2016-08-09 17:03:23 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
2017-07-09 14:21:03 +00:00
|
|
|
|
namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
2016-08-09 17:03:23 +00:00
|
|
|
|
{
|
|
|
|
|
public partial class GPGX : ICodeDataLogger
|
|
|
|
|
{
|
2016-12-16 17:33:02 +00:00
|
|
|
|
public void SetCDL(ICodeDataLog cdl)
|
2016-08-09 17:03:23 +00:00
|
|
|
|
{
|
|
|
|
|
CDL = cdl;
|
2016-08-10 19:27:46 +00:00
|
|
|
|
if (cdl == null) Core.gpgx_set_cd_callback(null);
|
|
|
|
|
else Core.gpgx_set_cd_callback(CDCallback);
|
2016-08-09 17:03:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-16 17:33:02 +00:00
|
|
|
|
public void NewCDL(ICodeDataLog cdl)
|
2016-08-09 17:03:23 +00:00
|
|
|
|
{
|
|
|
|
|
cdl["MD CART"] = new byte[MemoryDomains["MD CART"].Size];
|
|
|
|
|
cdl["68K RAM"] = new byte[MemoryDomains["68K RAM"].Size];
|
|
|
|
|
cdl["Z80 RAM"] = new byte[MemoryDomains["Z80 RAM"].Size];
|
|
|
|
|
|
|
|
|
|
if (MemoryDomains.Has("SRAM"))
|
|
|
|
|
cdl["SRAM"] = new byte[MemoryDomains["SRAM"].Size];
|
|
|
|
|
|
|
|
|
|
cdl.SubType = "GEN";
|
|
|
|
|
cdl.SubVer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: we have Disassembling now
|
|
|
|
|
// not supported
|
2016-12-16 17:33:02 +00:00
|
|
|
|
public void DisassembleCDL(Stream s, ICodeDataLog cdl) { }
|
2016-08-09 17:03:23 +00:00
|
|
|
|
|
2016-12-16 17:33:02 +00:00
|
|
|
|
private ICodeDataLog CDL;
|
2016-08-09 17:03:23 +00:00
|
|
|
|
private void CDCallbackProc(int addr, LibGPGX.CDLog_AddrType addrtype, LibGPGX.CDLog_Flags flags)
|
|
|
|
|
{
|
|
|
|
|
//TODO - hard reset makes CDL go nuts.
|
|
|
|
|
|
|
|
|
|
if (CDL == null) return;
|
|
|
|
|
if (!CDL.Active) return;
|
|
|
|
|
string key;
|
|
|
|
|
switch (addrtype)
|
|
|
|
|
{
|
|
|
|
|
case LibGPGX.CDLog_AddrType.MDCART: key = "MD CART"; break;
|
|
|
|
|
case LibGPGX.CDLog_AddrType.RAM68k: key = "68K RAM"; break;
|
|
|
|
|
case LibGPGX.CDLog_AddrType.RAMZ80: key = "Z80 RAM"; break;
|
|
|
|
|
case LibGPGX.CDLog_AddrType.SRAM: key = "SRAM"; break;
|
|
|
|
|
default: throw new InvalidOperationException("Lagrangian earwax incident");
|
|
|
|
|
}
|
|
|
|
|
CDL[key][addr] |= (byte)flags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|