fix copypaste bug in GB CDL for some games with large cartram

This commit is contained in:
zeromus 2016-05-29 13:02:00 -05:00
parent 7fb0eaf337
commit 55bd219470
1 changed files with 55 additions and 55 deletions

View File

@ -1,56 +1,56 @@
using System;
using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
partial class Gameboy
{
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
CDL = cdl;
if(cdl == null)
LibGambatte.gambatte_setcdcallback(GambatteState, null);
else
LibGambatte.gambatte_setcdcallback(GambatteState, CDCallback);
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
//cdl["HRAM"] = new byte[_memoryDomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
cdl["WRAM"] = new byte[MemoryDomains["WRAM"].Size];
if (MemoryDomains.Has("CartRAM"))
cdl["CartRAM"] = new byte[MemoryDomains["WRAM"].Size];
cdl.SubType = "GB";
cdl.SubVer = 0;
}
//not supported
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { }
CodeDataLog CDL;
LibGambatte.CDCallback CDCallback;
void CDCallbackProc(int addr, LibGambatte.CDLog_AddrType addrtype, LibGambatte.CDLog_Flags flags)
{
if (CDL == null) return;
if (!CDL.Active) return;
string key;
switch (addrtype)
{
case LibGambatte.CDLog_AddrType.ROM: key = "ROM"; break;
case LibGambatte.CDLog_AddrType.HRAM: key = "HRAM"; break;
case LibGambatte.CDLog_AddrType.WRAM: key = "WRAM"; break;
case LibGambatte.CDLog_AddrType.CartRAM: key = "CartRAM"; break;
default: throw new InvalidOperationException("Juniper lightbulb proxy");
}
CDL[key][addr] |= (byte)flags;
}
}
using System;
using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
partial class Gameboy
{
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
CDL = cdl;
if(cdl == null)
LibGambatte.gambatte_setcdcallback(GambatteState, null);
else
LibGambatte.gambatte_setcdcallback(GambatteState, CDCallback);
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
//cdl["HRAM"] = new byte[_memoryDomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
cdl["WRAM"] = new byte[MemoryDomains["WRAM"].Size];
if (MemoryDomains.Has("CartRAM"))
cdl["CartRAM"] = new byte[MemoryDomains["CartRAM"].Size];
cdl.SubType = "GB";
cdl.SubVer = 0;
}
//not supported
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { }
CodeDataLog CDL;
LibGambatte.CDCallback CDCallback;
void CDCallbackProc(int addr, LibGambatte.CDLog_AddrType addrtype, LibGambatte.CDLog_Flags flags)
{
if (CDL == null) return;
if (!CDL.Active) return;
string key;
switch (addrtype)
{
case LibGambatte.CDLog_AddrType.ROM: key = "ROM"; break;
case LibGambatte.CDLog_AddrType.HRAM: key = "HRAM"; break;
case LibGambatte.CDLog_AddrType.WRAM: key = "WRAM"; break;
case LibGambatte.CDLog_AddrType.CartRAM: key = "CartRAM"; break;
default: throw new InvalidOperationException("Juniper lightbulb proxy");
}
CDL[key][addr] |= (byte)flags;
}
}
}