This commit is contained in:
owomomo 2019-04-03 00:48:30 +08:00
parent 85c77109c0
commit 3f6475c268
4 changed files with 40 additions and 32 deletions

View File

@ -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_COM,(LPTSTR)"");
SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(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(); UpdateCheatsAdded();
break; break;
case ID_CHEATLISTPOPUP_DELETESELECTEDCHEATS: 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_VAL,(LPTSTR)"");
SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)"");
SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(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(); UpdateCheatsAdded();
} }
} else { } 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_COM,(LPTSTR)"");
SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(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(); UpdateCheatsAdded();
} }
break; break;
@ -551,7 +551,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(v)); SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(v));
if(c == -1) SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); if(c == -1) SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)"");
else SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)U8ToStr(c)); 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; break;
case IDC_BTN_CHEAT_ADDFROMFILE: case IDC_BTN_CHEAT_ADDFROMFILE:
{ {
@ -577,7 +577,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (file) if (file)
{ {
FCEU_LoadGameCheats(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(); UpdateCheatsAdded();
savecheats = 1; savecheats = 1;
} }
@ -670,7 +670,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
} }
} }
UpdateCheatsAdded(); UpdateCheatsAdded();
UpdateColorTable(); UpdateCheatWindowRelatedWindow();
SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0);
SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETSEL,(WPARAM)1,selcheat); SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETSEL,(WPARAM)1,selcheat);
break; break;
@ -1050,3 +1050,12 @@ void DisableAllCheats()
SetDlgItemText(hCheat, 201, str); 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.
}

View File

@ -16,3 +16,5 @@ extern std::vector<uint16> FrozenAddresses;
//void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line //void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line
void DisableAllCheats(); void DisableAllCheats();
void UpdateCheatWindowRelatedWindow();

View File

@ -1269,30 +1269,30 @@ LRESULT CustomDraw (LPARAM lParam)
case CDDS_ITEMPREPAINT: case CDDS_ITEMPREPAINT:
{ {
int rv = CDRF_DODEFAULT; int rv = CDRF_DODEFAULT;
int cheat = CALL_WITH_T_SIZE_TYPES_1(GetNumCheatsFromIndex, rs_type_size, rs_t == 's', noMisalign, lplvcd->nmcd.dwItemSpec);
if (int cheat = CALL_WITH_T_SIZE_TYPES_1(GetNumCheatsFromIndex, rs_type_size, rs_t == 's', noMisalign, lplvcd->nmcd.dwItemSpec))
{
switch (cheat) { switch (cheat) {
case 1: lplvcd->clrTextBk = RGB(216, 203, 253); break; default:
case 2: lplvcd->clrTextBk = RGB(195, 186, 253); break; case 0:
case 3: lplvcd->clrTextBk = RGB(176, 139, 252); break; if (lplvcd->nmcd.dwItemSpec % 2)
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); lplvcd->clrTextBk = RGB(248, 248, 255);
rv = CDRF_NEWFONT; 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)) if(!IsSatisfied(lplvcd->nmcd.dwItemSpec))
{
// tint red any items that would be eliminated if a search were to run now // tint red any items that would be eliminated if a search were to run now
lplvcd->clrText = RGB(192,64,64); // changed to a more visual color in dark background
lplvcd->clrText = cheat == 4 ? RGB(255,192,0) : RGB(192,64,64);
rv = CDRF_NEWFONT; rv = CDRF_NEWFONT;
}
return rv; return rv;
} break; } break;

View File

@ -731,11 +731,8 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
case IDYES: case IDYES:
extern void DisableAllCheats(); extern void DisableAllCheats();
DisableAllCheats(); DisableAllCheats();
extern HWND hMemView; extern void UpdateCheatWindowRelatedWindow();
if (hMemView) { UpdateCheatWindowRelatedWindow();
extern void UpdateColorTable();
UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well
}
} }
} }