From 3f6475c26814575e522cdac038717d9c0853163b Mon Sep 17 00:00:00 2001 From: owomomo Date: Wed, 3 Apr 2019 00:48:30 +0800 Subject: [PATCH] ... --- src/drivers/win/cheat.cpp | 21 +++++++++++++----- src/drivers/win/cheat.h | 4 +++- src/drivers/win/ram_search.cpp | 40 +++++++++++++++++----------------- src/drivers/win/replay.cpp | 7 ++---- 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 95d83390..59b86909 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -471,7 +471,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)""); } - if (hMemView) UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well + UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); break; case ID_CHEATLISTPOPUP_DELETESELECTEDCHEATS: @@ -490,7 +490,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)""); SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)""); - if (hMemView) UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well + UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); } } else { @@ -503,7 +503,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)""); } - if (hMemView) UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well + UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); } break; @@ -551,7 +551,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(v)); if(c == -1) SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); else SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)U8ToStr(c)); - if(hMemView)UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well + UpdateCheatWindowRelatedWindow(); break; case IDC_BTN_CHEAT_ADDFROMFILE: { @@ -577,7 +577,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (file) { FCEU_LoadGameCheats(file); - if (hMemView) UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well + UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); savecheats = 1; } @@ -670,7 +670,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } } UpdateCheatsAdded(); - UpdateColorTable(); + UpdateCheatWindowRelatedWindow(); SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETSEL,(WPARAM)1,selcheat); break; @@ -1049,4 +1049,13 @@ void DisableAllCheats() sprintf(str, "Active Cheats %d", 0); SetDlgItemText(hCheat, 201, str); } +} + +void UpdateCheatWindowRelatedWindow() +{ + if (hMemView) + UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well + extern HWND RamSearchHWnd; + if (RamSearchHWnd) + RedrawWindow(GetDlgItem(RamSearchHWnd, IDC_RAMLIST), NULL, NULL, RDW_INVALIDATE); // if ram search is open then update the ram list. } \ No newline at end of file diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index 8d9f5b2b..3b2ac3bc 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -15,4 +15,6 @@ extern unsigned int FrozenAddressCount; extern std::vector FrozenAddresses; //void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line -void DisableAllCheats(); \ No newline at end of file +void DisableAllCheats(); + +void UpdateCheatWindowRelatedWindow(); \ No newline at end of file diff --git a/src/drivers/win/ram_search.cpp b/src/drivers/win/ram_search.cpp index 5e3e9a19..c59b00b9 100644 --- a/src/drivers/win/ram_search.cpp +++ b/src/drivers/win/ram_search.cpp @@ -1269,30 +1269,30 @@ LRESULT CustomDraw (LPARAM lParam) case CDDS_ITEMPREPAINT: { int rv = CDRF_DODEFAULT; - - if (int cheat = CALL_WITH_T_SIZE_TYPES_1(GetNumCheatsFromIndex, rs_type_size, rs_t == 's', noMisalign, lplvcd->nmcd.dwItemSpec)) - { - switch (cheat) { - case 1: lplvcd->clrTextBk = RGB(216, 203, 253); break; - case 2: lplvcd->clrTextBk = RGB(195, 186, 253); break; - case 3: lplvcd->clrTextBk = RGB(176, 139, 252); break; - case 4: lplvcd->clrTextBk = RGB(175, 94, 253); break; - } - rv = CDRF_NEWFONT; - } - else if(lplvcd->nmcd.dwItemSpec % 2) - { - // alternate the background color slightly - lplvcd->clrTextBk = RGB(248,248,255); - rv = CDRF_NEWFONT; + int cheat = CALL_WITH_T_SIZE_TYPES_1(GetNumCheatsFromIndex, rs_type_size, rs_t == 's', noMisalign, lplvcd->nmcd.dwItemSpec); + switch (cheat) { + default: + case 0: + if (lplvcd->nmcd.dwItemSpec % 2) + lplvcd->clrTextBk = RGB(248, 248, 255); + break; + case 1: + lplvcd->clrTextBk = RGB(216, 203, 253); break; + case 2: + lplvcd->clrTextBk = RGB(195, 186, 253); break; + case 3: + lplvcd->clrTextBk = RGB(176, 139, 252); break; + case 4: + lplvcd->clrTextBk = RGB(175, 94, 253); + lplvcd->clrText = RGB(255, 255, 255); break; // use a more visual color in dark background } if(!IsSatisfied(lplvcd->nmcd.dwItemSpec)) - { // tint red any items that would be eliminated if a search were to run now - lplvcd->clrText = RGB(192,64,64); - rv = CDRF_NEWFONT; - } + // changed to a more visual color in dark background + lplvcd->clrText = cheat == 4 ? RGB(255,192,0) : RGB(192,64,64); + + rv = CDRF_NEWFONT; return rv; } break; diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index c0a3b7c7..6baf6221 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -731,11 +731,8 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case IDYES: extern void DisableAllCheats(); DisableAllCheats(); - extern HWND hMemView; - if (hMemView) { - extern void UpdateColorTable(); - UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well - } + extern void UpdateCheatWindowRelatedWindow(); + UpdateCheatWindowRelatedWindow(); } }