ruffle-rs / ruffle

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

Mata Nui Online Game (MNOG): Certain looping background audio is not stopped between scene switches #4067

Open CounterPillow opened 3 years ago

CounterPillow commented 3 years ago

Describe the bug

The Flash game "Mata Nui Online Game" exhibits a particular problem in which the looping background audio of certain scenes is not stopped after a scene switch. "Scene" here referring to what appear to be separate .swf files the player loads.

To reproduce:

  1. Download the game from here (this at least is the particular version I'm using): https://fratti.ch/tmp/MataNuiOnlineGame-BuiltInSave.zip
  2. Run ruffle player.swf in the matanui subdirectory
  3. Play the game as follows: https://fratti.ch/bugdemos/ruffle/mnog_ruffle.mp4
  4. Notice how the underwater ambient track never disappears after leaving the water

Some other background tracks in the demonstration video are affected, e.g. the waterfall noise. However, the underwater ambience is the most noticeable one.

As the player progresses through the game, the tracks will begin to stack into an unholy cacophony of compressed flash audio.

Expected behavior Upon leaving the water, the ambient track should disappear as it does when running player.swf with Flash Projector: https://fratti.ch/bugdemos/ruffle/mnog_flash.mp4

Is the problem with the Ruffle desktop app, extension, or self-hosted version?

Ruffle desktop:

$ ruffle -V
Ruffle 0.1.0-nightly (46ddc312 2021-04-19)

Latest version with which I have reproduced the issue (I'll keep updating this):

$ ruffle -V
Ruffle 0.1.0-nightly (5135b140 2021-06-08)

What platform are you using?

Linux x86_64

CounterPillow commented 3 years ago

Looks like here's what's happening:

In V.6.swf (the lilypad hut with the hole), clicking on the hole (character id 35) sets

Music_ChangeMusic = "1";
Music_Movie = "Music_Underwater.swf";

before loading VI.1-E.swf, our first underwater scene.

Clicking on the hole back up in VI.1-E.swf, namely character id 72, we execute the following:

Music_ChangeMusic = "1";
Music_Movie = "blank.swf";

blank.swf in this case is literally just a blank SWF file, it seems.

What do these variables trigger? In player.swf, Frame 29:

   if(Music_ChangeMusic eq "1")
   {
      loadMovie(Music_Movie,"/Music-holder");
      Music_ChangeMusic = "0";
   }

So a loadMovie call replaces the movie in the /Music-holder (character id 1 in player.swf?). Replacing an existing movie in an object like that apparently does not make ruffle stop said movie's looped audio.

edit: oops, accidental close