From a3280d664daa891aeff4ce198fc0a0e6c13fa704 Mon Sep 17 00:00:00 2001 From: owomomo Date: Thu, 2 May 2019 03:13:05 +0800 Subject: [PATCH 01/10] 1. New cheat list box 0.0.0.1 alpha, changed the toggle cheat from double click to selecting checkboxes in the item. It can show the code and name in the same time. 2. Fixed an ancient bug of cheat dialog that importing new cheats makes old existing cheats uneffective. 3. Restructured some cheat searching type to macros since the meaning of the mysterious number is unclear. Maybe the switch case was more efficient than if else... or not? 4. Use a temporary variable rather than a global one to indicate whether the null file pointer is cased by user clicking the cancel or close button of the open archive dialog or a loading error. 5. When recording a movie with cheats, show warning to the user and asking for disabling them. 6. Removed some seems like unused variables, hope this didn't break compiling crossing platforms. --- src/cheat.cpp | 377 ++++++++--------- src/cheat.h | 16 +- src/driver.h | 2 + src/drivers/win/archive.cpp | 32 +- src/drivers/win/archive.h | 2 + src/drivers/win/cheat.cpp | 710 +++++++++++++++++++-------------- src/drivers/win/cheat.h | 2 + src/drivers/win/mapinput.cpp | 5 +- src/drivers/win/ram_search.cpp | 51 +-- src/drivers/win/ramwatch.cpp | 57 +-- src/drivers/win/ramwatch.h | 5 +- src/drivers/win/replay.cpp | 17 + src/drivers/win/res.rc | 92 +++-- src/drivers/win/resource.h | 2 + src/fceu.cpp | 19 +- src/file.cpp | 8 +- src/file.h | 7 +- 17 files changed, 739 insertions(+), 665 deletions(-) diff --git a/src/cheat.cpp b/src/cheat.cpp index 0b8f4166..fbdd901b 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -40,7 +40,7 @@ static uint8 *CheatRPtrs[64]; vector FrozenAddresses; //List of addresses that are currently frozen void UpdateFrozenList(void); //Function that populates the list of frozen addresses -unsigned int FrozenAddressCount=0; //Keeps up with the Frozen address count, necessary for using in other dialogs (such as hex editor) +unsigned int FrozenAddressCount = 0; //Keeps up with the Frozen address count, necessary for using in other dialogs (such as hex editor) void FCEU_CheatResetRAM(void) { @@ -60,9 +60,9 @@ void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p) } -CHEATF_SUBFAST SubCheats[256]; -uint32 numsubcheats=0; -struct CHEATF *cheats=0,*cheatsl=0; +CHEATF_SUBFAST SubCheats[256] = { 0 }; +uint32 numsubcheats = 0; +struct CHEATF *cheats = 0, *cheatsl = 0; #define CHEATC_NONE 0x8000 @@ -74,7 +74,7 @@ int savecheats = 0; static DECLFR(SubCheatsRead) { - CHEATF_SUBFAST *s=SubCheats; + CHEATF_SUBFAST *s = SubCheats; int x=numsubcheats; do @@ -99,40 +99,35 @@ static DECLFR(SubCheatsRead) void RebuildSubCheats(void) { uint32 x; - struct CHEATF *c=cheats; - for(x=0;xtype==1 && c->status) + if(c->type == 1 && c->status) { - if(GetReadHandler(c->addr)==SubCheatsRead) + if(GetReadHandler(c->addr) != SubCheatsRead) { - /* Prevent a catastrophe by this check. */ - //FCEU_DispMessage("oops",0); - } - else - { - SubCheats[numsubcheats].PrevRead=GetReadHandler(c->addr); - SubCheats[numsubcheats].addr=c->addr; - SubCheats[numsubcheats].val=c->val; - SubCheats[numsubcheats].compare=c->compare; - SetReadHandler(c->addr,c->addr,SubCheatsRead); + SubCheats[numsubcheats].PrevRead = GetReadHandler(c->addr); + SubCheats[numsubcheats].addr = c->addr; + SubCheats[numsubcheats].val = c->val; + SubCheats[numsubcheats].compare = c->compare; + SetReadHandler(c->addr, c->addr, SubCheatsRead); numsubcheats++; } } - c=c->next; + c = c->next; } FrozenAddressCount = numsubcheats; //Update the frozen address list UpdateFrozenList(); - //FCEUI_DispMessage("Active Cheats: %d",0, FrozenAddresses.size()/*FrozenAddressCount*/); //Debug + } void FCEU_PowerCheats() { - numsubcheats=0; /* Quick hack to prevent setting of ancient read addresses. */ + numsubcheats = 0; /* Quick hack to prevent setting of ancient read addresses. */ RebuildSubCheats(); } @@ -154,31 +149,38 @@ static void CheatMemErr(void) static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type) { struct CHEATF *temp; - if(!(temp=(struct CHEATF *)FCEU_dmalloc(sizeof(struct CHEATF)))) + if(!(temp = (struct CHEATF *)FCEU_dmalloc(sizeof(struct CHEATF)))) { CheatMemErr(); return(0); } - temp->name=name; - temp->addr=addr; - temp->val=val; - temp->status=status; - temp->compare=compare; - temp->type=type; - temp->next=0; + + temp->name = strcpy((char*) FCEU_dmalloc(strlen(name) + 1), name); + temp->addr = addr; + temp->val = val; + temp->status = status; + temp->compare = compare; + temp->type = type; + temp->next = 0; if(cheats) { - cheatsl->next=temp; - cheatsl=temp; + cheatsl->next = temp; + cheatsl = temp; } else - cheats=cheatsl=temp; + cheats = cheatsl = temp; - return(1); + return (1); } -void FCEU_LoadGameCheats(FILE *override) +/* The "override_existing" parameter is used only in cheat dialog import. + Since the default behaviour will reset numsubcheats to 0 everytime, + In game loading, this is absolutely right, but when importing in cheat window, + resetting numsubcheats to 0 will override existed cheat items to make them + invalid. +*/ +void FCEU_LoadGameCheats(FILE *override, int override_existing) { FILE *fp; unsigned int addr; @@ -189,84 +191,95 @@ void FCEU_LoadGameCheats(FILE *override) int x; char linebuf[2048]; - char *namebuf; - int tc=0; + char *namebuf = NULL; + int tc = 0; char *fn; - numsubcheats=savecheats=0; + savecheats = 0; + if (override_existing) + numsubcheats = 0; if(override) fp = override; else { - fn=strdup(FCEU_MakeFName(FCEUMKF_CHEAT,0,0).c_str()); - fp=FCEUD_UTF8fopen(fn,"rb"); + fn = strdup(FCEU_MakeFName(FCEUMKF_CHEAT, 0, 0).c_str()); + fp = FCEUD_UTF8fopen(fn, "rb"); free(fn); - if(!fp) return; + if (!fp) { + return; + } } - FCEU_DispMessage("Cheats file loaded.",0); //Tells user a cheats file was loaded. - while(fgets(linebuf,2048,fp) != nullptr) + while(fgets(linebuf, 2048, fp) != nullptr) { - char *tbuf=linebuf; - int doc=0; + char *tbuf = linebuf; + int doc = 0; - addr=val=compare=status=type=0; + addr = val = compare = status = type = 0; - if(tbuf[0]=='S') + if(tbuf[0] == 'S') { tbuf++; - type=1; + type = 1; } - else type=0; + else + type = 0; - if(tbuf[0]=='C') + if(tbuf[0] == 'C') { tbuf++; - doc=1; + doc = 1; } - if(tbuf[0]==':') + if(tbuf[0] == ':') { tbuf++; - status=0; + status = 0; } - else status=1; + else status = 1; if(doc) { - char *neo=&tbuf[4+2+2+1+1+1]; - if(sscanf(tbuf,"%04x%*[:]%02x%*[:]%02x",&addr,&val,&compare)!=3) + 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))) + if (!(namebuf = (char *)FCEU_dmalloc(strlen(neo) + 1))) return; - strcpy(namebuf,neo); + strcpy(namebuf, neo); } else { - char *neo=&tbuf[4+2+1+1]; - if(sscanf(tbuf,"%04x%*[:]%02x",&addr,&val)!=2) + char *neo = &tbuf[4+2+1+1]; + if(sscanf(tbuf, "%04x%*[:]%02x", &addr, &val) != 2) continue; - if (!(namebuf=(char *)FCEU_dmalloc(strlen(neo)+1))) + if (!(namebuf = (char *)FCEU_dmalloc(strlen(neo) + 1))) return; - strcpy(namebuf,neo); + strcpy(namebuf, neo); } - for(x=0;x<(int)strlen(namebuf);x++) + for(x = 0; x < (int)strlen(namebuf); x++) { - if(namebuf[x]==10 || namebuf[x]==13) + if(namebuf[x] == 10 || namebuf[x] == 13) { - namebuf[x]=0; + namebuf[x] = 0; break; } else if(namebuf[x] > 0x00 && namebuf[x] < 0x20) - namebuf[x]=0x20; + namebuf[x] = 0x20; } - AddCheatEntry(namebuf,addr,val,doc?compare:-1,status,type); + AddCheatEntry(namebuf, addr, val, doc ? compare : -1, status, type); tc++; } + + if (namebuf) + free(namebuf); + RebuildSubCheats(); + + FCEU_DispMessage("Cheats file loaded.", 0); //Tells user a cheats file was loaded. + if(!override) fclose(fp); } @@ -355,23 +368,26 @@ void FCEU_FlushGameCheats(FILE *override, int nosave) int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type) { - char *t; + char *t = NULL; - if(!(t=(char *)FCEU_dmalloc(strlen(name)+1))) + if(!(t = (char *)FCEU_dmalloc(strlen(name) + 1))) { CheatMemErr(); return(0); } strcpy(t,name); - if(!AddCheatEntry(t,addr,val,compare,1,type)) + if(!AddCheatEntry(t, addr, val, compare, 1, type)) { free(t); return(0); } - savecheats=1; + savecheats = 1; RebuildSubCheats(); - return(1); + if (t) + free(t); + + return 1; } int FCEUI_DelCheat(uint32 which) @@ -588,43 +604,40 @@ int FCEUI_DecodePAR(const char *str, int *a, int *v, int *c, int *type) int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int c, int s, int type) { - struct CHEATF *next=cheats; - uint32 x=0; + struct CHEATF *next = cheats; + uint32 x = 0; while(next) { - if(x==which) + if(x == which) { if(name) { char *t; - if((t=(char *)realloc(next->name, strlen(name)+1))) - { - next->name=t; - strcpy(next->name,name); - } + if((t = (char *)realloc(next->name, strlen(name) + 1))) + strcpy(next->name = t, name); else - return(0); + return 0; } - if(a>=0) - next->addr=a; - if(v>=0) - next->val=v; - if(s>=0) - next->status=s; - if(c>=-1) - next->compare=c; - next->type=type; + if(a >= 0) + next->addr = a; + if(v >= 0) + next->val = v; + if(s >= 0) + next->status = s; + if(c >= -1) + next->compare = c; + next->type = type; - savecheats=1; + savecheats = 1; RebuildSubCheats(); - return(1); + return 1; } - next=next->next; + next = next->next; x++; } - return(0); + return 0; } /* Convenience function. */ @@ -793,130 +806,56 @@ void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2) } } - - if(!type) // Change to a specific value. + switch (type) { - for(x=0;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CheatComp[x]==v1 && CheatRPtrs[x>>10][x]==v2) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } + default: + case FCEU_SEARCH_SPECIFIC_CHANGE: // Change to a specific value + for (x = 0; x < 0x10000; ++x) + 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). + 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; + break; + case FCEU_SEARCH_PUERLY_RELATIVE_CHANGE: // Purely relative change. + for (x = 0x000; x<0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && CAbs(CheatComp[x] - CheatRPtrs[x >> 10][x]) != v2) + CheatComp[x] |= CHEATC_EXCLUDED; + break; + case FCEU_SEARCH_ANY_CHANGE: // Any change. + for (x = 0x000; x < 0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && CheatComp[x] == CheatRPtrs[x >> 10][x]) + CheatComp[x] |= CHEATC_EXCLUDED; + break; + case FCEU_SEARCH_NEWVAL_KNOWN: // new value = known + for (x = 0x000; x < 0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && CheatRPtrs[x >> 10][x] != v1) + CheatComp[x] |= CHEATC_EXCLUDED; + break; + case FCEU_SEARCH_NEWVAL_GT: // new value greater than + for (x = 0x000; x < 0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && CheatComp[x] >= CheatRPtrs[x >> 10][x]) + CheatComp[x] |= CHEATC_EXCLUDED; + break; + case FCEU_SEARCH_NEWVAL_LT: // new value less than + for (x = 0x000; x < 0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && CheatComp[x] <= CheatRPtrs[x >> 10][x]) + CheatComp[x] |= CHEATC_EXCLUDED; + break; + case FCEU_SEARCH_NEWVAL_GT_KNOWN: // new value greater than by known value + for (x = 0x000; x < 0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && CheatRPtrs[x >> 10][x] - CheatComp[x] != v2) + CheatComp[x] |= CHEATC_EXCLUDED; + break; + case FCEU_SEARCH_NEWVAL_LT_KNOWN: // new value less than by known value + for (x = 0x000; x < 0x10000; x++) + if (!(CheatComp[x] & CHEATC_NOSHOW) && (CheatComp[x] - CheatRPtrs[x >> 10][x]) != v2) + CheatComp[x] |= CHEATC_EXCLUDED; + break; } - else if(type==1) // Search for relative change(between values). - { - for(x=0;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CheatComp[x]==v1 && CAbs(CheatComp[x]-CheatRPtrs[x>>10][x])==v2) - { - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - } - else if(type==2) // Purely relative change. - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CAbs(CheatComp[x]-CheatRPtrs[x>>10][x])==v2) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - } - else if(type==3) // Any change. - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CheatComp[x]!=CheatRPtrs[x>>10][x]) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - - } - else if(type==4) // new value = known - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CheatRPtrs[x>>10][x]==v1) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - - } - else if(type==5) // new value greater than - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CheatComp[x]>10][x]) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - - } - else if(type==6) // new value less than - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if(CheatComp[x]>CheatRPtrs[x>>10][x]) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - - } - else if(type==7) // new value greater than by known value - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if((CheatRPtrs[x>>10][x]-CheatComp[x])==v2) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - - } - else if(type==8) // new value less than by known value - { - for(x=0x000;x<0x10000;x++) - if(!(CheatComp[x]&CHEATC_NOSHOW)) - { - if((CheatComp[x]-CheatRPtrs[x>>10][x])==v2) - { - - } - else - CheatComp[x]|=CHEATC_EXCLUDED; - } - - } } int FCEU_CheatGetByte(uint32 A) @@ -958,7 +897,7 @@ void UpdateFrozenList(void) // disable all cheats int FCEU_DisableAllCheats(){ int count = 0; - struct CHEATF *next=cheats; + struct CHEATF *next = cheats; while(next) { if(next->status){ @@ -967,7 +906,7 @@ int FCEU_DisableAllCheats(){ next->status = 0; next = next->next; } - savecheats=1; + savecheats = 1; RebuildSubCheats(); return count; } diff --git a/src/cheat.h b/src/cheat.h index d7130a37..b828ccee 100644 --- a/src/cheat.h +++ b/src/cheat.h @@ -1,7 +1,7 @@ void FCEU_CheatResetRAM(void); void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p); -void FCEU_LoadGameCheats(FILE *override); +void FCEU_LoadGameCheats(FILE *override, int override_existing = 1); void FCEU_FlushGameCheats(FILE *override, int nosave); void FCEU_ApplyPeriodicCheats(void); void FCEU_PowerCheats(void); @@ -24,7 +24,7 @@ typedef struct { struct CHEATF { struct CHEATF *next; - char *name; + char *name = ""; uint16 addr; uint8 val; int compare; /* -1 for no compare. */ @@ -32,9 +32,19 @@ struct CHEATF { int status; }; +#define FCEU_SEARCH_SPECIFIC_CHANGE 0 +#define FCEU_SEARCH_RELATIVE_CHANGE 1 +#define FCEU_SEARCH_PUERLY_RELATIVE_CHANGE 2 +#define FCEU_SEARCH_ANY_CHANGE 3 +#define FCEU_SEARCH_NEWVAL_KNOWN 4 +#define FCEU_SEARCH_NEWVAL_GT 5 +#define FCEU_SEARCH_NEWVAL_LT 6 +#define FCEU_SEARCH_NEWVAL_GT_KNOWN 7 +#define FCEU_SEARCH_NEWVAL_LT_KNOWN 8 + #define CalcAddressRangeCheatCount(count, address, size) \ count = 0; \ for (int i = 0; i < numsubcheats && count < size; ++i) \ if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size) \ - ++count; + ++count diff --git a/src/driver.h b/src/driver.h index f221b9bb..29411760 100644 --- a/src/driver.h +++ b/src/driver.h @@ -14,7 +14,9 @@ inline FILE *FCEUD_UTF8fopen(const std::string &n, const char *mode) { return FC EMUFILE_FILE* FCEUD_UTF8_fstream(const char *n, const char *m); inline EMUFILE_FILE* FCEUD_UTF8_fstream(const std::string &n, const char *m) { return FCEUD_UTF8_fstream(n.c_str(),m); } FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string& fname, int innerIndex); +FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string& fname, int innerIndex, bool* userCancel); FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename); +FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename, bool* userCancel); ArchiveScanRecord FCEUD_ScanArchive(std::string fname); //mbg 7/23/06 diff --git a/src/drivers/win/archive.cpp b/src/drivers/win/archive.cpp index 355378c9..0c9cea92 100644 --- a/src/drivers/win/archive.cpp +++ b/src/drivers/win/archive.cpp @@ -275,10 +275,6 @@ public: } }; -// indicator for the open in archive dialog that if the load was canceled by the user. -// TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. -extern bool archiveManuallyCanceled; - static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) @@ -289,7 +285,7 @@ static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM for(uint32 i=0;isize();i++) { std::string& name = (*currFileSelectorContext)[i].name; - SendMessage(hwndListbox,LB_ADDSTRING,0,(LPARAM)name.c_str()); + SendMessage(hwndListbox, LB_ADDSTRING, 0, (LPARAM)name.c_str()); } } break; @@ -310,9 +306,6 @@ static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM case IDCANCEL: EndDialog(hwndDlg, LB_ERR); - // Tell the parent window that the operation was canceled rather than loading error - // TODO: find a better way to do this. - archiveManuallyCanceled = true; return TRUE; } break; @@ -493,7 +486,7 @@ extern HWND hAppWnd; //TODO - factor out the filesize and name extraction code from below (it is already done once above) -static FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename, int innerIndex) +static FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename, int innerIndex, bool* userCancel) { FCEUFILE* fp = 0; @@ -565,7 +558,11 @@ static FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, s delete ms; } - } //if returned a file from the fileselector + } + else { + if(userCancel) + *userCancel = true; + }//if returned a file from the fileselector } //if we opened the 7z correctly object->Release(); @@ -574,11 +571,26 @@ static FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, s return fp; } +static FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename, int innerIndex) +{ + return FCEUD_OpenArchive(asr, fname, innerFilename, innerIndex, NULL); +} + +FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string& fname, int innerIndex, bool* userCancel) +{ + return FCEUD_OpenArchive(asr, fname, 0, innerIndex, userCancel); +} + FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string& fname, int innerIndex) { return FCEUD_OpenArchive(asr, fname, 0, innerIndex); } +FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename, bool* userCancel) +{ + return FCEUD_OpenArchive(asr, fname, innerFilename, -1, userCancel); +} + FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename) { return FCEUD_OpenArchive(asr, fname, innerFilename, -1); diff --git a/src/drivers/win/archive.h b/src/drivers/win/archive.h index f4eb40ca..619f075d 100644 --- a/src/drivers/win/archive.h +++ b/src/drivers/win/archive.h @@ -11,8 +11,10 @@ void initArchiveSystem(); //if you want to autopilot this, pass in an innerfilename to try and automatically load FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename); +FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename, bool* userCancel); FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string& fname, int innerIndex); +FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string& fname, int innerIndex, bool* userCancel); //scans a file to see if it is an archive you can handle ArchiveScanRecord FCEUD_ScanArchive(std::string fname); diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 1d58673a..ea538048 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -32,16 +32,28 @@ 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 -void InitializeCheatsAdded(HWND hwndDlg); - bool pauseWhileActive = false; //For checkbox "Pause while active" extern bool wasPausedByCheats; int CheatWindow; -int CheatStyle=1; +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; int ChtPosX,ChtPosY; @@ -96,41 +108,54 @@ char *U8ToStr(uint8 a) return str; } -static HWND hwndLB; //int RedoCheatsCallB(char *name, uint32 a, uint8 v, int s) { //bbit edited: this commented out line was changed to the below for the new fceud -int RedoCheatsCallB(char *name, uint32 a, uint8 v, int c, int s, int type, void*data) +int RedoCheatsCallB(char *name, uint32 a, uint8 v, int c, int s, int type, void* data) { - char str[259] = { 0 }; + char str[256] = { 0 }; - strcpy(str,(s?"* ":" ")); - if(name[0] == 0) { - if(a >= 0x8000) { - EncodeGG(str+2, a, v, c); - } else { - if(c == -1) sprintf(str+2,"%04X:%02X",(int)a,(int)v); - else sprintf(str+2,"%04X?%02X:%02X",(int)a,(int)c,(int)v); - } + if(a >= 0x8000) + EncodeGG(str, a, v, c); + else { + if(c == -1) + sprintf(str, "%04X:%02X", (int)a, (int)v); + else + sprintf(str, "%04X?%02X:%02X", (int)a, (int)c, (int)v); } - else strcat(str,name); - SendDlgItemMessage(hwndLB,IDC_LIST_CHEATS,LB_ADDSTRING,0,(LPARAM)(LPSTR)str); + LVITEM lvi = { 0 }; + lvi.mask = LVIF_TEXT; + lvi.iItem = data ? *((int*)data) : GGLISTSIZE; + lvi.pszText = str; + + if (data) + SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_SETITEM, 0, (LPARAM)&lvi); + else + lvi.iItem = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_INSERTITEM, 0, (LPARAM)&lvi); + lvi.iSubItem = 1; + lvi.pszText = name; + SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_SETITEM, 0, (LPARAM)&lvi); + + lvi.mask = LVIF_STATE; + lvi.stateMask = LVIS_STATEIMAGEMASK; + lvi.state = INDEXTOSTATEIMAGEMASK(s ? 2 : 1); + SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_SETITEMSTATE, lvi.iItem, (LPARAM)&lvi); + return 1; } void RedoCheatsLB(HWND hwndDlg) { - SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LB_RESETCONTENT, 0, 0); - hwndLB = hwndDlg; + SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_DELETEALLITEMS, 0, 0); FCEUI_ListCheats(RedoCheatsCallB, 0); if (selcheat >= 0) { - EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_DEL), TRUE); - EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_DEL), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_UPD), TRUE); } else { - EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_DEL), FALSE); - EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_DEL), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_UPD), FALSE); } } @@ -139,7 +164,7 @@ int ShowResultsCallB(uint32 a, uint8 last, uint8 current) char temp[16]; sprintf(temp,"$%04X: %02X | %02X",(unsigned int)a,last,current); - SendDlgItemMessage(hwndLB,IDC_CHEAT_LIST_POSSIBILITIES,LB_ADDSTRING,0,(LPARAM)(LPSTR)temp); + SendDlgItemMessage(hCheat, IDC_CHEAT_LIST_POSSIBILITIES, LB_ADDSTRING, 0, (LPARAM)(LPSTR)temp); return 1; } @@ -152,7 +177,6 @@ void ShowResults(HWND hwndDlg) scrollnum=n; scrollindex=-32768; - hwndLB=hwndDlg; SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,LB_RESETCONTENT,0,0); FCEUI_CheatSearchGetRange(0,16,ShowResultsCallB); @@ -176,75 +200,102 @@ void EnableCheatButtons(HWND hwndDlg, int enable) EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_LT),enable); } +HWND InitializeCheatList(HWND hwnd) +{ + HWND hwndChtList = GetDlgItem(hwnd, IDC_LIST_CHEATS); + + // prepare the columns + LVCOLUMN lv = { 0 }; + lv.mask = LVCF_TEXT | LVCF_WIDTH; + + lv.pszText = "Code"; + lv.cx = 100; + SendMessage(hwndChtList, LVM_INSERTCOLUMN, 0, (LPARAM)&lv); + + lv.pszText = "Name"; + lv.cx = 140; + SendMessage(hwndChtList, LVM_INSERTCOLUMN, 1, (LPARAM)&lv); + + // Add a checkbox to indicate if the cheat is activated + SendMessage(hwndChtList, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); + + return hwndChtList; +} + BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { LOGFONT lf; RECT wrect; - char str[259] = { 0 },str2[259] = { 0 }; +// char str[256] = { 0 }, str2[256] = { 0 }; - char *name; - uint32 a; - uint8 v; - int c; - int s; +// char *name = ""; +// uint32 a; +// uint8 v; +// int c; +// int s; switch (uMsg) { case WM_INITDIALOG: - if (ChtPosX==-32000) ChtPosX=0; //Just in case - if (ChtPosY==-32000) ChtPosY=0; - SetWindowPos(hwndDlg,0,ChtPosX,ChtPosY,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER); - + { + if (ChtPosX == -32000) ChtPosX = 0; //Just in case + if (ChtPosY == -32000) ChtPosY = 0; + SetWindowPos(hwndDlg, 0, ChtPosX, ChtPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); + CheckDlgButton(hwndDlg, IDC_CHEAT_PAUSEWHENACTIVE, pauseWhileActive ? MF_CHECKED : MF_UNCHECKED); //setup font hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0); GetObject(hFont, sizeof(LOGFONT), &lf); - strcpy(lf.lfFaceName,"Courier New"); + strcpy(lf.lfFaceName, "Courier New"); hNewFont = CreateFontIndirect(&lf); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_ADDR,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_COM,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_KNOWN,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_LIST_POSSIBILITIES,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_NE_BY,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_GT_BY,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_LT_BY,WM_SETFONT,(WPARAM)hNewFont,FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_ADDR, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_COM, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_KNOWN, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_NE_BY, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_GT_BY, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_LT_BY, WM_SETFONT, (WPARAM)hNewFont, FALSE); //text limits - SendDlgItemMessage(hwndDlg,IDC_CHEAT_ADDR,EM_SETLIMITTEXT,4,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL,EM_SETLIMITTEXT,2,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_COM,EM_SETLIMITTEXT,2,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_NAME,EM_SETLIMITTEXT,256,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_KNOWN,EM_SETLIMITTEXT,2,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_NE_BY,EM_SETLIMITTEXT,2,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_GT_BY,EM_SETLIMITTEXT,2,0); - SendDlgItemMessage(hwndDlg,IDC_CHEAT_VAL_LT_BY,EM_SETLIMITTEXT,2,0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_ADDR, EM_SETLIMITTEXT, 4, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL, EM_SETLIMITTEXT, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_COM, EM_SETLIMITTEXT, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_NAME, EM_SETLIMITTEXT, 256, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_KNOWN, EM_SETLIMITTEXT, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_NE_BY, EM_SETLIMITTEXT, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_GT_BY, EM_SETLIMITTEXT, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_LT_BY, EM_SETLIMITTEXT, 2, 0); //disable or enable buttons - EnableWindow(GetDlgItem(hwndDlg,IDC_CHEAT_VAL_KNOWN),FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), FALSE); if (scrollnum) { - EnableCheatButtons(hwndDlg,TRUE); + char str[256] = { 0 }; + EnableCheatButtons(hwndDlg, TRUE); ShowResults(hwndDlg); - sprintf(str,"%d Possibilities",(int)FCEUI_CheatSearchGetCount()); - SetDlgItemText(hwndDlg,IDC_CHEAT_BOX_POSSIBILITIES,str); + sprintf(str, "%d Possibilities", (int)FCEUI_CheatSearchGetCount()); + SetDlgItemText(hwndDlg, IDC_CHEAT_BOX_POSSIBILITIES, str); } - else EnableCheatButtons(hwndDlg,FALSE); + else EnableCheatButtons(hwndDlg, FALSE); + + //add header for cheat list + InitializeCheatList(hwndDlg); //misc setup - searchdone=0; - SetDlgItemText(hwndDlg,IDC_CHEAT_VAL_KNOWN,(LPTSTR)U8ToStr(knownvalue)); + searchdone = 0; + SetDlgItemText(hwndDlg, IDC_CHEAT_VAL_KNOWN, (LPTSTR)U8ToStr(knownvalue)); + // Enable Context Sub-Menus - hCheatcontext = LoadMenu(fceu_hInstance,"CHEATCONTEXTMENUS"); + hCheatcontext = LoadMenu(fceu_hInstance, "CHEATCONTEXTMENUS"); break; - + } case WM_KILLFOCUS: break; - case WM_NCACTIVATE: if (pauseWhileActive) { @@ -264,27 +315,29 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ShowResults(hwndDlg); } break; - case WM_CLOSE: - case WM_QUIT: - CheatWindow=0; - hCheat = 0; - if (CheatStyle) DestroyWindow(hwndDlg); - else EndDialog(hwndDlg,0); + if (CheatStyle) + DestroyWindow(hwndDlg); + else + EndDialog(hwndDlg, 0); + break; + case WM_DESTROY: + CheatWindow = 0; + hCheat = NULL; DeleteObject(hFont); DeleteObject(hNewFont); - if (searchdone) FCEUI_CheatSearchSetCurrentAsOriginal(); + if (searchdone) + FCEUI_CheatSearchSetCurrentAsOriginal(); break; - case WM_MOVE: if (!IsIconic(hwndDlg)) { - GetWindowRect(hwndDlg,&wrect); - ChtPosX = wrect.left; - ChtPosY = wrect.top; + GetWindowRect(hwndDlg,&wrect); + ChtPosX = wrect.left; + ChtPosY = wrect.top; - #ifdef WIN32 - WindowBoundsCheckNoResize(ChtPosX,ChtPosY,wrect.right); - #endif + #ifdef WIN32 + WindowBoundsCheckNoResize(ChtPosX,ChtPosY,wrect.right); + #endif } break; @@ -384,18 +437,17 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case WM_CONTEXTMENU: { // Handle certain subborn context menus for nearly incapable controls. - - if (wParam == (uint32)GetDlgItem(hwndDlg,IDC_LIST_CHEATS)) { + 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); + 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 + 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 + 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 } } @@ -409,16 +461,41 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case BN_CLICKED: switch (LOWORD(wParam)) { case CHEAT_CONTEXT_TOGGLECHEAT: - CheatConsoleCallB(hwndDlg, WM_COMMAND, (LBN_DBLCLK * 0x10000) | (IDC_LIST_CHEATS), lParam); + { + LVITEM lvi; + lvi.mask = LVIF_STATE; + lvi.stateMask = LVIS_STATEIMAGEMASK; + int tmpsel = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_GETNEXTITEM, -1, LVNI_ALL | LVNI_SELECTED); + while (tmpsel != -1) + { + char* name = ""; uint32 a = 0; uint8 v = 0; int s = 0; int c = 0; + FCEUI_GetCheat(tmpsel, &name, &a, &v, &c, &s, NULL); + FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); + + lvi.iItem = tmpsel; + lvi.state = INDEXTOSTATEIMAGEMASK(s ? 2 : 1); + SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_SETITEMSTATE, tmpsel, (LPARAM)&lvi); + + tmpsel = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETNEXTITEM, tmpsel, LVNI_ALL | LVNI_SELECTED); + } + UpdateCheatWindowRelatedWindow(); + UpdateCheatListGroupBoxUI(); + } break; case CHEAT_CONTEXT_POKECHEATVALUE: - FCEUI_GetCheat(selcheat,&name,&a,&v,NULL,&s,NULL); - BWrite[a](a,v); + { + 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: + { DoMemView(); - FCEUI_GetCheat(selcheat,&name,&a,&v,NULL,&s,NULL); + char* name = ""; uint32 a; uint8 v; int s; + FCEUI_GetCheat(selcheat, &name, &a, &v, NULL, &s, NULL); SetHexEditorAddress(a); + } break; case IDC_CHEAT_PAUSEWHENACTIVE: pauseWhileActive ^= 1; @@ -431,128 +508,126 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } break; case IDC_BTN_CHEAT_ADD: + { + char str[256] = { 0 }; + uint32 a = 0; + uint8 v = 0; + int c = 0; dodecode = true; - - GetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,str,5); - if(str[0] != 0) dodecode = false; - a=StrToU16(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_VAL,str,3); - if(str[0] != 0) dodecode = false; - v=StrToU8(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_COM,str,3); - if(str[0] != 0) dodecode = false; - c=(str[0] == 0)?-1:StrToU8(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_NAME,str,256); - if(dodecode && (strlen(str) == 6 || strlen(str) == 8)) { + + GetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, str, 5); + if(str[0] != 0) + dodecode = false; + a = StrToU16(str); + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL, str, 3); + if(str[0] != 0) + dodecode = false; + v = StrToU8(str); + GetDlgItemText(hwndDlg,IDC_CHEAT_COM, str, 3); + if(str[0] != 0) + dodecode = false; + c = (str[0] == 0) ? -1 : StrToU8(str); + GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, str, 256); + if(dodecode && (strlen(str) == 6 || strlen(str) == 8)) if(FCEUI_DecodeGG(str, &GGaddr, &GGval, &GGcomp)) { a = GGaddr; v = GGval; c = GGcomp; } - } -// if (FCEUI_AddCheat(str,a,v)) { //bbit edited: replaced this with the line below - if (FCEUI_AddCheat(str,a,v,c,1)) { - if(str[0] == 0) { - if(a >= 0x8000) EncodeGG(str, a, v, c); - else { - if(c == -1) sprintf(str,"%04X:%02X",(int)a,(int)v); //bbit edited: added this line to give your cheat a name if you didn't supply one - else sprintf(str,"%04X?%02X:%02X",(int)a,(int)c,(int)v); - } - } - strcpy(str2,"* "); - strcat(str2,str); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_ADDSTRING,0,(LPARAM)(LPSTR)str2); - selcheat = (SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_GETCOUNT,0,0) - 1); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETSEL,(WPARAM)1,selcheat); + if (FCEUI_AddCheat(str, a, v, c, 1)) { + RedoCheatsCallB(str, a, v, c, 1, 1, NULL); - SetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)""); + int newselcheat = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETITEMCOUNT, 0, 0) - 1; + ListView_MoveSelectionMark(GetDlgItem(hwndDlg, IDC_LIST_CHEATS), selcheat, newselcheat); + selcheat = newselcheat; + + ClearCheatListText(hwndDlg); } UpdateCheatWindowRelatedWindow(); - UpdateCheatsAdded(); + UpdateCheatListGroupBoxUI(); break; + } case ID_CHEATLISTPOPUP_DELETESELECTEDCHEATS: case IDC_BTN_CHEAT_DEL: if (selcheatcount > 1) { if (IDYES == MessageBox(hwndDlg, "Multiple cheats selected. Continue with delete?", "Delete multiple cheats?", MB_ICONQUESTION | MB_YESNO)) { //Get message box - selcheat=-1; - for (int selcheattemp=SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_GETCOUNT,0,0)-1;selcheattemp>=0;selcheattemp--) { - if (SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_GETSEL,selcheattemp,0)) { - FCEUI_DelCheat(selcheattemp); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_DELETESTRING,selcheattemp,0); - } + selcheat = -1; + + int selcheattemp = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETNEXTITEM, -1, LVNI_ALL | LVNI_SELECTED); + LVITEM lvi; + lvi.mask = LVIF_STATE; + lvi.stateMask = LVIS_SELECTED; + lvi.state = 0; + while (selcheattemp != -1) + { + FCEUI_DelCheat(selcheattemp); + SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_DELETEITEM, selcheattemp, 0); + selcheattemp = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETNEXTITEM, -1, LVNI_ALL | LVNI_SELECTED); } - SetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)""); + + ClearCheatListText(hwndDlg); + UpdateCheatWindowRelatedWindow(); - UpdateCheatsAdded(); + UpdateCheatListGroupBoxUI(); } } else { if (selcheat >= 0) { FCEUI_DelCheat(selcheat); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_DELETESTRING,selcheat,0); - selcheat=-1; - SetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); - SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)""); + SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_DELETEITEM, selcheat, 0); + selcheat = -1; + ClearCheatListText(hwndDlg); } UpdateCheatWindowRelatedWindow(); - UpdateCheatsAdded(); + UpdateCheatListGroupBoxUI(); } break; case IDC_BTN_CHEAT_UPD: - dodecode = true; + { + selcheat = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETSELECTIONMARK, 0, 0); - if (selcheat < 0) break; - GetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,str,5); - if(str[0] != 0) dodecode = false; - a=StrToU16(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_VAL,str,3); - if(str[0] != 0) dodecode = false; - v=StrToU8(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_COM,str,3); - if(str[0] != 0) dodecode = false; - c=(str[0] == 0)?-1:StrToU8(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_NAME,str,256); - if(dodecode && (strlen(str) == 6 || strlen(str) == 8)) { - if(FCEUI_DecodeGG(str, &GGaddr, &GGval, &GGcomp)) { + dodecode = true; + char str[256] = { 0 }; + char* name = ""; uint32 a; uint8 v; int s; int c; + + if (selcheat < 0) + break; + GetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, str, 5); + if (str[0] != 0) + dodecode = false; + a = StrToU16(str); + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL, str, 3); + if (str[0] != 0) + dodecode = false; + v = StrToU8(str); + GetDlgItemText(hwndDlg, IDC_CHEAT_COM, str, 3); + if (str[0] != 0) + dodecode = false; + c = (str[0] == 0) ? -1 : StrToU8(str); + GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, str, 256); + if (dodecode && (strlen(str) == 6 || strlen(str) == 8)) { + if (FCEUI_DecodeGG(str, &GGaddr, &GGval, &GGcomp)) { a = GGaddr; v = GGval; c = GGcomp; } } -// FCEUI_SetCheat(selcheat,str,a,v,-1); //bbit edited: replaced this with the line below - FCEUI_SetCheat(selcheat,str,a,v,c,-1,1); -// FCEUI_GetCheat(selcheat,&name,&a,&v,&s); //bbit edited: replaced this with the line below - FCEUI_GetCheat(selcheat,&name,&a,&v,&c,&s,NULL); - strcpy(str2,(s?"* ":" ")); - if(str[0] == 0) { - if(a >= 0x8000) EncodeGG(str, a, v, c); - else { - if(c == -1) sprintf(str,"%04X:%02X",(int)a,(int)v); //bbit edited: added this line to give your cheat a name if you didn't supply one - else sprintf(str,"%04X?%02X:%02X",(int)a,(int)c,(int)v); - } - } - strcat(str2,str); + FCEUI_SetCheat(selcheat, str, a, v, c, -1, 1); + FCEUI_GetCheat(selcheat, &name, &a, &v, &c, &s, NULL); + RedoCheatsCallB(name, a, v, c, s, 1, &selcheat); + SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_SETSELECTIONMARK, 0, selcheat); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_DELETESTRING,selcheat,0); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_INSERTSTRING,selcheat,(LPARAM)(LPSTR)str2); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETSEL,(WPARAM)1,selcheat); - - SetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,(LPTSTR)U16ToStr(a)); - SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(v)); - if(c == -1) SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); - else SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)U8ToStr(c)); + SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a)); + SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v)); + if (c == -1) + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)""); + else + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(c)); UpdateCheatWindowRelatedWindow(); + UpdateCheatListGroupBoxUI(); + // UpdateCheatAdded(); break; + } case IDC_BTN_CHEAT_ADDFROMFILE: { OPENFILENAME ofn; @@ -576,7 +651,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l FILE* file = FCEUD_UTF8fopen(nameo, "rb"); if (file) { - FCEU_LoadGameCheats(file); + FCEU_LoadGameCheats(file, 0); UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); savecheats = 1; @@ -590,44 +665,56 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l EnableCheatButtons(hwndDlg,TRUE); break; case IDC_BTN_CHEAT_KNOWN: - searchdone=1; - GetDlgItemText(hwndDlg,IDC_CHEAT_VAL_KNOWN,str,3); - knownvalue=StrToU8(str); - FCEUI_CheatSearchEnd(4,knownvalue,0); + { + char str[256] = { 0 }; + searchdone = 1; + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL_KNOWN, str, 3); + knownvalue = StrToU8(str); + FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_KNOWN, knownvalue, 0); ShowResults(hwndDlg); break; + } case IDC_BTN_CHEAT_EQ: - searchdone=1; - FCEUI_CheatSearchEnd(2,0,0); + searchdone = 1; + FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE,0,0); ShowResults(hwndDlg); break; case IDC_BTN_CHEAT_NE: - searchdone=1; - if (IsDlgButtonChecked(hwndDlg,IDC_CHEAT_CHECK_NE_BY) == BST_CHECKED) { - GetDlgItemText(hwndDlg,IDC_CHEAT_VAL_NE_BY,str,3); - FCEUI_CheatSearchEnd(2,0,StrToU8(str)); + { + char str[256] = { 0 }; + searchdone = 1; + if (IsDlgButtonChecked(hwndDlg, IDC_CHEAT_CHECK_NE_BY) == BST_CHECKED) { + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL_NE_BY, str, 3); + FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE, 0, StrToU8(str)); } - else FCEUI_CheatSearchEnd(3,0,0); + else FCEUI_CheatSearchEnd(FCEU_SEARCH_ANY_CHANGE, 0, 0); ShowResults(hwndDlg); break; + } case IDC_BTN_CHEAT_GT: - searchdone=1; - if (IsDlgButtonChecked(hwndDlg,IDC_CHEAT_CHECK_GT_BY) == BST_CHECKED) { - GetDlgItemText(hwndDlg,IDC_CHEAT_VAL_GT_BY,str,3); - FCEUI_CheatSearchEnd(7,0,StrToU8(str)); + { + char str[256] = { 0 }; + searchdone = 1; + if (IsDlgButtonChecked(hwndDlg, IDC_CHEAT_CHECK_GT_BY) == BST_CHECKED) { + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL_GT_BY, str, 3); + FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_GT_KNOWN, 0, StrToU8(str)); } - else FCEUI_CheatSearchEnd(5,0,0); + else FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_GT, 0, 0); ShowResults(hwndDlg); break; + } case IDC_BTN_CHEAT_LT: - searchdone=1; - if (IsDlgButtonChecked(hwndDlg,IDC_CHEAT_CHECK_LT_BY) == BST_CHECKED) { - GetDlgItemText(hwndDlg,IDC_CHEAT_VAL_LT_BY,str,3); - FCEUI_CheatSearchEnd(8,0,StrToU8(str)); + { + char str[256] = { 0 }; + searchdone = 1; + if (IsDlgButtonChecked(hwndDlg, IDC_CHEAT_CHECK_LT_BY) == BST_CHECKED) { + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL_LT_BY, str, 3); + FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_LT_KNOWN, 0, StrToU8(str)); } - else FCEUI_CheatSearchEnd(6,0,0); + else FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_LT, 0, 0); ShowResults(hwndDlg); break; + } } break; case LBN_DBLCLK: @@ -635,90 +722,38 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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; - 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); + 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; - case IDC_LIST_CHEATS: - //SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_GETSEL,(WPARAM)x,(LPARAM)0); - for (int selcheattemp=SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_GETCOUNT,0,0)-1;selcheattemp>=0;selcheattemp--) { - if (SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_GETSEL,selcheattemp,0)) { -// FCEUI_GetCheat(selcheattemp,&name,&a,&v,&s); //bbit edited: replaced this with the line below - FCEUI_GetCheat(selcheattemp,&name,&a,&v,&c,&s,NULL); -// FCEUI_SetCheat(selcheattemp,0,-1,-1,s^=1);//bbit edited: replaced this with the line below - FCEUI_SetCheat(selcheattemp,0,-1,-1,-2,s^=1,1); - strcpy(str,(s?"* ":" ")); - if(name[0] == 0) { - if(a >= 0x8000) EncodeGG(str+2, a, v, c); - else { - if(c == -1) sprintf(str+2,"%04X:%02X",(int)a,(int)v); //bbit edited: added this line to give your cheat a name if you didn't supply one - else sprintf(str+2,"%04X?%02X:%02X",(int)a,(int)c,(int)v); - } - } - else strcat(str,name); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_DELETESTRING,selcheattemp,0); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_INSERTSTRING,selcheattemp,(LPARAM)(LPSTR)str); - } - } - UpdateCheatsAdded(); - UpdateCheatWindowRelatedWindow(); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); - SendDlgItemMessage(hwndDlg,IDC_LIST_CHEATS,LB_SETSEL,(WPARAM)1,selcheat); - break; } break; case LBN_SELCHANGE: switch (LOWORD(wParam)) { - case IDC_LIST_CHEATS: - selcheat = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LB_GETCURSEL, 0, 0); - selcheatcount = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LB_GETSELCOUNT, 0, 0); - if (selcheat < 0) break; - - FCEUI_GetCheat(selcheat,&name,&a,&v,&c,&s,NULL); - SetDlgItemText(hwndDlg,IDC_CHEAT_NAME,(LPTSTR)name); - SetDlgItemText(hwndDlg,IDC_CHEAT_ADDR,(LPTSTR)U16ToStr(a)); - SetDlgItemText(hwndDlg,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(v)); - if (c == -1) - SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); - else - SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)U8ToStr(c)); - - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_DEL),TRUE); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_UPD),TRUE); - break; case IDC_CHEAT_LIST_POSSIBILITIES: - 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); + { + 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)""); + 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_LIST_CHEATS: - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_DEL),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_UPD),FALSE); - break; case IDC_CHEAT_LIST_POSSIBILITIES: lbfocus=0; break; @@ -727,6 +762,77 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } break; + case WM_NOTIFY: + { + switch (wParam) + { + case IDC_LIST_CHEATS: + { + NMHDR* lP = (NMHDR*)lParam; + switch (lP->code) { + case LVN_ITEMCHANGED: + { + NMLISTVIEW* pNMListView = (NMLISTVIEW*)lP; + +// selcheat = pNMListView->iItem; + selcheatcount = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETSELECTEDCOUNT, 0, 0); + if (pNMListView->uNewState & LVIS_FOCUSED || + !(pNMListView->uOldState & LVIS_SELECTED) && pNMListView->uNewState & LVIS_SELECTED) + { + selcheat = pNMListView->iItem; + if (selcheat >= 0) + { + char* name = ""; uint32 a; uint8 v; int s; int c; + FCEUI_GetCheat(selcheat, &name, &a, &v, &c, &s, NULL); + SetDlgItemText(hwndDlg, IDC_CHEAT_NAME, (LPTSTR)name); + SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a)); + SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v)); + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); + } + + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_DEL), selcheatcount > 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_UPD), selcheatcount > 0); + } + + if (pNMListView->uChanged & LVIF_STATE) + // uncheck -> check + if (pNMListView->uOldState & INDEXTOSTATEIMAGEMASK(1) && + pNMListView->uNewState & INDEXTOSTATEIMAGEMASK(2)) + { + int tmpsel = pNMListView->iItem; + char* name = ""; uint32 a; uint8 v; int s; int c; + FCEUI_GetCheat(tmpsel, &name, &a, &v, &c, &s, NULL); + if (!s) + { + FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); + + UpdateCheatWindowRelatedWindow(); + UpdateCheatListGroupBoxUI(); + } + } + // check -> uncheck + else if (pNMListView->uOldState & INDEXTOSTATEIMAGEMASK(2) && + pNMListView->uNewState & INDEXTOSTATEIMAGEMASK(1)) + { + int tmpsel = pNMListView->iItem; + char* name = ""; uint32 a; uint8 v; int s; int c; + FCEUI_GetCheat(tmpsel, &name, &a, &v, &c, &s, NULL); + if (s) + { + FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); + + UpdateCheatWindowRelatedWindow(); + UpdateCheatListGroupBoxUI(); + } + } + + break; + } + } + } + break; + } + } } return 0; } @@ -746,12 +852,12 @@ void ConfigCheats(HWND hParent) if (!CheatWindow) { - selcheat=-1; - CheatWindow=1; + selcheat = -1; + CheatWindow = 1; if (CheatStyle) - pwindow = hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", NULL, CheatConsoleCallB); + pwindow = hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB); else - DialogBox(fceu_hInstance,"CHEATCONSOLE",hParent,CheatConsoleCallB); + DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB); UpdateCheatsAdded(); } else { @@ -768,30 +874,36 @@ void UpdateCheatList() ShowResults(pwindow); } -//Used by cheats and external dialogs such as hex editor to update items in the cheat search dialog -void UpdateCheatsAdded() +void UpdateCheatListGroupBoxUI() { char temp[64]; if (FrozenAddressCount < 256) { - sprintf(temp,"Active Cheats %d", FrozenAddressCount); + sprintf(temp, "Active Cheats %d", FrozenAddressCount); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), TRUE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), TRUE); - } else if (FrozenAddressCount == 256) + } + else if (FrozenAddressCount == 256) { - sprintf(temp,"Active Cheats %d (Max Limit)", FrozenAddressCount); + sprintf(temp, "Active Cheats %d (Max Limit)", FrozenAddressCount); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE); } else { - sprintf(temp,"%d Error: Too many cheats loaded!", FrozenAddressCount); + sprintf(temp, "%d Error: Too many cheats loaded!", FrozenAddressCount); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE); } - SetDlgItemText(hCheat,201,temp); + SetDlgItemText(hCheat, IDC_GROUPBOX_CHEATLIST, temp); +} + +//Used by cheats and external dialogs such as hex editor to update items in the cheat search dialog +void UpdateCheatsAdded() +{ RedoCheatsLB(hCheat); + UpdateCheatListGroupBoxUI(); } BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -887,20 +999,21 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if(GGaddr < 0x8000)GGaddr += 0x8000; - if (FCEUI_AddCheat(GGcode,GGaddr,GGval,GGcomp,1) && (hCheat != 0)) { - strcpy(str,"* "); - strcat(str,GGcode); - SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_ADDSTRING,0,(LPARAM)(LPSTR)str); - selcheat = (SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_GETCOUNT,0,0) - 1); - SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_SETCURSEL,selcheat,0); + if (FCEUI_AddCheat(GGcode, GGaddr, GGval, GGcomp, 1) && hCheat) { + RedoCheatsCallB(GGcode, GGaddr, GGval, GGcomp, 1, 1, NULL); + int newselcheat = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_GETITEMCOUNT, 0, 0) - 1; + ListView_MoveSelectionMark(GetDlgItem(hCheat, IDC_LIST_CHEATS), selcheat, newselcheat); + selcheat = newselcheat; - SetDlgItemText(hCheat,IDC_CHEAT_ADDR,(LPTSTR)U16ToStr(GGaddr)); - SetDlgItemText(hCheat,IDC_CHEAT_VAL,(LPTSTR)U8ToStr(GGval)); - if(GGcomp == -1) SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)""); - else SetDlgItemText(hwndDlg,IDC_CHEAT_COM,(LPTSTR)U8ToStr(GGcomp)); + SetDlgItemText(hCheat, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(GGaddr)); + SetDlgItemText(hCheat, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(GGval)); + if(GGcomp == -1) + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)""); + else + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(GGcomp)); - EnableWindow(GetDlgItem(hCheat,IDC_BTN_CHEAT_DEL),TRUE); - EnableWindow(GetDlgItem(hCheat,IDC_BTN_CHEAT_UPD),TRUE); + EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_DEL), TRUE); + EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), TRUE); UpdateCheatsAdded(); } } @@ -1032,22 +1145,13 @@ CPoint test = point; void DisableAllCheats() { if(FCEU_DisableAllCheats() && hCheat){ - LRESULT sel; char str[259]; - for (int tempSelCheat = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_GETCOUNT, 0, 0) - 1; tempSelCheat >= 0; --tempSelCheat) - { - SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_GETTEXT, tempSelCheat, (LPARAM)(LPCTSTR)str); - if (str[0] == '*') - { - str[0] = ' '; - sel = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_GETSEL, tempSelCheat, 0); - SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_DELETESTRING, tempSelCheat, 0); - SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_INSERTSTRING, tempSelCheat, (LPARAM)(LPSTR)str); - if (sel) - SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_SETSEL, 1, tempSelCheat); - } - } - sprintf(str, "Active Cheats %d", 0); - SetDlgItemText(hCheat, 201, str); + LVITEM lvi; + lvi.mask = LVIF_STATE; + lvi.stateMask = LVIS_STATEIMAGEMASK; + lvi.state = INDEXTOSTATEIMAGEMASK(1); + for (int current = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_GETCOUNT, 0, 0) - 1; current >= 0; --current) + SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_GETITEMSTATE, current, (LPARAM)&lvi); + UpdateCheatListGroupBoxUI(); } } diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index bd8a9f26..ee12b804 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -3,12 +3,14 @@ extern int CheatWindow,CheatStyle; //bbit edited: this line added extern HWND hCheat; +HWND InitializeCheatList(HWND hwndDlg); void RedoCheatsLB(HWND hwndDlg); void ConfigCheats(HWND hParent); void DoGGConv(); void SetGGConvFocus(int address,int compare); void UpdateCheatList(); +void UpdateCheatListGroupBoxUI(); void UpdateCheatsAdded(); extern unsigned int FrozenAddressCount; diff --git a/src/drivers/win/mapinput.cpp b/src/drivers/win/mapinput.cpp index cdd5d964..f769d9b9 100644 --- a/src/drivers/win/mapinput.cpp +++ b/src/drivers/win/mapinput.cpp @@ -23,7 +23,7 @@ else if (filter > EMUCMDTYPE_MISC && filter < EMUCMDTYPE_MAX || filter == EMUCMD else \ lpListView->iSubItem = mapInputSortCol; \ if (SendMessage(hwndListView, LVM_SORTITEMS, (WPARAM)lpListView, (LPARAM)MapInputItemSortFunc)) \ - UpdateSortColumnIcon(hwndListView, mapInputSortCol, mapInputSortAsc); + UpdateSortColumnIcon(hwndListView, mapInputSortCol, mapInputSortAsc) void KeyboardUpdateState(void); //mbg merge 7/17/06 yech had to add this @@ -768,9 +768,10 @@ BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM break; case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; case WM_DESTROY: case WM_QUIT: - EndDialog(hwndDlg, 0); break; case WM_NOTIFY: diff --git a/src/drivers/win/ram_search.cpp b/src/drivers/win/ram_search.cpp index 7127e4aa..256c8158 100644 --- a/src/drivers/win/ram_search.cpp +++ b/src/drivers/win/ram_search.cpp @@ -1078,9 +1078,6 @@ void signal_new_frame () -bool RamSearchClosed = false; -bool RamWatchClosed = false; - void ResetResults() { reset_address_info(); @@ -1093,40 +1090,27 @@ void CloseRamWindows() //Close the Ram Search & Watch windows when rom closes ResetWatches(); ResetResults(); if (RamSearchHWnd) - { SendMessage(RamSearchHWnd,WM_CLOSE,NULL,NULL); - RamSearchClosed = true; - } if (RamWatchHWnd) - { SendMessage(RamWatchHWnd,WM_CLOSE,NULL,NULL); - RamWatchClosed = true; - } } void ReopenRamWindows() //Reopen them when a new Rom is loaded { HWND hwnd = GetActiveWindow(); - if (RamSearchClosed) + if(!RamSearchHWnd) { - RamSearchClosed = false; - if(!RamSearchHWnd) - { - reset_address_info(); - LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - RamSearchHWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, (DLGPROC) RamSearchProc); - } - } - if (RamWatchClosed || AutoRWLoad) - { - RamWatchClosed = false; - if(!RamWatchHWnd) - { - if (AutoRWLoad) OpenRWRecentFile(0); - RamWatchHWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); - } + reset_address_info(); + LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + RamSearchHWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_RAMSEARCH), hWnd, (DLGPROC) RamSearchProc); } + if (AutoRWLoad) + OpenRWRecentFile(0); + + if (!RamWatchHWnd) + RamWatchHWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_RAMWATCH), hWnd, (DLGPROC) RamWatchProc); + if (hwnd == hWnd && hwnd != GetActiveWindow()) SetActiveWindow(hWnd); // restore focus to the main window if it had it before } @@ -2045,15 +2029,6 @@ invalid_field: signal_new_size(); {rv = true; break;} } - //case IDOK: - case IDCANCEL: - RamSearchHWnd = NULL; -/* if (theApp.pauseDuringCheatSearch) - EndDialog(hDlg, true); // this should never be called on a modeless dialog - else -*/ - DestroyWindow(hDlg); - {rv = true; break;} } // check refresh for comparison preview color update @@ -2097,12 +2072,12 @@ invalid_field: return rv; } break; - -// case WM_CLOSE: + case WM_CLOSE: + DestroyWindow(hDlg); + break; case WM_DESTROY: RamSearchHWnd = NULL; // theApp.modelessCheatDialogIsOpen = false; -// return true; break; } diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index c26eb228..6a1c27dd 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -34,7 +34,7 @@ bool RWSaveWindowPos = false; //Keeps track of whether Save Window position is c char currentWatch[1024]; int ramw_x, ramw_y; //Used to store ramwatch dialog window positions std::map rswatches; -int WatchCount=0; +int WatchCount = 0; char applicationPath[2048]; struct InitRamWatch @@ -129,7 +129,6 @@ bool InsertWatch(const AddressWatcher& Watch) } - /* LRESULT CALLBACK PromptWatchNameProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) //Gets the description of a watched address { @@ -1021,7 +1020,8 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam //regSetDwordValue(RAMWY, ramw_y); TODO } break; - case WM_INITDIALOG: { + case WM_INITDIALOG: + { RECT r, r2; int dx1, dy1, dx2, dy2; @@ -1126,7 +1126,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam { case LVN_ITEMCHANGED: // selection changed event { - NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lP; + NMLISTVIEW* pNMListView = (NMLISTVIEW*)lP; if(pNMListView->uNewState & LVIS_FOCUSED || (pNMListView->uNewState ^ pNMListView->uOldState) & LVIS_SELECTED) @@ -1493,12 +1493,9 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam return true; } break; -// case WM_CLOSE: -// RamWatchHWnd = NULL; -// DragAcceptFiles(hDlg, FALSE); -// DestroyWindow(hDlg); -// return false; - + case WM_CLOSE: + DestroyWindow(hDlg); + break; case WM_DESTROY: // this is the correct place RamWatchHWnd = NULL; @@ -1507,7 +1504,6 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam // release the hdc related objects SeparatorCache::DeInit(); - break; case WM_DROPFILES: @@ -1532,22 +1528,33 @@ void UpdateWatchCheats() { void SeparatorCache::Init(HWND hBox) { - RECT ir; - ir.left = LVIR_BOUNDS; + if (!iHeight) + { + RECT ir; + ir.left = LVIR_BOUNDS; - int count = SendMessage(hBox, LVM_GETITEMCOUNT, 0, 0); - SendMessage(hBox, LVM_SETITEMCOUNT, 1, 0); - SendMessage(hBox, LVM_GETITEMRECT, 0, (LPARAM)&ir); - SendMessage(hBox, LVM_SETITEMCOUNT, count, 0); + int count = SendMessage(hBox, LVM_GETITEMCOUNT, 0, 0); + SendMessage(hBox, LVM_SETITEMCOUNT, 1, 0); + SendMessage(hBox, LVM_GETITEMRECT, 0, (LPARAM)&ir); + SendMessage(hBox, LVM_SETITEMCOUNT, count, 0); - sepOffY = (iHeight = ir.bottom - ir.top) / 2; + iHeight = ir.bottom - ir.top; + } - sepPen = CreatePen(PS_SOLID, 1, RGB(160, 160, 160)); - sepPenSel = CreatePen(PS_SOLID, 1, RGB(224, 224, 224)); + if (!sepOffY) + sepOffY = iHeight / 2; - LOGFONT logFont; - GetObject((HANDLE)SendMessage(hBox, WM_GETFONT, NULL, NULL), sizeof(logFont), &logFont); - sepFon = (HFONT)CreateFontIndirect((logFont.lfWeight = FW_SEMIBOLD, &logFont)); + if (!sepPen) + sepPen = CreatePen(PS_SOLID, 1, RGB(160, 160, 160)); + if (!sepPenSel) + sepPenSel = CreatePen(PS_SOLID, 1, RGB(224, 224, 224)); + + if (!sepFon) + { + LOGFONT logFont; + GetObject((HANDLE)SendMessage(hBox, WM_GETFONT, NULL, NULL), sizeof(logFont), &logFont); + sepFon = (HFONT)CreateFontIndirect((logFont.lfWeight = FW_SEMIBOLD, &logFont)); + } } void SeparatorCache::DeInit() @@ -1555,6 +1562,10 @@ void SeparatorCache::DeInit() DeleteObject(sepPen); DeleteObject(sepPenSel); DeleteObject(sepFon); + + sepPen = NULL; + sepPenSel = NULL; + sepFon = NULL; } diff --git a/src/drivers/win/ramwatch.h b/src/drivers/win/ramwatch.h index b5b95930..0d1ce60c 100644 --- a/src/drivers/win/ramwatch.h +++ b/src/drivers/win/ramwatch.h @@ -59,8 +59,9 @@ extern HWND RamWatchHWnd; extern HACCEL RamWatchAccels; bool InsertWatch(const AddressWatcher& Watch); -bool InsertWatch(const AddressWatcher& Watch, HWND parent); // asks user for comment) -bool EditWatch(int watchIndex, AddressWatcher& watcher); +bool InsertWatch(const AddressWatcher& Watch, HWND parent); // asks user for comment +bool InsertWatch(int watchIndex, const AddressWatcher& watcher); +bool EditWatch(int watchIndex, const AddressWatcher& watcher); bool RemoveWatch(int watchIndex); void Update_RAM_Watch(); diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index 6baf6221..5013ce50 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -957,6 +957,23 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP { case IDOK: { + extern unsigned int FrozenAddressCount; + if (FrozenAddressCount) + { + char ch[512]; + sprintf(ch, "You have %d activated cheats. If this is not your intentional, it can cause playback prblems! Do you want to disable all of them and continue?", FrozenAddressCount); + switch (MessageBox(hwndDlg, ch, "Movie recording problem", MB_YESNOCANCEL | MB_ICONEXCLAMATION)) + { + case IDCANCEL: + return TRUE; + case IDYES: + extern void DisableAllCheats(); + DisableAllCheats(); + extern void UpdateCheatWindowRelatedWindow(); + UpdateCheatWindowRelatedWindow(); + } + } + LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0); p->szFilename = GetRecordPath(hwndDlg); p->recordFrom = (int)lIndex; diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 7bfd47a8..8db6568c 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -12,11 +12,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// +// ·ÇÌض¨ÓïÑÔ resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) +#pragma code_page(936) ///////////////////////////////////////////////////////////////////////////// // @@ -633,7 +633,7 @@ CHEATCONTEXTMENUS MENU BEGIN POPUP "CheatListPopup" BEGIN - MENUITEM "Toggle selected Cheats\tDbl-Clk", CHEAT_CONTEXT_TOGGLECHEAT + 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 @@ -1966,46 +1966,46 @@ BEGIN LTEXT "New Selection Name:",-1,5,240,68,8 END -CHEATCONSOLE DIALOGEX 0, 0, 379, 189 +CHEATCONSOLE DIALOGEX 0, 0, 420, 190 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",201,5,2,129,182,WS_TABSTOP - GROUPBOX "Cheat Search",202,140,2,233,182,WS_TABSTOP - LISTBOX IDC_LIST_CHEATS,11,11,118,98,LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL - LTEXT "Name:",IDC_STATIC,12,114,22,10 - LTEXT "Addr:",IDC_STATIC,12,130,18,10 - LTEXT "Val:",IDC_STATIC,61,130,12,10 - LTEXT "Cmp:",IDC_STATIC,95,130,16,10 - EDITTEXT IDC_CHEAT_NAME,35,112,94,12,ES_AUTOHSCROLL | ES_WANTRETURN - EDITTEXT IDC_CHEAT_ADDR,31,128,25,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_CHEAT_VAL,74,128,16,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_CHEAT_COM,113,128,16,12,ES_UPPERCASE | ES_WANTRETURN - DEFPUSHBUTTON "Add",IDC_BTN_CHEAT_ADD,11,144,36,16 - PUSHBUTTON "Delete",IDC_BTN_CHEAT_DEL,52,144,36,16 - PUSHBUTTON "Update",IDC_BTN_CHEAT_UPD,93,144,36,16 - PUSHBUTTON "Reset",IDC_BTN_CHEAT_RESET,146,12,55,15 - PUSHBUTTON "Known Value:",IDC_BTN_CHEAT_KNOWN,146,31,55,15 - LTEXT "0x",IDC_STATIC,205,34,9,8 - EDITTEXT IDC_CHEAT_VAL_KNOWN,215,32,18,12,ES_UPPERCASE - GROUPBOX "Previous Compare",204,145,49,113,115 - PUSHBUTTON "Equal",IDC_BTN_CHEAT_EQ,151,62,55,15,WS_GROUP - PUSHBUTTON "Not Equal",IDC_BTN_CHEAT_NE,151,87,55,15 - CONTROL "By:",IDC_CHEAT_CHECK_NE_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,90,22,10 - EDITTEXT IDC_CHEAT_VAL_NE_BY,234,89,18,12,ES_UPPERCASE | ES_WANTRETURN - PUSHBUTTON "Greater Than",IDC_BTN_CHEAT_GT,151,114,55,15 - CONTROL "By:",IDC_CHEAT_CHECK_GT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,117,22,10 - EDITTEXT IDC_CHEAT_VAL_GT_BY,234,116,18,12,ES_UPPERCASE | ES_WANTRETURN - PUSHBUTTON "Less Than",IDC_BTN_CHEAT_LT,151,141,55,15 - CONTROL "By:",IDC_CHEAT_CHECK_LT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,144,22,10 - EDITTEXT IDC_CHEAT_VAL_LT_BY,234,143,18,12,ES_UPPERCASE | ES_WANTRETURN - GROUPBOX "Possibilities",IDC_CHEAT_BOX_POSSIBILITIES,263,8,105,156,WS_TABSTOP - LISTBOX IDC_CHEAT_LIST_POSSIBILITIES,268,18,85,142,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_TABSTOP - SCROLLBAR IDC_CHEAT_SCRL_POSSIBILITIES,354,18,10,142,SBS_VERT + 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 + 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 CONTROL " Pause emulation when this window is active",IDC_CHEAT_PAUSEWHENACTIVE, - "Button",BS_AUTOCHECKBOX,147,169,157,10 - PUSHBUTTON "Add from CHT file...",IDC_BTN_CHEAT_ADDFROMFILE,23,163,93,16 + "Button",BS_AUTOCHECKBOX,188,169,157,10 + PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,127,163,43,16 END IDD_LUA DIALOGEX 0, 0, 270, 150 @@ -2142,7 +2142,7 @@ END IDD_RAMWATCH DIALOGEX 0, 0, 269, 298 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " RAM Watch" +CAPTION "RAM Watch" MENU RAMWATCH_MENU FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -2425,7 +2425,8 @@ BEGIN "CHEATCONSOLE", DIALOG BEGIN - BOTTOMMARGIN, 188 + RIGHTMARGIN, 419 + BOTTOMMARGIN, 189 END "VIDEOCONFIG", DIALOG @@ -2499,6 +2500,11 @@ BEGIN 0 END +CHEATCONSOLE AFX_DIALOG_LAYOUT +BEGIN + 0 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -2670,12 +2676,12 @@ 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 // ·ÇÌض¨ÓïÑÔ resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// English(U.S.) resources +// Ó¢Óï(ÃÀ¹ú) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -2704,7 +2710,7 @@ END #endif // APSTUDIO_INVOKED -#endif // English(U.S.) resources +#endif // Ó¢Óï(ÃÀ¹ú) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index a94b891b..e8f30292 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -238,6 +238,7 @@ #define IDC_DEBUGGER_FLAG_N 200 #define IDC_ADDBP_ADDR_START 200 #define MENU_POWER 201 +#define IDC_GROUPBOX_CHEATLIST 201 #define TXT_PAD2 201 #define IDC_BUTTON_BROWSEFILE 201 #define IDC_CHECK_READONLY 201 @@ -260,6 +261,7 @@ #define IDC_ADDBP_CONDITION 202 #define IDC_ASSEMBLER_SAVE 202 #define IDD_TASEDITOR_NEWPROJECT 202 +#define IDC_GROUPBOX_CHEATSEARCH 202 #define MENU_SWITCH_DISK 203 #define IDC_NETMOO_NICK 203 #define IDC_CHEAT_BOX_POSSIBILITIES 203 diff --git a/src/fceu.cpp b/src/fceu.cpp index b515b70f..52376f8f 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -114,10 +114,6 @@ bool AutoResumePlay = false; char romNameWhenClosingEmulator[2048] = {0}; -// indicator for the open in archive dialog that if the load was canceled by the user. -// TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. -bool archiveManuallyCanceled = false; - FCEUGI::FCEUGI() : filename(0), archiveFilename(0) { @@ -404,9 +400,6 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode); int FDSLoad(const char *name, FCEUFILE *fp); int NSFLoad(const char *name, FCEUFILE *fp); -//char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron -extern bool archiveManuallyCanceled; - //name should be UTF-8, hopefully, or else there may be trouble FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silent) { @@ -418,16 +411,18 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen int lastdendy = dendy; const char* romextensions[] = { "nes", "fds", 0 }; - fp = FCEU_fopen(name, 0, "rb", 0, -1, romextensions); + + // indicator for if the operaton was canceled by user + // currently there's only one situation: + // the user clicked cancel form the open from archive dialog + bool userCancel = false; + fp = FCEU_fopen(name, 0, "rb", 0, -1, romextensions, &userCancel); if (!fp) { // Although !fp, if the operation was canceled from archive select dialog box, don't show the error message; - if (!silent && !archiveManuallyCanceled) + if (!silent && !userCancel) FCEU_PrintError("Error opening \"%s\"!", name); - // Set it back to false, since user might not load ROM from dialog the next time. - // TODO: find a better way to do this. - archiveManuallyCanceled = false; return 0; } diff --git a/src/file.cpp b/src/file.cpp index 3ef0bf6a..04d943f2 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -256,7 +256,7 @@ zpfail: return 0; } -FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext, int index, const char** extensions) +FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext, int index, const char** extensions, bool* userCancel) { FILE *ipsfile=0; FCEUFILE *fceufp=0; @@ -360,11 +360,11 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext //open an archive file if(archive == "") if(index != -1) - fceufp = FCEUD_OpenArchiveIndex(asr, fileToOpen, index); + fceufp = FCEUD_OpenArchiveIndex(asr, fileToOpen, index, userCancel); else - fceufp = FCEUD_OpenArchive(asr, fileToOpen, 0); + fceufp = FCEUD_OpenArchive(asr, fileToOpen, 0, userCancel); else - fceufp = FCEUD_OpenArchive(asr, archive, &fname); + fceufp = FCEUD_OpenArchive(asr, archive, &fname, userCancel); if(!fceufp) return 0; diff --git a/src/file.h b/src/file.h index 5a6a5d4a..3b85639f 100644 --- a/src/file.h +++ b/src/file.h @@ -11,11 +11,6 @@ extern bool bindSavestate; -// indicator for the open in archive dialog that if the load was canceled by the user. -// TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. -extern bool archiveManuallyCanceled; - - struct FCEUFILE { //the stream you can use to access the data //std::iostream *stream; @@ -127,7 +122,7 @@ struct ArchiveScanRecord }; -FCEUFILE *FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext, int index=-1, const char** extensions = 0); +FCEUFILE *FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext, int index=-1, const char** extensions = 0, bool* userCancel = NULL); bool FCEU_isFileInArchive(const char *path); int FCEU_fclose(FCEUFILE*); uint64 FCEU_fread(void *ptr, size_t size, size_t nmemb, FCEUFILE*); From f0859ce1e35f3cb9d70d69f9f20939e816c32a17 Mon Sep 17 00:00:00 2001 From: owomomo Date: Thu, 2 May 2019 03:15:57 +0800 Subject: [PATCH 02/10] detail --- src/drivers/win/res.rc | 10 +++++----- src/drivers/win/resource.h | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 8db6568c..1e269a20 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -12,11 +12,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// ·ÇÌض¨ÓïÑÔ resources +// #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(936) +#pragma code_page(1252) ///////////////////////////////////////////////////////////////////////////// // @@ -2676,12 +2676,12 @@ 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 // ·ÇÌض¨ÓïÑÔ resources +#endif ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// Ó¢Óï(ÃÀ¹ú) resources +// English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -2710,7 +2710,7 @@ END #endif // APSTUDIO_INVOKED -#endif // Ó¢Óï(ÃÀ¹ú) resources +#endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index e8f30292..e7984edd 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -1,7 +1,3 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ Éú³ÉµÄ°üº¬Îļþ¡£ -// ¹© res.rc ʹÓà -// #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 #define BTN_CLOSE 1 From 9adcbf16cbdba87ae3290d49c8c4d806b879652a Mon Sep 17 00:00:00 2001 From: owomomo Date: Wed, 8 May 2019 13:55:53 +0800 Subject: [PATCH 03/10] 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. --- src/cheat.cpp | 49 +--- src/cheat.h | 7 + src/drivers/win/cheat.cpp | 498 ++++++++++++++++++--------------- src/drivers/win/cheat.h | 17 ++ src/drivers/win/mapinput.cpp | 9 +- src/drivers/win/memview.cpp | 9 +- src/drivers/win/ram_search.cpp | 38 +-- src/drivers/win/ram_search.h | 1 - src/drivers/win/ramwatch.cpp | 248 ++++++++-------- src/drivers/win/ramwatch.h | 25 +- src/drivers/win/res.rc | 90 +++--- src/drivers/win/resource.h | 21 +- src/drivers/win/window.cpp | 2 +- src/fceu.cpp | 5 +- src/state.cpp | 1 + 15 files changed, 537 insertions(+), 483 deletions(-) diff --git a/src/cheat.cpp b/src/cheat.cpp index fbdd901b..3dc6aa2e 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -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 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 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 (scrollindexscrollmax) 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; diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index ee12b804..895cd969 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -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 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)"")) + diff --git a/src/drivers/win/mapinput.cpp b/src/drivers/win/mapinput.cpp index f769d9b9..131740bb 100644 --- a/src/drivers/win/mapinput.cpp +++ b/src/drivers/win/mapinput.cpp @@ -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"; diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index a6c2cc0a..2bcf7e4b 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -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) diff --git a/src/drivers/win/ram_search.cpp b/src/drivers/win/ram_search.cpp index 256c8158..1167e883 100644 --- a/src/drivers/win/ram_search.cpp +++ b/src/drivers/win/ram_search.cpp @@ -32,9 +32,9 @@ #include "../../cheat.h" #include "resource.h" +#include "cheat.h" #include "ram_search.h" #include "ramwatch.h" -#include "cheat.h" #include #include #include @@ -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;} } diff --git a/src/drivers/win/ram_search.h b/src/drivers/win/ram_search.h index 991f22b7..122fa82c 100644 --- a/src/drivers/win/ram_search.h +++ b/src/drivers/win/ram_search.h @@ -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); diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index 6a1c27dd..51cbba3d 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -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 #include #include @@ -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; } diff --git a/src/drivers/win/ramwatch.h b/src/drivers/win/ramwatch.h index 0d1ce60c..b93981ac 100644 --- a/src/drivers/win/ramwatch.h +++ b/src/drivers/win/ramwatch.h @@ -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); diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 1e269a20..e1cb83ae 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -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 ///////////////////////////////////////////////////////////////////////////// diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index e7984edd..c94445c3 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -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 diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 826c775b..0e4b684a 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -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" diff --git a/src/fceu.cpp b/src/fceu.cpp index 52376f8f..9ad47bd7 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -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(); diff --git a/src/state.cpp b/src/state.cpp index 0f22f90f..a1df612b 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -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 From 885bc1e889d35ac7a5d58c113b2bca15e315eb02 Mon Sep 17 00:00:00 2001 From: owomomo Date: Wed, 8 May 2019 17:24:45 +0800 Subject: [PATCH 04/10] 1. Fix freeze ram in Hex Editor doesn't refresh the related window. 2. detail --- src/drivers/win/cheat.cpp | 23 ++++++++++++----------- src/drivers/win/cheat.h | 2 +- src/drivers/win/memview.cpp | 1 + src/drivers/win/ram_search.cpp | 25 +++++++++++++------------ src/drivers/win/ramwatch.cpp | 2 ++ src/drivers/win/replay.cpp | 8 ++++---- src/fceu.cpp | 6 +++++- 7 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 87a95693..0563a978 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -459,7 +459,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tmpsel = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETNEXTITEM, tmpsel, LVNI_ALL | LVNI_SELECTED); } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } break; @@ -496,7 +496,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l selcheat = newselcheat; } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -581,7 +581,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ClearCheatListText(hwndDlg); } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); break; } @@ -606,7 +606,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ClearCheatListText(hwndDlg); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } else { @@ -616,7 +616,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l selcheat = -1; ClearCheatListText(hwndDlg); } - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } break; @@ -661,7 +661,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)""); else SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(c)); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); // UpdateCheatAdded(); break; @@ -690,8 +690,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (file) { FCEU_LoadGameCheats(file, 0); - UpdateCheatWindowRelatedWindow(); UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); savecheats = 1; } } @@ -801,7 +801,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -816,7 +816,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -907,6 +907,7 @@ void ConfigCheats(HWND hParent) else DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB); UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); } else { ShowWindow(hCheat, SW_SHOWNORMAL); @@ -1063,7 +1064,7 @@ 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); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } } @@ -1205,7 +1206,7 @@ void DisableAllCheats() } } -void UpdateCheatWindowRelatedWindow() +void UpdateCheatRelatedWindow() { // hex editor if (hMemView) diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index 895cd969..7a24a5d7 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -22,7 +22,7 @@ extern std::vector FrozenAddresses; void DisableAllCheats(); -void UpdateCheatWindowRelatedWindow(); +void UpdateCheatRelatedWindow(); // deselect the old one and select the new one #define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \ diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 2bcf7e4b..baeb1892 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -951,6 +951,7 @@ void FreezeRam(int address, int mode, int final){ //} UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); } } diff --git a/src/drivers/win/ram_search.cpp b/src/drivers/win/ram_search.cpp index 1167e883..a2e38a0c 100644 --- a/src/drivers/win/ram_search.cpp +++ b/src/drivers/win/ram_search.cpp @@ -1819,22 +1819,23 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // Don't open cheat dialog switch (sizeType) { - case 0: { - FCEUI_AddCheat("",address,curvalue,-1,1); - break; } - case 1: { + case 0: + FCEUI_AddCheat("",address,curvalue, -1, 1); + break; + case 1: + FCEUI_AddCheat("",address,curvalue & 0xFF, -1, 1); + FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100, -1, 1); + break; + case 2: FCEUI_AddCheat("",address,curvalue & 0xFF,-1,1); - FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100,-1,1); - break; } - case 2: { - FCEUI_AddCheat("",address,curvalue & 0xFF,-1,1); - FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100,-1,1); - FCEUI_AddCheat("",address + 2,(curvalue & 0xFF0000) / 0x10000,-1,1); - FCEUI_AddCheat("",address + 3,(curvalue & 0xFF000000) / 0x1000000,-1,1); - break; } + FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100, -1, 1); + FCEUI_AddCheat("",address + 2,(curvalue & 0xFF0000) / 0x10000, -1, 1); + FCEUI_AddCheat("",address + 3,(curvalue & 0xFF000000) / 0x1000000, -1, 1); + break; } UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED); diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index 51cbba3d..b03bf055 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -1442,8 +1442,10 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam FCEUI_AddCheat("", address + 3, (rswatches[watchIndex].CurValue & 0xFF000000) / 0x1000000, -1, 1); break; } + UpdateCheatsAdded(); UpdateCheatWindowRelatedWindow(); + } else MessageBox(hDlg, "Sorry, you can't add cheat to a separator.", "Ram Watch", MB_ICONERROR | MB_OK); diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index 5013ce50..d2fb74a2 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -731,8 +731,8 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP case IDYES: extern void DisableAllCheats(); DisableAllCheats(); - extern void UpdateCheatWindowRelatedWindow(); - UpdateCheatWindowRelatedWindow(); + extern void UpdateCheatRelatedWindow(); + UpdateCheatRelatedWindow(); } } @@ -969,8 +969,8 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case IDYES: extern void DisableAllCheats(); DisableAllCheats(); - extern void UpdateCheatWindowRelatedWindow(); - UpdateCheatWindowRelatedWindow(); + extern void UpdateCheatRelatedWindow(); + UpdateCheatRelatedWindow(); } } diff --git a/src/fceu.cpp b/src/fceu.cpp index 9ad47bd7..991b054a 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -556,7 +556,11 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen DoDebuggerDataReload(); // Reloads data without reopening window CDLoggerROMChanged(); if (hMemView) UpdateColorTable(); - if (hCheat) UpdateCheatsAdded(); + if (hCheat) + { + UpdateCheatsAdded(); + UpdateCheatRelatedWindow(); + } if (FrozenAddressCount) FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount); #endif From 07f0c1af2c7240dfd72907bae346debf103fcd33 Mon Sep 17 00:00:00 2001 From: owomomo Date: Wed, 8 May 2019 21:05:43 +0800 Subject: [PATCH 05/10] 1. Fix go to hex editor in possiblilities list doesn't select the address. 2. Detail. --- src/drivers/win/cheat.cpp | 25 +++++++++++++++---------- src/drivers/win/memview.cpp | 6 ------ src/drivers/win/ramwatch.cpp | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 0563a978..ba3f0fdc 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -447,10 +447,11 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l lvi.mask = LVIF_STATE; lvi.stateMask = LVIS_STATEIMAGEMASK; int tmpsel = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_GETNEXTITEM, -1, LVNI_ALL | LVNI_SELECTED); + + char* name = ""; int s; while (tmpsel != -1) { - char* name = ""; uint32 a = 0; uint8 v = 0; int s = 0; int c = 0; - FCEUI_GetCheat(tmpsel, &name, &a, &v, &c, &s, NULL); + FCEUI_GetCheat(tmpsel, &name, NULL, NULL, NULL, &s, NULL); FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); lvi.iItem = tmpsel; @@ -459,22 +460,23 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tmpsel = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETNEXTITEM, tmpsel, LVNI_ALL | LVNI_SELECTED); } + UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } break; case CHEAT_CONTEXT_LIST_POKECHEATVALUE: { - char* name = ""; uint32 a; uint8 v; int s; - FCEUI_GetCheat(selcheat, &name, &a, &v, NULL, &s, NULL); + uint32 a; uint8 v; + FCEUI_GetCheat(selcheat, NULL, &a, &v, NULL, NULL, NULL); BWrite[a](a, v); } break; case CHEAT_CONTEXT_LIST_GOTOINHEXEDITOR: { + uint32 a; + FCEUI_GetCheat(selcheat, NULL, &a, NULL, NULL, NULL, NULL); DoMemView(); - char* name = ""; uint32 a; uint8 v; int s; - FCEUI_GetCheat(selcheat, &name, &a, &v, NULL, &s, NULL); SetHexEditorAddress(a); } break; @@ -532,7 +534,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l { int sel = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETSELECTIONMARK, 0, 0); if (sel != -1) + { + DoMemView(); SetHexEditorAddress(possiList[sel].addr); + } } break; case IDC_CHEAT_PAUSEWHENACTIVE: @@ -795,8 +800,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l pNMListView->uNewState & INDEXTOSTATEIMAGEMASK(2)) { int tmpsel = pNMListView->iItem; - char* name = ""; uint32 a; uint8 v; int s; int c; - FCEUI_GetCheat(tmpsel, &name, &a, &v, &c, &s, NULL); + char* name = ""; int s; + FCEUI_GetCheat(tmpsel, &name, NULL, NULL, NULL, &s, NULL); if (!s) { FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); @@ -810,8 +815,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l pNMListView->uNewState & INDEXTOSTATEIMAGEMASK(1)) { int tmpsel = pNMListView->iItem; - char* name = ""; uint32 a; uint8 v; int s; int c; - FCEUI_GetCheat(tmpsel, &name, &a, &v, &c, &s, NULL); + char* name = ""; int s; + FCEUI_GetCheat(tmpsel, &name, NULL, NULL, NULL, &s, NULL); if (s) { FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1); diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index baeb1892..fedd28b1 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -944,12 +944,6 @@ void FreezeRam(int address, int mode, int final){ FCEUI_AddCheat("", address, GetMem(address), -1, 1); } - //if (final) - //{ - //if(hCheat)RedoCheatsLB(hCheat); - UpdateColorTable(); - //} - UpdateCheatsAdded(); UpdateCheatRelatedWindow(); } diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index b03bf055..489f32ae 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -1444,7 +1444,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam } UpdateCheatsAdded(); - UpdateCheatWindowRelatedWindow(); + UpdateCheatRelatedWindow(); } else From 0713de844c77ba048a2058e458a262b31cc3bf99 Mon Sep 17 00:00:00 2001 From: owomomo Date: Fri, 10 May 2019 02:17:16 +0800 Subject: [PATCH 06/10] 1. New cheat list box 0.0.0.4 Alpha, separated the normal cheat adding method and the cheat code/game genie method. While you're inputting the values, they are synced to the formatted string which is very convinience. In the past, the game genie was added from the name edit control, now the name is separated and the code can have a name even if it's a game genie. 2. Solved a problem of the add/editing watch dialog when pop up repeatedly from multiple places, because there are 3 places can pop up it now. 3. Fixed a bug when loading cheats from file crashes the emulator. 4. Detail. --- src/cheat.cpp | 4 +- src/drivers/win/cheat.cpp | 293 ++++++++++++++++++++--------------- src/drivers/win/cheat.h | 6 +- src/drivers/win/ramwatch.cpp | 59 ++++--- src/drivers/win/ramwatch.h | 5 + src/drivers/win/res.rc | 86 +++++----- src/drivers/win/resource.h | 16 +- 7 files changed, 274 insertions(+), 195 deletions(-) diff --git a/src/cheat.cpp b/src/cheat.cpp index 3dc6aa2e..031f0c04 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -189,8 +189,8 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing) unsigned int compare; int x; - char linebuf[2048]; - char namebuf[128]; + char linebuf[2048] = { 0 }; + char namebuf[128] = { 0 }; int tc = 0; char *fn; diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index ba3f0fdc..8327f3a9 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -31,7 +31,7 @@ static HWND pwindow = 0; //Handle to Cheats dialog HWND hCheat = 0; //mbg merge 7/19/06 had to add -static HMENU hCheatcontext; //Handle to cheat context menu +HMENU hCheatcontext = 0; //Handle to cheat context menu bool pauseWhileActive = false; //For checkbox "Pause while active" extern bool wasPausedByCheats; @@ -67,7 +67,7 @@ char GGcode[10]; int GGlist[GGLISTSIZE]; static int dontupdateGG; //this eliminates recursive crashing -bool dodecode; +// bool dodecode; HWND hGGConv; @@ -106,15 +106,7 @@ char *U8ToStr(uint8 a) int RedoCheatsCallB(char *name, uint32 a, uint8 v, int c, int s, int type, void* data) { char str[256] = { 0 }; - - if(a >= 0x8000) - EncodeGG(str, a, v, c); - else { - if(c == -1) - sprintf(str, "%04X:%02X", (int)a, (int)v); - else - sprintf(str, "%04X?%02X:%02X", (int)a, (int)c, (int)v); - } + GetCheatStr(str, a, v, c); LVITEM lvi = { 0 }; lvi.mask = LVIF_TEXT; @@ -255,12 +247,20 @@ int ShowResults(HWND hwndDlg, bool supressUpdate = false) void EnableCheatButtons(HWND hwndDlg, int enable) { - EnableWindow(GetDlgItem(hwndDlg,IDC_CHEAT_VAL_KNOWN),enable); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_KNOWN),enable); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_EQ),enable); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_NE),enable); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_GT),enable); - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_CHEAT_LT),enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_KNOWN), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_LABEL_KNOWN), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_EQ), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_NE), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_CHECK_NE_BY), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_NE_BY), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_GT), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_CHECK_GT_BY), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_GT_BY), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_LT), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_CHECK_LT_BY), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_LT_BY), enable); + } HWND InitializeCheatList(HWND hwnd) @@ -313,6 +313,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_NE_BY, WM_SETFONT, (WPARAM)hNewFont, FALSE); SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_GT_BY, WM_SETFONT, (WPARAM)hNewFont, FALSE); SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_LT_BY, WM_SETFONT, (WPARAM)hNewFont, FALSE); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_TEXT, WM_SETFONT, (WPARAM)hNewFont, FALSE); //text limits SendDlgItemMessage(hwndDlg, IDC_CHEAT_ADDR, EM_SETLIMITTEXT, 4, 0); @@ -323,15 +324,16 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_NE_BY, EM_SETLIMITTEXT, 2, 0); SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_GT_BY, EM_SETLIMITTEXT, 2, 0); SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_LT_BY, EM_SETLIMITTEXT, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_CHEAT_TEXT, EM_SETLIMITTEXT, 10, 0); //disable or enable buttons - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), FALSE); + CheckDlgButton(hwndDlg, IDC_RADIO_ADDRESS, MF_CHECKED); possiTotalCount = 0; possiItemCount = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETCOUNTPERPAGE, 0, 0); - EnableCheatButtons(hwndDlg, possiTotalCount != 0); ShowResults(hwndDlg); + EnableCheatButtons(hwndDlg, possiTotalCount != 0); //add header for cheat list and possibilities InitializeCheatList(hwndDlg); @@ -427,13 +429,11 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l 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; @@ -552,33 +552,11 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break; case IDC_BTN_CHEAT_ADD: { - char str[256] = { 0 }; - uint32 a = 0; - uint8 v = 0; - int c = 0; - dodecode = true; + char name[256] = { 0 }; uint32 a; uint8 v = 0; int c = 0; + GetUICheatInfo(hwndDlg, name, &a, &v, &c); - GetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, str, 5); - if(str[0] != 0) - dodecode = false; - a = StrToU16(str); - GetDlgItemText(hwndDlg, IDC_CHEAT_VAL, str, 3); - if(str[0] != 0) - dodecode = false; - v = StrToU8(str); - GetDlgItemText(hwndDlg,IDC_CHEAT_COM, str, 3); - if(str[0] != 0) - dodecode = false; - c = (str[0] == 0) ? -1 : StrToU8(str); - GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, str, 256); - if(dodecode && (strlen(str) == 6 || strlen(str) == 8)) - if(FCEUI_DecodeGG(str, &GGaddr, &GGval, &GGcomp)) { - a = GGaddr; - v = GGval; - c = GGcomp; - } - if (FCEUI_AddCheat(str, a, v, c, 1)) { - RedoCheatsCallB(str, a, v, c, 1, 1, NULL); + if (FCEUI_AddCheat(name, a, v, c, 1)) { + RedoCheatsCallB(name, a, v, c, 1, 1, NULL); int newselcheat = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETITEMCOUNT, 0, 0) - 1; ListView_MoveSelectionMark(GetDlgItem(hwndDlg, IDC_LIST_CHEATS), selcheat, newselcheat); @@ -628,35 +606,14 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDC_BTN_CHEAT_UPD: { selcheat = SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_GETSELECTIONMARK, 0, 0); - - dodecode = true; - char str[256] = { 0 }; - char* name = ""; uint32 a; uint8 v; int s; int c; - if (selcheat < 0) break; - GetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, str, 5); - if (str[0] != 0) - dodecode = false; - a = StrToU16(str); - GetDlgItemText(hwndDlg, IDC_CHEAT_VAL, str, 3); - if (str[0] != 0) - dodecode = false; - v = StrToU8(str); - GetDlgItemText(hwndDlg, IDC_CHEAT_COM, str, 3); - if (str[0] != 0) - dodecode = false; - c = (str[0] == 0) ? -1 : StrToU8(str); - GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, str, 256); - if (dodecode && (strlen(str) == 6 || strlen(str) == 8)) { - if (FCEUI_DecodeGG(str, &GGaddr, &GGval, &GGcomp)) { - a = GGaddr; - v = GGval; - c = GGcomp; - } - } - FCEUI_SetCheat(selcheat, str, a, v, c, -1, 1); - FCEUI_GetCheat(selcheat, &name, &a, &v, &c, &s, NULL); + + char name[256]; uint32 a; uint8 v; int s; int c; + GetUICheatInfo(hwndDlg, name, &a, &v, &c); + + FCEUI_SetCheat(selcheat, name, a, v, c, -1, 1); + FCEUI_GetCheat(selcheat, NULL, &a, &v, &c, &s, NULL); RedoCheatsCallB(name, a, v, c, s, 1, &selcheat); SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_SETSELECTIONMARK, 0, selcheat); @@ -700,8 +657,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l savecheats = 1; } } - break; } + break; case IDC_BTN_CHEAT_RESET: FCEUI_CheatSearchBegin(); ShowResults(hwndDlg); @@ -715,8 +672,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l knownvalue = StrToU8(str); FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_KNOWN, knownvalue, 0); ShowResults(hwndDlg); - break; } + break; case IDC_BTN_CHEAT_EQ: searchdone = 1; FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE,0,0); @@ -732,8 +689,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } else FCEUI_CheatSearchEnd(FCEU_SEARCH_ANY_CHANGE, 0, 0); ShowResults(hwndDlg); - break; } + break; case IDC_BTN_CHEAT_GT: { char str[256] = { 0 }; @@ -744,8 +701,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } else FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_GT, 0, 0); ShowResults(hwndDlg); - break; } + break; case IDC_BTN_CHEAT_LT: { char str[256] = { 0 }; @@ -756,10 +713,63 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } else FCEUI_CheatSearchEnd(FCEU_SEARCH_NEWVAL_LT, 0, 0); ShowResults(hwndDlg); - break; + } + break; + case IDC_RADIO_ADDRESS: + case IDC_RADIO_TEXT_CODE: + ToggleCheatInputMode(hwndDlg, LOWORD(wParam)); + break; + } + break; + case EN_UPDATE: + switch (LOWORD(wParam)) + { + case IDC_CHEAT_ADDR: + case IDC_CHEAT_VAL: + case IDC_CHEAT_COM: + { + if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_ADDRESS)) + { + char buf[16]; uint32 a; uint8 v; int c; + GetUICheatInfo(hwndDlg, NULL, &a, &v, &c); + GetCheatStr(buf, a, v, c); + SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf); + } + + // it was saparated to the text/game genie position + /* + if (dodecode && (strlen(buf) == 6 || strlen(buf) == 8)) + if (FCEUI_DecodeGG(buf, &GGaddr, &GGval, &GGcomp)) { + a = GGaddr; + v = GGval; + c = GGcomp; + } + */ + } + break; + case IDC_CHEAT_TEXT: + { + if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_TEXT_CODE)) + { + char buf[16]; + GetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf, 16); + int a = -1, v = -1; int c = -1; + if (strchr(buf, ':')) + { + if (strchr(buf, '?')) + sscanf(buf, "%X:%X?%X", &a, &c, &v); + else + sscanf(buf, "%X:%X", &a, &v); + } + else if (strlen(buf) == 6 || strlen(buf) == 8) + FCEUI_DecodeGG(buf, &a, &v, &c); + + SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)(a == -1 ? "" : U16ToStr(a))); + SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v))); + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); + } } } - break; } break; case WM_NOTIFY: @@ -788,6 +798,11 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a)); SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v)); SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); + + char code[32]; + GetCheatStr(code, a, v, c); + + SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, code); } EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_DEL), selcheatcount > 0); @@ -960,6 +975,16 @@ void UpdateCheatsAdded() UpdateCheatListGroupBoxUI(); } +void ToggleCheatInputMode(HWND hwndDlg, int modeId) +{ + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), modeId == IDC_RADIO_ADDRESS); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL), modeId == IDC_RADIO_ADDRESS); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_COM), modeId == IDC_RADIO_ADDRESS); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_LABEL), modeId == IDC_RADIO_ADDRESS); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_COM_LABEL), modeId == IDC_RADIO_ADDRESS); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_TEXT), modeId == IDC_RADIO_TEXT_CODE); +} + BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { char str[100]; @@ -981,66 +1006,63 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) }; case WM_INITDIALOG: //todo: set text limits - if (GGConv_wndx==-32000) GGConv_wndx=0; //Just in case - if (GGConv_wndy==-32000) GGConv_wndy=0; - SetWindowPos(hwndDlg,0,GGConv_wndx,GGConv_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER); - break; - case WM_CREATE: - - break; - case WM_PAINT: + if (GGConv_wndx == -32000) + GGConv_wndx = 0; //Just in case + if (GGConv_wndy == -32000) + GGConv_wndy = 0; + SetWindowPos(hwndDlg, 0, GGConv_wndx, GGConv_wndy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); + SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_CODE, EM_SETLIMITTEXT, 8, 0); break; case WM_CLOSE: case WM_QUIT: DestroyWindow(hGGConv); hGGConv = 0; break; - case WM_COMMAND: - switch(HIWORD(wParam)) { - case EN_UPDATE: - if(dontupdateGG)break; - dontupdateGG = 1; - switch(LOWORD(wParam)){ //lets find out what edit control got changed - case IDC_GAME_GENIE_CODE: //The Game Genie Code - in this case decode it. - GetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode,9); - if((strlen(GGcode) != 8) && (strlen(GGcode) != 6))break; + switch(HIWORD(wParam)) { + case EN_UPDATE: + if(dontupdateGG)break; + dontupdateGG = 1; + switch(LOWORD(wParam)){ //lets find out what edit control got changed + case IDC_GAME_GENIE_CODE: //The Game Genie Code - in this case decode it. + GetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode,9); + if((strlen(GGcode) != 8) && (strlen(GGcode) != 6))break; - FCEUI_DecodeGG(GGcode, &GGaddr, &GGval, &GGcomp); + FCEUI_DecodeGG(GGcode, &GGaddr, &GGval, &GGcomp); - sprintf(str,"%04X",GGaddr); - SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str); + sprintf(str,"%04X",GGaddr); + SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str); - if(GGcomp != -1) - sprintf(str,"%02X",GGcomp); - else str[0] = 0; + if(GGcomp != -1) + sprintf(str,"%02X",GGcomp); + else str[0] = 0; SetDlgItemText(hGGConv,IDC_GAME_GENIE_COMP,str); - sprintf(str,"%02X",GGval); - SetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str); + sprintf(str,"%02X",GGval); + SetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str); //ListGGAddresses(); - break; + break; - case IDC_GAME_GENIE_ADDR: - case IDC_GAME_GENIE_COMP: - case IDC_GAME_GENIE_VAL: + case IDC_GAME_GENIE_ADDR: + case IDC_GAME_GENIE_COMP: + case IDC_GAME_GENIE_VAL: - GetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str,5); - if(strlen(str) != 4) break; + GetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str,5); + if(strlen(str) != 4) break; - GetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str,5); - if(strlen(str) != 2) {GGval = -1; break;} + GetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str,5); + if(strlen(str) != 2) {GGval = -1; break;} - GGaddr = GetEditHex(hGGConv,IDC_GAME_GENIE_ADDR); - GGval = GetEditHex(hGGConv,IDC_GAME_GENIE_VAL); + GGaddr = GetEditHex(hGGConv,IDC_GAME_GENIE_ADDR); + GGval = GetEditHex(hGGConv,IDC_GAME_GENIE_VAL); - GetDlgItemText(hGGConv,IDC_GAME_GENIE_COMP,str,5); - if(strlen(str) != 2) GGcomp = -1; - else GGcomp = GetEditHex(hGGConv,IDC_GAME_GENIE_COMP); + GetDlgItemText(hGGConv,IDC_GAME_GENIE_COMP,str,5); + if(strlen(str) != 2) GGcomp = -1; + else GGcomp = GetEditHex(hGGConv,IDC_GAME_GENIE_COMP); - EncodeGG(GGcode, GGaddr, GGval, GGcomp); - SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode); - //ListGGAddresses(); + EncodeGG(GGcode, GGaddr, GGval, GGcomp); + SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode); + //ListGGAddresses(); break; } ListGGAddresses(); @@ -1074,7 +1096,6 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) } } break; - case LBN_DBLCLK: switch (LOWORD(wParam)) { case IDC_LIST_GGADDRESSES: @@ -1192,11 +1213,31 @@ void DoGGConv() return; } -/* -void ListBox::OnRButtonDown(UINT nFlags, CPoint point) +inline void GetCheatStr(char* buf, int a, int v, int c) { -CPoint test = point; -} */ + if (a >= 0x8000) + EncodeGG(buf, a, v, c); + else { + if (c == -1) + sprintf(buf, "%04X:%02X", (int)a, (int)v); + else + sprintf(buf, "%04X?%02X:%02X", (int)a, (int)c, (int)v); + } + +} + +void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c) +{ + char buf[16]; + GetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, buf, 5); + *a = StrToU16(buf); + GetDlgItemText(hwndDlg, IDC_CHEAT_VAL, buf, 3); + *v = StrToU8(buf); + GetDlgItemText(hwndDlg, IDC_CHEAT_COM, buf, 3); + *c = (buf[0] == 0) ? -1 : StrToU8(buf); + if (name) + GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, name, 256); +} void DisableAllCheats() { diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index 7a24a5d7..99939705 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -15,6 +15,9 @@ void SetGGConvFocus(int address,int compare); void UpdateCheatList(); void UpdateCheatListGroupBoxUI(); void UpdateCheatsAdded(); +void ToggleCheatInputMode(HWND hwndDlg, int modeId); +void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c); +inline void GetCheatStr(char* buf, int a, int v, int c); extern unsigned int FrozenAddressCount; extern std::vector FrozenAddresses; @@ -35,5 +38,6 @@ SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, newIndex) (SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPTSTR)"") & \ SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \ SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \ -SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)"")) +SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)"") & \ +SetDlgItemText(hwnd, IDC_CHEAT_TEXT, (LPTSTR)"")) diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index 489f32ae..306c6406 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -131,7 +131,6 @@ bool InsertWatch(const AddressWatcher& Watch) return true; } - bool InsertWatch(const AddressWatcher& Watch, HWND parent) { if(!VerifyWatchNotAlreadyAdded(Watch)) @@ -144,9 +143,20 @@ bool InsertWatch(const AddressWatcher& Watch, HWND parent) int prevWatchCount = WatchCount; - rswatches[WatchCount] = Watch; - rswatches[WatchCount].CurValue = GetCurrentValue(rswatches[WatchCount]); - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, (DLGPROC)EditWatchProc, (LPARAM)WatchCount); + int tmpWatchIndex; + if (parent == RamWatchHWnd) + tmpWatchIndex = WatchCount; + else if (parent == RamSearchHWnd) + tmpWatchIndex = -2; + else if (parent == hCheat) + tmpWatchIndex = -3; + else + tmpWatchIndex = -4; + + rswatches[tmpWatchIndex] = Watch; + rswatches[tmpWatchIndex].CurValue = GetCurrentValue(rswatches[tmpWatchIndex]); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, (DLGPROC)EditWatchProc, tmpWatchIndex); + rswatches.erase(tmpWatchIndex); return WatchCount > prevWatchCount; } @@ -158,7 +168,9 @@ bool InsertWatches(const AddressWatcher* watches, HWND parent, const int count) else { bool success = false; + char comment[256]; rswatches[-1] = watches[0]; + rswatches[-1].comment = comment; if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, (DLGPROC)EditWatchProc, (LPARAM)-1)) for (int i = 0; i < count; ++i) { @@ -166,7 +178,6 @@ bool InsertWatches(const AddressWatcher* watches, HWND parent, const int count) watcher.comment = rswatches[-1].comment; success |= InsertWatch(watcher); } - free(rswatches[-1].comment); rswatches.erase(-1); return success; } @@ -768,7 +779,9 @@ void RefreshWatchListSelectedItemControlStatus(HWND hDlg) LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) //Gets info for a RAM Watch, and then inserts it into the Watch List { - static int index; + // since there are 3 windows can pops up the add watch dialog, we should store them separately. + // 0 for ram watch, 1 for ram search, 2 for cheat dialog. + static int indexes[4]; switch(uMsg) { @@ -777,12 +790,12 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara RECT r; GetWindowRect(hWnd, &r); SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); - - index = (int)lParam; - AddressWatcher& watcher = rswatches[index]; + + AddressWatcher& watcher = rswatches[lParam]; if (watcher.Type != 'S') { char Str_Tmp[1024]; - if (index != -1) + // -1 means batch add + if (lParam != -1) { sprintf(Str_Tmp, "%04X", watcher.Address); SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp); @@ -821,6 +834,8 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SetDlgItemText(hDlg, IDC_PROMPT_EDIT, watcher.comment); HWND parent = GetParent(hDlg); + indexes[GetDlgStoreIndex(parent)] = lParam; + if (watcher.Type == 'S' || parent == RamSearchHWnd || parent == hCheat) { EnableWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), FALSE); @@ -845,21 +860,25 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara { case IDOK: { - char Str_Tmp[1024]; + char Str_Tmp[256]; + + HWND parent = GetParent(hDlg); + int index = indexes[GetDlgStoreIndex(parent)]; + // not a single watch editing operation if (index != -1) { // 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); + // 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, + // When it's from ram search or cheat window, all the information required is already set, // so this is also unecessary if (RamWatchHWnd && RamWatchHWnd == GetParent(hDlg) && watcher.Type != 'S') { - GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 1024); + GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 256); // type if (SendDlgItemMessage(hDlg, IDC_SIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED) @@ -910,9 +929,9 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara watcher.comment = Str_Tmp; // finallly update the watch list - if (index < WatchCount) + if (index >= 0 && index < WatchCount) // it's a watch editing operation. - // Only ram watch window can edit a watch, the ram search window only add watch. + // Only ram watch window can edit a watch, the ram search window and cheat window only add watch. EditWatch(index, watcher); else InsertWatch(watcher); @@ -924,7 +943,7 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara AddressWatcher& watcher = rswatches[index]; // comment GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 80); - watcher.comment = strcpy((char*) malloc(strlen(Str_Tmp) + 2), Str_Tmp); + strcpy(watcher.comment, Str_Tmp); } EndDialog(hDlg, true); @@ -1289,7 +1308,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)); if(watchIndex != -1) { - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM)watchIndex); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC)EditWatchProc, watchIndex); SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST)); } return true; @@ -1300,7 +1319,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam target.WrongEndian = 0; target.Size = 'b'; target.Type = 's'; - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC)EditWatchProc, (LPARAM)WatchCount); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC)EditWatchProc, WatchCount); SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST)); return true; } diff --git a/src/drivers/win/ramwatch.h b/src/drivers/win/ramwatch.h index b93981ac..2df1638d 100644 --- a/src/drivers/win/ramwatch.h +++ b/src/drivers/win/ramwatch.h @@ -78,4 +78,9 @@ extern HWND RamWatchHWnd; #define WatchSizeConv(watch) (watch.Type == 'S' ? 0 : watch.Size == 'd' ? 4 : watch.Size == 'w' ? 2 : watch.Size == 'b' ? 1 : 0) #define SizeConvWatch(size) (size == 4 ? 'd' : size == 2 ? 'w' : size == 1 : 'b' : 0) +#define GetDlgStoreIndex(parent) \ + (parent == RamWatchHWnd ? 0 : \ + parent == RamSearchHWnd ? 1 : \ + parent == hCheat ? 2 : 3) + #endif diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index e1cb83ae..30192e26 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -12,7 +12,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources +// Neutral resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON3 ICON "res\\taseditor-icon.ico" -IDI_ICON4 ICON "res\\taseditor-icon32.ico" +IDI_ICON3 ICON "res/taseditor-icon.ico" +IDI_ICON4 ICON "res/taseditor-icon32.ico" ICON_1 ICON "res/ICON_1.ico" ICON_2 ICON "res/ICON_2.ico" @@ -1567,7 +1567,7 @@ STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS CAPTION "Game Genie Encoder/Decoder Tool" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - EDITTEXT IDC_GAME_GENIE_CODE,115,22,53,14,ES_AUTOHSCROLL + EDITTEXT IDC_GAME_GENIE_CODE,115,22,53,14,ES_UPPERCASE | ES_AUTOHSCROLL GROUPBOX "Game Genie Code",-1,107,5,69,42 GROUPBOX "Address/Compare/Value",65534,9,5,91,75 LTEXT "Address:",65533,18,24,35,8 @@ -1973,45 +1973,47 @@ BEGIN LTEXT "New Selection Name:",-1,5,240,68,8 END -CHEATCONSOLE DIALOGEX 0, 0, 431, 198 +CHEATCONSOLE DIALOGEX 0, 0, 395, 216 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,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 + GROUPBOX "Active Cheats",IDC_GROUPBOX_CHEATLIST,5,2,178,209,WS_TABSTOP + GROUPBOX "Cheat Search",IDC_GROUPBOX_CHEATSEARCH,188,2,201,209,WS_TABSTOP + CONTROL "",IDC_LIST_CHEATS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,11,11,167,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,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 + LTEXT "Value:",IDC_CHEAT_VAL_LABEL,83,162,22,8 + LTEXT "Compare:",IDC_CHEAT_COM_LABEL,126,162,34,8 + EDITTEXT IDC_CHEAT_NAME,37,145,141,12,ES_AUTOHSCROLL | ES_WANTRETURN + EDITTEXT IDC_CHEAT_ADDR,54,160,25,12,ES_UPPERCASE | ES_WANTRETURN + EDITTEXT IDC_CHEAT_VAL,107,160,16,12,ES_UPPERCASE | ES_WANTRETURN + EDITTEXT IDC_CHEAT_COM,162,160,16,12,ES_UPPERCASE | ES_WANTRETURN + DEFPUSHBUTTON "Add",IDC_BTN_CHEAT_ADD,11,192,36,16 + PUSHBUTTON "Delete",IDC_BTN_CHEAT_DEL,49,192,36,16 + PUSHBUTTON "Update",IDC_BTN_CHEAT_UPD,87,192,36,16 + PUSHBUTTON "Reset",IDC_BTN_CHEAT_RESET,200,12,55,15 + PUSHBUTTON "Known Value:",IDC_BTN_CHEAT_KNOWN,200,32,55,15 + LTEXT "0x",IDC_CHEAT_LABEL_KNOWN,225,51,9,8 + EDITTEXT IDC_CHEAT_VAL_KNOWN,236,49,18,12,ES_UPPERCASE + GROUPBOX "Previous Compare",IDC_GROUP_PREV_COM,193,63,69,132 + PUSHBUTTON "Equal",IDC_BTN_CHEAT_EQ,200,75,55,15,WS_GROUP + PUSHBUTTON "Not Equal",IDC_BTN_CHEAT_NE,200,96,55,15 + CONTROL "By:",IDC_CHEAT_CHECK_NE_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,114,22,10 + EDITTEXT IDC_CHEAT_VAL_NE_BY,236,113,18,12,ES_UPPERCASE | ES_WANTRETURN + PUSHBUTTON "Greater Than",IDC_BTN_CHEAT_GT,200,129,55,15 + CONTROL "By:",IDC_CHEAT_CHECK_GT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,147,22,10 + EDITTEXT IDC_CHEAT_VAL_GT_BY,236,146,18,12,ES_UPPERCASE | ES_WANTRETURN + PUSHBUTTON "Less Than",IDC_BTN_CHEAT_LT,200,162,55,15 + CONTROL "By:",IDC_CHEAT_CHECK_LT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,180,22,10 + EDITTEXT IDC_CHEAT_VAL_LT_BY,236,179,18,12,ES_UPPERCASE | ES_WANTRETURN + GROUPBOX "Possibilities",IDC_CHEAT_BOX_POSSIBILITIES,266,8,117,187,WS_TABSTOP + CONTROL "",IDC_CHEAT_LIST_POSSIBILITIES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,272,18,106,172 CONTROL " Pause emulation when this window is active",IDC_CHEAT_PAUSEWHENACTIVE, - "Button",BS_AUTOCHECKBOX,188,179,157,10 - PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,128,174,43,16 + "Button",BS_AUTOCHECKBOX,198,198,157,10 + PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,136,192,43,16 + CONTROL "Address:",IDC_RADIO_ADDRESS,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,161,42,10 + CONTROL "Cheat Code / Game Genie:",IDC_RADIO_TEXT_CODE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,176,101,10 + EDITTEXT IDC_CHEAT_TEXT,115,175,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED END IDD_LUA DIALOGEX 0, 0, 270, 150 @@ -2431,8 +2433,8 @@ BEGIN "CHEATCONSOLE", DIALOG BEGIN - RIGHTMARGIN, 430 - BOTTOMMARGIN, 197 + RIGHTMARGIN, 394 + BOTTOMMARGIN, 215 END "VIDEOCONFIG", DIALOG @@ -2682,12 +2684,12 @@ 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 // English (U.S.) resources +#endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources +// English (U.S) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -2716,7 +2718,7 @@ END #endif // APSTUDIO_INVOKED -#endif // English (U.S.) resources +#endif // English (U.S) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index c94445c3..8f8f6adc 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ Éú³ÉµÄ°üº¬Îļþ¡£ -// ¹© res.rc ʹÓà +// Microsoft Visual C++ generated file +// for res.rc // #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 @@ -273,6 +273,7 @@ #define COMBO_NETMOO_LOCAL_PLAYERS 204 #define MENU_MV_EDIT_FIND_NEXT 204 #define IDC_DEBUGGER_FLAG_D 204 +#define IDC_GROUP_PREV_COM 204 #define IDC_NETMOO_KEY 205 #define IDC_DEBUGGER_FLAG_I 205 #define IDB_BITMAP20 205 @@ -584,6 +585,7 @@ #define IDC_NOTE_TO_FIND 1147 #define IDC_AUTOSAVE_PERIOD 1147 #define IDC_EXTRA_SCANLINES 1147 +#define IDC_CHEAT_TEXT 1147 #define IDC_BUTTON9 1148 #define TASEDITOR_FIND_NEXT_SIMILAR_MARKER 1148 #define IDC_SYMBOLIC_ADDRESS 1148 @@ -792,6 +794,12 @@ #define IDC_EXTRA_SCANLINES_TEXT 1309 #define IDC_DATASIZE_GROUPBOX 1310 #define IDC_DATATYPE_GROUPBOX 1311 +#define IDC_RADIO_ADDRESS 1312 +#define IDC_RADIO_TEXT_CODE 1313 +#define IDC_CHEAT_VAL_LABEL 1314 +#define IDC_CHEAT_COM_LABEL 1315 +#define IDC_CHEAT_KNOWN_LABEL 1316 +#define IDC_CHEAT_LABEL_KNOWN 1316 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 #define MENU_SOUND 40042 @@ -1273,7 +1281,7 @@ #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_ADDCHEAT 40601 #define CHEAT_CONTEXT_POSSI_GOTOINHEXEDITOR 40602 #define CHEAT_CONTEXT_POSSI_ADDTORAMWATCH 40603 #define IDC_DEBUGGER_ICONTRAY 55535 @@ -1290,7 +1298,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 304 #define _APS_NEXT_COMMAND_VALUE 40611 -#define _APS_NEXT_CONTROL_VALUE 1312 +#define _APS_NEXT_CONTROL_VALUE 1317 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif From c927728736e59aa4b2600bc6708019dd692582b4 Mon Sep 17 00:00:00 2001 From: owomomo Date: Fri, 10 May 2019 18:47:24 +0800 Subject: [PATCH 07/10] 1. Since the radio switch is not quite necessary in cheat window, I canceled it to freely edit style. 2. After some nightly consideration, I decided to remove some unused resource IDs from resource file, some of them were obseleted, renamed, mistyped or temporary, currently nothing was corrupted... 3. Detail. --- src/drivers/win/cheat.cpp | 85 ++--- src/drivers/win/memwatch.cpp | 7 +- src/drivers/win/replay.cpp | 5 - src/drivers/win/res.rc | 113 +++--- src/drivers/win/resource.h | 326 +----------------- src/drivers/win/taseditor.cpp | 44 ++- .../win/taseditor/taseditor_window.cpp | 10 +- src/drivers/win/window.cpp | 2 +- 8 files changed, 150 insertions(+), 442 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 8327f3a9..84a798d7 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -326,9 +326,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_LT_BY, EM_SETLIMITTEXT, 2, 0); SendDlgItemMessage(hwndDlg, IDC_CHEAT_TEXT, EM_SETLIMITTEXT, 10, 0); - //disable or enable buttons - CheckDlgButton(hwndDlg, IDC_RADIO_ADDRESS, MF_CHECKED); - possiTotalCount = 0; possiItemCount = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETCOUNTPERPAGE, 0, 0); @@ -438,9 +435,14 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } break; case WM_COMMAND: - switch (HIWORD(wParam)) { + { + static int editMode = 0; + + switch (HIWORD(wParam)) + { case BN_CLICKED: - switch (LOWORD(wParam)) { + switch (LOWORD(wParam)) + { case CHEAT_CONTEXT_LIST_TOGGLECHEAT: { LVITEM lvi; @@ -524,7 +526,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tempWatch.Type = 'h'; tempWatch.Address = possiList[sel].addr; tempWatch.WrongEndian = false; - if(InsertWatch(tempWatch, hwndDlg) && !RamWatchHWnd) + if (InsertWatch(tempWatch, hwndDlg) && !RamWatchHWnd) SendMessage(hAppWnd, WM_COMMAND, ID_RAM_WATCH, 0); SetForegroundWindow(RamWatchHWnd); } @@ -542,19 +544,19 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break; case IDC_CHEAT_PAUSEWHENACTIVE: pauseWhileActive ^= 1; - if ((EmulationPaused == 1 ? true : false) != pauseWhileActive) + if ((EmulationPaused == 1 ? true : false) != pauseWhileActive) { EmulationPaused = (pauseWhileActive ? 1 : 0); wasPausedByCheats = pauseWhileActive; if (EmulationPaused) FCEU_printf("Emulation paused: %d\n", EmulationPaused); } - break; + break; case IDC_BTN_CHEAT_ADD: { char name[256] = { 0 }; uint32 a; uint8 v = 0; int c = 0; GetUICheatInfo(hwndDlg, name, &a, &v, &c); - + if (FCEUI_AddCheat(name, a, v, c, 1)) { RedoCheatsCallB(name, a, v, c, 1, 1, NULL); @@ -592,7 +594,8 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l UpdateCheatRelatedWindow(); UpdateCheatListGroupBoxUI(); } - } else { + } + else { if (selcheat >= 0) { FCEUI_DelCheat(selcheat); SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_DELETEITEM, selcheat, 0); @@ -639,10 +642,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l const char filter[] = "Cheat files (*.cht)\0*.cht\0All Files (*.*)\0*.*\0\0"; ofn.lpstrFilter = filter; - char nameo[2048] = {0}; - ofn.lpstrFile = nameo; + char nameo[2048] = { 0 }; + ofn.lpstrFile = nameo; ofn.nMaxFile = 2048; - ofn.Flags = OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_FILEMUSTEXIST; + ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST; std::string initdir = FCEU_GetPath(FCEUMKF_CHEAT); ofn.lpstrInitialDir = initdir.c_str(); @@ -662,7 +665,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case IDC_BTN_CHEAT_RESET: FCEUI_CheatSearchBegin(); ShowResults(hwndDlg); - EnableCheatButtons(hwndDlg,TRUE); + EnableCheatButtons(hwndDlg, TRUE); break; case IDC_BTN_CHEAT_KNOWN: { @@ -676,7 +679,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break; case IDC_BTN_CHEAT_EQ: searchdone = 1; - FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE,0,0); + FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE, 0, 0); ShowResults(hwndDlg); break; case IDC_BTN_CHEAT_NE: @@ -715,41 +718,36 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ShowResults(hwndDlg); } break; - case IDC_RADIO_ADDRESS: - case IDC_RADIO_TEXT_CODE: - ToggleCheatInputMode(hwndDlg, LOWORD(wParam)); - break; } - break; - case EN_UPDATE: - switch (LOWORD(wParam)) - { + break; + case EN_SETFOCUS: + switch (LOWORD(wParam)) + { + case IDC_CHEAT_ADDR: + case IDC_CHEAT_VAL: + case IDC_CHEAT_COM: editMode = 0; break; + case IDC_CHEAT_TEXT: editMode = 1; break; + } + break; + case EN_UPDATE: + switch (LOWORD(wParam)) + { case IDC_CHEAT_ADDR: case IDC_CHEAT_VAL: case IDC_CHEAT_COM: { - if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_ADDRESS)) + if (editMode == 0) { char buf[16]; uint32 a; uint8 v; int c; GetUICheatInfo(hwndDlg, NULL, &a, &v, &c); GetCheatStr(buf, a, v, c); SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf); } - - // it was saparated to the text/game genie position - /* - if (dodecode && (strlen(buf) == 6 || strlen(buf) == 8)) - if (FCEUI_DecodeGG(buf, &GGaddr, &GGval, &GGcomp)) { - a = GGaddr; - v = GGval; - c = GGcomp; - } - */ } break; case IDC_CHEAT_TEXT: { - if (IsDlgButtonChecked(hwndDlg, IDC_RADIO_TEXT_CODE)) + if (editMode == 1) { char buf[16]; GetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf, 16); @@ -765,11 +763,12 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l FCEUI_DecodeGG(buf, &a, &v, &c); SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)(a == -1 ? "" : U16ToStr(a))); - SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v))); - SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); - } + SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v))); + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); + } } } + } } break; case WM_NOTIFY: @@ -975,16 +974,6 @@ void UpdateCheatsAdded() UpdateCheatListGroupBoxUI(); } -void ToggleCheatInputMode(HWND hwndDlg, int modeId) -{ - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), modeId == IDC_RADIO_ADDRESS); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL), modeId == IDC_RADIO_ADDRESS); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_COM), modeId == IDC_RADIO_ADDRESS); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_LABEL), modeId == IDC_RADIO_ADDRESS); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_COM_LABEL), modeId == IDC_RADIO_ADDRESS); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHEAT_TEXT), modeId == IDC_RADIO_TEXT_CODE); -} - BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { char str[100]; diff --git a/src/drivers/win/memwatch.cpp b/src/drivers/win/memwatch.cpp index b2a203d1..9f3af8a2 100644 --- a/src/drivers/win/memwatch.cpp +++ b/src/drivers/win/memwatch.cpp @@ -702,7 +702,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA const int FMAX = 6; string formula[FMAX] = {"> than", "> by 1", "< than", "< by 1", "equal", "!equal"}; - const int kLabelControls[] = {MW_ValueLabel1,MW_ValueLabel2}; + const int kLabelControls[] = {MW_VALUELABEL1,MW_VALUELABEL2}; switch(uMsg) { @@ -846,10 +846,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA ClearAllText(); RamChange(); break; - - case MEMW_FILE_RECENT: - break; - + case MEMW_OPTIONS_LOADSTART: //Load on Start up MemWatchLoadOnStart ^= 1; CheckMenuItem(memwmenu, MEMW_OPTIONS_LOADSTART, MemWatchLoadOnStart ? MF_CHECKED : MF_UNCHECKED); diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index d2fb74a2..acfecfbd 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -269,11 +269,6 @@ void UpdateReplayDialog(HWND hwndDlg) free(fn); } - else - { - EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_OFFSET),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_FROM),FALSE); - } if(doClear) { diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 30192e26..b513395e 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -13,7 +13,6 @@ ///////////////////////////////////////////////////////////////////////////// // Neutral resources - #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #pragma code_page(1252) @@ -206,14 +205,14 @@ BEGIN MENUITEM "1 on, 1 off", MENU_AUTOFIRE_PATTERN_1 MENUITEM "1 on, 2 off", MENU_AUTOFIRE_PATTERN_2 MENUITEM "1 on, 3 off", MENU_AUTOFIRE_PATTERN_3 - MENUITEM "1 on, 4 off", ID_DEBUG_DEBUGGER - MENUITEM "1 on, 5 off", ID_DEBUG_PPUVIEWER - MENUITEM "2 on, 1 off", ID_DEBUG_NAMETABLEVIEWER - MENUITEM "2 on, 2 off", ID_DEBUG_HEXEDITOR - MENUITEM "2 on, 3 off", ID_DEBUG_TRACELOGGER + MENUITEM "1 on, 4 off", MENU_AUTOFIRE_PATTERN_4 + MENUITEM "1 on, 5 off", MENU_AUTOFIRE_PATTERN_5 + MENUITEM "2 on, 1 off", MENU_AUTOFIRE_PATTERN_6 + MENUITEM "2 on, 2 off", MENU_AUTOFIRE_PATTERN_7 + MENUITEM "2 on, 3 off", MENU_AUTOFIRE_PATTERN_8 MENUITEM "2 on, 4 off", MENU_AUTOFIRE_PATTERN_9 - MENUITEM "3 on, 1 off", ID_DEBUG_GAMEGENIEDECODER - MENUITEM "3 on, 2 off", ID_DEBUG_CDLOGGER + MENUITEM "3 on, 1 off", MENU_AUTOFIRE_PATTERN_10 + MENUITEM "3 on, 2 off", MENU_AUTOFIRE_PATTERN_11 MENUITEM "3 on, 3 off", MENU_AUTOFIRE_PATTERN_12 MENUITEM "4 on, 1 off", MENU_AUTOFIRE_PATTERN_13 MENUITEM "4 on, 2 off", MENU_AUTOFIRE_PATTERN_14 @@ -1078,7 +1077,7 @@ BEGIN GROUPBOX "Output/Output Format:",302,10,9,131,93,WS_GROUP CONTROL "Sound enabled.",CHECK_SOUND_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,22,117,12 GROUPBOX "Buffering:",127,150,9,131,93,WS_GROUP - CONTROL "Use Global Focus",124,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,22,100,12 + CONTROL "Use Global Focus",CHECK_SOUND_GLOBAL_FOCUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,22,100,12 CTEXT "Sound Latency",65459,162,50,107,8 CONTROL "",CTL_LATENCY_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,162,70,107,13 GROUPBOX "Master",125,19,142,44,93,WS_GROUP @@ -1334,10 +1333,10 @@ BEGIN EDITTEXT 1069,171,182,55,14,ES_AUTOHSCROLL LTEXT "Name",65428,41,7,20,8 LTEXT "Address",65427,6,7,26,8 - LTEXT "Value",MW_ValueLabel1,101,7,19,8 + LTEXT "Value",MW_VALUELABEL1,101,7,19,8 LTEXT "Name",65425,171,7,20,8 LTEXT "Address",65424,135,7,26,8 - LTEXT "Value",MW_ValueLabel2,231,7,19,8 + LTEXT "Value",MW_VALUELABEL2,231,7,19,8 LTEXT " ",EDIT00_RESULTS,89,225,26,8 GROUPBOX "Memory Change Monitoring",IDC_STATIC,0,202,129,57,BS_CENTER LTEXT "Address",IDC_STATIC,6,213,26,8 @@ -1827,10 +1826,10 @@ BEGIN CONTROL " Piano Roll",IDC_CHECK_PIANO_ROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,68,67,10 CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,83,67,10 GROUPBOX "Greenzone saving options",IDC_STATIC,13,98,97,72 - CONTROL " all frames",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,23,109,77,10 - CONTROL " every 16th frame",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,23,124,77,10 - CONTROL " marked frames",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,23,139,77,10 - CONTROL " don't save",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,23,154,77,10 + CONTROL " all frames",IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES,"Button",BS_AUTORADIOBUTTON,23,109,77,10 + CONTROL " every 16th frame",IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME,"Button",BS_AUTORADIOBUTTON,23,124,77,10 + CONTROL " marked frames",IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES,"Button",BS_AUTORADIOBUTTON,23,139,77,10 + CONTROL " don't save",IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE,"Button",BS_AUTORADIOBUTTON,23,154,77,10 END ASSEMBLER DIALOGEX 0, 0, 202, 135 @@ -1973,47 +1972,47 @@ BEGIN LTEXT "New Selection Name:",-1,5,240,68,8 END -CHEATCONSOLE DIALOGEX 0, 0, 395, 216 +CHEATCONSOLE DIALOGEX 0, 0, 386, 217 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,178,209,WS_TABSTOP - GROUPBOX "Cheat Search",IDC_GROUPBOX_CHEATSEARCH,188,2,201,209,WS_TABSTOP - CONTROL "",IDC_LIST_CHEATS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,11,11,167,131 - LTEXT "Name:",IDC_STATIC,13,147,22,10 - LTEXT "Value:",IDC_CHEAT_VAL_LABEL,83,162,22,8 - LTEXT "Compare:",IDC_CHEAT_COM_LABEL,126,162,34,8 - EDITTEXT IDC_CHEAT_NAME,37,145,141,12,ES_AUTOHSCROLL | ES_WANTRETURN - EDITTEXT IDC_CHEAT_ADDR,54,160,25,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_CHEAT_VAL,107,160,16,12,ES_UPPERCASE | ES_WANTRETURN - EDITTEXT IDC_CHEAT_COM,162,160,16,12,ES_UPPERCASE | ES_WANTRETURN - DEFPUSHBUTTON "Add",IDC_BTN_CHEAT_ADD,11,192,36,16 - PUSHBUTTON "Delete",IDC_BTN_CHEAT_DEL,49,192,36,16 - PUSHBUTTON "Update",IDC_BTN_CHEAT_UPD,87,192,36,16 - PUSHBUTTON "Reset",IDC_BTN_CHEAT_RESET,200,12,55,15 - PUSHBUTTON "Known Value:",IDC_BTN_CHEAT_KNOWN,200,32,55,15 - LTEXT "0x",IDC_CHEAT_LABEL_KNOWN,225,51,9,8 - EDITTEXT IDC_CHEAT_VAL_KNOWN,236,49,18,12,ES_UPPERCASE - GROUPBOX "Previous Compare",IDC_GROUP_PREV_COM,193,63,69,132 - PUSHBUTTON "Equal",IDC_BTN_CHEAT_EQ,200,75,55,15,WS_GROUP - PUSHBUTTON "Not Equal",IDC_BTN_CHEAT_NE,200,96,55,15 - CONTROL "By:",IDC_CHEAT_CHECK_NE_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,114,22,10 - EDITTEXT IDC_CHEAT_VAL_NE_BY,236,113,18,12,ES_UPPERCASE | ES_WANTRETURN - PUSHBUTTON "Greater Than",IDC_BTN_CHEAT_GT,200,129,55,15 - CONTROL "By:",IDC_CHEAT_CHECK_GT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,147,22,10 - EDITTEXT IDC_CHEAT_VAL_GT_BY,236,146,18,12,ES_UPPERCASE | ES_WANTRETURN - PUSHBUTTON "Less Than",IDC_BTN_CHEAT_LT,200,162,55,15 - CONTROL "By:",IDC_CHEAT_CHECK_LT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,180,22,10 - EDITTEXT IDC_CHEAT_VAL_LT_BY,236,179,18,12,ES_UPPERCASE | ES_WANTRETURN - GROUPBOX "Possibilities",IDC_CHEAT_BOX_POSSIBILITIES,266,8,117,187,WS_TABSTOP - CONTROL "",IDC_CHEAT_LIST_POSSIBILITIES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,272,18,106,172 + GROUPBOX "Active Cheats",IDC_GROUPBOX_CHEATLIST,5,2,169,209,WS_TABSTOP + GROUPBOX "Cheat Search",IDC_GROUPBOX_CHEATSEARCH,179,2,201,209,WS_TABSTOP + CONTROL "",IDC_LIST_CHEATS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,11,11,157,133 + LTEXT "Name:",IDC_STATIC,12,149,22,10 + LTEXT "Value:",IDC_CHEAT_VAL_LABEL,73,163,22,8 + LTEXT "Compare:",IDC_CHEAT_COM_LABEL,117,163,34,8 + EDITTEXT IDC_CHEAT_NAME,37,147,131,12,ES_AUTOHSCROLL | ES_WANTRETURN + EDITTEXT IDC_CHEAT_ADDR,44,161,25,12,ES_UPPERCASE | ES_WANTRETURN + EDITTEXT IDC_CHEAT_VAL,97,161,16,12,ES_UPPERCASE | ES_WANTRETURN + EDITTEXT IDC_CHEAT_COM,152,161,16,12,ES_UPPERCASE | ES_WANTRETURN + DEFPUSHBUTTON "Add",IDC_BTN_CHEAT_ADD,9,192,36,16 + PUSHBUTTON "Delete",IDC_BTN_CHEAT_DEL,45,192,36,16 + PUSHBUTTON "Update",IDC_BTN_CHEAT_UPD,81,192,36,16 + PUSHBUTTON "Reset",IDC_BTN_CHEAT_RESET,191,12,55,15 + PUSHBUTTON "Known Value:",IDC_BTN_CHEAT_KNOWN,191,32,55,15 + LTEXT "0x",IDC_CHEAT_LABEL_KNOWN,216,51,9,8 + EDITTEXT IDC_CHEAT_VAL_KNOWN,227,49,18,12,ES_UPPERCASE + GROUPBOX "Previous Compare",IDC_GROUP_PREV_COM,184,63,69,132 + PUSHBUTTON "Equal",IDC_BTN_CHEAT_EQ,191,75,55,15,WS_GROUP + PUSHBUTTON "Not Equal",IDC_BTN_CHEAT_NE,191,96,55,15 + CONTROL "By:",IDC_CHEAT_CHECK_NE_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,203,114,22,10 + EDITTEXT IDC_CHEAT_VAL_NE_BY,227,113,18,12,ES_UPPERCASE | ES_WANTRETURN + PUSHBUTTON "Greater Than",IDC_BTN_CHEAT_GT,191,129,55,15 + CONTROL "By:",IDC_CHEAT_CHECK_GT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,203,147,22,10 + EDITTEXT IDC_CHEAT_VAL_GT_BY,227,146,18,12,ES_UPPERCASE | ES_WANTRETURN + PUSHBUTTON "Less Than",IDC_BTN_CHEAT_LT,191,162,55,15 + CONTROL "By:",IDC_CHEAT_CHECK_LT_BY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,203,180,22,10 + EDITTEXT IDC_CHEAT_VAL_LT_BY,227,179,18,12,ES_UPPERCASE | ES_WANTRETURN + GROUPBOX "Possibilities",IDC_CHEAT_BOX_POSSIBILITIES,257,8,117,187,WS_TABSTOP + CONTROL "",IDC_CHEAT_LIST_POSSIBILITIES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,263,18,106,172 CONTROL " Pause emulation when this window is active",IDC_CHEAT_PAUSEWHENACTIVE, - "Button",BS_AUTOCHECKBOX,198,198,157,10 - PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,136,192,43,16 - CONTROL "Address:",IDC_RADIO_ADDRESS,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,161,42,10 - CONTROL "Cheat Code / Game Genie:",IDC_RADIO_TEXT_CODE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,176,101,10 - EDITTEXT IDC_CHEAT_TEXT,115,175,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED + "Button",BS_AUTOCHECKBOX,185,198,157,10 + PUSHBUTTON "Import...",IDC_BTN_CHEAT_ADDFROMFILE,126,192,43,16 + EDITTEXT IDC_CHEAT_TEXT,105,175,63,12,ES_UPPERCASE | ES_AUTOHSCROLL + LTEXT "Address:",IDC_CHEAT_ADDRESS_LABEL,12,163,30,8 + LTEXT "Cheat code / Game Genie:",IDC_CHEAT_CODE_GG_LABEL,12,177,87,8 END IDD_LUA DIALOGEX 0, 0, 270, 150 @@ -2222,10 +2221,10 @@ BEGIN CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,92,67,10 GROUPBOX "File contents",IDC_STATIC,105,4,111,177 GROUPBOX "Greenzone saving options",IDC_STATIC,112,106,97,69 - CONTROL " all frames",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,122,117,77,10 - CONTROL " every 16th frame",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,122,131,77,10 - CONTROL " marked frames",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,122,145,77,10 - CONTROL " don't save",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,122,159,77,10 + CONTROL " all frames",IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES,"Button",BS_AUTORADIOBUTTON,122,117,77,10 + CONTROL " every 16th frame", IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME,"Button",BS_AUTORADIOBUTTON,122,131,77,10 + CONTROL " marked frames", IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES,"Button",BS_AUTORADIOBUTTON,122,145,77,10 + CONTROL " don't save", IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE,"Button",BS_AUTORADIOBUTTON,122,159,77,10 CONTROL " Autosave project",IDC_AUTOSAVE_PROJECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,17,81,10 CONTROL " silently",IDC_SILENT_AUTOSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,42,10 LTEXT "every",IDC_AUTOSAVE_PERIOD_EVERY_TEXT,14,32,21,8 @@ -2433,8 +2432,8 @@ BEGIN "CHEATCONSOLE", DIALOG BEGIN - RIGHTMARGIN, 394 - BOTTOMMARGIN, 215 + RIGHTMARGIN, 385 + BOTTOMMARGIN, 216 END "VIDEOCONFIG", DIALOG diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 8f8f6adc..e4cfd2dc 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -5,7 +5,6 @@ #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 #define BTN_CLOSE 1 -#define IDB_CLOSE_LOG 1 #define MENU_OPEN_FILE 100 #define EDIT_ROMS 100 #define LBL_LOG_TEXT 100 @@ -16,11 +15,9 @@ #define GRP_GAMEPAD1 100 #define IDC_TRACER_LOG 100 #define MENU_MV_FILE_SAVE 100 -#define IDC_VIDEOCONFIG_MODE 100 #define IDC_ROMPATCHER_OFFSET_BOX 100 #define IDC_ASSEMBLER_HISTORY 100 #define MENU_CLOSE_FILE 101 -#define IDI_ICON1 101 #define CB_DISABLE_SPEED_THROTTLING 101 #define LBL_CDLOGGER_DATACOUNT 101 #define GRP_PPUVIEW_TABLES 101 @@ -34,7 +31,6 @@ #define IDC_ROMPATCHER_DOTNES_OFFSET 101 #define IDC_NTVIEW_TABLE_BOX 101 #define IDC_ASSEMBLER_DISASSEMBLY 101 -#define IDI_ICON2 102 #define MENU_RECENT_FILES 102 #define CB_LOAD_FILE_OPEN 102 #define LBL_CDLOGGER_UNDEFCOUNT 102 @@ -108,10 +104,8 @@ #define IDC_CHEAT_VAL_GT_BY 109 #define IDC_DEBUGGER_SEEK_TO 109 #define IDC_ROMPATCHER_PATCH_DATA 109 -#define IDC_ADDBP_MODE_X2 109 #define IDC_ADDBP_MODE_F 109 #define BTN_CDLOGGER_SAVE_UNUSED 109 -#define IDC_VIDEOCONFIG_43 109 #define IDC_VIDEOCONFIG_TVASPECT 109 #define IDC_GROUP_LOG_OPTIONS 109 #define IDC_CHEAT_VAL_LT_BY 110 @@ -130,7 +124,6 @@ #define IDC_CHECK_LOG_PROCESSOR_STATUS 111 #define IDC_DEBUGGER_RELOAD_SYMS 111 #define IDC_ROMPATCHER_BTN_SAVE 111 -#define IDC_CHEAT_VAL2 111 #define IDC_CHEAT_COM 111 #define IDC_VIDEOCONFIG_DIRECTDRAW_FS 111 #define BTN_AUTO_HOLD 112 @@ -141,50 +134,36 @@ #define IDC_EXTRA_LOG_OPTIONS 113 #define BTN_CLEAR_AH 114 #define IDC_CHECK_LOG_NEW_INSTRUCTIONS 114 -#define IDD_DIALOG1 114 #define IDC_DEBUGGER_RUN_LINE 114 #define LBL_CDLOGGER_VROMREADCOUNT 114 #define LBL_AUTO_HOLD 115 #define IDC_CHECK_LOG_NEW_DATA 115 -#define IDD_DIALOG2 115 -#define IDC_DEBUGGER_STEP_OUT3 115 #define IDC_DEBUGGER_RUN_FRAME2 115 #define LBL_CDLOGGER_UNDEFVROMCOUNT 115 #define LBL_CLEAR_AH 116 #define IDC_CHECK_LOG_UPDATE_WINDOW 116 -#define IDC_DEBUGGER_RESET_CYCLES_COUNTER 116 #define IDC_DEBUGGER_RESET_COUNTERS 116 #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_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_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 -#define IDD_DIALOG3 123 #define IDC_CHECK_SYMBOLIC_TRACING 123 #define CHECK_SOUND_GLOBAL_FOCUS 124 -#define INSERTCOMMENTSUBTITLE 124 #define IDC_CHECK_LOG_MESSAGES 124 #define IDC_CHECK_LOG_BREAKPOINTS 125 #define CHECK_SOUND_ENABLED 126 #define CTL_LATENCY_TRACKBAR 128 #define COMBO_SOUND_QUALITY 129 #define CHECK_SOUND_MUTEFA 130 -#define IDC_DISABLE_HW_ACCEL_WIN 130 -#define IDC_DISABLE_HW_ACCEL_FS 131 #define DEBUGGER_CONTEXT_TOGGLEBREAK 132 #define MENU_RECORD_MOVIE 141 #define MENU_REPLAY_MOVIE 142 @@ -271,12 +250,10 @@ #define IDC_ASSEMBLER_UNDO 203 #define MENU_INSERT_COIN 204 #define COMBO_NETMOO_LOCAL_PLAYERS 204 -#define MENU_MV_EDIT_FIND_NEXT 204 #define IDC_DEBUGGER_FLAG_D 204 #define IDC_GROUP_PREV_COM 204 #define IDC_NETMOO_KEY 205 #define IDC_DEBUGGER_FLAG_I 205 -#define IDB_BITMAP20 205 #define IDB_TE_GREEN_ARROW 205 #define IDC_NETMOO_PASS 206 #define IDC_DEBUGGER_FLAG_Z 206 @@ -368,13 +345,10 @@ #define IDD_TASEDITOR_SAVINGOPTIONS 289 #define IDD_SYMBOLIC_DEBUG_NAMING 290 #define DLG_SNESPAD 291 -#define IDB_PNG2 298 #define MENU_HIDE_MENU 300 #define COMBO_FILTER 300 -#define IDC_EDIT_AUTHORINFO 300 #define IDC_LABEL_LENGTH 300 #define MENU_MV_VIEW_RAM 300 -#define IDC_RADIO_SCALE 300 #define IDC_DEBUGGER_DISASSEMBLY 300 #define IDC_ASSEMBLER_DEFPUSHBUTTON 300 #define MENU_RUN_IN_BACKGROUND 301 @@ -382,20 +356,14 @@ #define IDC_LABEL_FRAMES 301 #define IDC_BTN_CHEAT_ADD 301 #define MENU_MV_VIEW_PPU 301 -#define IDC_RADIO_STRETCH 301 #define IDC_DEBUGGER_DISASSEMBLY_VSCR 301 #define MENU_BACKGROUND_INPUT 302 #define IDC_LABEL_UNDOCOUNT 302 #define IDC_BTN_CHEAT_DEL 302 -#define IDC_VIDEOCONFIG_XSCALE 302 #define IDC_DEBUGGER_BP_LIST 302 #define MENU_MV_VIEW_OAM 302 #define MENU_MV_VIEW_ROM 303 -#define MENU_SHOW_STATUS_ICON 303 -#define IDC_LABEL_AUTHORINFO 303 #define IDC_BTN_CHEAT_UPD 303 -#define IDC_VIDEOCONFIG_YSCALE 303 -#define IDC_DEBUGGER_DISASSEMBLY2 303 #define IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL 303 #define MENU_ENABLE_AUTOSAVE 304 #define IDC_LABEL_ROMUSED 304 @@ -419,10 +387,8 @@ #define IDC_LABEL_PALUSED 309 #define MENU_GAME_GENIE 310 #define IDC_DEBUGGER_VAL_PPU 310 -#define IDC_LABEL_PALUSED2 310 #define IDC_LABEL_NEWPPUUSED 310 #define IDC_DEBUGGER_VAL_SPR 311 -#define IDC_LABEL_TWEAKCOUNT 311 #define IDC_BTN_CHEAT_ADDFROMFILE 311 #define IDC_DEBUGGER_BOOKMARK 312 #define IDC_DEBUGGER_CYCLES_EXCEED 313 @@ -433,7 +399,6 @@ #define MENU_NTSC 330 #define MENU_PAL 331 #define MENU_DENDY 332 -#define CHECK_DISABLE_FOURSCORE 400 #define MENU_MV_BOOKMARKS_RM_ALL 400 #define IDC_WINSIZE_MUL_X 400 #define IDC_CHEAT_CHECK_NE_BY 401 @@ -445,9 +410,7 @@ #define IDC_CHEAT_CHECK_LT_BY 403 #define IDC_FORCE_ASPECT_CORRECTION 403 #define IDC_DEBUGGER_VAL_S 403 -#define IDC_VIDEOCONFIG_ASPECT_X 404 #define IDC_TVASPECT_X 404 -#define IDC_VIDEOCONFIG_ASPECT_Y 405 #define IDC_DEBUGGER_VAL_S2 405 #define IDC_TVASPECT_Y 405 #define IDC_VIDEOCONFIG_SCALER_WIN 406 @@ -467,29 +430,23 @@ #define IDC_DEBUGGER_VAL_CYCLES_COUNT 503 #define CTL_VOLUME_TRACKBAR_NOISE 504 #define IDC_DEBUGGER_VAL_PPUPIXEL 504 -#define IDC_SCANLINE_FIRST_NTSC2 504 -#define CTL_VOLUME_TRACKBAR_NOISE2 505 #define CTL_VOLUME_TRACKBAR_PCM 505 #define IDC_DEBUGGER_VAL_CYCLES_COUNT2 505 -#define IDC_DEBUGGER_VAL_CYCLES_COUNT3 506 #define IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT 506 #define IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT2 507 #define IDC_VIDEOCONFIG_NO8LIM 600 #define IDC_DEBUGGER_ROM_PATCHER 602 #define LIST_DEBUGGER_BOOKMARKS 701 #define BTN_CANCEL 800 -#define IDC_EDIT_OFFSET 1000 #define IDC_GAME_GENIE_CODE 1000 #define IDC_MEMVIEWFIND_WHAT 1000 #define IDC_BOOKMARK_DESCRIPTION 1000 #define MW_ADDR00 1001 -#define IDC_EDIT_FROM 1001 #define IDC_GAME_GENIE_ADDR 1001 #define IDC_MEMVIEWFIND_TYPE_HEX 1001 #define IDC_NTVIEW_MIRROR_HORIZONTAL 1001 #define IDC_CHECK_STOPMOVIE 1002 #define IDC_GAME_GENIE_COMP 1002 -#define IDC_TRACER_STATS 1002 #define IDC_MEMVIEWFIND_TYPE_TEXT 1002 #define IDC_NTVIEW_MIRROR_VERTICAL 1002 #define LV_MAPPING 1003 @@ -515,7 +472,6 @@ #define MW_ADDR05 1016 #define MW_ADDR06 1019 #define MW_ADDR07 1022 -#define GUI_BOT_BOTMODE 1025 #define MW_ADDR08 1025 #define MW_ADDR09 1028 #define MW_ADDR10 1031 @@ -532,7 +488,6 @@ #define MW_ADDR21 1064 #define MW_ADDR22 1067 #define MW_ADDR23 1070 -#define GUI_BOT_PART_LAST 1090 #define BTN_ALLOW_LRUD 1117 #define BTN_PRESET_SET1 1119 #define BTN_PRESET_SET2 1120 @@ -544,49 +499,36 @@ #define BTN_PRESET_EXPORT2 1126 #define BTN_PRESET_EXPORT3 1127 #define IDC_LIST1 1130 -#define IDC_HACKY2 1131 -#define IDC_HACKY1 1132 #define IDC_BUTTON_METADATA 1132 -#define IDC_HACKYEXPORT 1133 -#define IDC_BUTTON1 1133 #define MEMW_EXPANDCOLLAPSE 1133 #define IDC_SOUND_RESTOREDEFAULTVOL 1133 #define TASEDITOR_REWIND 1133 -#define IDC_BUTTON2 1134 #define TASEDITOR_FORWARD 1134 -#define IDC_BUTTON3 1135 #define TASEDITOR_REWIND_FULL 1135 -#define IDC_BUTTON4 1136 #define TASEDITOR_FORWARD_FULL 1136 #define TASEDITOR_PLAYSTOP 1137 -#define IDC_RADIO1 1138 +#define IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES 1138 #define IDC_RADIO_UP 1138 -#define IDC_RADIO2 1139 #define IDC_RADIO_ALL 1139 -#define IDC_RADIO3 1140 +#define IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME 1139 #define IDC_RADIO_1P 1140 -#define IDC_RADIO4 1141 +#define IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES 1140 #define IDC_RADIO_2P 1141 +#define IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE 1141 #define MEMW_EDIT00FORMULA 1142 -#define IDC_RADIO5 1142 #define IDC_RADIO_3P 1142 #define MEMW_EDIT01FORMULA 1143 -#define IDC_RADIO6 1143 #define IDC_RADIO_4P 1143 #define IDC_PROGRESS_BUTTON 1144 #define MEMW_EDIT02FORMULA 1144 -#define IDC_BUTTON7 1145 #define MEMW_EDIT03FORMULA 1145 #define TASEDITOR_PREV_MARKER 1145 -#define IDC_BUTTON8 1146 #define TASEDITOR_FIND_BEST_SIMILAR_MARKER 1146 -#define IDC_EDIT1 1147 #define IDC_SELECTION_MARKER_EDIT 1147 #define IDC_NOTE_TO_FIND 1147 #define IDC_AUTOSAVE_PERIOD 1147 #define IDC_EXTRA_SCANLINES 1147 #define IDC_CHEAT_TEXT 1147 -#define IDC_BUTTON9 1148 #define TASEDITOR_FIND_NEXT_SIMILAR_MARKER 1148 #define IDC_SYMBOLIC_ADDRESS 1148 #define IDC_VBLANK_SCANLINES 1148 @@ -597,15 +539,10 @@ #define TASEDITOR_NEXT_MARKER 1151 #define IDC_SYMBOLIC_COMMENT 1151 #define IDC_BRANCHES_BUTTON 1152 -#define IDC_JUMP_PLAYBACK_BUTTON 1153 -#define IDC_EDIT2 1154 #define IDC_PLAYBACK_MARKER_EDIT 1154 -#define IDC_JUMP_SELECTION_BUTTON 1155 #define TASEDITOR_RUN_MANUAL 1156 #define CHECK_SOUND_MUTETURBO 1179 #define IDC_EDIT_AUTHOR 1180 -#define MEMW_STATIC 1181 -#define MEMW_RESULTS 1184 #define MEMW_EDIT00RESET 1184 #define MEMW_EDIT01RESET 1185 #define MEMW_EDIT02RESET 1186 @@ -615,24 +552,19 @@ #define MEMW_EDIT02RMADDRESS 1190 #define MEMW_EDIT03RMADDRESS 1191 #define IDC_DEBUGGER_RESTORESIZE 1191 -#define MEMW_EDIT04RMADDRESS 1192 #define IDC_MOVIE_CLOSE 1192 #define EDIT00_RESULTS 1193 #define IDC_MOVIE_PAUSEAFTERPLAYBACK 1193 #define EDIT01_RESULTS 1194 #define IDC_MOVIE_BINDSAVESTATES 1194 #define EDIT02_RESULTS 1195 -#define IDC_MOVIE_DISPLAYSTATUSICON 1195 #define EDIT03_RESULTS 1196 #define IDC_MOVIE_DISPLAYSUBTITLES 1196 #define IDC_MOVIE_SUBTITLESINAVI 1197 #define IDC_MOVIE_AUTOBACKUP 1198 -#define IDC_SOUNDS_RESTOREDEFAULTS 1199 -#define BTN_CANCELED 1200 #define ID_SOUND_TRITOP 1201 #define IDC_MOVIE_SUGGEST_READONLY 1201 #define ID_SOUND_QUALITYNOTIFY 1202 -#define IDC_CHECK1 1203 #define CB_ENABLECONTEXTMENU 1203 #define DEBUGAUTOLOAD 1203 #define IDC_CHEAT_PAUSEWHENACTIVE 1203 @@ -649,36 +581,24 @@ #define CHECK_DEEMPH_SWAP 1203 #define IDC_CHECK_LOG_BANK_NUMBER 1203 #define IDC_VOLUMEGROUP 1204 -#define IDC_OMITBLANK 1204 -#define IDC_CHECK3 1204 #define IDC_CHECK_MARKERS 1204 #define IDC_RECORDING 1204 #define IDC_COPY_MARKERS 1204 -#define IDC_AUTORESUMECDLOGGING2 1204 #define IDC_AUTOSAVECDL 1204 #define IDC_INVERT_THE_MASK 1204 -#define IDC_DEBUGGER_PREDEFINEDREGS 1204 #define IDC_DEBUGGER_PREDEFINED_REGS 1204 #define IDC_RAMLIST 1205 -#define IDC_CHECK4 1205 #define IDC_CHECK_BOOKMARKS 1205 -#define IDC_SUPERIMPOSE2 1205 #define IDC_RUN_AUTO 1205 #define IDC_AUTOLOADCDL 1205 -#define IDC_INVERT_THE_MASK2 1205 #define IDC_SPRITE16_MODE 1205 #define IDC_C_SEARCH 1206 -#define IDC_CHECK5 1206 -#define IDC_CHECK_GREENZONE 1206 #define IDC_USEPATTERN 1206 #define IDC_C_ADDCHEAT 1207 -#define IDC_CHECK6 1207 #define IDC_CHECK_HISTORY 1207 #define IDC_C_WATCH 1208 -#define IDC_CHECK7 1208 #define IDC_CHECK_SELECTION 1208 #define IDC_C_RESET 1209 -#define IDC_CHECK8 1209 #define IDC_CHECK_PIANO_ROLL 1209 #define IDC_C_ELIMINATE 1210 #define IDC_LESSTHAN 1211 @@ -709,18 +629,14 @@ #define IDC_C_RESET_CHANGES 1236 #define IDC_C_UNDO 1237 #define IDC_WATCHLIST 1238 -#define IDC_C_ELIMINATE2 1238 #define IDC_C_HEXEDITOR 1238 #define IDC_C_WATCH_EDIT 1239 #define IDC_C_WATCH_REMOVE 1240 #define IDC_C_WATCH_DUPLICATE 1241 #define ID_WATCHES_UPDOWN 1242 #define IDC_C_WATCH_UP 1243 -#define IDC_C_WATCH_DUPLICATE2 1243 -#define IDC_C_WATCH_Separator 1243 #define IDC_C_WATCH_DOWN 1244 #define IDC_PROMPT_TEXT 1245 -#define IDC_PROMPT_TEXT2 1246 #define IDC_PROMPT_EDIT 1247 #define IDC_BUTTON_LUABROWSE 1248 #define IDC_BUTTON_LUARUN 1249 @@ -737,26 +653,20 @@ #define IDC_SINGLEINSTANCE 1258 #define IDC_MOVIE_CLOSEAFTERPLAYBACK 1258 #define IDC_C_WATCH_SEPARATE 1259 -#define IDC_TWEAKCOUNT 1260 #define CHECK_AUTORESTORE_PLAYBACK 1261 #define CB_FS_BY_DOUBLECLICK 1261 #define IDC_PROGRESS1 1262 #define CHECK_FOLLOW_CURSOR 1263 #define IDC_BOOKMARKS_BOX 1264 #define IDC_BRANCHES_BITMAP 1265 -#define IDC_SCREENSHOT_BITMAP 1266 #define CHECK_TURBO_SEEK 1266 #define IDC_TEXT_SELECTION 1267 #define IDC_TEXT_CLIPBOARD 1268 #define IDC_RADIO_1PLAYER 1269 -#define IDC_TEXT_SELECTION2 1269 -#define CHECK_AUTOADJUSTINPUTDUETOLAG 1269 #define IDC_RADIO_2PLAYERS 1270 #define IDC_PLAYBACK_MARKER 1270 #define IDC_RADIO_FOURSCORE 1271 #define IDC_SELECTION_MARKER 1271 -#define IDC_NOTE_TOOLTIP_EDIT 1272 -#define IDC_SELECTION_MARKER2 1272 #define IDC_RADIO_DOWN 1273 #define IDC_PLAYBACK_BOX 1275 #define IDC_RECORDER_BOX 1276 @@ -771,8 +681,6 @@ #define ID_CHR2 1284 #define ID_CHR3 1285 #define ID_STATIC 1286 -#define ID_CDL_OPTIONS 1287 -#define ID_CDL_GENERATEROM 1288 #define CTL_PALSAT_TRACKBAR 1291 #define CB_SKIP_7BIT 1293 #define STATIC_SATVALUE 1294 @@ -784,9 +692,6 @@ #define STATIC_CONTRASTVALUE 1300 #define CTL_PALBRIGHT_TRACKBAR 1301 #define STATIC_BRIGHTVALUE 1302 -#define IDC_RICHEDIT21 1304 -#define IDC_RICHEDIT_DISASM 1304 -#define IDC_CHECK2 1305 #define DEBUGIDAFONT 1305 #define IDC_AUTOSAVE_PERIOD_EVERY_TEXT 1306 #define IDC_AUTOSAVE_PERIOD_MINUTES_TEXT 1307 @@ -794,11 +699,10 @@ #define IDC_EXTRA_SCANLINES_TEXT 1309 #define IDC_DATASIZE_GROUPBOX 1310 #define IDC_DATATYPE_GROUPBOX 1311 -#define IDC_RADIO_ADDRESS 1312 -#define IDC_RADIO_TEXT_CODE 1313 +#define IDC_CHEAT_CODE_GG_LABEL 1312 +#define IDC_CHEAT_ADDRESS_LABEL 1313 #define IDC_CHEAT_VAL_LABEL 1314 #define IDC_CHEAT_COM_LABEL 1315 -#define IDC_CHEAT_KNOWN_LABEL 1316 #define IDC_CHEAT_LABEL_KNOWN 1316 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 @@ -809,7 +713,6 @@ #define MENU_ABOUT 40046 #define MENU_MSGLOG 40047 #define MENU_CHEATS 40048 -#define MENU_BASIC_BOT 40049 #define MENU_AUTOFIRE_PATTERN_1 40050 #define MENU_AUTOFIRE_PATTERN_2 40051 #define MENU_AUTOFIRE_PATTERN_3 40052 @@ -839,7 +742,6 @@ #define MENU_AUTOFIRE_OFFSET_5 40069 #define MENU_AUTOFIRE_OFFSET_6 40070 #define MENU_ALTERNATE_AB 40071 -#define MENU_EXTERNAL_INPUT 40072 #define MENU_PPUVIEWER 40074 #define MENU_NAMETABLEVIEWER 40075 #define MENU_HEXEDITOR 40076 @@ -848,7 +750,6 @@ #define MENU_GAMEGENIEDECODER 40079 #define MENU_DEBUGGER 40080 #define MENU_MEMORY_WATCH 40081 -#define MENU_RAMFILTER 40082 #define ID_FILE_RECENT 40100 #define MEMW_HELP_WCOMMANDS 40101 #define MEMW_OPTIONS_LOADLASTFILE 40102 @@ -856,71 +757,33 @@ #define MEMW_FILE_OPEN 40104 #define MEMW_FILE_SAVE 40105 #define MEMW_FILE_SAVEAS 40106 -#define MEMW_FILE_RECENT 40107 #define MEMW_FILE_CLOSE 40108 #define MEMW_OPTIONS_LOADSTART 40109 #define ID_FILE_RECORDMODE_TRUNCATE 40110 #define ID_FILE_RECORDMODE_OVERWRITE 40111 #define ID_FILE_RECORDMODE_INSERT 40112 -#define ID_FILE_RECORDMODE_XOR 40113 #define FCEUX_CONTEXT_RECORDMODE_TRUNCATE 40115 #define FCEUX_CONTEXT_RECORDMODE_OVERWRITE 40116 #define FCEUX_CONTEXT_RECORDMODE_INSERT 40117 -#define FCEUX_CONTEXT_RECORDMODE_XOR 40118 #define MENU_RECORD_WAV 40120 #define MENU_STOP_WAV 40121 -#define MENU_TASEDIT 40124 -#define MENU_PAUSEAFTERPLAYBACK 40126 #define ID_FILE_NEXTRECORDMODE 40127 #define ID_FILE_PREVRECORDMODE 40128 #define ACCEL_CTRL_O 40130 -#define ACCEL_CTRL_E 40131 #define ACCEL_CTRL_W 40132 #define ACCEL_CTRL_S 40134 #define ACCEL_CTRL_SHIFT_S 40135 #define ACCEL_CTRL_N 40136 #define ACCEL_CTRL_C 40138 #define MENU_HELP 40140 -#define ID_FILE_OOADFM2 40141 -#define ID_FILE_OPENFM2 40142 -#define ID_FILE_SAVEFM2 40143 -#define ID_TWEAKS_DISPLAYBG 40144 -#define ID_TWEAKS_DISPLAYOBJ 40145 -#define ID_ 40146 #define MENU_DISPLAY_BG 40147 #define MENU_DISPLAY_OBJ 40148 -#define ID_FILE_CONVERTMOVIE 40149 #define MENU_CONVERT_MOVIE 40150 -#define ID_STRAY_INSERTFRAMES 40151 -#define MENU_INSERTFRAMES 40152 -#define ID_SELECTED_INSERTFRAME 40153 -#define ID_SELECTED_DELETEFRAME 40154 -#define MENU_DELETEFRAME 40155 -#define MENU_DELETEFRAMES 40156 -#define MENU_STRAY_INSERTFRAMES 40157 #define ID_TOOLS_TEXTHOOKER 40158 -#define ID_Menu 40159 -#define ID_STRAY_TRUNCATE 40160 -#define ID_SELECTED_BRANCH 40161 -#define ID_SELECTED_INSERTMARKER 40162 -#define ID_SELECTED_CREATEMACRO 40163 -#define ID_EDIT 40164 -#define ID_EDIT_COPY40165 40165 -#define ID_EDIT_PASTE40166 40166 -#define ID_EDIT_CUT40167 40167 -#define ID_EDIT_COPYTONEW 40168 #define ID_EDIT_DELETE 40169 -#define ID_HELP_TASEDITHELP 40170 -#define ID_FILE_NEWPROJECTCTRL 40171 #define ID_FILE_SAVEPROJECT 40172 -#define ID_FILE_SAVEAS 40173 -#define ID_FILE_CLOSECTRL 40174 -#define ID_Menu40175 40175 -#define ID_Menu40176 40176 #define ID_EDIT_TRUNCATE 40177 #define ID_FILE_IMPORT 40178 -#define ID_FILE_NEWPROJECT 40179 -#define ID_FILE_OPEN_PROJECT 40180 #define ID_FILE_OPENPROJECT 40181 #define ID_FILE_SAVEPROJECTAS 40182 #define ID_FILE_EXPORTFM2 40183 @@ -928,27 +791,13 @@ #define ACCEL_CTRL_V 40195 #define ACCEL_CTRL_SHIFT_V 40196 #define ACCEL_CTRL_DELETE 40197 -#define ID_ACCEL_CTRL_T 40198 -#define ACCEL_CTRL_T 40198 #define ACCEL_CTRL_B 40199 #define ID_CONTEXT_SELECTED_TRUNCATE 40200 -#define ID_CONTEXT_STRAY_TRUNCATE 40201 -#define ID_VIEW 40202 -#define MENU_CONTEXT_STRAY_INSERTFRAMES 40203 #define ID_CONTEXT_SELECTED_INSERTFRAMES 40204 #define ID_CONTEXT_SELECTED_DELETEFRAMES 40205 -#define ID_SELECTED_REMOVEMARKER 40206 -#define ID_CONTEXT_SELECTED_PASTETONEW 40207 -#define ID_CONTEXT_SELECTED_BRANCH 40210 -#define ID_EDIT_BRANCHCTRL 40211 -#define ID_EDIT_BRANCH 40212 #define ID_EDIT_SELECTALL 40214 -#define ID_EDIT_REMOVEMARKER 40215 -#define ID_FILE_CLOSECTRL40216 40216 #define ID_MEMWVIEW_FILE_CLOSE 40217 -#define ID_FILE_CLOSE40218 40218 #define MENU_MV_FILE_GOTO_ADDRESS 40219 -#define MENU_BASIC_BOT2 40220 #define ID_FILE_TRUNCATE_MOVIE 40221 #define FCEUX_CONTEXT_TRUNCATE_MOVIE 40222 #define ID_FILE_INSERT_1_FRAME 40223 @@ -957,140 +806,54 @@ #define FCEUX_CONTEXT_DELETE_1_FRAME 40226 #define ID_FILE_OPENLUAWINDOW 40229 #define ID_FILE_CLOSELUAWINDOWS 40230 -#define ID_CONFIG_DISPLAY 40231 -#define ID_DISPLAY_INPUTDISPLAY 40232 -#define ID_DISPLAY_LAGCOUNTER 40233 -#define FCUE_DISPLAY_INPUTDISPLAY 40234 -#define FCEU_DISPLAY_LAGCOUNTER 40235 -#define MENU_DISPLAY_INPUTDISPLAY 40236 #define MENU_DISPLAY_LAGCOUNTER 40237 -#define ID_DISPLAY_FRAMEADV 40238 #define MENU_DISPLAY_FA_LAGSKIP 40239 -#define ID_DISPLAY_INPUTDISPLAY40240 40240 -#define ID_LAGCOUNTER_OFF 40241 -#define ID_LAGCOUNTER_1PLAYER 40242 -#define ID_LAGCOUNTER_2PLAYER 40243 -#define ID_LAGCOUNTER_4PLAYER 40244 -#define ID_DISPLAY_LAGCOUNTER40245 40245 -#define MENU_INPUTDISPLAY_OFF 40246 -#define MENU_INPUTDISPLAY_1P 40247 -#define MENU_INPUTDISPLAY_2P 40248 -#define MENU_INPUTDISPLAY_4P 40249 #define MENU_INPUTDISPLAY_0 40250 #define MENU_INPUTDISPLAY_1 40251 #define MENU_INPUTDISPLAY_2 40252 #define MENU_INPUTDISPLAY_4 40253 #define ID_DISPLAY_FRAMECOUNTER 40254 -#define ID_CONFIG_BINDSAVESTATESTOMOVIE 40255 #define MENU_CONFIG_BINDSAVES 40256 -#define MEMVIEW_HELP 40257 #define MENU_MV_HELP 40258 -#define ID_DISPLAY_MOVESUBTITLES 40259 -#define ID_DISPLAY_MOVIESUBTITLES 40260 -#define ID_DISPLAY_MOVIESUBTITLESINAVI 40261 -#define ID_DISPLAY_MOVIESUBTITLES_AVI 40262 #define ID_NES_PAUSE 40263 -#define ID_NES_FRAMEADVANCE 40264 #define ID_NES_SPEEDUP 40265 #define ID_NES_SLOWDOWN 40266 -#define ID_NES_FASTESTSPEED 40267 #define ID_NES_NORMALSPEED 40268 #define ID_NES_TURBO 40269 #define ID_NES_SLOWESTSPEED 40270 -#define ID_NES_EMULATIONSPEED 40271 #define ID_FILE_SCREENSHOT 40272 -#define ID_FILE_RESTARTMOVIE 40273 #define ID_FILE_PLAYMOVIEFROMBEGINNING 40274 -#define ID_GAME_INSERTSUBTITLE 40275 -#define ID_GAME_INSERTCOMMENT 40276 -#define ID_GAME_HELP 40277 -#define ID_GAME_REPLAYMOVIE 40278 -#define ID_GAME_HELP40279 40279 -#define FCEU_CONTEXT_INSERTSUBTITLE 40280 #define FCEU_CONTEXT_MOVIEHELP 40281 #define FCEUX_CONTEXT_REPLAYMOVIE 40282 -#define FCEU_CONTEXT_ROMHELP 40283 -#define ID_NOGAME_OPENROM 40284 -#define ID_NOGAME_HELP 40285 #define FCEU_CONTEXT_OPENROM 40286 #define FCEU_CONTEXT_FCEUHELP 40287 -#define FCEU_CONTEXT_INSERTCOMMENT 40288 -#define ID_FILE_MOVIE 40289 -#define ID_FILE_RECORDAVI 40290 -#define ID_FILE_LUA 40291 -#define ID_NES_EMULATION 40292 -#define ID_GAME_PLAYMOVIEFROMBEGINNING 40293 -#define ID_GAME_STOPMOVIE 40294 #define FCEU_CONTEXT_PLAYMOVIEFROMBEGINNING 40295 #define FCEU_CONTEXT_STOPMOVIE 40296 -#define ID_GAME_CLOSEROM 40297 #define FCEU_CONTEXT_CLOSEROM 40298 -#define ID_GAME_PLAYMOVIEFROMBEGINNING40299 40299 -#define ID_GAME_STOPMOVIERECORDING 40300 -#define ID_GAME_HELP40301 40301 -#define ID_GAME_RECORDMOVIE 40302 #define FCEUX_CONTEXT_RECORDMOVIE 40303 -#define ID_GAME_SCREENSHOT 40304 #define FCEUX_CONTEXT_SCREENSHOT 40305 -#define ID_GAME_REWINDTOLASTAUTO 40306 #define FCEUX_CONTEXT_REWINDTOLASTAUTO 40307 -#define ID_GAME_REWINDTOLASTAUTO40308 40308 -#define ID_GAME_REWINDTOLASTAUTO40309 40309 -#define ID_GAME_VIEWCOMMENTSSUBTITLES 40310 #define FCEUX_CONTEXT_VIEWCOMMENTSSUBTITLES 40311 -#define ID_GAME_VIEWCOMMENTSSUBTITLES40312 40312 -#define ID_OPTIONS_COLLAPSETO1COLUMN 40313 #define MEMW_OPTIONS_EXPANDCOLLAPSE 40314 -#define ID_GAME_UNDOLOADSTATE 40315 #define FCEUX_CONTEXT_UNDOLOADSTATE 40316 -#define ID_GAME_UNDOLOADSTATE40317 40317 -#define ID_GAME_UNDOLOADSTATE40318 40318 -#define ID_GAME_MAKEBACKUP 40319 #define FCEUX_CONTEXT_MAKEBACKUP 40320 -#define ID_CONFIG_MOVIEOPTIONS 40321 #define MENU_MOVIEOPTIONS 40322 -#define ID_GAME_UNDOSAVESTATE 40323 #define FCEUX_CONTEXT_UNDOSAVESTATE 40324 -#define ID_GAME_UNDOSAVESTATE40325 40325 -#define ID_GAME_UNDOSAVESTATE40326 40326 -#define ID_NOGAME_OPENMOSTRECENTROM 40327 #define FCEUX_CONTEXT_RECENTROM1 40328 -#define ID_NES_EMULATION40329 40329 -#define ID_MOVIE_TOGGLEREAD 40330 #define ID_FILE_MOVIE_TOGGLEREAD 40331 -#define ID_LUA_RELOADLUASCRIPT 40332 -#define ID_FILE_LUA_RELOADLUASCRIPT 40333 -#define ID_GAME_SWITCHTOREAD 40334 #define FCEUX_CONTEXT_READONLYTOGGLE 40335 -#define ID_GAME_TOGGLETOREAD 40336 -#define ID_FILE_SAVESTATE 40337 -#define ID_CONFIG_ENABLE 40338 -#define ID_SAVESTATE_QUICKSAVE 40339 -#define ID_SAVESTATE_QUICKLOAD 40340 -#define ID_SAVESTATE 40341 -#define ID_LOADSTATE 40342 #define MENU_LOADSTATE 40343 #define MENU_SAVESTATE 40344 -#define ID_SAVESTATE_NEXTSAVESLOT 40345 -#define ID_SAVESTATE_PREVIOUSSAVESLOT 40346 #define MENU_NEXTSAVESTATE 40347 #define MENU_PREVIOUSSAVESTATE 40348 -#define ID_SAVESTATE_VIEWSAVESLOTS 40349 #define MENU_VIEWSAVESLOTS 40350 -#define ID_LUA_RECENT 40351 #define MENU_LUA_RECENT 40352 -#define ID_Menu40353 40353 #define MENU_MOVIE_RECENT 40354 -#define ID_GAME_LOADLASTMOVIE 40355 #define FCEUX_CONTEXT_LOADLASTMOVIE 40356 -#define ID_GAME_SAVEMOVIEAS 40357 #define FCEUX_CONTEXT_SAVEMOVIEAS 40358 #define ID_FILE_TOGGLE_RECORDING_MOVIE 40359 #define FCEUX_CONTEXT_TOGGLE_RECORDING 40360 #define ID_OPTIONS_BINDTOMAINWINDOW 40361 -#define ID_CONFIG_PPU 40362 -#define ID_PPU_NEWPPU 40363 -#define ID_PPU_OLDPPU 40364 #define ID_NEWPPU 40365 #define ID_OLDPPU 40366 #define ID_CONFIG_SAVECONFIGFILE 40367 @@ -1105,69 +868,42 @@ #define ID_RAM_SEARCH 40376 #define ID_RAM_WATCH 40377 #define RW_MENU_FIRST_RECENT_FILE 40380 -#define RW_MENU_LAST_RECENT_FILE 40400 -#define ID_ENABLE_BACKUPSAVESTATES 40401 +#define RW_MENU_LAST_RECENT_FILE 40400#define ID_ENABLE_BACKUPSAVESTATES 40401 #define ID_ENABLE_COMPRESSSAVESTATES 40402 -#define ID_AVI_DISABLEMOV 40403 -#define ID_AVI_DISMOVIEMESS 40404 #define ID_AVI_DISMOVIEMESSAGE 40405 #define ID_INPUTDISPLAY_OLDSTYLEDISP 40406 -#define ID_GAME_RECOVERY 40407 -#define ID_SAVESTATE_RECOVERY 40408 #define ID_CONTEXT_FULLSAVESTATES 40409 #define ID_FILE_SAVESCREENSHOTAS 40411 -#define ID_WATCHES_ADDSEPARATOR 40412 -#define ID_WATCHES_SEPARATOR 40413 -#define IDC_C_WATCHES_SEPARATOR 40414 -#define IDC_C_WATCH_SEPARATORS 40415 -#define IDC_C_WATCH_Separa 40416 -#define ID_GAME_USECONFIG 40417 #define FCEUX_CONTEXT_GUICONFIG 40418 -#define ID_SELECTED_INSERTFRAMES 40422 -#define ID_CONTEXT_SELECTED_INSERTFRAME 40423 -#define ID_SELECTED_INSERTFRAMES40424 40424 #define ID_CONTEXT_SELECTED_INSERTFRAMES2 40425 #define ACCEL_CTRL_F 40429 -#define ACCEL_CTRL_P 40430 #define ID_CONFIG_SETGREENZONECAPACITY 40432 #define ACCEL_CTRL_INSERT 40433 #define ID_DISPLAY_RERECORDCOUNTER 40436 #define ID_DISPLAY_MOVIESTATUSICON 40437 -#define ID_AVI_DISPLAYHUD 40438 -#define ID_AVI_STOPWAV 40439 #define ID_AVI_ENABLEHUDRECORDING 40440 -#define ID_VIEW_SHOWDOTINEMPTYCELLS 40441 #define ACCEL_INS 40442 #define ACCEL_DEL 40443 -#define ID_SELECTED_CLEARSELECTION 40445 -#define ID_CONTEXT_SELECTED_CLEARSELECTION 40446 #define ID_CONTEXT_SELECTED_CLEARFRAMES 40447 -#define ID_VIEW_SHOW 40448 #define ID_EDIT_CLEAR 40450 #define ID_EDIT_INSERTFRAMES 40451 #define ID_EDIT_INSERT 40452 -#define ID_EDIT_SELECTBETWEENMARKERS 40453 #define ID_CONFIG_BINDMARKERSTOINPUT 40454 #define ACCEL_CTRL_A 40455 #define ID_EDIT_SELECTMIDMARKERS 40457 #define ID_SELECTED_SELECTMIDMARKERS 40458 -#define ID_EDIT_CLONEFRAME 40459 #define ID_EDIT_CLONEFRAMES 40460 -#define ACCEL_SHIFT_INS 40461 #define ACCEL_CTRL_SHIFT_INS 40461 #define ID_SELECTED_CLONE 40463 -#define ID_CONFIG_Q 40464 #define ACCEL_CTRL_Z 40465 #define ACCEL_CTRL_Y 40466 #define ID_EDIT_UNDO 40468 #define ID_EDIT_REDO 40469 #define ID_CONFIG_SETMAXUNDOLEVELS 40470 -#define ID_VIEW_X 40471 #define ID_VIEW_JUMPWHENMAKINGUNDO 40472 #define ID_CONFIG_BRANCHESRESTOREFULLMOVIE 40473 #define ID_CONFIG_OLDBRANCHINGCONTROLS 40474 #define ID_CONFIG_HUDINBRANCHSCREENSHOTS 40475 -#define ID_CONFIG_SETAUTOSAVEPERIOD 40476 #define ACCEL_CTRL_Q 40478 #define ID_EDIT_SELECTIONUNDO 40481 #define ID_EDIT_SELECTIONREDO 40482 @@ -1176,49 +912,29 @@ #define ID_HELP_ABOUT 40485 #define ID_VIEW_ENABLEHOTCHANGES 40488 #define ID_VIEW_SHOWBRANCHSCREENSHOTS 40489 -#define ID_CONFIG_USE1PFORRECORDING2P 40490 #define ID_CONFIG_USE1PFORRECORDING 40491 #define ID_CONFIG_COMBINECONSECUTIVERECORDINGS 40492 -#define ACCEL_SHIFT_V 40493 #define ID_EDIT_PASTEINSERT 40495 -#define ID_SELECTED_SETMARKER 40498 -#define ID_SELECTED_CLEARMARKER 40499 -#define ID_SELECTED_REMOVEMARKER40500 40500 -#define ID_CONFIG_KEYBOARDCONTROLSINPIANOROLL 40501 #define ACCEL_CTRL_PGUP 40502 #define ACCEL_CTRL_PGDN 40503 #define ACCEL_SHIFT_PGUP 40504 #define ACCEL_SHIFT_PGDN 40505 -#define ID_ACCELERATOR40506 40506 #define ID_VIEW_FOLLOWMARKERNOTECONTEXT 40507 #define ID_VIEW_SHOWBRANCHTOOLTIPS 40508 #define ID_CONFIG_USEINPUTKEYSFORCOLUMNSET 40509 #define ID_CONFIG_EMPTYNEWMARKERNOTES 40510 -#define ID_EDIT_FINDNOTE 40513 -#define ID_CONFIG_REAPPEARINGFINDNOTEDIALOG 40514 #define ID_VIEW_FINDNOTE 40515 -#define ID_CONFIG_SILENTAUTOSAVE 40516 #define ID_FILE_CLOSE 40517 #define ID_EDIT_PASTE 40520 #define ID_EDIT_COPY 40521 #define ID_EDIT_CUT 40522 -#define ID_HELP_TASEDITORHELP 40523 #define MENU_TASEDITOR 40524 #define ID_FILE_NEW 40525 -#define ID_HELP_SHOWTOOLTIPS 40526 #define ID_HELP_TOOLTIPS 40527 -#define ID_STRAY_UNPAUSEEMULATOR 40528 -#define ID_STRAY_UNPAUSE 40529 -#define ID_STRAY_TRUNCATE40530 40530 -#define ID_PATTERN 40531 -#define ID_PATTERN_TESTPATTERN 40532 -#define ID_PATTERN40533 40533 #define ID_PATTERN_TEST 40534 -#define ID_CONFIG_COLUMNSETPATTERNSKIPSLAG 40535 #define ID_EDIT_DESELECT 40536 #define ID_SELECTED_DESELECT 40537 #define ID_CONFIG_DRAWINPUTBYDRAGGING 40539 -#define ID_CONFIG_DOUBLECLICKONFRAME 40540 #define ACCEL_CTRL_UP 40541 #define ACCEL_CTRL_DOWN 40542 #define ACCEL_CTRL_LEFT 40543 @@ -1238,67 +954,51 @@ #define ID_CONFIG_AUTOPAUSEATTHEENDOFMOVIE 40559 #define ID_SELECTED_SETMARKERS 40560 #define ID_SELECTED_REMOVEMARKERS 40561 -#define ACCEL_CTRL_SPACEBAR 40563 -#define ACCEL_CTRL_SPACE 40563 #define ID_HELP_OPEN_MANUAL 40564 #define ID_DISPLAY_FPS 40565 -#define ID_CONFIG_AUTO 40566 #define ID_CONFIG_ADJUSTLAG 40567 #define ID_CONFIG_PATTERNSKIPSLAG 40568 #define CLEAR_LOG 40569 #define CLOSE_LOG 40570 #define ID_SELECTED_UNGREENZONE 40571 -#define ID_SELECTED_F 40572 +#define CHEAT_CONTEXT_POSSI_GOTOINHEXEDITOR 40572 #define ID_CONFIG_ENABLEGREENZONING 40573 #define ID_EMULATIONSPEED_SETFRAMEADVANCEDELAY 40574 -#define ID_Menu40575 40575 #define ID_EMULATIONSPEED_SETCUSTOMSPEEDFORFRAMEADVANCE 40576 #define ID_EMULATIONSPEED_CUSTOMSPEED 40577 -#define ID_ENABLE_AUTO 40578 #define ID_ENABLE_AUTORESUME 40579 -#define ID_CONFIG_COMPACTQUICKSAVING 40580 #define ID_CONFIG_SAVING_OPTIONS 40581 #define ID_CDLFILENAME 40582 -#define ID_VIEW_A 40583 -#define ID_VIEW_HIGHLIGHT 40584 -#define ID_VIEW_HIGHLIGHT_ACTIVITY 40585 #define ID_HIGHLIGHTING_FADEWHENPAUSED 40586 #define ID_HIGHLIGHTING_SETFADINGPERIOD 40587 #define ID_HIGHLIGHTING_HIGHLIGHT_ACTIVITY 40588 -#define ID_DUMPTOFILE_CPUBUS 40589 #define MENU_MV_FILE_DUMP_64K 40590 -#define ID_CONFIG_REGION 40591 #define MENU_MV_FILE_DUMP_OAM 40592 #define MENU_RAMINIT_DEFAULT 40593 #define MENU_RAMINIT_FF 40594 #define MENU_RAMINIT_00 40595 #define MENU_RAMINIT_RANDOM 40596 -#define ID_COPY_SELECTALL 40596 #define MENU_MV_FILE_LOAD_RAM 40597 -#define ID_COPY_COPY 40597 #define MENU_MV_FILE_LOAD_PPU 40598 #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 +#define MW_VALUELABEL2 65423 +#define MW_VALUELABEL1 65426 #define IDC_STATIC_SLASHTEXT 65442 #define IDC_BOOKMARK_NAME_TEXT 65532 -#define ID_CDL 65533 #define IDC_NTVIEW_SCANLINE_TEXT 65534 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 304 -#define _APS_NEXT_COMMAND_VALUE 40611 -#define _APS_NEXT_CONTROL_VALUE 1317 +#define _APS_NEXT_RESOURCE_VALUE 303 +#define _APS_NEXT_COMMAND_VALUE 40000 +#define _APS_NEXT_CONTROL_VALUE 1011 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/drivers/win/taseditor.cpp b/src/drivers/win/taseditor.cpp index 86f89e6b..d0daa0f8 100644 --- a/src/drivers/win/taseditor.cpp +++ b/src/drivers/win/taseditor.cpp @@ -485,7 +485,21 @@ void SaveCompact_SetDialogItems(HWND hwndDlg) CheckDlgButton(hwndDlg, IDC_CHECK_HISTORY, taseditorConfig.saveCompact_SaveHistory?BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHECK_PIANO_ROLL, taseditorConfig.saveCompact_SavePianoRoll?BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHECK_SELECTION, taseditorConfig.saveCompact_SaveSelection?BST_CHECKED : BST_UNCHECKED); - CheckRadioButton(hwndDlg, IDC_RADIO1, IDC_RADIO4, IDC_RADIO1 + (taseditorConfig.saveCompact_GreenzoneSavingMode % GREENZONE_SAVING_MODES_TOTAL)); + switch (taseditorConfig.saveCompact_GreenzoneSavingMode % GREENZONE_SAVING_MODES_TOTAL) + { + case GREENZONE_SAVING_MODE_ALL: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES); + break; + case GREENZONE_SAVING_MODE_16TH: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME); + break; + case GREENZONE_SAVING_MODE_MARKED: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES); + break; + case GREENZONE_SAVING_MODE_NO: + default: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE); + } } void SaveCompact_GetDialogItems(HWND hwndDlg) { @@ -495,11 +509,11 @@ void SaveCompact_GetDialogItems(HWND hwndDlg) taseditorConfig.saveCompact_SaveHistory = (SendDlgItemMessage(hwndDlg, IDC_CHECK_HISTORY, BM_GETCHECK, 0, 0) == BST_CHECKED); taseditorConfig.saveCompact_SavePianoRoll = (SendDlgItemMessage(hwndDlg, IDC_CHECK_PIANO_ROLL, BM_GETCHECK, 0, 0) == BST_CHECKED); taseditorConfig.saveCompact_SaveSelection = (SendDlgItemMessage(hwndDlg, IDC_CHECK_SELECTION, BM_GETCHECK, 0, 0) == BST_CHECKED); - if (SendDlgItemMessage(hwndDlg, IDC_RADIO1, BM_GETCHECK, 0, 0) == BST_CHECKED) + if (SendDlgItemMessage(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, BM_GETCHECK, 0, 0) == BST_CHECKED) taseditorConfig.saveCompact_GreenzoneSavingMode = GREENZONE_SAVING_MODE_ALL; - else if (SendDlgItemMessage(hwndDlg, IDC_RADIO2, BM_GETCHECK, 0, 0) == BST_CHECKED) + else if (SendDlgItemMessage(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME, BM_GETCHECK, 0, 0) == BST_CHECKED) taseditorConfig.saveCompact_GreenzoneSavingMode = GREENZONE_SAVING_MODE_16TH; - else if (SendDlgItemMessage(hwndDlg, IDC_RADIO3, BM_GETCHECK, 0, 0) == BST_CHECKED) + else if (SendDlgItemMessage(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES, BM_GETCHECK, 0, 0) == BST_CHECKED) taseditorConfig.saveCompact_GreenzoneSavingMode = GREENZONE_SAVING_MODE_MARKED; else taseditorConfig.saveCompact_GreenzoneSavingMode = GREENZONE_SAVING_MODE_NO; @@ -681,7 +695,21 @@ BOOL CALLBACK savingOptionsWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_CHECK_HISTORY, taseditorConfig.projectSavingOptions_SaveHistory?BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHECK_PIANO_ROLL, taseditorConfig.projectSavingOptions_SavePianoRoll?BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHECK_SELECTION, taseditorConfig.projectSavingOptions_SaveSelection?BST_CHECKED : BST_UNCHECKED); - CheckRadioButton(hwndDlg, IDC_RADIO1, IDC_RADIO4, IDC_RADIO1 + (taseditorConfig.projectSavingOptions_GreenzoneSavingMode % GREENZONE_SAVING_MODES_TOTAL)); + switch (taseditorConfig.saveCompact_GreenzoneSavingMode % GREENZONE_SAVING_MODES_TOTAL) + { + case GREENZONE_SAVING_MODE_ALL: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES); + break; + case GREENZONE_SAVING_MODE_16TH: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME); + break; + case GREENZONE_SAVING_MODE_MARKED: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES); + break; + case GREENZONE_SAVING_MODE_NO: + default: + CheckRadioButton(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE, IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE); + } EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD), taseditorConfig.autosaveEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD_EVERY_TEXT), taseditorConfig.autosaveEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD_MINUTES_TEXT), taseditorConfig.autosaveEnabled); @@ -719,11 +747,11 @@ BOOL CALLBACK savingOptionsWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LP taseditorConfig.projectSavingOptions_SaveHistory = (SendDlgItemMessage(hwndDlg, IDC_CHECK_HISTORY, BM_GETCHECK, 0, 0) == BST_CHECKED); taseditorConfig.projectSavingOptions_SavePianoRoll = (SendDlgItemMessage(hwndDlg, IDC_CHECK_PIANO_ROLL, BM_GETCHECK, 0, 0) == BST_CHECKED); taseditorConfig.projectSavingOptions_SaveSelection = (SendDlgItemMessage(hwndDlg, IDC_CHECK_SELECTION, BM_GETCHECK, 0, 0) == BST_CHECKED); - if (SendDlgItemMessage(hwndDlg, IDC_RADIO1, BM_GETCHECK, 0, 0) == BST_CHECKED) + if (SendDlgItemMessage(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES, BM_GETCHECK, 0, 0) == BST_CHECKED) taseditorConfig.projectSavingOptions_GreenzoneSavingMode = GREENZONE_SAVING_MODE_ALL; - else if (SendDlgItemMessage(hwndDlg, IDC_RADIO2, BM_GETCHECK, 0, 0) == BST_CHECKED) + else if (SendDlgItemMessage(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME, BM_GETCHECK, 0, 0) == BST_CHECKED) taseditorConfig.projectSavingOptions_GreenzoneSavingMode = GREENZONE_SAVING_MODE_16TH; - else if (SendDlgItemMessage(hwndDlg, IDC_RADIO3, BM_GETCHECK, 0, 0) == BST_CHECKED) + else if (SendDlgItemMessage(hwndDlg, IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES, BM_GETCHECK, 0, 0) == BST_CHECKED) taseditorConfig.projectSavingOptions_GreenzoneSavingMode = GREENZONE_SAVING_MODE_MARKED; else taseditorConfig.projectSavingOptions_GreenzoneSavingMode = GREENZONE_SAVING_MODE_NO; diff --git a/src/drivers/win/taseditor/taseditor_window.cpp b/src/drivers/win/taseditor/taseditor_window.cpp index 815c6a46..55699f18 100644 --- a/src/drivers/win/taseditor/taseditor_window.cpp +++ b/src/drivers/win/taseditor/taseditor_window.cpp @@ -1138,19 +1138,19 @@ BOOL CALLBACK TASEditorWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara FCEUI_MovieToggleReadOnly(); CheckDlgButton(taseditorWindow.hwndTASEditor, IDC_RECORDING, movie_readonly?BST_UNCHECKED : BST_CHECKED); break; - case IDC_RADIO2: + case IDC_RADIO_ALL: recorder.multitrackRecordingJoypadNumber = MULTITRACK_RECORDING_ALL; break; - case IDC_RADIO3: + case IDC_RADIO_1P: recorder.multitrackRecordingJoypadNumber = MULTITRACK_RECORDING_1P; break; - case IDC_RADIO4: + case IDC_RADIO_2P: recorder.multitrackRecordingJoypadNumber = MULTITRACK_RECORDING_2P; break; - case IDC_RADIO5: + case IDC_RADIO_3P: recorder.multitrackRecordingJoypadNumber = MULTITRACK_RECORDING_3P; break; - case IDC_RADIO6: + case IDC_RADIO_4P: recorder.multitrackRecordingJoypadNumber = MULTITRACK_RECORDING_4P; break; case IDC_SUPERIMPOSE: diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 0e4b684a..ddfa0d37 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -408,7 +408,7 @@ void UpdateCheckedMenuItems() FCEUI_GetRenderPlanes(spr,bg); static int *polo[] = { &genie, &status_icon}; - static int polo2[]={ MENU_GAME_GENIE, MENU_SHOW_STATUS_ICON }; + static int polo2[]={ MENU_GAME_GENIE, ID_DISPLAY_MOVIESTATUSICON }; int x; // Check or uncheck the necessary menu items From b93ea26b32b51f6839eb173463c98c534893a259 Mon Sep 17 00:00:00 2001 From: owomomo Date: Fri, 10 May 2019 18:47:24 +0800 Subject: [PATCH 08/10] 1. Since the radio switch is not quite necessary in cheat window, I canceled it to freely edit style. 2. After some nightly consideration, I decided to remove some unused resource IDs from resource file, some of them were obseleted, renamed, mistyped or temporary, currently nothing was corrupted... 3. Detail. --- src/drivers/win/cheat.cpp | 68 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 84a798d7..d8e8d121 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -723,51 +723,51 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case EN_SETFOCUS: switch (LOWORD(wParam)) { - case IDC_CHEAT_ADDR: - case IDC_CHEAT_VAL: - case IDC_CHEAT_COM: editMode = 0; break; - case IDC_CHEAT_TEXT: editMode = 1; break; + case IDC_CHEAT_ADDR: + case IDC_CHEAT_VAL: + case IDC_CHEAT_COM: editMode = 0; break; + case IDC_CHEAT_TEXT: editMode = 1; break; } break; case EN_UPDATE: switch (LOWORD(wParam)) { - case IDC_CHEAT_ADDR: - case IDC_CHEAT_VAL: - case IDC_CHEAT_COM: - { - if (editMode == 0) + case IDC_CHEAT_ADDR: + case IDC_CHEAT_VAL: + case IDC_CHEAT_COM: { - char buf[16]; uint32 a; uint8 v; int c; - GetUICheatInfo(hwndDlg, NULL, &a, &v, &c); - GetCheatStr(buf, a, v, c); - SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf); - } - } - break; - case IDC_CHEAT_TEXT: - { - if (editMode == 1) - { - char buf[16]; - GetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf, 16); - int a = -1, v = -1; int c = -1; - if (strchr(buf, ':')) + if (editMode == 0) { - if (strchr(buf, '?')) - sscanf(buf, "%X:%X?%X", &a, &c, &v); - else - sscanf(buf, "%X:%X", &a, &v); + char buf[16]; uint32 a; uint8 v; int c; + GetUICheatInfo(hwndDlg, NULL, &a, &v, &c); + GetCheatStr(buf, a, v, c); + SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf); } - else if (strlen(buf) == 6 || strlen(buf) == 8) - FCEUI_DecodeGG(buf, &a, &v, &c); + } + break; + case IDC_CHEAT_TEXT: + { + if (editMode == 1) + { + char buf[16]; + GetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf, 16); + int a = -1, v = -1; int c = -1; + if (strchr(buf, ':')) + { + if (strchr(buf, '?')) + sscanf(buf, "%X:%X?%X", &a, &c, &v); + else + sscanf(buf, "%X:%X", &a, &v); + } + else if (strlen(buf) == 6 || strlen(buf) == 8) + FCEUI_DecodeGG(buf, &a, &v, &c); - SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)(a == -1 ? "" : U16ToStr(a))); - SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v))); - SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); + SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)(a == -1 ? "" : U16ToStr(a))); + SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v))); + SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c))); + } } } - } } } break; From a680d67fa141e64bac3686ce0b05695b17e2cc1b Mon Sep 17 00:00:00 2001 From: owomomo Date: Fri, 10 May 2019 19:18:30 +0800 Subject: [PATCH 09/10] Fix weird compile error. it's quite strange that the macro define missed a line feed. --- src/drivers/win/resource.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index e4cfd2dc..b93118b9 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -868,7 +868,8 @@ #define ID_RAM_SEARCH 40376 #define ID_RAM_WATCH 40377 #define RW_MENU_FIRST_RECENT_FILE 40380 -#define RW_MENU_LAST_RECENT_FILE 40400#define ID_ENABLE_BACKUPSAVESTATES 40401 +#define RW_MENU_LAST_RECENT_FILE 40400 +#define ID_ENABLE_BACKUPSAVESTATES 40401 #define ID_ENABLE_COMPRESSSAVESTATES 40402 #define ID_AVI_DISMOVIEMESSAGE 40405 #define ID_INPUTDISPLAY_OLDSTYLEDISP 40406 From 91c408468a446541c0372c462cc93ba0760075d1 Mon Sep 17 00:00:00 2001 From: owomomo Date: Sat, 11 May 2019 00:06:43 +0800 Subject: [PATCH 10/10] Attempting to fix Issue #43. --- src/fceu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fceu.cpp b/src/fceu.cpp index 991b054a..ff950c9b 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -436,10 +436,11 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen strcpy(fullname, name); } + // reset loaded game BEFORE it's loading. + ResetGameLoaded(); //file opened ok. start loading. FCEU_printf("Loading %s...\n\n", fullname); GetFileBase(fp->filename.c_str()); - ResetGameLoaded(); //reset parameters so they're cleared just in case a format's loader doesn't know to do the clearing MasterRomInfoParams = TMasterRomInfoParams();