Use .bml instead of .cht. Add fallbacks where loading.

This commit is contained in:
Brandon Wright 2018-04-30 17:19:33 -05:00
parent 074965bd1c
commit e3838a2dad
5 changed files with 57 additions and 54 deletions

View File

@ -766,7 +766,7 @@ static void S9xLoadCheatsFromBMLNode (bml_node *n)
return; return;
} }
bool8 S9xLoadCheatFileClassic (const char *filename) static bool8 S9xLoadCheatFileClassic (const char *filename)
{ {
FILE *fs; FILE *fs;
uint8 data[28]; uint8 data[28];

View File

@ -375,7 +375,7 @@ void
S9xAutoSaveSRAM (void) S9xAutoSaveSRAM (void)
{ {
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR)); Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
return; return;
} }

View File

@ -1788,6 +1788,7 @@ bool8 CMemory::LoadROMInt (int32 ROMfillSize)
S9xReset(); S9xReset();
S9xDeleteCheats(); S9xDeleteCheats();
if (!S9xLoadCheatFile(S9xGetFilename(".bml", CHEAT_DIR)))
S9xLoadCheatFile(S9xGetFilename(".cht", CHEAT_DIR)); S9xLoadCheatFile(S9xGetFilename(".cht", CHEAT_DIR));
return (TRUE); return (TRUE);
@ -1954,6 +1955,7 @@ bool8 CMemory::LoadMultiCartInt ()
S9xReset(); S9xReset();
S9xDeleteCheats(); S9xDeleteCheats();
if (!S9xLoadCheatFile(S9xGetFilename(".bml", CHEAT_DIR)))
S9xLoadCheatFile(S9xGetFilename(".cht", CHEAT_DIR)); S9xLoadCheatFile(S9xGetFilename(".cht", CHEAT_DIR));
return (TRUE); return (TRUE);

View File

@ -1620,7 +1620,7 @@ void S9xExit (void)
Memory.SaveSRAM(S9xGetFilename(".srm", SRAM_DIR)); Memory.SaveSRAM(S9xGetFilename(".srm", SRAM_DIR));
S9xResetSaveTimer(FALSE); S9xResetSaveTimer(FALSE);
S9xSaveCheatFile(S9xGetFilename(".cht", CHEAT_DIR)); S9xSaveCheatFile(S9xGetFilename(".bml", CHEAT_DIR));
S9xUnmapAllControls(); S9xUnmapAllControls();
S9xDeinitDisplay(); S9xDeinitDisplay();
Memory.Deinit(); Memory.Deinit();
@ -1792,6 +1792,7 @@ int main (int argc, char **argv)
if (Settings.ApplyCheats) if (Settings.ApplyCheats)
{ {
if (!S9xLoadCheatFile(S9xGetFilename(".bml", CHEAT_DIR)))
S9xLoadCheatFile(S9xGetFilename(".cht", CHEAT_DIR)); S9xLoadCheatFile(S9xGetFilename(".cht", CHEAT_DIR));
} }

View File

@ -2307,7 +2307,7 @@ LRESULT CALLBACK WinProc(
case ID_CHEAT_ENTER: case ID_CHEAT_ENTER:
RestoreGUIDisplay (); RestoreGUIDisplay ();
DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CHEATER), hWnd, DlgCheater); DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CHEATER), hWnd, DlgCheater);
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
RestoreSNESDisplay (); RestoreSNESDisplay ();
break; break;
case ID_CHEAT_SEARCH: case ID_CHEAT_SEARCH:
@ -2326,7 +2326,7 @@ LRESULT CALLBACK WinProc(
case ID_CHEAT_SEARCH_MODAL: case ID_CHEAT_SEARCH_MODAL:
RestoreGUIDisplay (); RestoreGUIDisplay ();
DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CHEAT_SEARCH), hWnd, DlgCheatSearch); // modal DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CHEAT_SEARCH), hWnd, DlgCheatSearch); // modal
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
RestoreSNESDisplay (); RestoreSNESDisplay ();
break; break;
case ID_CHEAT_APPLY: case ID_CHEAT_APPLY:
@ -3653,7 +3653,7 @@ loop_exit:
if (!Settings.StopEmulation) if (!Settings.StopEmulation)
{ {
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR)); Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
} }
//if (!VOODOO_MODE && !GUI.FullScreen) //if (!VOODOO_MODE && !GUI.FullScreen)
// GetWindowRect (GUI.hWnd, &GUI.window_size); // GetWindowRect (GUI.hWnd, &GUI.window_size);
@ -4093,7 +4093,7 @@ static bool LoadROM(const TCHAR *filename, const TCHAR *filename2 /*= NULL*/) {
if (!Settings.StopEmulation) { if (!Settings.StopEmulation) {
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR)); Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
} }
if(filename2) if(filename2)
@ -9111,7 +9111,7 @@ INT_PTR CALLBACK DlgCheatSearch(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
case WM_DESTROY: case WM_DESTROY:
{ {
cheatSearchHWND = NULL; cheatSearchHWND = NULL;
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
break; break;
} }