add restart with safe mode util

This commit is contained in:
Chloe committed 2026-10-17 02:51:05 -05:00
1 parent 79c06ca629
commit c8994c2484
2 files changed
+10 -2

No files matched your search

@@ -104,8 +104,10 @@ class MainActivity : ComponentActivity() {
val gdInstalled = GamePackageUtils.isGameInstalled(packageManager)
val geodeInstalled = LaunchUtils.isGeodeInstalled(this)
if (gdInstalled && geodeInstalled && intent.getBooleanExtra("restarted", false)) {
onLaunch(this)
val restartImmediately = intent.getBooleanExtra("restarted", false)
if (gdInstalled && geodeInstalled && restartImmediately) {
val withSafeMode = intent.getBooleanExtra("safe-mode", false)
onLaunch(this, withSafeMode)
}
enableEdgeToEdge()
@@ -191,10 +191,16 @@ object GeodeUtils {
@JvmStatic
fun restartGame() {
restartGame(true)
}
@JvmStatic
fun restartGame(safeMode: Boolean) {
activity.get()?.run {
packageManager.getLaunchIntentForPackage(packageName)?.also {
val mainIntent = Intent.makeRestartActivityTask(it.component)
mainIntent.putExtra("restarted", true)
mainIntent.putExtra("safe-mode", safeMode)
startActivity(mainIntent)
exitProcess(0)
}