ruffle-rs / ruffle

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

Mission Bielany: no textures, drawTriangles() with uvt data needed #14300

Open jan-adam opened 11 months ago

jan-adam commented 11 months ago

Describe the bug

Run .SWF file. Click "Kontynuuj" (Continue). Click "Kontynuuj" (Continue) again. Click "Nowa Gra" (New Game).

The graphics is broken. Only one line of pixels is visible on the screen. There should be 14 lines of text on the screen (introductory text to the game). Click the screen anywhere. The next graphics is also broken. Ruffle prints an error:

ERROR ruffle_core::avm2::events: Error dispatching event EventObject(EventObject { type: "loadSuccess", class: away3d.events::MaterialEvent, ptr: 0x15d0c1a9080 }) to handler FunctionObject(FunctionObject { ptr: 0x15d067fb150 }) : RustError("TypeError: null is not an Object")

Expected behavior

There should be 14 lines of text on the screen (introductory text to the game). When clicked, you should see a corridor. The text overlay should disappear when you click it again. Now it should be possible to navigate the game with the mouse.

Content Location

https://archive.org/download/test_mb2k2_pl_ruffle_dev/MB2K2_PL_ruffle_dev.zip

Affected platform

Desktop app

Operating system

Windows 10

Browser

No response

Additional information

Affected version: ruffle-nightly-2023_12_03-windows-x86_64

Flash Player Standalone works flawlessly.

Continuation of #9276 (the preloader issue was recently fixed). Now we need to fix the game startup after clicking New Game button.

jan-adam commented 11 months ago

Additional screenshots.

Ruffle

Click New Game, the following screen will appear.

2a

Click the screen anywhere.

2b

"Ładowanie" = "Loading" And this is where the application hangs. There is nothing further that can be done. The background sound works though.

Expected behavior - Flash Player

Click New Game, the following screen will appear.

1a

Click the screen anywhere.

1b

Click again.

1c

jan-adam commented 9 months ago

Tested with the latest version (ruffle-nightly-2024_01_28-windows-x86_64).

There is some progress. The error mentioned at the beginning (TypeError: null is not an Object) no longer exists. But the graphics are still displayed incorrectly and there is no image. Ruffle does not print any errors to the console.

Two interesting observations:

  1. After clicking "New game", the introductory text still does not appear correctly. But if I minimize the window and then restore it - the text will appear! Very interesting.

  2. I entered set RUST_LOG=warn,ruffle_core=debug,avm_trace=trace into the console and then I launched the program.

WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.utils.Dictionary constructor with weak keys
WARN run_frame: ruffle_core::stub: Encountered stub: AVM2 flash.display.Loader.load() addChild at the correct time
WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.system.Capabilities.language getter
WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.display.InteractiveObject.tabIndex setter
WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.display.DisplayObjectContainer.tabChildren setter
WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.display.DisplayObjectContainer.tabChildren getter
INFO run_frame:run_all_phases_avm2: ruffle_core::library: Loaded new device font "Times New Roman" from file
WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.text.TextField.useRichTextClipboard setter
WARN run_frame:run_all_phases_avm2: ruffle_core::stub: Encountered stub: AVM2 flash.text.TextField.mouseWheelEnabled setter
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upSkin
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name thumbUpSkin
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.InteractiveObject.tabEnabled getter
WARN ruffle_core::stub: Encountered stub: AVM2 flash.geom.Matrix3D.pointAt()
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name overSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name overIcon
INFO ruffle_core::focus_tracker: Focus is now on Some(MovieClip(MovieClip { ptr: 0x146b4cab600 }))
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name downSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name downIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name overIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name overIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name overIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name downIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name overIcon
WARN render: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.Graphics.drawGraphicsData() with uvt data
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.Graphics.drawGraphicsData() with null indices
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name trackUpSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upArrowDisabledSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name downArrowDisabledSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upArrowUpSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name downArrowUpSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name thumbUpSkin
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name upIcon
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name
WARN run_frame:run_all_phases_avm2: ruffle_core::avm2::globals::flash::display::display_object_container: Display object container has no child with name
Aaron1011 commented 9 months ago

The incorrect graphics are probably caused by the flash.geom.Matrix3D.pointAt() stub

jan-adam commented 9 months ago

I agree. Generally, the most important things in this log are 3 stubs:

WARN ruffle_core::stub: Encountered stub: AVM2 flash.geom.Matrix3D.pointAt()
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.Graphics.drawGraphicsData() with uvt data
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.Graphics.drawGraphicsData() with null indices

These stubs appear in other issues as well, for example pointAt() in 4 reported issues.

jan-adam commented 4 months ago

Tested with the latest version of Ruffle. There is slight progress:

Ruffle

You can navigate with the mouse, but you see an empty cube, no textures.

WARN ruffle_core::stub: Encountered stub: AVM2 flash.geom.Matrix3D.pointAt()
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.Graphics.drawTriangles() winding behavior
WARN ruffle_core::stub: Encountered stub: AVM2 flash.display.Graphics.drawTriangles() with uvt data

I'm surprised that mouse navigation works without flash.geom.Matrix3D.pointAt(). But still, textures are missing. Implementing flash.display.Graphics.drawTriangles() with uvt data is necessary for drawing textures.

jan-adam commented 4 months ago

I see that the needed feature may be finished soon.

https://github.com/ruffle-rs/ruffle/pull/16950