From e6ef78e1404ab4dbc7c70313e62bdae8b165f35b Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Wed, 8 Oct 2025 15:49:11 -0400 Subject: [PATCH] Finally fixed BIOS problem --- .../java/com/izzy2lost/psx2/MainActivity.java | 25 +++++++++++-------- .../psx2/SetupWizardDialogFragment.java | 19 +++++++++++--- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/izzy2lost/psx2/MainActivity.java b/app/src/main/java/com/izzy2lost/psx2/MainActivity.java index 2383235..1c57e56 100644 --- a/app/src/main/java/com/izzy2lost/psx2/MainActivity.java +++ b/app/src/main/java/com/izzy2lost/psx2/MainActivity.java @@ -1006,20 +1006,23 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF if (hasAnyBiosFiles(f)) return true; } else { String name = f.getName(); - // Common PCSX2 BIOS components: SCPH*.bin (main), and component ROMs ROM0/ROM1/ROM2/EROM if (name != null) { String lower = name.toLowerCase(Locale.ROOT); - boolean isMainBios = lower.startsWith("scph") && (lower.endsWith(".bin") || lower.endsWith(".rom")); - boolean isComponentSuffix = lower.endsWith(".rom0") || lower.endsWith(".rom1") || lower.endsWith(".rom2") || lower.endsWith(".erom"); - boolean isBareComponent = lower.equals("rom0") || lower.equals("rom1") || lower.equals("rom2") || lower.equals("erom"); - - if (isMainBios) { - if (f.length() >= 256 * 1024) return true; // main BIOS typically >= 2MB, but allow 256KB+ - } else if (isComponentSuffix || isBareComponent) { + + // Check for component ROM files (these have specific names) + boolean isComponentSuffix = lower.endsWith(".rom0") || lower.endsWith(".rom1") || + lower.endsWith(".rom2") || lower.endsWith(".erom"); + boolean isBareComponent = lower.equals("rom0") || lower.equals("rom1") || + lower.equals("rom2") || lower.equals("erom"); + + if (isComponentSuffix || isBareComponent) { if (f.length() >= 64 * 1024) return true; // component ROMs can be smaller - } else if (lower.endsWith(".bin") || lower.endsWith(".rom")) { - // Fallback: any .bin/.rom over 256KB - if (f.length() >= 256 * 1024) return true; + } + + // Accept any .bin or .rom file that's at least 256KB (likely a BIOS) + // This covers all regional variants and renamed files + if ((lower.endsWith(".bin") || lower.endsWith(".rom")) && f.length() >= 256 * 1024) { + return true; } } } diff --git a/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java b/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java index e31b062..80388d8 100644 --- a/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java +++ b/app/src/main/java/com/izzy2lost/psx2/SetupWizardDialogFragment.java @@ -194,11 +194,22 @@ public class SetupWizardDialogFragment extends DialogFragment { for (File f : fs) { if (f != null && f.isFile()) { String lower = f.getName().toLowerCase(java.util.Locale.ROOT); - boolean isMainBios = lower.startsWith("scph") && (lower.endsWith(".bin") || lower.endsWith(".rom")); - boolean isComponentSuffix = lower.endsWith(".rom0") || lower.endsWith(".rom1") || lower.endsWith(".rom2") || lower.endsWith(".erom"); - boolean isBareComponent = lower.equals("rom0") || lower.equals("rom1") || lower.equals("rom2") || lower.equals("erom"); - if ((isMainBios && f.length() >= 256 * 1024) || (isComponentSuffix || isBareComponent)) + + // Check for component ROM files (these have specific names) + boolean isComponentSuffix = lower.endsWith(".rom0") || lower.endsWith(".rom1") || + lower.endsWith(".rom2") || lower.endsWith(".erom"); + boolean isBareComponent = lower.equals("rom0") || lower.equals("rom1") || + lower.equals("rom2") || lower.equals("erom"); + + if (isComponentSuffix || isBareComponent) { return true; + } + + // Accept any .bin or .rom file that's at least 256KB (likely a BIOS) + // This covers renamed files and all regional variants + if ((lower.endsWith(".bin") || lower.endsWith(".rom")) && f.length() >= 256 * 1024) { + return true; + } } } }