ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.45k stars 800 forks source link

Black screen after start button - https://www.4399.com/flash/79452_4.htm #16492

Open wsxarcher opened 3 months ago

wsxarcher commented 3 months ago

Describe the bug

When clicking start you just see a black screen and no clear errors:

WARN core\src\stub.rs:144 Encountered stub: AVM2 flash.display.Loader.unload()
69.js:1049 WARN core\src\stub.rs:144 Encountered stub: AVM2 flash.display.Loader.unloadAndStop()
69.js:1049 WARN core\src\stub.rs:144 Encountered stub: AVM2 flash.text.TextField.styleSheet setter
69.js:1049 WARN core\src\library.rs:556 Unknown device font "SimSun" (bold: false, italic: false)
69.js:1049 WARN core\src\library.rs:556 Unknown device font "Arial" (bold: true, italic: false)
69.js:1049 INFO web\src\log_adapter.rs:18 gameWid = 640
69.js:1049 INFO web\src\log_adapter.rs:18 gameHei = 480
69.js:1049 INFO web\src\log_adapter.rs:18 THE COOKIE 438
69.js:1049 INFO  estimating duration from bitrate, may be inaccurate for vbr files log.target = "symphonia_bundle_mp3::demuxer";log.module_path = "symphonia_bundle_mp3::demuxer";log.file = "C:\\Users\\marcobartoli\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\symphonia-bundle-mp3-0.5.4\\src\\demuxer.rs";log.line = 150;
69.js:1049 WARN  mpa: invalid main_data_begin, underflow by 91 bytes log.target = "symphonia_bundle_mp3::layer3";log.module_path = "symphonia_bundle_mp3::layer3";log.file = "C:\\Users\\marcobartoli\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\symphonia-bundle-mp3-0.5.4\\src\\layer3\\mod.rs";log.line = 86;
1169.js:1049 WARN  mpa: invalid main_data_begin, underflow by 91 bytes log.target = "symphonia_bundle_mp3::layer3";log.module_path = "symphonia_bundle_mp3::layer3";log.file = "C:\\Users\\marcobartoli\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\symphonia-bundle-mp3-0.5.4\\src\\layer3\\mod.rs";log.line = 86;

Expected behavior

Load the game

Content Location

https://www.4399.com/flash/79452_4.htm

Affected platform

Browser's extension

Operating system

Window 11

Browser

Edge/Chrome 125

Additional information

This game is part of a bigger effort to support 4399.com games. There might be other issues with this website, from how it handles Flash checks and many CORS issues. Unfortunately, some games cannot be easily debugged on desktop because the swf download other swf or do requests while logged in.

If Ruffle is not detected try to reload the page multiple times because of the known race condition on the Flash check. To avoid refreshing try this Tampermonkey user script 一键下载 flash 游戏 (greasyfork.org)

To solve these issues refers to previous issues such as:

Dinnerbone commented 3 months ago

The game thinks its pirated and has its site-locking mechanism triggered.

The code:

var _loc1_:* = ["hiulit.com","dev.my4399.com","edit.4399.com","test.4399.com","sda.4399.com","szhong.4399.com","sxiao.4399.com","s8.4399.com","mycdnaa.4399.com","www.miniclip.com.4399pk.com","nitrome.com.4399.com"];
var _loc2_:String = loaderInfo.loaderURL;
var _loc3_:* = false;
var _loc4_:* = 0;
while(_loc4_ < _loc1_.length)
{
  if(_loc2_.lastIndexOf(_loc1_[_loc4_]) > 0)
  {
     _loc3_ = true;
  }
  _loc4_++;
}
if(_loc3_ == false)
{
  this.x += 340;
  this.y += 1000 + 1000 * Math.random();
}

The loaderInfo.loaderURL is "https://cdn.comment.4399pk.com/control/A4399dv_base_main.swf?20200714" which doesn't match

Unsure if it's a bug in our code (are we using the wrong loader url somehow?) or the websites (maybe they moved stuff to a new cdn over the last decade and it just broke...?)

Dinnerbone commented 3 months ago

Confirmed to work with Flash Player, likely a bug in how we're calculating which url the loader swf is from

riku-42 commented 1 month ago

Hi @Dinnerbone, I am debugging this issue and would like to know how to obtain the ActionScript code and locate the issue here. Are there any debugging guidance documents available?

wsxarcher commented 1 month ago

Also getting this error from JS


Error setting ExternalInterface legacy callback for setloaded TypeError: Cannot redefine property: setloaded
    at Function.defineProperty (<anonymous>)
    at InnerPlayer.onCallbackAvailable (ruffle-player-element.js:37:1)
    at imports.wbg.__wbg_onCallbackAvailable_03c42ccb24ed8e42 (ruffle_web-wasm_extensions.js:1079:1)
    at ruffle_web.wasm.<ruffle_web::external_interface::JavascriptInterface as ruffle_core::external::ExternalInterfaceProvider>::on_callback_available::h49a48853f8095b45 (ruffle_web.wasm-03468bb6:0x9f3915)
    at ruffle_web.wasm.ruffle_core::external::ExternalInterface::add_callback::h8d31506313cb973d (ruffle_web.wasm-03468bb6:0x60a739)
    at ruffle_web.wasm.ruffle_core::avm2::globals::flash::external::external_interface::add_callback::ha168eccf645cd7a6 (ruffle_web.wasm-03468bb6:0x70ce2c)
    at ruffle_web.wasm.ruffle_core::avm2::function::exec::hdc9b57918a65a3a8 (ruffle_web.wasm-03468bb6:0x2f51d8)
    at ruffle_web.wasm.ruffle_core::avm2::object::TObject::call_method::h4170af685db0047b (ruffle_web.wasm-03468bb6:0x628f53)
    at ruffle_web.wasm.ruffle_core::avm2::object::TObject::call_property::h9c602950884f5b72 (ruffle_web.wasm-03468bb6:0x5bb775)
    at ruffle_web.wasm.ruffle_core::avm2::activation::Activation::run_actions::h47e026f956487046 (ruffle_web.wasm-03468bb6:0x5e96f)```
Dinnerbone commented 1 month ago

Hi @Dinnerbone, I am debugging this issue and would like to know how to obtain the ActionScript code and locate the issue here. Are there any debugging guidance documents available?

There's some details in the contribution guidelines - https://github.com/ruffle-rs/ruffle/blob/master/CONTRIBUTING.md

To view code, we recommend JPEXS FFDEC.

You can also ask on discord for help!

Dinnerbone commented 1 month ago

Also getting this error from JS

It's ignorable, won't affect anything - but I'll make a PR to fix it anyway