1. Fix crash when add multiple watches in RAM Search window, and adding multiple watches here can be batch named.
2. New cheat list box 0.0.0.3 Alpha, changed the possibilities box to a CListCtrl rather than a simple CListBox, use a map for its buffer. It may not quite efficient currently, but I personally think it's much better than adding and deleting the items repeatedly every frame, and now its item can be selected while emulation is running, although there's not much usage for this... 3. added several context menus to possible list, now you can directly add address to memory watch or ram watch, or go to hex editor from here, currently it's still a single select list.
This commit is contained in:
parent
f0859ce1e3
commit
9adcbf16cb
|
@ -139,14 +139,13 @@ int FCEU_CalcCheatAffectedBytes(uint32 address, uint32 size) {
|
|||
return count;
|
||||
}
|
||||
|
||||
static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type);
|
||||
static int AddCheatEntry(const char *name, uint32 addr, uint8 val, int compare, int status, int type);
|
||||
static void CheatMemErr(void)
|
||||
{
|
||||
FCEUD_PrintError("Error allocating memory for cheat data.");
|
||||
}
|
||||
|
||||
/* This function doesn't allocate any memory for "name" */
|
||||
static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type)
|
||||
static int AddCheatEntry(const char *name, uint32 addr, uint8 val, int compare, int status, int type)
|
||||
{
|
||||
struct CHEATF *temp;
|
||||
if(!(temp = (struct CHEATF *)FCEU_dmalloc(sizeof(struct CHEATF))))
|
||||
|
@ -191,7 +190,7 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
|||
int x;
|
||||
|
||||
char linebuf[2048];
|
||||
char *namebuf = NULL;
|
||||
char namebuf[128];
|
||||
int tc = 0;
|
||||
char *fn;
|
||||
|
||||
|
@ -244,8 +243,7 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
|||
char *neo = &tbuf[4+2+2+1+1+1];
|
||||
if(sscanf(tbuf, "%04x%*[:]%02x%*[:]%02x", &addr, &val, &compare) != 3)
|
||||
continue;
|
||||
if (!(namebuf = (char *)FCEU_dmalloc(strlen(neo) + 1)))
|
||||
return;
|
||||
char namebuf[128];
|
||||
strcpy(namebuf, neo);
|
||||
}
|
||||
else
|
||||
|
@ -253,8 +251,6 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
|||
char *neo = &tbuf[4+2+1+1];
|
||||
if(sscanf(tbuf, "%04x%*[:]%02x", &addr, &val) != 2)
|
||||
continue;
|
||||
if (!(namebuf = (char *)FCEU_dmalloc(strlen(neo) + 1)))
|
||||
return;
|
||||
strcpy(namebuf, neo);
|
||||
}
|
||||
|
||||
|
@ -273,9 +269,6 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
|||
tc++;
|
||||
}
|
||||
|
||||
if (namebuf)
|
||||
free(namebuf);
|
||||
|
||||
RebuildSubCheats();
|
||||
|
||||
FCEU_DispMessage("Cheats file loaded.", 0); //Tells user a cheats file was loaded.
|
||||
|
@ -368,25 +361,12 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
|
|||
|
||||
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type)
|
||||
{
|
||||
char *t = NULL;
|
||||
|
||||
if(!(t = (char *)FCEU_dmalloc(strlen(name) + 1)))
|
||||
{
|
||||
CheatMemErr();
|
||||
return(0);
|
||||
}
|
||||
strcpy(t,name);
|
||||
if(!AddCheatEntry(t, addr, val, compare, 1, type))
|
||||
{
|
||||
free(t);
|
||||
return(0);
|
||||
}
|
||||
if(!AddCheatEntry(name, addr, val, compare, 1, type))
|
||||
return 0;
|
||||
savecheats = 1;
|
||||
RebuildSubCheats();
|
||||
|
||||
if (t)
|
||||
free(t);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -744,7 +724,7 @@ void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void
|
|||
void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current))
|
||||
{
|
||||
uint32 x;
|
||||
uint32 in=0;
|
||||
uint32 in = 0;
|
||||
|
||||
if(!CheatComp)
|
||||
{
|
||||
|
@ -753,14 +733,15 @@ void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a,
|
|||
return;
|
||||
}
|
||||
|
||||
for(x=0;x<0x10000;x++)
|
||||
if(!(CheatComp[x]&CHEATC_NOSHOW) && CheatRPtrs[x>>10])
|
||||
for(x = 0; x < 0x10000; x++)
|
||||
if(!(CheatComp[x] & CHEATC_NOSHOW) && CheatRPtrs[x >> 10])
|
||||
{
|
||||
if(in>=first)
|
||||
if(!callb(x,CheatComp[x],CheatRPtrs[x>>10][x]))
|
||||
if(in >= first)
|
||||
if(!callb(x, CheatComp[x], CheatRPtrs[x >> 10][x]))
|
||||
break;
|
||||
in++;
|
||||
if(in>last) return;
|
||||
if(in > last)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -814,7 +795,7 @@ void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2)
|
|||
if (!(CheatComp[x] & CHEATC_NOSHOW) && (CheatComp[x] != v1 || CheatRPtrs[x >> 10][x] != v2))
|
||||
CheatComp[x] |= CHEATC_EXCLUDED;
|
||||
break;
|
||||
case FCEU_SEARCH_RELATIVE_CHANGE: // Search for relative change(between values).
|
||||
case FCEU_SEARCH_RELATIVE_CHANGE: // Search for relative change (between values).
|
||||
for (x = 0; x < 0x10000; x++)
|
||||
if (!(CheatComp[x] & CHEATC_NOSHOW) && (CheatComp[x] != v1 || CAbs(CheatComp[x] - CheatRPtrs[x >> 10][x]) != v2))
|
||||
CheatComp[x] |= CHEATC_EXCLUDED;
|
||||
|
@ -886,7 +867,7 @@ void UpdateFrozenList(void)
|
|||
|
||||
uint32 x;
|
||||
FrozenAddresses.clear(); //Clear vector and repopulate
|
||||
for(x=0;x<numsubcheats;x++)
|
||||
for(x = 0; x < numsubcheats; x++)
|
||||
{
|
||||
FrozenAddresses.push_back(SubCheats[x].addr);
|
||||
//FCEU_printf("Address %d: %d \n",x,FrozenAddresses[x]); //Debug
|
||||
|
|
|
@ -32,6 +32,13 @@ struct CHEATF {
|
|||
int status;
|
||||
};
|
||||
|
||||
struct SEARCHPOSSIBLE {
|
||||
uint16 addr;
|
||||
uint8 previous;
|
||||
uint8 current;
|
||||
bool update;
|
||||
};
|
||||
|
||||
#define FCEU_SEARCH_SPECIFIC_CHANGE 0
|
||||
#define FCEU_SEARCH_RELATIVE_CHANGE 1
|
||||
#define FCEU_SEARCH_PUERLY_RELATIVE_CHANGE 2
|
||||
|
|
|
@ -23,14 +23,15 @@
|
|||
#include "memview.h"
|
||||
#include "memwatch.h"
|
||||
#include "debugger.h"
|
||||
#include "ramwatch.h"
|
||||
#include "../../fceu.h"
|
||||
#include "../../cart.h"
|
||||
#include "../../cheat.h" // For FCEU_LoadGameCheats()
|
||||
#include <map>
|
||||
|
||||
static HWND pwindow = 0; //Handle to Cheats dialog
|
||||
HWND hCheat = 0; //mbg merge 7/19/06 had to add
|
||||
static HMENU hCheatcontext; //Handle to context menu
|
||||
static HMENU hCheatcontextsub; //Handle to context sub menu
|
||||
static HMENU hCheatcontext; //Handle to cheat context menu
|
||||
|
||||
bool pauseWhileActive = false; //For checkbox "Pause while active"
|
||||
extern bool wasPausedByCheats;
|
||||
|
@ -40,19 +41,6 @@ int CheatStyle = 1;
|
|||
|
||||
#define GGLISTSIZE 128 //hopefully this is enough for all cases
|
||||
|
||||
// deselect the old one and select the new one
|
||||
#define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \
|
||||
LVITEM lvi; \
|
||||
SendMessage(hwnd, LVM_SETITEMSTATE, prevIndex, (LPARAM)&(lvi.mask = LVIF_STATE, lvi.stateMask = LVIS_SELECTED, lvi.state = 0, lvi)), \
|
||||
SendMessage(hwnd, LVM_SETITEMSTATE, newIndex, (LPARAM)&(lvi.state = LVIS_SELECTED, lvi)), \
|
||||
SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, newIndex)
|
||||
|
||||
#define ClearCheatListText(hwnd) \
|
||||
(SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)""))
|
||||
|
||||
|
||||
int selcheat;
|
||||
int selcheatcount;
|
||||
|
@ -60,13 +48,19 @@ int ChtPosX,ChtPosY;
|
|||
int GGConv_wndx=0, GGConv_wndy=0;
|
||||
static HFONT hFont,hNewFont;
|
||||
|
||||
static int scrollindex;
|
||||
static int scrollnum;
|
||||
static int scrollmax;
|
||||
// static int scrollindex;
|
||||
// static int scrollnum;
|
||||
// static int scrollmax;
|
||||
std::map<int, SEARCHPOSSIBLE> possiList;
|
||||
|
||||
int lbfocus=0;
|
||||
int possiStart = 0;
|
||||
int possiItemCount = 0;
|
||||
int possiTotalCount = 0;
|
||||
bool possibleUpdate = false;
|
||||
|
||||
int lbfocus = 0;
|
||||
int searchdone;
|
||||
static int knownvalue=0;
|
||||
static int knownvalue = 0;
|
||||
|
||||
int GGaddr, GGcomp, GGval;
|
||||
char GGcode[10];
|
||||
|
@ -140,6 +134,7 @@ int RedoCheatsCallB(char *name, uint32 a, uint8 v, int c, int s, int type, void*
|
|||
lvi.state = INDEXTOSTATEIMAGEMASK(s ? 2 : 1);
|
||||
SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_SETITEMSTATE, lvi.iItem, (LPARAM)&lvi);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -159,35 +154,103 @@ void RedoCheatsLB(HWND hwndDlg)
|
|||
}
|
||||
}
|
||||
|
||||
HWND InitializeResultsList(HWND hwnd)
|
||||
{
|
||||
HWND hwndResults = GetDlgItem(hwnd, IDC_CHEAT_LIST_POSSIBILITIES);
|
||||
|
||||
// prepare columns
|
||||
LVCOLUMN lv = { 0 };
|
||||
lv.mask = LVCF_TEXT | LVCF_WIDTH;
|
||||
|
||||
lv.pszText = "Addr";
|
||||
lv.cx = 50;
|
||||
SendMessage(hwndResults, LVM_INSERTCOLUMN, 0, (LPARAM)&lv);
|
||||
|
||||
lv.pszText = "Pre";
|
||||
lv.mask |= LVCF_FMT;
|
||||
lv.fmt = LVCFMT_RIGHT;
|
||||
lv.cx = 36;
|
||||
SendMessage(hwndResults, LVM_INSERTCOLUMN, 1, (LPARAM)&lv);
|
||||
|
||||
lv.pszText = "Cur";
|
||||
SendMessage(hwndResults, LVM_INSERTCOLUMN, 2, (LPARAM)&lv);
|
||||
|
||||
|
||||
// set style to full row select
|
||||
SendMessage(hwndResults, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
|
||||
|
||||
|
||||
return hwndResults;
|
||||
}
|
||||
|
||||
int ShowResultsCallB(uint32 a, uint8 last, uint8 current)
|
||||
{
|
||||
char temp[16];
|
||||
if (hCheat)
|
||||
{
|
||||
if (possiList[possiItemCount].update =
|
||||
(possiList[possiItemCount].addr != a ||
|
||||
possiList[possiItemCount].previous != last ||
|
||||
possiList[possiItemCount].current != current))
|
||||
{
|
||||
possiList[possiItemCount].addr = a;
|
||||
possiList[possiItemCount].previous = last;
|
||||
possiList[possiItemCount].current = current;
|
||||
possibleUpdate |= possiList[possiItemCount].update;
|
||||
}
|
||||
++possiItemCount;
|
||||
}
|
||||
|
||||
sprintf(temp,"$%04X: %02X | %02X",(unsigned int)a,last,current);
|
||||
SendDlgItemMessage(hCheat, IDC_CHEAT_LIST_POSSIBILITIES, LB_ADDSTRING, 0, (LPARAM)(LPSTR)temp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ShowResults(HWND hwndDlg)
|
||||
int ShowResults(HWND hwndDlg, bool supressUpdate = false)
|
||||
{
|
||||
int n=FCEUI_CheatSearchGetCount();
|
||||
int t;
|
||||
char str[20];
|
||||
|
||||
scrollnum=n;
|
||||
scrollindex=-32768;
|
||||
if (possiList.size() > 64)
|
||||
possiList.clear();
|
||||
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,0,0);
|
||||
FCEUI_CheatSearchGetRange(0,16,ShowResultsCallB);
|
||||
int count = FCEUI_CheatSearchGetCount();
|
||||
|
||||
t=-32768+n-17;
|
||||
if (t<-32768) t=-32768;
|
||||
scrollmax=t;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETRANGE,-32768,t);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,-32768,1);
|
||||
if (count != possiTotalCount)
|
||||
{
|
||||
char str[20];
|
||||
sprintf(str, "%d Possibilit%s", count, count == 1 ? "y" : "ies");
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_BOX_POSSIBILITIES, str);
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_SETITEMCOUNT, count, 0);
|
||||
possiTotalCount = count;
|
||||
}
|
||||
|
||||
sprintf(str,"%d Possibilities",n);
|
||||
SetDlgItemText(hwndDlg,IDC_CHEAT_BOX_POSSIBILITIES,str);
|
||||
if (count)
|
||||
{
|
||||
int first = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETTOPINDEX, 0, 0);
|
||||
if (first < 0)
|
||||
first = 0;
|
||||
int last = first + possiItemCount + 1;
|
||||
if (last > count)
|
||||
last = count;
|
||||
|
||||
int tmpPossiItemCount = possiItemCount;
|
||||
possiItemCount = first;
|
||||
FCEUI_CheatSearchGetRange(first, last, ShowResultsCallB);
|
||||
possiItemCount = tmpPossiItemCount;
|
||||
if (possibleUpdate && !supressUpdate)
|
||||
{
|
||||
int start = -1, end = -1;
|
||||
for (int i = first; i < last; ++i)
|
||||
if (possiList[i - first].update)
|
||||
{
|
||||
if (start == -1)
|
||||
start = i;
|
||||
end = i;
|
||||
}
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_REDRAWITEMS, start, end);
|
||||
}
|
||||
possibleUpdate = false;
|
||||
possiStart = first;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void EnableCheatButtons(HWND hwndDlg, int enable)
|
||||
|
@ -213,7 +276,7 @@ HWND InitializeCheatList(HWND hwnd)
|
|||
SendMessage(hwndChtList, LVM_INSERTCOLUMN, 0, (LPARAM)&lv);
|
||||
|
||||
lv.pszText = "Name";
|
||||
lv.cx = 140;
|
||||
lv.cx = 132;
|
||||
SendMessage(hwndChtList, LVM_INSERTCOLUMN, 1, (LPARAM)&lv);
|
||||
|
||||
// Add a checkbox to indicate if the cheat is activated
|
||||
|
@ -224,16 +287,6 @@ HWND InitializeCheatList(HWND hwnd)
|
|||
|
||||
BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LOGFONT lf;
|
||||
RECT wrect;
|
||||
|
||||
// char str[256] = { 0 }, str2[256] = { 0 };
|
||||
|
||||
// char *name = "";
|
||||
// uint32 a;
|
||||
// uint8 v;
|
||||
// int c;
|
||||
// int s;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -247,6 +300,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
|
||||
//setup font
|
||||
hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0);
|
||||
LOGFONT lf;
|
||||
GetObject(hFont, sizeof(LOGFONT), &lf);
|
||||
strcpy(lf.lfFaceName, "Courier New");
|
||||
hNewFont = CreateFontIndirect(&lf);
|
||||
|
@ -272,18 +326,16 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
|
||||
//disable or enable buttons
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), FALSE);
|
||||
if (scrollnum)
|
||||
{
|
||||
char str[256] = { 0 };
|
||||
EnableCheatButtons(hwndDlg, TRUE);
|
||||
ShowResults(hwndDlg);
|
||||
sprintf(str, "%d Possibilities", (int)FCEUI_CheatSearchGetCount());
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_BOX_POSSIBILITIES, str);
|
||||
}
|
||||
else EnableCheatButtons(hwndDlg, FALSE);
|
||||
|
||||
//add header for cheat list
|
||||
possiTotalCount = 0;
|
||||
possiItemCount = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETCOUNTPERPAGE, 0, 0);
|
||||
|
||||
EnableCheatButtons(hwndDlg, possiTotalCount != 0);
|
||||
ShowResults(hwndDlg);
|
||||
|
||||
//add header for cheat list and possibilities
|
||||
InitializeCheatList(hwndDlg);
|
||||
InitializeResultsList(hwndDlg);
|
||||
|
||||
//misc setup
|
||||
searchdone = 0;
|
||||
|
@ -307,9 +359,9 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
}
|
||||
|
||||
}
|
||||
if ((CheatStyle) && (scrollnum)) {
|
||||
if ((!wParam) && (searchdone)) {
|
||||
searchdone=0;
|
||||
if (CheatStyle && possiTotalCount) {
|
||||
if ((!wParam) && searchdone) {
|
||||
searchdone = 0;
|
||||
FCEUI_CheatSearchSetCurrentAsOriginal();
|
||||
}
|
||||
ShowResults(hwndDlg);
|
||||
|
@ -328,139 +380,68 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
DeleteObject(hNewFont);
|
||||
if (searchdone)
|
||||
FCEUI_CheatSearchSetCurrentAsOriginal();
|
||||
possiList.clear();
|
||||
break;
|
||||
case WM_MOVE:
|
||||
if (!IsIconic(hwndDlg)) {
|
||||
GetWindowRect(hwndDlg,&wrect);
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndDlg, &wrect);
|
||||
ChtPosX = wrect.left;
|
||||
ChtPosY = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
WindowBoundsCheckNoResize(ChtPosX,ChtPosY,wrect.right);
|
||||
WindowBoundsCheckNoResize(ChtPosX, ChtPosY, wrect.right);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_VSCROLL:
|
||||
if (scrollnum > 16) {
|
||||
switch (LOWORD(wParam)) {
|
||||
case SB_TOP:
|
||||
scrollindex=-32768;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,16,0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex+32768,scrollindex+32768+16,ShowResultsCallB);
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
scrollindex=scrollmax;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,16,0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex+32768,scrollindex+32768+16,ShowResultsCallB);
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
if (scrollindex > -32768) {
|
||||
scrollindex--;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,16,0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex+32768,scrollindex+32768+16,ShowResultsCallB);
|
||||
}
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
scrollindex-=17;
|
||||
if(scrollindex<-32768) scrollindex=-32768;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,16,0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex+32768,scrollindex+32768+16,ShowResultsCallB);
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
if (scrollindex<scrollmax) {
|
||||
scrollindex++;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,0,0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex+32768,scrollindex+32768+16,ShowResultsCallB);
|
||||
}
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
scrollindex+=17;
|
||||
if (scrollindex>scrollmax) scrollindex=scrollmax;
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,0,0);
|
||||
FCEUI_CheatSearchGetRange(scrollindex+32768,scrollindex+32768+16,ShowResultsCallB);
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
scrollindex=(short int)HIWORD(wParam);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_SCRL_POSSIBILITIES,SBM_SETPOS,scrollindex,1);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,0,0);
|
||||
FCEUI_CheatSearchGetRange(32768+scrollindex,32768+scrollindex+16,ShowResultsCallB);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_VKEYTOITEM:
|
||||
if (lbfocus) {
|
||||
int real;
|
||||
|
||||
real=SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_GETCURSEL,0,0);
|
||||
switch (LOWORD(wParam)) {
|
||||
case VK_UP:
|
||||
// mmmm....recursive goodness
|
||||
if (real == 0) SendMessage(hwndDlg,WM_VSCROLL,SB_LINEUP,0);
|
||||
return -1;
|
||||
break;
|
||||
case VK_DOWN:
|
||||
if (real == 16) {
|
||||
SendMessage(hwndDlg,WM_VSCROLL,SB_LINEDOWN,0);
|
||||
SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_SETCURSEL,real,0);
|
||||
}
|
||||
return -1;
|
||||
break;
|
||||
case VK_PRIOR:
|
||||
SendMessage(hwndDlg,WM_VSCROLL,SB_PAGEUP,0);
|
||||
break;
|
||||
case VK_NEXT:
|
||||
SendMessage(hwndDlg,WM_VSCROLL,SB_PAGEDOWN,0);
|
||||
break;
|
||||
case VK_HOME:
|
||||
SendMessage(hwndDlg,WM_VSCROLL,SB_TOP,0);
|
||||
break;
|
||||
case VK_END:
|
||||
SendMessage(hwndDlg,WM_VSCROLL,SB_BOTTOM,0);
|
||||
break;
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
// Handle certain subborn context menus for nearly incapable controls.
|
||||
if (GetDlgCtrlID((HWND)wParam) == IDC_LIST_CHEATS) {
|
||||
// Only open the menu if a cheat is selected
|
||||
if (selcheat >= 0) {
|
||||
// Open IDC_LIST_CHEATS Context Menu
|
||||
hCheatcontextsub = GetSubMenu(hCheatcontext, 0);
|
||||
// SetMenuDefaultItem(hCheatcontextsub, CHEAT_CONTEXT_TOGGLECHEAT, false);
|
||||
if (lParam != -1)
|
||||
TrackPopupMenu(hCheatcontextsub, TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, 0); //Create menu
|
||||
else { // Handle the context menu keyboard key
|
||||
GetWindowRect(GetDlgItem(hwndDlg, IDC_LIST_CHEATS), &wrect);
|
||||
TrackPopupMenu(hCheatcontextsub, TPM_RIGHTBUTTON, wrect.left + int((wrect.right - wrect.left) / 3), wrect.top + int((wrect.bottom - wrect.top) / 3), 0, hwndDlg, 0); //Create menu
|
||||
HWND itemHwnd = (HWND)wParam;
|
||||
int dlgId = GetDlgCtrlID(itemHwnd);
|
||||
int sel = SendMessage(itemHwnd, LVM_GETSELECTIONMARK, 0, 0);
|
||||
HMENU hCheatcontextsub = NULL;
|
||||
switch (dlgId) {
|
||||
case IDC_LIST_CHEATS:
|
||||
// Only open the menu if a cheat is selected
|
||||
if (selcheat >= 0)
|
||||
// Open IDC_LIST_CHEATS Context Menu
|
||||
hCheatcontextsub = GetSubMenu(hCheatcontext, 0);
|
||||
break;
|
||||
case IDC_CHEAT_LIST_POSSIBILITIES:
|
||||
if (sel != -1) {
|
||||
hCheatcontextsub = GetSubMenu(hCheatcontext, 1);
|
||||
SetMenuDefaultItem(hCheatcontextsub, CHEAT_CONTEXT_POSSI_ADDTOMEMORYWATCH, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hCheatcontextsub)
|
||||
{
|
||||
POINT point;
|
||||
if (lParam != -1)
|
||||
{
|
||||
point.x = LOWORD(lParam);
|
||||
point.y = HIWORD(lParam);
|
||||
} else {
|
||||
// Handle the context menu keyboard key
|
||||
RECT wrect;
|
||||
wrect.left = LVIR_BOUNDS;
|
||||
SendMessage(itemHwnd, LVM_GETITEMRECT, sel, (LPARAM)&wrect);
|
||||
POINT point;
|
||||
point.x = wrect.left + (wrect.right - wrect.left) / 2;
|
||||
point.y = wrect.top + (wrect.bottom - wrect.top) / 2;
|
||||
ClientToScreen(itemHwnd, &point);
|
||||
}
|
||||
TrackPopupMenu(hCheatcontextsub, TPM_RIGHTBUTTON, point.x, point.y, 0, hwndDlg, 0); //Create menu
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (HIWORD(wParam)) {
|
||||
case BN_CLICKED:
|
||||
switch (LOWORD(wParam)) {
|
||||
case CHEAT_CONTEXT_TOGGLECHEAT:
|
||||
case CHEAT_CONTEXT_LIST_TOGGLECHEAT:
|
||||
{
|
||||
LVITEM lvi;
|
||||
lvi.mask = LVIF_STATE;
|
||||
|
@ -482,14 +463,14 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
UpdateCheatListGroupBoxUI();
|
||||
}
|
||||
break;
|
||||
case CHEAT_CONTEXT_POKECHEATVALUE:
|
||||
case CHEAT_CONTEXT_LIST_POKECHEATVALUE:
|
||||
{
|
||||
char* name = ""; uint32 a; uint8 v; int s;
|
||||
FCEUI_GetCheat(selcheat, &name, &a, &v, NULL, &s, NULL);
|
||||
BWrite[a](a, v);
|
||||
}
|
||||
break;
|
||||
case CHEAT_CONTEXT_GOTOINHEXEDITOR:
|
||||
case CHEAT_CONTEXT_LIST_GOTOINHEXEDITOR:
|
||||
{
|
||||
DoMemView();
|
||||
char* name = ""; uint32 a; uint8 v; int s;
|
||||
|
@ -497,6 +478,63 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
SetHexEditorAddress(a);
|
||||
}
|
||||
break;
|
||||
case CHEAT_CONTEXT_POSSI_ADDCHEAT:
|
||||
{
|
||||
char str[256] = { 0 };
|
||||
int sel = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETSELECTIONMARK, 0, 0);
|
||||
if (sel != -1)
|
||||
{
|
||||
char str[256] = { 0 };
|
||||
GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, str, 256);
|
||||
SEARCHPOSSIBLE& possible = possiList[sel];
|
||||
if (FCEUI_AddCheat(str, possible.addr, possible.current, -1, 1))
|
||||
{
|
||||
RedoCheatsCallB(str, possible.addr, possible.current, -1, 1, 1, NULL);
|
||||
|
||||
int newselcheat = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETITEMCOUNT, 0, 0) - 1;
|
||||
ListView_MoveSelectionMark(GetDlgItem(hwndDlg, IDC_LIST_CHEATS), selcheat, newselcheat);
|
||||
selcheat = newselcheat;
|
||||
}
|
||||
|
||||
UpdateCheatWindowRelatedWindow();
|
||||
UpdateCheatListGroupBoxUI();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHEAT_CONTEXT_POSSI_ADDTOMEMORYWATCH:
|
||||
{
|
||||
char addr[16] = { 0 };
|
||||
int sel = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETSELECTIONMARK, 0, 0);
|
||||
if (sel != -1)
|
||||
{
|
||||
sprintf(addr, "%04X", possiList[sel].addr);
|
||||
AddMemWatch(addr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHEAT_CONTEXT_POSSI_ADDTORAMWATCH:
|
||||
{
|
||||
int sel = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETSELECTIONMARK, 0, 0);
|
||||
if (sel != -1)
|
||||
{
|
||||
AddressWatcher tempWatch;
|
||||
tempWatch.Size = 'b';
|
||||
tempWatch.Type = 'h';
|
||||
tempWatch.Address = possiList[sel].addr;
|
||||
tempWatch.WrongEndian = false;
|
||||
if(InsertWatch(tempWatch, hwndDlg) && !RamWatchHWnd)
|
||||
SendMessage(hAppWnd, WM_COMMAND, ID_RAM_WATCH, 0);
|
||||
SetForegroundWindow(RamWatchHWnd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHEAT_CONTEXT_POSSI_GOTOINHEXEDITOR:
|
||||
{
|
||||
int sel = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETSELECTIONMARK, 0, 0);
|
||||
if (sel != -1)
|
||||
SetHexEditorAddress(possiList[sel].addr);
|
||||
}
|
||||
break;
|
||||
case IDC_CHEAT_PAUSEWHENACTIVE:
|
||||
pauseWhileActive ^= 1;
|
||||
if ((EmulationPaused == 1 ? true : false) != pauseWhileActive)
|
||||
|
@ -547,7 +585,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
UpdateCheatListGroupBoxUI();
|
||||
break;
|
||||
}
|
||||
case ID_CHEATLISTPOPUP_DELETESELECTEDCHEATS:
|
||||
case CHEAT_CONTEXT_LIST_DELETESELECTEDCHEATS:
|
||||
case IDC_BTN_CHEAT_DEL:
|
||||
if (selcheatcount > 1)
|
||||
{
|
||||
|
@ -717,49 +755,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
}
|
||||
}
|
||||
break;
|
||||
case LBN_DBLCLK:
|
||||
switch (LOWORD(wParam)) { //disable/enable cheat
|
||||
case IDC_CHEAT_LIST_POSSIBILITIES:
|
||||
if (EmulationPaused == 1) //We only want to send info to memwatch if paused
|
||||
{ //otherwise we will be sending info while it is updating causing unpredictable behavior
|
||||
lbfocus = 1;
|
||||
char str[256] = { 0 }, str2[256] = { 0 };
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LB_GETTEXT,
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LB_GETCURSEL, 0, 0), (LPARAM)(LPCTSTR)str);
|
||||
strcpy(str2, str+1);
|
||||
str2[4] = 0;
|
||||
AddMemWatch(str2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LBN_SELCHANGE:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_CHEAT_LIST_POSSIBILITIES:
|
||||
{
|
||||
char str[256] = { 0 }, str2[256] = { 0 };
|
||||
lbfocus = 1;
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LB_GETTEXT,
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LB_GETCURSEL, 0, 0),
|
||||
(LPARAM)(LPCTSTR)str);
|
||||
strcpy(str2, str + 1);
|
||||
str2[4] = 0;
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)str2);
|
||||
strcpy(str2, str + 13);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)str2);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LBN_SELCANCEL:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDC_CHEAT_LIST_POSSIBILITIES:
|
||||
lbfocus=0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
|
@ -825,12 +820,65 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
UpdateCheatListGroupBoxUI();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDC_CHEAT_LIST_POSSIBILITIES:
|
||||
{
|
||||
LPNMHDR lP = (LPNMHDR)lParam;
|
||||
switch (lP->code)
|
||||
{
|
||||
case LVN_ITEMCHANGED:
|
||||
{
|
||||
NMLISTVIEW* pNMListView = (NMLISTVIEW*)lP;
|
||||
if (pNMListView->uNewState & LVIS_FOCUSED ||
|
||||
!(pNMListView->uOldState & LVIS_SELECTED) && pNMListView->uNewState & LVIS_SELECTED)
|
||||
{
|
||||
|
||||
SEARCHPOSSIBLE& possible = possiList[pNMListView->iItem];
|
||||
char str[16];
|
||||
sprintf(str, "%04X", possible.addr);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCTSTR)str);
|
||||
sprintf(str, "%02X", possible.current);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCTSTR)str);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LVN_GETDISPINFO:
|
||||
{
|
||||
NMLVDISPINFO* info = (NMLVDISPINFO*)lParam;
|
||||
|
||||
if (!possiList.count(info->item.iItem))
|
||||
ShowResults(hwndDlg, true);
|
||||
|
||||
static char num[32];
|
||||
switch (info->item.iSubItem)
|
||||
{
|
||||
case 0:
|
||||
sprintf(num, "$%04X", possiList[info->item.iItem].addr);
|
||||
break;
|
||||
case 1:
|
||||
sprintf(num, "%02X", possiList[info->item.iItem].previous);
|
||||
break;
|
||||
case 2:
|
||||
sprintf(num, "%02X", possiList[info->item.iItem].current);
|
||||
break;
|
||||
}
|
||||
info->item.pszText = num;
|
||||
}
|
||||
break;
|
||||
case NM_DBLCLK:
|
||||
{
|
||||
char addr[16];
|
||||
sprintf(addr, "%04X", possiList[((NMITEMACTIVATE*)lParam)->iItem].addr);
|
||||
AddMemWatch(addr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -868,7 +916,7 @@ void ConfigCheats(HWND hParent)
|
|||
|
||||
void UpdateCheatList()
|
||||
{
|
||||
if(!pwindow)
|
||||
if (!pwindow)
|
||||
return;
|
||||
else
|
||||
ShowResults(pwindow);
|
||||
|
@ -1014,7 +1062,9 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_DEL), TRUE);
|
||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), TRUE);
|
||||
UpdateCheatsAdded();
|
||||
|
||||
UpdateCheatWindowRelatedWindow();
|
||||
UpdateCheatListGroupBoxUI();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -6,6 +6,9 @@ extern HWND hCheat;
|
|||
HWND InitializeCheatList(HWND hwndDlg);
|
||||
void RedoCheatsLB(HWND hwndDlg);
|
||||
|
||||
typedef unsigned int HWAddressType;
|
||||
|
||||
|
||||
void ConfigCheats(HWND hParent);
|
||||
void DoGGConv();
|
||||
void SetGGConvFocus(int address,int compare);
|
||||
|
@ -20,3 +23,17 @@ extern std::vector<uint16> FrozenAddresses;
|
|||
void DisableAllCheats();
|
||||
|
||||
void UpdateCheatWindowRelatedWindow();
|
||||
|
||||
// deselect the old one and select the new one
|
||||
#define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \
|
||||
LVITEM lvi; \
|
||||
SendMessage(hwnd, LVM_SETITEMSTATE, prevIndex, (LPARAM)&(lvi.mask = LVIF_STATE, lvi.stateMask = LVIS_SELECTED, lvi.state = 0, lvi)), \
|
||||
SendMessage(hwnd, LVM_SETITEMSTATE, newIndex, (LPARAM)&(lvi.state = LVIS_SELECTED, lvi)), \
|
||||
SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, newIndex)
|
||||
|
||||
#define ClearCheatListText(hwnd) \
|
||||
(SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)""))
|
||||
|
||||
|
|
|
@ -602,23 +602,18 @@ HWND InitializeListView(HWND hwndDlg)
|
|||
|
||||
// Init ListView columns.
|
||||
memset(&lv, 0, sizeof(lv));
|
||||
lv.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
||||
lv.fmt = LVCFMT_LEFT;
|
||||
lv.mask = LVCF_TEXT | LVCF_WIDTH;
|
||||
lv.pszText = "Type";
|
||||
lv.cx = 80;
|
||||
|
||||
SendMessage(hwndListView, LVM_INSERTCOLUMN, (WPARAM)0, (LPARAM)&lv);
|
||||
|
||||
memset(&lv, 0, sizeof(lv));
|
||||
lv.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
||||
lv.fmt = LVCFMT_LEFT;
|
||||
lv.pszText = "Command";
|
||||
lv.cx = 240;
|
||||
|
||||
SendMessage(hwndListView, LVM_INSERTCOLUMN, (WPARAM)1, (LPARAM)&lv);
|
||||
|
||||
memset(&lv, 0, sizeof(lv));
|
||||
lv.mask = LVCF_FMT | LVCF_TEXT;
|
||||
lv.mask ^= LVCF_WIDTH;
|
||||
lv.fmt = LVCFMT_LEFT;
|
||||
lv.pszText = "Input";
|
||||
|
||||
|
|
|
@ -933,14 +933,15 @@ void FreezeRam(int address, int mode, int final){
|
|||
if (mode == 0 || mode == -1)
|
||||
{
|
||||
//mbg merge 6/29/06 - added argument
|
||||
FCEUI_ListCheats(DeleteCheatCallB,0);
|
||||
if(mode == 0 && cheatwasdeleted != -1)FCEUI_AddCheat("",address,GetMem(address),-1,1);
|
||||
FCEUI_ListCheats(DeleteCheatCallB, 0);
|
||||
if(mode == 0 && cheatwasdeleted != -1)
|
||||
FCEUI_AddCheat("", address, GetMem(address), -1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//mbg merge 6/29/06 - added argument
|
||||
FCEUI_ListCheats(DeleteCheatCallB,0);
|
||||
FCEUI_AddCheat("",address,GetMem(address),-1,1);
|
||||
FCEUI_ListCheats(DeleteCheatCallB, 0);
|
||||
FCEUI_AddCheat("", address, GetMem(address), -1, 1);
|
||||
}
|
||||
|
||||
//if (final)
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
#include "../../cheat.h"
|
||||
|
||||
#include "resource.h"
|
||||
#include "cheat.h"
|
||||
#include "ram_search.h"
|
||||
#include "ramwatch.h"
|
||||
#include "cheat.h"
|
||||
#include <assert.h>
|
||||
#include <commctrl.h>
|
||||
#include <list>
|
||||
|
@ -1943,30 +1943,36 @@ invalid_field:
|
|||
case IDC_C_WATCH:
|
||||
{
|
||||
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
|
||||
int selCount = ListView_GetSelectedCount(ramListControl);
|
||||
|
||||
bool inserted = false;
|
||||
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
|
||||
while (watchItemIndex >= 0)
|
||||
int selCount = SendMessage(ramListControl, LVM_GETSELECTEDCOUNT, 0, 0);
|
||||
if (selCount > 0)
|
||||
{
|
||||
AddressWatcher tempWatch;
|
||||
tempWatch.Address = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size,rs_t=='s',noMisalign, watchItemIndex);
|
||||
tempWatch.Size = rs_type_size;
|
||||
tempWatch.Type = rs_t;
|
||||
tempWatch.WrongEndian = 0; //Replace when I get little endian working
|
||||
tempWatch.comment = NULL;
|
||||
|
||||
if (selCount == 1)
|
||||
inserted |= InsertWatch(tempWatch, hDlg);
|
||||
else
|
||||
inserted |= InsertWatch(tempWatch);
|
||||
bool inserted = false;
|
||||
|
||||
watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED);
|
||||
AddressWatcher* watches = (AddressWatcher*)malloc(selCount * sizeof(AddressWatcher));
|
||||
int i = 0;
|
||||
int watchItemIndex = -1;
|
||||
while ((watchItemIndex = SendMessage(ramListControl, LVM_GETNEXTITEM, watchItemIndex, LVNI_SELECTED)) >= 0)
|
||||
{
|
||||
tempWatch.Address = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
|
||||
watches[i] = tempWatch;
|
||||
++i;
|
||||
}
|
||||
|
||||
// bring up the ram watch window if it's not already showing so the user knows where the watch went
|
||||
if ((selCount == 1 ?
|
||||
InsertWatch(watches[0], hDlg) : InsertWatches(watches, hDlg, selCount))
|
||||
&& !RamWatchHWnd)
|
||||
SendMessage(hWnd, WM_COMMAND, ID_RAM_WATCH, 0);
|
||||
SetForegroundWindow(RamSearchHWnd);
|
||||
|
||||
free(watches);
|
||||
}
|
||||
// bring up the ram watch window if it's not already showing so the user knows where the watch went
|
||||
if(inserted && !RamWatchHWnd)
|
||||
SendMessage(hWnd, WM_COMMAND, ID_RAM_WATCH, 0);
|
||||
SetForegroundWindow(RamSearchHWnd);
|
||||
{rv = true; break;}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
extern char rs_type_size;
|
||||
extern int ResultCount;
|
||||
typedef unsigned int HWAddressType;
|
||||
|
||||
unsigned int sizeConv(unsigned int index,char size, char *prevSize = &rs_type_size, bool usePrev = false);
|
||||
unsigned int GetRamValue(unsigned int Addr,char Size);
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
using namespace std;
|
||||
|
||||
#include "resource.h"
|
||||
#include "ram_search.h"
|
||||
#include "ramwatch.h"
|
||||
#include "cheat.h"
|
||||
#include "ramwatch.h"
|
||||
#include "ram_search.h"
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
@ -119,72 +119,19 @@ bool InsertWatch(const AddressWatcher& Watch)
|
|||
NewWatch.Cheats = FCEU_CalcCheatAffectedBytes(NewWatch.Address, WatchSizeConv(NewWatch));
|
||||
NewWatch.comment = strcpy((char*)malloc(strlen(Watch.comment) + 2), Watch.comment);
|
||||
|
||||
// currently it's impossible to add a separator from outside RAM Watch, so no need to check the handle
|
||||
if (NewWatch.Type == 'S')
|
||||
separatorCache[i] = SeparatorCache(RamWatchHWnd, NewWatch.comment);
|
||||
|
||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
|
||||
// In case the window is not open and somebody call this method outside.
|
||||
if (RamWatchHWnd)
|
||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd, IDC_WATCHLIST), WatchCount);
|
||||
RWfileChanged = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
LRESULT CALLBACK PromptWatchNameProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) //Gets the description of a watched address
|
||||
{
|
||||
RECT r;
|
||||
RECT r2;
|
||||
int dx1, dy1, dx2, dy2;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
//Clear_Sound_Buffer();
|
||||
|
||||
GetWindowRect(hWnd, &r);
|
||||
dx1 = (r.right - r.left) / 2;
|
||||
dy1 = (r.bottom - r.top) / 2;
|
||||
|
||||
GetWindowRect(hDlg, &r2);
|
||||
dx2 = (r2.right - r2.left) / 2;
|
||||
dy2 = (r2.bottom - r2.top) / 2;
|
||||
|
||||
//SetWindowPos(hDlg, NULL, max(0, r.left + (dx1 - dx2)), max(0, r.top + (dy1 - dy2)), NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||
strcpy(Str_Tmp,"Enter a name for this RAM address.");
|
||||
SendDlgItemMessage(hDlg,IDC_PROMPT_TEXT,WM_SETTEXT,0,(LPARAM)Str_Tmp);
|
||||
strcpy(Str_Tmp,"");
|
||||
SendDlgItemMessage(hDlg,IDC_PROMPT_TEXT2,WM_SETTEXT,0,(LPARAM)Str_Tmp);
|
||||
return true;
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
{
|
||||
GetDlgItemText(hDlg,IDC_PROMPT_EDIT,Str_Tmp,80);
|
||||
InsertWatch(rswatches[WatchCount],Str_Tmp);
|
||||
EndDialog(hDlg, true);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, false);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
EndDialog(hDlg, false);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
bool InsertWatch(const AddressWatcher& Watch, HWND parent)
|
||||
{
|
||||
if(!VerifyWatchNotAlreadyAdded(Watch))
|
||||
|
@ -204,6 +151,28 @@ bool InsertWatch(const AddressWatcher& Watch, HWND parent)
|
|||
return WatchCount > prevWatchCount;
|
||||
}
|
||||
|
||||
bool InsertWatches(const AddressWatcher* watches, HWND parent, const int count)
|
||||
{
|
||||
if (count == 1)
|
||||
return InsertWatch(watches[0], parent);
|
||||
else
|
||||
{
|
||||
bool success = false;
|
||||
rswatches[-1] = watches[0];
|
||||
if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, (DLGPROC)EditWatchProc, (LPARAM)-1))
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
AddressWatcher watcher = watches[i];
|
||||
watcher.comment = rswatches[-1].comment;
|
||||
success |= InsertWatch(watcher);
|
||||
}
|
||||
free(rswatches[-1].comment);
|
||||
rswatches.erase(-1);
|
||||
return success;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Update_RAM_Watch()
|
||||
{
|
||||
BOOL watchChanged[MAX_WATCH_COUNT] = {0};
|
||||
|
@ -813,8 +782,14 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
AddressWatcher& watcher = rswatches[index];
|
||||
if (watcher.Type != 'S') {
|
||||
char Str_Tmp[1024];
|
||||
sprintf(Str_Tmp, "%04X", watcher.Address);
|
||||
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp);
|
||||
if (index != -1)
|
||||
{
|
||||
sprintf(Str_Tmp, "%04X", watcher.Address);
|
||||
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp);
|
||||
} else
|
||||
// Add multiple watches
|
||||
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, "(multiple)");
|
||||
|
||||
switch (watcher.Size)
|
||||
{
|
||||
case 'b':
|
||||
|
@ -846,7 +821,7 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
SetDlgItemText(hDlg, IDC_PROMPT_EDIT, watcher.comment);
|
||||
|
||||
HWND parent = GetParent(hDlg);
|
||||
if (watcher.Type == 'S' || parent == RamSearchHWnd)
|
||||
if (watcher.Type == 'S' || parent == RamSearchHWnd || parent == hCheat)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_DATATYPE_GROUPBOX), FALSE);
|
||||
|
@ -871,75 +846,86 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
case IDOK:
|
||||
{
|
||||
char Str_Tmp[1024];
|
||||
// a normal watch, copy it to a temporary one
|
||||
AddressWatcher watcher = rswatches[index];
|
||||
if (watcher.comment != NULL)
|
||||
watcher.comment = strcpy((char*)malloc(strlen(watcher.comment) + 2), watcher.comment);
|
||||
|
||||
// It's from ram watch window, not a separator
|
||||
// When it's from ram search window, all the information required is already set,
|
||||
// so this is also unecessary
|
||||
if (RamWatchHWnd && RamWatchHWnd == GetParent(hDlg) && watcher.Type != 'S')
|
||||
// not a single watch editing operation
|
||||
if (index != -1)
|
||||
{
|
||||
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 1024);
|
||||
// a normal watch, copy it to a temporary one
|
||||
AddressWatcher watcher = rswatches[index];
|
||||
if (watcher.comment != NULL)
|
||||
watcher.comment = strcpy((char*)malloc(strlen(watcher.comment) + 2), watcher.comment);
|
||||
|
||||
// type
|
||||
if (SendDlgItemMessage(hDlg, IDC_SIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 's';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_UNSIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 'u';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 'h';
|
||||
else {
|
||||
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
// size
|
||||
if (SendDlgItemMessage(hDlg, IDC_1_BYTE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Size = 'b';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_2_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Size = 'w';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_4_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Size = 'd';
|
||||
else {
|
||||
MessageBox(hDlg, "Size must be specified.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
// address
|
||||
GetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp, 1024);
|
||||
char *addrstr = Str_Tmp;
|
||||
if (strlen(Str_Tmp) > 8)
|
||||
addrstr = &Str_Tmp[strlen(Str_Tmp) - 9];
|
||||
for (int i = 0; addrstr[i]; ++i)
|
||||
if (toupper(addrstr[i]) == 'O')
|
||||
addrstr[i] = '0';
|
||||
sscanf(addrstr, "%04X", &watcher.Address);
|
||||
|
||||
if ((watcher.Address & ~0xFFFFFF) == ~0xFFFFFF)
|
||||
watcher.Address &= 0xFFFFFF;
|
||||
|
||||
if (!IsHardwareAddressValid(watcher.Address))
|
||||
// It's from ram watch window, not a separator
|
||||
// When it's from ram search window, all the information required is already set,
|
||||
// so this is also unecessary
|
||||
if (RamWatchHWnd && RamWatchHWnd == GetParent(hDlg) && watcher.Type != 'S')
|
||||
{
|
||||
MessageBox(hDlg, "Invalid Address.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 1024);
|
||||
|
||||
// type
|
||||
if (SendDlgItemMessage(hDlg, IDC_SIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 's';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_UNSIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 'u';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 'h';
|
||||
else {
|
||||
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
// size
|
||||
if (SendDlgItemMessage(hDlg, IDC_1_BYTE, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Size = 'b';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_2_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Size = 'w';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_4_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Size = 'd';
|
||||
else {
|
||||
MessageBox(hDlg, "Size must be specified.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
// address
|
||||
GetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp, 1024);
|
||||
char *addrstr = Str_Tmp;
|
||||
if (strlen(Str_Tmp) > 8)
|
||||
addrstr = &Str_Tmp[strlen(Str_Tmp) - 9];
|
||||
for (int i = 0; addrstr[i]; ++i)
|
||||
if (toupper(addrstr[i]) == 'O')
|
||||
addrstr[i] = '0';
|
||||
sscanf(addrstr, "%04X", &watcher.Address);
|
||||
|
||||
if ((watcher.Address & ~0xFFFFFF) == ~0xFFFFFF)
|
||||
watcher.Address &= 0xFFFFFF;
|
||||
|
||||
if (!IsHardwareAddressValid(watcher.Address))
|
||||
{
|
||||
MessageBox(hDlg, "Invalid Address.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// comment
|
||||
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 80);
|
||||
watcher.comment = Str_Tmp;
|
||||
|
||||
// finallly update the watch list
|
||||
if (index < WatchCount)
|
||||
// it's a watch editing operation.
|
||||
// Only ram watch window can edit a watch, the ram search window only add watch.
|
||||
EditWatch(index, watcher);
|
||||
else
|
||||
InsertWatch(watcher);
|
||||
if (RamWatchHWnd)
|
||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd, IDC_WATCHLIST), WatchCount);
|
||||
}
|
||||
else {
|
||||
// a multiple watches insert operation, just asking for a comment
|
||||
AddressWatcher& watcher = rswatches[index];
|
||||
// comment
|
||||
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 80);
|
||||
watcher.comment = strcpy((char*) malloc(strlen(Str_Tmp) + 2), Str_Tmp);
|
||||
}
|
||||
|
||||
// comment
|
||||
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 80);
|
||||
watcher.comment = Str_Tmp;
|
||||
|
||||
// finallly update the watch list
|
||||
if (index < WatchCount)
|
||||
// it's a watch editing operation.
|
||||
// Only ram watch window can edit a watch, the ram search window only add watch.
|
||||
EditWatch(index, watcher);
|
||||
else
|
||||
InsertWatch(watcher);
|
||||
if (RamWatchHWnd)
|
||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd, IDC_WATCHLIST), WatchCount);
|
||||
EndDialog(hDlg, true);
|
||||
|
||||
RWfileChanged = true;
|
||||
|
@ -1130,16 +1116,14 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
|
||||
if(pNMListView->uNewState & LVIS_FOCUSED ||
|
||||
(pNMListView->uNewState ^ pNMListView->uOldState) & LVIS_SELECTED)
|
||||
{
|
||||
// disable buttons that we don't have the right number of selected items for
|
||||
RefreshWatchListSelectedCountControlStatus(hDlg, pNMListView->iItem);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case LVN_GETDISPINFO:
|
||||
{
|
||||
LV_DISPINFO *Item = (LV_DISPINFO *)lParam;
|
||||
NMLVDISPINFO *Item = (NMLVDISPINFO*)lParam;
|
||||
const unsigned int iNum = Item->item.iItem;
|
||||
if (rswatches[iNum].Type != 'S')
|
||||
{
|
||||
|
@ -1278,17 +1262,13 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case RAMMENU_FILE_SAVE:
|
||||
QuickSaveWatches();
|
||||
break;
|
||||
|
||||
case RAMMENU_FILE_SAVEAS:
|
||||
//case IDC_C_SAVE:
|
||||
return Save_Watches();
|
||||
case RAMMENU_FILE_OPEN:
|
||||
return Load_Watches(true);
|
||||
case RAMMENU_FILE_APPEND:
|
||||
//case IDC_C_LOAD:
|
||||
return Load_Watches(false);
|
||||
case RAMMENU_FILE_NEW:
|
||||
//case IDC_C_RESET:
|
||||
ResetWatches();
|
||||
return true;
|
||||
case IDC_C_WATCH_REMOVE:
|
||||
|
@ -1301,7 +1281,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
ListView_DeleteItem(watchListControl, watchIndex);
|
||||
watchIndex = ListView_GetNextItem(watchListControl, -1, LVNI_ALL | LVNI_SELECTED);
|
||||
}
|
||||
RWfileChanged=true;
|
||||
RWfileChanged = true;
|
||||
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -17,18 +17,6 @@ extern bool RWfileChanged;
|
|||
#define RAMWX "RamwX"
|
||||
#define RAMWY "RamwY"
|
||||
|
||||
// AddressWatcher is self-contained now
|
||||
struct AddressWatcher
|
||||
{
|
||||
unsigned int Address; // hardware address
|
||||
unsigned int CurValue;
|
||||
char* comment = NULL; // NULL means no comment, non-NULL means allocated comment
|
||||
bool WrongEndian;
|
||||
char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator.
|
||||
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'S' = separator
|
||||
short Cheats; // how many bytes are affected by cheat
|
||||
};
|
||||
|
||||
// Cache all the things required for drawing separator
|
||||
// to prevent creating and destroying them repeatedly when painting
|
||||
struct SeparatorCache
|
||||
|
@ -58,8 +46,21 @@ extern char Watch_Dir[1024];
|
|||
extern HWND RamWatchHWnd;
|
||||
extern HACCEL RamWatchAccels;
|
||||
|
||||
// AddressWatcher is self-contained now
|
||||
struct AddressWatcher
|
||||
{
|
||||
unsigned int Address; // hardware address
|
||||
unsigned int CurValue;
|
||||
char* comment = NULL; // NULL means no comment, non-NULL means allocated comment
|
||||
bool WrongEndian;
|
||||
char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator.
|
||||
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'S' = separator
|
||||
short Cheats; // how many bytes are affected by cheat
|
||||
};
|
||||
|
||||
bool InsertWatch(const AddressWatcher& Watch);
|
||||
bool InsertWatch(const AddressWatcher& Watch, HWND parent); // asks user for comment
|
||||
bool InsertWatches(const AddressWatcher* watches, HWND parent, const int count);
|
||||
bool InsertWatch(int watchIndex, const AddressWatcher& watcher);
|
||||
bool EditWatch(int watchIndex, const AddressWatcher& watcher);
|
||||
bool RemoveWatch(int watchIndex);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
@ -633,10 +633,17 @@ CHEATCONTEXTMENUS MENU
|
|||
BEGIN
|
||||
POPUP "CheatListPopup"
|
||||
BEGIN
|
||||
MENUITEM "Toggle selected Cheats", CHEAT_CONTEXT_TOGGLECHEAT
|
||||
MENUITEM "Poke Cheat Value", CHEAT_CONTEXT_POKECHEATVALUE
|
||||
MENUITEM "Goto in Hex Editor", CHEAT_CONTEXT_GOTOINHEXEDITOR
|
||||
MENUITEM "Delete selected Cheats", ID_CHEATLISTPOPUP_DELETESELECTEDCHEATS
|
||||
MENUITEM "Toggle selected Cheats", CHEAT_CONTEXT_LIST_TOGGLECHEAT
|
||||
MENUITEM "Poke Cheat Value", CHEAT_CONTEXT_LIST_POKECHEATVALUE
|
||||
MENUITEM "Goto in Hex Editor", CHEAT_CONTEXT_LIST_GOTOINHEXEDITOR
|
||||
MENUITEM "Delete selected Cheats", CHEAT_CONTEXT_LIST_DELETESELECTEDCHEATS
|
||||
END
|
||||
POPUP "CheatPossiPopup"
|
||||
BEGIN
|
||||
MENUITEM "Add to Memory Watch", CHEAT_CONTEXT_POSSI_ADDTOMEMORYWATCH
|
||||
MENUITEM "Add cheat", CHEAT_CONTEXT_POSSI_ADDCHEAT
|
||||
MENUITEM "Add to RAM Watch", CHEAT_CONTEXT_POSSI_ADDTORAMWATCH
|
||||
MENUITEM "Go to in Hex Editor", CHEAT_CONTEXT_POSSI_GOTOINHEXEDITOR
|
||||
END
|
||||
END
|
||||
|
||||
|
@ -1966,46 +1973,45 @@ BEGIN
|
|||
LTEXT "New Selection Name:",-1,5,240,68,8
|
||||
END
|
||||
|
||||
CHEATCONSOLE DIALOGEX 0, 0, 420, 190
|
||||
CHEATCONSOLE DIALOGEX 0, 0, 431, 198
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Cheat Search"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Active Cheats",IDC_GROUPBOX_CHEATLIST,5,2,171,182,WS_TABSTOP
|
||||
GROUPBOX "Cheat Search",IDC_GROUPBOX_CHEATSEARCH,181,2,233,182,WS_TABSTOP
|
||||
CONTROL "", IDC_LIST_CHEATS, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 11,11,159,118
|
||||
LTEXT "Name:",IDC_STATIC,12,135,22,10
|
||||
LTEXT "Address:",IDC_STATIC,12,150,30,8
|
||||
LTEXT "Value:",IDC_STATIC,73,150,22,8
|
||||
LTEXT "Compare:",IDC_STATIC,116,150,34,8
|
||||
EDITTEXT IDC_CHEAT_NAME,36,133,132,12,ES_AUTOHSCROLL | ES_WANTRETURN
|
||||
EDITTEXT IDC_CHEAT_ADDR,44,148,25,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
EDITTEXT IDC_CHEAT_VAL,97,148,16,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
EDITTEXT IDC_CHEAT_COM,152,148,16,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
DEFPUSHBUTTON "Add",IDC_BTN_CHEAT_ADD,11,163,36,16
|
||||
PUSHBUTTON "Delete",IDC_BTN_CHEAT_DEL,47,163,36,16
|
||||
PUSHBUTTON "Update",IDC_BTN_CHEAT_UPD,83,163,36,16
|
||||
GROUPBOX "Active Cheats",IDC_GROUPBOX_CHEATLIST,5,2,171,191,WS_TABSTOP
|
||||
GROUPBOX "Cheat Search",IDC_GROUPBOX_CHEATSEARCH,181,2,244,191,WS_TABSTOP
|
||||
CONTROL "",IDC_LIST_CHEATS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,11,11,159,131
|
||||
LTEXT "Name:",IDC_STATIC,13,147,22,10
|
||||
LTEXT "Address:",IDC_STATIC,13,162,30,8
|
||||
LTEXT "Value:",IDC_STATIC,74,162,22,8
|
||||
LTEXT "Compare:",IDC_STATIC,117,162,34,8
|
||||
EDITTEXT IDC_CHEAT_NAME,37,145,132,12,ES_AUTOHSCROLL | ES_WANTRETURN
|
||||
EDITTEXT IDC_CHEAT_ADDR,45,160,25,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
EDITTEXT IDC_CHEAT_VAL,98,160,16,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
EDITTEXT IDC_CHEAT_COM,153,160,16,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
DEFPUSHBUTTON "Add",IDC_BTN_CHEAT_ADD,12,174,36,16
|
||||
PUSHBUTTON "Delete",IDC_BTN_CHEAT_DEL,48,174,36,16
|
||||
PUSHBUTTON "Update",IDC_BTN_CHEAT_UPD,84,174,36,16
|
||||
PUSHBUTTON "Reset",IDC_BTN_CHEAT_RESET,187,12,55,15
|
||||
PUSHBUTTON "Known Value:",IDC_BTN_CHEAT_KNOWN,187,31,55,15
|
||||
LTEXT "0x",IDC_STATIC,246,34,9,8
|
||||
EDITTEXT IDC_CHEAT_VAL_KNOWN,256,32,18,12,ES_UPPERCASE
|
||||
GROUPBOX "Previous Compare",204,186,49,113,115
|
||||
PUSHBUTTON "Equal",IDC_BTN_CHEAT_EQ,192,62,55,15,WS_GROUP
|
||||
PUSHBUTTON "Not Equal",IDC_BTN_CHEAT_NE,192,87,55,15
|
||||
CONTROL "By:",IDC_CHEAT_CHECK_NE_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,90,22,10
|
||||
EDITTEXT IDC_CHEAT_VAL_NE_BY,275,89,18,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
PUSHBUTTON "Greater Than",IDC_BTN_CHEAT_GT,192,114,55,15
|
||||
CONTROL "By:",IDC_CHEAT_CHECK_GT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,117,22,10
|
||||
EDITTEXT IDC_CHEAT_VAL_GT_BY,275,116,18,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
PUSHBUTTON "Less Than",IDC_BTN_CHEAT_LT,192,141,55,15
|
||||
CONTROL "By:",IDC_CHEAT_CHECK_LT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,144,22,10
|
||||
EDITTEXT IDC_CHEAT_VAL_LT_BY,275,143,18,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
GROUPBOX "Possibilities",IDC_CHEAT_BOX_POSSIBILITIES,304,8,105,156,WS_TABSTOP
|
||||
LISTBOX IDC_CHEAT_LIST_POSSIBILITIES,309,18,85,142,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_TABSTOP
|
||||
SCROLLBAR IDC_CHEAT_SCRL_POSSIBILITIES,395,18,10,142,SBS_VERT
|
||||
PUSHBUTTON "Known Value:",IDC_BTN_CHEAT_KNOWN,187,35,55,15
|
||||
LTEXT "0x",IDC_STATIC,246,38,9,8
|
||||
EDITTEXT IDC_CHEAT_VAL_KNOWN,256,36,18,12,ES_UPPERCASE
|
||||
GROUPBOX "Previous Compare",204,186,57,113,119
|
||||
PUSHBUTTON "Equal",IDC_BTN_CHEAT_EQ,192,74,55,15,WS_GROUP
|
||||
PUSHBUTTON "Not Equal",IDC_BTN_CHEAT_NE,192,101,55,15
|
||||
CONTROL "By:",IDC_CHEAT_CHECK_NE_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,104,22,10
|
||||
EDITTEXT IDC_CHEAT_VAL_NE_BY,275,103,18,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
PUSHBUTTON "Greater Than",IDC_BTN_CHEAT_GT,192,128,55,15
|
||||
CONTROL "By:",IDC_CHEAT_CHECK_GT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,131,22,10
|
||||
EDITTEXT IDC_CHEAT_VAL_GT_BY,275,130,18,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
PUSHBUTTON "Less Than",IDC_BTN_CHEAT_LT,192,155,55,15
|
||||
CONTROL "By:",IDC_CHEAT_CHECK_LT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,158,22,10
|
||||
EDITTEXT IDC_CHEAT_VAL_LT_BY,275,157,18,12,ES_UPPERCASE | ES_WANTRETURN
|
||||
GROUPBOX "Possibilities",IDC_CHEAT_BOX_POSSIBILITIES,304,8,116,168,WS_TABSTOP
|
||||
CONTROL "",IDC_CHEAT_LIST_POSSIBILITIES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,309,18,106,153
|
||||
CONTROL " Pause emulation when this window is active",IDC_CHEAT_PAUSEWHENACTIVE,
|
||||
"Button",BS_AUTOCHECKBOX,188,169,157,10
|
||||
PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,127,163,43,16
|
||||
"Button",BS_AUTOCHECKBOX,188,179,157,10
|
||||
PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,128,174,43,16
|
||||
END
|
||||
|
||||
IDD_LUA DIALOGEX 0, 0, 270, 150
|
||||
|
@ -2425,8 +2431,8 @@ BEGIN
|
|||
|
||||
"CHEATCONSOLE", DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 419
|
||||
BOTTOMMARGIN, 189
|
||||
RIGHTMARGIN, 430
|
||||
BOTTOMMARGIN, 197
|
||||
END
|
||||
|
||||
"VIDEOCONFIG", DIALOG
|
||||
|
@ -2676,7 +2682,7 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp"
|
|||
IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp"
|
||||
IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp"
|
||||
IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
|
||||
#endif
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ 生成的包含文件。
|
||||
// 供 res.rc 使用
|
||||
//
|
||||
#define CLOSE_BUTTON 1
|
||||
#define BUTTON_CLOSE 1
|
||||
#define BTN_CLOSE 1
|
||||
|
@ -91,7 +95,6 @@
|
|||
#define IDC_TEXT_LINES_TO_THIS_WINDOW 106
|
||||
#define BTN_PORT2 107
|
||||
#define BTN_CDLOGGER_SAVE 107
|
||||
#define IDC_CHEAT_SCRL_POSSIBILITIES 107
|
||||
#define IDC_DEBUGGER_STEP_OVER 107
|
||||
#define IDC_ADDBP_MEM_SPR 107
|
||||
#define IDC_ROMPATCHER_DISASSEMBLY 107
|
||||
|
@ -151,21 +154,22 @@
|
|||
#define IDC_CHECK_LOG_UPDATE_WINDOW 116
|
||||
#define IDC_DEBUGGER_RESET_CYCLES_COUNTER 116
|
||||
#define IDC_DEBUGGER_RESET_COUNTERS 116
|
||||
#define CHEAT_CONTEXT_TOGGLECHEAT 117
|
||||
#define CHEAT_CONTEXT_LIST_TOGGLECHEAT 117
|
||||
#define IDC_DEBUGGER_RESET_ON_STEP 117
|
||||
#define IDC_DEBUGGER_BREAK_ON_CYCLES 117
|
||||
#define IDC_CHECK_LINES_TABBING 117
|
||||
#define IDC_CHECK_CODE_TABBING 117
|
||||
#define CHEAT_CONTEXT_POKECHEATVALUE 118
|
||||
#define CHEAT_CONTEXT_LIST_POKECHEATVALUE 118
|
||||
#define IDC_DEBUGGER_RESET_ON_BP0 118
|
||||
#define IDC_CHECK_LOG_STATUSES_TO_THE_LEFT 118
|
||||
#define IDC_DEBUGGER_BOOKMARK_DEL2 118
|
||||
#define IDC_DEBUGGER_BOOKMARK_NAME 118
|
||||
#define CHEAT_CONTEXT_GOTOINHEXEDITOR 119
|
||||
#define CHEAT_CONTEXT_LIST_GOTOINHEXEDITOR 119
|
||||
#define IDC_DEBUGGER_BREAK_ON_INSTRUCTIONS 119
|
||||
#define IDC_CHECK_LOG_FRAME_NUMBER 119
|
||||
#define IDC_CHECK_LOG_FRAMES_COUNT 119
|
||||
#define IDC_CHECK_LOG_CYCLES_COUNT 120
|
||||
#define CHEAT_CONTEXT_LIST_DELETESELECTEDCHEATS 120
|
||||
#define IDC_CHECK_LOG_FRAME_NUMBER3 121
|
||||
#define IDC_CHECK_LOG_INSTRUCTIONS_COUNT 121
|
||||
#define COMBO_SOUND_8BIT 122
|
||||
|
@ -1103,7 +1107,6 @@
|
|||
#define ID_GAME_RECOVERY 40407
|
||||
#define ID_SAVESTATE_RECOVERY 40408
|
||||
#define ID_CONTEXT_FULLSAVESTATES 40409
|
||||
#define ID_CHEATLISTPOPUP_DELETESELECTEDCHEATS 40410
|
||||
#define ID_FILE_SAVESCREENSHOTAS 40411
|
||||
#define ID_WATCHES_ADDSEPARATOR 40412
|
||||
#define ID_WATCHES_SEPARATOR 40413
|
||||
|
@ -1269,6 +1272,10 @@
|
|||
#define DISASM_CONTEXT_COPY 40598
|
||||
#define MENU_MV_FILE_LOAD_OAM 40599
|
||||
#define DISASM_CONTEXT_SELECTALL 40599
|
||||
#define CHEAT_CONTEXT_POSSI_ADDTOMEMORYWATCH 40600
|
||||
#define CHEAT_CONTEXT_POSSI_ADDCHEAT 40601
|
||||
#define CHEAT_CONTEXT_POSSI_GOTOINHEXEDITOR 40602
|
||||
#define CHEAT_CONTEXT_POSSI_ADDTORAMWATCH 40603
|
||||
#define IDC_DEBUGGER_ICONTRAY 55535
|
||||
#define MW_ValueLabel2 65423
|
||||
#define MW_ValueLabel1 65426
|
||||
|
@ -1281,8 +1288,8 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 303
|
||||
#define _APS_NEXT_COMMAND_VALUE 40600
|
||||
#define _APS_NEXT_RESOURCE_VALUE 304
|
||||
#define _APS_NEXT_COMMAND_VALUE 40611
|
||||
#define _APS_NEXT_CONTROL_VALUE 1312
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
#include "input.h"
|
||||
#include "fceu.h"
|
||||
|
||||
#include "cheat.h"
|
||||
#include "ram_search.h"
|
||||
#include "ramwatch.h"
|
||||
#include "memwatch.h"
|
||||
#include "ppuview.h"
|
||||
#include "debugger.h"
|
||||
#include "cheat.h"
|
||||
#include "debug.h"
|
||||
#include "ntview.h"
|
||||
#include "memview.h"
|
||||
|
|
|
@ -734,7 +734,10 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
|
|||
|
||||
#ifdef WIN32
|
||||
//These Windows only dialogs need to be updated only once per frame so they are included here
|
||||
UpdateCheatList(); // CaH4e3: can't see why, this is only cause problems with selection - adelikat: selection is only a problem when not paused, it shoudl be paused to select, we want to see the values update
|
||||
// CaH4e3: can't see why, this is only cause problems with selection
|
||||
// adelikat: selection is only a problem when not paused, it should be paused to select, we want to see the values update
|
||||
// owomomo: use an OWNERDATA CListCtrl to partially solve the problem
|
||||
UpdateCheatList();
|
||||
UpdateTextHooker();
|
||||
Update_RAM_Search(); // Update_RAM_Watch() is also called.
|
||||
RamChange();
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
//TODO - we really need some kind of global platform-specific options api
|
||||
#ifdef WIN32
|
||||
#include "drivers/win/main.h"
|
||||
#include "drivers/win/cheat.h"
|
||||
#include "drivers/win/ram_search.h"
|
||||
#include "drivers/win/ramwatch.h"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue