delete existing cheats before loading new game, proper cheats init. avoids cheats from last game applied to next one.

This commit is contained in:
dborth 2009-07-08 22:28:26 +00:00
parent 93f2826d21
commit f01152621d
4 changed files with 8 additions and 16 deletions

View File

@ -62,9 +62,7 @@ SetupCheats()
{ {
char filepath[1024]; char filepath[1024];
int offset = 0; int offset = 0;
uint16 i;
S9xInitCheatData ();
S9xDeleteCheats ();
int method = GCSettings.SaveMethod; int method = GCSettings.SaveMethod;
@ -87,7 +85,7 @@ SetupCheats()
if(NGCLoadCheatFile (offset)) if(NGCLoadCheatFile (offset))
{ {
// disable all cheats loaded from the file // disable all cheats loaded from the file
for (uint16 i = 0; i < Cheat.num_cheats; i++) for (i = 0; i < Cheat.num_cheats; i++)
S9xDisableCheat(i); S9xDisableCheat(i);
} }
} }

View File

@ -474,6 +474,7 @@ int BrowserLoadFile(int method)
StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename); StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename);
SNESROMSize = 0; SNESROMSize = 0;
S9xDeleteCheats();
if(!inSz) if(!inSz)
{ {

View File

@ -170,11 +170,7 @@
#include "apu.h" #include "apu.h"
#include "dma.h" #include "dma.h"
#include "sa1.h" #include "sa1.h"
#ifndef NGC
#include "cheats.h" #include "cheats.h"
#endif
#include "srtc.h" #include "srtc.h"
#include "sdd1.h" #include "sdd1.h"
#include "spc7110.h" #include "spc7110.h"
@ -313,9 +309,9 @@ void S9xReset (void)
S9xSA1Init (); S9xSA1Init ();
if (Settings.C4) if (Settings.C4)
S9xInitC4 (); S9xInitC4 ();
#ifndef NGC
S9xInitCheatData (); S9xInitCheatData ();
#endif
if (Settings.OBC1) if (Settings.OBC1)
ResetOBC1(); ResetOBC1();
if (Settings.SuperFX) if (Settings.SuperFX)
@ -359,9 +355,7 @@ void S9xSoftReset (void)
if (Settings.C4) if (Settings.C4)
S9xInitC4 (); S9xInitC4 ();
#ifndef NGC
S9xInitCheatData (); S9xInitCheatData ();
#endif
// Settings.Paused = FALSE; // Settings.Paused = FALSE;
} }

View File

@ -190,11 +190,10 @@
#include "seta.h" #include "seta.h"
#include "srtc.h" #include "srtc.h"
#include "bsx.h" #include "bsx.h"
#include "cheats.h"
#ifndef NGC #ifndef NGC
#include "reader.h" #include "reader.h"
#include "cheats.h"
#else #else
#include <gccore.h> #include <gccore.h>
@ -1006,8 +1005,8 @@ again:
InitROM(); InitROM();
#ifndef NGC
S9xInitCheatData(); S9xInitCheatData();
#ifndef NGC
S9xApplyCheats(); S9xApplyCheats();
#endif #endif
@ -1231,8 +1230,8 @@ bool8 CMemory::LoadMultiCart (const char *cartA, const char *cartB)
InitROM(); InitROM();
#ifndef NGC
S9xInitCheatData(); S9xInitCheatData();
#ifndef NGC
S9xApplyCheats(); S9xApplyCheats();
#endif #endif