enable "add cheat" button in ram search and ram watch, and fix some cheat add/edit dialog bugs/limitations

This commit is contained in:
nitsuja 2009-12-12 10:34:06 +00:00
parent b3b25bcc96
commit d37f31bf68
6 changed files with 172 additions and 57 deletions

View File

@ -39,8 +39,10 @@ static u32 searchAddValue = 0;
static u8 searchAddMode = 0; static u8 searchAddMode = 0;
static u8 searchAddFreeze = 1; static u8 searchAddFreeze = 1;
static u8 searchAddSize = 0; static u8 searchAddSize = 0;
static const char* searchAddDesc = 0;
static char editBuf[3][75] = { 0 }; static char editBuf[3][75] = { 0 };
static u32 cheatEditPos = 0; static u32 cheatEditPos = 0;
static u8 cheatAddPasteCheck = 0;
static u8 cheatXXtype = 0; static u8 cheatXXtype = 0;
static u8 cheatXXaction = 0; static u8 cheatXXaction = 0;
@ -68,14 +70,13 @@ char *searchRangeText[2][4] = { {"[0..255]", "[0..65536]", "[0..16777215]", "[0.
u32 searchRange[4][2] = { u32 searchRange[4][2] = {
{ 0, 255 }, { 0, 255 },
{ 0, 65536 }, { 0, 65535 },
{ 0, 16777215 }, { 0, 16777215 },
{ 0, 4294967295 } { 0, 4294967295 }
}; };
LONG_PTR CALLBACK EditValueProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) LONG_PTR CALLBACK EditValueProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
// TODO: check paste
if (msg == WM_CHAR) if (msg == WM_CHAR)
{ {
switch (wParam) switch (wParam)
@ -91,15 +92,25 @@ LONG_PTR CALLBACK EditValueProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case '8': case '8':
case '9': case '9':
break; break;
case 'o':
case 'O':
wParam = '0';
break;
case '-': case '-':
{ {
u8 pos = 0; u32 pos = 0;
SendMessage(hwnd, EM_GETSEL, (WPARAM)&pos, NULL); SendMessage(hwnd, EM_GETSEL, (WPARAM)&pos, NULL);
if (pos != 0) wParam = 0; if (pos != 0) wParam = 0;
} }
break; break;
case VK_BACK: case VK_BACK:
case 0x3: // ^C
case 0x18: // ^X
case 0x1a: // ^Z
break;
case 0x16: // ^V
cheatAddPasteCheck = true;
break; break;
default: default:
wParam = 0; wParam = 0;
@ -113,7 +124,6 @@ LONG_PTR CALLBACK EditValueProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
LONG_PTR CALLBACK EditValueHEXProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) LONG_PTR CALLBACK EditValueHEXProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
// TODO: check paste
if (msg == WM_CHAR) if (msg == WM_CHAR)
{ {
switch (wParam) switch (wParam)
@ -143,7 +153,17 @@ LONG_PTR CALLBACK EditValueHEXProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case 'f': case 'f':
wParam -= 32; wParam -= 32;
break; break;
case 'o':
case 'O':
wParam = '0';
break;
case VK_BACK: case VK_BACK:
case 0x3: // ^C
case 0x18: // ^X
case 0x1a: // ^Z
break;
case 0x16: // ^V
cheatAddPasteCheck = true;
break; break;
default: default:
wParam = 0; wParam = 0;
@ -165,20 +185,22 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
{ {
saveOldEditProc = oldEditProc; saveOldEditProc = oldEditProc;
SendMessage(GetDlgItem(dialog, IDC_EDIT1), EM_SETLIMITTEXT, 6, 0); SendMessage(GetDlgItem(dialog, IDC_EDIT1), EM_SETLIMITTEXT, 6, 0);
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_SETLIMITTEXT, 10, 0); SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_SETLIMITTEXT, 11, 0);
SendMessage(GetDlgItem(dialog, IDC_EDIT3), EM_SETLIMITTEXT, 75, 0); SendMessage(GetDlgItem(dialog, IDC_EDIT3), EM_SETLIMITTEXT, 75, 0);
oldEditProcHEX = SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)EditValueHEXProc); oldEditProcHEX = SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)EditValueHEXProc);
oldEditProc = SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT2), GWLP_WNDPROC, (LONG_PTR)EditValueProc); oldEditProc = SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT2), GWLP_WNDPROC, (LONG_PTR)EditValueProc);
if (searchAddMode == 1) if (searchAddMode == 1 || searchAddMode == 2)
{ {
char buf[10]; char buf[12];
searchAddAddress &= 0x00FFFFFF; searchAddAddress &= 0x00FFFFFF;
wsprintf(buf, "%06X", searchAddAddress); wsprintf(buf, "%06X", searchAddAddress);
SetWindowText(GetDlgItem(dialog, IDC_EDIT1), buf); SetWindowText(GetDlgItem(dialog, IDC_EDIT1), buf);
wsprintf(buf, "%i", searchAddValue); wsprintf(buf, "%i", searchAddValue);
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf); SetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf);
EnableWindow(GetDlgItem(dialog, IDOK), TRUE); EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
if (searchAddMode == 1)
{
EnableWindow(GetDlgItem(dialog, IDC_EDIT1), FALSE); EnableWindow(GetDlgItem(dialog, IDC_EDIT1), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO1), FALSE); EnableWindow(GetDlgItem(dialog, IDC_RADIO1), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_RADIO2), FALSE);
@ -186,6 +208,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
EnableWindow(GetDlgItem(dialog, IDC_RADIO4), FALSE); EnableWindow(GetDlgItem(dialog, IDC_RADIO4), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO8), FALSE); EnableWindow(GetDlgItem(dialog, IDC_RADIO8), FALSE);
} }
}
else else
{ {
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), "0"); SetWindowText(GetDlgItem(dialog, IDC_EDIT2), "0");
@ -193,14 +216,26 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
} }
memset(editBuf, 0, sizeof(editBuf)); memset(editBuf, 0, sizeof(editBuf));
if(searchAddDesc)
{
strncpy(editBuf[2], searchAddDesc, sizeof(editBuf[2]) - 1);
SetWindowText(GetDlgItem(dialog, IDC_EDIT3), editBuf[2]);
}
searchAddDesc = 0;
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 10); GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 10);
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 11); GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 11);
CheckDlgButton(dialog, IDC_CHECK1, BST_CHECKED); CheckDlgButton(dialog, IDC_CHECK1, BST_CHECKED);
CheckDlgButton(dialog, searchSizeIDDs[searchAddSize], BST_CHECKED); CheckDlgButton(dialog, searchSizeIDDs[searchAddSize], BST_CHECKED);
if(searchAddMode == 2)
{
SetFocus(GetDlgItem(dialog, IDC_EDIT2));
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_SETSEL, 0, -1);
} }
return TRUE; }
return searchAddMode != 2;
case WM_COMMAND: case WM_COMMAND:
{ {
@ -213,7 +248,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
if (cheatsAdd(searchAddSize, tmp_addr, atol(editBuf[1]), editBuf[2], searchAddFreeze)) if (cheatsAdd(searchAddSize, tmp_addr, atol(editBuf[1]), editBuf[2], searchAddFreeze))
{ {
if ((searchAddMode == 0) || (cheatsSave() && searchAddMode == 1)) if ((searchAddMode == 0) || (cheatsSave() && (searchAddMode == 1 || searchAddMode == 2)))
{ {
oldEditProc = saveOldEditProc; oldEditProc = saveOldEditProc;
searchAddAddress = tmp_addr; searchAddAddress = tmp_addr;
@ -235,20 +270,32 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
if (HIWORD(wparam) == EN_UPDATE) if (HIWORD(wparam) == EN_UPDATE)
{ {
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 8); GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 8);
if ( (strlen(editBuf[0]) < 6) || (!strlen(editBuf[1])) )
u32 val = 0;
sscanf_s(editBuf[0], "%x", &val);
val &= 0x00FFFFFF;
if(cheatAddPasteCheck)
{
cheatAddPasteCheck = 0;
char temp [12];
sprintf(temp, "%06X", val);
if(strcmp(editBuf[0], temp))
{
strcpy(editBuf[0], temp);
int sel1=-1, sel2=0;
SendMessage(GetDlgItem(dialog , IDC_EDIT1), EM_GETSEL, (WPARAM)&sel1, (LPARAM)&sel2);
SetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0]);
SendMessage(GetDlgItem(dialog, IDC_EDIT1), EM_SETSEL, sel1, sel2);
}
}
if ( (strlen(editBuf[0]) < 6) || (!strlen(editBuf[1])) || val > 0x400000)
{ {
EnableWindow(GetDlgItem(dialog, IDOK), FALSE); EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE; return TRUE;
} }
u32 val = 0;
sscanf_s(editBuf[0], "%x", &val);
val &= 0x00FFFFFF;
if (val > 0x400000)
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
EnableWindow(GetDlgItem(dialog, IDOK), TRUE); EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
} }
return TRUE; return TRUE;
@ -258,19 +305,35 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
{ {
if (HIWORD(wparam) == EN_UPDATE) if (HIWORD(wparam) == EN_UPDATE)
{ {
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 11); GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 12);
if ( (strlen(editBuf[0]) < 6) || (!strlen(editBuf[1])) ) int parseOffset = 0;
if(editBuf[1][0] && editBuf[1][1] == '-')
parseOffset = 1; // typed something in front of -
u32 val = strtoul(editBuf[1]+parseOffset,NULL,10);
if(cheatAddPasteCheck || parseOffset)
{
cheatAddPasteCheck = 0;
val &= searchRange[searchAddSize][1];
char temp [12];
sprintf(temp, "%u", val);
if(strcmp(editBuf[1], temp))
{
strcpy(editBuf[1], temp);
int sel1=-1, sel2=0;
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_GETSEL, (WPARAM)&sel1, (LPARAM)&sel2);
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1]);
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_SETSEL, sel1, sel2);
}
}
if ( (strlen(editBuf[0]) < 6) || (!strlen(editBuf[1]))
|| (val > searchRange[searchAddSize][1] && !(editBuf[1][0] == '-' && u32(-s32(val))-1 <= searchRange[searchAddSize][1])) )
{ {
EnableWindow(GetDlgItem(dialog, IDOK), FALSE); EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE; return TRUE;
} }
u32 val = strtoul(editBuf[1],NULL,10);
if (val > searchRange[searchAddSize][1])
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
EnableWindow(GetDlgItem(dialog, IDOK), TRUE); EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
} }
return TRUE; return TRUE;
@ -393,16 +456,31 @@ INT_PTR CALLBACK CheatsEditProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara
{ {
if (HIWORD(wparam) == EN_UPDATE) if (HIWORD(wparam) == EN_UPDATE)
{ {
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf, 10); GetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf, 12);
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), buf2, 8); GetWindowText(GetDlgItem(dialog, IDC_EDIT1), buf2, 8);
if ( (strlen(buf2) < 6) || (!strlen(buf)) ) int parseOffset = 0;
if(buf[0] && buf[1] == '-')
parseOffset = 1; // typed something in front of -
u32 val = strtoul(buf+parseOffset,NULL,10);
if(cheatAddPasteCheck || parseOffset)
{ {
EnableWindow(GetDlgItem(dialog, IDOK), FALSE); cheatAddPasteCheck = 0;
return TRUE; val &= searchRange[tempCheat.size][1];
char temp [12];
sprintf(temp, "%u", val);
if(strcmp(buf, temp))
{
strcpy(buf, temp);
int sel1=-1, sel2=0;
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_GETSEL, (WPARAM)&sel1, (LPARAM)&sel2);
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf);
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_SETSEL, sel1, sel2);
}
} }
u32 val = atol(buf); if ( (strlen(buf2) < 6) || (!strlen(buf))
if (val > searchRange[tempCheat.size][1]) || (val > searchRange[tempCheat.size][1] && !(buf[0] == '-' && u32(-s32(val))-1 <= searchRange[tempCheat.size][1])) )
{ {
EnableWindow(GetDlgItem(dialog, IDOK), FALSE); EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE; return TRUE;
@ -919,6 +997,32 @@ void CheatsListDialog(HWND hwnd)
} }
} }
void CheatsAddDialog(HWND parentHwnd, u32 address, u32 value, u8 size, const char* description)
{
searchAddAddress = address;
searchAddValue = value;
searchAddMode = 2;
searchAddFreeze = 1;
searchAddSize = size - 1;
searchAddDesc = description;
if (DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_CHEAT_ADD), parentHwnd, (DLGPROC) CheatsAddProc))
{
// disabled here for now because it's modal and that's annoying.
//CheatsListDialog(listParentHwnd);
//
//char buf[256];
//cheatsGet(&tempCheat, cheatEditPos);
//if (tempCheat.enabled)
// ListView_SetItemText(cheatListView, cheatEditPos, 0, "X");
//wsprintf(buf, "0x02%06X", tempCheat.hi[0]);
//ListView_SetItemText(cheatListView, cheatEditPos, 1, buf);
//ltoa(tempCheat.lo[0], buf, 10);
//ListView_SetItemText(cheatListView, cheatEditPos, 2, buf);
//ListView_SetItemText(cheatListView, cheatEditPos, 3, tempCheat.description);
}
}
// ================================================================================== Search // ================================================================================== Search
INT_PTR CALLBACK CheatsSearchExactWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) INT_PTR CALLBACK CheatsSearchExactWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
@ -953,7 +1057,7 @@ INT_PTR CALLBACK CheatsSearchExactWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM
{ {
if (HIWORD(wparam) == EN_UPDATE) if (HIWORD(wparam) == EN_UPDATE)
{ {
char buf[10]; char buf[12];
GetWindowText(GetDlgItem(dialog, IDC_EVALUE), buf, 10); GetWindowText(GetDlgItem(dialog, IDC_EVALUE), buf, 10);
if (!strlen(buf)) if (!strlen(buf))
{ {

View File

@ -22,3 +22,4 @@
extern void CheatsListDialog(HWND hwnd); extern void CheatsListDialog(HWND hwnd);
extern void CheatsSearchDialog(HWND hwnd); extern void CheatsSearchDialog(HWND hwnd);
extern void CheatsSearchReset(); extern void CheatsSearchReset();
extern void CheatsAddDialog(HWND parentHwnd, u32 address, u32 value, u8 size, const char* description=0);

View File

@ -4683,7 +4683,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case ID_VIEW_FRAMECOUNTER: case ID_VIEW_FRAMECOUNTER:
CommonSettings.hud.FrameCounterDisplay ^= true; CommonSettings.hud.FrameCounterDisplay ^= true;
WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName); WritePrivateProfileBool("Display", "FrameCounter", CommonSettings.hud.FrameCounterDisplay, IniName);
osd->clear();
return 0; return 0;
case ID_VIEW_DISPLAYFPS: case ID_VIEW_DISPLAYFPS:

View File

@ -8,6 +8,8 @@
// update every single value in RAM every single frame, and // update every single value in RAM every single frame, and
// keep track of the exact number of frames across which each value has changed, // keep track of the exact number of frames across which each value has changed,
// without causing the emulation to run noticeably slower than normal. // without causing the emulation to run noticeably slower than normal.
// [note: in DeSmuME it is noticeably slower because the emulation is already only barely fast enough.
// but especially after narrowing down the search results a little, it's still decently fast.]
// //
// The data representation was changed from one entry per valid address // The data representation was changed from one entry per valid address
// to one entry per contiguous range of uneliminated addresses // to one entry per contiguous range of uneliminated addresses
@ -38,6 +40,7 @@
#include <assert.h> #include <assert.h>
#include <commctrl.h> #include <commctrl.h>
#include "ramwatch.h" #include "ramwatch.h"
#include "cheatsWin.h"
#include <list> #include <list>
#include <vector> #include <vector>
#ifdef _WIN32 #ifdef _WIN32
@ -1043,7 +1046,7 @@ void RefreshRamListSelectedCountControlStatus(HWND hDlg)
if(selCount < 2 || prevSelCount < 2) if(selCount < 2 || prevSelCount < 2)
{ {
EnableWindow(GetDlgItem(hDlg, IDC_C_WATCH), (selCount == 1 && WatchCount < MAX_WATCH_COUNT) ? TRUE : FALSE); EnableWindow(GetDlgItem(hDlg, IDC_C_WATCH), (selCount == 1 && WatchCount < MAX_WATCH_COUNT) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_C_ADDCHEAT), (selCount == 1) ? /*TRUE*/FALSE : FALSE); EnableWindow(GetDlgItem(hDlg, IDC_C_ADDCHEAT), (selCount == 1) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_C_ELIMINATE), (selCount >= 1) ? TRUE : FALSE); EnableWindow(GetDlgItem(hDlg, IDC_C_ELIMINATE), (selCount >= 1) ? TRUE : FALSE);
} }
prevSelCount = selCount; prevSelCount = selCount;
@ -1680,14 +1683,15 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
} {rv = true; break;} } {rv = true; break;}
case IDC_C_ADDCHEAT: case IDC_C_ADDCHEAT:
{ {
// watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_RAMLIST)); int cheatItemIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_RAMLIST));
// Liste_GG[CheatCount].restore = Liste_GG[CheatCount].data = rsresults[watchIndex].cur; if(cheatItemIndex >= 0)
// Liste_GG[CheatCount].addr = rsresults[watchIndex].Address; {
// Liste_GG[CheatCount].size = rs_type_size; u32 address = CALL_WITH_T_SIZE_TYPES(GetHardwareAddressFromItemIndex, rs_type_size,rs_t=='s',noMisalign, cheatItemIndex);
// Liste_GG[CheatCount].Type = rs_t; u8 size = (rs_type_size=='b') ? 1 : (rs_type_size=='w' ? 2 : 4);
// Liste_GG[CheatCount].oper = '='; u32 value = CALL_WITH_T_SIZE_TYPES(GetCurValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, cheatItemIndex);
// Liste_GG[CheatCount].mode = 0; CheatsAddDialog(hDlg, address, value, size);
// DialogBoxParam(ghInstance, MAKEINTRESOURCE(IDD_EDITCHEAT), hDlg, (DLGPROC) EditCheatProc,(LPARAM) 0); }
{rv = true; break;}
} }
case IDC_C_RESET: case IDC_C_RESET:
{ {

View File

@ -7,6 +7,7 @@
#include "NDSSystem.h" #include "NDSSystem.h"
#include "ramwatch.h" #include "ramwatch.h"
#include "ram_search.h" #include "ram_search.h"
#include "cheatsWin.h"
#include <assert.h> #include <assert.h>
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
@ -48,9 +49,9 @@ unsigned int GetCurrentValue(AddressWatcher& watch)
switch (watch.Size) switch (watch.Size)
{ {
case 0x62: return val_u8; case 'b': return val_u8;
case 0x77: return val_u16; case 'w': return val_u16;
case 0x64: return val_u32; case 'd': return val_u32;
default: return 0; default: return 0;
} }
// return ReadValueAtHardwareAddress(watch.Address, watch.Size == 'd' ? 4 : watch.Size == 'w' ? 2 : 1); // return ReadValueAtHardwareAddress(watch.Address, watch.Size == 'd' ? 4 : watch.Size == 'w' ? 2 : 1);
@ -1046,10 +1047,14 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
} }
case IDC_C_ADDCHEAT: case IDC_C_ADDCHEAT:
{ {
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)) | (1 << 24); watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
if(watchIndex != -1) if(watchIndex != -1)
{ {
// DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITCHEAT), hDlg, (DLGPROC) EditCheatProc,(LPARAM) searchIndex); //TODO: made a IDD_EDITCHEAT dialog, and EditCheatProc (are they in GENS?) and integrate into cheats system u32 address = rswatches[watchIndex].Address;
u8 size = (rswatches[watchIndex].Size=='b') ? 1 : (rswatches[watchIndex].Size=='w' ? 2 : 4);
u32 value = rswatches[watchIndex].CurValue;
const char* desc = rswatches[watchIndex].comment;
CheatsAddDialog(hDlg, address, value, size, desc);
} }
break; break;
} }

Binary file not shown.