ruffle-rs / ruffle

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

Given examples compiled with Adobe CrossBridge either dont boot or crash the webpage/desktop ea #15392

Open FlashBacks1998 opened 5 months ago

FlashBacks1998 commented 5 months ago

Describe the bug

I have some .swf(s) examples when trying to find more infomation on what CrossBridge is (a program made to compile c++ into .swf). There were some bugs that I want to report.

One of the main crashes can be found in CModules/NeHe Gamedev Tutorials (labeled cmodule_lession#.swf) as none of the examples work, they just boot to a blank white screen. In the console it looks like theres an error whenever Ruffle tries to dispatch Event.COMPLETE in the preloader to the given variable Console causing the main application to never open. These examples work in the Flash Player 32. Loading SWF data ruffle_web-wasm_extensions-5Nv9_fAv.js:2 ERROR core/src/avm2/events.rs:428 Error dispatching event EventObject(EventObject { type: "complete", class: flash.events::Event, ptr: 0xdb7d28 }) to handler FunctionObject(FunctionObject { ptr: 0xd7d0e8, name: Ok("com.adobe.flascc.preloader::DefaultPreloader/onPreloaderComplete()") }) : ReferenceError: Error #1065: Variable Console is not defined.

Another example StarlingFilters by VPMedia (labeled vpmedia_starlingfilters.swf) will not only cause the Ruffle desktop application to crash, but will cause the webpage Ruffle is hosted on to become unusable (I cant even click on anything). Looking at the console I get all kinds of webgpu-webgl performance warnings. Specifically performance warning: READ-usage buffer was read back without waiting on a fence. This caused a graphics pipeline stall. was outputted 256 times in an instant. Loading SWF data ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.utils.Dictionary constructor with weak keys ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display3D.Context3D.driverInfo getter ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.text.TextBlock.createTextLine() ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/library.rs:548 Unknown device font "Times New Roman" (bold: false, italic: false) ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.text.engine.TextLine.ascent getter ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.text.engine.TextLine.descent getter ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.text.engine.TextLine.validity getter 256performance warning: READ-usage buffer was read back without waiting on a fence. This caused a graphics pipeline stall. ruffle_web-wasm_extensions-5Nv9_fAv.js:2 WebGL: too many errors, no more errors will be reported to the console for this context. Q.n.wbg.__wbg_getBufferSubData_42fbdf01d4c31560 @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 $wgpu_hal::gles::adapter::<impl wgpu_hal::gles::AdapterShared>::get_buffer_sub_data::h43cb713709fcb672 @ 039a1976:0x9a9e59 $wgpu_hal::gles::device::<impl wgpu_hal::Device<wgpu_hal::gles::Api> for wgpu_hal::gles::Device>::map_buffer::h0267d14ceebf68d5 @ 039a1976:0x730921 $wgpu_core::device::map_buffer::h6d0fae34b9f14821 @ 039a1976:0x58f58e $wgpu_core::device::resource::Device<A>::maintain::haf729e3b304426bf @ 039a1976:0x56129b $<T as wgpu::context::DynContext>::device_poll::h974f733156f5af51 @ 039a1976:0xa65d95 $ruffle_render_wgpu::utils::capture_image::h26b090350e5504b7 @ 039a1976:0x8374ac $<ruffle_render_wgpu::backend::WgpuRenderBackend<T> as ruffle_render::backend::RenderBackend>::resolve_sync_handle::he6893499d4aa92e6 @ 039a1976:0x91f547 $ruffle_core::bitmap::bitmap_data::wrapper::BitmapDataWrapper::sync::h7b81c75b9482a055 @ 039a1976:0x8dbfc7 $ruffle_core::avm2::globals::flash::display3D::textures::texture::upload_from_bitmap_data::h931c3042e936e73f @ 039a1976:0x6f1e9e $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x338234 $ruffle_core::avm2::object::TObject::call_property::hd08d6b80fd7c54cc @ 039a1976:0x4a8e75 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708a56 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h436dead1a5b0ee19 @ 039a1976:0x498884 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708957 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x39126 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call::h3318af562f2e00bb @ 039a1976:0x3bdb92 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x39a06 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::class_object::ClassObject::call_super::h3cac67718f5809aa @ 039a1976:0x6eb029 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x381ff $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call::h3318af562f2e00bb @ 039a1976:0x3bdb92 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x39a06 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::class_object::ClassObject::call_super::h3cac67718f5809aa @ 039a1976:0x6eb029 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x381ff $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $ruffle_core::avm2::object::TObject::call_property::h1c392a61384e836d @ 039a1976:0x4980f3 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708869 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call::h3318af562f2e00bb @ 039a1976:0x3bdb92 $ruffle_core::avm2::events::dispatch_event_to_target::hd6355ac569529ad3 @ 039a1976:0x3d15b1 $ruffle_core::avm2::events::dispatch_event::hb6eda2a7c7c5a752 @ 039a1976:0x47a2e0 $ruffle_core::avm2::globals::flash::events::event_dispatcher::dispatch_event::h547634073df75a97 @ 039a1976:0x8ceec7 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x338234 $ruffle_core::avm2::object::TObject::call_property::h3778d4da2e35699e @ 039a1976:0x4845ee $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_public_property::h0d7eb09b3f51525f @ 039a1976:0x1dfd3d $ruffle_core::avm2::globals::flash::display::stage_3d::request_context3d_internal::hff6b5ac041ba7e4c @ 039a1976:0x476bcb $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x338234 $ruffle_core::avm2::object::TObject::call_property::h3778d4da2e35699e @ 039a1976:0x4845ee $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call_property::h016cd4c3ad040f20 @ 039a1976:0x708a12 $ruffle_core::avm2::activation::Activation::run_actions::h2791e334b6bf18be @ 039a1976:0x38b97 $ruffle_core::avm2::function::Executable::exec::h8f52860b7770c3eb @ 039a1976:0x337e27 $<ruffle_core::avm2::object::Object as ruffle_core::avm2::object::TObject>::call::h3318af562f2e00bb @ 039a1976:0x3bdb92 $ruffle_web::Ruffle::tick::h928bfc2502629bdc @ 039a1976:0x315b6e $ruffle_web::Ruffle::new_internal::{{closure}}::{{closure}}::{{closure}}::h78e5658c5c8010a5 @ 039a1976:0xaf6c58 $wasm_bindgen::convert::closures::invoke1_mut::h1719b46e70956c35 @ 039a1976:0xac02bd ee @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 c @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 requestAnimationFrame (async) (anonymous) @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 f @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 Q.n.wbg.__wbg_requestAnimationFrame_1820a8e6b645ec5a @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 $ruffle_web::Ruffle::tick::h928bfc2502629bdc @ 039a1976:0x30d422 $wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}::hfb74def201f83728 @ 039a1976:0x5e42d0 $wasm_bindgen_futures::queue::Queue::new::{{closure}}::h462622a7166234af @ 039a1976:0x7e1200 $<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h6430564868658030 @ 039a1976:0xac08bb $closure8577 externref shim @ 039a1976:0xacbced _e @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 c @ ruffle_web-wasm_extensions-5Nv9_fAv.js:2 ruffle_web-wasm_extensions-5Nv9_fAv.js:2 ERROR core/src/avm2/events.rs:428 Error dispatching event EventObject(EventObject { type: "context3DCreate", class: flash.events::Event, ptr: 0x1885468 }) to handler FunctionObject(FunctionObject { ptr: 0x187ada8, name: Ok("starling.core::Starling/onContextCreated()") }) : RustError("A script in this movie has taken too long to execute and has been terminated.") ruffle_web-wasm_extensions-5Nv9_fAv.js:2 ERROR core/src/avm2/events.rs:428 Error dispatching event EventObject(EventObject { type: "enterFrame", class: flash.events::Event, ptr: 0x1886df8 }) to handler FunctionObject(FunctionObject { ptr: 0x187a1b0, name: Ok("starling.core::Starling/onEnterFrame()") }) : RustError("A script in this movie has taken too long to execute and has been terminated.") ruffle_web-wasm_extensions-5Nv9_fAv.js:2 ERROR core/src/avm2/events.rs:428 Error dispatching event EventObject(EventObject { type: "enterFrame", class: flash.events::Event, ptr: 0x2ba6d28 }) to handler FunctionObject(FunctionObject { ptr: 0x187a1b0, name: Ok("starling.core::Starling/onEnterFrame()") }) : RustError("A script in this movie has taken too long to execute and has been terminated.")

Expected behavior

Capture workingPNG

Content Location

https://web.archive.org/web/20160305062932/http://www.cmodule.org/nehe/ https://web.archive.org/web/20161109061226/http://www.vpmedia.hu/crossbridge/starlingfilters/

examples.zip

Affected platform

Online demo

Operating system

Windows 10

Browser

Brave

Additional information

Also tested in Ruffle Desktop

adrian17 commented 5 months ago

Issue one is a vaguely known but not-yet-understood ordering issue.

Basically,

         gotoAndStop(2); // contains DoABC tag for Console
         new Console(this);

The hang in the second issue appears like a blocking GPU wait issued after every call to uploadFromBitmapData(); this definitely feels like something we should avoid, but I have no clue if the graphics APIs we use actually make it possible. firefox_2024-03-02_12-59-49