ADDED new function "Load Game -> Do not change cheat list"

This commit is contained in:
spacy51 2008-10-29 10:41:52 +00:00
parent 817c6a43dc
commit 644ea117dc
16 changed files with 101 additions and 19 deletions

View File

@ -2667,6 +2667,27 @@ void cheatsReadGame(gzFile file, int version)
}
}
// skip the cheat list data
void cheatsReadGameSkip( gzFile file, int version )
{
int nCheats = 0;
nCheats = utilReadInt( file );
if( version >= 9 ) {
utilGzSeek( file, sizeof( cheatsList ), SEEK_CUR );
}
bool firstCodeBreaker = true;
for( int i = 0; i < nCheats; i++ ) {
if( version < 9 ) {
utilGzSeek( file, ( 7 * sizeof(int) ) + ( 52 * sizeof(char) ), SEEK_CUR );
}
}
}
void cheatsSaveCheatList(const char *file)
{
if(cheatsNumber == 0)

View File

@ -25,6 +25,7 @@ void cheatsEnable(int number);
void cheatsDisable(int number);
void cheatsSaveGame(gzFile file);
void cheatsReadGame(gzFile file, int version);
void cheatsReadGameSkip(gzFile file, int version);
void cheatsSaveCheatList(const char *file);
bool cheatsLoadCheatList(const char *file);
void cheatsWriteMemory(u32 address, u32 value);

View File

@ -33,6 +33,7 @@ int cpuSaveType = 0;
bool cheatsEnabled = true;
bool mirroringEnable = false;
bool skipSaveGameBattery = false;
bool skipSaveGameCheats = false;
// this is an optional hack to change the backdrop/background color:
// -1: disabled

View File

@ -41,7 +41,8 @@ extern bool speedHack;
extern int cpuSaveType;
extern bool cheatsEnabled;
extern bool mirroringEnable;
extern bool skipSaveGameBattery;
extern bool skipSaveGameBattery; // skip battery data when reading save states
extern bool skipSaveGameCheats; // skip cheat list data when reading save states
extern int customBackdropColor;
extern u8 *bios;

View File

@ -740,8 +740,13 @@ static bool CPUReadState(gzFile gzFile)
soundReadGame(gzFile, version);
if(version > SAVE_GAME_VERSION_1) {
if(skipSaveGameCheats) {
// skip cheats list data
cheatsReadGameSkip(gzFile, version);
} else {
cheatsReadGame(gzFile, version);
}
}
if(version > SAVE_GAME_VERSION_6) {
rtcReadGame(gzFile);
}

View File

@ -3852,7 +3852,11 @@ static bool gbReadSaveState(gzFile gzFile)
systemDrawScreen();
if(version > GBSAVE_GAME_VERSION_1)
if( skipSaveGameCheats ) {
gbCheatsReadGameSkip(gzFile, version);
} else {
gbCheatsReadGame(gzFile, version);
}
if (version<11)
{

View File

@ -73,6 +73,35 @@ void gbCheatsReadGame(gzFile gzFile, int version)
gbCheatUpdateMap();
}
void gbCheatsReadGameSkip(gzFile gzFile, int version)
{
if( version <= 8 ) {
int gbGgOn = utilReadInt( gzFile );
if( gbGgOn ) {
int n = utilReadInt( gzFile );
if( n > 0 ) {
utilGzSeek( gzFile, n * sizeof(gbXxCheat), SEEK_CUR );
}
}
int gbGsOn = utilReadInt( gzFile );
if( gbGsOn ) {
int n = utilReadInt(gzFile);
if( n > 0 ) {
utilGzSeek( gzFile, n * sizeof(gbXxCheat), SEEK_CUR );
}
}
} else {
int n = utilReadInt( gzFile );
if( n > 0 ) {
utilGzSeek( gzFile, n * sizeof(gbCheat), SEEK_CUR );
}
}
}
void gbCheatsSaveCheatList(const char *file)
{
if(gbCheatNumber == 0)

View File

@ -20,6 +20,7 @@ struct gbCheat {
void gbCheatsSaveGame(gzFile);
void gbCheatsReadGame(gzFile, int);
void gbCheatsReadGameSkip(gzFile, int);
void gbCheatsSaveCheatList(const char *);
bool gbCheatsLoadCheatList(const char *);
bool gbCheatReadGSCodeFile(const char *);

View File

@ -11,6 +11,7 @@ extern bool useBios;
extern bool skipBios;
extern u8 *bios;
extern bool skipSaveGameBattery;
extern bool skipSaveGameCheats;
extern u8 *gbRom;
extern u8 *gbRam;

View File

@ -386,8 +386,13 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_COMMAND(ID_PIXELFILTER_MULTI, &MainWnd::OnPixelfilterMultiThreading)
ON_UPDATE_COMMAND_UI(ID_PIXELFILTER_MULTI, &MainWnd::OnUpdatePixelfilterMultiThreading)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_SELECT_PLUGIN, &MainWnd::OnUpdateOptionsSelectPlugin)
ON_COMMAND(ID_LOADGAME_DONOTCHANGEBATTERYSAVE, &MainWnd::OnLoadgameDonotchangebatterysave)
ON_UPDATE_COMMAND_UI(ID_LOADGAME_DONOTCHANGEBATTERYSAVE, &MainWnd::OnUpdateLoadgameDonotchangebatterysave)
ON_COMMAND(ID_LOADGAME_DONOTCHANGECHEATLIST, &MainWnd::OnLoadgameDonotchangecheatlist)
ON_UPDATE_COMMAND_UI(ID_LOADGAME_DONOTCHANGECHEATLIST, &MainWnd::OnUpdateLoadgameDonotchangecheatlist)
ON_COMMAND(ID_OUTPUTAPI_XAUDIO2CONFIG, &MainWnd::OnOutputapiXaudio2config)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_XAUDIO2CONFIG, &MainWnd::OnUpdateOutputapiXaudio2config)
ON_WM_ENTERSIZEMOVE()

View File

@ -355,8 +355,11 @@ protected:
afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnUpdatePixelfilterMultiThreading(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsSelectPlugin(CCmdUI *pCmdUI);
afx_msg void OnLoadgameDonotchangebatterysave();
afx_msg void OnUpdateLoadgameDonotchangebatterysave(CCmdUI *pCmdUI);
afx_msg void OnLoadgameDonotchangecheatlist();
afx_msg void OnUpdateLoadgameDonotchangecheatlist(CCmdUI *pCmdUI);
afx_msg void OnEnterSizeMove();

View File

@ -877,11 +877,20 @@ void MainWnd::OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI)
void MainWnd::OnLoadgameDonotchangebatterysave()
{
theApp.winSkipSaveGameBattery = !theApp.winSkipSaveGameBattery;
skipSaveGameBattery = theApp.winSkipSaveGameBattery;
skipSaveGameBattery = !skipSaveGameBattery;
}
void MainWnd::OnUpdateLoadgameDonotchangebatterysave(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(theApp.winSkipSaveGameBattery);
pCmdUI->SetCheck(skipSaveGameBattery);
}
void MainWnd::OnLoadgameDonotchangecheatlist()
{
skipSaveGameCheats = !skipSaveGameCheats;
}
void MainWnd::OnUpdateLoadgameDonotchangecheatlist(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(skipSaveGameCheats);
}

View File

@ -309,7 +309,6 @@ VBA::VBA()
wasPaused = false;
frameskipadjust = 0;
autoLoadMostRecent = false;
winSkipSaveGameBattery = false;
maxScale = 0;
romSize = 0;
lastWindowed = VIDEO_3X;
@ -1716,11 +1715,11 @@ void VBA::loadSettings()
if(joypadDefault < 0 || joypadDefault > 3)
joypadDefault = 0;
autoLoadMostRecent = regQueryDwordValue("autoLoadMostRecent", false) ? true :
false;
autoLoadMostRecent = ( 1 == regQueryDwordValue("autoLoadMostRecent", 0) ) ? true : false;
winSkipSaveGameBattery = regQueryDwordValue("winSkipSaveGameBattery", false) ? true : false;
skipSaveGameBattery = theApp.winSkipSaveGameBattery;
skipSaveGameBattery = ( 1 == regQueryDwordValue("skipSaveGameBattery", 0) ) ? true : false;
skipSaveGameCheats = ( 1 == regQueryDwordValue("skipSaveGameCheats", 0) ) ? true : false;
cheatsEnabled = regQueryDwordValue("cheatsEnabled", false) ? true : false;
@ -2633,7 +2632,8 @@ void VBA::saveSettings()
regSetDwordValue("joypadDefault", joypadDefault);
regSetDwordValue("autoLoadMostRecent", autoLoadMostRecent);
regSetDwordValue("winSkipSaveGameBattery", winSkipSaveGameBattery);
regSetDwordValue("skipSaveGameBattery", skipSaveGameBattery);
regSetDwordValue("skipSaveGameCheats", skipSaveGameCheats);
regSetDwordValue("cheatsEnabled", cheatsEnabled);
regSetDwordValue("maxScale", maxScale);
regSetDwordValue("throttle", throttle);

View File

@ -179,7 +179,6 @@ class VBA : public CWinApp
bool wasPaused;
int frameskipadjust;
bool autoLoadMostRecent;
bool winSkipSaveGameBattery;
int maxScale;
int romSize;
VIDEO_SIZE lastWindowed;

View File

@ -1632,7 +1632,6 @@ BEGIN
BEGIN
MENUITEM "Most recent", ID_FILE_LOADGAME_MOSTRECENT
MENUITEM "Auto load most recent", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT
MENUITEM "Do not change battery save", ID_LOADGAME_DONOTCHANGEBATTERYSAVE
MENUITEM SEPARATOR
MENUITEM "Slot #1", ID_FILE_LOADGAME_SLOT1
MENUITEM "Slot #2", ID_FILE_LOADGAME_SLOT2
@ -1644,6 +1643,9 @@ BEGIN
MENUITEM "Slot #8", ID_FILE_LOADGAME_SLOT8
MENUITEM "Slot #9", ID_FILE_LOADGAME_SLOT9
MENUITEM "Slot #10", ID_FILE_LOADGAME_SLOT10
MENUITEM SEPARATOR
MENUITEM "Do not change battery save", ID_LOADGAME_DONOTCHANGEBATTERYSAVE
MENUITEM "Do not change cheat list", ID_LOADGAME_DONOTCHANGECHEATLIST
END
POPUP "Save Game"
BEGIN

View File

@ -392,7 +392,6 @@
#define IDC_MAP_VIEW_ZOOM 1138
#define IDS_MOVIE_PLAY 1138
#define IDC_VIEWER 1140
#define IDC_SAVE_BG2 1140
#define IDC_CHANGE_BACKDROP 1140
#define IDC_ADDRESSES 1141
#define IDC_GO 1143
@ -870,13 +869,14 @@
#define ID_FILE_OPEN_GBA 40366
#define ID_FILE_QUICKOPENROM 40367
#define ID_OPTIONS_VIDEO_LAYERS_RESET 40368
#define ID_LOADGAME_DONOTCHANGECHEATLIST 40370
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 165
#define _APS_NEXT_COMMAND_VALUE 40370
#define _APS_NEXT_COMMAND_VALUE 40371
#define _APS_NEXT_CONTROL_VALUE 1297
#define _APS_NEXT_SYMED_VALUE 103
#endif