Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVM2 - Stuck on loading screen waiting for external MP3 Sound #8932

Closed
MrCheeze opened this issue Dec 27, 2022 · 6 comments
Closed

AVM2 - Stuck on loading screen waiting for external MP3 Sound #8932

MrCheeze opened this issue Dec 27, 2022 · 6 comments
Labels
A-avm2 Area: AVM2 (ActionScript 3) bug Something isn't working

Comments

@MrCheeze
Copy link
Contributor

Describe the bug

This flash ("Alterniabound") contains a preloader screen that tries to wait for both the main swf to load, as well as seven external MP3 files. It waits for a ProgressEvent for all eight files, but only the swf sends one, so loader progress stays stuck at 12.5% forever.

For the loader to work, I think there's still a fair bit of missing AVM2/AS3 Sound functionality needed... right now I don't think the Sound constructor even tries to load the MP3, and I don't think it would trigger a progress event even if it did.

The script that triggers this issue is below:

   public dynamic class MainTimeline extends MovieClip
   {
      public function MainTimeline()
      {
         super();
         addFrameScript(0,this.frame1,2,this.frame3);
      }
      
      public function checkLoads() : void
      {
         var _loc1_:Number = (this.loads[0] + this.loads[1] + this.loads[2] + this.loads[3] + this.loads[4] + this.loads[5] + this.loads[6] + this.loads[7]) / 8;
         this.txtOutput.text = String(int(_loc1_ * 100)) + "%";
         if(_loc1_ > 0.99)
         {
            play();
         }
         else
         {
            stop();
         }
      }
      
      internal function frame1() : *
      {
         stop();
         this.karkatsTheme = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/Crustacean.mp3"));
         this.vriskasTheme = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/VriskasTheme3.mp3"));
         this.terezisTheme = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/terezistheme.mp3"));
         this.vriskaFast = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/spidersclawLOOP2.mp3"));
         this.nickRape = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/THE_NIC_CAGE_SONG.mp3"));
         this.nickRom = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/Nic_Cage_Romance.mp3"));
         this.napTime = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/A%20Tender%20Moment.mp3"));
         this.karkatsTheme.addEventListener(ProgressEvent.PROGRESS,this.s1);
         this.vriskasTheme.addEventListener(ProgressEvent.PROGRESS,this.s2);
         this.terezisTheme.addEventListener(ProgressEvent.PROGRESS,this.s3);
         this.vriskaFast.addEventListener(ProgressEvent.PROGRESS,this.s4);
         this.nickRape.addEventListener(ProgressEvent.PROGRESS,this.s5);
         this.nickRom.addEventListener(ProgressEvent.PROGRESS,this.s6);
         this.napTime.addEventListener(ProgressEvent.PROGRESS,this.s7);
         this.loads = new Array(0,0,0,0,0,0,0,0);
         this.loaderInfo.addEventListener(ProgressEvent.PROGRESS,this.progresser);
      }
      
      public function s4(param1:ProgressEvent) : void
      {
         this.loads[4] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function s5(param1:ProgressEvent) : void
      {
         this.loads[5] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function s6(param1:ProgressEvent) : void
      {
         this.loads[6] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function s7(param1:ProgressEvent) : void
      {
         this.loads[7] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function s1(param1:ProgressEvent) : void
      {
         this.loads[1] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function s2(param1:ProgressEvent) : void
      {
         this.loads[2] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function s3(param1:ProgressEvent) : void
      {
         this.loads[3] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
      
      public function progresser(param1:ProgressEvent) : void
      {
         this.loads[0] = param1.bytesLoaded / param1.bytesTotal;
         this.checkLoads();
      }
   }
}

Expected behavior

Ruffle loads the MP3, notifies the preloader script about them being loaded, and we make it past the preloader screen.

Affected platform

Desktop app

Operating system

Windows 11

Browser

No response

Additional information

No response

@MrCheeze MrCheeze added the bug Something isn't working label Dec 27, 2022
@n0samu
Copy link
Member

n0samu commented Dec 27, 2022

Hi, can you please provide a link to the original URL of the SWF file? In Flash Player, it actually tries to load all of the MP3 files from mspaintadventures.com, so even if Ruffle did have the necessary features implemented, CORS restrictions would prevent the content from working on your website.

@n0samu n0samu added the A-avm2 Area: AVM2 (ActionScript 3) label Dec 27, 2022
@n0samu
Copy link
Member

n0samu commented Dec 27, 2022

Oh, I found it: https://www.homestuck.com/story/2792
Looks like the SWF file is hosted on homestuck.com, so it would be subject to the same problem.
Anyway, I'm surprised to only see these error messages in the console:

Movie clip 36: Duplicated frame label
Movie clip 129: Duplicated frame label 

I would expect to see an error about unimplemented functions. I guess it's not even getting to the part where it tries to load the external files?

@MrCheeze
Copy link
Contributor Author

The original host of the swf can be found here:
http://mspaintadventures.com/test_index.php?s=6&p=004692
http://cdn.mspaintadventures.com/storyfiles/hs2/02791/02791.swf

The whole mspaintadventures.com domain is somewhat deprecated though, so maybe this particular flash can't be made to work even with the missing Sound functionally, unless #1486 is ever implemented.

I guess it's not even getting to the part where it tries to load the external files?

I think so, from what I saw of the code the Sound constructor seems to just ignore the url provided as an argument entirely.

@MrCheeze
Copy link
Contributor Author

MrCheeze commented Sep 5, 2023

The missing ruffle features have now been implemented, it is now ONLY cors issues that are preventing the MP3s from loading in this flash (leading to getting stuck on the loading screen).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/spidersclawLOOP2.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/VriskasTheme3.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/Crustacean.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/Nic_Cage_Romance.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/THE_NIC_CAGE_SONG.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/terezistheme.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/A%20Tender%20Moment.mp3. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

@n0samu n0samu closed this as completed Sep 5, 2023
@n0samu
Copy link
Member

n0samu commented Sep 5, 2023

Actually there is definitely some other problem besides CORS. The game does not work in the Ruffle desktop app or the extension's internal player page, neither of which are subject to CORS restrictions.

@n0samu n0samu reopened this Sep 5, 2023
@MrCheeze
Copy link
Contributor Author

More information on what the current problem is -
this.karkatsTheme = new Sound(new URLRequest("http://www.mspaintadventures.com/storyfiles/hs2/songs/alterniaboundsongs/Crustacean.mp3")); now successfully loads the sound file (it didn't, back when the issue was first opened).

The current problem is that this.karkatsTheme.addEventListener(ProgressEvent.PROGRESS,this.s1); still does not actually ever call function s1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-avm2 Area: AVM2 (ActionScript 3) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants