Merge pull request #12345 from minhaferzz/startup-handler

Android: Fix issue when launching a game when Dolphin is not open
This commit is contained in:
Mai 2023-12-05 03:10:41 -05:00 committed by GitHub
commit 2199dd26bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -1066,16 +1066,16 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
}
@JvmStatic
fun launch(activity: FragmentActivity, filePaths: Array<String>, riivolution: Boolean) {
fun launch(activity: FragmentActivity, filePaths: Array<String>, riivolution: Boolean, fromIntent: Boolean = false) {
if (ignoreLaunchRequests)
return
performLaunchChecks(activity) { launchWithoutChecks(activity, filePaths, riivolution) }
performLaunchChecks(activity, fromIntent) { launchWithoutChecks(activity, filePaths, riivolution) }
}
@JvmStatic
fun launch(activity: FragmentActivity, filePath: String, riivolution: Boolean) =
launch(activity, arrayOf(filePath), riivolution)
fun launch(activity: FragmentActivity, filePath: String, riivolution: Boolean, fromIntent: Boolean = false) =
launch(activity, arrayOf(filePath), riivolution, fromIntent)
private fun launchWithoutChecks(
activity: FragmentActivity,
@ -1089,8 +1089,11 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
activity.startActivity(launcher)
}
private fun performLaunchChecks(activity: FragmentActivity, continueCallback: Runnable) {
private fun performLaunchChecks(activity: FragmentActivity, fromIntent: Boolean, continueCallback: Runnable) {
AfterDirectoryInitializationRunner().runWithLifecycle(activity) {
if (fromIntent) {
activity.finish()
}
if (!FileBrowserHelper.isPathEmptyOrValid(StringSetting.MAIN_DEFAULT_ISO) ||
!FileBrowserHelper.isPathEmptyOrValid(StringSetting.MAIN_FS_PATH) ||
!FileBrowserHelper.isPathEmptyOrValid(StringSetting.MAIN_DUMP_PATH) ||
@ -1129,7 +1132,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
if (ignoreLaunchRequests)
return
performLaunchChecks(activity) { launchSystemMenuWithoutChecks(activity) }
performLaunchChecks(activity, false) { launchSystemMenuWithoutChecks(activity) }
}
private fun launchSystemMenuWithoutChecks(activity: FragmentActivity) {

View File

@ -37,8 +37,7 @@ public final class StartupHandler
if (gamesToLaunch != null && gamesToLaunch.length > 0)
{
// Start the emulation activity, send the ISO passed in and finish the main activity
EmulationActivity.launch(parent, gamesToLaunch, false);
parent.finish();
EmulationActivity.launch(parent, gamesToLaunch, false, true);
}
}