ruffle-rs / ruffle

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

Error Dispatching EventObject on: https://gamemaker3d.com/editor/index_flash.html #11789

Open cyberix-3d opened 1 year ago

cyberix-3d commented 1 year ago

Describe the bug

I'm experiencing an issue with the following link: https://www.gamemaker3d.com/editor/index_flash.html When I access it, I receive the following error message: ERROR core/src/avm2/events.rs:419 Error dispatching event EventObject(EventObject { type: "complete", class: flash.events::Event, ptr: 0x3c405dc }) to handler FunctionObject(FunctionObject { ptr: 0x55236c }) : RustError("Cannot set prototype of class to null or undefined")

Additionally, there are multiple errors related to accessing SWZ files from Adobe. These errors are occurring due to CORS restrictions:

Access to fetch at 'https://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/framework_4.6.0.23201.swz' from origin 'https://www.gamemaker3d.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
339.js:1348     GET https://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/framework_4.6.0.23201.swz net::ERR_FAILED 200

Access to fetch at 'https://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz' from origin 'https://www.gamemaker3d.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
339.js:1348     GET https://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz net::ERR_FAILED 200

I kindly request your assistance in resolving these issues. Thank you in advance.

Expected behavior

I expected the link to load without any errors and for the event dispatching of the EventObject to be handled successfully without any issues.

Affected platform

Desktop app

Operating system

Windows 10

Browser

Google chrome 114

Additional information

No response

n0samu commented 1 year ago

Hi, it looks like you included the needed SWZ files on your site, and Ruffle is correctly falling back to those, so there is no problem there. As for the AVM2 error you mentioned, it's most likely caused by a problem that happened earlier. For example, a variable that is supposed to have a value may not have been properly initialized by Ruffle.

There are also a lot of warnings like this:

WARN core/src/display_object/movie_clip.rs:862 Got AVM2 error ReferenceError: Error #1069: Property mx.core::ByteArrayAsset not found on global and there is no default value.
    at global$init() [TU=frame2] when attempting to assign symbol class feathers.themes.AzureMobileTheme_ATLAS_FONT_XML`

I also see some mentions of classes like:

I wonder if that means your app embeds its own mini ActionScript VM / parser. If so, that's scary advanced! Overall this looks like exactly the kind of super-complex application that will take longest for Ruffle to be able to support.

Lord-McSweeney commented 1 year ago

This issue is because mx.core::ByteArrayAsset doesn't need to actually be looked up until the class that extends it is instantiated, by which time ByteArrayAsset will be defined by loaded SWZ files (specifically framework_4.6.0.23201.swz). This should be resolved in the ClassObject refactor.

Lord-McSweeney commented 10 months ago

This spits out a bunch of errors now, and many visual elements are missing, but it now manages to finish loading.

Lord-McSweeney commented 5 months ago

This has progressed, but now panics:

panicked at core/src/avm2/vtable.rs:170:58:
index out of bounds: the len is 2 but the index is 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
AVM2 stack trace: 
    at Function/nsEquals()
    at Parse::Rib/openNamespace()
    at Parse::Context/pushNamespace()
    at Parse::Parser/program()
    at Function/compile()
    at com.hurlant.eval::CompiledESC/eval()
    at Eval/compile()
    at Eval/run()
    at MethodInfo-1437()
    at Cyberix3DEngine/RemoveLoadingFunc()
    at MethodInfo-1529()

This is probably unrelated to the optimizer since it still happens with --no-avm2-optimizer: the issue is more likely that we aren't doing the slot_id bounds check in Object::set_slot.

cyberix3d2 commented 2 months ago

Now it is not causing a panic, which is a good progress!

However, I’ve encountered another problem when submitting a request to the AMF PHP server. The server returns a “service not found” error, even though everything worked fine when using Flash.

Could you please look into this issue?

Thank you!

https://www.gamemaker3d.com/editor/index_flash.html

Screenshot 2024-06-16 at 13 47 49
Aaron1011 commented 2 months ago

This is currently blocked on several things: