mirror of https://github.com/snes9xgit/snes9x.git
Switch back to .cht format. Update to byuu's new form.
This commit is contained in:
parent
2645ba8d18
commit
642ce83e47
25
cheats2.cpp
25
cheats2.cpp
|
@ -654,7 +654,7 @@ char *S9xCheatGroupToText (SCheatGroup *g)
|
||||||
{
|
{
|
||||||
char *tmp = S9xCheatToText (&g->c[i]);
|
char *tmp = S9xCheatToText (&g->c[i]);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
text += '+';
|
text += " + ";
|
||||||
text += tmp;
|
text += tmp;
|
||||||
delete[] tmp;
|
delete[] tmp;
|
||||||
}
|
}
|
||||||
|
@ -809,10 +809,10 @@ bool8 S9xLoadCheatFile (const char *filename)
|
||||||
return S9xLoadCheatFileClassic (filename);
|
return S9xLoadCheatFileClassic (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
n = bml_find_sub (bml, "cartridge");
|
n = bml_find_sub (bml, "cheat");
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
S9xLoadCheatsFromBMLNode (n);
|
S9xLoadCheatsFromBMLNode (bml);
|
||||||
}
|
}
|
||||||
|
|
||||||
bml_free_node (bml);
|
bml_free_node (bml);
|
||||||
|
@ -841,22 +841,19 @@ bool8 S9xSaveCheatFile (const char *filename)
|
||||||
if (!file)
|
if (!file)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
fprintf (file, "cartridge sha256=");
|
|
||||||
for (i = 0; i < 32; i++)
|
|
||||||
fprintf (file, "%02x", Memory.ROMSHA256[i]);
|
|
||||||
fprintf (file, "\n");
|
|
||||||
|
|
||||||
for (i = 0; i < Cheat.g.size (); i++)
|
for (i = 0; i < Cheat.g.size (); i++)
|
||||||
{
|
{
|
||||||
char *txt = S9xCheatGroupToText (i);
|
char *txt = S9xCheatGroupToText (i);
|
||||||
|
|
||||||
fprintf (file,
|
fprintf (file,
|
||||||
" cheat%s\n"
|
"cheat\n"
|
||||||
" description: %s\n"
|
" description: %s\n"
|
||||||
" code: %s\n",
|
" code: %s\n"
|
||||||
(Cheat.g[i].enabled ? " enabled" : ""),
|
"%s\n",
|
||||||
(Cheat.g[i].name ? Cheat.g[i].name : ""),
|
Cheat.g[i].name ? Cheat.g[i].name : "",
|
||||||
txt);
|
txt,
|
||||||
|
Cheat.g[i].enabled ? " enabled\n" : ""
|
||||||
|
);
|
||||||
|
|
||||||
delete[] txt;
|
delete[] txt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ void
|
||||||
S9xAutoSaveSRAM (void)
|
S9xAutoSaveSRAM (void)
|
||||||
{
|
{
|
||||||
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
|
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
|
||||||
S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
|
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1788,8 +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);
|
||||||
}
|
}
|
||||||
|
@ -1955,8 +1954,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1634,7 +1634,7 @@ void S9xExit (void)
|
||||||
|
|
||||||
Memory.SaveSRAM(S9xGetFilename(".srm", SRAM_DIR));
|
Memory.SaveSRAM(S9xGetFilename(".srm", SRAM_DIR));
|
||||||
S9xResetSaveTimer(FALSE);
|
S9xResetSaveTimer(FALSE);
|
||||||
S9xSaveCheatFile(S9xGetFilename(".bml", CHEAT_DIR));
|
S9xSaveCheatFile(S9xGetFilename(".cht", CHEAT_DIR));
|
||||||
S9xUnmapAllControls();
|
S9xUnmapAllControls();
|
||||||
S9xDeinitDisplay();
|
S9xDeinitDisplay();
|
||||||
Memory.Deinit();
|
Memory.Deinit();
|
||||||
|
@ -1806,8 +1806,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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
S9xParseArgsForCheats(argv, argc);
|
S9xParseArgsForCheats(argv, argc);
|
||||||
|
|
|
@ -2353,7 +2353,7 @@ LRESULT CALLBACK WinProc(
|
||||||
{
|
{
|
||||||
WinSearchCheatDatabase();
|
WinSearchCheatDatabase();
|
||||||
}
|
}
|
||||||
S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
|
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR));
|
||||||
RestoreSNESDisplay ();
|
RestoreSNESDisplay ();
|
||||||
break;
|
break;
|
||||||
case ID_CHEAT_SEARCH:
|
case ID_CHEAT_SEARCH:
|
||||||
|
@ -2372,7 +2372,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 (".bml", CHEAT_DIR));
|
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR));
|
||||||
RestoreSNESDisplay ();
|
RestoreSNESDisplay ();
|
||||||
break;
|
break;
|
||||||
case ID_CHEAT_APPLY:
|
case ID_CHEAT_APPLY:
|
||||||
|
@ -3685,7 +3685,7 @@ loop_exit:
|
||||||
if (!Settings.StopEmulation)
|
if (!Settings.StopEmulation)
|
||||||
{
|
{
|
||||||
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
|
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR));
|
||||||
S9xSaveCheatFile (S9xGetFilename (".bml", CHEAT_DIR));
|
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR));
|
||||||
}
|
}
|
||||||
//if (!VOODOO_MODE && !GUI.FullScreen)
|
//if (!VOODOO_MODE && !GUI.FullScreen)
|
||||||
// GetWindowRect (GUI.hWnd, &GUI.window_size);
|
// GetWindowRect (GUI.hWnd, &GUI.window_size);
|
||||||
|
@ -4133,7 +4133,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 (".bml", CHEAT_DIR));
|
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(filename2)
|
if(filename2)
|
||||||
|
@ -9289,7 +9289,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 (".bml", CHEAT_DIR));
|
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue