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_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.
}

View File

@ -15,4 +15,6 @@ extern unsigned int FrozenAddressCount;
extern std::vector<uint16> FrozenAddresses;
//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:
{
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;

View File

@ -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();
}
}