diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 87a95693..0563a978 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -459,7 +459,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tmpsel = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETNEXTITEM, tmpsel, LVNI_ALL | LVNI_SELECTED); } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } break; @@ -496,7 +496,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l selcheat = newselcheat; } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -581,7 +581,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ClearCheatListText(hwndDlg); } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); break; } @@ -606,7 +606,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ClearCheatListText(hwndDlg); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } else { @@ -616,7 +616,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l selcheat = -1; ClearCheatListText(hwndDlg); } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } break; @@ -661,7 +661,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)""); else SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(c)); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); // UpdateCheatAdded(); break; @@ -690,8 +690,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (file) { FCEU_LoadGameCheats(file, 0); - UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); savecheats = 1; } } @@ -801,7 +801,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -816,7 +816,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -907,6 +907,7 @@ void ConfigCheats(HWND hParent) else DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB); UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); } else { ShowWindow(hCheat, SW_SHOWNORMAL); @@ -1063,7 +1064,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_DEL), TRUE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), TRUE); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -1205,7 +1206,7 @@ void DisableAllCheats() } } -void UpdateCheatWindowRelatedWindow() +void UpdateCheatRelatedWindow() { // hex editor if (hMemView) diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index 895cd969..7a24a5d7 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -22,7 +22,7 @@ extern std::vector FrozenAddresses; void DisableAllCheats(); -void UpdateCheatWindowRelatedWindow(); +void UpdateCheatRelatedWindow(); // deselect the old one and select the new one #define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \ diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 2bcf7e4b..baeb1892 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -951,6 +951,7 @@ void FreezeRam(int address, int mode, int final){ //} UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); } } diff --git a/src/drivers/win/ram_search.cpp b/src/drivers/win/ram_search.cpp index 1167e883..a2e38a0c 100644 --- a/src/drivers/win/ram_search.cpp +++ b/src/drivers/win/ram_search.cpp @@ -1819,22 +1819,23 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Don't open cheat dialog switch (sizeType) { - case 0: { - FCEUI_AddCheat("",address,curvalue,-1,1); - break; } - case 1: { + case 0: + FCEUI_AddCheat("",address,curvalue, -1, 1); + break; + case 1: + FCEUI_AddCheat("",address,curvalue & 0xFF, -1, 1); + FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100, -1, 1); + break; + case 2: FCEUI_AddCheat("",address,curvalue & 0xFF,-1,1); - FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100,-1,1); - break; } - case 2: { - FCEUI_AddCheat("",address,curvalue & 0xFF,-1,1); - FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100,-1,1); - FCEUI_AddCheat("",address + 2,(curvalue & 0xFF0000) / 0x10000,-1,1); - FCEUI_AddCheat("",address + 3,(curvalue & 0xFF000000) / 0x1000000,-1,1); - break; } + FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100, -1, 1); + FCEUI_AddCheat("",address + 2,(curvalue & 0xFF0000) / 0x10000, -1, 1); + FCEUI_AddCheat("",address + 3,(curvalue & 0xFF000000) / 0x1000000, -1, 1); + break; } UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED); diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index 51cbba3d..b03bf055 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -1442,8 +1442,10 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam FCEUI_AddCheat("", address + 3, (rswatches[watchIndex].CurValue & 0xFF000000) / 0x1000000, -1, 1); break; } + UpdateCheatsAdded(); UpdateCheatWindowRelatedWindow(); + } else MessageBox(hDlg, "Sorry, you can't add cheat to a separator.", "Ram Watch", MB_ICONERROR | MB_OK); diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index 5013ce50..d2fb74a2 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -731,8 +731,8 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case IDYES: extern void DisableAllCheats(); DisableAllCheats(); - extern void UpdateCheatWindowRelatedWindow(); - UpdateCheatWindowRelatedWindow(); + extern void UpdateCheatRelatedWindow(); + UpdateCheatRelatedWindow(); } } @@ -969,8 +969,8 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case IDYES: extern void DisableAllCheats(); DisableAllCheats(); - extern void UpdateCheatWindowRelatedWindow(); - UpdateCheatWindowRelatedWindow(); + extern void UpdateCheatRelatedWindow(); + UpdateCheatRelatedWindow(); } } diff --git a/src/fceu.cpp b/src/fceu.cpp index 9ad47bd7..991b054a 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -556,7 +556,11 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen DoDebuggerDataReload(); // Reloads data without reopening window CDLoggerROMChanged(); if (hMemView) UpdateColorTable(); - if (hCheat) UpdateCheatsAdded(); + if (hCheat) + { + UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); + } if (FrozenAddressCount) FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount); #endif