minor fix in cheat system

This commit is contained in:
mtabachenko 2009-01-15 11:43:25 +00:00
parent 8a9103ed33
commit 92fb5e378f
2 changed files with 11 additions and 4 deletions

View File

@ -134,12 +134,13 @@ BOOL cheatsSave()
for (int t = 0; t < cheats[i].num; t++)
{
char tmp_hex[6] = {0};
wsprintf(tmp_hex, "%06X", cheats[i].hi[t]);
wsprintf(buf, "H%03i%04i", i, t);
wsprintf(tmp_hex, "%06X", cheats[i].hi[t]);
WritePrivateProfileString("Cheats", buf, tmp_hex, (char *)cheatFilename);
wsprintf(buf, "L%03i%04i", i, t);
WritePrivateProfileInt("Cheats", buf, cheats[i].lo[t], (char *)cheatFilename);
wsprintf(tmp_hex, "%06X", cheats[i].lo[t]);
WritePrivateProfileString("Cheats", buf, tmp_hex, (char *)cheatFilename);
}
}
#endif
@ -173,7 +174,8 @@ BOOL cheatsLoad()
GetPrivateProfileString("Cheats", buf, "0", tmp_buf, 10, (char *)cheatFilename);
sscanf_s(tmp_buf, "%x", &cheats[i].hi[t]);
wsprintf(buf, "L%03i%04i", i, t);
cheats[i].lo[t] = GetPrivateProfileInt("Cheats", buf, 0, (char *)cheatFilename);
GetPrivateProfileString("Cheats", buf, "0", tmp_buf, 10, (char *)cheatFilename);
sscanf_s(tmp_buf, "%x", &cheats[i].lo[t]);
}
}
#endif

View File

@ -227,7 +227,12 @@ BOOL CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
if (cheatsAdd(atol(editBuf[3]), searchAddSize, tmp_addr, atol(editBuf[1]), editBuf[2], searchAddFreeze))
{
if (cheatsSave())
{
searchAddAddress = tmp_addr;
searchAddValue = atol(editBuf[1]);
EndDialog(dialog, TRUE);
}
}
}
return TRUE;
@ -424,7 +429,7 @@ BOOL CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpar
if (searchAddFreeze)
lvi.pszText= "X";
else
lvi.pszText= "";
lvi.pszText= " ";
u32 row = ListView_InsertItem(cheatListView, &lvi);
wsprintf(buf, "0x02%06X", searchAddAddress);
ListView_SetItemText(cheatListView, row, 1, buf);