Merge branch 'master' into dlgproc_fix
This commit is contained in:
commit
850390e5ba
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef CART_H
|
||||||
|
#define CART_H
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// Set by mapper/board code:
|
// Set by mapper/board code:
|
||||||
void (*Power)(void);
|
void (*Power)(void);
|
||||||
|
@ -100,3 +103,5 @@ void FCEU_GeniePower(void);
|
||||||
bool FCEU_OpenGenie(void);
|
bool FCEU_OpenGenie(void);
|
||||||
void FCEU_CloseGenie(void);
|
void FCEU_CloseGenie(void);
|
||||||
void FCEU_KillGenie(void);
|
void FCEU_KillGenie(void);
|
||||||
|
|
||||||
|
#endif#endif
|
|
@ -62,6 +62,8 @@ void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p)
|
||||||
|
|
||||||
CHEATF_SUBFAST SubCheats[256] = { 0 };
|
CHEATF_SUBFAST SubCheats[256] = { 0 };
|
||||||
uint32 numsubcheats = 0;
|
uint32 numsubcheats = 0;
|
||||||
|
int globalCheatDisabled = 0;
|
||||||
|
int disableAutoLSCheats = 0;
|
||||||
struct CHEATF *cheats = 0, *cheatsl = 0;
|
struct CHEATF *cheats = 0, *cheatsl = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,11 +106,10 @@ void RebuildSubCheats(void)
|
||||||
SetReadHandler(SubCheats[x].addr, SubCheats[x].addr, SubCheats[x].PrevRead);
|
SetReadHandler(SubCheats[x].addr, SubCheats[x].addr, SubCheats[x].PrevRead);
|
||||||
|
|
||||||
numsubcheats = 0;
|
numsubcheats = 0;
|
||||||
|
if (!globalCheatDisabled)
|
||||||
while(c)
|
while(c)
|
||||||
{
|
{
|
||||||
if(c->type == 1 && c->status)
|
if(c->type == 1 && c->status && GetReadHandler(c->addr) != SubCheatsRead)
|
||||||
{
|
|
||||||
if(GetReadHandler(c->addr) != SubCheatsRead)
|
|
||||||
{
|
{
|
||||||
SubCheats[numsubcheats].PrevRead = GetReadHandler(c->addr);
|
SubCheats[numsubcheats].PrevRead = GetReadHandler(c->addr);
|
||||||
SubCheats[numsubcheats].addr = c->addr;
|
SubCheats[numsubcheats].addr = c->addr;
|
||||||
|
@ -117,9 +118,9 @@ void RebuildSubCheats(void)
|
||||||
SetReadHandler(c->addr, c->addr, SubCheatsRead);
|
SetReadHandler(c->addr, c->addr, SubCheatsRead);
|
||||||
numsubcheats++;
|
numsubcheats++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
c = c->next;
|
c = c->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrozenAddressCount = numsubcheats; //Update the frozen address list
|
FrozenAddressCount = numsubcheats; //Update the frozen address list
|
||||||
UpdateFrozenList();
|
UpdateFrozenList();
|
||||||
|
|
||||||
|
@ -243,7 +244,6 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
||||||
char *neo = &tbuf[4+2+2+1+1+1];
|
char *neo = &tbuf[4+2+2+1+1+1];
|
||||||
if(sscanf(tbuf, "%04x%*[:]%02x%*[:]%02x", &addr, &val, &compare) != 3)
|
if(sscanf(tbuf, "%04x%*[:]%02x%*[:]%02x", &addr, &val, &compare) != 3)
|
||||||
continue;
|
continue;
|
||||||
char namebuf[128];
|
|
||||||
strcpy(namebuf, neo);
|
strcpy(namebuf, neo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -277,6 +277,31 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FCEU_SaveGameCheats(FILE* fp, int release)
|
||||||
|
{
|
||||||
|
struct CHEATF *next = cheats;
|
||||||
|
while (next)
|
||||||
|
{
|
||||||
|
if (next->type)
|
||||||
|
fputc('S', fp);
|
||||||
|
if (next->compare >= 0)
|
||||||
|
fputc('C', fp);
|
||||||
|
|
||||||
|
if (!next->status)
|
||||||
|
fputc(':', fp);
|
||||||
|
|
||||||
|
if (next->compare >= 0)
|
||||||
|
fprintf(fp, "%04x:%02x:%02x:%s\n", next->addr, next->val, next->compare, next->name);
|
||||||
|
else
|
||||||
|
fprintf(fp, "%04x:%02x:%s\n", next->addr, next->val, next->name);
|
||||||
|
|
||||||
|
if (release) free(next->name);
|
||||||
|
struct CHEATF *t = next;
|
||||||
|
next = next->next;
|
||||||
|
if (release) free(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FCEU_FlushGameCheats(FILE *override, int nosave)
|
void FCEU_FlushGameCheats(FILE *override, int nosave)
|
||||||
{
|
{
|
||||||
if(CheatComp)
|
if(CheatComp)
|
||||||
|
@ -309,7 +334,6 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
|
||||||
|
|
||||||
if(cheats)
|
if(cheats)
|
||||||
{
|
{
|
||||||
struct CHEATF *next=cheats;
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if(override)
|
if(override)
|
||||||
|
@ -319,28 +343,7 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
|
||||||
|
|
||||||
if(fp)
|
if(fp)
|
||||||
{
|
{
|
||||||
for(;;)
|
FCEU_SaveGameCheats(fp, 1);
|
||||||
{
|
|
||||||
struct CHEATF *t;
|
|
||||||
if(next->type)
|
|
||||||
fputc('S',fp);
|
|
||||||
if(next->compare>=0)
|
|
||||||
fputc('C',fp);
|
|
||||||
|
|
||||||
if(!next->status)
|
|
||||||
fputc(':',fp);
|
|
||||||
|
|
||||||
if(next->compare>=0)
|
|
||||||
fprintf(fp,"%04x:%02x:%02x:%s\n",next->addr,next->val,next->compare,next->name);
|
|
||||||
else
|
|
||||||
fprintf(fp,"%04x:%02x:%s\n",next->addr,next->val,next->name);
|
|
||||||
|
|
||||||
free(next->name);
|
|
||||||
t=next;
|
|
||||||
next=next->next;
|
|
||||||
free(t);
|
|
||||||
if(!next) break;
|
|
||||||
}
|
|
||||||
if(!override)
|
if(!override)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
@ -642,6 +645,14 @@ int FCEUI_ToggleCheat(uint32 which)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FCEUI_GlobalToggleCheat(int global_enabled)
|
||||||
|
{
|
||||||
|
int _numsubcheats = numsubcheats;
|
||||||
|
globalCheatDisabled = !global_enabled;
|
||||||
|
RebuildSubCheats();
|
||||||
|
return _numsubcheats != numsubcheats;
|
||||||
|
}
|
||||||
|
|
||||||
static int InitCheatComp(void)
|
static int InitCheatComp(void)
|
||||||
{
|
{
|
||||||
uint32 x;
|
uint32 x;
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
#ifndef CHEAT_H
|
||||||
|
#define CHEAT_H
|
||||||
void FCEU_CheatResetRAM(void);
|
void FCEU_CheatResetRAM(void);
|
||||||
void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p);
|
void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p);
|
||||||
|
|
||||||
void FCEU_LoadGameCheats(FILE *override, int override_existing = 1);
|
void FCEU_LoadGameCheats(FILE *override, int override_existing = 1);
|
||||||
void FCEU_FlushGameCheats(FILE *override, int nosave);
|
void FCEU_FlushGameCheats(FILE *override, int nosave);
|
||||||
|
void FCEU_SaveGameCheats(FILE *fp, int release = 0);
|
||||||
|
int FCEUI_GlobalToggleCheat(int global_enabled);
|
||||||
void FCEU_ApplyPeriodicCheats(void);
|
void FCEU_ApplyPeriodicCheats(void);
|
||||||
void FCEU_PowerCheats(void);
|
void FCEU_PowerCheats(void);
|
||||||
int FCEU_CalcCheatAffectedBytes(uint32 address, uint32 size);
|
int FCEU_CalcCheatAffectedBytes(uint32 address, uint32 size);
|
||||||
|
@ -12,6 +16,8 @@ int FCEU_CheatGetByte(uint32 A);
|
||||||
void FCEU_CheatSetByte(uint32 A, uint8 V);
|
void FCEU_CheatSetByte(uint32 A, uint8 V);
|
||||||
|
|
||||||
extern int savecheats;
|
extern int savecheats;
|
||||||
|
extern int globalCheatDisabled;
|
||||||
|
extern int disableAutoLSCheats;
|
||||||
|
|
||||||
int FCEU_DisableAllCheats();
|
int FCEU_DisableAllCheats();
|
||||||
|
|
||||||
|
@ -55,3 +61,4 @@ struct SEARCHPOSSIBLE {
|
||||||
for (int i = 0; i < numsubcheats && count < size; ++i) \
|
for (int i = 0; i < numsubcheats && count < size; ++i) \
|
||||||
if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size) \
|
if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size) \
|
||||||
++count
|
++count
|
||||||
|
#endif
|
|
@ -191,6 +191,7 @@ int FCEUI_DecodeGG(const char *str, int *a, int *v, int *c);
|
||||||
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type);
|
int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type);
|
||||||
int FCEUI_DelCheat(uint32 which);
|
int FCEUI_DelCheat(uint32 which);
|
||||||
int FCEUI_ToggleCheat(uint32 which);
|
int FCEUI_ToggleCheat(uint32 which);
|
||||||
|
int FCEUI_GlobalToggleCheat(int global_enable);
|
||||||
|
|
||||||
int32 FCEUI_CheatSearchGetCount(void);
|
int32 FCEUI_CheatSearchGetCount(void);
|
||||||
void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current));
|
void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current));
|
||||||
|
|
|
@ -17,5 +17,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
#ifndef COMMON_CHEAT_H
|
||||||
|
#define COMMON_CHEAT_H
|
||||||
void DoConsoleCheatConfig(void);
|
void DoConsoleCheatConfig(void);
|
||||||
|
#endif
|
|
@ -135,7 +135,7 @@ INT_PTR CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
FreeCDLog();
|
FreeCDLog();
|
||||||
RenameCDLog("");
|
RenameCDLog("");
|
||||||
hCDLogger = 0;
|
hCDLogger = 0;
|
||||||
EndDialog(hwndDlg, 0);
|
DestroyWindow(hwndDlg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
|
|
|
@ -29,11 +29,13 @@
|
||||||
#include "../../cheat.h" // For FCEU_LoadGameCheats()
|
#include "../../cheat.h" // For FCEU_LoadGameCheats()
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
static HWND pwindow = 0; //Handle to Cheats dialog
|
// static HWND pwindow = 0; // owomomo: removed pwindow because ambiguous, perhaps it is some obseleted early future plan from half developed old FCEUX?
|
||||||
HWND hCheat = 0; //mbg merge 7/19/06 had to add
|
HWND hCheat = 0; //Handle to Cheats dialog
|
||||||
HMENU hCheatcontext = 0; //Handle to cheat context menu
|
HMENU hCheatcontext = 0; //Handle to cheat context menu
|
||||||
|
|
||||||
bool pauseWhileActive = false; //For checkbox "Pause while active"
|
bool pauseWhileActive = false; //For checkbox "Pause while active"
|
||||||
|
extern int globalCheatDisabled;
|
||||||
|
extern int disableAutoLSCheats;
|
||||||
extern bool wasPausedByCheats;
|
extern bool wasPausedByCheats;
|
||||||
|
|
||||||
int CheatWindow;
|
int CheatWindow;
|
||||||
|
@ -62,17 +64,18 @@ int lbfocus = 0;
|
||||||
int searchdone;
|
int searchdone;
|
||||||
static int knownvalue = 0;
|
static int knownvalue = 0;
|
||||||
|
|
||||||
int GGaddr, GGcomp, GGval;
|
// int GGaddr, GGcomp, GGval;
|
||||||
char GGcode[10];
|
// char GGcode[10];
|
||||||
int GGlist[GGLISTSIZE];
|
int GGlist[GGLISTSIZE];
|
||||||
static int dontupdateGG; //this eliminates recursive crashing
|
static int dontupdateGG; //this eliminates recursive crashing
|
||||||
|
char* GameGenieLetters = "APZLGITYEOXUKSVN";
|
||||||
|
|
||||||
// bool dodecode;
|
// bool dodecode;
|
||||||
|
|
||||||
HWND hGGConv;
|
HWND hGGConv;
|
||||||
|
|
||||||
void EncodeGG(char *str, int a, int v, int c);
|
void EncodeGG(char *str, int a, int v, int c);
|
||||||
void ListGGAddresses();
|
void ListGGAddresses(HWND hwndDlg);
|
||||||
|
|
||||||
uint16 StrToU16(char *s)
|
uint16 StrToU16(char *s)
|
||||||
{
|
{
|
||||||
|
@ -292,18 +295,28 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
if (ChtPosX == -32000) ChtPosX = 0; //Just in case
|
POINT pt;
|
||||||
if (ChtPosY == -32000) ChtPosY = 0;
|
if (ChtPosX != 0 && ChtPosY != 0)
|
||||||
SetWindowPos(hwndDlg, 0, ChtPosX, ChtPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
{
|
||||||
|
pt.x = ChtPosX;
|
||||||
|
pt.y = ChtPosY;
|
||||||
|
pt = CalcSubWindowPos(hwndDlg, &pt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pt = CalcSubWindowPos(hwndDlg, NULL);
|
||||||
|
|
||||||
CheckDlgButton(hwndDlg, IDC_CHEAT_PAUSEWHENACTIVE, pauseWhileActive ? MF_CHECKED : MF_UNCHECKED);
|
ChtPosX = pt.x;
|
||||||
|
ChtPosY = pt.y;
|
||||||
|
|
||||||
|
|
||||||
|
// SetWindowPos(hwndDlg, 0, ChtPosX, ChtPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||||
|
|
||||||
|
CheckDlgButton(hwndDlg, IDC_CHEAT_PAUSEWHENACTIVE, pauseWhileActive ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
CheckDlgButton(hwndDlg, IDC_CHEAT_GLOBAL_SWITCH, globalCheatDisabled ? BST_UNCHECKED : BST_CHECKED);
|
||||||
|
CheckDlgButton(hwndDlg, IDC_CHEAT_AUTOLOADSAVE, disableAutoLSCheats == 2 ? BST_UNCHECKED : disableAutoLSCheats == 1 ? BST_INDETERMINATE : BST_CHECKED);
|
||||||
|
|
||||||
//setup font
|
//setup font
|
||||||
hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0);
|
SetupCheatFont(hwndDlg);
|
||||||
LOGFONT lf;
|
|
||||||
GetObject(hFont, sizeof(LOGFONT), &lf);
|
|
||||||
strcpy(lf.lfFaceName, "Courier New");
|
|
||||||
hNewFont = CreateFontIndirect(&lf);
|
|
||||||
|
|
||||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_ADDR, 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_VAL, WM_SETFONT, (WPARAM)hNewFont, FALSE);
|
||||||
|
@ -325,6 +338,21 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_VAL_GT_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_VAL_LT_BY, EM_SETLIMITTEXT, 2, 0);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_TEXT, EM_SETLIMITTEXT, 10, 0);
|
SendDlgItemMessage(hwndDlg, IDC_CHEAT_TEXT, EM_SETLIMITTEXT, 10, 0);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, EM_SETLIMITTEXT, 8, 0);
|
||||||
|
|
||||||
|
// limit their characters
|
||||||
|
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_COM), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_KNOWN), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_NE_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_GT_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_VAL_LT_BY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_TEXT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
possiTotalCount = 0;
|
possiTotalCount = 0;
|
||||||
possiItemCount = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETCOUNTPERPAGE, 0, 0);
|
possiItemCount = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETCOUNTPERPAGE, 0, 0);
|
||||||
|
@ -338,7 +366,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
//misc setup
|
//misc setup
|
||||||
searchdone = 0;
|
searchdone = 0;
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL_KNOWN, (LPTSTR)U8ToStr(knownvalue));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL_KNOWN, (LPCSTR)U8ToStr(knownvalue));
|
||||||
|
|
||||||
// Enable Context Sub-Menus
|
// Enable Context Sub-Menus
|
||||||
hCheatcontext = LoadMenu(fceu_hInstance, "CHEATCONTEXTMENUS");
|
hCheatcontext = LoadMenu(fceu_hInstance, "CHEATCONTEXTMENUS");
|
||||||
|
@ -356,7 +384,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
wasPausedByCheats = true;
|
wasPausedByCheats = true;
|
||||||
FCEU_printf("Emulation paused: %d\n", EmulationPaused);
|
FCEU_printf("Emulation paused: %d\n", EmulationPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (CheatStyle && possiTotalCount) {
|
if (CheatStyle && possiTotalCount) {
|
||||||
if ((!wParam) && searchdone) {
|
if ((!wParam) && searchdone) {
|
||||||
|
@ -366,6 +393,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
ShowResults(hwndDlg);
|
ShowResults(hwndDlg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WM_QUIT:
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
if (CheatStyle)
|
if (CheatStyle)
|
||||||
DestroyWindow(hwndDlg);
|
DestroyWindow(hwndDlg);
|
||||||
|
@ -375,8 +403,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
CheatWindow = 0;
|
CheatWindow = 0;
|
||||||
hCheat = NULL;
|
hCheat = NULL;
|
||||||
DeleteObject(hFont);
|
DeleteCheatFont();
|
||||||
DeleteObject(hNewFont);
|
|
||||||
if (searchdone)
|
if (searchdone)
|
||||||
FCEUI_CheatSearchSetCurrentAsOriginal();
|
FCEUI_CheatSearchSetCurrentAsOriginal();
|
||||||
possiList.clear();
|
possiList.clear();
|
||||||
|
@ -620,12 +647,12 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
RedoCheatsCallB(name, a, v, c, s, 1, &selcheat);
|
RedoCheatsCallB(name, a, v, c, s, 1, &selcheat);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_SETSELECTIONMARK, 0, selcheat);
|
SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_SETSELECTIONMARK, 0, selcheat);
|
||||||
|
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)U16ToStr(a));
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)U8ToStr(v));
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)"");
|
||||||
else
|
else
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(c));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)U8ToStr(c));
|
||||||
UpdateCheatRelatedWindow();
|
UpdateCheatRelatedWindow();
|
||||||
UpdateCheatListGroupBoxUI();
|
UpdateCheatListGroupBoxUI();
|
||||||
// UpdateCheatAdded();
|
// UpdateCheatAdded();
|
||||||
|
@ -633,25 +660,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
}
|
}
|
||||||
case IDC_BTN_CHEAT_ADDFROMFILE:
|
case IDC_BTN_CHEAT_ADDFROMFILE:
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn;
|
char filename[2048];
|
||||||
memset(&ofn, 0, sizeof(ofn));
|
if (ShowCheatFileBox(hwndDlg, filename, false))
|
||||||
ofn.lStructSize = sizeof(ofn);
|
|
||||||
ofn.hwndOwner = hwndDlg;
|
|
||||||
ofn.hInstance = fceu_hInstance;
|
|
||||||
ofn.lpstrTitle = "Open Cheats file";
|
|
||||||
const char filter[] = "Cheat files (*.cht)\0*.cht\0All Files (*.*)\0*.*\0\0";
|
|
||||||
ofn.lpstrFilter = filter;
|
|
||||||
|
|
||||||
char nameo[2048] = { 0 };
|
|
||||||
ofn.lpstrFile = nameo;
|
|
||||||
ofn.nMaxFile = 2048;
|
|
||||||
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST;
|
|
||||||
std::string initdir = FCEU_GetPath(FCEUMKF_CHEAT);
|
|
||||||
ofn.lpstrInitialDir = initdir.c_str();
|
|
||||||
|
|
||||||
if (GetOpenFileName(&ofn))
|
|
||||||
{
|
{
|
||||||
FILE* file = FCEUD_UTF8fopen(nameo, "rb");
|
FILE* file = FCEUD_UTF8fopen(filename, "rb");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
FCEU_LoadGameCheats(file, 0);
|
FCEU_LoadGameCheats(file, 0);
|
||||||
|
@ -662,6 +674,9 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDC_BTN_CHEAT_EXPORTTOFILE:
|
||||||
|
SaveCheatAs(hwndDlg);
|
||||||
|
break;
|
||||||
case IDC_BTN_CHEAT_RESET:
|
case IDC_BTN_CHEAT_RESET:
|
||||||
FCEUI_CheatSearchBegin();
|
FCEUI_CheatSearchBegin();
|
||||||
ShowResults(hwndDlg);
|
ShowResults(hwndDlg);
|
||||||
|
@ -718,6 +733,27 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
ShowResults(hwndDlg);
|
ShowResults(hwndDlg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDC_CHEAT_GLOBAL_SWITCH:
|
||||||
|
if (FCEUI_GlobalToggleCheat(IsDlgButtonChecked(hwndDlg, IDC_CHEAT_GLOBAL_SWITCH)))
|
||||||
|
{
|
||||||
|
UpdateCheatRelatedWindow();
|
||||||
|
UpdateCheatListGroupBoxUI();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDC_CHEAT_AUTOLOADSAVE:
|
||||||
|
switch (IsDlgButtonChecked(hwndDlg, IDC_CHEAT_AUTOLOADSAVE))
|
||||||
|
{
|
||||||
|
case BST_CHECKED: disableAutoLSCheats = 0; break;
|
||||||
|
case BST_INDETERMINATE: disableAutoLSCheats = 1; break;
|
||||||
|
case BST_UNCHECKED:
|
||||||
|
if(MessageBox(hwndDlg, "If this option is unchecked, you must manually save the cheats by yourself, or all the changed you made to the cheat list would be discarded silently without any asking once you close the game!\nDo you really want to do it in this way?", "Cheat warning", MB_YESNO | MB_ICONWARNING) == IDYES)
|
||||||
|
disableAutoLSCheats = 2;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
disableAutoLSCheats = 0;
|
||||||
|
CheckDlgButton(hwndDlg, IDC_CHEAT_AUTOLOADSAVE, BST_CHECKED);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EN_SETFOCUS:
|
case EN_SETFOCUS:
|
||||||
|
@ -727,6 +763,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
case IDC_CHEAT_VAL:
|
case IDC_CHEAT_VAL:
|
||||||
case IDC_CHEAT_COM: editMode = 0; break;
|
case IDC_CHEAT_COM: editMode = 0; break;
|
||||||
case IDC_CHEAT_TEXT: editMode = 1; break;
|
case IDC_CHEAT_TEXT: editMode = 1; break;
|
||||||
|
case IDC_CHEAT_GAME_GENIE_TEXT: editMode = 2; break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EN_UPDATE:
|
case EN_UPDATE:
|
||||||
|
@ -740,8 +777,13 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
{
|
{
|
||||||
char buf[16]; uint32 a; uint8 v; int c;
|
char buf[16]; uint32 a; uint8 v; int c;
|
||||||
GetUICheatInfo(hwndDlg, NULL, &a, &v, &c);
|
GetUICheatInfo(hwndDlg, NULL, &a, &v, &c);
|
||||||
GetCheatStr(buf, a, v, c);
|
buf[0] = 0;
|
||||||
|
GetCheatCodeStr(buf, a, v, c);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf);
|
SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf);
|
||||||
|
buf[0] = 0;
|
||||||
|
if (a > 0x7FFF && v != -1)
|
||||||
|
EncodeGG(buf, a, v, c);
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -751,7 +793,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
GetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf, 16);
|
GetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf, 16);
|
||||||
int a = -1, v = -1; int c = -1;
|
int a = -1, v = -1, c = -1;
|
||||||
if (strchr(buf, ':'))
|
if (strchr(buf, ':'))
|
||||||
{
|
{
|
||||||
if (strchr(buf, '?'))
|
if (strchr(buf, '?'))
|
||||||
|
@ -759,12 +801,35 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
else
|
else
|
||||||
sscanf(buf, "%X:%X", &a, &v);
|
sscanf(buf, "%X:%X", &a, &v);
|
||||||
}
|
}
|
||||||
else if (strlen(buf) == 6 || strlen(buf) == 8)
|
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)(a == -1 ? "" : U16ToStr(a)));
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)(v == -1 ? "" : U8ToStr(v)));
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||||
|
buf[0] = 0;
|
||||||
|
if (a > 0x7FFF && v != -1)
|
||||||
|
EncodeGG(buf, a, v, c);
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDC_CHEAT_GAME_GENIE_TEXT:
|
||||||
|
{
|
||||||
|
if (editMode == 2)
|
||||||
|
{
|
||||||
|
char buf[16];
|
||||||
|
GetDlgItemText(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, buf, 16);
|
||||||
|
int a = -1, v = -1, c = -1;
|
||||||
|
if (strlen(buf) == 6 || strlen(buf) == 8)
|
||||||
FCEUI_DecodeGG(buf, &a, &v, &c);
|
FCEUI_DecodeGG(buf, &a, &v, &c);
|
||||||
|
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)(a == -1 ? "" : U16ToStr(a)));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)(a == -1 ? "" : U16ToStr(a)));
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v)));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)(v == -1 ? "" : U8ToStr(v)));
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c)));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||||
|
|
||||||
|
buf[0] = 0;
|
||||||
|
if (a != -1 && v != -1)
|
||||||
|
GetCheatCodeStr(buf, a, v, c);
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -793,15 +858,20 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
{
|
{
|
||||||
char* name = ""; uint32 a; uint8 v; int s; int c;
|
char* name = ""; uint32 a; uint8 v; int s; int c;
|
||||||
FCEUI_GetCheat(selcheat, &name, &a, &v, &c, &s, NULL);
|
FCEUI_GetCheat(selcheat, &name, &a, &v, &c, &s, NULL);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_NAME, (LPTSTR)name);
|
SetDlgItemText(hwndDlg, IDC_CHEAT_NAME, (LPCSTR)name);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)U16ToStr(a));
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)U8ToStr(v));
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c)));
|
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||||
|
|
||||||
char code[32];
|
char code[32];
|
||||||
GetCheatStr(code, a, v, c);
|
code[0] = 0;
|
||||||
|
GetCheatCodeStr(code, a, v, c);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, code);
|
SetDlgItemText(hwndDlg, IDC_CHEAT_TEXT, code);
|
||||||
|
code[0] = 0;
|
||||||
|
if (a > 0x7FFF && v != -1)
|
||||||
|
EncodeGG(code, a, v, c);
|
||||||
|
SetDlgItemText(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, code);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_DEL), selcheatcount > 0);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_CHEAT_DEL), selcheatcount > 0);
|
||||||
|
@ -819,7 +889,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
if (!s)
|
if (!s)
|
||||||
{
|
{
|
||||||
FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1);
|
FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1);
|
||||||
|
|
||||||
UpdateCheatRelatedWindow();
|
UpdateCheatRelatedWindow();
|
||||||
UpdateCheatListGroupBoxUI();
|
UpdateCheatListGroupBoxUI();
|
||||||
}
|
}
|
||||||
|
@ -858,10 +927,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
SEARCHPOSSIBLE& possible = possiList[pNMListView->iItem];
|
SEARCHPOSSIBLE& possible = possiList[pNMListView->iItem];
|
||||||
char str[16];
|
char str[16];
|
||||||
sprintf(str, "%04X", possible.addr);
|
sprintf(str, "%04X", possible.addr);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCTSTR)str);
|
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)str);
|
||||||
sprintf(str, "%02X", possible.current);
|
sprintf(str, "%02X", possible.current);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCTSTR)str);
|
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)str);
|
||||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -922,7 +991,7 @@ void ConfigCheats(HWND hParent)
|
||||||
selcheat = -1;
|
selcheat = -1;
|
||||||
CheatWindow = 1;
|
CheatWindow = 1;
|
||||||
if (CheatStyle)
|
if (CheatStyle)
|
||||||
pwindow = hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||||
else
|
else
|
||||||
DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||||
UpdateCheatsAdded();
|
UpdateCheatsAdded();
|
||||||
|
@ -936,10 +1005,10 @@ void ConfigCheats(HWND hParent)
|
||||||
|
|
||||||
void UpdateCheatList()
|
void UpdateCheatList()
|
||||||
{
|
{
|
||||||
if (!pwindow)
|
if (!hCheat)
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
ShowResults(pwindow);
|
ShowResults(hCheat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateCheatListGroupBoxUI()
|
void UpdateCheatListGroupBoxUI()
|
||||||
|
@ -963,8 +1032,9 @@ void UpdateCheatListGroupBoxUI()
|
||||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE);
|
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE);
|
||||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE);
|
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDlgItemText(hCheat, IDC_GROUPBOX_CHEATLIST, temp);
|
SetDlgItemText(hCheat, IDC_GROUPBOX_CHEATLIST, temp);
|
||||||
|
|
||||||
|
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_EXPORTTOFILE), cheats != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Used by cheats and external dialogs such as hex editor to update items in the cheat search dialog
|
//Used by cheats and external dialogs such as hex editor to update items in the cheat search dialog
|
||||||
|
@ -976,8 +1046,8 @@ void UpdateCheatsAdded()
|
||||||
|
|
||||||
BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
char str[100];
|
// int i;
|
||||||
int i;
|
extern void GetUIGGInfo(HWND hwndDlg, uint32* a, uint8* v, int* c);
|
||||||
|
|
||||||
switch(uMsg) {
|
switch(uMsg) {
|
||||||
case WM_MOVE: {
|
case WM_MOVE: {
|
||||||
|
@ -994,67 +1064,85 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
//todo: set text limits
|
{
|
||||||
if (GGConv_wndx == -32000)
|
POINT pt;
|
||||||
GGConv_wndx = 0; //Just in case
|
if (GGConv_wndx != 0 && GGConv_wndy != 0)
|
||||||
if (GGConv_wndy == -32000)
|
{
|
||||||
GGConv_wndy = 0;
|
pt.x = GGConv_wndx;
|
||||||
SetWindowPos(hwndDlg, 0, GGConv_wndx, GGConv_wndy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
pt.y = GGConv_wndy;
|
||||||
|
pt = CalcSubWindowPos(hwndDlg, &pt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pt = CalcSubWindowPos(hwndDlg, NULL);
|
||||||
|
|
||||||
|
GGConv_wndx = pt.x;
|
||||||
|
GGConv_wndy = pt.y;
|
||||||
|
|
||||||
|
// text limits;
|
||||||
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_CODE, EM_SETLIMITTEXT, 8, 0);
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_CODE, EM_SETLIMITTEXT, 8, 0);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_ADDR, EM_SETLIMITTEXT, 4, 0);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_COMP, EM_SETLIMITTEXT, 2, 0);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_VAL, EM_SETLIMITTEXT, 2, 0);
|
||||||
|
|
||||||
|
// setup font
|
||||||
|
SetupCheatFont(hwndDlg);
|
||||||
|
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_ADDR, WM_SETFONT, (WPARAM)hNewFont, FALSE);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_COMP, WM_SETFONT, (WPARAM)hNewFont, FALSE);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_VAL, WM_SETFONT, (WPARAM)hNewFont, FALSE);
|
||||||
|
|
||||||
|
// limit their characters
|
||||||
|
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_CODE), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_ADDR), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_COMP), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_VAL), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
case WM_QUIT:
|
case WM_QUIT:
|
||||||
DestroyWindow(hGGConv);
|
DestroyWindow(hGGConv);
|
||||||
hGGConv = 0;
|
|
||||||
break;
|
break;
|
||||||
|
case WM_DESTROY:
|
||||||
|
hGGConv = NULL;
|
||||||
|
DeleteCheatFont();
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(HIWORD(wParam)) {
|
switch(HIWORD(wParam)) {
|
||||||
case EN_UPDATE:
|
case EN_UPDATE:
|
||||||
if(dontupdateGG)break;
|
if(dontupdateGG)break;
|
||||||
dontupdateGG = 1;
|
dontupdateGG = 1;
|
||||||
switch(LOWORD(wParam)){ //lets find out what edit control got changed
|
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.
|
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;
|
char buf[9];
|
||||||
|
GetDlgItemText(hGGConv, IDC_GAME_GENIE_CODE, buf, 9);
|
||||||
|
|
||||||
FCEUI_DecodeGG(GGcode, &GGaddr, &GGval, &GGcomp);
|
int a = -1, v = -1, c = -1;
|
||||||
|
if (strlen(buf) == 6 || strlen(buf) == 8)
|
||||||
|
FCEUI_DecodeGG(buf, &a, &v, &c);
|
||||||
|
|
||||||
sprintf(str,"%04X",GGaddr);
|
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_ADDR, a == -1 ? "" : U16ToStr(a));
|
||||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str);
|
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_COMP, c == -1 ? "" : U8ToStr(c));
|
||||||
|
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_VAL, v == -1 ? "" : U8ToStr(v));
|
||||||
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);
|
|
||||||
//ListGGAddresses();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_GAME_GENIE_ADDR:
|
case IDC_GAME_GENIE_ADDR:
|
||||||
case IDC_GAME_GENIE_COMP:
|
case IDC_GAME_GENIE_COMP:
|
||||||
case IDC_GAME_GENIE_VAL:
|
case IDC_GAME_GENIE_VAL:
|
||||||
|
|
||||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str,5);
|
uint32 a = -1; uint8 v = -1; int c = -1;
|
||||||
if(strlen(str) != 4) break;
|
GetUIGGInfo(hwndDlg, &a, &v, &c);
|
||||||
|
|
||||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str,5);
|
char buf[9] = { 0 };
|
||||||
if(strlen(str) != 2) {GGval = -1; break;}
|
if (a > 0x7FFF && v != -1)
|
||||||
|
EncodeGG(buf, a, v, c);
|
||||||
GGaddr = GetEditHex(hGGConv,IDC_GAME_GENIE_ADDR);
|
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_CODE, buf);
|
||||||
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);
|
|
||||||
|
|
||||||
EncodeGG(GGcode, GGaddr, GGval, GGcomp);
|
|
||||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode);
|
|
||||||
//ListGGAddresses();
|
//ListGGAddresses();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ListGGAddresses();
|
ListGGAddresses(hwndDlg);
|
||||||
dontupdateGG = 0;
|
dontupdateGG = 0;
|
||||||
break;
|
break;
|
||||||
case BN_CLICKED:
|
case BN_CLICKED:
|
||||||
|
@ -1062,20 +1150,22 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case IDC_BTN_ADD_TO_CHEATS:
|
case IDC_BTN_ADD_TO_CHEATS:
|
||||||
//ConfigCheats(fceu_hInstance);
|
//ConfigCheats(fceu_hInstance);
|
||||||
|
|
||||||
if(GGaddr < 0x8000)GGaddr += 0x8000;
|
char buf[9];
|
||||||
|
uint32 a = -1; uint8 v = -1; int c = -1;
|
||||||
|
GetUIGGInfo(hwndDlg, &a, &v, &c);
|
||||||
|
GetDlgItemText(hwndDlg, IDC_GAME_GENIE_CODE, buf, 9);
|
||||||
|
|
||||||
if (FCEUI_AddCheat(GGcode, GGaddr, GGval, GGcomp, 1) && hCheat) {
|
if(a < 0x8000) a += 0x8000;
|
||||||
RedoCheatsCallB(GGcode, GGaddr, GGval, GGcomp, 1, 1, NULL);
|
|
||||||
|
if (FCEUI_AddCheat(buf, a, v, c, 1) && hCheat) {
|
||||||
|
RedoCheatsCallB(buf, a, v, c, 1, 1, NULL);
|
||||||
int newselcheat = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_GETITEMCOUNT, 0, 0) - 1;
|
int newselcheat = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LVM_GETITEMCOUNT, 0, 0) - 1;
|
||||||
ListView_MoveSelectionMark(GetDlgItem(hCheat, IDC_LIST_CHEATS), selcheat, newselcheat);
|
ListView_MoveSelectionMark(GetDlgItem(hCheat, IDC_LIST_CHEATS), selcheat, newselcheat);
|
||||||
selcheat = newselcheat;
|
selcheat = newselcheat;
|
||||||
|
|
||||||
SetDlgItemText(hCheat, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(GGaddr));
|
SetDlgItemText(hCheat, IDC_CHEAT_ADDR, (LPCSTR)U16ToStr(a));
|
||||||
SetDlgItemText(hCheat, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(GGval));
|
SetDlgItemText(hCheat, IDC_CHEAT_VAL, (LPCSTR)U8ToStr(v));
|
||||||
if(GGcomp == -1)
|
SetDlgItemText(hCheat, IDC_CHEAT_COM, (LPCSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||||
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_DEL), TRUE);
|
||||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), TRUE);
|
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_UPD), TRUE);
|
||||||
|
@ -1088,27 +1178,22 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case LBN_DBLCLK:
|
case LBN_DBLCLK:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDC_LIST_GGADDRESSES:
|
case IDC_LIST_GGADDRESSES:
|
||||||
i = SendDlgItemMessage(hwndDlg,IDC_LIST_GGADDRESSES,LB_GETCURSEL,0,0);
|
ChangeMemViewFocus(3,GGlist[SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_GETCURSEL, 0, 0)],-1);
|
||||||
ChangeMemViewFocus(3,GGlist[i],-1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
break;
|
|
||||||
case WM_HSCROLL:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//The code in this function is a modified version
|
//The code in this function is a modified version
|
||||||
//of Chris Covell's work - I'd just like to point that out
|
//of Chris Covell's work - I'd just like to point that out
|
||||||
void EncodeGG(char *str, int a, int v, int c)
|
void EncodeGG(char *str, int a, int v, int c)
|
||||||
{
|
{
|
||||||
uint8 num[8];
|
uint8 num[8];
|
||||||
static char lets[16]={'A','P','Z','L','G','I','T','Y','E','O','X','U','K','S','V','N'};
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
a&=0x7fff;
|
a&=0x7fff;
|
||||||
|
@ -1122,38 +1207,41 @@ void EncodeGG(char *str, int a, int v, int c)
|
||||||
|
|
||||||
if (c == -1){
|
if (c == -1){
|
||||||
num[5]+=v&8;
|
num[5]+=v&8;
|
||||||
for(i = 0;i < 6;i++)str[i] = lets[num[i]];
|
for(i = 0;i < 6;i++)str[i] = GameGenieLetters[num[i]];
|
||||||
str[6] = 0;
|
str[6] = 0;
|
||||||
} else {
|
} else {
|
||||||
num[2]+=8;
|
num[2]+=8;
|
||||||
num[5]+=c&8;
|
num[5]+=c&8;
|
||||||
num[6]=(c&7)+((c>>4)&8);
|
num[6]=(c&7)+((c>>4)&8);
|
||||||
num[7]=((c>>4)&7)+(v&8);
|
num[7]=((c>>4)&7)+(v&8);
|
||||||
for(i = 0;i < 8;i++)str[i] = lets[num[i]];
|
for(i = 0;i < 8;i++)str[i] = GameGenieLetters[num[i]];
|
||||||
str[8] = 0;
|
str[8] = 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListGGAddresses()
|
void ListGGAddresses(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
uint32 i, j = 0; //mbg merge 7/18/06 changed from int
|
uint32 i, j = 0; //mbg merge 7/18/06 changed from int
|
||||||
char str[20];
|
char str[20], code[9];
|
||||||
SendDlgItemMessage(hGGConv,IDC_LIST_GGADDRESSES,LB_RESETCONTENT,0,0);
|
SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_RESETCONTENT,0,0);
|
||||||
|
|
||||||
|
uint32 a = -1; uint8 v = -1; int c = -1;
|
||||||
|
extern void GetUIGGInfo(HWND hwnd, uint32* a, uint8* v, int* c);
|
||||||
|
GetUIGGInfo(hwndDlg, &a, &v, &c);
|
||||||
|
|
||||||
// also enable/disable the add GG button here
|
// also enable/disable the add GG button here
|
||||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode,9);
|
GetDlgItemText(hwndDlg, IDC_GAME_GENIE_CODE, code, 9);
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ADD_TO_CHEATS), a >= 0 && (strlen(code) == 6 || strlen(code) == 8));
|
||||||
|
|
||||||
if((GGaddr < 0) || ((strlen(GGcode) != 8) && (strlen(GGcode) != 6)))EnableWindow(GetDlgItem(hGGConv,IDC_BTN_ADD_TO_CHEATS),FALSE);
|
if (a != -1 && v != -1)
|
||||||
else EnableWindow(GetDlgItem(hGGConv,IDC_BTN_ADD_TO_CHEATS),TRUE);
|
for(i = 0; i < PRGsize[0]; i += 0x2000)
|
||||||
|
if(c == -1 || PRGptr[0][i + (a & 0x1FFF)] == c){
|
||||||
for(i = 0;i < PRGsize[0];i+=0x2000){
|
GGlist[j] = i + (a & 0x1FFF) + 0x10;
|
||||||
if((PRGptr[0][i+(GGaddr&0x1FFF)] == GGcomp) || (GGcomp == -1)){
|
if(++j > GGLISTSIZE)
|
||||||
GGlist[j] = i+(GGaddr&0x1FFF)+0x10;
|
return;
|
||||||
if(++j > GGLISTSIZE)return;
|
sprintf(str, "%06X", i + (a & 0x1FFF) + 0x10);
|
||||||
sprintf(str,"%06X",i+(GGaddr&0x1FFF)+0x10);
|
SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_ADDSTRING, 0, (LPARAM)str);
|
||||||
SendDlgItemMessage(hGGConv,IDC_LIST_GGADDRESSES,LB_ADDSTRING,0,(LPARAM)(LPSTR)str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,9 +1251,10 @@ void ListGGAddresses()
|
||||||
void SetGGConvFocus(int address, int compare)
|
void SetGGConvFocus(int address, int compare)
|
||||||
{
|
{
|
||||||
char str[10];
|
char str[10];
|
||||||
if(!hGGConv)DoGGConv();
|
if(!hGGConv)
|
||||||
GGaddr = address;
|
DoGGConv();
|
||||||
GGcomp = compare;
|
// GGaddr = address;
|
||||||
|
// GGcomp = compare;
|
||||||
|
|
||||||
dontupdateGG = 1; //little hack to fix a nasty bug
|
dontupdateGG = 1; //little hack to fix a nasty bug
|
||||||
|
|
||||||
|
@ -1174,14 +1263,19 @@ void SetGGConvFocus(int address,int compare)
|
||||||
|
|
||||||
dontupdateGG = 0;
|
dontupdateGG = 0;
|
||||||
|
|
||||||
sprintf(str,"%02X",GGcomp);
|
sprintf(str, "%02X", compare);
|
||||||
SetDlgItemText(hGGConv, IDC_GAME_GENIE_COMP, str);
|
SetDlgItemText(hGGConv, IDC_GAME_GENIE_COMP, str);
|
||||||
|
|
||||||
|
GetDlgItemText(hGGConv, IDC_GAME_GENIE_VAL, str, 3);
|
||||||
|
uint8 val = StrToU8(str);
|
||||||
|
|
||||||
if(GGval < 0)SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,"");
|
if(val < 0)
|
||||||
|
SetDlgItemText(hGGConv, IDC_GAME_GENIE_CODE, "");
|
||||||
else {
|
else {
|
||||||
EncodeGG(GGcode, GGaddr, GGval, GGcomp);
|
str[0] = 0;
|
||||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode);
|
if (val > 0x7FFF)
|
||||||
|
EncodeGG(str, address, val, compare);
|
||||||
|
SetDlgItemText(hGGConv, IDC_GAME_GENIE_CODE, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFocus(GetDlgItem(hGGConv, IDC_GAME_GENIE_VAL));
|
SetFocus(GetDlgItem(hGGConv, IDC_GAME_GENIE_VAL));
|
||||||
|
@ -1196,23 +1290,24 @@ void DoGGConv()
|
||||||
ShowWindow(hGGConv, SW_SHOWNORMAL);
|
ShowWindow(hGGConv, SW_SHOWNORMAL);
|
||||||
SetForegroundWindow(hGGConv);
|
SetForegroundWindow(hGGConv);
|
||||||
} else
|
} else
|
||||||
{
|
hGGConv = CreateDialog(fceu_hInstance,"GGCONV", hAppWnd, GGConvCallB);
|
||||||
hGGConv = CreateDialog(fceu_hInstance,"GGCONV",NULL,GGConvCallB);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GetCheatStr(char* buf, int a, int v, int c)
|
inline void GetCheatStr(char* buf, int a, int v, int c)
|
||||||
{
|
{
|
||||||
if (a >= 0x8000)
|
if (a > 0x7FFF)
|
||||||
EncodeGG(buf, a, v, c);
|
EncodeGG(buf, a, v, c);
|
||||||
else {
|
else {
|
||||||
if (c == -1)
|
GetCheatCodeStr(buf, a, v, c);
|
||||||
sprintf(buf, "%04X:%02X", (int)a, (int)v);
|
}
|
||||||
else
|
|
||||||
sprintf(buf, "%04X?%02X:%02X", (int)a, (int)c, (int)v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void GetCheatCodeStr(char* buf, int a, int v, int c)
|
||||||
|
{
|
||||||
|
if (c == -1)
|
||||||
|
sprintf(buf, "%04X:%02X", a, v);
|
||||||
|
else
|
||||||
|
sprintf(buf, "%04X?%02X:%02X", a, c, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c)
|
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c)
|
||||||
|
@ -1228,6 +1323,17 @@ void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c)
|
||||||
GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, name, 256);
|
GetDlgItemText(hwndDlg, IDC_CHEAT_NAME, name, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetUIGGInfo(HWND hwndDlg, uint32* a, uint8* v, int* c)
|
||||||
|
{
|
||||||
|
char buf[16];
|
||||||
|
GetDlgItemText(hwndDlg, IDC_GAME_GENIE_ADDR, buf, 5);
|
||||||
|
*a = StrToU16(buf);
|
||||||
|
GetDlgItemText(hwndDlg, IDC_GAME_GENIE_VAL, buf, 3);
|
||||||
|
*v = StrToU8(buf);
|
||||||
|
GetDlgItemText(hwndDlg, IDC_GAME_GENIE_COMP, buf, 3);
|
||||||
|
*c = (buf[0] == 0 ? -1 : StrToU8(buf));
|
||||||
|
}
|
||||||
|
|
||||||
void DisableAllCheats()
|
void DisableAllCheats()
|
||||||
{
|
{
|
||||||
if(FCEU_DisableAllCheats() && hCheat){
|
if(FCEU_DisableAllCheats() && hCheat){
|
||||||
|
@ -1270,3 +1376,111 @@ void UpdateCheatRelatedWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShowCheatFileBox(HWND hwnd, char* buf, bool save)
|
||||||
|
{
|
||||||
|
if (!buf)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char filename[2048] = { 0 };
|
||||||
|
|
||||||
|
OPENFILENAME ofn;
|
||||||
|
memset(&ofn, 0, sizeof(OPENFILENAME));
|
||||||
|
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||||
|
ofn.hInstance = fceu_hInstance;
|
||||||
|
ofn.hwndOwner = hwnd;
|
||||||
|
ofn.lpstrTitle = save ? "Save cheats file" : "Open cheats file";
|
||||||
|
ofn.lpstrFilter = "Cheat files (*.cht)\0*.cht\0All Files (*.*)\0*.*\0\0";
|
||||||
|
|
||||||
|
// I gave up setting the default filename for import cheat dialog, since the filename display contains a bug.
|
||||||
|
if (save)
|
||||||
|
{
|
||||||
|
if (GameInfo)
|
||||||
|
{
|
||||||
|
char* _filename;
|
||||||
|
if ((_filename = strrchr(GameInfo->filename, '\\')) || (_filename = strrchr(GameInfo->filename, '/')))
|
||||||
|
strcpy(filename, _filename + 1);
|
||||||
|
else
|
||||||
|
strcpy(filename, GameInfo->filename);
|
||||||
|
|
||||||
|
_filename = strrchr(filename, '.');
|
||||||
|
if (_filename)
|
||||||
|
strcpy(_filename, ".cht");
|
||||||
|
else
|
||||||
|
strcat(filename, ".cht");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ofn.lpstrFile = filename;
|
||||||
|
ofn.nMaxFile = sizeof(filename);
|
||||||
|
ofn.lpstrDefExt = "cht";
|
||||||
|
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST;
|
||||||
|
ofn.lpstrInitialDir = FCEU_GetPath(FCEUMKF_CHEAT).c_str();
|
||||||
|
|
||||||
|
if (save ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn))
|
||||||
|
{
|
||||||
|
strcpy(buf, filename);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AskSaveCheat()
|
||||||
|
{
|
||||||
|
if (cheats)
|
||||||
|
{
|
||||||
|
HWND hwnd = hCheat ? hCheat : hAppWnd;
|
||||||
|
if (MessageBox(hwnd, "Save cheats?", "Cheat Console", MB_YESNO | MB_ICONASTERISK) == IDYES)
|
||||||
|
SaveCheatAs(hwnd, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SaveCheatAs(HWND hwnd, bool flush)
|
||||||
|
{
|
||||||
|
if (cheats)
|
||||||
|
{
|
||||||
|
char filename[2048];
|
||||||
|
if (ShowCheatFileBox(hwnd, filename, true))
|
||||||
|
{
|
||||||
|
FILE* file = FCEUD_UTF8fopen(filename, "wb");
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
if (flush)
|
||||||
|
{
|
||||||
|
savecheats = 1;
|
||||||
|
FCEU_FlushGameCheats(file, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
FCEU_SaveGameCheats(file);
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MessageBox(hwnd, "Error saving cheats!", "Cheat Console", MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupCheatFont(HWND hwnd)
|
||||||
|
{
|
||||||
|
if (!hCheat && !hGGConv)
|
||||||
|
{
|
||||||
|
hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
|
||||||
|
LOGFONT lf;
|
||||||
|
GetObject(hFont, sizeof(LOGFONT), &lf);
|
||||||
|
strcpy(lf.lfFaceName, "Courier New");
|
||||||
|
hNewFont = CreateFontIndirect(&lf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeleteCheatFont()
|
||||||
|
{
|
||||||
|
if (!hCheat && !hGGConv)
|
||||||
|
{
|
||||||
|
DeleteObject(hFont);
|
||||||
|
DeleteObject(hNewFont);
|
||||||
|
hFont = NULL;
|
||||||
|
hNewFont = NULL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
//--
|
//--
|
||||||
//mbg merge 7/18/06 had to make these extern
|
//mbg merge 7/18/06 had to make these extern
|
||||||
|
#ifndef WIN_CHEAT_H
|
||||||
|
#define WIN_CHEAT_H
|
||||||
extern int CheatWindow,CheatStyle; //bbit edited: this line added
|
extern int CheatWindow,CheatStyle; //bbit edited: this line added
|
||||||
extern HWND hCheat;
|
extern HWND hCheat;
|
||||||
|
|
||||||
|
@ -18,14 +20,28 @@ void UpdateCheatsAdded();
|
||||||
void ToggleCheatInputMode(HWND hwndDlg, int modeId);
|
void ToggleCheatInputMode(HWND hwndDlg, int modeId);
|
||||||
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c);
|
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c);
|
||||||
inline void GetCheatStr(char* buf, int a, int v, int c);
|
inline void GetCheatStr(char* buf, int a, int v, int c);
|
||||||
|
inline void GetCheatCodeStr(char* buf, int a, int v, int c);
|
||||||
|
|
||||||
extern unsigned int FrozenAddressCount;
|
extern unsigned int FrozenAddressCount;
|
||||||
extern std::vector<uint16> FrozenAddresses;
|
extern std::vector<uint16> FrozenAddresses;
|
||||||
//void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line
|
//void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line
|
||||||
|
extern struct CHEATF* cheats;
|
||||||
|
extern char* GameGenieLetters;
|
||||||
|
|
||||||
void DisableAllCheats();
|
void DisableAllCheats();
|
||||||
|
bool ShowCheatFileBox(HWND hwnd, char* buf, bool save = false);
|
||||||
|
void AskSaveCheat();
|
||||||
|
void SaveCheatAs(HWND hwnd, bool flush = false);
|
||||||
|
|
||||||
void UpdateCheatRelatedWindow();
|
void UpdateCheatRelatedWindow();
|
||||||
|
void SetupCheatFont(HWND hDlg);
|
||||||
|
void DeleteCheatFont();
|
||||||
|
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||||
|
|
||||||
|
extern BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP);
|
||||||
|
extern WNDPROC DefaultEditCtrlProc;
|
||||||
|
|
||||||
|
|
||||||
// deselect the old one and select the new one
|
// deselect the old one and select the new one
|
||||||
#define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \
|
#define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \
|
||||||
|
@ -35,9 +51,11 @@ SendMessage(hwnd, LVM_SETITEMSTATE, newIndex, (LPARAM)&(lvi.state = LVIS_SELECTE
|
||||||
SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, newIndex)
|
SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, newIndex)
|
||||||
|
|
||||||
#define ClearCheatListText(hwnd) \
|
#define ClearCheatListText(hwnd) \
|
||||||
(SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPTSTR)"") & \
|
(SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPCSTR)"") & \
|
||||||
SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \
|
SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPCSTR)"") & \
|
||||||
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \
|
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPCSTR)"") & \
|
||||||
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)"") & \
|
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPCSTR)"") & \
|
||||||
SetDlgItemText(hwnd, IDC_CHEAT_TEXT, (LPTSTR)""))
|
SetDlgItemText(hwnd, IDC_CHEAT_TEXT, (LPCSTR)"") & \
|
||||||
|
SetDlgItemText(hwnd, IDC_CHEAT_GAME_GENIE_TEXT, (LPCSTR)""))
|
||||||
|
|
||||||
|
#endif
|
|
@ -56,6 +56,8 @@ extern bool rightClickEnabled;
|
||||||
extern bool fullscreenByDoubleclick;
|
extern bool fullscreenByDoubleclick;
|
||||||
extern int CurrentState;
|
extern int CurrentState;
|
||||||
extern bool pauseWhileActive; //adelikat: Cheats dialog
|
extern bool pauseWhileActive; //adelikat: Cheats dialog
|
||||||
|
extern int globalCheatDisabled;
|
||||||
|
extern int disableAutoLSCheats;
|
||||||
extern bool enableHUDrecording;
|
extern bool enableHUDrecording;
|
||||||
extern bool disableMovieMessages;
|
extern bool disableMovieMessages;
|
||||||
extern bool replaceP2StartWithMicrophone;
|
extern bool replaceP2StartWithMicrophone;
|
||||||
|
@ -466,6 +468,8 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
AC(backupSavestates),
|
AC(backupSavestates),
|
||||||
AC(compressSavestates),
|
AC(compressSavestates),
|
||||||
AC(pauseWhileActive),
|
AC(pauseWhileActive),
|
||||||
|
AC(disableAutoLSCheats),
|
||||||
|
AC(globalCheatDisabled),
|
||||||
AC(enableHUDrecording),
|
AC(enableHUDrecording),
|
||||||
AC(disableMovieMessages),
|
AC(disableMovieMessages),
|
||||||
AC(replaceP2StartWithMicrophone),
|
AC(replaceP2StartWithMicrophone),
|
||||||
|
|
|
@ -70,7 +70,7 @@ static HMENU hDisasmcontext; //Handle to context menu
|
||||||
static HMENU hDisasmcontextsub; //Handle to context sub menu
|
static HMENU hDisasmcontextsub; //Handle to context sub menu
|
||||||
WNDPROC IDC_DEBUGGER_DISASSEMBLY_oldWndProc = 0;
|
WNDPROC IDC_DEBUGGER_DISASSEMBLY_oldWndProc = 0;
|
||||||
|
|
||||||
static HFONT hFont;
|
// static HFONT hFont;
|
||||||
static SCROLLINFO si;
|
static SCROLLINFO si;
|
||||||
|
|
||||||
bool debuggerAutoload = false;
|
bool debuggerAutoload = false;
|
||||||
|
@ -278,6 +278,10 @@ INT_PTR CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
CenterWindow(hwndDlg);
|
CenterWindow(hwndDlg);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_START, EM_SETLIMITTEXT, 4, 0);
|
SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_START, EM_SETLIMITTEXT, 4, 0);
|
||||||
SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_END, EM_SETLIMITTEXT, 4, 0);
|
SendDlgItemMessage(hwndDlg, IDC_ADDBP_ADDR_END, EM_SETLIMITTEXT, 4, 0);
|
||||||
|
|
||||||
|
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_ADDBP_ADDR_START), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_ADDBP_ADDR_END), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
|
||||||
if (WP_edit >= 0)
|
if (WP_edit >= 0)
|
||||||
{
|
{
|
||||||
SetWindowText(hwndDlg,"Edit Breakpoint...");
|
SetWindowText(hwndDlg,"Edit Breakpoint...");
|
||||||
|
@ -359,7 +363,7 @@ INT_PTR CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
int tmp = NewBreakWindows(hwndDlg,WP_edit,(BOOL)(watchpoint[WP_edit].flags&WP_E));
|
int tmp = NewBreakWindows(hwndDlg,WP_edit,(BOOL)(watchpoint[WP_edit].flags&WP_E));
|
||||||
if (tmp == 2 || tmp == INVALID_BREAKPOINT_CONDITION)
|
if (tmp == 2 || tmp == INVALID_BREAKPOINT_CONDITION)
|
||||||
{
|
{
|
||||||
MessageBox(hwndDlg, "Invalid breakpoint condition", "Error", MB_OK);
|
MessageBox(hwndDlg, "Invalid breakpoint condition", "Error", MB_OK | MB_ICONERROR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EndDialog(hwndDlg,1);
|
EndDialog(hwndDlg,1);
|
||||||
|
@ -1820,6 +1824,14 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETLIMITTEXT,4,0);
|
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETLIMITTEXT,4,0);
|
||||||
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,EM_SETLIMITTEXT,2,0);
|
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,EM_SETLIMITTEXT,2,0);
|
||||||
|
|
||||||
|
// limit input
|
||||||
|
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PCSEEK), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_PC), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_A), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_VAL_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_DEBUGGER_BOOKMARK), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
|
||||||
//I'm lazy, disable the controls which I can't mess with right now
|
//I'm lazy, disable the controls which I can't mess with right now
|
||||||
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETREADONLY,TRUE,0);
|
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETREADONLY,TRUE,0);
|
||||||
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,EM_SETREADONLY,TRUE,0);
|
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,EM_SETREADONLY,TRUE,0);
|
||||||
|
@ -2475,11 +2487,11 @@ void UpdatePatcher(HWND hwndDlg){
|
||||||
|
|
||||||
/// Updates debugger controls that should be enabled/disabled if a game is loaded.
|
/// Updates debugger controls that should be enabled/disabled if a game is loaded.
|
||||||
/// @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
/// @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
||||||
void updateGameDependentMenusDebugger(unsigned int enable) {
|
void updateGameDependentMenusDebugger() {
|
||||||
if (!hDebug)
|
if (!hDebug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//EnableWindow(GetDlgItem(hDebug,DEBUGLOADDEB),(enable ? 0 : 1));
|
// EnableWindow(GetDlgItem(hDebug,DEBUGLOADDEB), GameInfo != 0 ? FALSE : TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoDebug(uint8 halt)
|
void DoDebug(uint8 halt)
|
||||||
|
@ -2496,7 +2508,7 @@ void DoDebug(uint8 halt)
|
||||||
ShowWindow(hDebug, SW_SHOWNORMAL);
|
ShowWindow(hDebug, SW_SHOWNORMAL);
|
||||||
SetForegroundWindow(hDebug);
|
SetForegroundWindow(hDebug);
|
||||||
|
|
||||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
updateGameDependentMenusDebugger();
|
||||||
|
|
||||||
if (GameInfo)
|
if (GameInfo)
|
||||||
UpdateDebugger(true);
|
UpdateDebugger(true);
|
||||||
|
|
|
@ -43,7 +43,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr);
|
||||||
void PrintOffsetToSeekAndBookmarkFields(int offset);
|
void PrintOffsetToSeekAndBookmarkFields(int offset);
|
||||||
|
|
||||||
void LoadGameDebuggerData(HWND hwndDlg);
|
void LoadGameDebuggerData(HWND hwndDlg);
|
||||||
void updateGameDependentMenusDebugger(unsigned int enable);
|
void updateGameDependentMenusDebugger();
|
||||||
|
|
||||||
extern bool inDebugger;
|
extern bool inDebugger;
|
||||||
|
|
||||||
|
@ -69,5 +69,7 @@ public:
|
||||||
|
|
||||||
} *debugSystem;
|
} *debugSystem;
|
||||||
|
|
||||||
|
// extern WNDPROC DefaultEditCtrlProc;
|
||||||
|
// extern LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef HEADEREDITOR_H
|
||||||
|
#define HEADEREDITOR_H
|
||||||
|
|
||||||
|
struct iNES_HEADER;
|
||||||
|
|
||||||
|
extern HWND hHeadEditor;
|
||||||
|
void DoHeadEdit();
|
||||||
|
|
||||||
|
HWND InitHeaderEditDialog(HWND hwnd, iNES_HEADER* header);
|
||||||
|
bool ShowINESFileBox(HWND parent, char* buf = NULL, bool save = false);
|
||||||
|
void ToggleINES20(HWND hwnd, bool ines20);
|
||||||
|
void ToggleExtendSystemList(HWND hwnd, bool enable);
|
||||||
|
void ToggleVSSystemGroup(HWND hwnd, bool enable);
|
||||||
|
void ToggleUnofficialPropertiesEnabled(HWND hwnd, bool ines20, bool check);
|
||||||
|
void ToggleUnofficialExtraRegionCode(HWND hwnd, bool ines20, bool unofficial_check, bool check);
|
||||||
|
void ToggleUnofficialPrgRamPresent(HWND hwnd, bool ines20, bool unofficial_check, bool check);
|
||||||
|
void SetHeaderData(HWND hwnd, iNES_HEADER* header);
|
||||||
|
bool LoadHeader(HWND parent, iNES_HEADER* header);
|
||||||
|
bool WriteHeaderData(HWND hwnd, iNES_HEADER* header);
|
||||||
|
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value);
|
||||||
|
bool SearchByString(HWND hwnd, UINT id, int* value, char* buf);
|
||||||
|
bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exact = false);
|
||||||
|
bool SaveINESFile(HWND hwnd, char* path, iNES_HEADER* header);
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP);
|
||||||
|
extern WNDPROC DefaultEditCtrlProc;
|
||||||
|
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP);
|
||||||
|
|
||||||
|
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||||
|
#endif
|
|
@ -102,9 +102,9 @@ void WinLuaOnStop(int hDlgAsInt)
|
||||||
|
|
||||||
INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
RECT r;
|
// RECT r;
|
||||||
RECT r2;
|
// RECT r2;
|
||||||
int dx1, dy1, dx2, dy2;
|
// int dx1, dy1, dx2, dy2;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
|
||||||
|
@ -113,42 +113,9 @@ INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
|
||||||
// remove the 30000 character limit from the console control
|
// remove the 30000 character limit from the console control
|
||||||
SendMessage(GetDlgItem(hDlg, IDC_LUACONSOLE),EM_LIMITTEXT,0,0);
|
SendMessage(GetDlgItem(hDlg, IDC_LUACONSOLE),EM_LIMITTEXT,0,0);
|
||||||
|
|
||||||
GetWindowRect(hAppWnd, &r);
|
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||||
dx1 = (r.right - r.left) / 2;
|
CalcSubWindowPos(hDlg, NULL);
|
||||||
dy1 = (r.bottom - r.top) / 2;
|
|
||||||
|
|
||||||
GetWindowRect(hDlg, &r2);
|
|
||||||
dx2 = (r2.right - r2.left) / 2;
|
|
||||||
dy2 = (r2.bottom - r2.top) / 2;
|
|
||||||
|
|
||||||
//int windowIndex = 0;//std::find(LuaScriptHWnds.begin(), LuaScriptHWnds.end(), hDlg) - LuaScriptHWnds.begin();
|
|
||||||
//int staggerOffset = windowIndex * 24;
|
|
||||||
//r.left += staggerOffset;
|
|
||||||
//r.right += staggerOffset;
|
|
||||||
//r.top += staggerOffset;
|
|
||||||
//r.bottom += staggerOffset;
|
|
||||||
|
|
||||||
// push it away from the main window if we can
|
|
||||||
const int width = (r.right-r.left);
|
|
||||||
const int width2 = (r2.right-r2.left);
|
|
||||||
const int rspace = GetSystemMetrics(SM_CXSCREEN)- (r.left+width2+width);
|
|
||||||
if(rspace > r.left && r.left+width2 + width < GetSystemMetrics(SM_CXSCREEN))
|
|
||||||
{
|
|
||||||
r.right += width;
|
|
||||||
r.left += width;
|
|
||||||
}
|
|
||||||
else if((int)r.left - (int)width2 > 0)
|
|
||||||
{
|
|
||||||
r.right -= width2;
|
|
||||||
r.left -= width2;
|
|
||||||
}
|
|
||||||
else if(r.left+width2 + width < GetSystemMetrics(SM_CXSCREEN))
|
|
||||||
{
|
|
||||||
r.right += width;
|
|
||||||
r.left += width;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
|
||||||
|
|
||||||
RECT r3;
|
RECT r3;
|
||||||
GetClientRect(hDlg, &r3);
|
GetClientRect(hDlg, &r3);
|
||||||
|
|
|
@ -321,18 +321,18 @@ int BlockingCheck()
|
||||||
if(GetMessage(&msg, 0, 0, 0) > 0)
|
if(GetMessage(&msg, 0, 0, 0) > 0)
|
||||||
{
|
{
|
||||||
//other accelerator capable dialogs could be added here
|
//other accelerator capable dialogs could be added here
|
||||||
extern HWND hwndMemWatch;
|
|
||||||
|
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
|
||||||
if(hCheat)
|
// Cheat console
|
||||||
if(IsChild(hCheat, msg.hwnd))
|
if(hCheat && IsChild(hCheat, msg.hwnd))
|
||||||
handled = IsDialogMessage(hCheat, &msg);
|
handled = IsDialogMessage(hCheat, &msg);
|
||||||
if(!handled && hMemFind)
|
|
||||||
{
|
// Hex Editor -> Find
|
||||||
if(IsChild(hMemFind, msg.hwnd))
|
if(!handled && hMemFind && IsChild(hMemFind, msg.hwnd))
|
||||||
handled = IsDialogMessage(hMemFind, &msg);
|
handled = IsDialogMessage(hMemFind, &msg);
|
||||||
}
|
|
||||||
|
// Memory Watch
|
||||||
|
extern HWND hwndMemWatch;
|
||||||
if(!handled && hwndMemWatch)
|
if(!handled && hwndMemWatch)
|
||||||
{
|
{
|
||||||
if(IsChild(hwndMemWatch, msg.hwnd))
|
if(IsChild(hwndMemWatch, msg.hwnd))
|
||||||
|
@ -340,65 +340,94 @@ int BlockingCheck()
|
||||||
if(!handled)
|
if(!handled)
|
||||||
handled = IsDialogMessage(hwndMemWatch,&msg);
|
handled = IsDialogMessage(hwndMemWatch,&msg);
|
||||||
}
|
}
|
||||||
if(!handled && RamSearchHWnd)
|
|
||||||
{
|
// RAM Search
|
||||||
|
if(!handled && RamSearchHWnd && IsChild(RamSearchHWnd, msg.hwnd))
|
||||||
handled = IsDialogMessage(RamSearchHWnd, &msg);
|
handled = IsDialogMessage(RamSearchHWnd, &msg);
|
||||||
}
|
|
||||||
|
// RAM_Watch
|
||||||
if(!handled && RamWatchHWnd)
|
if(!handled && RamWatchHWnd)
|
||||||
{
|
if(handled = IsDialogMessage(RamWatchHWnd, &msg))
|
||||||
if(IsDialogMessage(RamWatchHWnd, &msg))
|
|
||||||
{
|
|
||||||
if(msg.message == WM_KEYDOWN) // send keydown messages to the dialog (for accelerators, and also needed for the Alt key to work)
|
if(msg.message == WM_KEYDOWN) // send keydown messages to the dialog (for accelerators, and also needed for the Alt key to work)
|
||||||
SendMessage(RamWatchHWnd, msg.message, msg.wParam, msg.lParam);
|
SendMessage(RamWatchHWnd, msg.message, msg.wParam, msg.lParam);
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TAS Editor
|
||||||
if(!handled && taseditorWindow.hwndTASEditor)
|
if(!handled && taseditorWindow.hwndTASEditor)
|
||||||
{
|
{
|
||||||
if(taseditorEnableAcceleratorKeys)
|
if(taseditorEnableAcceleratorKeys)
|
||||||
if(IsChild(taseditorWindow.hwndTASEditor, msg.hwnd))
|
if(IsChild(taseditorWindow.hwndTASEditor, msg.hwnd))
|
||||||
handled = TranslateAccelerator(taseditorWindow.hwndTASEditor, fceu_hAccel, &msg);
|
handled = TranslateAccelerator(taseditorWindow.hwndTASEditor, fceu_hAccel, &msg);
|
||||||
if(!handled && taseditorWindow.hwndTASEditor){
|
if(!handled){
|
||||||
handled = IsDialogMessage(taseditorWindow.hwndTASEditor, &msg);
|
handled = IsDialogMessage(taseditorWindow.hwndTASEditor, &msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!handled && taseditorWindow.hwndFindNote)
|
|
||||||
{
|
|
||||||
if(IsChild(taseditorWindow.hwndFindNote, msg.hwnd))
|
|
||||||
handled = IsDialogMessage(taseditorWindow.hwndFindNote, &msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TAS Editor -> Find Node
|
||||||
|
if(!handled && taseditorWindow.hwndFindNote && IsChild(taseditorWindow.hwndFindNote, msg.hwnd))
|
||||||
|
handled = IsDialogMessage(taseditorWindow.hwndFindNote, &msg);
|
||||||
|
|
||||||
|
// Sound Config
|
||||||
extern HWND uug;
|
extern HWND uug;
|
||||||
if(!handled && uug && IsChild(uug, msg.hwnd))
|
if(!handled && uug && IsChild(uug, msg.hwnd))
|
||||||
handled = IsDialogMessage(uug, &msg);
|
handled = IsDialogMessage(uug, &msg);
|
||||||
if(!handled && pwindow && IsChild(pwindow, msg.hwnd))
|
|
||||||
handled = IsDialogMessage(pwindow, &msg);
|
// Palette Config
|
||||||
|
extern HWND hWndPal;
|
||||||
|
if(!handled && hWndPal && IsChild(hWndPal, msg.hwnd))
|
||||||
|
handled = IsDialogMessage(hWndPal, &msg);
|
||||||
|
|
||||||
|
// Code/Data Logger
|
||||||
if(!handled && hCDLogger && IsChild(hCDLogger, msg.hwnd))
|
if(!handled && hCDLogger && IsChild(hCDLogger, msg.hwnd))
|
||||||
handled = IsDialogMessage(hCDLogger, &msg);
|
handled = IsDialogMessage(hCDLogger, &msg);
|
||||||
|
|
||||||
|
// Trace Logger
|
||||||
if(!handled && hTracer && IsChild(hTracer, msg.hwnd))
|
if(!handled && hTracer && IsChild(hTracer, msg.hwnd))
|
||||||
handled = IsDialogMessage(hTracer, &msg);
|
handled = IsDialogMessage(hTracer, &msg);
|
||||||
|
|
||||||
|
// Game Genie Encoder/Decoder
|
||||||
extern HWND hGGConv;
|
extern HWND hGGConv;
|
||||||
if(!handled && hGGConv && IsChild(hGGConv, msg.hwnd))
|
if(!handled && hGGConv && IsChild(hGGConv, msg.hwnd))
|
||||||
handled = IsDialogMessage(hGGConv, &msg);
|
handled = IsDialogMessage(hGGConv, &msg);
|
||||||
|
|
||||||
|
// Debugger
|
||||||
if(!handled && hDebug && IsChild(hDebug, msg.hwnd))
|
if(!handled && hDebug && IsChild(hDebug, msg.hwnd))
|
||||||
handled = IsDialogMessage(hDebug, &msg);
|
handled = IsDialogMessage(hDebug, &msg);
|
||||||
|
|
||||||
|
// PPU Viewer
|
||||||
extern HWND hPPUView;
|
extern HWND hPPUView;
|
||||||
if(!handled && hPPUView && IsChild(hPPUView, msg.hwnd))
|
if(!handled && hPPUView && IsChild(hPPUView, msg.hwnd))
|
||||||
handled = IsDialogMessage(hPPUView, &msg);
|
handled = IsDialogMessage(hPPUView, &msg);
|
||||||
|
|
||||||
|
// Nametable Viewer
|
||||||
extern HWND hNTView;
|
extern HWND hNTView;
|
||||||
if(!handled && hNTView && IsChild(hNTView, msg.hwnd))
|
if(!handled && hNTView && IsChild(hNTView, msg.hwnd))
|
||||||
handled = IsDialogMessage(hNTView, &msg);
|
handled = IsDialogMessage(hNTView, &msg);
|
||||||
|
|
||||||
|
// Text Hooker
|
||||||
extern HWND hTextHooker;
|
extern HWND hTextHooker;
|
||||||
if(!handled && hTextHooker && IsChild(hTextHooker, msg.hwnd))
|
if(!handled && hTextHooker && IsChild(hTextHooker, msg.hwnd))
|
||||||
handled = IsDialogMessage(hTextHooker, &msg);
|
handled = IsDialogMessage(hTextHooker, &msg);
|
||||||
|
|
||||||
|
// Lua Scripts
|
||||||
extern HWND LuaConsoleHWnd;
|
extern HWND LuaConsoleHWnd;
|
||||||
if(!handled && LuaConsoleHWnd && IsChild(LuaConsoleHWnd, msg.hwnd))
|
if(!handled && LuaConsoleHWnd && IsChild(LuaConsoleHWnd, msg.hwnd))
|
||||||
handled = IsDialogMessage(LuaConsoleHWnd, &msg);
|
handled = IsDialogMessage(LuaConsoleHWnd, &msg);
|
||||||
|
|
||||||
|
// Logs
|
||||||
extern HWND logwin;
|
extern HWND logwin;
|
||||||
if(!handled && logwin && IsChild(logwin, msg.hwnd))
|
if(!handled && logwin && IsChild(logwin, msg.hwnd))
|
||||||
handled = IsDialogMessage(logwin, &msg);
|
handled = IsDialogMessage(logwin, &msg);
|
||||||
|
|
||||||
|
// Header Editor
|
||||||
|
extern HWND hHeadEditor;
|
||||||
|
if (!handled && hHeadEditor && IsChild(hHeadEditor, msg.hwnd))
|
||||||
|
handled = IsDialogMessage(hHeadEditor, &msg);
|
||||||
|
|
||||||
|
// Netplay (Though it's quite dummy and nearly forgotten)
|
||||||
|
extern HWND netwin;
|
||||||
|
if (!handled && netwin && IsChild(netwin, msg.hwnd))
|
||||||
|
handled = IsDialogMessage(netwin, &msg);
|
||||||
|
|
||||||
/* //adelikat - Currently no accel keys are used in the main window. Uncomment this block to activate them.
|
/* //adelikat - Currently no accel keys are used in the main window. Uncomment this block to activate them.
|
||||||
if(!handled)
|
if(!handled)
|
||||||
if(msg.hwnd == hAppWnd)
|
if(msg.hwnd == hAppWnd)
|
||||||
|
@ -410,6 +439,7 @@ int BlockingCheck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!handled)
|
if(!handled)
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
|
@ -467,7 +497,7 @@ void DoFCEUExit()
|
||||||
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR) && !exitTASEditor())
|
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR) && !exitTASEditor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CloseMemoryWatch() && AskSave()) //If user was asked to save changes in the memory watch dialog or ram watch, and chose cancel, don't close FCEUX!
|
if (CloseMemoryWatch() && AskSaveRamWatch()) //If user was asked to save changes in the memory watch dialog or ram watch, and chose cancel, don't close FCEUX!
|
||||||
{
|
{
|
||||||
if(goptions & GOO_CONFIRMEXIT)
|
if(goptions & GOO_CONFIRMEXIT)
|
||||||
{
|
{
|
||||||
|
@ -1124,14 +1154,14 @@ void FCEUD_ToggleStatusIcon(void)
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *GetRomName()
|
char *GetRomName(bool force)
|
||||||
{
|
{
|
||||||
//The purpose of this function is to format the ROM name stored in LoadedRomFName
|
//The purpose of this function is to format the ROM name stored in LoadedRomFName
|
||||||
//And return a char array with just the name with path or extension
|
//And return a char array with just the name with path or extension
|
||||||
//The purpose of this function is to populate a save as dialog with the ROM name as a default filename
|
//The purpose of this function is to populate a save as dialog with the ROM name as a default filename
|
||||||
extern char LoadedRomFName[2048]; //Contains full path of ROM
|
extern char LoadedRomFName[2048]; //Contains full path of ROM
|
||||||
std::string Rom; //Will contain the formatted path
|
std::string Rom; //Will contain the formatted path
|
||||||
if(GameInfo) //If ROM is loaded
|
if(GameInfo || force) //If ROM is loaded
|
||||||
{
|
{
|
||||||
char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX];
|
char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX];
|
||||||
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
||||||
|
@ -1145,14 +1175,14 @@ char *GetRomName()
|
||||||
return mystring;
|
return mystring;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *GetRomPath()
|
char *GetRomPath(bool force)
|
||||||
{
|
{
|
||||||
//The purpose of this function is to format the ROM name stored in LoadedRomFName
|
//The purpose of this function is to format the ROM name stored in LoadedRomFName
|
||||||
//And return a char array with just the name with path or extension
|
//And return a char array with just the name with path or extension
|
||||||
//The purpose of this function is to populate a save as dialog with the ROM name as a default filename
|
//The purpose of this function is to populate a save as dialog with the ROM name as a default filename
|
||||||
extern char LoadedRomFName[2048]; //Contains full path of ROM
|
extern char LoadedRomFName[2048]; //Contains full path of ROM
|
||||||
std::string Rom; //Will contain the formatted path
|
std::string Rom; //Will contain the formatted path
|
||||||
if(GameInfo) //If ROM is loaded
|
if(GameInfo || force) //If ROM is loaded
|
||||||
{
|
{
|
||||||
char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX];
|
char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX];
|
||||||
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
||||||
|
|
|
@ -65,8 +65,8 @@ extern int vmod;
|
||||||
|
|
||||||
extern char* directory_names[14];
|
extern char* directory_names[14];
|
||||||
|
|
||||||
char *GetRomName(); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension
|
char *GetRomName(bool force = false); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension
|
||||||
char *GetRomPath(); //Checks if rom is loaded, if so, outputs the Rom path only
|
char *GetRomPath(bool force = false); //Checks if rom is loaded, if so, outputs the Rom path only
|
||||||
|
|
||||||
///Contains the names of the default directories.
|
///Contains the names of the default directories.
|
||||||
static const char *default_directory_names[13] = {
|
static const char *default_directory_names[13] = {
|
||||||
|
|
|
@ -316,7 +316,7 @@ static int GetFileData(uint32 offset){
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WriteFileData(uint32 addr,int data){
|
static int WriteFileData(uint32 addr,int data){
|
||||||
if (addr < 16)MessageBox(hMemView,"Sorry", "Go bug bbit if you really want to edit the header.", MB_OK);
|
if (addr < 16) MessageBox(hMemView, "You can't edit ROM header here, however you can use iNES Header Editor to edit the header if it's an iNES format file.", "Sorry", MB_OK | MB_ICONERROR);
|
||||||
if((addr >= 16) && (addr < PRGsize[0]+16)) *(uint8 *)(GetNesPRGPointer(addr-16)) = data;
|
if((addr >= 16) && (addr < PRGsize[0]+16)) *(uint8 *)(GetNesPRGPointer(addr-16)) = data;
|
||||||
if((addr >= PRGsize[0]+16) && (addr < CHRsize[0]+PRGsize[0]+16)) *(uint8 *)(GetNesCHRPointer(addr-16-PRGsize[0])) = data;
|
if((addr >= PRGsize[0]+16) && (addr < CHRsize[0]+PRGsize[0]+16)) *(uint8 *)(GetNesCHRPointer(addr-16-PRGsize[0])) = data;
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ void MemwAddRecentFile(const char *filename)
|
||||||
UpdateMemwRecentArray(filename, memw_recent_files, MEMW_MAX_NUMBER_OF_RECENT_FILES, memwrecentmenu, ID_FILE_RECENT, MEMW_MENU_FIRST_RECENT_FILE);
|
UpdateMemwRecentArray(filename, memw_recent_files, MEMW_MAX_NUMBER_OF_RECENT_FILES, memwrecentmenu, ID_FILE_RECENT, MEMW_MENU_FIRST_RECENT_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int MW_ADDR_Lookup[] = {
|
static const int MW_ADDR[] = {
|
||||||
MW_ADDR00, MW_ADDR01, MW_ADDR02, MW_ADDR03,
|
MW_ADDR00, MW_ADDR01, MW_ADDR02, MW_ADDR03,
|
||||||
MW_ADDR04, MW_ADDR05, MW_ADDR06, MW_ADDR07,
|
MW_ADDR04, MW_ADDR05, MW_ADDR06, MW_ADDR07,
|
||||||
MW_ADDR08, MW_ADDR09, MW_ADDR10, MW_ADDR11,
|
MW_ADDR08, MW_ADDR09, MW_ADDR10, MW_ADDR11,
|
||||||
|
@ -209,11 +209,42 @@ static const int MW_ADDR_Lookup[] = {
|
||||||
MW_ADDR16, MW_ADDR17, MW_ADDR18, MW_ADDR19,
|
MW_ADDR16, MW_ADDR17, MW_ADDR18, MW_ADDR19,
|
||||||
MW_ADDR20, MW_ADDR21, MW_ADDR22, MW_ADDR23
|
MW_ADDR20, MW_ADDR21, MW_ADDR22, MW_ADDR23
|
||||||
};
|
};
|
||||||
inline int MW_ADDR(int i) { return MW_ADDR_Lookup[i] ; }
|
static const int MW_NAME[] =
|
||||||
inline int MW_NAME(int i) { return MW_ADDR_Lookup[i]-1; }
|
{
|
||||||
inline int MW_VAL (int i) { return MW_ADDR_Lookup[i]+1; }
|
MW_NAME00, MW_NAME01, MW_NAME02, MW_NAME03,
|
||||||
|
MW_NAME04, MW_NAME05, MW_NAME06, MW_NAME07,
|
||||||
|
MW_NAME08, MW_NAME09, MW_NAME10, MW_NAME11,
|
||||||
|
MW_NAME12, MW_NAME13, MW_NAME14, MW_NAME15,
|
||||||
|
MW_NAME16, MW_NAME17, MW_NAME18, MW_NAME19,
|
||||||
|
MW_NAME20, MW_NAME21, MW_NAME22, MW_NAME23
|
||||||
|
};
|
||||||
|
static const int MW_VAL[] = {
|
||||||
|
MW_VAL00, MW_VAL01, MW_VAL02, MW_VAL03,
|
||||||
|
MW_VAL04, MW_VAL05, MW_VAL06, MW_VAL07,
|
||||||
|
MW_VAL08, MW_VAL09, MW_VAL10, MW_VAL11,
|
||||||
|
MW_VAL12, MW_VAL13, MW_VAL14, MW_VAL15,
|
||||||
|
MW_VAL16, MW_VAL17, MW_VAL18, MW_VAL19,
|
||||||
|
MW_VAL20, MW_VAL21, MW_VAL22, MW_VAL23
|
||||||
|
};
|
||||||
|
static const int MW_RESET[] = {
|
||||||
|
MEMW_EDIT00RESET, MEMW_EDIT01RESET,
|
||||||
|
MEMW_EDIT02RESET, MEMW_EDIT03RESET
|
||||||
|
};
|
||||||
|
static const int MW_RESULT[] = {
|
||||||
|
EDIT00_RESULTS, EDIT01_RESULTS,
|
||||||
|
EDIT02_RESULTS, EDIT03_RESULTS
|
||||||
|
};
|
||||||
|
static const int MW_RMADDR[] = {
|
||||||
|
MEMW_EDIT00RMADDRESS, MEMW_EDIT01RMADDRESS,
|
||||||
|
MEMW_EDIT02RMADDRESS, MEMW_EDIT03RMADDRESS
|
||||||
|
};
|
||||||
|
static const int MW_EDITFORMULA[] = {
|
||||||
|
MEMW_EDIT00FORMULA, MEMW_EDIT01FORMULA,
|
||||||
|
MEMW_EDIT02FORMULA, MEMW_EDIT03FORMULA
|
||||||
|
};
|
||||||
|
|
||||||
static const int MWNUM = ARRAY_SIZE(MW_ADDR_Lookup);
|
|
||||||
|
static const int MWNUM = ARRAY_SIZE(MW_ADDR);
|
||||||
|
|
||||||
static int yPositions[MWNUM];
|
static int yPositions[MWNUM];
|
||||||
static int xPositions[MWNUM];
|
static int xPositions[MWNUM];
|
||||||
|
@ -223,7 +254,7 @@ static struct MWRec
|
||||||
static int findIndex(WORD ctl)
|
static int findIndex(WORD ctl)
|
||||||
{
|
{
|
||||||
for(int i=0;i<MWNUM;i++)
|
for(int i=0;i<MWNUM;i++)
|
||||||
if(MW_ADDR(i) == ctl)
|
if(MW_ADDR[i] == ctl)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -346,8 +377,8 @@ static void SaveStrings()
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<MWNUM;i++)
|
for(i=0;i<MWNUM;i++)
|
||||||
{
|
{
|
||||||
GetDlgItemText(hwndMemWatch,MW_ADDR(i),addresses[i],ADDRESSLENGTH);
|
GetDlgItemText(hwndMemWatch,MW_ADDR[i],addresses[i],ADDRESSLENGTH);
|
||||||
GetDlgItemText(hwndMemWatch,MW_NAME(i),labels[i],LABELLENGTH);
|
GetDlgItemText(hwndMemWatch,MW_NAME[i],labels[i],LABELLENGTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,9 +596,9 @@ static void LoadMemWatch()
|
||||||
addresses[i][tempal] = 0;
|
addresses[i][tempal] = 0;
|
||||||
labels[i][templl] = 0; //just in case
|
labels[i][templl] = 0; //just in case
|
||||||
|
|
||||||
SetDlgItemText(hwndMemWatch,MW_VAL (i),(LPTSTR) "---");
|
SetDlgItemText(hwndMemWatch,MW_VAL [i],(LPTSTR) "---");
|
||||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
@ -615,9 +646,9 @@ void OpenMemwatchRecentFile(int memwRFileNumber)
|
||||||
addresses[i][tempal] = 0;
|
addresses[i][tempal] = 0;
|
||||||
labels[i][templl] = 0; //just in case
|
labels[i][templl] = 0; //just in case
|
||||||
|
|
||||||
SetDlgItemText(hwndMemWatch,MW_VAL (i),(LPTSTR) "---");
|
SetDlgItemText(hwndMemWatch,MW_VAL [i],(LPTSTR) "---");
|
||||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||||
}
|
}
|
||||||
fclose(fp); //Close the file
|
fclose(fp); //Close the file
|
||||||
fileChanged = false; //Flag that the memwatch file has not been changed since last save
|
fileChanged = false; //Flag that the memwatch file has not been changed since last save
|
||||||
|
@ -686,8 +717,8 @@ void ClearAllText()
|
||||||
{
|
{
|
||||||
addresses[i][0] = 0;
|
addresses[i][0] = 0;
|
||||||
labels[i][0] = 0;
|
labels[i][0] = 0;
|
||||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||||
}
|
}
|
||||||
//Now clear last file used variable (memwLastFilename)
|
//Now clear last file used variable (memwLastFilename)
|
||||||
for (int i=0;i<2048;i++)
|
for (int i=0;i<2048;i++)
|
||||||
|
@ -707,7 +738,7 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
EnableMenuItem(memwmenu,MEMW_FILE_SAVE,MF_BYCOMMAND | (fileChanged ? MF_ENABLED : MF_GRAYED));
|
EnableMenuItem(memwmenu, MEMW_FILE_SAVE, MF_BYCOMMAND | fileChanged ? MF_ENABLED : MF_GRAYED);
|
||||||
break;
|
break;
|
||||||
case WM_MOVE: {
|
case WM_MOVE: {
|
||||||
if (!IsIconic(hwndDlg)) {
|
if (!IsIconic(hwndDlg)) {
|
||||||
|
@ -724,9 +755,18 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
};
|
};
|
||||||
|
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
if (MemWatch_wndx==-32000) MemWatch_wndx=0; //Just in case
|
POINT pt;
|
||||||
if (MemWatch_wndy==-32000) MemWatch_wndy=0; //-32000 bugs can happen as it is a special windows value
|
if (MemWatch_wndx != 0 && MemWatch_wndy != 0)
|
||||||
SetWindowPos(hwndDlg,0,MemWatch_wndx,MemWatch_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
|
{
|
||||||
|
pt.x = MemWatch_wndx;
|
||||||
|
pt.y = MemWatch_wndy;
|
||||||
|
pt = CalcSubWindowPos(hwndDlg, &pt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pt = CalcSubWindowPos(hwndDlg, NULL);
|
||||||
|
MemWatch_wndx = pt.x;
|
||||||
|
MemWatch_wndy = pt.y;
|
||||||
|
|
||||||
hdc = GetDC(hwndDlg);
|
hdc = GetDC(hwndDlg);
|
||||||
SelectObject (hdc, debugSystem->hFixedFont);
|
SelectObject (hdc, debugSystem->hFixedFont);
|
||||||
SetTextAlign(hdc,TA_UPDATECP | TA_TOP | TA_LEFT);
|
SetTextAlign(hdc,TA_UPDATECP | TA_TOP | TA_LEFT);
|
||||||
|
@ -744,14 +784,18 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
if(i >= MWNUM / 2)
|
if(i >= MWNUM / 2)
|
||||||
col = 1;
|
col = 1;
|
||||||
RECT r;
|
RECT r;
|
||||||
GetWindowRect(GetDlgItem(hwndDlg,MW_ADDR(i)),&r);
|
GetWindowRect(GetDlgItem(hwndDlg, MW_ADDR[i]), &r);
|
||||||
ScreenToClient(hwndDlg, (LPPOINT)&r);
|
ScreenToClient(hwndDlg, (LPPOINT)&r);
|
||||||
ScreenToClient(hwndDlg, (LPPOINT)&r.right);
|
ScreenToClient(hwndDlg, (LPPOINT)&r.right);
|
||||||
yPositions[i] = r.top;
|
yPositions[i] = r.top;
|
||||||
yPositions[i] += ((r.bottom-r.top)-debugSystem->fixedFontHeight)/2; //vertically center
|
yPositions[i] += (r.bottom - r.top - debugSystem->fixedFontHeight) / 2; //vertically center
|
||||||
GetWindowRect(GetDlgItem(hwndDlg, kLabelControls[col]), &r);
|
GetWindowRect(GetDlgItem(hwndDlg, kLabelControls[col]), &r);
|
||||||
ScreenToClient(hwndDlg, (LPPOINT)&r);
|
ScreenToClient(hwndDlg, (LPPOINT)&r);
|
||||||
xPositions[i] = r.left;
|
xPositions[i] = r.left;
|
||||||
|
|
||||||
|
// experimental: limit the text length and input to hex values
|
||||||
|
SendDlgItemMessage(hwndDlg, MW_ADDR[i], EM_SETLIMITTEXT, 4, 0);
|
||||||
|
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, MW_ADDR[i]), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Populate Formula pulldown menus
|
//Populate Formula pulldown menus
|
||||||
|
@ -759,9 +803,9 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
{
|
{
|
||||||
for (int y = 0; y < FMAX; y++)
|
for (int y = 0; y < FMAX; y++)
|
||||||
{
|
{
|
||||||
SendDlgItemMessage(hwndDlg, MEMW_EDIT00FORMULA+x,(UINT) CB_ADDSTRING, 0,(LPARAM) formula[y].c_str() );
|
SendDlgItemMessage(hwndDlg, MW_EDITFORMULA[x], (UINT)CB_ADDSTRING, 0, (LPARAM)formula[y].c_str());
|
||||||
}
|
}
|
||||||
SendDlgItemMessage(hwndDlg, MEMW_EDIT00FORMULA+x, CB_SETCURSEL, 0, 0);
|
SendDlgItemMessage(hwndDlg, MW_EDITFORMULA[x], CB_SETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -771,6 +815,7 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
editnow[x] = 0;
|
editnow[x] = 0;
|
||||||
editlast[x]= 0;
|
editlast[x]= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RamChangeInitialize = true;
|
RamChangeInitialize = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -870,7 +915,6 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
case MEMW_EXPANDCOLLAPSE:
|
case MEMW_EXPANDCOLLAPSE:
|
||||||
CollapseWindow();
|
CollapseWindow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MEMW_EDIT00RESET:
|
case MEMW_EDIT00RESET:
|
||||||
RamChangeReset(0);
|
RamChangeReset(0);
|
||||||
break;
|
break;
|
||||||
|
@ -993,9 +1037,9 @@ void CreateMemWatch()
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < MWNUM; i++)
|
for(i = 0; i < MWNUM; i++)
|
||||||
{
|
{
|
||||||
SetDlgItemText(hwndMemWatch,MW_VAL (i),(LPTSTR) "---");
|
SetDlgItemText(hwndMemWatch,MW_VAL [i],(LPTSTR) "---");
|
||||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MemWatchLoadFileOnStart) OpenMemwatchRecentFile(0);
|
if (MemWatchLoadFileOnStart) OpenMemwatchRecentFile(0);
|
||||||
|
@ -1014,10 +1058,10 @@ void AddMemWatch(char memaddress[32])
|
||||||
CreateMemWatch();
|
CreateMemWatch();
|
||||||
for(i = 0; i < MWNUM; i++)
|
for(i = 0; i < MWNUM; i++)
|
||||||
{
|
{
|
||||||
GetDlgItemText(hwndMemWatch,MW_ADDR(i),TempArray,32);
|
GetDlgItemText(hwndMemWatch,MW_ADDR[i],TempArray,32);
|
||||||
if (TempArray[0] == 0)
|
if (TempArray[0] == 0)
|
||||||
{
|
{
|
||||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),memaddress);
|
SetDlgItemText(hwndMemWatch,MW_ADDR[i],memaddress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1039,23 +1083,19 @@ void RamChange()
|
||||||
//Get proper Addr edit box
|
//Get proper Addr edit box
|
||||||
switch (x)
|
switch (x)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: whichADDR = 0; break; //Addr 1
|
||||||
whichADDR = 0; break; //Addr 1
|
case 1: whichADDR = 1; break; //Addr 2
|
||||||
case 1:
|
case 2: whichADDR = 11; break; //Addr 12
|
||||||
whichADDR = 3; break; //Addr 2
|
case 3: whichADDR = 12; break; //Addr 13
|
||||||
case 2:
|
|
||||||
whichADDR = 36; break; //Addr 12
|
|
||||||
case 3:
|
|
||||||
whichADDR = 39; break; //Addr 13
|
|
||||||
}
|
}
|
||||||
GetDlgItemText(hwndMemWatch, MW_ADDR00+(whichADDR), editboxnow[x], 6); //Get Address value of edit00
|
GetDlgItemText(hwndMemWatch, MW_ADDR[whichADDR], editboxnow[x], 6); //Get Address value of edit00
|
||||||
SetDlgItemText(hwndMemWatch, MEMW_EDIT00RMADDRESS+x, editboxnow[x]); //Put Address value
|
SetDlgItemText(hwndMemWatch, MW_RMADDR[x], editboxnow[x]); //Put Address value
|
||||||
editlast[x] = editnow[x]; //Update last value
|
editlast[x] = editnow[x]; //Update last value
|
||||||
editnow[x] = GetMem(mwrec.addr); //Update now value
|
editnow[x] = GetMem(mwrec.addr); //Update now value
|
||||||
|
|
||||||
|
|
||||||
//Calculate Ram Change
|
//Calculate Ram Change
|
||||||
int z = SendDlgItemMessage(hwndMemWatch, MEMW_EDIT00FORMULA+x,(UINT) CB_GETTOPINDEX, 0,0);
|
int z = SendDlgItemMessage(hwndMemWatch, MW_EDITFORMULA[x],(UINT) CB_GETTOPINDEX, 0,0);
|
||||||
switch (z)
|
switch (z)
|
||||||
{
|
{
|
||||||
//Greater than------------------------------------
|
//Greater than------------------------------------
|
||||||
|
@ -1102,7 +1142,7 @@ void RamChangeReset(int x)
|
||||||
{
|
{
|
||||||
editcount[x] = 0;
|
editcount[x] = 0;
|
||||||
sprintf(editchangem[x], "%d", editcount[x]); //Convert counter to text
|
sprintf(editchangem[x], "%d", editcount[x]); //Convert counter to text
|
||||||
SetDlgItemText(hwndMemWatch, EDIT00_RESULTS+x, editchangem[x]); //Display text in results box
|
SetDlgItemText(hwndMemWatch, MW_RESULT[x], editchangem[x]); //Display text in results box
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangeMemwMenuItemText(int menuitem, string text)
|
void ChangeMemwMenuItemText(int menuitem, string text)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
static int recv_tcpwrap(uint8 *buf, int len);
|
static int recv_tcpwrap(uint8 *buf, int len);
|
||||||
static void NetStatAdd(char *text);
|
static void NetStatAdd(char *text);
|
||||||
|
|
||||||
static HWND netwin=0;
|
HWND netwin=0;
|
||||||
|
|
||||||
static char *netstatt[64];
|
static char *netstatt[64];
|
||||||
static int netstattcount=0;
|
static int netstattcount=0;
|
||||||
|
|
|
@ -12,6 +12,7 @@ extern int palsharpness;
|
||||||
extern int palcontrast;
|
extern int palcontrast;
|
||||||
extern int palbrightness;
|
extern int palbrightness;
|
||||||
extern bool paldeemphswap;
|
extern bool paldeemphswap;
|
||||||
|
HWND hWndPal = NULL;
|
||||||
|
|
||||||
bool SetPalette(const char* nameo)
|
bool SetPalette(const char* nameo)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +227,7 @@ INT_PTR CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
case BUTTON_CLOSE:
|
case BUTTON_CLOSE:
|
||||||
gornk:
|
gornk:
|
||||||
DestroyWindow(hwndDlg);
|
DestroyWindow(hwndDlg);
|
||||||
pwindow = 0; // Yay for user race conditions.
|
hWndPal = 0; // Yay for user race conditions.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,13 +241,9 @@ gornk:
|
||||||
**/
|
**/
|
||||||
void ConfigPalette()
|
void ConfigPalette()
|
||||||
{
|
{
|
||||||
if(!pwindow)
|
if(!hWndPal)
|
||||||
{
|
hWndPal = CreateDialog(fceu_hInstance, "PALCONFIG", hAppWnd, PaletteConCallB);
|
||||||
pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
SetFocus(hWndPal);
|
||||||
SetFocus(pwindow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1245,7 +1245,6 @@ LRESULT CustomDraw (LPARAM lParam)
|
||||||
{
|
{
|
||||||
case CDDS_PREPAINT :
|
case CDDS_PREPAINT :
|
||||||
return CDRF_NOTIFYITEMDRAW;
|
return CDRF_NOTIFYITEMDRAW;
|
||||||
|
|
||||||
case CDDS_ITEMPREPAINT:
|
case CDDS_ITEMPREPAINT:
|
||||||
{
|
{
|
||||||
int rv = CDRF_DODEFAULT;
|
int rv = CDRF_DODEFAULT;
|
||||||
|
@ -1398,38 +1397,15 @@ static BOOL SelectingByKeyboard()
|
||||||
|
|
||||||
INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
RECT r;
|
|
||||||
RECT r2;
|
|
||||||
int dx1, dy1, dx2, dy2;
|
|
||||||
static int watchIndex=0;
|
static int watchIndex=0;
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG: {
|
case WM_INITDIALOG: {
|
||||||
RamSearchHWnd = hDlg;
|
RamSearchHWnd = hDlg;
|
||||||
|
|
||||||
GetWindowRect(hWnd, &r);
|
CalcSubWindowPos(hDlg, NULL);
|
||||||
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;
|
|
||||||
|
|
||||||
// push it away from the main window if we can
|
|
||||||
const int width = (r.right-r.left);
|
|
||||||
const int width2 = (r2.right-r2.left);
|
|
||||||
if(r.left+width2 + width < GetSystemMetrics(SM_CXSCREEN))
|
|
||||||
{
|
|
||||||
r.right += width;
|
|
||||||
r.left += width;
|
|
||||||
}
|
|
||||||
else if((int)r.left - (int)width2 > 0)
|
|
||||||
{
|
|
||||||
r.right -= width2;
|
|
||||||
r.left -= width2;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
|
||||||
switch(rs_o)
|
switch(rs_o)
|
||||||
{
|
{
|
||||||
case '<':
|
case '<':
|
||||||
|
|
|
@ -30,6 +30,7 @@ void DoRamSearchOperation(); //Perform a search
|
||||||
|
|
||||||
extern HWND RamSearchHWnd;
|
extern HWND RamSearchHWnd;
|
||||||
extern INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
extern INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||||
|
|
||||||
// Too much work to do for resorting the values, and finding the biggest number
|
// Too much work to do for resorting the values, and finding the biggest number
|
||||||
// by sorting in ram list doesn't help too much in usually use, so I gave it up.
|
// by sorting in ram list doesn't help too much in usually use, so I gave it up.
|
||||||
|
|
|
@ -12,6 +12,7 @@ using namespace std;
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <bitset>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
@ -234,7 +235,7 @@ void Update_RAM_Watch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AskSave()
|
bool AskSaveRamWatch()
|
||||||
{
|
{
|
||||||
//This function asks to save changes if the watch file contents have changed
|
//This function asks to save changes if the watch file contents have changed
|
||||||
//returns false only if a save was attempted but failed or was cancelled
|
//returns false only if a save was attempted but failed or was cancelled
|
||||||
|
@ -677,7 +678,7 @@ bool Load_Watches(bool clear)
|
||||||
|
|
||||||
bool ResetWatches()
|
bool ResetWatches()
|
||||||
{
|
{
|
||||||
if(!AskSave())
|
if(!AskSaveRamWatch())
|
||||||
return false;
|
return false;
|
||||||
for (;WatchCount >= 0; WatchCount--)
|
for (;WatchCount >= 0; WatchCount--)
|
||||||
{
|
{
|
||||||
|
@ -825,6 +826,9 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
case 'h':
|
case 'h':
|
||||||
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
|
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
SendDlgItemMessage(hDlg, IDC_BINARY, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, "---------");
|
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, "---------");
|
||||||
|
@ -844,6 +848,7 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
EnableWindow(GetDlgItem(hDlg, IDC_SIGNED), FALSE);
|
EnableWindow(GetDlgItem(hDlg, IDC_SIGNED), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, IDC_UNSIGNED), FALSE);
|
EnableWindow(GetDlgItem(hDlg, IDC_UNSIGNED), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, IDC_HEX), FALSE);
|
EnableWindow(GetDlgItem(hDlg, IDC_HEX), FALSE);
|
||||||
|
EnableWindow(GetDlgItem(hDlg, IDC_BINARY), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, IDC_1_BYTE), FALSE);
|
EnableWindow(GetDlgItem(hDlg, IDC_1_BYTE), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, IDC_2_BYTES), FALSE);
|
EnableWindow(GetDlgItem(hDlg, IDC_2_BYTES), FALSE);
|
||||||
EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE);
|
EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE);
|
||||||
|
@ -886,6 +891,8 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
watcher.Type = 'u';
|
watcher.Type = 'u';
|
||||||
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||||
watcher.Type = 'h';
|
watcher.Type = 'h';
|
||||||
|
else if (SendDlgItemMessage(hDlg, IDC_BINARY, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||||
|
watcher.Type = 'b';
|
||||||
else {
|
else {
|
||||||
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
|
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
|
||||||
return true;
|
return true;
|
||||||
|
@ -903,6 +910,12 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (watcher.Type == 'b' && (watcher.Size == 'd' || watcher.Size == 'w'))
|
||||||
|
{
|
||||||
|
MessageBox(hDlg, "Only 1 byte is supported on binary format.", "Error", MB_OK | MB_ICONERROR);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// address
|
// address
|
||||||
GetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp, 1024);
|
GetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp, 1024);
|
||||||
char *addrstr = Str_Tmp;
|
char *addrstr = Str_Tmp;
|
||||||
|
@ -1026,46 +1039,15 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
RECT r, r2;
|
|
||||||
int dx1, dy1, dx2, dy2;
|
|
||||||
|
|
||||||
GetWindowRect(hWnd, &r); //Ramwatch window
|
|
||||||
dx1 = (r.right - r.left) / 2;
|
|
||||||
dy1 = (r.bottom - r.top) / 2;
|
|
||||||
|
|
||||||
GetWindowRect(hDlg, &r2); // TASer window
|
|
||||||
dx2 = (r2.right - r2.left) / 2;
|
|
||||||
dy2 = (r2.bottom - r2.top) / 2;
|
|
||||||
|
|
||||||
|
|
||||||
// push it away from the main window if we can
|
|
||||||
const int width = (r.right-r.left);
|
|
||||||
const int height = (r.bottom - r.top);
|
|
||||||
const int width2 = (r2.right-r2.left);
|
|
||||||
if(r.left+width2 + width < GetSystemMetrics(SM_CXSCREEN))
|
|
||||||
{
|
|
||||||
r.right += width;
|
|
||||||
r.left += width;
|
|
||||||
}
|
|
||||||
else if((int)r.left - (int)width2 > 0)
|
|
||||||
{
|
|
||||||
r.right -= width2;
|
|
||||||
r.left -= width2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
//If user has Save Window Pos selected, override default positioning
|
|
||||||
if (RWSaveWindowPos)
|
if (RWSaveWindowPos)
|
||||||
{
|
{
|
||||||
//If ramwindow is for some reason completely off screen, use default instead
|
POINT pt = { ramw_x, ramw_y };
|
||||||
if (ramw_x > (-width*2) || ramw_x < (width*2 + GetSystemMetrics(SM_CYSCREEN)) )
|
pt = CalcSubWindowPos(hDlg, &pt);
|
||||||
r.left = ramw_x; //This also ignores cases of windows -32000 error codes
|
ramw_x = pt.x;
|
||||||
//If ramwindow is for some reason completely off screen, use default instead
|
ramw_y = pt.y;
|
||||||
if (ramw_y > (0-height*2) ||ramw_y < (height*2 + GetSystemMetrics(SM_CYSCREEN)) )
|
|
||||||
r.top = ramw_y; //This also ignores cases of windows -32000 error codes
|
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------
|
else
|
||||||
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
CalcSubWindowPos(hDlg, NULL);
|
||||||
|
|
||||||
ramwatchmenu=GetMenu(hDlg);
|
ramwatchmenu=GetMenu(hDlg);
|
||||||
rwrecentmenu=CreateMenu();
|
rwrecentmenu=CreateMenu();
|
||||||
|
@ -1160,6 +1142,18 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
int i = rswatches[iNum].CurValue;
|
int i = rswatches[iNum].CurValue;
|
||||||
int t = rswatches[iNum].Type;
|
int t = rswatches[iNum].Type;
|
||||||
int size = rswatches[iNum].Size;
|
int size = rswatches[iNum].Size;
|
||||||
|
if (rswatches[iNum].Type == 'b')
|
||||||
|
{
|
||||||
|
auto bits = bitset<8>(i); // Currently work with 1 byte size only
|
||||||
|
int j = 0, k = 7;
|
||||||
|
while (k >= 0)
|
||||||
|
{
|
||||||
|
if (k == 3) num[j++] = ' ';
|
||||||
|
num[j++] = bits[k--] ? '1' : '0';
|
||||||
|
}
|
||||||
|
Item->item.pszText = num;
|
||||||
|
break;
|
||||||
|
}
|
||||||
const char* formatString = ((t == 's') ? "%d" : (t == 'u') ? "%u" : (size == 'd' ? "%08X" : size == 'w' ? "%04X" : "%02X"));
|
const char* formatString = ((t == 's') ? "%d" : (t == 'u') ? "%u" : (size == 'd' ? "%08X" : size == 'w' ? "%04X" : "%02X"));
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
|
@ -1442,6 +1436,8 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
numberType = 1;
|
numberType = 1;
|
||||||
else if(rswatches[watchIndex].Type == 'h')
|
else if(rswatches[watchIndex].Type == 'h')
|
||||||
numberType = 2;
|
numberType = 2;
|
||||||
|
else if (rswatches[watchIndex].Type == 'b')
|
||||||
|
numberType = 3;
|
||||||
|
|
||||||
// Don't open cheat dialog
|
// Don't open cheat dialog
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ extern bool AutoRWLoad;
|
||||||
extern bool RWSaveWindowPos;
|
extern bool RWSaveWindowPos;
|
||||||
#define MAX_RECENT_WATCHES 5
|
#define MAX_RECENT_WATCHES 5
|
||||||
extern char rw_recent_files[MAX_RECENT_WATCHES][1024];
|
extern char rw_recent_files[MAX_RECENT_WATCHES][1024];
|
||||||
extern bool AskSave();
|
extern bool AskSaveRamWatch();
|
||||||
extern int ramw_x;
|
extern int ramw_x;
|
||||||
extern int ramw_y;
|
extern int ramw_y;
|
||||||
extern bool RWfileChanged;
|
extern bool RWfileChanged;
|
||||||
|
@ -54,7 +54,7 @@ struct AddressWatcher
|
||||||
char* comment = NULL; // NULL means no comment, non-NULL means allocated comment
|
char* comment = NULL; // NULL means no comment, non-NULL means allocated comment
|
||||||
bool WrongEndian;
|
bool WrongEndian;
|
||||||
char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator.
|
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
|
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'b' = binary, 'S' = separator
|
||||||
short Cheats; // how many bytes are affected by cheat
|
short Cheats; // how many bytes are affected by cheat
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
||||||
//{{NO_DEPENDENCIES}}
|
//{{NO_DEPENDENCIES}}
|
||||||
// Microsoft Visual C++ generated file
|
// Microsoft Visual C++ generated include file
|
||||||
// for res.rc
|
// for res.rc
|
||||||
//
|
//
|
||||||
#define CLOSE_BUTTON 1
|
#define CLOSE_BUTTON 1
|
||||||
|
@ -365,6 +365,7 @@
|
||||||
#define MENU_MV_VIEW_ROM 303
|
#define MENU_MV_VIEW_ROM 303
|
||||||
#define IDC_BTN_CHEAT_UPD 303
|
#define IDC_BTN_CHEAT_UPD 303
|
||||||
#define IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL 303
|
#define IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL 303
|
||||||
|
#define IDD_EDIT_HEADER 303
|
||||||
#define MENU_ENABLE_AUTOSAVE 304
|
#define MENU_ENABLE_AUTOSAVE 304
|
||||||
#define IDC_LABEL_ROMUSED 304
|
#define IDC_LABEL_ROMUSED 304
|
||||||
#define IDC_BTN_CHEAT_RESET 304
|
#define IDC_BTN_CHEAT_RESET 304
|
||||||
|
@ -441,19 +442,21 @@
|
||||||
#define IDC_GAME_GENIE_CODE 1000
|
#define IDC_GAME_GENIE_CODE 1000
|
||||||
#define IDC_MEMVIEWFIND_WHAT 1000
|
#define IDC_MEMVIEWFIND_WHAT 1000
|
||||||
#define IDC_BOOKMARK_DESCRIPTION 1000
|
#define IDC_BOOKMARK_DESCRIPTION 1000
|
||||||
|
#define MW_NAME00 1000
|
||||||
#define MW_ADDR00 1001
|
#define MW_ADDR00 1001
|
||||||
#define IDC_GAME_GENIE_ADDR 1001
|
|
||||||
#define IDC_MEMVIEWFIND_TYPE_HEX 1001
|
#define IDC_MEMVIEWFIND_TYPE_HEX 1001
|
||||||
#define IDC_NTVIEW_MIRROR_HORIZONTAL 1001
|
#define IDC_NTVIEW_MIRROR_HORIZONTAL 1001
|
||||||
#define IDC_CHECK_STOPMOVIE 1002
|
#define IDC_CHECK_STOPMOVIE 1002
|
||||||
#define IDC_GAME_GENIE_COMP 1002
|
#define IDC_GAME_GENIE_COMP 1002
|
||||||
#define IDC_MEMVIEWFIND_TYPE_TEXT 1002
|
#define IDC_MEMVIEWFIND_TYPE_TEXT 1002
|
||||||
#define IDC_NTVIEW_MIRROR_VERTICAL 1002
|
#define IDC_NTVIEW_MIRROR_VERTICAL 1002
|
||||||
|
#define MW_VAL00 1002
|
||||||
#define LV_MAPPING 1003
|
#define LV_MAPPING 1003
|
||||||
#define IDC_EDIT_STOPFRAME 1003
|
#define IDC_EDIT_STOPFRAME 1003
|
||||||
#define IDC_GAME_GENIE_VAL 1003
|
#define IDC_GAME_GENIE_VAL 1003
|
||||||
#define IDC_MEMVIEWFIND_DIR_UP 1003
|
#define IDC_MEMVIEWFIND_DIR_UP 1003
|
||||||
#define IDC_NTVIEW_MIRROR_FOUR_SCREEN 1003
|
#define IDC_NTVIEW_MIRROR_FOUR_SCREEN 1003
|
||||||
|
#define MW_NAME01 1003
|
||||||
#define MW_ADDR01 1004
|
#define MW_ADDR01 1004
|
||||||
#define IDC_LIST_GGADDRESSES 1004
|
#define IDC_LIST_GGADDRESSES 1004
|
||||||
#define IDC_MEMVIEWFIND_DIR_DOWN 1004
|
#define IDC_MEMVIEWFIND_DIR_DOWN 1004
|
||||||
|
@ -461,43 +464,161 @@
|
||||||
#define IDC_BTN_ADD_TO_CHEATS 1005
|
#define IDC_BTN_ADD_TO_CHEATS 1005
|
||||||
#define IDC_MEMVIEWFIND_NEXT 1005
|
#define IDC_MEMVIEWFIND_NEXT 1005
|
||||||
#define IDC_NTVIEW_MIRROR_SS_TABLE_1 1005
|
#define IDC_NTVIEW_MIRROR_SS_TABLE_1 1005
|
||||||
|
#define MW_VAL01 1005
|
||||||
#define IDC_NTVIEW_MIRROR_SS_TABLE_2 1006
|
#define IDC_NTVIEW_MIRROR_SS_TABLE_2 1006
|
||||||
|
#define MW_NAME02 1006
|
||||||
#define MW_ADDR02 1007
|
#define MW_ADDR02 1007
|
||||||
#define IDC_NTVIEW_MIRROR_SS_TABLE_3 1007
|
#define IDC_NTVIEW_MIRROR_SS_TABLE_3 1007
|
||||||
#define IDC_NTVIEW_SHOW_SCROLL_LINES 1008
|
#define IDC_NTVIEW_SHOW_SCROLL_LINES 1008
|
||||||
|
#define MW_VAL02 1008
|
||||||
#define IDC_NTVIEW_SHOW_ATTRIBUTES 1009
|
#define IDC_NTVIEW_SHOW_ATTRIBUTES 1009
|
||||||
|
#define MW_NAME03 1009
|
||||||
#define IDC_NTVIEW_HIDE_PALETTES 1010
|
#define IDC_NTVIEW_HIDE_PALETTES 1010
|
||||||
#define MW_ADDR03 1010
|
#define MW_ADDR03 1010
|
||||||
|
#define IDC_BTN_CHEAT_EXPORTTOFILE 1011
|
||||||
|
#define MW_VAL03 1011
|
||||||
|
#define IDSAVE 1012
|
||||||
|
#define MW_NAME04 1012
|
||||||
#define MW_ADDR04 1013
|
#define MW_ADDR04 1013
|
||||||
|
#define IDC_CHECK1 1013
|
||||||
|
#define IDC_CHEAT_AUTOLOADSAVE 1013
|
||||||
|
#define IDC_RESTORE_BUTTON 1014
|
||||||
|
#define MW_VAL04 1014
|
||||||
|
#define MW_NAME05 1015
|
||||||
#define MW_ADDR05 1016
|
#define MW_ADDR05 1016
|
||||||
|
#define MW_VAL05 1017
|
||||||
|
#define IDC_PRGROM_COMBO 1018
|
||||||
|
#define MW_NAME06 1018
|
||||||
#define MW_ADDR06 1019
|
#define MW_ADDR06 1019
|
||||||
|
#define IDC_CHRROM_COMBO 1019
|
||||||
|
#define IDC_RADIO_MIRR_HORIZONTAL 1020
|
||||||
|
#define MW_VAL06 1020
|
||||||
|
#define IDC_RADIO_MIRR_VERTICAL 1021
|
||||||
|
#define MW_NAME07 1021
|
||||||
#define MW_ADDR07 1022
|
#define MW_ADDR07 1022
|
||||||
|
#define IDC_RADIO_MIRR_4SCREEN 1022
|
||||||
|
#define MW_VAL07 1023
|
||||||
|
#define IDC_CHECK_TRAINER 1024
|
||||||
|
#define MW_NAME08 1024
|
||||||
#define MW_ADDR08 1025
|
#define MW_ADDR08 1025
|
||||||
|
#define IDC_PRGRAM_COMBO 1025
|
||||||
|
#define IDC_MAPPER_COMBO 1026
|
||||||
|
#define MW_VAL08 1026
|
||||||
|
#define IDC_SUBMAPPER_EDIT 1027
|
||||||
|
#define MW_NAME09 1027
|
||||||
#define MW_ADDR09 1028
|
#define MW_ADDR09 1028
|
||||||
|
#define IDC_CHRRAM_COMBO 1028
|
||||||
|
#define IDC_PRGNVRAM_COMBO 1029
|
||||||
|
#define MW_VAL09 1029
|
||||||
|
#define IDC_CHRNVRAM_COMBO 1030
|
||||||
|
#define MW_NAME10 1030
|
||||||
#define MW_ADDR10 1031
|
#define MW_ADDR10 1031
|
||||||
|
#define IDC_RADIO_REGION_NTSC 1031
|
||||||
|
#define IDC_RADIO_REGION_PAL 1032
|
||||||
|
#define MW_VAL10 1032
|
||||||
|
#define IDC_RADIO_REGION_DUAL 1033
|
||||||
|
#define MW_NAME11 1033
|
||||||
#define MW_ADDR11 1034
|
#define MW_ADDR11 1034
|
||||||
|
#define MW_VAL11 1035
|
||||||
|
#define IDC_INPUT_DEVICE_COMBO 1036
|
||||||
|
#define MW_NAME12 1036
|
||||||
#define MW_ADDR12 1037
|
#define MW_ADDR12 1037
|
||||||
|
#define IDC_RADIO_REGION_DENDY 1037
|
||||||
|
#define IDC_RADIO_SYSTEM_NORMAL 1038
|
||||||
|
#define MW_VAL12 1038
|
||||||
|
#define IDC_RADIO_SYSTEM_VS 1039
|
||||||
|
#define MW_NAME13 1039
|
||||||
#define MW_ADDR13 1040
|
#define MW_ADDR13 1040
|
||||||
|
#define IDC_RADIO_SYSTEM_PLAYCHOICE10 1040
|
||||||
|
#define IDC_RADIO_SYSTEM_EXTEND 1041
|
||||||
|
#define MW_VAL13 1041
|
||||||
|
#define MW_NAME14 1042
|
||||||
#define MW_ADDR14 1043
|
#define MW_ADDR14 1043
|
||||||
|
#define IDC_SYSTEM_EXTEND_COMBO 1043
|
||||||
|
#define MW_VAL14 1044
|
||||||
|
#define MW_NAME15 1045
|
||||||
#define MW_ADDR15 1046
|
#define MW_ADDR15 1046
|
||||||
|
#define IDC_VS_SYSTEM_COMBO 1046
|
||||||
|
#define IDC_VS_PPU_COMBO 1047
|
||||||
|
#define MW_VAL15 1047
|
||||||
|
#define MW_NAME16 1048
|
||||||
#define MW_ADDR16 1049
|
#define MW_ADDR16 1049
|
||||||
|
#define IDC_MAPPER_TEXT 1049
|
||||||
|
#define IDC_SUBMAPPER_TEXT 1050
|
||||||
|
#define MW_VAL16 1050
|
||||||
|
#define IDC_PRGROM_TEXT 1051
|
||||||
|
#define MW_NAME17 1051
|
||||||
#define MW_ADDR17 1052
|
#define MW_ADDR17 1052
|
||||||
|
#define IDC_CHRROM_TEXT 1053
|
||||||
|
#define MW_VAL17 1053
|
||||||
|
#define MW_NAME18 1054
|
||||||
#define MW_ADDR18 1055
|
#define MW_ADDR18 1055
|
||||||
|
#define IDC_PRGRAM_TEXT 1055
|
||||||
|
#define MW_VAL18 1056
|
||||||
|
#define IDC_CHRRAM_TEXT 1057
|
||||||
|
#define MW_NAME19 1057
|
||||||
#define MW_ADDR19 1058
|
#define MW_ADDR19 1058
|
||||||
|
#define IDC_PRGNVRAM_TEXT 1059
|
||||||
|
#define MW_VAL19 1059
|
||||||
|
#define IDC_CHRNVRAM_TEXT 1060
|
||||||
|
#define MW_NAME20 1060
|
||||||
#define MW_ADDR20 1061
|
#define MW_ADDR20 1061
|
||||||
|
#define MW_VAL20 1062
|
||||||
|
#define IDC_INESHEADER_GROUP 1063
|
||||||
|
#define MW_NAME21 1063
|
||||||
#define MW_ADDR21 1064
|
#define MW_ADDR21 1064
|
||||||
|
#define IDC_MIRRORING_GROUP 1064
|
||||||
|
#define IDC_REGION_GROUP 1065
|
||||||
|
#define MW_VAL21 1065
|
||||||
|
#define IDC_SYSTEM_GROUP 1066
|
||||||
|
#define MW_NAME22 1066
|
||||||
#define MW_ADDR22 1067
|
#define MW_ADDR22 1067
|
||||||
|
#define IDC_VS_SYSTEM_GROUP 1067
|
||||||
|
#define IDC_VS_SYSTEM_TEXT 1068
|
||||||
|
#define MW_VAL22 1068
|
||||||
|
#define IDC_VS_PPU_TEXT 1069
|
||||||
|
#define MW_NAME23 1069
|
||||||
#define MW_ADDR23 1070
|
#define MW_ADDR23 1070
|
||||||
|
#define IDC_RADIO_VERSION_STANDARD 1071
|
||||||
|
#define MW_VAL23 1071
|
||||||
|
#define IDC_RADIO_VERSION_INES20 1073
|
||||||
|
#define IDC_VERSION_GROUP 1074
|
||||||
|
#define IDC_MAPPER_GROUP 1075
|
||||||
|
#define IDC_CHECK_BATTERYNVRAM 1076
|
||||||
|
#define IDC_INPUT_DEVICE_TEXT 1077
|
||||||
|
#define IDC_PRG_GROUP 1078
|
||||||
|
#define IDC_CHR_GROUP 1079
|
||||||
|
#define IDC_UNOFFICIAL_GROUP 1081
|
||||||
|
#define IDC_CHECK_UNOFFICIAL_PRGRAM 1082
|
||||||
|
#define IDC_CHECK_UNOFFICIAL_EXTRA_REGION 1083
|
||||||
|
#define IDC_CHECK_UNOFFICIAL_BUS_CONFLICT 1084
|
||||||
|
#define IDC_CHECK_UNOFFICIAL 1085
|
||||||
|
#define IDC_MISCELLANEOUS_ROMS_TEXT 1086
|
||||||
|
#define IDC_MISCELLANEOUS_ROMS_EDIT 1087
|
||||||
|
#define IDC_EXTEND_SYSTEM_GROUP 1089
|
||||||
|
#define IDC_EXTEND_SYSTEM_TEXT 1090
|
||||||
|
#define IDC_BUTTON1 1094
|
||||||
|
#define IDC_CHEAT_SWITCH 1096
|
||||||
|
#define IDC_CHEAT_GLOBAL_SWITCH 1096
|
||||||
|
#define IDC_GAME_GENIE_LABEL 1097
|
||||||
|
#define IDC_CHEAT_GAME_GENIE_TEXT 1098
|
||||||
|
#define IDC_CHECK2 1099
|
||||||
#define BTN_ALLOW_LRUD 1117
|
#define BTN_ALLOW_LRUD 1117
|
||||||
|
#define IDC_PRGROM_EDIT 1118
|
||||||
|
#define IDC_CHRROM_EDIT 1119
|
||||||
#define BTN_PRESET_SET1 1119
|
#define BTN_PRESET_SET1 1119
|
||||||
#define BTN_PRESET_SET2 1120
|
#define BTN_PRESET_SET2 1120
|
||||||
#define BTN_PRESET_SET3 1121
|
#define BTN_PRESET_SET3 1121
|
||||||
#define BTN_PRESET_IMPORT1 1122
|
#define BTN_PRESET_IMPORT1 1122
|
||||||
#define BTN_PRESET_IMPORT2 1123
|
#define BTN_PRESET_IMPORT2 1123
|
||||||
#define BTN_PRESET_IMPORT3 1124
|
#define BTN_PRESET_IMPORT3 1124
|
||||||
|
#define IDC_PRGRAM_EDIT 1125
|
||||||
#define BTN_PRESET_EXPORT1 1125
|
#define BTN_PRESET_EXPORT1 1125
|
||||||
#define BTN_PRESET_EXPORT2 1126
|
#define BTN_PRESET_EXPORT2 1126
|
||||||
#define BTN_PRESET_EXPORT3 1127
|
#define BTN_PRESET_EXPORT3 1127
|
||||||
|
#define IDC_CHRRAM_EDIT 1128
|
||||||
|
#define IDC_PRGNVRAM_EDIT 1129
|
||||||
|
#define IDC_CHRNVRAM_EDIT 1130
|
||||||
#define IDC_LIST1 1130
|
#define IDC_LIST1 1130
|
||||||
#define IDC_BUTTON_METADATA 1132
|
#define IDC_BUTTON_METADATA 1132
|
||||||
#define MEMW_EXPANDCOLLAPSE 1133
|
#define MEMW_EXPANDCOLLAPSE 1133
|
||||||
|
@ -699,11 +820,14 @@
|
||||||
#define IDC_EXTRA_SCANLINES_TEXT 1309
|
#define IDC_EXTRA_SCANLINES_TEXT 1309
|
||||||
#define IDC_DATASIZE_GROUPBOX 1310
|
#define IDC_DATASIZE_GROUPBOX 1310
|
||||||
#define IDC_DATATYPE_GROUPBOX 1311
|
#define IDC_DATATYPE_GROUPBOX 1311
|
||||||
#define IDC_CHEAT_CODE_GG_LABEL 1312
|
#define IDC_CHEAT_CODE_LABEL 1312
|
||||||
#define IDC_CHEAT_ADDRESS_LABEL 1313
|
#define IDC_CHEAT_ADDRESS_LABEL 1313
|
||||||
#define IDC_CHEAT_VAL_LABEL 1314
|
#define IDC_CHEAT_VAL_LABEL 1314
|
||||||
#define IDC_CHEAT_COM_LABEL 1315
|
#define IDC_CHEAT_COM_LABEL 1315
|
||||||
#define IDC_CHEAT_LABEL_KNOWN 1316
|
#define IDC_CHEAT_LABEL_KNOWN 1316
|
||||||
|
#define IDC_BINARY 1317
|
||||||
|
#define IDC_GAME_GENIE_ADDR 1501
|
||||||
|
#define MENU_INESHEADEREDITOR 40001
|
||||||
#define MENU_NETWORK 40040
|
#define MENU_NETWORK 40040
|
||||||
#define MENU_PALETTE 40041
|
#define MENU_PALETTE 40041
|
||||||
#define MENU_SOUND 40042
|
#define MENU_SOUND 40042
|
||||||
|
@ -997,9 +1121,9 @@
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 303
|
#define _APS_NEXT_RESOURCE_VALUE 305
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40000
|
#define _APS_NEXT_COMMAND_VALUE 40002
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1011
|
#define _APS_NEXT_CONTROL_VALUE 1100
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -299,11 +299,11 @@ INT_PTR CALLBACK newProjectProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARA
|
||||||
break;
|
break;
|
||||||
case IDC_COPY_INPUT:
|
case IDC_COPY_INPUT:
|
||||||
p->copyCurrentInput ^= 1;
|
p->copyCurrentInput ^= 1;
|
||||||
CheckDlgButton(hwndDlg, IDC_COPY_INPUT, p->copyCurrentInput?MF_CHECKED : MF_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_COPY_INPUT, p->copyCurrentInput? BST_CHECKED : BST_UNCHECKED);
|
||||||
break;
|
break;
|
||||||
case IDC_COPY_MARKERS:
|
case IDC_COPY_MARKERS:
|
||||||
p->copyCurrentMarkers ^= 1;
|
p->copyCurrentMarkers ^= 1;
|
||||||
CheckDlgButton(hwndDlg, IDC_COPY_MARKERS, p->copyCurrentMarkers?MF_CHECKED : MF_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_COPY_MARKERS, p->copyCurrentMarkers? BST_CHECKED : BST_UNCHECKED);
|
||||||
break;
|
break;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
{
|
{
|
||||||
|
@ -792,7 +792,7 @@ INT_PTR CALLBACK ExportProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lP
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckDlgButton(hwndDlg, IDC_NOTES_TO_SUBTITLES, taseditorConfig.lastExportedSubtitlesStatus?MF_CHECKED : MF_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_NOTES_TO_SUBTITLES, taseditorConfig.lastExportedSubtitlesStatus ? BST_CHECKED : BST_UNCHECKED);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
|
@ -808,7 +808,7 @@ INT_PTR CALLBACK ExportProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lP
|
||||||
break;
|
break;
|
||||||
case IDC_NOTES_TO_SUBTITLES:
|
case IDC_NOTES_TO_SUBTITLES:
|
||||||
taseditorConfig.lastExportedSubtitlesStatus ^= 1;
|
taseditorConfig.lastExportedSubtitlesStatus ^= 1;
|
||||||
CheckDlgButton(hwndDlg, IDC_NOTES_TO_SUBTITLES, taseditorConfig.lastExportedSubtitlesStatus?MF_CHECKED : MF_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_NOTES_TO_SUBTITLES, taseditorConfig.lastExportedSubtitlesStatus ? BST_CHECKED : BST_UNCHECKED);
|
||||||
break;
|
break;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hwndDlg, 1);
|
EndDialog(hwndDlg, 1);
|
||||||
|
|
|
@ -630,7 +630,7 @@ INT_PTR CALLBACK findNoteWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPAR
|
||||||
if (taseditorConfig.findnoteWindowY == -32000) taseditorConfig.findnoteWindowY = 0;
|
if (taseditorConfig.findnoteWindowY == -32000) taseditorConfig.findnoteWindowY = 0;
|
||||||
SetWindowPos(hwndDlg, 0, taseditorConfig.findnoteWindowX, taseditorConfig.findnoteWindowY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
SetWindowPos(hwndDlg, 0, taseditorConfig.findnoteWindowX, taseditorConfig.findnoteWindowY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||||
|
|
||||||
CheckDlgButton(hwndDlg, IDC_MATCH_CASE, taseditorConfig.findnoteMatchCase?MF_CHECKED : MF_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_MATCH_CASE, taseditorConfig.findnoteMatchCase ? BST_CHECKED : BST_UNCHECKED);
|
||||||
if (taseditorConfig.findnoteSearchUp)
|
if (taseditorConfig.findnoteSearchUp)
|
||||||
Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_UP), BST_CHECKED);
|
Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_UP), BST_CHECKED);
|
||||||
else
|
else
|
||||||
|
@ -680,7 +680,7 @@ INT_PTR CALLBACK findNoteWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPAR
|
||||||
break;
|
break;
|
||||||
case IDC_MATCH_CASE:
|
case IDC_MATCH_CASE:
|
||||||
taseditorConfig.findnoteMatchCase ^= 1;
|
taseditorConfig.findnoteMatchCase ^= 1;
|
||||||
CheckDlgButton(hwndDlg, IDC_MATCH_CASE, taseditorConfig.findnoteMatchCase?MF_CHECKED : MF_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_MATCH_CASE, taseditorConfig.findnoteMatchCase? BST_CHECKED : BST_UNCHECKED);
|
||||||
break;
|
break;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1288,6 +1288,11 @@ INT_PTR CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), eoptions&EO_TVASPECT);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), eoptions&EO_TVASPECT);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_SLASHTEXT), eoptions&EO_TVASPECT);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_SLASHTEXT), eoptions&EO_TVASPECT);
|
||||||
|
|
||||||
|
DefaultEditCtrlProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_WINSIZE_MUL_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_WINSIZE_MUL_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_TVASPECT_X), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
SetWindowLong(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "memview.h"
|
#include "memview.h"
|
||||||
#include "tracer.h"
|
#include "tracer.h"
|
||||||
#include "cdlogger.h"
|
#include "cdlogger.h"
|
||||||
|
#include "header_editor.h"
|
||||||
#include "throttle.h"
|
#include "throttle.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
@ -100,7 +101,7 @@ using namespace std;
|
||||||
|
|
||||||
//Handles----------------------------------------------
|
//Handles----------------------------------------------
|
||||||
static HMENU fceumenu = 0; //Main menu.
|
static HMENU fceumenu = 0; //Main menu.
|
||||||
HWND pwindow; //Client Area
|
// HWND pwindow; //Client Area
|
||||||
HMENU recentmenu; //Recent Menu
|
HMENU recentmenu; //Recent Menu
|
||||||
HMENU recentluamenu; //Recent Lua Files Menu
|
HMENU recentluamenu; //Recent Lua Files Menu
|
||||||
HMENU recentmoviemenu; //Recent Movie Files Menu
|
HMENU recentmoviemenu; //Recent Movie Files Menu
|
||||||
|
@ -181,6 +182,7 @@ const unsigned int MAX_NUMBER_OF_MOVIE_RECENT_FILES = sizeof(recent_movie)/sizeo
|
||||||
|
|
||||||
int EnableBackgroundInput = 0;
|
int EnableBackgroundInput = 0;
|
||||||
int ismaximized = 0;
|
int ismaximized = 0;
|
||||||
|
WNDPROC DefaultEditCtrlProc;
|
||||||
|
|
||||||
//Help Menu subtopics
|
//Help Menu subtopics
|
||||||
string moviehelp = "MovieRecording"; //Movie Recording
|
string moviehelp = "MovieRecording"; //Movie Recording
|
||||||
|
@ -366,8 +368,9 @@ void CalcWindowSize(RECT *al)
|
||||||
|
|
||||||
/// Updates the menu items that should only be enabled if a game is loaded.
|
/// Updates the menu items that should only be enabled if a game is loaded.
|
||||||
/// @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
/// @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
||||||
void updateGameDependentMenus(unsigned int enable)
|
void updateGameDependentMenus()
|
||||||
{
|
{
|
||||||
|
// they are quite simple, enabled only when game is loaded
|
||||||
const int menu_ids[]= {
|
const int menu_ids[]= {
|
||||||
MENU_CLOSE_FILE,
|
MENU_CLOSE_FILE,
|
||||||
ID_FILE_SCREENSHOT,
|
ID_FILE_SCREENSHOT,
|
||||||
|
@ -395,10 +398,14 @@ void updateGameDependentMenus(unsigned int enable)
|
||||||
ID_TOOLS_TEXTHOOKER
|
ID_TOOLS_TEXTHOOKER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool enable = GameInfo != 0;
|
||||||
for (unsigned int i = 0; i < sizeof(menu_ids) / sizeof(*menu_ids); i++)
|
for (unsigned int i = 0; i < sizeof(menu_ids) / sizeof(*menu_ids); i++)
|
||||||
{
|
EnableMenuItem(fceumenu, menu_ids[i], MF_BYCOMMAND | enable ? MF_ENABLED : MF_GRAYED | MF_DISABLED);
|
||||||
EnableMenuItem(fceumenu, menu_ids[i], MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED));
|
|
||||||
}
|
// Special treatment for the iNES head editor, only when no game is loaded or an NES game is loaded
|
||||||
|
extern iNES_HEADER head;
|
||||||
|
enable = GameInfo == 0 || !strncmp((const char*)&head, "NES\x1A", 4);
|
||||||
|
EnableMenuItem(fceumenu, MENU_INESHEADEREDITOR, MF_BYCOMMAND | enable ? MF_ENABLED : MF_GRAYED | MF_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates menu items which need to be checked or unchecked.
|
//Updates menu items which need to be checked or unchecked.
|
||||||
|
@ -1058,8 +1065,8 @@ void CloseGame()
|
||||||
{
|
{
|
||||||
FCEUI_CloseGame();
|
FCEUI_CloseGame();
|
||||||
KillMemView();
|
KillMemView();
|
||||||
updateGameDependentMenus(GameInfo != 0);
|
updateGameDependentMenus();
|
||||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
updateGameDependentMenusDebugger();
|
||||||
SetMainWindowText();
|
SetMainWindowText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1120,8 +1127,8 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
|
||||||
SetMainWindowText();
|
SetMainWindowText();
|
||||||
ParseGIInput(GameInfo);
|
ParseGIInput(GameInfo);
|
||||||
|
|
||||||
updateGameDependentMenus(GameInfo != 0);
|
updateGameDependentMenus();
|
||||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
updateGameDependentMenusDebugger();
|
||||||
EmulationPaused = oldPaused;
|
EmulationPaused = oldPaused;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2312,7 +2319,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
case MENU_GAMEGENIEDECODER:
|
case MENU_GAMEGENIEDECODER:
|
||||||
DoGGConv();
|
DoGGConv();
|
||||||
break;
|
break;
|
||||||
|
case MENU_INESHEADEREDITOR:
|
||||||
|
DoHeadEdit();
|
||||||
|
break;
|
||||||
//Help Menu--------------------------------------------------------------
|
//Help Menu--------------------------------------------------------------
|
||||||
case MENU_HELP:
|
case MENU_HELP:
|
||||||
OpenHelpWindow();
|
OpenHelpWindow();
|
||||||
|
@ -2679,8 +2688,8 @@ int CreateMainWindow()
|
||||||
UpdateLuaRMenu(recentluamenu, recent_lua, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
UpdateLuaRMenu(recentluamenu, recent_lua, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
||||||
UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
|
UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
|
||||||
|
|
||||||
updateGameDependentMenus(0);
|
updateGameDependentMenus();
|
||||||
updateGameDependentMenusDebugger(0);
|
updateGameDependentMenusDebugger();
|
||||||
if (MainWindow_wndx==-32000) MainWindow_wndx=0; //Just in case
|
if (MainWindow_wndx==-32000) MainWindow_wndx=0; //Just in case
|
||||||
if (MainWindow_wndy==-32000) MainWindow_wndy=0;
|
if (MainWindow_wndy==-32000) MainWindow_wndy=0;
|
||||||
hAppWnd = CreateWindowEx(
|
hAppWnd = CreateWindowEx(
|
||||||
|
@ -3212,3 +3221,255 @@ void UpdateSortColumnIcon(HWND hwndListView, int sortColumn, bool sortAsc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Push the window away from the main FCEUX window
|
||||||
|
POINT CalcSubWindowPos(HWND hDlg, POINT* conf)
|
||||||
|
{
|
||||||
|
POINT pt; // dialog position
|
||||||
|
RECT wR, dR; // Window rect, dialog rect
|
||||||
|
|
||||||
|
|
||||||
|
// Try to calc the default position, it doesn't overlap the main window and ensure it's in the screen;
|
||||||
|
GetWindowRect(hAppWnd, &wR);
|
||||||
|
GetWindowRect(hDlg, &dR);
|
||||||
|
|
||||||
|
pt.x = wR.left;
|
||||||
|
pt.y = wR.top;
|
||||||
|
|
||||||
|
LONG wW = wR.right - wR.left; // window width
|
||||||
|
LONG dW = dR.right - dR.left; // dialog width
|
||||||
|
|
||||||
|
if (pt.x + wW + dW < GetSystemMetrics(SM_CXSCREEN))
|
||||||
|
pt.x += wW; // if there is enough place for the dialog on the right, put the dialog there
|
||||||
|
else if (pt.x - dW > 0)
|
||||||
|
pt.x -= dW; // otherwise, we check if we can put it on the left
|
||||||
|
|
||||||
|
// If the dialog has a configured window position, override the default position
|
||||||
|
if (conf)
|
||||||
|
{
|
||||||
|
LONG wH = wR.bottom - wR.top;
|
||||||
|
// It is overrided only when the configured position is not completely off screen
|
||||||
|
if (conf->x > -wW * 2 || conf->x < wW * 2 + GetSystemMetrics(SM_CXSCREEN))
|
||||||
|
pt.x = conf->x;
|
||||||
|
if (conf->y > -wH * 2 || conf->y < wH * 2 + GetSystemMetrics(SM_CYSCREEN))
|
||||||
|
pt.y = conf->y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// finally set the window position
|
||||||
|
SetWindowPos(hDlg, NULL, pt.x, pt.y, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||||
|
|
||||||
|
// return the calculated point, maybe the caller can use it for further.
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP)
|
||||||
|
{
|
||||||
|
bool through = true;
|
||||||
|
LRESULT result = 0;
|
||||||
|
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case WM_PASTE:
|
||||||
|
{
|
||||||
|
|
||||||
|
bool(*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd));
|
||||||
|
|
||||||
|
if (IsLetterLegal)
|
||||||
|
{
|
||||||
|
if (OpenClipboard(hwnd))
|
||||||
|
{
|
||||||
|
HANDLE handle = GetClipboardData(CF_TEXT);
|
||||||
|
if (handle)
|
||||||
|
{
|
||||||
|
|
||||||
|
// get the original clipboard string
|
||||||
|
char* clipStr = (char*)GlobalLock(handle);
|
||||||
|
|
||||||
|
// check if the text in clipboard has illegal characters
|
||||||
|
int len = strlen(clipStr);
|
||||||
|
for (int i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
if (!IsLetterLegal(clipStr[i]))
|
||||||
|
{
|
||||||
|
through = false;
|
||||||
|
// Show Edit control tip, just like the control with ES_NUMBER do
|
||||||
|
ShowLetterIllegalError(hwnd, IsLetterLegal);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GlobalUnlock(handle);
|
||||||
|
CloseClipboard();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_CHAR:
|
||||||
|
{
|
||||||
|
bool(*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd));
|
||||||
|
through = IsInputLegal(GetIsLetterLegal(GetDlgCtrlID(hwnd)), wP);
|
||||||
|
if (!through)
|
||||||
|
ShowLetterIllegalError(hwnd, IsLetterLegal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return through ? CallWindowProc(DefaultEditCtrlProc, hwnd, msg, wP, lP) : result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a letter legal checking function for the specified control with the given id
|
||||||
|
bool inline (*GetIsLetterLegal(UINT id))(char letter)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
// owomomo TODO: RAM Search is a bit complicated,
|
||||||
|
// I'll handle it in later development
|
||||||
|
|
||||||
|
|
||||||
|
// Game genie text in Cheat and Game Genie Encoder/Decoder
|
||||||
|
case IDC_CHEAT_GAME_GENIE_TEXT:
|
||||||
|
case IDC_GAME_GENIE_CODE:
|
||||||
|
return IsLetterLegalGG;
|
||||||
|
|
||||||
|
// Addresses in Debugger
|
||||||
|
case IDC_DEBUGGER_VAL_PCSEEK:
|
||||||
|
case IDC_DEBUGGER_VAL_PC:
|
||||||
|
case IDC_DEBUGGER_VAL_A:
|
||||||
|
case IDC_DEBUGGER_VAL_X:
|
||||||
|
case IDC_DEBUGGER_VAL_Y:
|
||||||
|
case IDC_DEBUGGER_BOOKMARK:
|
||||||
|
|
||||||
|
// Debugger -> Add breakpoint
|
||||||
|
case IDC_ADDBP_ADDR_START: case IDC_ADDBP_ADDR_END:
|
||||||
|
|
||||||
|
// RAM Watch / RAM Search / Cheat -> Add watch
|
||||||
|
// TODO: Some other features
|
||||||
|
// case IDC_EDIT_COMPAREADDRESS:
|
||||||
|
|
||||||
|
// Address, Value, Compare, Known Value, Note equal, Greater than and Less than in Cheat
|
||||||
|
case IDC_CHEAT_ADDR: case IDC_CHEAT_VAL: case IDC_CHEAT_COM:
|
||||||
|
case IDC_CHEAT_VAL_KNOWN: case IDC_CHEAT_VAL_NE_BY:
|
||||||
|
case IDC_CHEAT_VAL_GT_BY: case IDC_CHEAT_VAL_LT_BY:
|
||||||
|
|
||||||
|
// Address, Value and Compare in Game Genie Encoder/Decoder
|
||||||
|
case IDC_GAME_GENIE_ADDR: case IDC_GAME_GENIE_VAL: case IDC_GAME_GENIE_COMP:
|
||||||
|
|
||||||
|
// Address controls in Memory watch
|
||||||
|
case MW_ADDR00: case MW_ADDR01: case MW_ADDR02: case MW_ADDR03:
|
||||||
|
case MW_ADDR04: case MW_ADDR05: case MW_ADDR06: case MW_ADDR07:
|
||||||
|
case MW_ADDR08: case MW_ADDR09: case MW_ADDR10: case MW_ADDR11:
|
||||||
|
case MW_ADDR12: case MW_ADDR13: case MW_ADDR14: case MW_ADDR15:
|
||||||
|
case MW_ADDR16: case MW_ADDR17: case MW_ADDR18: case MW_ADDR19:
|
||||||
|
case MW_ADDR20: case MW_ADDR21: case MW_ADDR22: case MW_ADDR23:
|
||||||
|
return IsLetterLegalHex;
|
||||||
|
|
||||||
|
// Size multiplier and TV Aspect in Video Config
|
||||||
|
case IDC_WINSIZE_MUL_X: case IDC_WINSIZE_MUL_Y:
|
||||||
|
case IDC_TVASPECT_X: case IDC_TVASPECT_Y:
|
||||||
|
return IsLetterLegalFloat;
|
||||||
|
|
||||||
|
// Cheat code in Cheat
|
||||||
|
case IDC_CHEAT_TEXT:
|
||||||
|
return IsLetterLegalCheat;
|
||||||
|
|
||||||
|
// PRG ROM, PRG RAM, PRG NVRAM, CHR ROM, CHR RAM, CHR NVRAM in iNES Header Editor
|
||||||
|
case IDC_PRGROM_EDIT: case IDC_PRGRAM_EDIT: case IDC_PRGNVRAM_EDIT:
|
||||||
|
case IDC_CHRROM_EDIT: case IDC_CHRRAM_EDIT: case IDC_CHRNVRAM_EDIT:
|
||||||
|
return IsLetterLegalSize;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ShowLetterIllegalError(HWND hwnd, bool(*IsLetterLegal)(char letter), bool balloon)
|
||||||
|
{
|
||||||
|
(balloon ? ShowLetterIllegalBalloonTip : ShowLetterIllegalMessageBox)(hwnd, IsLetterLegal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShowLetterIllegalBalloonTip(HWND hwnd, bool(*IsLetterLegal)(char letter))
|
||||||
|
{
|
||||||
|
char* title = "Unacceptable Character";
|
||||||
|
int uLen = MultiByteToWideChar(CP_ACP, NULL, title, -1, NULL, 0);
|
||||||
|
wchar_t* titleW = (wchar_t*)malloc(sizeof(wchar_t) * uLen);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, title, -1, (LPWSTR)titleW, uLen);
|
||||||
|
|
||||||
|
char* msg = GetLetterIllegalErrMsg(IsLetterLegal);
|
||||||
|
uLen = MultiByteToWideChar(CP_ACP, NULL, msg, -1, NULL, 0);
|
||||||
|
wchar_t* msgW = (wchar_t*)malloc(sizeof(wchar_t) * uLen);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, msg, -1, (LPWSTR)msgW, uLen);
|
||||||
|
|
||||||
|
EDITBALLOONTIP tip;
|
||||||
|
tip.cbStruct = sizeof(EDITBALLOONTIP);
|
||||||
|
tip.pszText = msgW;
|
||||||
|
tip.pszTitle = titleW;
|
||||||
|
tip.ttiIcon = TTI_ERROR;
|
||||||
|
SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM)&tip);
|
||||||
|
|
||||||
|
free(titleW);
|
||||||
|
free(msgW);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ShowLetterIllegalMessageBox(HWND hwnd, bool(*IsLetterLegal)(char letter))
|
||||||
|
{
|
||||||
|
MessageBox(hwnd, GetLetterIllegalErrMsg(IsLetterLegal), "Unacceptable Character", MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline char* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter))
|
||||||
|
{
|
||||||
|
if (IsLetterLegal == IsLetterLegalGG)
|
||||||
|
return "You can only type Game Genie characters:\nA P Z L G I T Y E O X U K S V N";
|
||||||
|
if (IsLetterLegal == IsLetterLegalHex)
|
||||||
|
return "You can only type characters for hexadecimal number (0-9,A-F).";
|
||||||
|
if (IsLetterLegal == IsLetterLegalCheat)
|
||||||
|
return
|
||||||
|
"The cheat code comes into the following 2 formats:\n"
|
||||||
|
"AAAA:VV freezes the value in Address $AAAA to $VV.\n"
|
||||||
|
"AAAA?CC:VV changes the value in Address $AAAA to $VV only when it's $CC.\n"
|
||||||
|
"All the characters are hexadecimal number (0-9,A-F).\n";
|
||||||
|
if (IsLetterLegal == IsLetterLegalFloat)
|
||||||
|
return "You can only type decimal number (decimal point is acceptable).";
|
||||||
|
if (IsLetterLegal == IsLetterLegalSize)
|
||||||
|
return "You can only type decimal number followed with B, KB or MB.";
|
||||||
|
if (IsLetterLegal == IsLetterLegalDec)
|
||||||
|
return "You can only type decimal number (minus is acceptable).";
|
||||||
|
|
||||||
|
return "Your input contains invalid characters.";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsInputLegal(bool (*IsLetterLegal)(char letter), char letter)
|
||||||
|
{
|
||||||
|
return !IsLetterLegal || letter == VK_BACK || GetKeyState(VK_CONTROL) & 0x8000 || IsLetterLegal(letter);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsLetterLegalGG(char letter)
|
||||||
|
{
|
||||||
|
char ch = toupper(letter);
|
||||||
|
for (int i = 0; GameGenieLetters[i]; ++i)
|
||||||
|
if (GameGenieLetters[i] == ch)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsLetterLegalHex(char letter)
|
||||||
|
{
|
||||||
|
return letter >= '0' && letter <= '9' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f';
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsLetterLegalCheat(char letter)
|
||||||
|
{
|
||||||
|
return letter >= '0' && letter <= ':' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f' || letter == '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsLetterLegalSize(char letter)
|
||||||
|
{
|
||||||
|
return letter >= '0' && letter <= '9' || letter == 'm' || letter == 'M' || letter == 'k' || letter == 'K' || letter == 'b' || letter == 'B';
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsLetterLegalDec(char letter)
|
||||||
|
{
|
||||||
|
return letter >= '0' && letter <= '9' || letter == '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool IsLetterLegalFloat(char letter)
|
||||||
|
{
|
||||||
|
return letter >= '0' && letter <= '9' || letter == '.';
|
||||||
|
}
|
|
@ -19,7 +19,7 @@ struct CreateMovieParameters
|
||||||
extern char *recent_files[];
|
extern char *recent_files[];
|
||||||
extern char *recent_lua[];
|
extern char *recent_lua[];
|
||||||
extern char *recent_movie[];
|
extern char *recent_movie[];
|
||||||
extern HWND pwindow;
|
// extern HWND pwindow;
|
||||||
|
|
||||||
HWND GetMainHWND();
|
HWND GetMainHWND();
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ void SetMainWindowStuff();
|
||||||
void GetMouseData(uint32 (&md)[3]);
|
void GetMouseData(uint32 (&md)[3]);
|
||||||
void GetMouseRelative(int32 (&md)[3]);
|
void GetMouseRelative(int32 (&md)[3]);
|
||||||
//void ChangeMenuItemText(int menuitem, string text);
|
//void ChangeMenuItemText(int menuitem, string text);
|
||||||
|
POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||||
|
|
||||||
template<int BUFSIZE>
|
template<int BUFSIZE>
|
||||||
inline std::string GetDlgItemText(HWND hDlg, int nIDDlgItem) {
|
inline std::string GetDlgItemText(HWND hDlg, int nIDDlgItem) {
|
||||||
|
@ -126,4 +127,21 @@ struct HOTKEYMENUINDEX {
|
||||||
|
|
||||||
void UpdateMenuHotkeys(FCEUMENU_INDEX index);
|
void UpdateMenuHotkeys(FCEUMENU_INDEX index);
|
||||||
int GetCurrentContextIndex();
|
int GetCurrentContextIndex();
|
||||||
|
|
||||||
|
inline bool (*GetIsLetterLegal(UINT id))(char letter);
|
||||||
|
inline char* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter));
|
||||||
|
inline void ShowLetterIllegalError(HWND hwnd, bool(*IsLetterLegal)(char letter), bool balloon = true);
|
||||||
|
void ShowLetterIllegalBalloonTip(HWND hwnd, bool(*IsLetterLegal)(char letter));
|
||||||
|
inline void ShowLetterIllegalMessageBox(HWND hwnd, bool(*IsLetterLegal)(char letter));
|
||||||
|
inline bool IsInputLegal(bool(*IsLetterLegal)(char letter), char letter);
|
||||||
|
inline bool IsLetterLegalGG(char letter);
|
||||||
|
inline bool IsLetterLegalHex(char letter);
|
||||||
|
inline bool IsLetterLegalCheat(char letter);
|
||||||
|
inline bool IsLetterLegalDec(char letter);
|
||||||
|
inline bool IsLetterLegalSize(char letter);
|
||||||
|
inline bool IsLetterLegalFloat(char letter);
|
||||||
|
|
||||||
|
extern WNDPROC DefaultEditCtrlProc;
|
||||||
|
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
62
src/fceu.cpp
62
src/fceu.cpp
|
@ -189,6 +189,11 @@ static void FCEU_CloseGame(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameInfo->type != GIT_NSF) {
|
if (GameInfo->type != GIT_NSF) {
|
||||||
|
if (disableAutoLSCheats == 2)
|
||||||
|
FCEU_FlushGameCheats(0, 1);
|
||||||
|
else if (disableAutoLSCheats == 1)
|
||||||
|
AskSaveCheat();
|
||||||
|
else if (disableAutoLSCheats == 0)
|
||||||
FCEU_FlushGameCheats(0, 0);
|
FCEU_FlushGameCheats(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,9 +437,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
strcat(fullname, "|");
|
strcat(fullname, "|");
|
||||||
strcat(fullname, fp->filename.c_str());
|
strcat(fullname, fp->filename.c_str());
|
||||||
} else
|
} else
|
||||||
{
|
|
||||||
strcpy(fullname, name);
|
strcpy(fullname, name);
|
||||||
}
|
|
||||||
|
|
||||||
// reset loaded game BEFORE it's loading.
|
// reset loaded game BEFORE it's loading.
|
||||||
ResetGameLoaded();
|
ResetGameLoaded();
|
||||||
|
@ -469,29 +472,12 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
|
|
||||||
//try to load each different format
|
//try to load each different format
|
||||||
bool FCEUXLoad(const char *name, FCEUFILE * fp);
|
bool FCEUXLoad(const char *name, FCEUFILE * fp);
|
||||||
/*if(FCEUXLoad(name,fp))
|
|
||||||
goto endlseq;*/
|
|
||||||
if (iNESLoad(fullname, fp, OverwriteVidMode))
|
|
||||||
goto endlseq;
|
|
||||||
if (NSFLoad(fullname, fp))
|
|
||||||
goto endlseq;
|
|
||||||
if (UNIFLoad(fullname, fp))
|
|
||||||
goto endlseq;
|
|
||||||
if (FDSLoad(fullname, fp))
|
|
||||||
goto endlseq;
|
|
||||||
|
|
||||||
if (!silent)
|
if (iNESLoad(fullname, fp, OverwriteVidMode) ||
|
||||||
FCEU_PrintError("An error occurred while loading the file.");
|
NSFLoad(fullname, fp) ||
|
||||||
FCEU_fclose(fp);
|
UNIFLoad(fullname, fp) ||
|
||||||
|
FDSLoad(fullname, fp))
|
||||||
delete GameInfo;
|
{
|
||||||
GameInfo = 0;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
endlseq:
|
|
||||||
|
|
||||||
FCEU_fclose(fp);
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// ################################## Start of SP CODE ###########################
|
// ################################## Start of SP CODE ###########################
|
||||||
|
@ -508,19 +494,16 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
if (OverwriteVidMode)
|
if (OverwriteVidMode)
|
||||||
FCEU_ResetVidSys();
|
FCEU_ResetVidSys();
|
||||||
|
|
||||||
if (GameInfo->type != GIT_NSF)
|
if (GameInfo->type != GIT_NSF &&
|
||||||
{
|
FSettings.GameGenie &&
|
||||||
if (FSettings.GameGenie)
|
FCEU_OpenGenie())
|
||||||
{
|
|
||||||
if (FCEU_OpenGenie())
|
|
||||||
{
|
{
|
||||||
FCEUI_SetGameGenie(false);
|
FCEUI_SetGameGenie(false);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
genie = 0;
|
genie = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
PowerNES();
|
PowerNES();
|
||||||
|
|
||||||
if (GameInfo->type != GIT_NSF)
|
if (GameInfo->type != GIT_NSF)
|
||||||
|
@ -532,16 +515,18 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
if (!lastpal && PAL) {
|
if (!lastpal && PAL) {
|
||||||
FCEU_DispMessage("PAL mode set", 0);
|
FCEU_DispMessage("PAL mode set", 0);
|
||||||
FCEUI_printf("PAL mode set");
|
FCEUI_printf("PAL mode set");
|
||||||
} else if (!lastdendy && dendy) {
|
}
|
||||||
|
else if (!lastdendy && dendy) {
|
||||||
// this won't happen, since we don't autodetect dendy, but maybe someday we will?
|
// this won't happen, since we don't autodetect dendy, but maybe someday we will?
|
||||||
FCEU_DispMessage("Dendy mode set", 0);
|
FCEU_DispMessage("Dendy mode set", 0);
|
||||||
FCEUI_printf("Dendy mode set");
|
FCEUI_printf("Dendy mode set");
|
||||||
} else if ((lastpal || lastdendy) && !(PAL || dendy)) {
|
}
|
||||||
|
else if ((lastpal || lastdendy) && !(PAL || dendy)) {
|
||||||
FCEU_DispMessage("NTSC mode set", 0);
|
FCEU_DispMessage("NTSC mode set", 0);
|
||||||
FCEUI_printf("NTSC mode set");
|
FCEUI_printf("NTSC mode set");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameInfo->type != GIT_NSF)
|
if (GameInfo->type != GIT_NSF && !disableAutoLSCheats)
|
||||||
FCEU_LoadGameCheats(0);
|
FCEU_LoadGameCheats(0);
|
||||||
|
|
||||||
if (AutoResumePlay)
|
if (AutoResumePlay)
|
||||||
|
@ -565,7 +550,16 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
if (FrozenAddressCount)
|
if (FrozenAddressCount)
|
||||||
FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount);
|
FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!silent)
|
||||||
|
FCEU_PrintError("An error occurred while loading the file.");
|
||||||
|
|
||||||
|
delete GameInfo;
|
||||||
|
GameInfo = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FCEU_fclose(fp);
|
||||||
return GameInfo;
|
return GameInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,9 +261,9 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
|
||||||
FILE *ipsfile=0;
|
FILE *ipsfile=0;
|
||||||
FCEUFILE *fceufp=0;
|
FCEUFILE *fceufp=0;
|
||||||
|
|
||||||
bool read = (std::string)mode == "rb";
|
bool read = !strcmp(mode, "rb");
|
||||||
bool write = (std::string)mode == "wb";
|
bool write = !strcmp(mode, "wb");
|
||||||
if((read&&write) || (!read&&!write))
|
if(read && write || !read && !write)
|
||||||
{
|
{
|
||||||
FCEU_PrintError("invalid file open mode specified (only wb and rb are supported)");
|
FCEU_PrintError("invalid file open mode specified (only wb and rb are supported)");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
14
src/ines.cpp
14
src/ines.cpp
|
@ -63,7 +63,7 @@ static int iNES_Init(int num);
|
||||||
|
|
||||||
static int MapperNo = 0;
|
static int MapperNo = 0;
|
||||||
|
|
||||||
static int iNES2 = 0;
|
int iNES2 = 0;
|
||||||
|
|
||||||
static DECLFR(TrainerRead) {
|
static DECLFR(TrainerRead) {
|
||||||
return(trainerpoo[A & 0x1FF]);
|
return(trainerpoo[A & 0x1FF]);
|
||||||
|
@ -443,13 +443,8 @@ static int not_power2[] =
|
||||||
{
|
{
|
||||||
53, 198, 228
|
53, 198, 228
|
||||||
};
|
};
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
int32 number;
|
|
||||||
void (*init)(CartInfo *);
|
|
||||||
} BMAPPINGLocal;
|
|
||||||
|
|
||||||
static BMAPPINGLocal bmap[] = {
|
BMAPPINGLocal bmap[] = {
|
||||||
{"NROM", 0, NROM_Init},
|
{"NROM", 0, NROM_Init},
|
||||||
{"MMC1", 1, Mapper1_Init},
|
{"MMC1", 1, Mapper1_Init},
|
||||||
{"UNROM", 2, UNROM_Init},
|
{"UNROM", 2, UNROM_Init},
|
||||||
|
@ -729,10 +724,7 @@ static BMAPPINGLocal bmap[] = {
|
||||||
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
|
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
|
||||||
struct md5_context md5;
|
struct md5_context md5;
|
||||||
|
|
||||||
if (FCEU_fread(&head, 1, 16, fp) != 16)
|
if (FCEU_fread(&head, 1, 16, fp) != 16 || memcmp(&head, "NES\x1A", 4))
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (memcmp(&head, "NES\x1a", 4))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
head.cleanup();
|
head.cleanup();
|
||||||
|
|
39
src/ines.h
39
src/ines.h
|
@ -51,30 +51,23 @@ extern TMasterRomInfoParams MasterRomInfoParams;
|
||||||
|
|
||||||
//mbg merge 7/19/06 changed to c++ decl format
|
//mbg merge 7/19/06 changed to c++ decl format
|
||||||
struct iNES_HEADER {
|
struct iNES_HEADER {
|
||||||
char ID[4]; /*NES^Z*/
|
char ID[4]; /*NES^Z*/ // 0-3
|
||||||
uint8 ROM_size;
|
uint8 ROM_size; // 4
|
||||||
uint8 VROM_size;
|
uint8 VROM_size; // 5
|
||||||
uint8 ROM_type;
|
uint8 ROM_type; // 6
|
||||||
uint8 ROM_type2;
|
uint8 ROM_type2; // 7
|
||||||
uint8 ROM_type3;
|
uint8 ROM_type3; // 8
|
||||||
uint8 Upper_ROM_VROM_size;
|
uint8 Upper_ROM_VROM_size; // 9
|
||||||
uint8 RAM_size;
|
uint8 RAM_size; // 10
|
||||||
uint8 VRAM_size;
|
uint8 VRAM_size; // 11
|
||||||
uint8 TV_system;
|
uint8 TV_system; // 12
|
||||||
uint8 VS_hardware;
|
uint8 VS_hardware; // 13
|
||||||
uint8 reserved[2];
|
uint8 reserved[2]; // 14, 15
|
||||||
|
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
if(!memcmp((char *)(this)+0x7,"DiskDude",8))
|
if(!memcmp((char*)(this) + 0x7, "DiskDude", 8) || !memcmp((char*)(this) + 0x7, "demiforce", 9))
|
||||||
{
|
|
||||||
memset((char*)(this) + 0x7, 0, 0x9);
|
memset((char*)(this) + 0x7, 0, 0x9);
|
||||||
}
|
|
||||||
|
|
||||||
if(!memcmp((char *)(this)+0x7,"demiforce",9))
|
|
||||||
{
|
|
||||||
memset((char *)(this)+0x7,0,0x9);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!memcmp((char*)(this) + 0xA, "Ni03", 4))
|
if(!memcmp((char*)(this) + 0xA, "Ni03", 4))
|
||||||
{
|
{
|
||||||
|
@ -85,6 +78,7 @@ struct iNES_HEADER {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct iNES_HEADER head; //for mappers usage
|
extern struct iNES_HEADER head; //for mappers usage
|
||||||
|
|
||||||
void NSFVRC6_Init(void);
|
void NSFVRC6_Init(void);
|
||||||
|
@ -274,4 +268,9 @@ void Mapper252_Init(CartInfo *);
|
||||||
void Mapper253_Init(CartInfo *);
|
void Mapper253_Init(CartInfo *);
|
||||||
void Mapper254_Init(CartInfo *);
|
void Mapper254_Init(CartInfo *);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *name;
|
||||||
|
int32 number;
|
||||||
|
void (*init)(CartInfo *);
|
||||||
|
} BMAPPINGLocal;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1117,8 +1117,8 @@ static void LaunchCodeDataLogger(void)
|
||||||
static void LaunchCheats(void)
|
static void LaunchCheats(void)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
extern HWND pwindow;
|
extern HWND hCheat;
|
||||||
ConfigCheats(pwindow);
|
ConfigCheats(hCheat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1500,8 +1500,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
|
||||||
//mbg 8/18/08 - this code can be used to turn the error message into an OK/CANCEL
|
//mbg 8/18/08 - this code can be used to turn the error message into an OK/CANCEL
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::string msg = "There is a mismatch between savestate's movie and current movie.\ncurrent: " + currMovieData.guid.toString() + "\nsavestate: " + tempMovieData.guid.toString() + "\n\nThis means that you have loaded a savestate belonging to a different movie than the one you are playing now.\n\nContinue loading this savestate anyway?";
|
std::string msg = "There is a mismatch between savestate's movie and current movie.\ncurrent: " + currMovieData.guid.toString() + "\nsavestate: " + tempMovieData.guid.toString() + "\n\nThis means that you have loaded a savestate belonging to a different movie than the one you are playing now.\n\nContinue loading this savestate anyway?";
|
||||||
extern HWND pwindow;
|
int result = MessageBox(hAppWnd, msg.c_str(), "Error loading savestate", MB_OKCANCEL);
|
||||||
int result = MessageBox(pwindow,msg.c_str(),"Error loading savestate",MB_OKCANCEL);
|
|
||||||
if(result == IDCANCEL)
|
if(result == IDCANCEL)
|
||||||
{
|
{
|
||||||
if (!backupSavestates) //If backups are disabled we can just resume normally since we can't restore so stop movie and inform user
|
if (!backupSavestates) //If backups are disabled we can just resume normally since we can't restore so stop movie and inform user
|
||||||
|
|
|
@ -557,6 +557,7 @@
|
||||||
<ClCompile Include="..\src\drivers\win\directories.cpp" />
|
<ClCompile Include="..\src\drivers\win\directories.cpp" />
|
||||||
<ClCompile Include="..\src\drivers\win\gui.cpp" />
|
<ClCompile Include="..\src\drivers\win\gui.cpp" />
|
||||||
<ClCompile Include="..\src\drivers\win\guiconfig.cpp" />
|
<ClCompile Include="..\src\drivers\win\guiconfig.cpp" />
|
||||||
|
<ClCompile Include="..\src\drivers\win\header_editor.cpp" />
|
||||||
<ClCompile Include="..\src\drivers\win\help.cpp" />
|
<ClCompile Include="..\src\drivers\win\help.cpp" />
|
||||||
<ClCompile Include="..\src\drivers\win\input.cpp" />
|
<ClCompile Include="..\src\drivers\win\input.cpp" />
|
||||||
<ClCompile Include="..\src\drivers\win\joystick.cpp" />
|
<ClCompile Include="..\src\drivers\win\joystick.cpp" />
|
||||||
|
@ -1012,6 +1013,7 @@
|
||||||
<ClInclude Include="..\src\drivers\win\directories.h" />
|
<ClInclude Include="..\src\drivers\win\directories.h" />
|
||||||
<ClInclude Include="..\src\drivers\win\gui.h" />
|
<ClInclude Include="..\src\drivers\win\gui.h" />
|
||||||
<ClInclude Include="..\src\drivers\win\guiconfig.h" />
|
<ClInclude Include="..\src\drivers\win\guiconfig.h" />
|
||||||
|
<ClInclude Include="..\src\drivers\win\header_editor.h" />
|
||||||
<ClInclude Include="..\src\drivers\win\help.h" />
|
<ClInclude Include="..\src\drivers\win\help.h" />
|
||||||
<ClInclude Include="..\src\drivers\win\input.h" />
|
<ClInclude Include="..\src\drivers\win\input.h" />
|
||||||
<ClInclude Include="..\src\drivers\win\joystick.h" />
|
<ClInclude Include="..\src\drivers\win\joystick.h" />
|
||||||
|
|
|
@ -1093,6 +1093,9 @@
|
||||||
<ClCompile Include="..\src\boards\hp10xx_hp20xx.cpp">
|
<ClCompile Include="..\src\boards\hp10xx_hp20xx.cpp">
|
||||||
<Filter>boards</Filter>
|
<Filter>boards</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\drivers\win\header_editor.cpp">
|
||||||
|
<Filter>drivers\win</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\src\drivers\common\args.h">
|
<ClInclude Include="..\src\drivers\common\args.h">
|
||||||
|
@ -1599,6 +1602,9 @@
|
||||||
<ClInclude Include="..\src\input\fkb.h">
|
<ClInclude Include="..\src\input\fkb.h">
|
||||||
<Filter>input</Filter>
|
<Filter>input</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\src\drivers\win\header_editor.h">
|
||||||
|
<Filter>drivers\win</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\src\drivers\win\res.rc">
|
<ResourceCompile Include="..\src\drivers\win\res.rc">
|
||||||
|
|
Loading…
Reference in New Issue