mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-22 01:55:25 -05:00
Original message: Hey devs, I'm moth, lead developer of the Cocoon Frontend For our now playing integration, we're trying to maximise compatability for launching & swapping games without the user having to force close out of the activity. Dolphin however does not support this at all. No matter what mix of flags and intents I try it just shows the MainActivity. After a deep dive I found out: EmulationActivity has an ignoreLaunchRequests check that is set to true until the end of NativeLibrary.Run() the launch() method returns if its true and just keeps you in MainActivity, never launching the new ROM This is a problem because Cocoon and other frontends need to use CLEAR_TASK to destroy the existing task and start fresh to load the new ROM. This destroys EmulationActivity & Fragment but the process still survives so NativeLibrary.Run never returns gracefully. This makes it so relaunching a new ROM does not work, even if we clear the activity. Also MainActivity or EmulationActivity doesnt handle onNewIntent() This would be the graceful way to handle it so we can use CLEAR_TOP | SINGLE_TOP without being ignored. The two fixes are: in StartupHandler.HandleInit(), reset the flag before launching so the cleared task's limbo state of ignoreLaunchRequests is reset The more graceful way would be to add override fun onNewIntent(intent: Intent) super.onNewIntent(intent) setIntent(intent) StartupHandler.HandleInit(this) } in your MainActivity This would let frontends redeliver game intents without destroying the entire task After implementation: I added multiple guards to ensure proper synchronicity and ensure emulators and surfaces are finished before starting a new game. Frontends can now take advantage of NEW_TASK | CLEAR_TASK to launch a new Dolphin game. |
||
|---|---|---|
| .. | ||
| src/main | ||
| .gitignore | ||
| build.gradle.kts | ||
| proguard-rules.pro | ||