nes-restore some more verbose detection logging that had got lost at some point

This commit is contained in:
zeromus 2012-03-06 08:01:48 +00:00
parent 7d263c9a10
commit 8e829faa03
2 changed files with 21 additions and 7 deletions

View File

@ -386,6 +386,20 @@ namespace BizHawk.Emulation.Consoles.Nintendo
}
void LoadWriteLine(object arg) { LoadWriteLine("{0}", arg); }
class MyWriter : StringWriter
{
public MyWriter(TextWriter _loadReport)
{
loadReport = _loadReport;
}
TextWriter loadReport;
public override void WriteLine(string format, params object[] arg)
{
Console.WriteLine(format, arg);
loadReport.WriteLine(format, arg);
}
}
public unsafe void Init(GameInfo gameInfo, byte[] rom)
{
LoadReport = new StringWriter();
@ -411,7 +425,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
string hash_md5 = "md5:" + Util.Hash_MD5(file, 16, file.Length - 16);
LoadWriteLine("Found iNES header:");
CartInfo iNesHeaderInfo = header->Analyze();
CartInfo iNesHeaderInfo = header->Analyze(new MyWriter(LoadReport));
LoadWriteLine("Since this is iNES we can (somewhat) confidently parse PRG/CHR banks to hash.");
LoadWriteLine("headerless rom hash: {0}", hash_sha1);
@ -428,7 +442,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
msTemp.Flush();
var bytes = msTemp.ToArray();
var hash = "sha1:" + Util.Hash_SHA1(bytes, 0, bytes.Length);
LoadWriteLine("PRG (8KB) + CHR hash: {0}", hash);
LoadWriteLine(" PRG (8KB) + CHR hash: {0}", hash);
hash_sha1_several.Add(hash);
}

View File

@ -151,7 +151,7 @@ static string ClassifyTable = @"
}
}
public CartInfo Analyze()
public CartInfo Analyze(TextWriter report)
{
var ret = new CartInfo();
ret.game = new NESGameInfo();
@ -170,9 +170,9 @@ static string ClassifyTable = @"
if(wram_size != 0 || flags9 != 0 || flags10 != 0 || zero11 != 0 || zero12 != 0 || zero13 != 0 || zero14 != 0 || zero15 != 0)
{
Console.WriteLine("Looks like you have an iNES 2.0 header, or some other kind of weird garbage.");
Console.WriteLine("We haven't bothered to support iNES 2.0.");
Console.WriteLine("We might, if we can find anyone who uses it. Let us know.");
report.WriteLine("Looks like you have an iNES 2.0 header, or some other kind of weird garbage.");
report.WriteLine("We haven't bothered to support iNES 2.0.");
report.WriteLine("We might, if we can find anyone who uses it. Let us know.");
}
ret.wram_size = (short)(wram_size * 8);
@ -186,7 +186,7 @@ static string ClassifyTable = @"
//let's not put a lot of hacks in here. that's what the databases are for.
//for example of one not to add: videomation hack to change vram = 8 -> 16
Console.WriteLine("map={0},pr={1},ch={2},wr={3},vr={4},ba={5},mir={6}",ret.mapper, ret.prg_size, ret.chr_size, ret.wram_size, ret.vram_size, ret.wram_battery ? 1 : 0, mirroring);
report.WriteLine("map={0},pr={1},ch={2},wr={3},vr={4},ba={5},mir={6}", ret.mapper, ret.prg_size, ret.chr_size, ret.wram_size, ret.vram_size, ret.wram_battery ? 1 : 0, mirroring);
return ret;
}