ruffle-rs / ruffle

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

Super Mario 63: Final battle hangs #10582

Open angelo-wf opened 1 year ago

angelo-wf commented 1 year ago

Describe the bug

The final battle with Bowser hangs in Ruffle. It gets stuck right at the start of it like this:

Scherm­afbeelding 2023-04-06 om 22 03 45

It looks like Mario gets stuck at the top of the screen (behind the power meter). The game is still running (it does not freeze, the background is still moving and animations keep going), but no input does anything except pausing with P.

The entire game seems to work fine up until this point (except for rendering issues, mainly with the text, but also some missing effect here and there like Metal Mario not showing up metallic at all).

I used the SWF File from runouw.com.

Here is the exported save data, which includes having unlocked a pipe to go straight to the final climb in Bowser's castle, 3 rooms away from the boss: SuperMarioSunshine128SavedFile.sol.zip.

Expected behavior

The final battle should work and not hang. Here is a video on Youtube showing the battle working.

Affected platform

Online demo

Operating system

macOS Ventura 13.3

Browser

Safari 16.4

Additional information

The following is logged to the console when the fight starts:

[Log] ERROR core/src/library.rs:215 Tried to instantiate non-registered character 8-16MidBG (339.index.js, line 1)
[Log] WARN core/src/avm1/globals/movie_clip.rs:682 Unable to attach '8-16MidBG' (339.index.js, line 1)
[Log] ERROR core/src/library.rs:215 Tried to instantiate non-registered character 8-16CloseBG (339.index.js, line 1)
[Log] WARN core/src/avm1/globals/movie_clip.rs:682 Unable to attach '8-16CloseBG' (339.index.js, line 1)
[Log] ERROR core/src/library.rs:215 Tried to instantiate non-registered character 8-16Puddle (339.index.js, line 1)
[Log] WARN core/src/avm1/globals/movie_clip.rs:682 Unable to attach '8-16Puddle' (339.index.js, line 1)
[Log] ERROR core/src/library.rs:215 Tried to instantiate non-registered character 8-16Ice (339.index.js, line 1)
[Log] WARN core/src/avm1/globals/movie_clip.rs:682 Unable to attach '8-16Ice' (339.index.js, line 1)
[Log] ERROR core/src/library.rs:215 Tried to instantiate non-registered character 8-16Water (339.index.js, line 1)
[Log] WARN core/src/avm1/globals/movie_clip.rs:682 Unable to attach '8-16Water' (339.index.js, line 1)
[Log] ERROR core/src/library.rs:215 Tried to instantiate non-registered character 8-16Lava (339.index.js, line 1)
[Log] WARN core/src/avm1/globals/movie_clip.rs:682 Unable to attach '8-16Lava' (339.index.js, line 1)
n0samu commented 1 year ago

Hi, your Pastebin link does not work. Can you please attach the file directly to your issue instead? You can attach the localstorage data as a text file, or you can download and attach the SOL file that the localstorage data represents using Ruffle's save manager (right-click => Open Save Manager).

angelo-wf commented 1 year ago

I updated the issue with the SOL file attached (zipped). (Not sure what happened to the Pastebin link, the link stored in my browser history stopped working as well.)

n0samu commented 1 year ago

Given how often Pastebin is abused by bad actors, I would bet that they check pastes to make sure they are not encoded binary files, and remove any that are. SOL is a binary format (AMF) and the localstorage data just stores that base64-encoded.

Anyway, thanks! One of our developers is already working on a fix for this issue, but your save file should be useful for testing/verification of the fix.

AL-Dawg commented 1 year ago

is there any way to fix this problem? Im dealing with the same problem

n0samu commented 1 year ago

Not yet, sorry!

edi960 commented 1 year ago

Is there a way to fix this issue on newgrounds I do not want to play all over again.

n0samu commented 1 year ago

You can download your save file using Ruffle's save manager. Right-click the game and click "Open Save Manager", then search for an entry called "SuperMarioSunshine128SavedFile" and download it

Vexxter9 commented 1 year ago

After loading that save data, here is how you get to the point where the bug happens:

Follow this route: https://cdn.discordapp.com/attachments/704769195749146634/1131606685262303272/2023-07-20_17-19-48.mp4 And then keep platforming upwards until you reach a slingstar, where you can press X to fly into the final bossfight, which is where the glitch happens

Dinnerbone commented 1 year ago

Research so far. I know nothing about this game so I'm somewhat going in blind 😅

I edited the swf to take me straight to the boss fight when you enter the castle. Not 100% sure if you need the save file too but I'd use it just to be safe.

I'm guessing it's an issue in startChar, it looks like it's supposed to teleport the character to the right place but doesn't?

_root.StartChar("8-16",0,-250,0,-350,100,_root.CurrentPlayer,_root.Fluddpow,"Fromwhite");
Vexxter9 commented 1 year ago

Maybe good to know is that in the practice hack for the game it skips the cutscene that normally plays before the fight. This makes it not softlock, but spawn Mario normally into the fight. This means the bug likely occurs at the end of the cutscene and not at the beginning of the fight

Here is a download link to the practice hack SWF: https://cdn.discordapp.com/attachments/614855396468719619/1131721275786662068/sm63prachack.swf

GTcreyon commented 1 year ago

I don't think the logged console output has anything to do with the issue at hand, since a similar issue occurs in other rooms too. It happens when certain layers of the room don't exist, which is normal in SM63.

Dinnerbone commented 1 year ago

From Mike:

something to do with base_clip and targets etc. when the base clip is deleted IIRC. I think it was telling something to ActionGotoFrame which requires the base clip to be right, but it wasn't, so that's when it soft-locked. But I might be misremembering

HunterBoy344 commented 1 year ago

Just wanted to say I have this issue as well. The game is so close to fully playable on Ruffle so I hope this gets fixed!!

ItsGamerBot47 commented 1 year ago

Having the same issue here. I tried looking for a way to load my saved game to the flash exe where runouw published the source code, and where is also the flash file, but I don't see a way to load the game and try this on another version of the game. As hunter said, hope this gets fixed, because this games was a great part of my childhood

n0samu commented 1 year ago

@ItsGamerBot47 I'd be happy to help you download your save file and load it into Flash Player, if you open a discussion or join our Discord server.

n0samu commented 1 year ago

@Herschel shared some more details about this bug a few months ago, which I'm reposting here in case anyone wants to pick it up:

The issue is in this code: DefineSprite 10379 frame 12.

_root.onEnterFrame = function()
{
CharCode();
};
_root.gotoAndStop("Courseframe");

The gotoAndStop destroys that clip, and then the CharCode() call doesn't work anymore, editing it to _root.CharCode() fixes it IIRC My ancient branch has scope.rs lines 150-161 commented out as a fix, so I believe that's involved -- that if is only falling back to root if it would resolve on self.locals(), but it should always do so My branch had changed Activation::get_variable to handle this case:

+        match self.resolve(path)? {
+            CallableValue::UnCallable(Value::Undefined) => {
+                let obj = self.target_clip_or_root().object().coerce_to_object(self);
+                if obj.has_property(self, path) {
+                    obj.get(path, self).map(|v| CallableValue::Callable(obj, v))
+                } else {
+                    Ok(CallableValue::UnCallable(Value::Undefined))
+                }
+            }
+            val => Ok(val),
+        }

Not sure this is 100% the correct fix (probably not, which is why I never made a PR!)

And he also shared a repro: deleted-clip-ef.zip

Also, changing the CharCode() call to _root.CharCode() indeed makes the game function as expected in Ruffle, as he thought.

Dogeyboy commented 11 months ago

Yeah I'm having the same problem. I do hope this gets fixed though, I really want to 100% the game and finish the final boss because this is a childhood game of mines.

GTcreyon commented 11 months ago

Not sure this is 100% the correct fix (probably not, which is why I never made a PR!)

Can anyone confirm this?