From 8f299fb37b24b1df87e480fc980590b3469993dc Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Wed, 8 Oct 2025 00:01:36 -0400 Subject: [PATCH] Add delays to hoping fix getting stuck or crashing after bios --- .gitignore | 1 + .../psx2/SetupWizardDialogFragment.java | 32 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 99935ec..6240e2d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ build/ /WARP.md *.aab *.properties +release/ diff --git a/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java b/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java index bd29bba..11fc0ac 100644 --- a/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java +++ b/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java @@ -244,21 +244,23 @@ public class SetupWizardDialogFragment extends DialogFragment { private void checkAndAutoAdvance() { if (isDataFolderPicked() && isGamesFolderPicked() && isBiosPresent()) { - // All steps complete, auto-advance - requireContext().getSharedPreferences("app_prefs", android.content.Context.MODE_PRIVATE) - .edit().putBoolean("first_run_done", true).apply(); - MainActivity a = null; - try { a = (MainActivity) requireActivity(); a.setSetupWizardActive(false); } catch (Throwable ignored) {} - dismissAllowingStateLoss(); - if (a != null) { - // Open the games dialog just like the old GAMES button - final MainActivity act = a; - View decor = act.getWindow() != null ? act.getWindow().getDecorView() : null; - if (decor != null) { - decor.postDelayed(act::openGamesDialog, 150); - } else { - act.runOnUiThread(act::openGamesDialog); - } + // All steps complete, auto-advance with delay to let BIOS processing finish + View decor = getDialog() != null && getDialog().getWindow() != null ? getDialog().getWindow().getDecorView() : null; + if (decor != null) { + decor.postDelayed(() -> { + try { + requireContext().getSharedPreferences("app_prefs", android.content.Context.MODE_PRIVATE) + .edit().putBoolean("first_run_done", true).apply(); + MainActivity a = (MainActivity) requireActivity(); + a.setSetupWizardActive(false); + dismissAllowingStateLoss(); + // Add extra delay before opening games dialog to avoid overload + View mainDecor = a.getWindow() != null ? a.getWindow().getDecorView() : null; + if (mainDecor != null) { + mainDecor.postDelayed(a::openGamesDialog, 800); + } + } catch (Throwable ignored) {} + }, 500); } } }