mirror of
https://github.com/libretro/RetroArch.git
synced 2026-01-09 06:34:03 +08:00
Fix double-launch issue when switching games from external launcher (#18587)
When launching a different game via FLAG_ACTIVITY_CLEAR_TOP (e.g., from Daijishou), onNewIntent() was calling finish() + System.exit(0), which killed the app without restarting. Users had to tap twice to launch a new game. Now starts a fresh activity with FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK before calling System.exit(0). This queues the new game to launch, then kills the current process so Android starts fresh.
This commit is contained in:
parent
7145bbe874
commit
feb9226ab9
@ -80,11 +80,13 @@ public final class RetroActivityFuture extends RetroActivityCamera {
|
||||
String currentCore = currentIntent != null ? currentIntent.getStringExtra("LIBRETRO") : null;
|
||||
|
||||
|
||||
// Check if we're trying to launch different content
|
||||
// Check if we're trying to launch different content
|
||||
if ((newRom != null && !newRom.equals(currentRom)) ||
|
||||
(newCore != null && !newCore.equals(currentCore))) {
|
||||
// Different game content - exit cleanly and let launcher restart us
|
||||
finish();
|
||||
// Different game content - start fresh instance then exit
|
||||
Intent restartIntent = new Intent(intent);
|
||||
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(restartIntent);
|
||||
System.exit(0);
|
||||
} else {
|
||||
// Same content, just update intent
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user