Reorder extension checks in LoadRom

This commit is contained in:
YoshiRulz 2020-06-07 19:45:58 +10:00
parent f6f6106ccf
commit 977f725de0
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 29 additions and 30 deletions

View File

@ -924,7 +924,7 @@ namespace BizHawk.Client.Common
try try
{ {
string ext = null; var doExtensionChecks = false;
if (OpenAdvanced is OpenAdvanced_Libretro) if (OpenAdvanced is OpenAdvanced_Libretro)
{ {
@ -1003,9 +1003,8 @@ namespace BizHawk.Client.Common
return false; return false;
} }
// if not libretro: // if not libretro: do extension checking
// do extension checking doExtensionChecks = true;
ext = file.Extension.ToLowerInvariant();
// do the archive binding we had to skip // do the archive binding we had to skip
if (!HandleArchiveBinding(file)) if (!HandleArchiveBinding(file))
@ -1015,33 +1014,33 @@ namespace BizHawk.Client.Common
} }
var cancel = false; var cancel = false;
var ext = file.Extension.ToLowerInvariant();
if (string.IsNullOrEmpty(ext)) if (doExtensionChecks) switch (ext)
{ {
} case ".m3u":
else if (ext == ".m3u") (nextEmulator, game) = LoadM3U(path, nextComm, file);
{ break;
(nextEmulator, game) = LoadM3U(path, nextComm, file); case ".xml":
} var result = LoadXML(path, nextComm, file); // must be called before LoadOther because of SNES hacks
else if (Disc.IsValidExtension(ext)) if (result == null) return false;
{ (nextEmulator, rom, game) = result.Value;
var result = LoadDisc(path, nextComm, file, ext); break;
if (result == null) return false; case ".psf":
(nextEmulator, game) = result.Value; case ".minipsf":
} (nextEmulator, rom, game) = LoadPSF(path, nextComm, file);
else if (file.Extension.ToLowerInvariant() == ".xml") break;
{ default:
var result = LoadXML(path, nextComm, file); // must be called before LoadOther because of SNES hacks if (Disc.IsValidExtension(ext))
if (result == null) return false; {
(nextEmulator, rom, game) = result.Value; var result1 = LoadDisc(path, nextComm, file, ext);
} if (result1 == null) return false;
else if (file.Extension.ToLowerInvariant() == ".psf" || file.Extension.ToLowerInvariant() == ".minipsf") (nextEmulator, game) = result1.Value;
{ }
(nextEmulator, rom, game) = LoadPSF(path, nextComm, file); else
} {
else (nextEmulator, rom, game) = LoadOther(path, nextComm, forceAccurateCore, file, out cancel);
{ }
(nextEmulator, rom, game) = LoadOther(path, nextComm, forceAccurateCore, file, out cancel); break;
} }
if (nextEmulator == null) if (nextEmulator == null)