Skip to content

Commit

Permalink
Prevent HWEvents from firing when setting cheats
Browse files Browse the repository at this point in the history
  • Loading branch information
OV2 committed Mar 28, 2012
1 parent 9cc05b3 commit da4829e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cheats2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,26 @@ 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);
}

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;
}

Expand Down

0 comments on commit da4829e

Please sign in to comment.