ruffle-rs / ruffle

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

causality 2 won't start #14793

Open zohebnsr opened 5 months ago

zohebnsr commented 5 months ago

Describe the bug

When I click the Play or Rules button, Nothing happens. I checked the Flash content and it seems to have all the assets, but those assets are under binary data options as 10 different SWF files. So, the Rules should be able to pull the SWF with instructions and play it. In the same way, Play button should pull another SWF from that binaryData. (I am just trying to guess how it should do, not an expert here).

I have attached the SWF file if you can have a look Causality-2 2.swf.zip

Expected behavior

Load the level when clicking on Play. Load the Rules when clicking on Rules.

Content Location

I have attached it as zip file.

Affected platform

Online demo

Operating system

macOS, Windows

Browser

Google Chrome 120

Additional information

NA

Lord-McSweeney commented 5 months ago

No stub warnings or errors are logged.

n0samu commented 5 months ago

I've added some trace statements to the SWF to make it easier to understand what's going on: Causality2_trace.zip

The menu is in the embedded SWF DefineBinaryData (8: com.netsource.game.causality.Game_menuClass_dataClass). The Play button is DefineButton2 (15: com.netsource.game.causality.helpers.buttons.StartGameButton). The com.netsource.game.causality.helpers.button class has this code:

    public class StartGameButton extends SimpleButton {
        public function StartGameButton() {
            super();
            addEventListener(MouseEvent.MOUSE_DOWN,this.clicked);
        }

        public function clicked(param1:MouseEvent) : void {
                        trace("Clicked button"); // trace added
            var _loc2_:GameEvent = new GameEvent(GameEvent.NEXT_LEVEL);
            dispatchEvent(_loc2_);
        }
    }

The "Clicked button" trace does appear, but nothing happens after GameEvent.NEXT_LEVEL is fired. The listener for the NEXT_LEVEL event is supposed to be added in the main SWF's applyListeners() function in com.netsource.game.causality.Game. But the applyListeners() function is never called. That's supposed to happen in the loadFinished function, which is triggered by a COMPLETE listener on a Loader:

            trace("Added COMPLETE listener to Loader"); // trace added
            this.loader.addEventListener(Event.COMPLETE,this.loadFinished);
            this.loader.Load();

So the root cause of the issue is that the Loader is not firing its COMPLETE event.