QuickNES fix Ms. Pac Man (Tengen)

Really it's the iNES header that is wrong, but QuickNES doesn't know this so adjust the file before sending it to QuickNES to boot.
I imagine there are other games that would be fixed in this manner and thus run in QuickNES.
This commit is contained in:
alyosha-tas 2017-03-02 20:05:20 -05:00 committed by GitHub
parent d87d5eb0e0
commit 685de44861
1 changed files with 29 additions and 1 deletions

View File

@ -37,12 +37,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
{
ServiceProvider = new BasicServiceProvider(this);
CoreComm = comm;
Context = QN.qn_new();
if (Context == IntPtr.Zero)
throw new InvalidOperationException("qn_new() returned NULL");
try
{
file = fix_ines_header(file);
unsafe
{
fixed (byte* p = file)
@ -52,6 +54,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
}
}
InitSaveRamBuff();
InitSaveStateBuff();
InitAudio();
@ -313,6 +317,30 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
throw new ObjectDisposedException(GetType().Name);
}
// Fix some incorrect ines header entries that QuickNES uses to load games.
// we need to do this from the raw file since QuickNES hasn't had time to process it yet.
byte[] fix_ines_header(byte[] file)
{
string sha1 = BizHawk.Common.BufferExtensions.BufferExtensions.HashSHA1(file);
bool log_it = false;
Console.WriteLine(sha1);
if (sha1== "93010514AA1300499ABC8F145D6ABCDBF3084090") // Ms. Pac Man (Tengen) [!]
{
file[6] &= 0xFE;
log_it = true;
}
if (log_it)
{
Console.WriteLine("iNES header error detected, adjusting settings...");
Console.WriteLine(sha1);
}
return file;
}
#region Blacklist
// These games are known to not work in quicknes but quicknes thinks it can run them, bail out if one of these is loaded