ruffle-rs / ruffle

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

Does not load - http://game.4399iw.com/yxsgkd/tpl-sid-1914-site-3_1-channel-my-randsj-0.10302402100689978?rand=0.539712809400281 #15016

Open wsxarcher opened 7 months ago

wsxarcher commented 7 months ago

Describe the bug

Game stops loading at 100%

ERROR core/src/avm2/events.rs:428 Error dispatching event EventObject(EventObject { type: "complete", class: br.com.stimuli.loading::BulkProgressEvent, ptr: 0x7eebf58 }) to handler FunctionObject(FunctionObject { ptr: 0x674ab60, name: Ok("resource::#*_4803/onAllItemsLoaded()") }) : RustError("A script in this movie has taken too long to execute and has been terminated.")

Expected behavior

Load the game

Content Location

http://game.4399iw.com/yxsgkd/tpl-sid-1914-site-3_1-channel-my-randsj-0.10302402100689978?rand=0.539712809400281 Select server from https://my.4399.com/yxsgkd/ (link to https does not work because of mixed content, force http like the link above)

Affected platform

Browser's extension

Operating system

Window 11

Browser

Edge/Chrome 120

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

Stacktrace when it stalls:

    at #*_11080::!_323$/#*_8221()
    at resource::#*_4798/#*_4378()
    at resource::#*_4803/onAllItemsLoaded()
    at flash.events::EventDispatcher/flash::events::EventDispatcher::dispatchEvent()
    at br.com.stimuli.loading::BulkLoader/_onAllLoaded()
    at br.com.stimuli.loading::BulkLoader/_onItemComplete()
    at flash.events::EventDispatcher/flash::events::EventDispatcher::dispatchEvent()
    at br.com.stimuli.loading.loadingtypes::LoadingItem/onCompleteHandler()
    at br.com.stimuli.loading.loadingtypes::ImageItem/onCompleteHandler()

Relevant codes:

      private function onAllItemsLoaded(param1:Event) : void
      {
         if(§!_282§.IS_OFFLINE_VIDEO)
         {
            this.m_stTimer.stop();
            this.CallBackStartFun(0);
         }
         this.§#*_581§.removeEventListener(BulkLoader.COMPLETE,this.onAllItemsLoaded);
         if(CONFIG.§#*_412§)
         {
            ResourceLoadMonitor.§#*_4953§().§#*_4350§();
            this.m_stZipFile.addEventListener(§#*_4798§.§#*_579§,this.§#*_4799§);
            this.m_stZipFile.§#*_4378§(this.§#*_581§.getContent("configzip")); // <----- HERE
         }
         else
         {
            this.§#*_4799§(null);
         }
      }

      public function §#*_4378§(param1:ByteArray) : void
      {
         var _loc2_:ByteArray = null;
         var _loc3_:§!_362§ = null;
         var _loc4_:String = null;
         var _loc5_:ByteArray = null;
         var _loc6_:int = 0;
         var _loc7_:int = 0;
         var _loc8_:int = 0;
         if(CONFIG.§#*_413§)
         {
            _loc2_ = new ByteArray();
            _loc3_ = new §!_362§();
            _loc4_ = §!_282§.§!_363§;
            _loc3_.decode(_loc4_);
            (_loc5_ = _loc3_.toByteArray()).position = 0;
            _loc6_ = getTimer();
            _loc7_ = int(§!_323§.§#*_8221§(param1,_loc2_,_loc5_,uint(-8))); // <----- HERE
            _loc8_ = getTimer() - _loc6_;
            param1 = _loc2_;
         }
         this.m_stZip.addEventListener(Event.COMPLETE,this.§#*_4799§);
         this.m_stZip.addEventListener(IOErrorEvent.IO_ERROR,this.§#*_4800§);
         this.m_stZip.loadBytes(param1);
      }

      public static function §#*_8221§(param1:ByteArray, param2:ByteArray, param3:ByteArray, param4:uint) : uint
      {
         var _loc5_:int = 0;
         var _loc6_:* = 0;
         param1.endian = Endian.LITTLE_ENDIAN;
         param2.endian = Endian.LITTLE_ENDIAN;
         param3.endian = Endian.LITTLE_ENDIAN;
         if(param1 == null || param1.length <= 0)
         {
            return 0;
         }
         param1.position = 0;
         if(param1.length <= 8 || Boolean(param1.length % §#*_2282§))
         {
            return 0;
         }
         var _loc7_:uint = 0;
         var _loc8_:uint = 0;
         var _loc9_:ByteArray = new ByteArray();
         xtea(param1,_loc9_,param3,param4);
         _loc7_ += §#*_2282§;
         _loc9_.position = 0;
         var _loc10_:* = _loc9_.readByte() & 7;
         var _loc11_:uint;
         if((_loc11_ = uint(param1.length - 1 - _loc10_ - §#*_2279§)) <= 0 || param2 == null)
         {
            return 0;
         }
         param2.position = 0;
         _loc9_.position = 1 + _loc10_;
         _loc5_ = 0;
         while(_loc5_ < §#*_2282§ - 1 - _loc10_)
         {
            param2.writeByte(_loc9_.readByte());
            _loc5_++;
         }
         _loc8_ += §#*_2282§ - 1 - _loc10_;
         var _loc12_:ByteArray;
         (_loc12_ = _loc9_).position = 0;
         var _loc13_:ByteArray = new ByteArray();
         while(_loc7_ < param1.length - 8)
         {
            param2.position = _loc8_ - §#*_2282§;
            param1.position = _loc7_;
            _loc13_.position = 0;
            _loc5_ = 0;
            while(_loc5_ < §#*_2282§)
            {
               _loc13_.writeByte(param1.readByte() ^ _loc12_.readByte());
               _loc5_++;
            }
            _loc13_.position = 0;
            param2.position = _loc8_;
            xtea(_loc13_,param2,param3,param4);
            param1.position = _loc7_ - §#*_2282§;
            param2.position = _loc8_;
            _loc5_ = 0;
            while(_loc5_ < §#*_2282§)
            {
               _loc6_ = param2.readByte() ^ param1.readByte();
               --param2.position;
               param2.writeByte(_loc6_);
               _loc5_++;
            }
            _loc12_ = param2;
            _loc7_ += §#*_2282§;
            _loc8_ += §#*_2282§;
         }
         var _loc14_:ByteArray = new ByteArray();
         param2.position = _loc8_ - §#*_2282§;
         param1.position = _loc7_;
         _loc13_.position = 0;
         _loc5_ = 0;
         while(_loc5_ < §#*_2282§)
         {
            _loc13_.writeByte(param1.readByte() ^ _loc12_.readByte());
            _loc5_++;
         }
         _loc13_.position = 0;
         _loc14_.position = 0;
         xtea(_loc13_,_loc14_,param3,param4);
         param1.position = _loc7_ - §#*_2282§;
         _loc14_.position = 0;
         _loc5_ = 0;
         while(_loc5_ < §#*_2282§)
         {
            _loc6_ = _loc14_.readByte() ^ param1.readByte();
            --_loc14_.position;
            _loc14_.writeByte(_loc6_);
            _loc5_++;
         }
         _loc14_.position = 1;
         while(_loc14_.bytesAvailable > 0)
         {
            if(_loc14_.readByte() != 0)
            {
               return 0;
            }
         }
         param2.position = _loc8_;
         _loc14_.position = 0;
         param2.writeByte(_loc14_.readByte());
         param1.endian = Endian.BIG_ENDIAN;
         param2.endian = Endian.BIG_ENDIAN;
         param3.endian = Endian.BIG_ENDIAN;
         return _loc11_;
      }

Seems to be creating a zip file, based on the names?

wsxarcher commented 2 months ago

Seems to use direct sockets too

WARN web/src/navigator.rs:388 Missing WebSocket proxy for host 124.222.1.48, port 844
69.js:1288 WARN web/src/navigator.rs:388 Missing WebSocket proxy for host 124.222.1.48, port 80