ruffle-rs / ruffle

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

Black screen - https://www.4399.com/flash/152162_3.htm #16478

Closed wsxarcher closed 4 days ago

wsxarcher commented 2 months ago

Describe the bug

Black screen and no errors.

If timeout is set it seems it gets stuck long time here

ERROR core\src\avm2\activation.rs:846 STACK TRACE   at citrus.utils::SoundChannelUtil$/maxAvailableChannels()   at citrus.sounds::CitrusSoundInstance$cinit()   at global$init() [TU=frame2]    at citrus.sounds::CitrusSound() at citrus.sounds::SoundManager/addSound()   at systems::SoundSystem/init()  at systems::SoundSystem()   at Game$/init() at Main/init()  at flash.display::DisplayObjectContainer/flash::display::DisplayObjectContainer::addChild() at PreloaderPure/startup()  at PreloaderPure/checkFrame()

Expected behavior

Load the game

Content Location

https://www.4399.com/flash/152162_3.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 2 months ago
      public static function maxAvailableChannels() : uint
      {
         var _loc1_:Vector.<SoundChannel> = new Vector.<SoundChannel>();
         var _loc2_:uint = 0;
         while((soundChannel = soundCheck.play(0,0,silentST)) != null)
         {
            _loc1_.push(soundChannel);
         }
         _loc2_ = _loc1_.length;
         while((soundChannel = _loc1_.pop()) != null)
         {
            soundChannel.stop();
         }
         _loc1_.length = 0;
         return _loc2_;
      }

I guess at some point play() should not succeed, as we're emulating hardware channels in a software mixer. @torokati44 maybe you'd know what a "reasonable" limit would be here?

Dinnerbone commented 2 months ago

On my machine I'm getting 32, maybe we use that?!

Dinnerbone commented 2 months ago

Ah, AS3 docs actually say it's hardcoded to 32

The maximum number of sound channels available at once is 32.