Finally fixed BIOS problem

This commit is contained in:
izzy2lost
2025-10-08 15:49:11 -04:00
parent a21912b884
commit e6ef78e140
2 changed files with 29 additions and 15 deletions
@@ -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;
}
}
}
@@ -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;
}
}
}
}