Switch back to .cht format. Update to byuu's new form.

This commit is contained in:
Brandon Wright 2018-06-03 18:02:48 -05:00
parent 2645ba8d18
commit 642ce83e47
5 changed files with 21 additions and 27 deletions

View File

@ -654,7 +654,7 @@ char *S9xCheatGroupToText (SCheatGroup *g)
{
char *tmp = S9xCheatToText (&g->c[i]);
if (i != 0)
text += '+';
text += " + ";
text += tmp;
delete[] tmp;
}
@ -809,10 +809,10 @@ bool8 S9xLoadCheatFile (const char *filename)
return S9xLoadCheatFileClassic (filename);
}
n = bml_find_sub (bml, "cartridge");
n = bml_find_sub (bml, "cheat");
if (n)
{
S9xLoadCheatsFromBMLNode (n);
S9xLoadCheatsFromBMLNode (bml);
}
bml_free_node (bml);
@ -841,22 +841,19 @@ bool8 S9xSaveCheatFile (const char *filename)
if (!file)
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++)
{
char *txt = S9xCheatGroupToText (i);
fprintf (file,
" cheat%s\n"
"cheat\n"
" description: %s\n"
" code: %s\n",
(Cheat.g[i].enabled ? " enabled" : ""),
(Cheat.g[i].name ? Cheat.g[i].name : ""),
txt);
" code: %s\n"
"%s\n",
Cheat.g[i].name ? Cheat.g[i].name : "",
txt,
Cheat.g[i].enabled ? " enabled\n" : ""
);
delete[] txt;
}

View File

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

View File

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

View File

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

View File

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