diff --git a/desmume/src/cheatSystem.cpp b/desmume/src/cheatSystem.cpp index 6be6d5bfd..096bb728f 100644 --- a/desmume/src/cheatSystem.cpp +++ b/desmume/src/cheatSystem.cpp @@ -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 diff --git a/desmume/src/windows/cheatsWin.cpp b/desmume/src/windows/cheatsWin.cpp index 2dd3e8a3d..e51aa72cf 100644 --- a/desmume/src/windows/cheatsWin.cpp +++ b/desmume/src/windows/cheatsWin.cpp @@ -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);