ruffle-rs / ruffle-android

An Android application for ruffle.rs
Other
231 stars 35 forks source link

Some SWF files cause crashes or launch loop [AVM1/2] #50

Closed DRSDavidSoft closed 10 months ago

DRSDavidSoft commented 11 months ago

Hi there!

Description

Ruffle for Android works wonderfully on some SWF files, but on others, the app crashes, or re-launches continually until the user exists.

I can't figure out why this happens. Can you please take a look? Please also let me know if I need to send you the SWF files.

I also noticed that this happens on the SWF files that have a loading screen, or check for the loading.

NOTE: I am submitting the issue here, because the same SWF files work without an issue on the latest official nightly build of Ruffle, tested on Windows 11.

For example, if you open Sonic Shorts Volume 1, 2 or 3, the Ruffle app displays the flash correctly up until you click on "PLAY" button, after load screen. Then either the app would crash, or it would re-launch from the beginning.

Device info

Samsung Galaxy Tab S8 Ultra (SM-X906B) Android Version: 13 (API 33) Processor: Qualcomm SM8450 Snapdragon 8 Gen 1 Revision r2p0 Arch: armv8a-aarch64 Linux Kernel: 5.10.136 GPU: Qualcomm Adreno 730

ADB Logcat

I've attached the full logcat (with the D, V, I flags included as well) below:

📦 rufflerr.log

Here's the log without debug, verbose and information flags:

E pageboostd: prefetch start : app rsruffle
E pageboostd: rsruffle, amt 1699840 scnt 7 fcnt 2
E pageboostd: prefetch end : app rsruffle data_amount 1699840
E rs.ruffle: Not starting debugger since process cannot load the jdwp agent.
W ruffle  : winit::platform_impl::platform: TODO: forward onStart notification to application
W ruffle  : winit::platform_impl::platform: TODO: handle Android InsetsChanged notification
W ruffle  : winit::platform_impl::platform: TODO: handle Android InsetsChanged notification
W ruffle  : ruffle_android: resized!
W ruffle  : wgpu_hal::gles::egl: EGL says it can present to the window but not natively
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_core::instance: Missing downlevel flags: DownlevelFlags(SURFACE_VIEW_FORMATS)
W ruffle  : The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
W InputManager-JNI: Input channel object '736026b Splash Screen rs.ruffle (client)' was disposed without first being removed with the input manager!
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
E WindowManager: win=Window{736026b u0 Splash Screen rs.ruffle EXITING} destroySurfaces: appStopped=false cleanupOnResume=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=8 caller=com.android.server.wm.WindowState.onExitAnimationDone:5983 com.android.server.wm.ActivityRecord.onAnimationFinished:8612 com.android.server.wm.WindowContainer.doAnimationFinished:3483 com.android.server.wm.WindowContainer.onAnimationFinished:3495 com.android.server.wm.Task.onAnimationFinished:8634 com.android.server.wm.WindowContainer$$ExternalSyntheticLambda4.onAnimationFinished:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:140 
E WindowManager: win=Window{c459ea0 u0 rs.ruffle/rs.ruffle.MainActivity} destroySurfaces: appStopped=true cleanupOnResume=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8 caller=com.android.server.wm.ActivityRecord.destroySurfaces:6533 com.android.server.wm.ActivityRecord.destroySurfaces:6514 com.android.server.wm.ActivityRecord.notifyAppStopped:6578 com.android.server.wm.ActivityRecord.activityStopped:7166 com.android.server.wm.ActivityClientController.activityStopped:258 android.app.IActivityClientController$Stub.onTransact:613 com.android.server.wm.ActivityClientController.onTransact:136 
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x14 in tid 8278 (Thread-5), pid 8243 (rs.ruffle)
F DEBUG   : Cmdline: rs.ruffle
F DEBUG   : pid: 8243, tid: 8278, name: Thread-5  >>> rs.ruffle <<<
W ActivityManager: crash : rs.ruffle,10116
W ActivityTaskManager:   Force finishing activity rs.ruffle/.FullscreenNativeActivity
W InputManager-JNI: Input channel object 'c459ea0 rs.ruffle/rs.ruffle.MainActivity (client)' was disposed without first being removed with the input manager!
W InputManager-JNI: Input channel object 'bdb1af6 rs.ruffle/rs.ruffle.FullscreenNativeActivity (client)' was disposed without first being removed with the input manager!
W UsageStatsService: Unexpected activity event reported! (rs.ruffle/rs.ruffle.MainActivity event : 23 instanceId : 147080493)
E rs.ruffle: Not starting debugger since process cannot load the jdwp agent.
W WindowManager: Exception thrown during dispatchAppVisibility Window{bdb1af6 u0 rs.ruffle/rs.ruffle.FullscreenNativeActivity EXITING}
E WindowManager: win=Window{bdb1af6 u0 rs.ruffle/rs.ruffle.FullscreenNativeActivity EXITING} destroySurfaces: appStopped=false cleanupOnResume=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.ActivityRecord.destroySurfaces:6533 com.android.server.wm.ActivityRecord.destroySurfaces:6514 com.android.server.wm.WindowState.onExitAnimationDone:5981 com.android.server.wm.ActivityRecord$$ExternalSyntheticLambda10.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.ActivityRecord.onAnimationFinished:8601 com.android.server.wm.ActivityRecord.postApplyAnimation:6246 
W ruffle  : winit::platform_impl::platform: TODO: forward onStart notification to application
W ruffle  : winit::platform_impl::platform: TODO: handle Android InsetsChanged notification
W ruffle  : ruffle_android: resized!
W ruffle  : wgpu_hal::gles::egl: EGL says it can present to the window but not natively
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_core::instance: Missing downlevel flags: DownlevelFlags(SURFACE_VIEW_FORMATS)
W ruffle  : The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W InputManager-JNI: Input channel object '15cf33 Splash Screen rs.ruffle (client)' was disposed without first being removed with the input manager!
W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{4ff1446 u0 rs.ruffle/.FullscreenNativeActivity} t-1 f}}
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_DEMAND_REFRESH
W ruffle  : wgpu_hal::vulkan::conv: Unrecognized present mode SHARED_CONTINUOUS_REFRESH
F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x14 in tid 8343 (Thread-5), pid 8309 (rs.ruffle)
F DEBUG   : Cmdline: rs.ruffle
F DEBUG   : pid: 8309, tid: 8343, name: Thread-5  >>> rs.ruffle <<<
W ActivityManager: crash : rs.ruffle,10116
W ActivityTaskManager:   Force finishing activity rs.ruffle/.FullscreenNativeActivity
W WindowManager:   Force finishing activity rs.ruffle/.FullscreenNativeActivity
W WindowManager:   Force finishing activity rs.ruffle/.MainActivity
W InputManager-JNI: Input channel object 'a209a9d rs.ruffle/rs.ruffle.FullscreenNativeActivity (client)' was disposed without first being removed with the input manager!
W InputManager-JNI: Input channel object '7e77f4f rs.ruffle/rs.ruffle.MainActivity (client)' was disposed without first being removed with the input manager!
W WindowManager: Failed to deliver inset state change to w=Window{a209a9d u0 rs.ruffle/rs.ruffle.FullscreenNativeActivity EXITING}
W WindowManager: Failed to deliver inset state change to w=Window{a209a9d u0 rs.ruffle/rs.ruffle.FullscreenNativeActivity EXITING}
W WindowManager: Exception thrown during dispatchAppVisibility Window{a209a9d u0 rs.ruffle/rs.ruffle.FullscreenNativeActivity EXITING}
E WindowManager: win=Window{a209a9d u0 rs.ruffle/rs.ruffle.FullscreenNativeActivity EXITING} destroySurfaces: appStopped=false cleanupOnResume=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.ActivityRecord.destroySurfaces:6533 com.android.server.wm.ActivityRecord.destroySurfaces:6514 com.android.server.wm.WindowState.onExitAnimationDone:5981 com.android.server.wm.ActivityRecord$$ExternalSyntheticLambda10.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.ActivityRecord.onAnimationFinished:8601 com.android.server.wm.ActivityRecord.postApplyAnimation:6246 
W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{f274c2d u0 rs.ruffle/.FullscreenNativeActivity} t-1 f}}
torokati44 commented 11 months ago

Thanks for the report! Yes, attach the problematic SWFs please. The uploaded builds have no debug information in them to show where exactly the problem occurred.

DRSDavidSoft commented 11 months ago

Thanks for the speedy reply! I'll attach some lightweight SWF files for now:

List of working

List of not working

These are some examples with a short size. I can attach the original SWFs that were causing problems as well. Maybe the issue is regarding the inclusion of some sort of links in the SWF files? Or is it related to the loading screen?

torokati44 commented 11 months ago

All 3 of the non-working examples work on my phone... 😐

What device and which Android version are you on?

DRSDavidSoft commented 11 months ago

Interesting! My device specification is as below (I also mentioned them in the original message):

Samsung Galaxy Tab S8 Ultra (SM-X906B) Android Version: 13 (API 33) Processor: Qualcomm SM8450 Snapdragon 8 Gen 1 Revision r2p0 Arch: armv8a-aarch64 Linux Kernel: 5.10.136 GPU: Qualcomm Adreno 730

The screen resolution is 2960x1848.

I used the nightly build with version of 20230807.

Is there a way I can attach a debugger and send you a more through log?

Additionally, can you please test that the following file also works when you press the PLAY button on the initial screen?

https://archive.org/download/sonic-shorts-volume-1/Sonic%20Shorts%20Volume%201.swf

torokati44 commented 11 months ago

(I also mentioned them in the original message):

Right, sorry, didn't read the edits, only the email with the original version of your report.

Is there a way I can attach a debugger and send you a more through log?

You could try following the build instructions in the README, and debug using Android Studio, but it's not exactly straightforward...

Additionally, can you please test that the following file also works when you press the PLAY button on the initial screen?

Yep, I can play the shorts no problem.

Could you please try this build? This one uses OpenGL for rendering, not Vulkan. Many Android phones have buggy Vulkan drivers... https://github.com/torokati44/ruffle-android/actions/runs/5579837493

DRSDavidSoft commented 11 months ago

Hi again, you were right! I did some extensive tests, and every SWF file works great with this build. So sorry for opening a duplicate issue, it never occured to me that the issue might be related to Vulkan builds. I wonder why this happens!

Anyways, is there anything I can do to help identify problems such as this? I don't have any Rust knowledge, but I'd be glad if I can help with any testing, etc. OpenGL seems to also perform well on my device, so no issue there!

I also had two unrelated questions/problems, that I was going to open a new issue, but since there are rather minor, I'd appreciate if I could ask them here as well:

Overall, thank you for bringing Ruffle to Android. Now I'm able to open many great nostalgic games such as Bloxorz on my tablet, which works great with the physical keyboard and the Dex mode! 🎉

torokati44 commented 11 months ago

I did some extensive tests, and every SWF file works great with this build.

Great, I'm glad! I'll soon push out a release where only the OpenGL backend is used for rendering, not Vulkan. Hopefully it will have fewer issues, and still perform well.

So sorry for opening a duplicate issue, it never occured to me that the issue might be related to Vulkan builds.

No worries, you couldn't have known.

I wonder why this happens!

Because of the buggy Vulkan drivers on Android by the device/SoC/GPU vendors... :)

When a SWF file is opened, if I navigate back to the initial screen, the UI elements such as the "Load an SWF" button are all disabled or freezed. [...] Can you also test to see if this issue only happens on my device, or yours as well?

Yeah I know about that, it happens for everybody, I just haven't gotten around to fixing it yet, sorry...

Have you implemented any sort of user preferences currently? [...] Obviously, waiting patiently for the config UI screens to come in future releases, so thank you!

I started working on setting preferences (exactly so users can choose between OpenGL and Vulkan backends :D and maybe other player options as well...), but again, didn't have much time to get far with it... As a first step, it might be easier to simply make the keyboard visibility persistent.

Overall, thank you for bringing Ruffle to Android. Now I'm able to open many great nostalgic games such as Bloxorz on my tablet, which works great with the physical keyboard and the Dex mode!

Yaay!

torokati44 commented 11 months ago

I'll soon push out a release where only the OpenGL backend is used for rendering, not Vulkan.

Well, actually... This build was going to be it: https://github.com/torokati44/ruffle-android/actions/runs/5835878401 But I'm seeing washed out colors with it. Could you please try this one too? (Download the ruffle-release-apks artifact, that one has all the APKs in it.)

DRSDavidSoft commented 11 months ago

You're right, the colors are not accurate. It seems to be brighter than it should be. I don't know what it could be caused by 🤷🏻

torokati44 commented 11 months ago

Hopefully this latest release (https://github.com/torokati44/ruffle-android/releases/tag/20230812) fixes the colors with OpenGL. It was https://github.com/gfx-rs/wgpu/pull/3817 BTW.

DRSDavidSoft commented 11 months ago

Thank you for the through investigation! The colors are now accurate! However, a weird issue happened again, the SWF files that were causing a problem are again causing crashes or launch loops again! At first I thought I had installed the older release as the behavior is exactly the same 😢

Could it be related to the way the color space is presented/used in either Vulkan/OpenGL? Maybe the original issue is unrelated to Vulkan, and is indeed related to colors paces...

DRSDavidSoft commented 10 months ago

Issue fixed on latest build! 🎉

torokati44 commented 10 months ago

That's strange, I don't know how this could be - but anyway, I'm glad!