Unindent `RomLoader.MakeGameFromDisc`

This commit is contained in:
YoshiRulz 2022-08-06 09:21:43 +10:00
parent 8f153fd503
commit 0236a820ec
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 52 additions and 55 deletions

View File

@ -238,66 +238,63 @@ namespace BizHawk.Client.Common
: discHasher.OldHash(); : discHasher.OldHash();
var game = Database.CheckDatabase(discHash); var game = Database.CheckDatabase(discHash);
if (game == null) if (game is not null) return game;
// else try to use our wizard methods
game = new GameInfo { Name = name, Hash = discHash };
Exception NoCoreForSystem(string sysID)
{ {
// try to use our wizard methods // no supported emulator core for these (yet)
game = new GameInfo { Name = name, Hash = discHash }; game.System = sysID;
Exception NoCoreForSystem(string sysID) return new NoAvailableCoreException(sysID);
{ }
// no supported emulator core for these (yet) switch (discType)
game.System = sysID; {
return new NoAvailableCoreException(sysID); case DiscType.SegaSaturn:
} game.System = VSystemID.Raw.SAT;
break;
case DiscType.MegaCD:
game.System = VSystemID.Raw.GEN;
break;
case DiscType.PCFX:
game.System = VSystemID.Raw.PCFX;
break;
switch (discType) case DiscType.TurboGECD:
{ case DiscType.TurboCD:
case DiscType.SegaSaturn: game.System = VSystemID.Raw.PCE;
game.System = VSystemID.Raw.SAT; break;
break;
case DiscType.MegaCD:
game.System = VSystemID.Raw.GEN;
break;
case DiscType.PCFX:
game.System = VSystemID.Raw.PCFX;
break;
case DiscType.TurboGECD: case DiscType.Amiga:
case DiscType.TurboCD: throw NoCoreForSystem(VSystemID.Raw.Amiga);
game.System = VSystemID.Raw.PCE; case DiscType.CDi:
break; throw NoCoreForSystem(VSystemID.Raw.PhillipsCDi);
case DiscType.Dreamcast:
throw NoCoreForSystem(VSystemID.Raw.Dreamcast);
case DiscType.GameCube:
throw NoCoreForSystem(VSystemID.Raw.GameCube);
case DiscType.NeoGeoCD:
throw NoCoreForSystem(VSystemID.Raw.NeoGeoCD);
case DiscType.Panasonic3DO:
throw NoCoreForSystem(VSystemID.Raw.Panasonic3DO);
case DiscType.Playdia:
throw NoCoreForSystem(VSystemID.Raw.Playdia);
case DiscType.SonyPS2:
throw NoCoreForSystem(VSystemID.Raw.PS2);
case DiscType.SonyPSP:
throw NoCoreForSystem(VSystemID.Raw.PSP);
case DiscType.Wii:
throw NoCoreForSystem(VSystemID.Raw.Wii);
case DiscType.Amiga: case DiscType.AudioDisc:
throw NoCoreForSystem(VSystemID.Raw.Amiga); case DiscType.UnknownCDFS:
case DiscType.CDi: case DiscType.UnknownFormat:
throw NoCoreForSystem(VSystemID.Raw.PhillipsCDi); game.System = _config.TryGetChosenSystemForFileExt(ext, out var sysID) ? sysID : VSystemID.Raw.NULL;
case DiscType.Dreamcast: break;
throw NoCoreForSystem(VSystemID.Raw.Dreamcast);
case DiscType.GameCube:
throw NoCoreForSystem(VSystemID.Raw.GameCube);
case DiscType.NeoGeoCD:
throw NoCoreForSystem(VSystemID.Raw.NeoGeoCD);
case DiscType.Panasonic3DO:
throw NoCoreForSystem(VSystemID.Raw.Panasonic3DO);
case DiscType.Playdia:
throw NoCoreForSystem(VSystemID.Raw.Playdia);
case DiscType.SonyPS2:
throw NoCoreForSystem(VSystemID.Raw.PS2);
case DiscType.SonyPSP:
throw NoCoreForSystem(VSystemID.Raw.PSP);
case DiscType.Wii:
throw NoCoreForSystem(VSystemID.Raw.Wii);
case DiscType.AudioDisc: default: //"for an unknown disc, default to psx instead of pce-cd, since that is far more likely to be what they are attempting to open" [5e07ab3ec3b8b8de9eae71b489b55d23a3909f55, year 2015]
case DiscType.UnknownCDFS: case DiscType.SonyPSX:
case DiscType.UnknownFormat: game.System = VSystemID.Raw.PSX;
game.System = _config.TryGetChosenSystemForFileExt(ext, out var sysID) ? sysID : VSystemID.Raw.NULL; break;
break;
default: //"for an unknown disc, default to psx instead of pce-cd, since that is far more likely to be what they are attempting to open" [5e07ab3ec3b8b8de9eae71b489b55d23a3909f55, year 2015]
case DiscType.SonyPSX:
game.System = VSystemID.Raw.PSX;
break;
}
} }
return game; return game;
} }