dolphin/Source
bug 57014eec4d Allow frontends to launch a new game without force closing Dolphin
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.
2026-03-19 22:37:03 +00:00
..
Android Allow frontends to launch a new game without force closing Dolphin 2026-03-19 22:37:03 +00:00
Core Merge pull request #14237 from JulienBernard3383279/gcc-adapter-hotswap 2026-03-18 16:56:30 -05:00
DSPSpy Fix various typos and spelling mistakes 2026-01-17 20:11:38 +01:00
DSPTool Host: Remove unnecessary functions 2025-08-03 13:19:30 -07:00
PCH Fix various typos and spelling mistakes 2026-01-17 20:11:38 +01:00
UnitTests Network: Improve IPv4PortRange::ToString to support CIDR notation and only last octet difference. 2026-02-15 23:13:18 -06:00
VSProps Move RangeSet from Externals to Common 2026-02-23 22:55:38 +01:00
.clang-format Clang-format: Fix invalid settings 2025-05-01 22:05:07 +02:00
CMakeLists.txt Merge pull request #14251 from JoshuaVandaele/cmake-editorconfig 2026-01-11 16:28:03 -05:00
dolphin-emu.sln Core/HW: Add Visual Studio project files for cpp-ipc library. 2025-10-28 18:50:58 +00:00