ADDED option "File->Load Game->Do not change battery save" (currently GBA only)
This commit is contained in:
parent
81a8b3cdd0
commit
785706fcbb
|
@ -77,6 +77,15 @@ void eepromReadGame(gzFile gzFile, int version)
|
|||
}
|
||||
}
|
||||
|
||||
void eepromReadGameSkip(gzFile gzFile, int version)
|
||||
{
|
||||
// skip the eeprom data in a save game
|
||||
utilReadDataSkip(gzFile, eepromSaveData);
|
||||
if(version >= SAVE_GAME_VERSION_3) {
|
||||
utilGzSeek(gzFile, sizeof(int), SEEK_CUR);
|
||||
utilGzSeek(gzFile, 0x2000, SEEK_CUR);
|
||||
}
|
||||
}
|
||||
|
||||
int eepromRead(u32 /* address */)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
extern void eepromSaveGame(gzFile _gzFile);
|
||||
extern void eepromReadGame(gzFile _gzFile, int version);
|
||||
extern void eepromReadGameSkip(gzFile _gzFile, int version);
|
||||
extern int eepromRead(u32 address);
|
||||
extern void eepromWrite(u32 address, u8 value);
|
||||
extern void eepromInit();
|
||||
|
|
|
@ -97,6 +97,18 @@ void flashReadGame(gzFile gzFile, int version)
|
|||
}
|
||||
}
|
||||
|
||||
void flashReadGameSkip(gzFile gzFile, int version)
|
||||
{
|
||||
// skip the flash data in a save game
|
||||
if(version < SAVE_GAME_VERSION_5)
|
||||
utilReadDataSkip(gzFile, flashSaveData);
|
||||
else if(version < SAVE_GAME_VERSION_7) {
|
||||
utilReadDataSkip(gzFile, flashSaveData2);
|
||||
} else {
|
||||
utilReadDataSkip(gzFile, flashSaveData3);
|
||||
}
|
||||
}
|
||||
|
||||
void flashSetSize(int size)
|
||||
{
|
||||
// log("Setting flash size to %d\n", size);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
extern void flashSaveGame(gzFile _gzFile);
|
||||
extern void flashReadGame(gzFile _gzFile, int version);
|
||||
extern void flashReadGameSkip(gzFile _gzFile, int version);
|
||||
extern u8 flashRead(u32 address);
|
||||
extern void flashWrite(u32 address, u8 byte);
|
||||
extern void flashDelayedWrite(u32 address, u8 byte);
|
||||
|
|
|
@ -50,6 +50,7 @@ bool speedHack = false;
|
|||
int cpuSaveType = 0;
|
||||
bool cheatsEnabled = true;
|
||||
bool mirroringEnable = false;
|
||||
bool skipSaveGameBattery = false;
|
||||
|
||||
u8 *bios = NULL;
|
||||
u8 *rom = NULL;
|
||||
|
|
|
@ -60,6 +60,7 @@ extern bool speedHack;
|
|||
extern int cpuSaveType;
|
||||
extern bool cheatsEnabled;
|
||||
extern bool mirroringEnable;
|
||||
extern bool skipSaveGameBattery;
|
||||
|
||||
extern u8 *bios;
|
||||
extern u8 *rom;
|
||||
|
|
15
src/Util.cpp
15
src/Util.cpp
|
@ -57,6 +57,7 @@ extern u32 systemColorMap32[0x10000];
|
|||
static int (ZEXPORT *utilGzWriteFunc)(gzFile, const voidp, unsigned int) = NULL;
|
||||
static int (ZEXPORT *utilGzReadFunc)(gzFile, voidp, unsigned int) = NULL;
|
||||
static int (ZEXPORT *utilGzCloseFunc)(gzFile) = NULL;
|
||||
static z_off_t (ZEXPORT *utilGzSeekFunc)(gzFile, z_off_t, int) = NULL;
|
||||
|
||||
bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix)
|
||||
{
|
||||
|
@ -631,6 +632,14 @@ void utilReadData(gzFile gzFile, variable_desc* data)
|
|||
}
|
||||
}
|
||||
|
||||
void utilReadDataSkip(gzFile gzFile, variable_desc* data)
|
||||
{
|
||||
while(data->address) {
|
||||
utilGzSeek(gzFile, data->size, SEEK_CUR);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
void utilWriteData(gzFile gzFile, variable_desc *data)
|
||||
{
|
||||
while(data->address) {
|
||||
|
@ -644,6 +653,7 @@ gzFile utilGzOpen(const char *file, const char *mode)
|
|||
utilGzWriteFunc = (int (ZEXPORT *)(void *,void * const, unsigned int))gzwrite;
|
||||
utilGzReadFunc = gzread;
|
||||
utilGzCloseFunc = gzclose;
|
||||
utilGzSeekFunc = gzseek;
|
||||
|
||||
return gzopen(file, mode);
|
||||
}
|
||||
|
@ -672,6 +682,11 @@ int utilGzClose(gzFile file)
|
|||
return utilGzCloseFunc(file);
|
||||
}
|
||||
|
||||
z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence)
|
||||
{
|
||||
return utilGzSeekFunc(file, offset, whence);
|
||||
}
|
||||
|
||||
long utilGzMemTell(gzFile file)
|
||||
{
|
||||
return memtell(file);
|
||||
|
|
|
@ -52,6 +52,7 @@ extern void utilPutDword(u8 *, u32);
|
|||
extern void utilPutWord(u8 *, u16);
|
||||
extern void utilWriteData(gzFile, variable_desc *);
|
||||
extern void utilReadData(gzFile, variable_desc *);
|
||||
extern void utilReadDataSkip(gzFile, variable_desc *);
|
||||
extern int utilReadInt(gzFile);
|
||||
extern void utilWriteInt(gzFile, int);
|
||||
extern gzFile utilGzOpen(const char *file, const char *mode);
|
||||
|
@ -59,6 +60,7 @@ extern gzFile utilMemGzOpen(char *memory, int available, const char *mode);
|
|||
extern int utilGzWrite(gzFile file, const voidp buffer, unsigned int len);
|
||||
extern int utilGzRead(gzFile file, voidp buffer, unsigned int len);
|
||||
extern int utilGzClose(gzFile file);
|
||||
extern z_off_t utilGzSeek(gzFile file, z_off_t offset, int whence);
|
||||
extern long utilGzMemTell(gzFile file);
|
||||
extern void utilGBAFindSave(const u8 *, const int);
|
||||
extern void utilUpdateSystemColorMaps();
|
||||
|
|
|
@ -746,8 +746,15 @@ static bool CPUReadState(gzFile gzFile)
|
|||
utilGzRead(gzFile, pix, 4*241*162);
|
||||
utilGzRead(gzFile, ioMem, 0x400);
|
||||
|
||||
eepromReadGame(gzFile, version);
|
||||
flashReadGame(gzFile, version);
|
||||
if(skipSaveGameBattery) {
|
||||
// skip eeprom data
|
||||
eepromReadGameSkip(gzFile, version);
|
||||
// skip flash data
|
||||
flashReadGameSkip(gzFile, version);
|
||||
} else {
|
||||
eepromReadGame(gzFile, version);
|
||||
flashReadGame(gzFile, version);
|
||||
}
|
||||
soundReadGame(gzFile, version);
|
||||
|
||||
if(version > SAVE_GAME_VERSION_1) {
|
||||
|
|
|
@ -440,6 +440,8 @@ 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)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
|
|
@ -428,6 +428,8 @@ public:
|
|||
afx_msg void OnPixelfilterMultiThreading();
|
||||
afx_msg void OnUpdatePixelfilterMultiThreading(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateOptionsSelectPlugin(CCmdUI *pCmdUI);
|
||||
afx_msg void OnLoadgameDonotchangebatterysave();
|
||||
afx_msg void OnUpdateLoadgameDonotchangebatterysave(CCmdUI *pCmdUI);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -991,3 +991,14 @@ void MainWnd::OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI)
|
|||
{
|
||||
pCmdUI->SetCheck(theApp.autoLoadMostRecent);
|
||||
}
|
||||
|
||||
void MainWnd::OnLoadgameDonotchangebatterysave()
|
||||
{
|
||||
theApp.winSkipSaveGameBattery = !theApp.winSkipSaveGameBattery;
|
||||
skipSaveGameBattery = theApp.winSkipSaveGameBattery;
|
||||
}
|
||||
|
||||
void MainWnd::OnUpdateLoadgameDonotchangebatterysave(CCmdUI *pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(theApp.winSkipSaveGameBattery);
|
||||
}
|
||||
|
|
|
@ -336,6 +336,7 @@ VBA::VBA()
|
|||
wasPaused = false;
|
||||
frameskipadjust = 0;
|
||||
autoLoadMostRecent = false;
|
||||
winSkipSaveGameBattery = false;
|
||||
fsMaxScale = 0;
|
||||
romSize = 0;
|
||||
lastWindowed = VIDEO_3X;
|
||||
|
@ -1761,6 +1762,9 @@ void VBA::loadSettings()
|
|||
autoLoadMostRecent = regQueryDwordValue("autoLoadMostRecent", false) ? true :
|
||||
false;
|
||||
|
||||
winSkipSaveGameBattery = regQueryDwordValue("winSkipSaveGameBattery", false) ? true : false;
|
||||
skipSaveGameBattery = theApp.winSkipSaveGameBattery;
|
||||
|
||||
cheatsEnabled = regQueryDwordValue("cheatsEnabled", false) ? true : false;
|
||||
|
||||
fsMaxScale = regQueryDwordValue("fsMaxScale", 0);
|
||||
|
@ -2669,6 +2673,7 @@ void VBA::saveSettings()
|
|||
|
||||
regSetDwordValue("joypadDefault", joypadDefault);
|
||||
regSetDwordValue("autoLoadMostRecent", autoLoadMostRecent);
|
||||
regSetDwordValue("winSkipSaveGameBattery", winSkipSaveGameBattery);
|
||||
regSetDwordValue("cheatsEnabled", cheatsEnabled);
|
||||
regSetDwordValue("fsMaxScale", fsMaxScale);
|
||||
regSetDwordValue("throttle", throttle);
|
||||
|
|
|
@ -201,6 +201,7 @@ class VBA : public CWinApp
|
|||
bool wasPaused;
|
||||
int frameskipadjust;
|
||||
bool autoLoadMostRecent;
|
||||
bool winSkipSaveGameBattery;
|
||||
int fsMaxScale;
|
||||
int romSize;
|
||||
VIDEO_SIZE lastWindowed;
|
||||
|
|
|
@ -12,6 +12,38 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// German (Germany) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.\0"
|
||||
END
|
||||
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // German (Germany) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
|
@ -1515,6 +1547,7 @@ 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
|
||||
|
|
|
@ -855,13 +855,15 @@
|
|||
#define ID_FILE_OPEN_GBC 40358
|
||||
#define ID_OUTPUTAPI_XAUDIO2 40359
|
||||
#define ID_PIXELFILTER_MULTI 40360
|
||||
#define ID_EMULATOR_LOADSTATESHOULD 40361
|
||||
#define ID_LOADGAME_DONOTCHANGEBATTERYSAVE 40362
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 163
|
||||
#define _APS_NEXT_COMMAND_VALUE 40361
|
||||
#define _APS_NEXT_COMMAND_VALUE 40363
|
||||
#define _APS_NEXT_CONTROL_VALUE 1285
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue