From 200cd91c2313c0c1dc4eb82c757133e38c8868e3 Mon Sep 17 00:00:00 2001 From: Roy Merkel Date: Sun, 7 Apr 2024 16:38:29 -0700 Subject: [PATCH] Added new value to write callback. --- libgambatte/include/gambatte.h | 2 +- libgambatte/src/memory.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libgambatte/include/gambatte.h b/libgambatte/include/gambatte.h index 6a19a432..9ba38ef5 100644 --- a/libgambatte/include/gambatte.h +++ b/libgambatte/include/gambatte.h @@ -32,7 +32,7 @@ namespace gambatte { enum { BG_PALETTE = 0, SP1_PALETTE = 1, SP2_PALETTE = 2 }; -typedef void (*MemoryCallback)(int32_t address, int64_t cycleOffset); +typedef void (*MemoryCallback)(int32_t address, int64_t cycleOffset, uint32_t data); typedef void (*CDCallback)(int32_t addr, int32_t addrtype, int32_t flags); enum eCDLog_AddrType { diff --git a/libgambatte/src/memory.h b/libgambatte/src/memory.h index c9023efe..7667f661 100644 --- a/libgambatte/src/memory.h +++ b/libgambatte/src/memory.h @@ -95,7 +95,7 @@ class Memory { template unsigned ff_read(unsigned p, unsigned long cc) { if (callbacksActive && readCallback_) - readCallback_(p, callbackCycleOffset(cc)); + readCallback_(p, callbackCycleOffset(cc), 0); return p < 0x80 ? nontrivial_ff_read(p, cc) : ioamhram_[p + 0x100]; } @@ -145,9 +145,9 @@ class Memory { template unsigned read(unsigned p, unsigned long cc) { if (!peek && callbacksActive && !execute && readCallback_) - readCallback_(p, callbackCycleOffset(cc)); + readCallback_(p, callbackCycleOffset(cc), 0); else if (!peek && callbacksActive && execute && opcode && execCallback_) - execCallback_(p, callbackCycleOffset(cc)); + execCallback_(p, callbackCycleOffset(cc), 0); if (biosMode_ && p < bios_.size() && !(p >= 0x100 && p < 0x200)) return readBios(p); @@ -223,7 +223,7 @@ class Memory { if (!poke && callbacksActive) { if (writeCallback_) - writeCallback_(p, callbackCycleOffset(cc)); + writeCallback_(p, callbackCycleOffset(cc), data); if (cdCallback_ && !biosMode_) { CDMapResult map = CDMap(p); @@ -241,7 +241,7 @@ class Memory { nontrivial_ff_write(p, data, cc); if (callbacksActive && writeCallback_) - writeCallback_(mm_io_begin + p, callbackCycleOffset(cc)); + writeCallback_(mm_io_begin + p, callbackCycleOffset(cc), data); if (callbacksActive && cdCallback_ && !biosMode_) { CDMapResult map = CDMap(mm_io_begin + p); if (map.type != eCDLog_AddrType_None)