1. Limit text input for Edit watch dialog and ram search.

2. As bbbradsmith in Pull Request #62 mentioned, SetWindowLong is replaced by SetWindowLongPtr for 64 bit compatible, I partially changed those written by myself.
This commit is contained in:
owomomo 2019-06-27 00:53:52 +08:00
parent fb0f6ee35f
commit 7dde5467fd
10 changed files with 553 additions and 450 deletions

View File

@ -343,16 +343,16 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
SendDlgItemMessage(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, EM_SETLIMITTEXT, 8, 0); SendDlgItemMessage(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, EM_SETLIMITTEXT, 8, 0);
// limit their characters // limit their characters
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_VAL), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_COM), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_COM), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_NE_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_NE_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_GT_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_GT_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_LT_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_LT_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_TEXT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_TEXT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
// Create popup to "Auto load / save with game", since it has 3 states and the text need some explanation // Create popup to "Auto load / save with game", since it has 3 states and the text need some explanation
SetCheatToolTip(hwndDlg, IDC_CHEAT_AUTOLOADSAVE); SetCheatToolTip(hwndDlg, IDC_CHEAT_AUTOLOADSAVE);
@ -1109,10 +1109,10 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_VAL, WM_SETFONT, (WPARAM)hNewFont, FALSE); SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_VAL, WM_SETFONT, (WPARAM)hNewFont, FALSE);
// limit their characters // limit their characters
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_CODE), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GAME_GENIE_CODE), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GAME_GENIE_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_COMP), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GAME_GENIE_COMP), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_VAL), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GAME_GENIE_VAL), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
} }
break; break;
case WM_CLOSE: case WM_CLOSE:

View File

@ -279,8 +279,8 @@ BOOL CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_START, EM_SETLIMITTEXT, 4, 0); SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_START, EM_SETLIMITTEXT, 4, 0);
SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_END, EM_SETLIMITTEXT, 4, 0); SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_END, EM_SETLIMITTEXT, 4, 0);
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_ADDBP_ADDR_START), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_ADDBP_ADDR_START), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_ADDBP_ADDR_END), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_ADDBP_ADDR_END), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
if (WP_edit >= 0) if (WP_edit >= 0)
{ {
@ -1825,12 +1825,12 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,EM_SETLIMITTEXT,2,0); SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,EM_SETLIMITTEXT,2,0);
// limit input // limit input
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PCSEEK), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PCSEEK), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PC), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PC), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_A), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_A), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_BOOKMARK), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DEBUGGER_BOOKMARK), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
//I'm lazy, disable the controls which I can't mess with right now //I'm lazy, disable the controls which I can't mess with right now
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETREADONLY,TRUE,0); SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETREADONLY,TRUE,0);

View File

@ -296,17 +296,17 @@ HWND InitHeaderEditDialog(HWND hwnd, iNES_HEADER* header)
// Change the default wndproc of these control to limit their text // Change the default wndproc of these control to limit their text
// PRG ROM // PRG ROM
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(GetDlgItem(hwnd, IDC_PRGROM_COMBO), IDC_PRGROM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(GetDlgItem(hwnd, IDC_PRGROM_COMBO), IDC_PRGROM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
// PRG RAM // PRG RAM
SetWindowLong(GetDlgItem(GetDlgItem(hwnd, IDC_PRGRAM_COMBO), IDC_PRGRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(GetDlgItem(hwnd, IDC_PRGRAM_COMBO), IDC_PRGRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
// PRG NVRAM // PRG NVRAM
SetWindowLong(GetDlgItem(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO), IDC_PRGNVRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO), IDC_PRGNVRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
// CHR ROM // CHR ROM
SetWindowLong(GetDlgItem(GetDlgItem(hwnd, IDC_CHRROM_COMBO), IDC_CHRROM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(GetDlgItem(hwnd, IDC_CHRROM_COMBO), IDC_CHRROM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
// CHR RAM // CHR RAM
SetWindowLong(GetDlgItem(GetDlgItem(hwnd, IDC_CHRRAM_COMBO), IDC_CHRRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(GetDlgItem(hwnd, IDC_CHRRAM_COMBO), IDC_CHRRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
// CHR NVRAM // CHR NVRAM
SetWindowLong(GetDlgItem(GetDlgItem(hwnd, IDC_CHRNVRAM_COMBO), IDC_CHRNVRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(GetDlgItem(hwnd, IDC_CHRNVRAM_COMBO), IDC_CHRNVRAM_EDIT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
ToggleINES20(hwnd, IsDlgButtonChecked(hwnd, IDC_RADIO_VERSION_INES20) == BST_CHECKED); ToggleINES20(hwnd, IsDlgButtonChecked(hwnd, IDC_RADIO_VERSION_INES20) == BST_CHECKED);

View File

@ -795,7 +795,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
// experimental: limit the text length and input to hex values // experimental: limit the text length and input to hex values
SendDlgItemMessage(hwndDlg, MW_ADDR[i], EM_SETLIMITTEXT, 4, 0); SendDlgItemMessage(hwndDlg, MW_ADDR[i], EM_SETLIMITTEXT, 4, 0);
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, MW_ADDR[i]), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, MW_ADDR[i]), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
} }
//Populate Formula pulldown menus //Populate Formula pulldown menus

View File

@ -641,6 +641,18 @@ unsigned int HardwareAddressToItemIndex(HWAddressType hardwareAddress)
: functionName<char, type>(p0, p1, p2, p3)) \ : functionName<char, type>(p0, p1, p2, p3)) \
: functionName<char, type>(p0, p1, p2, p3)) : functionName<char, type>(p0, p1, p2, p3))
#define CONV_VAL_TO_STR(sizeTypeID, type, val, buf) (sprintf(buf, type == 's' ? "%d" : type == 'u' ? "%u" : type == 'd' ? "%08X" : type == 'w' ? "%04X" : "%02X", sizeTypeID == 'd' ? (type == 's' ? (long)(val & 0xFFFFFFFF) : (unsigned long)(val & 0xFFFFFFFF)) : sizeTypeID == 'w' ? (type == 's' ? (short)(val & 0xFFFF) : (unsigned short)(val & 0xFFFF)) : (type == 's' ? (char)(val & 0xFF) : (unsigned char)(val & 0xFF))), buf)
#define ConvEditTextNum(hDlg, id, sizeTypeID, type) \
{ \
BOOL success = FALSE; \
int val = ReadControlInt(id, type == 'h', success); \
if (success) \
{ \
char num[11]; \
SetDlgItemText(hDlg, id, CONV_VAL_TO_STR(sizeTypeID, type, val, num)); \
} else SetDlgItemText(hDlg, id, ""); \
}
// basic comparison functions: // basic comparison functions:
template <typename T> inline bool LessCmp (T x, T y, T i) { return x < y; } template <typename T> inline bool LessCmp (T x, T y, T i) { return x < y; }
template <typename T> inline bool MoreCmp (T x, T y, T i) { return x > y; } template <typename T> inline bool MoreCmp (T x, T y, T i) { return x > y; }
@ -1401,7 +1413,8 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
static int watchIndex=0; static int watchIndex=0;
switch(uMsg) switch(uMsg)
{ {
case WM_INITDIALOG: { case WM_INITDIALOG:
{
RamSearchHWnd = hDlg; RamSearchHWnd = hDlg;
CalcSubWindowPos(hDlg, NULL); CalcSubWindowPos(hDlg, NULL);
@ -1435,6 +1448,7 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),true); EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),true);
break; break;
} }
switch (rs_c) switch (rs_c)
{ {
case 'r': case 'r':
@ -1453,6 +1467,7 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),true); EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),true);
break; break;
} }
switch (rs_t) switch (rs_t)
{ {
case 's': case 's':
@ -1465,6 +1480,7 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
break; break;
} }
switch (rs_type_size) switch (rs_type_size)
{ {
case 'b': case 'b':
@ -1517,8 +1533,16 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
ListView_SetCallbackMask(GetDlgItem(hDlg,IDC_RAMLIST), LVIS_FOCUSED|LVIS_SELECTED); ListView_SetCallbackMask(GetDlgItem(hDlg,IDC_RAMLIST), LVIS_FOCUSED|LVIS_SELECTED);
SendDlgItemMessage(hDlg, IDC_EDIT_COMPAREADDRESS, EM_SETLIMITTEXT, 4, 0);
DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_MODBY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
return true; return true;
} break; }
break;
case WM_NOTIFY: case WM_NOTIFY:
{ {
LPNMHDR lP = (LPNMHDR) lParam; LPNMHDR lP = (LPNMHDR) lParam;
@ -1561,28 +1585,12 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case 1: case 1:
{ {
int i = CALL_WITH_T_SIZE_TYPES_1(GetCurValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, iNum); int i = CALL_WITH_T_SIZE_TYPES_1(GetCurValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, iNum);
const char* formatString = ((rs_t=='s') ? "%d" : (rs_t=='u') ? "%u" : (rs_type_size=='d' ? "%08X" : rs_type_size=='w' ? "%04X" : "%02X")); Item->item.pszText = CONV_VAL_TO_STR(rs_type_size, rs_t, i, num);
switch (rs_type_size)
{
case 'b':
default: sprintf(num, formatString, rs_t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
case 'w': sprintf(num, formatString, rs_t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
case 'd': sprintf(num, formatString, rs_t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
}
Item->item.pszText = num;
} return true; } return true;
case 2: case 2:
{ {
int i = CALL_WITH_T_SIZE_TYPES_1(GetPrevValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, iNum); int i = CALL_WITH_T_SIZE_TYPES_1(GetPrevValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, iNum);
const char* formatString = ((rs_t=='s') ? "%d" : (rs_t=='u') ? "%u" : (rs_type_size=='d' ? "%08X" : rs_type_size=='w' ? "%04X" : "%02X")); Item->item.pszText = CONV_VAL_TO_STR(rs_type_size, rs_t, i, num);
switch (rs_type_size)
{
case 'b':
default: sprintf(num, formatString, rs_t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
case 'w': sprintf(num, formatString, rs_t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
case 'd': sprintf(num, formatString, rs_t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
}
Item->item.pszText = num;
} return true; } return true;
case 3: case 3:
{ {
@ -1646,77 +1654,109 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// return 0; // return 0;
//} //}
} }
break;
} }
break;
case WM_COMMAND: case WM_COMMAND:
{ {
int rv = false; switch (HIWORD(wParam))
{
case BN_CLICKED:
{
int rv = true;
bool needRefresh = true;
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_SIGNED: case IDC_SIGNED:
{
rs_t = 's'; rs_t = 's';
signal_new_size(); signal_new_size();
{rv = true; break;} ConvEditTextNum(hDlg, IDC_EDIT_COMPAREVALUE, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_DIFFBY, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_MODBY, rs_type_size, rs_t);
}
break;
case IDC_UNSIGNED: case IDC_UNSIGNED:
{
rs_t = 'u'; rs_t = 'u';
signal_new_size(); signal_new_size();
{rv = true; break;} ConvEditTextNum(hDlg, IDC_EDIT_COMPAREVALUE, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_DIFFBY, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_MODBY, rs_type_size, rs_t);
}
break;
case IDC_HEX: case IDC_HEX:
{
rs_t = 'h'; rs_t = 'h';
signal_new_size(); signal_new_size();
{rv = true; break;} ConvEditTextNum(hDlg, IDC_EDIT_COMPAREVALUE, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_DIFFBY, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_MODBY, rs_type_size, rs_t);
}
break;
case IDC_1_BYTE: case IDC_1_BYTE:
{
needRefresh = false;
rs_type_size = 'b'; rs_type_size = 'b';
signal_new_size(); signal_new_size();
{rv = true; break;} BOOL success = FALSE;
int val = ReadControlInt(IDC_EDIT_COMPAREVALUE, false, success);
if (success)
{
char num[11];
SetDlgItemText(hDlg, IDC_EDIT_COMPAREVALUE, CONV_VAL_TO_STR(rs_type_size, rs_t, val, num));
}
}
break;
case IDC_2_BYTES: case IDC_2_BYTES:
needRefresh = false;
rs_type_size = 'w'; rs_type_size = 'w';
signal_new_size(); signal_new_size();
{rv = true; break;} break;
case IDC_4_BYTES: case IDC_4_BYTES:
needRefresh = false;
rs_type_size = 'd'; rs_type_size = 'd';
signal_new_size(); signal_new_size();
{rv = true; break;} break;
case IDC_MISALIGN: case IDC_MISALIGN:
needRefresh = false;
noMisalign = !noMisalign; noMisalign = !noMisalign;
//CompactAddrs(); //CompactAddrs();
signal_new_size(); signal_new_size();
{rv = true; break;} break;
// case IDC_ENDIAN: // case IDC_ENDIAN:
//// littleEndian = !littleEndian; // littleEndian = !littleEndian;
//// signal_new_size(); // signal_new_size();
// {rv = true; break;} // break;
case IDC_LESSTHAN: case IDC_LESSTHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '<'; rs_o = '<';
{rv = true; break;} break;
case IDC_MORETHAN: case IDC_MORETHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '>'; rs_o = '>';
{rv = true; break;} break;
case IDC_NOMORETHAN: case IDC_NOMORETHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = 'l'; rs_o = 'l';
{rv = true; break;} break;
case IDC_NOLESSTHAN: case IDC_NOLESSTHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = 'm'; rs_o = 'm';
{rv = true; break;} break;
case IDC_EQUALTO: case IDC_EQUALTO:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '='; rs_o = '=';
{rv = true; break;} break;
case IDC_DIFFERENTFROM: case IDC_DIFFERENTFROM:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '!'; rs_o = '!';
{rv = true; break;} break;
case IDC_DIFFERENTBY: case IDC_DIFFERENTBY:
{ {
rs_o = 'd'; rs_o = 'd';
@ -1724,7 +1764,8 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
if (!SelectingByKeyboard()) if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_DIFFBY); SelectEditControl(IDC_EDIT_DIFFBY);
} {rv = true; break;} break;
}
case IDC_MODULO: case IDC_MODULO:
{ {
rs_o = '%'; rs_o = '%';
@ -1732,13 +1773,14 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), true); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), true);
if (!SelectingByKeyboard()) if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_MODBY); SelectEditControl(IDC_EDIT_MODBY);
} {rv = true; break;} break;
}
case IDC_PREVIOUSVALUE: case IDC_PREVIOUSVALUE:
rs_c = 'r'; rs_c = 'r';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false);
{rv = true; break;} break;
case IDC_SPECIFICVALUE: case IDC_SPECIFICVALUE:
{ {
rs_c = 's'; rs_c = 's';
@ -1747,7 +1789,7 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false);
if (!SelectingByKeyboard()) if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPAREVALUE); SelectEditControl(IDC_EDIT_COMPAREVALUE);
{rv = true; break;} break;
} }
case IDC_SPECIFICADDRESS: case IDC_SPECIFICADDRESS:
{ {
@ -1757,7 +1799,8 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false);
if (!SelectingByKeyboard()) if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPAREADDRESS); SelectEditControl(IDC_EDIT_COMPAREADDRESS);
} {rv = true; break;} break;
}
case IDC_NUMBEROFCHANGES: case IDC_NUMBEROFCHANGES:
{ {
rs_c = 'n'; rs_c = 'n';
@ -1766,9 +1809,11 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false); EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false);
if (!SelectingByKeyboard()) if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPARECHANGES); SelectEditControl(IDC_EDIT_COMPARECHANGES);
} {rv = true; break;} break;
}
case IDC_C_ADDCHEAT: case IDC_C_ADDCHEAT:
{ {
needRefresh = false;
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST); HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED); int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
while (watchItemIndex >= 0) while (watchItemIndex >= 0)
@ -1816,11 +1861,13 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED); watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED);
} }
} {rv = true; break;} break;
}
case IDC_C_SEARCHROM: case IDC_C_SEARCHROM:
ShowROM = SendDlgItemMessage(hDlg, IDC_C_SEARCHROM, BM_GETCHECK, 0, 0) != 0; ShowROM = SendDlgItemMessage(hDlg, IDC_C_SEARCHROM, BM_GETCHECK, 0, 0) != 0;
case IDC_C_RESET: case IDC_C_RESET:
{ {
needRefresh = false;
RamSearchSaveUndoStateIfNotTooBig(RamSearchHWnd); RamSearchSaveUndoStateIfNotTooBig(RamSearchHWnd);
int prevNumItems = last_rs_possible; int prevNumItems = last_rs_possible;
@ -1834,15 +1881,17 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
ListView_SetSelectionMark(GetDlgItem(hDlg, IDC_RAMLIST), 0); ListView_SetSelectionMark(GetDlgItem(hDlg, IDC_RAMLIST), 0);
RefreshRamListSelectedCountControlStatus(hDlg); RefreshRamListSelectedCountControlStatus(hDlg);
Update_RAM_Search(); Update_RAM_Search();
{rv = true; break;} break;
} }
case IDC_C_RESET_CHANGES: case IDC_C_RESET_CHANGES:
needRefresh = false;
memset(s_numChanges, 0, (sizeof(*s_numChanges)*(MAX_RAM_SIZE))); memset(s_numChanges, 0, (sizeof(*s_numChanges)*(MAX_RAM_SIZE)));
ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1); ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1);
Update_RAM_Search(); Update_RAM_Search();
//SetRamSearchUndoType(hDlg, 0); //SetRamSearchUndoType(hDlg, 0);
{rv = true; break;} break;
case IDC_C_UNDO: case IDC_C_UNDO:
needRefresh = false;
if (s_undoType > 0) if (s_undoType > 0)
{ {
// Clear_Sound_Buffer(); // Clear_Sound_Buffer();
@ -1866,18 +1915,30 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
ListView_SetSelectionMark(GetDlgItem(hDlg, IDC_RAMLIST), 0); ListView_SetSelectionMark(GetDlgItem(hDlg, IDC_RAMLIST), 0);
RefreshRamListSelectedCountControlStatus(hDlg); RefreshRamListSelectedCountControlStatus(hDlg);
} }
{rv = true; break;} break;
case IDC_C_AUTOSEARCH: case IDC_C_AUTOSEARCH:
needRefresh = false;
AutoSearch = SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_GETCHECK, 0, 0) != 0; AutoSearch = SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_GETCHECK, 0, 0) != 0;
AutoSearchAutoRetry = false; AutoSearchAutoRetry = false;
if (!AutoSearch) {rv = true; break;} if (!AutoSearch)
break;
else
rv = false;
case IDC_C_SEARCH: case IDC_C_SEARCH:
{ {
needRefresh = false;
// Clear_Sound_Buffer(); // Clear_Sound_Buffer();
if (!rs_val_valid && !(rs_val_valid = Set_RS_Val())) if (!rs_val_valid && !(rs_val_valid = Set_RS_Val()))
goto invalid_field; {
MessageBox(RamSearchHWnd, "Invalid or out-of-bound entered value.", "Error", MB_OK | MB_ICONSTOP);
if (AutoSearch) // stop autosearch if it just started
{
SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(hDlg, WM_COMMAND, IDC_C_AUTOSEARCH, 0);
}
}
else {
if (ResultCount) if (ResultCount)
{ {
RamSearchSaveUndoStateIfNotTooBig(hDlg); RamSearchSaveUndoStateIfNotTooBig(hDlg);
@ -1894,19 +1955,12 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
soft_reset_address_info(); soft_reset_address_info();
} }
{rv = true; break;}
invalid_field:
MessageBox(RamSearchHWnd,"Invalid or out-of-bound entered value.","Error",MB_OK|MB_ICONSTOP);
if(AutoSearch) // stop autosearch if it just started
{
SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(hDlg, WM_COMMAND, IDC_C_AUTOSEARCH, 0);
} }
{rv = true; break;} break;
} }
case IDC_C_HEXEDITOR: case IDC_C_HEXEDITOR:
{ {
needRefresh = false;
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST); HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int selCount = ListView_GetSelectedCount(ramListControl); int selCount = ListView_GetSelectedCount(ramListControl);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED); int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
@ -1915,10 +1969,12 @@ invalid_field:
unsigned int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex); unsigned int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
ChangeMemViewFocus(0, addr, -1); ChangeMemViewFocus(0, addr, -1);
} }
rv = false;
break; break;
} }
case IDC_C_WATCH: case IDC_C_WATCH:
{ {
needRefresh = false;
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST); HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int selCount = SendMessage(ramListControl, LVM_GETSELECTEDCOUNT, 0, 0); int selCount = SendMessage(ramListControl, LVM_GETSELECTEDCOUNT, 0, 0);
if (selCount > 0) if (selCount > 0)
@ -1950,12 +2006,13 @@ invalid_field:
free(watches); free(watches);
} }
{rv = true; break;} break;
} }
// eliminate all selected items // eliminate all selected items
case IDC_C_ELIMINATE: case IDC_C_ELIMINATE:
{ {
needRefresh = false;
RamSearchSaveUndoStateIfNotTooBig(hDlg); RamSearchSaveUndoStateIfNotTooBig(hDlg);
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST); HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
@ -2010,51 +2067,38 @@ invalid_field:
ListView_SetItemState(ramListControl, -1, 0, LVIS_SELECTED); // deselect all ListView_SetItemState(ramListControl, -1, 0, LVIS_SELECTED); // deselect all
signal_new_size(); signal_new_size();
{rv = true; break;} break;
} }
default:
rv = false;
needRefresh = false;
break;
} }
// check refresh for comparison preview color update if (needRefresh)
// also, update rs_val if needed {
bool needRefresh = false; rs_val_valid = Set_RS_Val();
ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1);
}
return rv;
}
case EN_CHANGE:
{
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_LESSTHAN:
case IDC_MORETHAN:
case IDC_NOMORETHAN:
case IDC_NOLESSTHAN:
case IDC_EQUALTO:
case IDC_DIFFERENTFROM:
case IDC_DIFFERENTBY:
case IDC_MODULO:
case IDC_PREVIOUSVALUE:
case IDC_SPECIFICVALUE:
case IDC_SPECIFICADDRESS:
case IDC_NUMBEROFCHANGES:
case IDC_SIGNED:
case IDC_UNSIGNED:
case IDC_HEX:
rs_val_valid = Set_RS_Val();
needRefresh = true;
break;
case IDC_EDIT_COMPAREVALUE: case IDC_EDIT_COMPAREVALUE:
case IDC_EDIT_COMPAREADDRESS: case IDC_EDIT_COMPAREADDRESS:
case IDC_EDIT_COMPARECHANGES: case IDC_EDIT_COMPARECHANGES:
case IDC_EDIT_DIFFBY: case IDC_EDIT_DIFFBY:
case IDC_EDIT_MODBY: case IDC_EDIT_MODBY:
if(HIWORD(wParam) == EN_CHANGE)
{
rs_val_valid = Set_RS_Val(); rs_val_valid = Set_RS_Val();
needRefresh = true; ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1);
}
}
}
} }
break; break;
}
if(needRefresh)
ListView_Update(GetDlgItem(hDlg,IDC_RAMLIST), -1);
return rv;
} break;
case WM_CLOSE: case WM_CLOSE:
DestroyWindow(hDlg); DestroyWindow(hDlg);
break; break;
@ -2067,6 +2111,7 @@ invalid_field:
return false; return false;
} }
void UpdateRamSearchTitleBar(int percent) void UpdateRamSearchTitleBar(int percent)
{ {
#define HEADER_STR " RAM Search - " #define HEADER_STR " RAM Search - "

View File

@ -854,6 +854,11 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE);
SetFocus(GetDlgItem(hDlg, IDC_PROMPT_EDIT)); SetFocus(GetDlgItem(hDlg, IDC_PROMPT_EDIT));
} }
else {
SetFocus(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS));
SendDlgItemMessage(hDlg, IDC_EDIT_COMPAREADDRESS, EM_SETLIMITTEXT, 4, 0);
DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
}
} }
return true; return true;

View File

@ -2165,7 +2165,7 @@ BEGIN
CONTROL "Number of Changes:",IDC_NUMBEROFCHANGES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,212,76,10 CONTROL "Number of Changes:",IDC_NUMBEROFCHANGES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,212,76,10
EDITTEXT IDC_EDIT_COMPAREVALUE,203,187,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED EDITTEXT IDC_EDIT_COMPAREVALUE,203,187,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPAREADDRESS,203,199,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED EDITTEXT IDC_EDIT_COMPAREADDRESS,203,199,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPARECHANGES,203,211,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED EDITTEXT IDC_EDIT_COMPARECHANGES,203,211,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
GROUPBOX "Data Type / Display",IDC_STATIC,196,228,75,45,0,WS_EX_TRANSPARENT GROUPBOX "Data Type / Display",IDC_STATIC,196,228,75,45,0,WS_EX_TRANSPARENT
CONTROL "Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,200,238,67,9 CONTROL "Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,200,238,67,9
CONTROL "Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,249,67,9 CONTROL "Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,249,67,9
@ -2213,6 +2213,7 @@ BEGIN
CONTROL "&Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,18,47,67,9 CONTROL "&Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,18,47,67,9
CONTROL "&Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,18,57,67,9 CONTROL "&Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,18,57,67,9
CONTROL "&Hexadecimal",IDC_HEX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,18,67,67,9 CONTROL "&Hexadecimal",IDC_HEX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,18,67,67,9
CONTROL "&Binary",IDC_BINARY,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,18,77,67,9
GROUPBOX "Data Size",IDC_DATASIZE_GROUPBOX,94,37,73,52,0,WS_EX_TRANSPARENT GROUPBOX "Data Size",IDC_DATASIZE_GROUPBOX,94,37,73,52,0,WS_EX_TRANSPARENT
CONTROL "&1 byte",IDC_1_BYTE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,98,47,61,11 CONTROL "&1 byte",IDC_1_BYTE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,98,47,61,11
CONTROL "&2 bytes",IDC_2_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,98,57,61,11 CONTROL "&2 bytes",IDC_2_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,98,57,61,11
@ -2743,6 +2744,11 @@ BEGIN
0 0
END END
IDD_RAMSEARCH AFX_DIALOG_LAYOUT
BEGIN
0
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View File

@ -1288,10 +1288,10 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), eoptions&EO_TVASPECT); EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), eoptions&EO_TVASPECT);
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_SLASHTEXT), eoptions&EO_TVASPECT); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_SLASHTEXT), eoptions&EO_TVASPECT);
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_WINSIZE_MUL_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc); DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_WINSIZE_MUL_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_WINSIZE_MUL_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_WINSIZE_MUL_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_TVASPECT_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TVASPECT_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLong(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
break; break;
} }

View File

@ -3342,10 +3342,6 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
// Debugger -> Add breakpoint // Debugger -> Add breakpoint
case IDC_ADDBP_ADDR_START: case IDC_ADDBP_ADDR_END: case IDC_ADDBP_ADDR_START: case IDC_ADDBP_ADDR_END:
// RAM Watch / RAM Search / Cheat -> Add watch
// TODO: Some other features
// case IDC_EDIT_COMPAREADDRESS:
// Address, Value, Compare, Known Value, Note equal, Greater than and Less than in Cheat // Address, Value, Compare, Known Value, Note equal, Greater than and Less than in Cheat
case IDC_CHEAT_ADDR: case IDC_CHEAT_VAL: case IDC_CHEAT_COM: case IDC_CHEAT_ADDR: case IDC_CHEAT_VAL: case IDC_CHEAT_COM:
case IDC_CHEAT_VAL_KNOWN: case IDC_CHEAT_VAL_NE_BY: case IDC_CHEAT_VAL_KNOWN: case IDC_CHEAT_VAL_NE_BY:
@ -3361,6 +3357,10 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
case MW_ADDR12: case MW_ADDR13: case MW_ADDR14: case MW_ADDR15: case MW_ADDR12: case MW_ADDR13: case MW_ADDR14: case MW_ADDR15:
case MW_ADDR16: case MW_ADDR17: case MW_ADDR18: case MW_ADDR19: case MW_ADDR16: case MW_ADDR17: case MW_ADDR18: case MW_ADDR19:
case MW_ADDR20: case MW_ADDR21: case MW_ADDR22: case MW_ADDR23: case MW_ADDR20: case MW_ADDR21: case MW_ADDR22: case MW_ADDR23:
// Specific Address in RAM Search
// RAM Watch / RAM Search / Cheat -> Add watch
case IDC_EDIT_COMPAREADDRESS:
return IsLetterLegalHex; return IsLetterLegalHex;
// Size multiplier and TV Aspect in Video Config // Size multiplier and TV Aspect in Video Config
@ -3372,10 +3372,24 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
case IDC_CHEAT_TEXT: case IDC_CHEAT_TEXT:
return IsLetterLegalCheat; return IsLetterLegalCheat;
// PRG ROM, PRG RAM, PRG NVRAM, CHR ROM, CHR RAM, CHR NVRAM in iNES Header Editor // PRG ROM, PRG RAM, PRG NVRAM, CHR ROM, CHR RAM and CHR NVRAM in iNES Header Editor
case IDC_PRGROM_EDIT: case IDC_PRGRAM_EDIT: case IDC_PRGNVRAM_EDIT: case IDC_PRGROM_EDIT: case IDC_PRGRAM_EDIT: case IDC_PRGNVRAM_EDIT:
case IDC_CHRROM_EDIT: case IDC_CHRRAM_EDIT: case IDC_CHRNVRAM_EDIT: case IDC_CHRROM_EDIT: case IDC_CHRRAM_EDIT: case IDC_CHRNVRAM_EDIT:
return IsLetterLegalSize; return IsLetterLegalSize;
// Specific value, Different by and Modulo in RAM search
case IDC_EDIT_COMPAREVALUE:
case IDC_EDIT_DIFFBY:
case IDC_EDIT_MODBY:
{
extern char rs_t;
switch (rs_t)
{
case 's': return IsLetterLegalDecHexMixed;
case 'u': return IsLetterLegalUnsignedDecHexMixed;
case 'h': return IsLetterLegalHex;
}
}
} }
return NULL; return NULL;
} }
@ -3430,7 +3444,28 @@ inline char* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter))
if (IsLetterLegal == IsLetterLegalSize) if (IsLetterLegal == IsLetterLegalSize)
return "You can only type decimal number followed with B, KB or MB."; return "You can only type decimal number followed with B, KB or MB.";
if (IsLetterLegal == IsLetterLegalDec) if (IsLetterLegal == IsLetterLegalDec)
return "You can only type decimal number (minus is acceptable)."; return "You can only type decimal number (sign character is acceptable).";
if (IsLetterLegal == IsLetterLegalDecHexMixed)
return
"You can only type decimal or hexademical number\n"
"(sign character is acceptable).\n\n"
"When your number contains letter A-F,\n"
"it is regarded as hexademical number,\n"
"however, if you want to express a heademical number\n"
"but all the digits are in 0-9,\n"
"you must add a $ prefix to prevent ambiguous.\n"
"eg. 10 is a decimal number,\n"
"$10 means a hexademical number that is 16 in decimal.";
if (IsLetterLegal == IsLetterLegalUnsignedDecHexMixed)
return
"You can only type decimal or hexademical number.\n\n"
"When your number contains letter A-F,\n"
"it is regarded as hexademical number,\n"
"however, if you want to express a heademical number\n"
"but all the digits are in 0-9,\n"
"you must add a $ prefix to prevent ambiguous.\n"
"eg. 10 is a decimal number,\n"
"$10 means a hexademical number that is 16 in decimal.";
return "Your input contains invalid characters."; return "Your input contains invalid characters.";
} }
@ -3466,10 +3501,20 @@ inline bool IsLetterLegalSize(char letter)
inline bool IsLetterLegalDec(char letter) inline bool IsLetterLegalDec(char letter)
{ {
return letter >= '0' && letter <= '9' || letter == '-'; return letter >= '0' && letter <= '9' || letter == '-' || letter == '+';
} }
inline bool IsLetterLegalFloat(char letter) inline bool IsLetterLegalFloat(char letter)
{ {
return letter >= '0' && letter <= '9' || letter == '.'; return letter >= '0' && letter <= '9' || letter == '.' || letter == '-' || letter == '+';
}
inline bool IsLetterLegalDecHexMixed(char letter)
{
return letter >= '0' && letter <= '9' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f' || letter == '$' || letter == '-' || letter == '+';
}
inline bool IsLetterLegalUnsignedDecHexMixed(char letter)
{
return letter >= '0' && letter <= '9' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f' || letter == '$';
} }

View File

@ -140,6 +140,8 @@ inline bool IsLetterLegalCheat(char letter);
inline bool IsLetterLegalDec(char letter); inline bool IsLetterLegalDec(char letter);
inline bool IsLetterLegalSize(char letter); inline bool IsLetterLegalSize(char letter);
inline bool IsLetterLegalFloat(char letter); inline bool IsLetterLegalFloat(char letter);
inline bool IsLetterLegalDecHexMixed(char letter);
inline bool IsLetterLegalUnsignedDecHexMixed(char letter);
extern WNDPROC DefaultEditCtrlProc; extern WNDPROC DefaultEditCtrlProc;
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP); extern LRESULT APIENTRY FilterEditCtrlProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP);