client can handle opening/dragging a .cue, hashing the data sector, looking it up in the DB, and passing it to the correct core

This commit is contained in:
beirich 2011-08-04 04:00:00 +00:00
parent 1000a3c26f
commit ff6323a362
2 changed files with 34 additions and 5 deletions

View File

@ -31,9 +31,12 @@ namespace BizHawk
CompactGameInfo cgi;
hash = RemoveHashType(hash);
db.TryGetValue(hash, out cgi);
if (cgi == null)
if (cgi == null)
{
Console.WriteLine("Game with hash " + hash + " was not in game database.");
return null;
return new GameInfo(cgi);
}
return new GameInfo(cgi);
}
static void LoadDatabase_Escape(string line)

View File

@ -841,11 +841,8 @@ namespace BizHawk.MultiClient
RomGame rom = null;
GameInfo game = null;
try
{
if (file.Extension.ToLower() == ".iso")
{
if (Global.PsxCoreLibrary.IsOpen)
@ -861,6 +858,35 @@ namespace BizHawk.MultiClient
//psx.SetDiscHopper(Global.DiscHopper);
}
}
else if (file.Extension.ToLower() == ".cue")
{
Disc disc = Disc.FromCuePath(path);
var hash = disc.GetHash();
game = Database.CheckDatabase(hash);
if (game == null)
{
// Game was not found in DB. For now we're going to send it to the PCE-CD core.
// In the future we need to do something smarter, possibly including simply asking the user
// what system the game is for.
game = new GameInfo();
game.System = "PCE";
game.Name = file.Name;
}
switch (game.System)
{
case "PCE":
if (File.Exists(Global.Config.PathPCEBios) == false)
{
MessageBox.Show("PCE-CD System Card not found. Please check the BIOS path in Config->Paths.");
return false;
}
rom = new RomGame(new HawkFile(Global.Config.PathPCEBios));
nextEmulator = new PCEngine(game, disc, rom.RomData);
break;
}
}
else
{
rom = new RomGame(file);