diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ITraceable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ITraceable.cs index 73129071f7..20855e1988 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ITraceable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ITraceable.cs @@ -13,12 +13,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy private void MakeTrace(IntPtr _s) { - int[] s = new int[13]; - System.Runtime.InteropServices.Marshal.Copy(_s, s, 0, 13); + int[] s = new int[14]; + System.Runtime.InteropServices.Marshal.Copy(_s, s, 0, 14); ushort unused; Tracer.Put(string.Format( - "{13} SP:{2:x2} A:{3:x2} B:{4:x2} C:{5:x2} D:{6:x2} E:{7:x2} F:{8:x2} H:{9:x2} L:{10:x2} {11} Cy:{0}", + "{13} SP:{2:x2} A:{3:x2} B:{4:x2} C:{5:x2} D:{6:x2} E:{7:x2} F:{8:x2} H:{9:x2} L:{10:x2} LY:{14:x2} {11} Cy:{0}", s[0], s[1] & 0xffff, s[2] & 0xffff, @@ -32,7 +32,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy s[10] & 0xff, s[11] != 0 ? "skip" : "", s[12] & 0xff, - Common.Components.Z80GB.NewDisassembler.Disassemble((ushort)s[1], (addr) => LibGambatte.gambatte_cpuread(GambatteState, addr), out unused).PadRight(30) + Common.Components.Z80GB.NewDisassembler.Disassemble((ushort)s[1], (addr) => LibGambatte.gambatte_cpuread(GambatteState, addr), out unused).PadRight(30), + s[13] & 0xff )); } } diff --git a/libgambatte/src/cpu.cpp b/libgambatte/src/cpu.cpp index 92173d1f44..e1674bebb1 100644 --- a/libgambatte/src/cpu.cpp +++ b/libgambatte/src/cpu.cpp @@ -505,7 +505,7 @@ void CPU::process(const unsigned long cycles) { unsigned char opcode; if (tracecallback) { - int result[13]; + int result[14]; result[0] = cycleCounter; result[1] = PC; result[2] = SP; @@ -520,6 +520,7 @@ void CPU::process(const unsigned long cycles) { result[11] = skip; PC_READ(opcode); result[12] = opcode; + result[13] = memory.debugGetLY(); tracecallback((void *)result); } else { diff --git a/libgambatte/src/memory.h b/libgambatte/src/memory.h index 70f4bafac3..8ffd355c31 100644 --- a/libgambatte/src/memory.h +++ b/libgambatte/src/memory.h @@ -85,6 +85,8 @@ public: bool loaded() const { return cart.loaded(); } const char * romTitle() const { return cart.romTitle(); } + int debugGetLY() const { return display.debugGetLY(); } + void setStatePtrs(SaveState &state); void loadState(const SaveState &state/*, unsigned long oldCc*/); void loadSavedata(const char *data) { cart.loadSavedata(data); } diff --git a/libgambatte/src/video.h b/libgambatte/src/video.h index 67c0856aed..4b722f1ebe 100644 --- a/libgambatte/src/video.h +++ b/libgambatte/src/video.h @@ -175,6 +175,8 @@ public: void setCgbPalette(unsigned *lut); void setVideoBuffer(uint_least32_t *videoBuf, int pitch); + int debugGetLY() const { return ppu.lyCounter().ly(); } + void dmgBgPaletteChange(const unsigned data, const unsigned long cycleCounter) { update(cycleCounter); bgpData[0] = data; diff --git a/output/dll/libgambatte.dll b/output/dll/libgambatte.dll index 752768150d..381b65d829 100644 Binary files a/output/dll/libgambatte.dll and b/output/dll/libgambatte.dll differ