Win32 Memwatch - ramchange implemented for 1 address only

This commit is contained in:
adelikat 2008-11-16 18:37:08 +00:00
parent 6c0c38ddcb
commit b18cd2afdb
3 changed files with 49 additions and 18 deletions

View File

@ -655,6 +655,8 @@ fileChanged = false;
static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
const int FMAX = 6;
std::string formula[FMAX] = {"> than", "> by 1", "< than", "< by 1", "equal", "!equal"};
const int kLabelControls[] = {MW_ValueLabel1,MW_ValueLabel2}; const int kLabelControls[] = {MW_ValueLabel1,MW_ValueLabel2};
@ -692,8 +694,13 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
xPositions[i] = r.left; xPositions[i] = r.left;
} }
//Populate Formula pulldown //Populate Formula pulldown menus
for (int x = 0; x < FMAX; x++)
{
SendDlgItemMessage(hwndDlg, MEMW_EDIT00FORMULA,(UINT) CB_ADDSTRING, 0,(LPARAM) formula[x].c_str() );
}
SendDlgItemMessage(hwndDlg, MEMW_EDIT00FORMULA, CB_SETCURSEL, 0, 0);
break; break;
case WM_PAINT: case WM_PAINT:
@ -891,13 +898,6 @@ void AddMemWatch(char memaddress[32])
void RamChange() void RamChange()
{ {
//Debug: Show frame counter---------------------------------
extern int currFrameCounter;
char counterbuf[32] = {0};
ramChange++;
sprintf(counterbuf,"%d/%d",currFrameCounter,ramChange);
SetDlgItemText(hwndMemWatch,MEMW_STATIC,counterbuf);
//----------------------------------------------------------
MWRec& mwrec = mwrecs[0]; MWRec& mwrec = mwrecs[0];
if(mwrec.valid && GameInfo) if(mwrec.valid && GameInfo)
{ {
@ -906,9 +906,39 @@ void RamChange()
edit00last = edit00now; //Update last value edit00last = edit00now; //Update last value
edit00now = GetMem(mwrec.addr); //Update now value edit00now = GetMem(mwrec.addr); //Update now value
if (edit00now > edit00last) //If current value is > then last value
edit00count++; //Increase counter
//Calculate Ram Change
int x = SendDlgItemMessage(hwndMemWatch, MEMW_EDIT00FORMULA,(UINT) CB_GETTOPINDEX, 0,0);
switch (x)
{
//Greater than------------------------------------
case 0:
if (edit00now > edit00last) edit00count++;
break;
//Greater by 1------------------------------------
case 1:
if (edit00now-edit00last == 1) edit00count++;
break;
//Less than---------------------------------------
case 2:
if (edit00now<edit00last) edit00count++;
break;
//Less by 1---------------------------------------
case 3:
if (edit00last-edit00now == 1) edit00count++;
break;
//Equal-------------------------------------------
case 4:
if (edit00now == edit00last) edit00count++;
break;
//Not Equal---------------------------------------
case 5:
if (edit00now != edit00last) edit00count++;
break;
default:
break;
}
sprintf(edit00changem, "%d", edit00count); //Convert counter to text sprintf(edit00changem, "%d", edit00count); //Convert counter to text
SetDlgItemText(hwndMemWatch, MEMW_RESULTS, edit00changem); //Display text in results box SetDlgItemText(hwndMemWatch, MEMW_RESULTS, edit00changem); //Display text in results box
} }

View File

@ -779,7 +779,7 @@ BEGIN
END END
MEMWATCH DIALOGEX 0, 0, 260, 269 MEMWATCH DIALOGEX 0, 0, 260, 269
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_VSCROLL | WS_SYSMENU
CAPTION "Memory Watch" CAPTION "Memory Watch"
MENU MEMWATCHMENU MENU MEMWATCHMENU
FONT 8, "MS Sans Serif", 0, 0, 0x0 FONT 8, "MS Sans Serif", 0, 0, 0x0
@ -842,14 +842,14 @@ BEGIN
LTEXT "Value",MW_ValueLabel2,231,7,19,8 LTEXT "Value",MW_ValueLabel2,231,7,19,8
LTEXT "Frames",MEMW_STATIC,209,249,44,8 LTEXT "Frames",MEMW_STATIC,209,249,44,8
LTEXT "results",MEMW_RESULTS,100,228,36,8 LTEXT "results",MEMW_RESULTS,100,228,36,8
GROUPBOX "Memory Change Monitoring",IDC_STATIC,0,202,256,59 GROUPBOX "Memory Change Monitoring",IDC_STATIC,0,202,256,65
LTEXT "Address",IDC_STATIC,6,213,26,8 LTEXT "Address",IDC_STATIC,6,213,26,8
LTEXT "Value",IDC_STATIC,101,213,19,8 LTEXT "Value",IDC_STATIC,101,213,19,8
LTEXT "Change formula",IDC_STATIC,44,213,50,8 LTEXT "Change formula",IDC_STATIC,44,213,50,8
LTEXT " ",MEMW_EDIT00RMADDRESS,7,228,24,8 LTEXT " ",MEMW_EDIT00RMADDRESS,7,228,24,8
PUSHBUTTON " ",MEMW_EDIT00RESET,137,230,11,7 PUSHBUTTON " ",MEMW_EDIT00RESET,137,230,11,7
LTEXT "Reset",IDC_STATIC,133,213,20,8 LTEXT "Reset",IDC_STATIC,133,213,20,8
COMBOBOX EDIT00FORMULA,45,225,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX MEMW_EDIT00FORMULA,45,226,48,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
END END
DEBUGGER DIALOGEX 54, 74, 548, 305 DEBUGGER DIALOGEX 54, 74, 548, 305
@ -1044,7 +1044,7 @@ BEGIN
LTEXT "3rd rule",-1,16,55,40,8 LTEXT "3rd rule",-1,16,55,40,8
LTEXT "4th rule",-1,16,71,40,8 LTEXT "4th rule",-1,16,71,40,8
LTEXT "5th rule",-1,16,89,40,8 LTEXT "5th rule",-1,16,89,40,8
COMBOBOX 3000,66,17,135,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX 3000,66,17,135,85,CBS_DROPDOWNLIST | WS_TABSTOP
COMBOBOX 3001,66,34,135,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX 3001,66,34,135,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX 3002,66,50,135,97,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX 3002,66,50,135,97,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX 3003,66,68,135,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX 3003,66,68,135,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -1415,7 +1415,7 @@ BEGIN
"MEMWATCH", DIALOG "MEMWATCH", DIALOG
BEGIN BEGIN
BOTTOMMARGIN, 261 BOTTOMMARGIN, 267
END END
"DEBUGGER", DIALOG "DEBUGGER", DIALOG

View File

@ -351,8 +351,9 @@
#define IDC_RADIO1 1138 #define IDC_RADIO1 1138
#define IDC_RADIO2 1139 #define IDC_RADIO2 1139
#define IDC_RADIO3 1140 #define IDC_RADIO3 1140
#define IDC_COMBO1 1142 //#define IDC_COMBO1 1142
#define EDIT00FORMULA 1142 //#define EDIT00FORMULA 1142
#define MEMW_EDIT00FORMULA 1142
#define IDC_BUTTON6 1143 #define IDC_BUTTON6 1143
#define IDC_BUTTON5 1144 #define IDC_BUTTON5 1144
#define IDC_BUTTON7 1145 #define IDC_BUTTON7 1145