CDL - add consistency check to GB, fix probably bugs in varying cartram sizes, change GB memdomain from "Cart RAM" to "CartRAM" (hope this doesnt cause a problem)
This commit is contained in:
parent
0ff0749191
commit
e8d307c33a
|
@ -154,6 +154,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
var gambatte = _emu as Gameboy;
|
var gambatte = _emu as Gameboy;
|
||||||
var cdl_gb = newCDL as CodeDataLog_GB;
|
var cdl_gb = newCDL as CodeDataLog_GB;
|
||||||
|
var memd = gambatte.AsMemoryDomains();
|
||||||
|
if (!cdl_gb.CheckConsistency(memd))
|
||||||
|
{
|
||||||
|
MessageBox.Show(this, "CDL file does not match emulator's current memory map!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
gambatte.CDL = cdl_gb;
|
gambatte.CDL = cdl_gb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,6 +357,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
pce.Cpu.CDLLoggingActive = LoggingActiveCheckbox.Checked;
|
pce.Cpu.CDLLoggingActive = LoggingActiveCheckbox.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//zeromus doesnt like this kind of logic
|
||||||
|
|
||||||
|
if (_cdl != null)
|
||||||
_cdl.Active = LoggingActiveCheckbox.Checked;
|
_cdl.Active = LoggingActiveCheckbox.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||||
public static CodeDataLog_GB Create(IMemoryDomains memdomains)
|
public static CodeDataLog_GB Create(IMemoryDomains memdomains)
|
||||||
{
|
{
|
||||||
var t = new CodeDataLog_GB();
|
var t = new CodeDataLog_GB();
|
||||||
|
|
||||||
t["ROM"] = new byte[memdomains["ROM"].Size];
|
t["ROM"] = new byte[memdomains["ROM"].Size];
|
||||||
|
|
||||||
//t["HRAM"] = new byte[memdomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
|
//t["HRAM"] = new byte[memdomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
|
||||||
t["WRAM"] = new byte[memdomains["WRAM"].Size];
|
t["WRAM"] = new byte[memdomains["WRAM"].Size];
|
||||||
t["CartRAM"] = new byte[memdomains["Cart RAM"].Size];
|
|
||||||
|
if(memdomains.Has("CartRAM"))
|
||||||
|
t["CartRAM"] = new byte[memdomains["WRAM"].Size];
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string SubType { get { return "GB"; } }
|
public override string SubType { get { return "GB"; } }
|
||||||
public override int SubVer { get { return 0; } }
|
public override int SubVer { get { return 0; } }
|
||||||
|
|
||||||
|
//todo - this could be base classed
|
||||||
|
public bool CheckConsistency(IMemoryDomains memdomains)
|
||||||
|
{
|
||||||
|
if (memdomains["ROM"].Size != this["ROM"].Length) return false;
|
||||||
|
if (memdomains["WRAM"].Size != this["WRAM"].Length) return false;
|
||||||
|
if(memdomains.Has("CartRAM"))
|
||||||
|
if (memdomains["CartRAM"].Size != this["CartRAM"].Length)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -710,7 +710,7 @@ void Cartridge::saveSavedata(char *dest) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Cartridge::getMemoryArea(int which, unsigned char **data, int *length) {
|
bool Cartridge::getMemoryArea(int which, unsigned char **data, int *length) const {
|
||||||
if (!data || !length)
|
if (!data || !length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
int saveSavedataLength();
|
int saveSavedataLength();
|
||||||
void saveSavedata(char *dest);
|
void saveSavedata(char *dest);
|
||||||
|
|
||||||
bool getMemoryArea(int which, unsigned char **data, int *length);
|
bool getMemoryArea(int which, unsigned char **data, int *length) const;
|
||||||
|
|
||||||
int loadROM(const char *romfiledata, unsigned romfilelength, bool forceDmg, bool multicartCompat);
|
int loadROM(const char *romfiledata, unsigned romfilelength, bool forceDmg, bool multicartCompat);
|
||||||
const char * romTitle() const { return reinterpret_cast<const char *>(memptrs.romdata() + 0x134); }
|
const char * romTitle() const { return reinterpret_cast<const char *>(memptrs.romdata() + 0x134); }
|
||||||
|
|
|
@ -144,12 +144,18 @@ public:
|
||||||
{
|
{
|
||||||
if(cart.wsrambankptr())
|
if(cart.wsrambankptr())
|
||||||
{
|
{
|
||||||
//not bankable
|
//not bankable. but. we're not sure how much might be here
|
||||||
unsigned addr = P&0x1FFF;
|
unsigned char *data;
|
||||||
|
int length;
|
||||||
|
bool has = cart.getMemoryArea(3,&data,&length);
|
||||||
|
unsigned addr = P&(length-1);
|
||||||
|
if(has && length!=0)
|
||||||
|
{
|
||||||
CDMapResult ret = { eCDLog_AddrType_CartRAM, addr };
|
CDMapResult ret = { eCDLog_AddrType_CartRAM, addr };
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(P<0xE000)
|
else if(P<0xE000)
|
||||||
{
|
{
|
||||||
unsigned bank = cart.wramdata(P >> 12 & 1) - cart.wramdata(0);
|
unsigned bank = cart.wramdata(P >> 12 & 1) - cart.wramdata(0);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue