ruffle-rs / ruffle

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

Twister Ice Fun (also known as Twister Game) hangs while loading the level. #6707

Open fsvgm777 opened 2 years ago

fsvgm777 commented 2 years ago

Describe the bug

In Ruffle, the game hangs on this screen upon clicking on "HRÁT": image

Expected behavior

The game is supposed to load the level proper upon clicking on "HRÁT".

Affected platform

Desktop app

Operating system

Windows 10 x64

Browser

No response

Additional information

It should be noted that Adobe Flash Player does not have the issue.

The game itself comes with an external game.dat, which I might assume it tries to load upon clicking on "HRÁT", but it doesn't load it in Ruffle.

Here's a ZIP with the game and the game.dat twistergame.zip :

Herschel commented 2 years ago

The game.dat variables are loaded into _root, but the game.dat includes: ...&constructor=[type Function]&__proto__=[object Object]&... which wipes out the proto of _root and causes havoc. Deleting those variables from game.dat causes the game to function.

When proto gets stomped, _root.gotoAndStop(5); has no effect, and the loading screen gets stuck.

Herschel commented 2 years ago

Looked into this a bit more, and the Flash Player behavior is really bizarre. Display objects in AVM1 seem to be able to "heal" their proto property:

Sample:

trace(_root.__proto__); // [object Object]
_root.__proto__ = "bad";
trace(_root.__proto__); // "bad"
trace(_root.__proto__.gotoAndStop); // undefined

trace(_root.gotoAndStop); // [type Function] -- proto healed???

trace(_root.__proto__); // [object Object]
trace(_root.__proto__.gotoAndStop); // [type Function]

proto-healing.zip

Likely I'm missing some part of the behavior here, so this needs more investigation.