Wire up known bad/good rom status from GameDB

This commit is contained in:
beirich 2011-07-10 16:06:12 +00:00
parent 74c8e09892
commit 6fc8d16e42
3 changed files with 39 additions and 10 deletions

View File

@ -6,17 +6,29 @@ using System.Threading;
namespace BizHawk
{
public enum RomStatus
{
GoodDump,
BadDump,
Homebrew,
TranslatedRom,
BIOS,
Overdump,
NotInDatabase
}
public enum HashType
{
CRC32, MD5
}
public class GameInfo
{
public string Name;
public string System;
public string MetaData;
public string hash;
public enum HashType
{
CRC32, MD5
}
public RomStatus Status;
public string[] GetOptions()
{
@ -93,6 +105,17 @@ namespace BizHawk
var Game = new GameInfo();
//remove a hash type identifier. well don't really need them for indexing (theyre just there for human purposes)
Game.hash = RemoveHashType(items[0].ToUpper());
switch (items[1].Trim())
{
case "B": Game.Status = RomStatus.BadDump; break;
case "V": Game.Status = RomStatus.BadDump; break;
case "T": Game.Status = RomStatus.TranslatedRom; break;
case "O": Game.Status = RomStatus.Overdump; break;
case "I": Game.Status = RomStatus.BIOS; break;
case "D": Game.Status = RomStatus.Homebrew; break;
case "H": Game.Status = RomStatus.Homebrew; break;
default: Game.Status = RomStatus.GoodDump; break;
}
Game.Name = items[2];
Game.System = items[3];
Game.MetaData = items.Length >= 6 ? items[5] : null;
@ -124,6 +147,7 @@ namespace BizHawk
var Game = new GameInfo();
Game.hash = hash;
Game.MetaData = "NotInDatabase";
Game.Status = RomStatus.NotInDatabase;
Console.WriteLine("Game was not in DB. CRC: {0:X8} ", CRC32.Calculate(RomData));
string ext = Path.GetExtension(fileName).ToUpperInvariant();

View File

@ -930,11 +930,14 @@ namespace BizHawk.MultiClient
{
if (Global.Game != null)
{
//TODO: check ROM dump and display warning icon
//DumpError.Image = BizHawk.MultiClient.Properties.Resources.WarningHS;
//DumpError.ToolTipText = "Warning: Bad ROM Dump";
DumpError.Image = BizHawk.MultiClient.Properties.Resources.GreenCheck;
DumpError.ToolTipText = "Verified good dump";
if (Global.Game.Status == RomStatus.BadDump)
{
DumpError.Image = BizHawk.MultiClient.Properties.Resources.WarningHS;
DumpError.ToolTipText = "Warning: Bad ROM Dump";
} else {
DumpError.Image = BizHawk.MultiClient.Properties.Resources.GreenCheck;
DumpError.ToolTipText = "Verified good dump";
}
}
else
{

View File

@ -10,6 +10,7 @@ namespace BizHawk.MultiClient
public byte[] RomData;
public byte[] FileData;
public string System;
public RomStatus Status { get; private set; }
private string name;
private string filesystemSafeName;
@ -40,6 +41,7 @@ namespace BizHawk.MultiClient
var info = Database.GetGameInfo(RomData, file.Name);
name = info.Name;
System = info.System;
Status = info.Status;
options = new List<string>(info.GetOptions());
CheckForPatchOptions();