Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8860 from Ebola16/Emu
Android: Disallow multiple launcher activities
  • Loading branch information
Tilka committed Jun 16, 2020
2 parents 851b438 + 1e6925e commit a2b7627
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Expand Up @@ -73,6 +73,7 @@ public final class EmulationActivity extends AppCompatActivity
private boolean mDeviceHasTouchScreen;
private boolean mMenuVisible;

private static boolean sIgnoreLaunchRequests = false;
private static boolean sIsGameCubeGame;

private boolean activityRecreated;
Expand Down Expand Up @@ -196,6 +197,11 @@ private static String[] scanForSecondDisc(GameFile gameFile)

public static void launch(FragmentActivity activity, GameFile gameFile)
{
if (sIgnoreLaunchRequests)
return;

sIgnoreLaunchRequests = true;

Intent launcher = new Intent(activity, EmulationActivity.class);

launcher.putExtra(EXTRA_SELECTED_GAMES, scanForSecondDisc(gameFile));
Expand All @@ -207,6 +213,11 @@ public static void launch(FragmentActivity activity, GameFile gameFile)

public static void launchFile(FragmentActivity activity, String[] filePaths)
{
if (sIgnoreLaunchRequests)
return;

sIgnoreLaunchRequests = true;

Intent launcher = new Intent(activity, EmulationActivity.class);
launcher.putExtra(EXTRA_SELECTED_GAMES, filePaths);

Expand Down Expand Up @@ -237,6 +248,11 @@ public static void launchFile(FragmentActivity activity, String[] filePaths)
activity.startActivity(launcher);
}

public static void stopIgnoringLaunchRequests()
{
sIgnoreLaunchRequests = false;
}

public static void clearWiimoteNewIniLinkedPreferences(Context context)
{
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
Expand Down
Expand Up @@ -411,6 +411,7 @@ private void runWithValidSurface()
Log.debug("[EmulationFragment] Starting emulation thread.");
NativeLibrary.Run(mGamePaths);
}
EmulationActivity.stopIgnoringLaunchRequests();
}, "NativeEmulation");
emulationThread.start();
}
Expand Down

0 comments on commit a2b7627

Please sign in to comment.