2008-08-07 05:25:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Snes9x 1.51
|
|
|
|
*
|
|
|
|
* Nintendo Wii/Gamecube Port
|
|
|
|
* Tantric August 2008
|
|
|
|
*
|
|
|
|
* cheatmgr.cpp
|
|
|
|
*
|
|
|
|
* Cheat handling
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "snes9xGx.h"
|
|
|
|
#include "memmap.h"
|
2008-08-07 07:19:17 +02:00
|
|
|
#include "fileop.h"
|
2008-08-07 05:25:02 +02:00
|
|
|
#include "cheats.h"
|
2008-08-10 05:14:39 +02:00
|
|
|
#include "filesel.h"
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
extern SCheatData Cheat;
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* SetupCheats
|
|
|
|
*
|
|
|
|
* Erases any prexisting cheats, loads cheats from a cheat file
|
|
|
|
* Called when a ROM is first loaded
|
|
|
|
****************************************************************************/
|
|
|
|
void
|
|
|
|
SetupCheats()
|
|
|
|
{
|
|
|
|
S9xInitCheatData ();
|
|
|
|
S9xDeleteCheats ();
|
|
|
|
|
|
|
|
char cheatFile[150] = { '\0' };
|
|
|
|
|
2008-08-10 05:14:39 +02:00
|
|
|
int method = GCSettings.SaveMethod;
|
|
|
|
|
|
|
|
if(method == METHOD_AUTO)
|
|
|
|
method = autoSaveMethod();
|
|
|
|
|
|
|
|
if(method == METHOD_SD || method == METHOD_USB)
|
2008-08-08 09:57:01 +02:00
|
|
|
{
|
2008-08-10 05:14:39 +02:00
|
|
|
changeFATInterface(method, NOTSILENT);
|
2008-08-08 09:57:01 +02:00
|
|
|
sprintf (cheatFile, "%s/snes9x/cheats/%s.cht", ROOTFATDIR, Memory.ROMFilename);
|
|
|
|
}
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
// load cheat file if present
|
|
|
|
if(strlen(cheatFile) > 0)
|
2008-08-07 07:19:17 +02:00
|
|
|
{
|
2008-08-07 05:25:02 +02:00
|
|
|
if(S9xLoadCheatFile (cheatFile))
|
|
|
|
{
|
|
|
|
// disable all cheats loaded from the file
|
|
|
|
for (uint16 i = 0; i < Cheat.num_cheats; i++)
|
|
|
|
S9xDisableCheat(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|