change NES board analysis to prioritize gamedb. this would allow users to control the operations, instead of nescartdb always taking control. not sure if this is OK, but I think it is.

This commit is contained in:
zeromus 2014-02-16 06:16:55 +00:00
parent 4a2f28d89f
commit 7b354ef8b9
1 changed files with 60 additions and 57 deletions

View File

@ -591,22 +591,54 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
if (USE_DATABASE)
choice = IdentifyFromBootGodDB(hash_sha1_several);
if (choice == null)
{
LoadWriteLine("Could not locate game in nescartdb");
if (USE_DATABASE)
{
if (hash_md5 != null) choice = IdentifyFromGameDB(hash_md5);
if (choice == null)
{
choice = IdentifyFromGameDB(hash_sha1);
if (choice == null)
LoadWriteLine("Could not locate game in bizhawk gamedb");
else
{
origin = EDetectionOrigin.GameDB;
LoadWriteLine("Chose board from bizhawk gamedb: " + choice.board_type);
//gamedb entries that dont specify prg/chr sizes can infer it from the ines header
if (iNesHeaderInfo != null)
{
if (choice.prg_size == -1) choice.prg_size = iNesHeaderInfo.prg_size;
if (choice.chr_size == -1) choice.chr_size = iNesHeaderInfo.chr_size;
if (choice.vram_size == -1) choice.vram_size = iNesHeaderInfo.vram_size;
if (choice.wram_size == -1) choice.wram_size = iNesHeaderInfo.wram_size;
}
else if (unif != null)
{
if (choice.prg_size == -1) choice.prg_size = unif.GetCartInfo().prg_size;
if (choice.chr_size == -1) choice.chr_size = unif.GetCartInfo().chr_size;
// unif has no wram\vram sizes; hope the board impl can figure it out...
if (choice.vram_size == -1) choice.vram_size = 0;
if (choice.wram_size == -1) choice.wram_size = 0;
}
}
//if this is still null, we have to try it some other way. nescartdb perhaps?
if (choice == null)
{
choice = IdentifyFromBootGodDB(hash_sha1_several);
if (choice == null)
LoadWriteLine("Could not locate game in nescartdb");
else
{
LoadWriteLine("Chose board from nescartdb:");
LoadWriteLine(choice);
origin = EDetectionOrigin.BootGodDB;
}
}
}
//if choice is still null, try UNIF and iNES
if (choice == null)
{
LoadWriteLine("Could not locate game in bizhawk gamedb");
if (unif != null)
{
LoadWriteLine("Using information from UNIF header");
@ -648,35 +680,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
origin = EDetectionOrigin.INES;
}
}
else
{
origin = EDetectionOrigin.GameDB;
LoadWriteLine("Chose board from bizhawk gamedb: " + choice.board_type);
//gamedb entries that dont specify prg/chr sizes can infer it from the ines header
if (iNesHeaderInfo != null)
{
if (choice.prg_size == -1) choice.prg_size = iNesHeaderInfo.prg_size;
if (choice.chr_size == -1) choice.chr_size = iNesHeaderInfo.chr_size;
if (choice.vram_size == -1) choice.vram_size = iNesHeaderInfo.vram_size;
if (choice.wram_size == -1) choice.wram_size = iNesHeaderInfo.wram_size;
}
else if (unif != null)
{
if (choice.prg_size == -1) choice.prg_size = unif.GetCartInfo().prg_size;
if (choice.chr_size == -1) choice.chr_size = unif.GetCartInfo().chr_size;
// unif has no wram\vram sizes; hope the board impl can figure it out...
if (choice.vram_size == -1) choice.vram_size = 0;
if (choice.wram_size == -1) choice.wram_size = 0;
}
}
}
else
{
LoadWriteLine("Chose board from nescartdb:");
LoadWriteLine(choice);
origin = EDetectionOrigin.BootGodDB;
}
//TODO - generate better name with region and system
game_name = choice.game.name;