From dc9b762461262b4771d5f5ccf3ebe4ea2f9656b2 Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Tue, 7 Oct 2025 14:54:06 -0400 Subject: [PATCH] Fix stuck at setup wizard after bios selection --- .../psx2/SetupWizardDialogFragment.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java b/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java index 5e22c6c..bd29bba 100644 --- a/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java +++ b/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java @@ -40,7 +40,11 @@ public class SetupWizardDialogFragment extends DialogFragment { super.onResume(); try { ((MainActivity) requireActivity()).setSetupWizardActive(true); } catch (Throwable ignored) {} // Refresh state (in case a step completed while this dialog was covered by a picker) - try { updateUi(); } catch (Throwable ignored) {} + try { + updateUi(); + // Auto-advance if all steps are complete + checkAndAutoAdvance(); + } catch (Throwable ignored) {} } @Override @@ -237,5 +241,26 @@ public class SetupWizardDialogFragment extends DialogFragment { if (hintView != null) hintView.setVisibility(View.VISIBLE); } + + 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); + } + } + } + } }