ruffle-rs / ruffle

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

Learn To Fly 3 - Stuck after Clicking on Story Mode #10552

Closed desertking closed 1 year ago

desertking commented 1 year ago

Describe the bug

Loading SWF file https://www.spiele-umsonst.de/azad/downloads/flashgames/learntofly3.swf ruffle_web-wasm_extensions.js:681 ERROR core/src/avm2/events.rs:419 Error dispatching event EventObject(EventObject { type: "enterFrame", class: flash.events::Event, ptr: 0x70f0d60 }) to handler FunctionObject(FunctionObject { ptr: 0x5a4bf80 }) : RustError("VerifyError: Trait concat in class ColorMatrix has same name as trait concat in class Array, but does not override it")

Here is the error I get when I want to start the story mode

Expected behavior

Start it?

Affected platform

Online demo

Operating system

All

Browser

All

Additional information

No response

Lord-McSweeney commented 1 year ago

Should be fixed by #10543.

n0samu commented 1 year ago

@Lord-McSweeney now the error is:

ERROR run_frame:run_all_phases_avm2: ruffle_core::avm2::events: Error dispatching event EventObject(EventObject { type: "enterFrame", class: flash.events::Event, ptr: 0x1e32ff5b8b0 }) to handler FunctionObject(FunctionObject { ptr: 0x1e32c259100 }) : ArgumentError: Error #1063: Argument count mismatch on  on index 0.
        at flash.filters::ColorMatrixFilter/set matrix()
        at flash.filters::ColorMatrixFilter()
        at %,::>&$/?C()
        at src.gui::LoadGameMenuSlot/updateFromState()
        at src.gui::NewGameSlotSelect()
        at src.gui::MainMenuController/gotoNewGameSlotSelect()
        at src.gui::NewGameMenu/goToNextScreen()
        at src.gui::NewGameMenu/finishMenu()
        at org.osflash.signals::Slot/execute()
        at org.osflash.signals::OnceSignal/dispatch()
        at src.gui.decorators::TweenPos/tick()
        at org.osflash.signals::Slot/execute()
        at org.osflash.signals::OnceSignal/dispatch()
        at src::Main/enterFrameTick()

Maybe we still have something wrong in our implementation?

n0samu commented 1 year ago

Hmm, well the game is instantiating a custom com.gskinner.geom.ColorMatrix class which extends Array, then passing that to the ColorMatrixFilter constructor. I guess that must be related?

Lord-McSweeney commented 1 year ago

This issue is because Ruffle's flash.filters.ColorMatrixFilter's set matrix() method expects for the array _matrix to be a base Array- the concat method on the base array has an optional argument. However, com.gskinner.geom.ColorMatrix extends Array (so it is a valid array), but its concat method requires an argument. The set matrix() method of Ruffle's implementation of flash.filters.ColorMatrixFilter should ideally find another way to make a copy of the array than relying on the array having functional instance methods such as concat.

It should also coerce the array contents to Numbers, and pad/crop the array to 20 items.