From da4829ec90ae4c9a71764549e2aa4657296bfb9d Mon Sep 17 00:00:00 2001 From: OV2 Date: Tue, 27 Mar 2012 16:40:34 +0200 Subject: [PATCH] Prevent HWEvents from firing when setting cheats --- cheats2.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cheats2.cpp b/cheats2.cpp index aeef2cc6..c3558efe 100644 --- a/cheats2.cpp +++ b/cheats2.cpp @@ -186,10 +186,13 @@ static void S9xSetByteFree (uint8, uint32); static uint8 S9xGetByteFree (uint32 address) { - uint32 Cycles = CPU.Cycles; + int32 Cycles = CPU.Cycles; + int32 NextEvent = CPU.NextEvent; uint8 byte; + CPU.NextEvent = 0x7FFFFFFF; byte = S9xGetByte(address); + CPU.NextEvent = NextEvent; CPU.Cycles = Cycles; return (byte); @@ -197,9 +200,12 @@ static uint8 S9xGetByteFree (uint32 address) static void S9xSetByteFree (uint8 byte, uint32 address) { - uint32 Cycles = CPU.Cycles; + int32 Cycles = CPU.Cycles; + int32 NextEvent = CPU.NextEvent; + CPU.NextEvent = 0x7FFFFFFF; S9xSetByte(byte, address); + CPU.NextEvent = NextEvent; CPU.Cycles = Cycles; }