Win32 - cheats search lists number active cheats, freezing addresses in hex editor updates cheats dialog, hex editor has minimize and maximize buttons

This commit is contained in:
adelikat 2008-12-16 05:31:58 +00:00
parent 3c9288c253
commit b7c47221c7
5 changed files with 63 additions and 6 deletions

View File

@ -1,4 +1,6 @@
---version 2.0.4 yet to be released--- ---version 2.0.4 yet to be released---
15-dec-2008 - adelikat - win32 - cheats - number of active cheats listed, freezing ram addresses in hex editor automatically updates cheats dialog
15-dec-2008 - adelikat - win32 - hexeditor - added minimize & maximize buttons
14-dec-2008 - adelikat - win32 - memwatch - frozen addresses will display as blue 14-dec-2008 - adelikat - win32 - memwatch - frozen addresses will display as blue
14-dec-2008 - adelikat - win32 - hexeditor - prevent the user from freezing more than 256 addresses at once 14-dec-2008 - adelikat - win32 - hexeditor - prevent the user from freezing more than 256 addresses at once
14-dec-2008 - adelikat - win32 - memwatch - collapsable to 1 column 14-dec-2008 - adelikat - win32 - memwatch - collapsable to 1 column

View File

@ -144,7 +144,7 @@ void RebuildSubCheats(void)
} }
FrozenAddressCount = numsubcheats; //Update the frozen address list FrozenAddressCount = numsubcheats; //Update the frozen address list
UpdateFrozenList(); UpdateFrozenList();
FCEUI_DispMessage("Active Cheats: %d", FrozenAddresses.size()/*FrozenAddressCount*/); //Debug //FCEUI_DispMessage("Active Cheats: %d", FrozenAddresses.size()/*FrozenAddressCount*/); //Debug
} }
void FCEU_PowerCheats() void FCEU_PowerCheats()

View File

@ -25,8 +25,12 @@
#include "debugger.h" #include "debugger.h"
#include "../../fceu.h" #include "../../fceu.h"
#include "../../cart.h" #include "../../cart.h"
static HWND pwindow = 0;
static HWND pwindow = 0; //Handle to Cheats dialog
HWND hCheat; //mbg merge 7/19/06 had to add HWND hCheat; //mbg merge 7/19/06 had to add
void InitializeCheatsAdded(HWND hwndDlg);
int CheatWindow; int CheatWindow;
int CheatStyle=1; int CheatStyle=1;
@ -191,9 +195,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
else EnableCheatButtons(hwndDlg,FALSE); else EnableCheatButtons(hwndDlg,FALSE);
//misc setup //misc setup
RedoCheatsLB(hwndDlg); //RedoCheatsLB(hwndDlg); //adelikat: Moved to UpdateCheatsAdded() function
searchdone=0; searchdone=0;
SetDlgItemText(hwndDlg,IDC_CHEAT_VAL_KNOWN,(LPTSTR)U8ToStr(knownvalue)); SetDlgItemText(hwndDlg,IDC_CHEAT_VAL_KNOWN,(LPTSTR)U8ToStr(knownvalue));
InitializeCheatsAdded(hwndDlg);
break; break;
case WM_NCACTIVATE: case WM_NCACTIVATE:
@ -342,6 +347,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_UPD),TRUE); EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_UPD),TRUE);
} }
if(hMemView)UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well if(hMemView)UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well
UpdateCheatsAdded();
break; break;
case IDC_BTN_CHEAT_DEL: case IDC_BTN_CHEAT_DEL:
if (selcheat >= 0) { if (selcheat >= 0) {
@ -355,6 +361,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_DEL),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_DEL),FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_UPD),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_UPD),FALSE);
if(hMemView)UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well if(hMemView)UpdateColorTable(); //if the memory viewer is open then update any blue freeze locations in it as well
UpdateCheatsAdded();
break; break;
case IDC_BTN_CHEAT_UPD: case IDC_BTN_CHEAT_UPD:
if (selcheat < 0) break; if (selcheat < 0) break;
@ -538,6 +545,52 @@ void UpdateCheatList()
ShowResults(pwindow); ShowResults(pwindow);
} }
//This is necessary during the intialization of the cheats dialog, it is redundant with UpdateCheatsAdded except the handle is passed by CheatConsoleCallB
void InitializeCheatsAdded(HWND hwndDlg)
{
char temp[64];
if (FrozenAddressCount < 256)
sprintf(temp,"Active Cheats %d", FrozenAddressCount);
else if (FrozenAddressCount == 256)
{
sprintf(temp,"Active Cheats %d (Max Limit)", FrozenAddressCount);
EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_ADD),FALSE);
}
else
{
sprintf(temp,"%d Error: Too many cheats loaded!", FrozenAddressCount);
EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_ADD),FALSE);
}
SetDlgItemText(hwndDlg,201,temp);
RedoCheatsLB(hwndDlg);
}
//Used by cheats and external dialogs such as hex editor to update items in the cheat search dialog
void UpdateCheatsAdded()
{
char temp[64];
if(!pwindow)
return;
else
{
if (FrozenAddressCount < 256)
sprintf(temp,"Active Cheats %d", FrozenAddressCount);
else if (FrozenAddressCount == 256)
{
sprintf(temp,"Active Cheats %d (Max Limit)", FrozenAddressCount);
EnableWindow(GetDlgItem(hCheat,IDC_BTN_CHEAT_ADD),FALSE);
}
else
{
sprintf(temp,"%d Error: Too many cheats loaded!", FrozenAddressCount);
EnableWindow(GetDlgItem(hCheat,IDC_BTN_CHEAT_ADD),FALSE);
}
SetDlgItemText(hCheat,201,temp);
RedoCheatsLB(hCheat);
}
}
BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
char str[100]; char str[100];

View File

@ -9,6 +9,7 @@ void ConfigCheats(HWND hParent);
void DoGGConv(); void DoGGConv();
void SetGGConvFocus(int address,int compare); void SetGGConvFocus(int address,int compare);
void UpdateCheatList(); void UpdateCheatList();
void UpdateCheatsAdded();
extern unsigned int FrozenAddressCount; extern unsigned int FrozenAddressCount;
extern std::vector<uint16> FrozenAddresses; extern std::vector<uint16> FrozenAddresses;

View File

@ -603,6 +603,7 @@ void FreezeRam(int address, int mode, int final){
UpdateColorTable(); UpdateColorTable();
}*/ }*/
//mbg merge 6/29/06 - WTF //mbg merge 6/29/06 - WTF
UpdateCheatsAdded();
} }
} }
@ -1544,7 +1545,7 @@ void DoMemView() {
hMemView = CreateWindowEx(0,"MEMVIEW","Memory Editor", hMemView = CreateWindowEx(0,"MEMVIEW","Memory Editor",
//WS_OVERLAPPEDWINDOW|WS_CLIPSIBLINGS, /* Style */ //WS_OVERLAPPEDWINDOW|WS_CLIPSIBLINGS, /* Style */
WS_SYSMENU|WS_THICKFRAME|WS_VSCROLL, WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_THICKFRAME|WS_VSCROLL,
CW_USEDEFAULT,CW_USEDEFAULT,625,242, /* X,Y ; Width, Height */ CW_USEDEFAULT,CW_USEDEFAULT,625,242, /* X,Y ; Width, Height */
NULL,NULL,fceu_hInstance,NULL ); NULL,NULL,fceu_hInstance,NULL );
ShowWindow (hMemView, SW_SHOW) ; ShowWindow (hMemView, SW_SHOW) ;