Merge branch 'master' into binary-view-on-ram-watch
This commit is contained in:
commit
3b8928fd50
|
@ -1,3 +1,6 @@
|
|||
#ifndef CART_H
|
||||
#define CART_H
|
||||
|
||||
typedef struct {
|
||||
// Set by mapper/board code:
|
||||
void (*Power)(void);
|
||||
|
@ -100,3 +103,5 @@ void FCEU_GeniePower(void);
|
|||
bool FCEU_OpenGenie(void);
|
||||
void FCEU_CloseGenie(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 };
|
||||
uint32 numsubcheats = 0;
|
||||
int globalCheatDisabled = 0;
|
||||
int disableAutoLSCheats = 0;
|
||||
struct CHEATF *cheats = 0, *cheatsl = 0;
|
||||
|
||||
|
||||
|
@ -104,11 +106,10 @@ void RebuildSubCheats(void)
|
|||
SetReadHandler(SubCheats[x].addr, SubCheats[x].addr, SubCheats[x].PrevRead);
|
||||
|
||||
numsubcheats = 0;
|
||||
while(c)
|
||||
{
|
||||
if(c->type == 1 && c->status)
|
||||
if (!globalCheatDisabled)
|
||||
while(c)
|
||||
{
|
||||
if(GetReadHandler(c->addr) != SubCheatsRead)
|
||||
if(c->type == 1 && c->status && GetReadHandler(c->addr) != SubCheatsRead)
|
||||
{
|
||||
SubCheats[numsubcheats].PrevRead = GetReadHandler(c->addr);
|
||||
SubCheats[numsubcheats].addr = c->addr;
|
||||
|
@ -117,9 +118,9 @@ void RebuildSubCheats(void)
|
|||
SetReadHandler(c->addr, c->addr, SubCheatsRead);
|
||||
numsubcheats++;
|
||||
}
|
||||
c = c->next;
|
||||
}
|
||||
c = c->next;
|
||||
}
|
||||
|
||||
FrozenAddressCount = numsubcheats; //Update the frozen address list
|
||||
UpdateFrozenList();
|
||||
|
||||
|
@ -243,7 +244,6 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
|||
char *neo = &tbuf[4+2+2+1+1+1];
|
||||
if(sscanf(tbuf, "%04x%*[:]%02x%*[:]%02x", &addr, &val, &compare) != 3)
|
||||
continue;
|
||||
char namebuf[128];
|
||||
strcpy(namebuf, neo);
|
||||
}
|
||||
else
|
||||
|
@ -277,6 +277,31 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
|
|||
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)
|
||||
{
|
||||
if(CheatComp)
|
||||
|
@ -309,7 +334,6 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
|
|||
|
||||
if(cheats)
|
||||
{
|
||||
struct CHEATF *next=cheats;
|
||||
FILE *fp;
|
||||
|
||||
if(override)
|
||||
|
@ -319,28 +343,7 @@ void FCEU_FlushGameCheats(FILE *override, int nosave)
|
|||
|
||||
if(fp)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
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;
|
||||
}
|
||||
FCEU_SaveGameCheats(fp, 1);
|
||||
if(!override)
|
||||
fclose(fp);
|
||||
}
|
||||
|
@ -642,6 +645,14 @@ int FCEUI_ToggleCheat(uint32 which)
|
|||
return(-1);
|
||||
}
|
||||
|
||||
int FCEUI_GlobalToggleCheat(int global_enabled)
|
||||
{
|
||||
int _numsubcheats = numsubcheats;
|
||||
globalCheatDisabled = !global_enabled;
|
||||
RebuildSubCheats();
|
||||
return _numsubcheats != numsubcheats;
|
||||
}
|
||||
|
||||
static int InitCheatComp(void)
|
||||
{
|
||||
uint32 x;
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#ifndef CHEAT_H
|
||||
#define CHEAT_H
|
||||
void FCEU_CheatResetRAM(void);
|
||||
void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p);
|
||||
|
||||
void FCEU_LoadGameCheats(FILE *override, int override_existing = 1);
|
||||
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_PowerCheats(void);
|
||||
int FCEU_CalcCheatAffectedBytes(uint32 address, uint32 size);
|
||||
|
@ -12,6 +16,8 @@ int FCEU_CheatGetByte(uint32 A);
|
|||
void FCEU_CheatSetByte(uint32 A, uint8 V);
|
||||
|
||||
extern int savecheats;
|
||||
extern int globalCheatDisabled;
|
||||
extern int disableAutoLSCheats;
|
||||
|
||||
int FCEU_DisableAllCheats();
|
||||
|
||||
|
@ -55,3 +61,4 @@ struct SEARCHPOSSIBLE {
|
|||
for (int i = 0; i < numsubcheats && count < size; ++i) \
|
||||
if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size) \
|
||||
++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_DelCheat(uint32 which);
|
||||
int FCEUI_ToggleCheat(uint32 which);
|
||||
int FCEUI_GlobalToggleCheat(int global_enable);
|
||||
|
||||
int32 FCEUI_CheatSearchGetCount(void);
|
||||
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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_CHEAT_H
|
||||
#define COMMON_CHEAT_H
|
||||
void DoConsoleCheatConfig(void);
|
||||
#endif
|
|
@ -135,7 +135,7 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
FreeCDLog();
|
||||
RenameCDLog("");
|
||||
hCDLogger = 0;
|
||||
EndDialog(hwndDlg, 0);
|
||||
DestroyWindow(hwndDlg);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
|
|
|
@ -29,11 +29,13 @@
|
|||
#include "../../cheat.h" // For FCEU_LoadGameCheats()
|
||||
#include <map>
|
||||
|
||||
static HWND pwindow = 0; //Handle to Cheats dialog
|
||||
HWND hCheat = 0; //mbg merge 7/19/06 had to add
|
||||
// static HWND pwindow = 0; // owomomo: removed pwindow because ambiguous, perhaps it is some obseleted early future plan from half developed old FCEUX?
|
||||
HWND hCheat = 0; //Handle to Cheats dialog
|
||||
HMENU hCheatcontext = 0; //Handle to cheat context menu
|
||||
|
||||
bool pauseWhileActive = false; //For checkbox "Pause while active"
|
||||
extern int globalCheatDisabled;
|
||||
extern int disableAutoLSCheats;
|
||||
extern bool wasPausedByCheats;
|
||||
|
||||
int CheatWindow;
|
||||
|
@ -62,17 +64,18 @@ int lbfocus = 0;
|
|||
int searchdone;
|
||||
static int knownvalue = 0;
|
||||
|
||||
int GGaddr, GGcomp, GGval;
|
||||
char GGcode[10];
|
||||
// int GGaddr, GGcomp, GGval;
|
||||
// char GGcode[10];
|
||||
int GGlist[GGLISTSIZE];
|
||||
static int dontupdateGG; //this eliminates recursive crashing
|
||||
char* GameGenieLetters = "APZLGITYEOXUKSVN";
|
||||
|
||||
// bool dodecode;
|
||||
|
||||
HWND hGGConv;
|
||||
|
||||
void EncodeGG(char *str, int a, int v, int c);
|
||||
void ListGGAddresses();
|
||||
void ListGGAddresses(HWND hwndDlg);
|
||||
|
||||
uint16 StrToU16(char *s)
|
||||
{
|
||||
|
@ -292,18 +295,28 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
if (ChtPosX == -32000) ChtPosX = 0; //Just in case
|
||||
if (ChtPosY == -32000) ChtPosY = 0;
|
||||
SetWindowPos(hwndDlg, 0, ChtPosX, ChtPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
POINT pt;
|
||||
if (ChtPosX != 0 && ChtPosY != 0)
|
||||
{
|
||||
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
|
||||
hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0);
|
||||
LOGFONT lf;
|
||||
GetObject(hFont, sizeof(LOGFONT), &lf);
|
||||
strcpy(lf.lfFaceName, "Courier New");
|
||||
hNewFont = CreateFontIndirect(&lf);
|
||||
SetupCheatFont(hwndDlg);
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHEAT_ADDR, 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_LT_BY, EM_SETLIMITTEXT, 2, 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;
|
||||
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
|
||||
searchdone = 0;
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL_KNOWN, (LPTSTR)U8ToStr(knownvalue));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL_KNOWN, (LPCSTR)U8ToStr(knownvalue));
|
||||
|
||||
// Enable Context Sub-Menus
|
||||
hCheatcontext = LoadMenu(fceu_hInstance, "CHEATCONTEXTMENUS");
|
||||
|
@ -356,7 +384,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
wasPausedByCheats = true;
|
||||
FCEU_printf("Emulation paused: %d\n", EmulationPaused);
|
||||
}
|
||||
|
||||
}
|
||||
if (CheatStyle && possiTotalCount) {
|
||||
if ((!wParam) && searchdone) {
|
||||
|
@ -366,6 +393,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
ShowResults(hwndDlg);
|
||||
}
|
||||
break;
|
||||
case WM_QUIT:
|
||||
case WM_CLOSE:
|
||||
if (CheatStyle)
|
||||
DestroyWindow(hwndDlg);
|
||||
|
@ -375,8 +403,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
case WM_DESTROY:
|
||||
CheatWindow = 0;
|
||||
hCheat = NULL;
|
||||
DeleteObject(hFont);
|
||||
DeleteObject(hNewFont);
|
||||
DeleteCheatFont();
|
||||
if (searchdone)
|
||||
FCEUI_CheatSearchSetCurrentAsOriginal();
|
||||
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);
|
||||
SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_SETSELECTIONMARK, 0, selcheat);
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)U16ToStr(a));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)U8ToStr(v));
|
||||
if (c == -1)
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)"");
|
||||
else
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(c));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)U8ToStr(c));
|
||||
UpdateCheatRelatedWindow();
|
||||
UpdateCheatListGroupBoxUI();
|
||||
// UpdateCheatAdded();
|
||||
|
@ -633,25 +660,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
}
|
||||
case IDC_BTN_CHEAT_ADDFROMFILE:
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
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))
|
||||
char filename[2048];
|
||||
if (ShowCheatFileBox(hwndDlg, filename, false))
|
||||
{
|
||||
FILE* file = FCEUD_UTF8fopen(nameo, "rb");
|
||||
FILE* file = FCEUD_UTF8fopen(filename, "rb");
|
||||
if (file)
|
||||
{
|
||||
FCEU_LoadGameCheats(file, 0);
|
||||
|
@ -662,6 +674,9 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
}
|
||||
}
|
||||
break;
|
||||
case IDC_BTN_CHEAT_EXPORTTOFILE:
|
||||
SaveCheatAs(hwndDlg);
|
||||
break;
|
||||
case IDC_BTN_CHEAT_RESET:
|
||||
FCEUI_CheatSearchBegin();
|
||||
ShowResults(hwndDlg);
|
||||
|
@ -718,6 +733,27 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
ShowResults(hwndDlg);
|
||||
}
|
||||
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;
|
||||
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_COM: editMode = 0; break;
|
||||
case IDC_CHEAT_TEXT: editMode = 1; break;
|
||||
case IDC_CHEAT_GAME_GENIE_TEXT: editMode = 2; break;
|
||||
}
|
||||
break;
|
||||
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;
|
||||
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);
|
||||
buf[0] = 0;
|
||||
if (a > 0x7FFF && v != -1)
|
||||
EncodeGG(buf, a, v, c);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT, buf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -751,7 +793,7 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
{
|
||||
char 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, '?'))
|
||||
|
@ -759,12 +801,35 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
else
|
||||
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);
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)(a == -1 ? "" : U16ToStr(a)));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)(v == -1 ? "" : U8ToStr(v)));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (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 != -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;
|
||||
FCEUI_GetCheat(selcheat, &name, &a, &v, &c, &s, NULL);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_NAME, (LPTSTR)name);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(a));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(v));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_NAME, (LPCSTR)name);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)U16ToStr(a));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)U8ToStr(v));
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||
|
||||
char code[32];
|
||||
GetCheatStr(code, a, v, c);
|
||||
|
||||
code[0] = 0;
|
||||
GetCheatCodeStr(code, a, v, c);
|
||||
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);
|
||||
|
@ -819,7 +889,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
if (!s)
|
||||
{
|
||||
FCEUI_SetCheat(tmpsel, name, -1, -1, -2, s ^= 1, 1);
|
||||
|
||||
UpdateCheatRelatedWindow();
|
||||
UpdateCheatListGroupBoxUI();
|
||||
}
|
||||
|
@ -858,10 +927,10 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
SEARCHPOSSIBLE& possible = possiList[pNMListView->iItem];
|
||||
char str[16];
|
||||
sprintf(str, "%04X", possible.addr);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCTSTR)str);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)str);
|
||||
sprintf(str, "%02X", possible.current);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCTSTR)str);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_VAL, (LPCSTR)str);
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPCSTR)"");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -922,7 +991,7 @@ void ConfigCheats(HWND hParent)
|
|||
selcheat = -1;
|
||||
CheatWindow = 1;
|
||||
if (CheatStyle)
|
||||
pwindow = hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||
hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||
else
|
||||
DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||
UpdateCheatsAdded();
|
||||
|
@ -936,10 +1005,10 @@ void ConfigCheats(HWND hParent)
|
|||
|
||||
void UpdateCheatList()
|
||||
{
|
||||
if (!pwindow)
|
||||
if (!hCheat)
|
||||
return;
|
||||
else
|
||||
ShowResults(pwindow);
|
||||
ShowResults(hCheat);
|
||||
}
|
||||
|
||||
void UpdateCheatListGroupBoxUI()
|
||||
|
@ -963,8 +1032,9 @@ void UpdateCheatListGroupBoxUI()
|
|||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE);
|
||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE);
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -976,8 +1046,8 @@ void UpdateCheatsAdded()
|
|||
|
||||
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) {
|
||||
case WM_MOVE: {
|
||||
|
@ -994,67 +1064,85 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
};
|
||||
case WM_INITDIALOG:
|
||||
//todo: set text limits
|
||||
if (GGConv_wndx == -32000)
|
||||
GGConv_wndx = 0; //Just in case
|
||||
if (GGConv_wndy == -32000)
|
||||
GGConv_wndy = 0;
|
||||
SetWindowPos(hwndDlg, 0, GGConv_wndx, GGConv_wndy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
{
|
||||
POINT pt;
|
||||
if (GGConv_wndx != 0 && GGConv_wndy != 0)
|
||||
{
|
||||
pt.x = GGConv_wndx;
|
||||
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);
|
||||
break;
|
||||
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;
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT:
|
||||
DestroyWindow(hGGConv);
|
||||
hGGConv = 0;
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
hGGConv = NULL;
|
||||
DeleteCheatFont();
|
||||
case WM_COMMAND:
|
||||
switch(HIWORD(wParam)) {
|
||||
case EN_UPDATE:
|
||||
if(dontupdateGG)break;
|
||||
dontupdateGG = 1;
|
||||
switch(LOWORD(wParam)){ //lets find out what edit control got changed
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
//lets find out what edit control got changed
|
||||
case IDC_GAME_GENIE_CODE: //The Game Genie Code - in this case decode it.
|
||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode,9);
|
||||
if((strlen(GGcode) != 8) && (strlen(GGcode) != 6))break;
|
||||
{
|
||||
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(hGGConv,IDC_GAME_GENIE_ADDR,str);
|
||||
|
||||
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();
|
||||
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_ADDR, a == -1 ? "" : U16ToStr(a));
|
||||
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_COMP, c == -1 ? "" : U8ToStr(c));
|
||||
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_VAL, v == -1 ? "" : U8ToStr(v));
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_GAME_GENIE_ADDR:
|
||||
case IDC_GAME_GENIE_COMP:
|
||||
case IDC_GAME_GENIE_VAL:
|
||||
|
||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str,5);
|
||||
if(strlen(str) != 4) break;
|
||||
|
||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_VAL,str,5);
|
||||
if(strlen(str) != 2) {GGval = -1; break;}
|
||||
|
||||
GGaddr = GetEditHex(hGGConv,IDC_GAME_GENIE_ADDR);
|
||||
GGval = GetEditHex(hGGConv,IDC_GAME_GENIE_VAL);
|
||||
|
||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_COMP,str,5);
|
||||
if(strlen(str) != 2) GGcomp = -1;
|
||||
else GGcomp = GetEditHex(hGGConv,IDC_GAME_GENIE_COMP);
|
||||
|
||||
EncodeGG(GGcode, GGaddr, GGval, GGcomp);
|
||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode);
|
||||
uint32 a = -1; uint8 v = -1; int c = -1;
|
||||
GetUIGGInfo(hwndDlg, &a, &v, &c);
|
||||
|
||||
char buf[9] = { 0 };
|
||||
if (a > 0x7FFF && v != -1)
|
||||
EncodeGG(buf, a, v, c);
|
||||
SetDlgItemText(hwndDlg, IDC_GAME_GENIE_CODE, buf);
|
||||
//ListGGAddresses();
|
||||
break;
|
||||
}
|
||||
ListGGAddresses();
|
||||
ListGGAddresses(hwndDlg);
|
||||
dontupdateGG = 0;
|
||||
break;
|
||||
case BN_CLICKED:
|
||||
|
@ -1062,20 +1150,22 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case IDC_BTN_ADD_TO_CHEATS:
|
||||
//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) {
|
||||
RedoCheatsCallB(GGcode, GGaddr, GGval, GGcomp, 1, 1, NULL);
|
||||
if(a < 0x8000) a += 0x8000;
|
||||
|
||||
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;
|
||||
ListView_MoveSelectionMark(GetDlgItem(hCheat, IDC_LIST_CHEATS), selcheat, newselcheat);
|
||||
selcheat = newselcheat;
|
||||
|
||||
SetDlgItemText(hCheat, IDC_CHEAT_ADDR, (LPTSTR)U16ToStr(GGaddr));
|
||||
SetDlgItemText(hCheat, IDC_CHEAT_VAL, (LPTSTR)U8ToStr(GGval));
|
||||
if(GGcomp == -1)
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)"");
|
||||
else
|
||||
SetDlgItemText(hwndDlg, IDC_CHEAT_COM, (LPTSTR)U8ToStr(GGcomp));
|
||||
SetDlgItemText(hCheat, IDC_CHEAT_ADDR, (LPCSTR)U16ToStr(a));
|
||||
SetDlgItemText(hCheat, IDC_CHEAT_VAL, (LPCSTR)U8ToStr(v));
|
||||
SetDlgItemText(hCheat, IDC_CHEAT_COM, (LPCSTR)(c == -1 ? "" : U8ToStr(c)));
|
||||
|
||||
EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_DEL), 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:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_LIST_GGADDRESSES:
|
||||
i = SendDlgItemMessage(hwndDlg,IDC_LIST_GGADDRESSES,LB_GETCURSEL,0,0);
|
||||
ChangeMemViewFocus(3,GGlist[i],-1);
|
||||
ChangeMemViewFocus(3,GGlist[SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_GETCURSEL, 0, 0)],-1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
break;
|
||||
case WM_HSCROLL:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//The code in this function is a modified version
|
||||
//of Chris Covell's work - I'd just like to point that out
|
||||
void EncodeGG(char *str, int a, int v, int c)
|
||||
{
|
||||
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;
|
||||
|
||||
a&=0x7fff;
|
||||
|
@ -1122,69 +1207,78 @@ void EncodeGG(char *str, int a, int v, int c)
|
|||
|
||||
if (c == -1){
|
||||
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;
|
||||
} else {
|
||||
num[2]+=8;
|
||||
num[5]+=c&8;
|
||||
num[6]=(c&7)+((c>>4)&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;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void ListGGAddresses()
|
||||
void ListGGAddresses(HWND hwndDlg)
|
||||
{
|
||||
uint32 i, j = 0; //mbg merge 7/18/06 changed from int
|
||||
char str[20];
|
||||
SendDlgItemMessage(hGGConv,IDC_LIST_GGADDRESSES,LB_RESETCONTENT,0,0);
|
||||
char str[20], code[9];
|
||||
SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_RESETCONTENT,0,0);
|
||||
|
||||
//also enable/disable the add GG button here
|
||||
GetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode,9);
|
||||
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);
|
||||
|
||||
if((GGaddr < 0) || ((strlen(GGcode) != 8) && (strlen(GGcode) != 6)))EnableWindow(GetDlgItem(hGGConv,IDC_BTN_ADD_TO_CHEATS),FALSE);
|
||||
else EnableWindow(GetDlgItem(hGGConv,IDC_BTN_ADD_TO_CHEATS),TRUE);
|
||||
// also enable/disable the add GG button here
|
||||
GetDlgItemText(hwndDlg, IDC_GAME_GENIE_CODE, code, 9);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ADD_TO_CHEATS), a >= 0 && (strlen(code) == 6 || strlen(code) == 8));
|
||||
|
||||
for(i = 0;i < PRGsize[0];i+=0x2000){
|
||||
if((PRGptr[0][i+(GGaddr&0x1FFF)] == GGcomp) || (GGcomp == -1)){
|
||||
GGlist[j] = i+(GGaddr&0x1FFF)+0x10;
|
||||
if(++j > GGLISTSIZE)return;
|
||||
sprintf(str,"%06X",i+(GGaddr&0x1FFF)+0x10);
|
||||
SendDlgItemMessage(hGGConv,IDC_LIST_GGADDRESSES,LB_ADDSTRING,0,(LPARAM)(LPSTR)str);
|
||||
}
|
||||
}
|
||||
if (a != -1 && v != -1)
|
||||
for(i = 0; i < PRGsize[0]; i += 0x2000)
|
||||
if(c == -1 || PRGptr[0][i + (a & 0x1FFF)] == c){
|
||||
GGlist[j] = i + (a & 0x1FFF) + 0x10;
|
||||
if(++j > GGLISTSIZE)
|
||||
return;
|
||||
sprintf(str, "%06X", i + (a & 0x1FFF) + 0x10);
|
||||
SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_ADDSTRING, 0, (LPARAM)str);
|
||||
}
|
||||
}
|
||||
|
||||
//A different model for this could be to have everything
|
||||
//set in the INITDIALOG message based on the internal
|
||||
//variables, and have this simply call that.
|
||||
void SetGGConvFocus(int address,int compare)
|
||||
void SetGGConvFocus(int address, int compare)
|
||||
{
|
||||
char str[10];
|
||||
if(!hGGConv)DoGGConv();
|
||||
GGaddr = address;
|
||||
GGcomp = compare;
|
||||
if(!hGGConv)
|
||||
DoGGConv();
|
||||
// GGaddr = address;
|
||||
// GGcomp = compare;
|
||||
|
||||
dontupdateGG = 1; //little hack to fix a nasty bug
|
||||
|
||||
sprintf(str,"%04X",address);
|
||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_ADDR,str);
|
||||
sprintf(str, "%04X", address);
|
||||
SetDlgItemText(hGGConv, IDC_GAME_GENIE_ADDR, str);
|
||||
|
||||
dontupdateGG = 0;
|
||||
|
||||
sprintf(str,"%02X",GGcomp);
|
||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_COMP,str);
|
||||
sprintf(str, "%02X", compare);
|
||||
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 {
|
||||
EncodeGG(GGcode, GGaddr, GGval, GGcomp);
|
||||
SetDlgItemText(hGGConv,IDC_GAME_GENIE_CODE,GGcode);
|
||||
str[0] = 0;
|
||||
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));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1196,23 +1290,24 @@ void DoGGConv()
|
|||
ShowWindow(hGGConv, SW_SHOWNORMAL);
|
||||
SetForegroundWindow(hGGConv);
|
||||
} else
|
||||
{
|
||||
hGGConv = CreateDialog(fceu_hInstance,"GGCONV",NULL,GGConvCallB);
|
||||
}
|
||||
return;
|
||||
hGGConv = CreateDialog(fceu_hInstance,"GGCONV", hAppWnd, GGConvCallB);
|
||||
}
|
||||
|
||||
inline void GetCheatStr(char* buf, int a, int v, int c)
|
||||
{
|
||||
if (a >= 0x8000)
|
||||
if (a > 0x7FFF)
|
||||
EncodeGG(buf, a, v, c);
|
||||
else {
|
||||
if (c == -1)
|
||||
sprintf(buf, "%04X:%02X", (int)a, (int)v);
|
||||
else
|
||||
sprintf(buf, "%04X?%02X:%02X", (int)a, (int)c, (int)v);
|
||||
GetCheatCodeStr(buf, a, v, c);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -1228,6 +1323,17 @@ void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c)
|
|||
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()
|
||||
{
|
||||
if(FCEU_DisableAllCheats() && hCheat){
|
||||
|
@ -1269,4 +1375,112 @@ void UpdateCheatRelatedWindow()
|
|||
SendDlgItemMessage(RamWatchHWnd, IDC_WATCHLIST, LVM_GETCOUNTPERPAGE, 0, 0) + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
#ifndef WIN_CHEAT_H
|
||||
#define WIN_CHEAT_H
|
||||
extern int CheatWindow,CheatStyle; //bbit edited: this line added
|
||||
extern HWND hCheat;
|
||||
|
||||
|
@ -11,21 +13,35 @@ typedef unsigned int HWAddressType;
|
|||
|
||||
void ConfigCheats(HWND hParent);
|
||||
void DoGGConv();
|
||||
void SetGGConvFocus(int address,int compare);
|
||||
void SetGGConvFocus(int address, int compare);
|
||||
void UpdateCheatList();
|
||||
void UpdateCheatListGroupBoxUI();
|
||||
void UpdateCheatsAdded();
|
||||
void ToggleCheatInputMode(HWND hwndDlg, int modeId);
|
||||
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c);
|
||||
inline void GetCheatStr(char* buf, int a, int v, int c);
|
||||
inline void GetCheatCodeStr(char* buf, int a, int v, int c);
|
||||
|
||||
extern unsigned int FrozenAddressCount;
|
||||
extern std::vector<uint16> FrozenAddresses;
|
||||
//void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line
|
||||
extern struct CHEATF* cheats;
|
||||
extern char* GameGenieLetters;
|
||||
|
||||
void DisableAllCheats();
|
||||
bool ShowCheatFileBox(HWND hwnd, char* buf, bool save = false);
|
||||
void AskSaveCheat();
|
||||
void SaveCheatAs(HWND hwnd, bool flush = false);
|
||||
|
||||
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
|
||||
#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)
|
||||
|
||||
#define ClearCheatListText(hwnd) \
|
||||
(SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_TEXT, (LPTSTR)""))
|
||||
(SetDlgItemText(hwnd, IDC_CHEAT_ADDR, (LPCSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPCSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPCSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPCSTR)"") & \
|
||||
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 int CurrentState;
|
||||
extern bool pauseWhileActive; //adelikat: Cheats dialog
|
||||
extern int globalCheatDisabled;
|
||||
extern int disableAutoLSCheats;
|
||||
extern bool enableHUDrecording;
|
||||
extern bool disableMovieMessages;
|
||||
extern bool replaceP2StartWithMicrophone;
|
||||
|
@ -466,6 +468,8 @@ static CFGSTRUCT fceuconfig[] =
|
|||
AC(backupSavestates),
|
||||
AC(compressSavestates),
|
||||
AC(pauseWhileActive),
|
||||
AC(disableAutoLSCheats),
|
||||
AC(globalCheatDisabled),
|
||||
AC(enableHUDrecording),
|
||||
AC(disableMovieMessages),
|
||||
AC(replaceP2StartWithMicrophone),
|
||||
|
|
|
@ -70,7 +70,7 @@ static HMENU hDisasmcontext; //Handle to context menu
|
|||
static HMENU hDisasmcontextsub; //Handle to context sub menu
|
||||
WNDPROC IDC_DEBUGGER_DISASSEMBLY_oldWndProc = 0;
|
||||
|
||||
static HFONT hFont;
|
||||
// static HFONT hFont;
|
||||
static SCROLLINFO si;
|
||||
|
||||
bool debuggerAutoload = false;
|
||||
|
@ -276,8 +276,12 @@ BOOL CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
CenterWindow(hwndDlg);
|
||||
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_START, 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)
|
||||
{
|
||||
SetWindowText(hwndDlg,"Edit Breakpoint...");
|
||||
|
@ -359,7 +363,7 @@ BOOL CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
int tmp = NewBreakWindows(hwndDlg,WP_edit,(BOOL)(watchpoint[WP_edit].flags&WP_E));
|
||||
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;
|
||||
}
|
||||
EndDialog(hwndDlg,1);
|
||||
|
@ -1820,6 +1824,14 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,EM_SETLIMITTEXT,4,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
|
||||
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,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.
|
||||
/// @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
||||
void updateGameDependentMenusDebugger(unsigned int enable) {
|
||||
void updateGameDependentMenusDebugger() {
|
||||
if (!hDebug)
|
||||
return;
|
||||
|
||||
//EnableWindow(GetDlgItem(hDebug,DEBUGLOADDEB),(enable ? 0 : 1));
|
||||
// EnableWindow(GetDlgItem(hDebug,DEBUGLOADDEB), GameInfo != 0 ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
void DoDebug(uint8 halt)
|
||||
|
@ -2496,7 +2508,7 @@ void DoDebug(uint8 halt)
|
|||
ShowWindow(hDebug, SW_SHOWNORMAL);
|
||||
SetForegroundWindow(hDebug);
|
||||
|
||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
||||
updateGameDependentMenusDebugger();
|
||||
|
||||
if (GameInfo)
|
||||
UpdateDebugger(true);
|
||||
|
|
|
@ -43,7 +43,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr);
|
|||
void PrintOffsetToSeekAndBookmarkFields(int offset);
|
||||
|
||||
void LoadGameDebuggerData(HWND hwndDlg);
|
||||
void updateGameDependentMenusDebugger(unsigned int enable);
|
||||
void updateGameDependentMenusDebugger();
|
||||
|
||||
extern bool inDebugger;
|
||||
|
||||
|
@ -69,5 +69,7 @@ public:
|
|||
|
||||
} *debugSystem;
|
||||
|
||||
// extern WNDPROC DefaultEditCtrlProc;
|
||||
// extern LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP);
|
||||
|
||||
#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)
|
||||
{
|
||||
RECT r;
|
||||
RECT r2;
|
||||
int dx1, dy1, dx2, dy2;
|
||||
// RECT r;
|
||||
// RECT r2;
|
||||
// int dx1, dy1, dx2, dy2;
|
||||
|
||||
switch (msg) {
|
||||
|
||||
|
@ -113,43 +113,10 @@ INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
|
|||
// remove the 30000 character limit from the console control
|
||||
SendMessage(GetDlgItem(hDlg, IDC_LUACONSOLE),EM_LIMITTEXT,0,0);
|
||||
|
||||
GetWindowRect(hAppWnd, &r);
|
||||
dx1 = (r.right - r.left) / 2;
|
||||
dy1 = (r.bottom - r.top) / 2;
|
||||
|
||||
GetWindowRect(hDlg, &r2);
|
||||
dx2 = (r2.right - r2.left) / 2;
|
||||
dy2 = (r2.bottom - r2.top) / 2;
|
||||
|
||||
//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);
|
||||
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||
CalcSubWindowPos(hDlg, NULL);
|
||||
|
||||
|
||||
RECT r3;
|
||||
GetClientRect(hDlg, &r3);
|
||||
windowInfo.width = r3.right - r3.left;
|
||||
|
|
|
@ -316,89 +316,118 @@ int BlockingCheck()
|
|||
MSG msg;
|
||||
moocow = 1;
|
||||
|
||||
while( PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ) )
|
||||
while(PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if( GetMessage( &msg, 0, 0, 0)>0 )
|
||||
if(GetMessage(&msg, 0, 0, 0) > 0)
|
||||
{
|
||||
//other accelerator capable dialogs could be added here
|
||||
extern HWND hwndMemWatch;
|
||||
|
||||
int handled = 0;
|
||||
|
||||
if(hCheat)
|
||||
if(IsChild(hCheat, msg.hwnd))
|
||||
handled = IsDialogMessage(hCheat, &msg);
|
||||
if(!handled && hMemFind)
|
||||
{
|
||||
if(IsChild(hMemFind, msg.hwnd))
|
||||
handled = IsDialogMessage(hMemFind, &msg);
|
||||
}
|
||||
// Cheat console
|
||||
if(hCheat && IsChild(hCheat, msg.hwnd))
|
||||
handled = IsDialogMessage(hCheat, &msg);
|
||||
|
||||
// Hex Editor -> Find
|
||||
if(!handled && hMemFind && IsChild(hMemFind, msg.hwnd))
|
||||
handled = IsDialogMessage(hMemFind, &msg);
|
||||
|
||||
// Memory Watch
|
||||
extern HWND hwndMemWatch;
|
||||
if(!handled && hwndMemWatch)
|
||||
{
|
||||
if(IsChild(hwndMemWatch,msg.hwnd))
|
||||
handled = TranslateAccelerator(hwndMemWatch,fceu_hAccel,&msg);
|
||||
if(IsChild(hwndMemWatch, msg.hwnd))
|
||||
handled = TranslateAccelerator(hwndMemWatch, fceu_hAccel, &msg);
|
||||
if(!handled)
|
||||
handled = IsDialogMessage(hwndMemWatch,&msg);
|
||||
}
|
||||
if(!handled && RamSearchHWnd)
|
||||
{
|
||||
|
||||
// RAM Search
|
||||
if(!handled && RamSearchHWnd && IsChild(RamSearchHWnd, msg.hwnd))
|
||||
handled = IsDialogMessage(RamSearchHWnd, &msg);
|
||||
}
|
||||
|
||||
// RAM_Watch
|
||||
if(!handled && RamWatchHWnd)
|
||||
{
|
||||
if(IsDialogMessage(RamWatchHWnd, &msg))
|
||||
{
|
||||
if(handled = 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)
|
||||
SendMessage(RamWatchHWnd, msg.message, msg.wParam, msg.lParam);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TAS Editor
|
||||
if(!handled && taseditorWindow.hwndTASEditor)
|
||||
{
|
||||
if(taseditorEnableAcceleratorKeys)
|
||||
if(IsChild(taseditorWindow.hwndTASEditor, msg.hwnd))
|
||||
handled = TranslateAccelerator(taseditorWindow.hwndTASEditor, fceu_hAccel, &msg);
|
||||
if(!handled && taseditorWindow.hwndTASEditor){
|
||||
if(!handled){
|
||||
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;
|
||||
if(!handled && uug && IsChild(uug, msg.hwnd))
|
||||
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))
|
||||
handled = IsDialogMessage(hCDLogger, &msg);
|
||||
|
||||
// Trace Logger
|
||||
if(!handled && hTracer && IsChild(hTracer, msg.hwnd))
|
||||
handled = IsDialogMessage(hTracer, &msg);
|
||||
|
||||
// Game Genie Encoder/Decoder
|
||||
extern HWND hGGConv;
|
||||
if(!handled && hGGConv && IsChild(hGGConv, msg.hwnd))
|
||||
handled = IsDialogMessage(hGGConv, &msg);
|
||||
|
||||
// Debugger
|
||||
if(!handled && hDebug && IsChild(hDebug, msg.hwnd))
|
||||
handled = IsDialogMessage(hDebug, &msg);
|
||||
|
||||
// PPU Viewer
|
||||
extern HWND hPPUView;
|
||||
if(!handled && hPPUView && IsChild(hPPUView, msg.hwnd))
|
||||
handled = IsDialogMessage(hPPUView, &msg);
|
||||
|
||||
// Nametable Viewer
|
||||
extern HWND hNTView;
|
||||
if(!handled && hNTView && IsChild(hNTView, msg.hwnd))
|
||||
handled = IsDialogMessage(hNTView, &msg);
|
||||
|
||||
// Text Hooker
|
||||
extern HWND hTextHooker;
|
||||
if(!handled && hTextHooker && IsChild(hTextHooker, msg.hwnd))
|
||||
handled = IsDialogMessage(hTextHooker, &msg);
|
||||
|
||||
// Lua Scripts
|
||||
extern HWND LuaConsoleHWnd;
|
||||
if(!handled && LuaConsoleHWnd && IsChild(LuaConsoleHWnd, msg.hwnd))
|
||||
handled = IsDialogMessage(LuaConsoleHWnd, &msg);
|
||||
|
||||
// Logs
|
||||
extern HWND logwin;
|
||||
if(!handled && logwin && IsChild(logwin, msg.hwnd))
|
||||
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.
|
||||
if(!handled)
|
||||
if(msg.hwnd == hAppWnd)
|
||||
|
@ -410,6 +439,7 @@ int BlockingCheck()
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(!handled)
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
|
@ -467,7 +497,7 @@ void DoFCEUExit()
|
|||
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR) && !exitTASEditor())
|
||||
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)
|
||||
{
|
||||
|
@ -1124,14 +1154,14 @@ void FCEUD_ToggleStatusIcon(void)
|
|||
UpdateCheckedMenuItems();
|
||||
}
|
||||
|
||||
char *GetRomName()
|
||||
char *GetRomName(bool force)
|
||||
{
|
||||
//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
|
||||
//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
|
||||
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];
|
||||
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
||||
|
@ -1145,14 +1175,14 @@ char *GetRomName()
|
|||
return mystring;
|
||||
}
|
||||
|
||||
char *GetRomPath()
|
||||
char *GetRomPath(bool force)
|
||||
{
|
||||
//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
|
||||
//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
|
||||
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];
|
||||
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
||||
|
|
|
@ -65,8 +65,8 @@ extern int vmod;
|
|||
|
||||
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 *GetRomPath(); //Checks if rom is loaded, if so, outputs the Rom path only
|
||||
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(bool force = false); //Checks if rom is loaded, if so, outputs the Rom path only
|
||||
|
||||
///Contains the names of the default directories.
|
||||
static const char *default_directory_names[13] = {
|
||||
|
|
|
@ -316,7 +316,7 @@ static int GetFileData(uint32 offset){
|
|||
}
|
||||
|
||||
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 >= PRGsize[0]+16) && (addr < CHRsize[0]+PRGsize[0]+16)) *(uint8 *)(GetNesCHRPointer(addr-16-PRGsize[0])) = data;
|
||||
|
||||
|
|
|
@ -201,19 +201,50 @@ 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);
|
||||
}
|
||||
|
||||
static const int MW_ADDR_Lookup[] = {
|
||||
MW_ADDR00,MW_ADDR01,MW_ADDR02,MW_ADDR03,
|
||||
MW_ADDR04,MW_ADDR05,MW_ADDR06,MW_ADDR07,
|
||||
MW_ADDR08,MW_ADDR09,MW_ADDR10,MW_ADDR11,
|
||||
MW_ADDR12,MW_ADDR13,MW_ADDR14,MW_ADDR15,
|
||||
MW_ADDR16,MW_ADDR17,MW_ADDR18,MW_ADDR19,
|
||||
MW_ADDR20,MW_ADDR21,MW_ADDR22,MW_ADDR23
|
||||
static const int MW_ADDR[] = {
|
||||
MW_ADDR00, MW_ADDR01, MW_ADDR02, MW_ADDR03,
|
||||
MW_ADDR04, MW_ADDR05, MW_ADDR06, MW_ADDR07,
|
||||
MW_ADDR08, MW_ADDR09, MW_ADDR10, MW_ADDR11,
|
||||
MW_ADDR12, MW_ADDR13, MW_ADDR14, MW_ADDR15,
|
||||
MW_ADDR16, MW_ADDR17, MW_ADDR18, MW_ADDR19,
|
||||
MW_ADDR20, MW_ADDR21, MW_ADDR22, MW_ADDR23
|
||||
};
|
||||
static const int MW_NAME[] =
|
||||
{
|
||||
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
|
||||
};
|
||||
inline int MW_ADDR(int i) { return MW_ADDR_Lookup[i] ; }
|
||||
inline int MW_NAME(int i) { return MW_ADDR_Lookup[i]-1; }
|
||||
inline int MW_VAL (int i) { return MW_ADDR_Lookup[i]+1; }
|
||||
|
||||
static const int MWNUM = ARRAY_SIZE(MW_ADDR_Lookup);
|
||||
|
||||
static const int MWNUM = ARRAY_SIZE(MW_ADDR);
|
||||
|
||||
static int yPositions[MWNUM];
|
||||
static int xPositions[MWNUM];
|
||||
|
@ -223,7 +254,7 @@ static struct MWRec
|
|||
static int findIndex(WORD ctl)
|
||||
{
|
||||
for(int i=0;i<MWNUM;i++)
|
||||
if(MW_ADDR(i) == ctl)
|
||||
if(MW_ADDR[i] == ctl)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
@ -346,8 +377,8 @@ static void SaveStrings()
|
|||
int i;
|
||||
for(i=0;i<MWNUM;i++)
|
||||
{
|
||||
GetDlgItemText(hwndMemWatch,MW_ADDR(i),addresses[i],ADDRESSLENGTH);
|
||||
GetDlgItemText(hwndMemWatch,MW_NAME(i),labels[i],LABELLENGTH);
|
||||
GetDlgItemText(hwndMemWatch,MW_ADDR[i],addresses[i],ADDRESSLENGTH);
|
||||
GetDlgItemText(hwndMemWatch,MW_NAME[i],labels[i],LABELLENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,9 +596,9 @@ static void LoadMemWatch()
|
|||
addresses[i][tempal] = 0;
|
||||
labels[i][templl] = 0; //just in case
|
||||
|
||||
SetDlgItemText(hwndMemWatch,MW_VAL (i),(LPTSTR) "---");
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_VAL [i],(LPTSTR) "---");
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
@ -615,9 +646,9 @@ void OpenMemwatchRecentFile(int memwRFileNumber)
|
|||
addresses[i][tempal] = 0;
|
||||
labels[i][templl] = 0; //just in case
|
||||
|
||||
SetDlgItemText(hwndMemWatch,MW_VAL (i),(LPTSTR) "---");
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_VAL [i],(LPTSTR) "---");
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||
}
|
||||
fclose(fp); //Close the file
|
||||
fileChanged = false; //Flag that the memwatch file has not been changed since last save
|
||||
|
@ -686,8 +717,8 @@ void ClearAllText()
|
|||
{
|
||||
addresses[i][0] = 0;
|
||||
labels[i][0] = 0;
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||
}
|
||||
//Now clear last file used variable (memwLastFilename)
|
||||
for (int i=0;i<2048;i++)
|
||||
|
@ -702,31 +733,40 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
const int FMAX = 6;
|
||||
string formula[FMAX] = {"> than", "> by 1", "< than", "< by 1", "equal", "!equal"};
|
||||
|
||||
const int kLabelControls[] = {MW_VALUELABEL1,MW_VALUELABEL2};
|
||||
const int kLabelControls[] = {MW_VALUELABEL1, MW_VALUELABEL2};
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
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;
|
||||
case WM_MOVE: {
|
||||
if (!IsIconic(hwndDlg)) {
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndDlg,&wrect);
|
||||
MemWatch_wndx = wrect.left;
|
||||
MemWatch_wndy = wrect.top;
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndDlg,&wrect);
|
||||
MemWatch_wndx = wrect.left;
|
||||
MemWatch_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
WindowBoundsCheckNoResize(MemWatch_wndx,MemWatch_wndy,wrect.right);
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
WindowBoundsCheckNoResize(MemWatch_wndx,MemWatch_wndy,wrect.right);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
case WM_INITDIALOG:
|
||||
if (MemWatch_wndx==-32000) MemWatch_wndx=0; //Just in case
|
||||
if (MemWatch_wndy==-32000) MemWatch_wndy=0; //-32000 bugs can happen as it is a special windows value
|
||||
SetWindowPos(hwndDlg,0,MemWatch_wndx,MemWatch_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
|
||||
POINT pt;
|
||||
if (MemWatch_wndx != 0 && MemWatch_wndy != 0)
|
||||
{
|
||||
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);
|
||||
SelectObject (hdc, debugSystem->hFixedFont);
|
||||
SetTextAlign(hdc,TA_UPDATECP | TA_TOP | TA_LEFT);
|
||||
|
@ -739,19 +779,23 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
}
|
||||
|
||||
//find the positions where we should draw string values
|
||||
for(int i=0;i<MWNUM;i++) {
|
||||
int col=0;
|
||||
if(i>=MWNUM/2)
|
||||
col=1;
|
||||
for(int i = 0; i < MWNUM; i++) {
|
||||
int col = 0;
|
||||
if(i >= MWNUM / 2)
|
||||
col = 1;
|
||||
RECT r;
|
||||
GetWindowRect(GetDlgItem(hwndDlg,MW_ADDR(i)),&r);
|
||||
ScreenToClient(hwndDlg,(LPPOINT)&r);
|
||||
ScreenToClient(hwndDlg,(LPPOINT)&r.right);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, MW_ADDR[i]), &r);
|
||||
ScreenToClient(hwndDlg, (LPPOINT)&r);
|
||||
ScreenToClient(hwndDlg, (LPPOINT)&r.right);
|
||||
yPositions[i] = r.top;
|
||||
yPositions[i] += ((r.bottom-r.top)-debugSystem->fixedFontHeight)/2; //vertically center
|
||||
GetWindowRect(GetDlgItem(hwndDlg,kLabelControls[col]),&r);
|
||||
ScreenToClient(hwndDlg,(LPPOINT)&r);
|
||||
yPositions[i] += (r.bottom - r.top - debugSystem->fixedFontHeight) / 2; //vertically center
|
||||
GetWindowRect(GetDlgItem(hwndDlg, kLabelControls[col]), &r);
|
||||
ScreenToClient(hwndDlg, (LPPOINT)&r);
|
||||
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
|
||||
|
@ -759,9 +803,9 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
{
|
||||
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 BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
editnow[x] = 0;
|
||||
editlast[x]= 0;
|
||||
}
|
||||
|
||||
RamChangeInitialize = true;
|
||||
break;
|
||||
|
||||
|
@ -870,7 +915,6 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
case MEMW_EXPANDCOLLAPSE:
|
||||
CollapseWindow();
|
||||
break;
|
||||
|
||||
case MEMW_EDIT00RESET:
|
||||
RamChangeReset(0);
|
||||
break;
|
||||
|
@ -892,7 +936,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
switch(HIWORD(wParam))
|
||||
{
|
||||
|
||||
case EN_CHANGE:
|
||||
case EN_CHANGE:
|
||||
{
|
||||
fileChanged = iftextchanged();
|
||||
//the contents of an address box changed. re-parse it.
|
||||
|
@ -904,44 +948,44 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
}
|
||||
|
||||
#if 0
|
||||
case BN_CLICKED:
|
||||
case BN_CLICKED:
|
||||
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case 101: //Save button clicked
|
||||
//StopSound(); //mbg 5/7/08
|
||||
//SaveMemWatch(); //5/13/08 Buttons removed (I didn't remove the code so it would be easy to add them back one day)
|
||||
break;
|
||||
case 102: //Load button clicked
|
||||
//StopSound(); //mbg 5/7/08
|
||||
//LoadMemWatch(); //5/13/08 Buttons removed
|
||||
break;
|
||||
case 103: //Clear button clicked
|
||||
//ClearAllText(); //5/13/08 Buttons removed
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case 101: //Save button clicked
|
||||
//StopSound(); //mbg 5/7/08
|
||||
//SaveMemWatch(); //5/13/08 Buttons removed (I didn't remove the code so it would be easy to add them back one day)
|
||||
break;
|
||||
case 102: //Load button clicked
|
||||
//StopSound(); //mbg 5/7/08
|
||||
//LoadMemWatch(); //5/13/08 Buttons removed
|
||||
break;
|
||||
case 103: //Clear button clicked
|
||||
//ClearAllText(); //5/13/08 Buttons removed
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(!(wParam>>16)) //Close button clicked
|
||||
{
|
||||
switch(wParam&0xFFFF)
|
||||
if(!(wParam>>16)) //Close button clicked
|
||||
{
|
||||
case 1:
|
||||
//CloseMemoryWatch(); //5/13/08 Buttons removed
|
||||
break;
|
||||
switch(wParam&0xFFFF)
|
||||
{
|
||||
case 1:
|
||||
//CloseMemoryWatch(); //5/13/08 Buttons removed
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -993,9 +1037,9 @@ void CreateMemWatch()
|
|||
int i;
|
||||
for(i = 0; i < MWNUM; i++)
|
||||
{
|
||||
SetDlgItemText(hwndMemWatch,MW_VAL (i),(LPTSTR) "---");
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME(i),(LPTSTR) labels[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_VAL [i],(LPTSTR) "---");
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR[i],(LPTSTR) addresses[i]);
|
||||
SetDlgItemText(hwndMemWatch,MW_NAME[i],(LPTSTR) labels[i]);
|
||||
}
|
||||
}
|
||||
if (MemWatchLoadFileOnStart) OpenMemwatchRecentFile(0);
|
||||
|
@ -1014,10 +1058,10 @@ void AddMemWatch(char memaddress[32])
|
|||
CreateMemWatch();
|
||||
for(i = 0; i < MWNUM; i++)
|
||||
{
|
||||
GetDlgItemText(hwndMemWatch,MW_ADDR(i),TempArray,32);
|
||||
GetDlgItemText(hwndMemWatch,MW_ADDR[i],TempArray,32);
|
||||
if (TempArray[0] == 0)
|
||||
{
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR(i),memaddress);
|
||||
SetDlgItemText(hwndMemWatch,MW_ADDR[i],memaddress);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1039,23 +1083,19 @@ void RamChange()
|
|||
//Get proper Addr edit box
|
||||
switch (x)
|
||||
{
|
||||
case 0:
|
||||
whichADDR = 0; break; //Addr 1
|
||||
case 1:
|
||||
whichADDR = 3; break; //Addr 2
|
||||
case 2:
|
||||
whichADDR = 36; break; //Addr 12
|
||||
case 3:
|
||||
whichADDR = 39; break; //Addr 13
|
||||
case 0: whichADDR = 0; break; //Addr 1
|
||||
case 1: whichADDR = 1; break; //Addr 2
|
||||
case 2: whichADDR = 11; break; //Addr 12
|
||||
case 3: whichADDR = 12; break; //Addr 13
|
||||
}
|
||||
GetDlgItemText(hwndMemWatch, MW_ADDR00+(whichADDR), editboxnow[x], 6); //Get Address value of edit00
|
||||
SetDlgItemText(hwndMemWatch, MEMW_EDIT00RMADDRESS+x, editboxnow[x]); //Put Address value
|
||||
GetDlgItemText(hwndMemWatch, MW_ADDR[whichADDR], editboxnow[x], 6); //Get Address value of edit00
|
||||
SetDlgItemText(hwndMemWatch, MW_RMADDR[x], editboxnow[x]); //Put Address value
|
||||
editlast[x] = editnow[x]; //Update last value
|
||||
editnow[x] = GetMem(mwrec.addr); //Update now value
|
||||
|
||||
|
||||
//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)
|
||||
{
|
||||
//Greater than------------------------------------
|
||||
|
@ -1102,7 +1142,7 @@ void RamChangeReset(int x)
|
|||
{
|
||||
editcount[x] = 0;
|
||||
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)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
static int recv_tcpwrap(uint8 *buf, int len);
|
||||
static void NetStatAdd(char *text);
|
||||
|
||||
static HWND netwin=0;
|
||||
HWND netwin=0;
|
||||
|
||||
static char *netstatt[64];
|
||||
static int netstattcount=0;
|
||||
|
|
|
@ -12,6 +12,7 @@ extern int palsharpness;
|
|||
extern int palcontrast;
|
||||
extern int palbrightness;
|
||||
extern bool paldeemphswap;
|
||||
HWND hWndPal = NULL;
|
||||
|
||||
bool SetPalette(const char* nameo)
|
||||
{
|
||||
|
@ -226,7 +227,7 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
case BUTTON_CLOSE:
|
||||
gornk:
|
||||
DestroyWindow(hwndDlg);
|
||||
pwindow = 0; // Yay for user race conditions.
|
||||
hWndPal = 0; // Yay for user race conditions.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -240,13 +241,9 @@ gornk:
|
|||
**/
|
||||
void ConfigPalette()
|
||||
{
|
||||
if(!pwindow)
|
||||
{
|
||||
pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB);
|
||||
}
|
||||
if(!hWndPal)
|
||||
hWndPal = CreateDialog(fceu_hInstance, "PALCONFIG", hAppWnd, PaletteConCallB);
|
||||
else
|
||||
{
|
||||
SetFocus(pwindow);
|
||||
}
|
||||
SetFocus(hWndPal);
|
||||
}
|
||||
|
||||
|
|
|
@ -1245,7 +1245,6 @@ LRESULT CustomDraw (LPARAM lParam)
|
|||
{
|
||||
case CDDS_PREPAINT :
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
int rv = CDRF_DODEFAULT;
|
||||
|
@ -1398,38 +1397,15 @@ static BOOL SelectingByKeyboard()
|
|||
|
||||
LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RECT r;
|
||||
RECT r2;
|
||||
int dx1, dy1, dx2, dy2;
|
||||
|
||||
static int watchIndex=0;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG: {
|
||||
RamSearchHWnd = hDlg;
|
||||
|
||||
GetWindowRect(hWnd, &r);
|
||||
dx1 = (r.right - r.left) / 2;
|
||||
dy1 = (r.bottom - r.top) / 2;
|
||||
CalcSubWindowPos(hDlg, NULL);
|
||||
|
||||
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)
|
||||
{
|
||||
case '<':
|
||||
|
|
|
@ -30,6 +30,7 @@ void DoRamSearchOperation(); //Perform a search
|
|||
|
||||
extern HWND RamSearchHWnd;
|
||||
extern LRESULT 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
|
||||
// by sorting in ram list doesn't help too much in usually use, so I gave it up.
|
||||
|
|
|
@ -235,7 +235,7 @@ void Update_RAM_Watch()
|
|||
}
|
||||
}
|
||||
|
||||
bool AskSave()
|
||||
bool AskSaveRamWatch()
|
||||
{
|
||||
//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
|
||||
|
@ -678,7 +678,7 @@ bool Load_Watches(bool clear)
|
|||
|
||||
bool ResetWatches()
|
||||
{
|
||||
if(!AskSave())
|
||||
if(!AskSaveRamWatch())
|
||||
return false;
|
||||
for (;WatchCount >= 0; WatchCount--)
|
||||
{
|
||||
|
@ -1039,47 +1039,16 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
|
||||
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))
|
||||
if (RWSaveWindowPos)
|
||||
{
|
||||
r.right += width;
|
||||
r.left += width;
|
||||
POINT pt = { ramw_x, ramw_y };
|
||||
pt = CalcSubWindowPos(hDlg, &pt);
|
||||
ramw_x = pt.x;
|
||||
ramw_y = pt.y;
|
||||
}
|
||||
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 ramwindow is for some reason completely off screen, use default instead
|
||||
if (ramw_x > (-width*2) || ramw_x < (width*2 + GetSystemMetrics(SM_CYSCREEN)) )
|
||||
r.left = ramw_x; //This also ignores cases of windows -32000 error codes
|
||||
//If ramwindow is for some reason completely off screen, use default instead
|
||||
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
|
||||
}
|
||||
//-------------------------------------------------------------------------------------
|
||||
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||
|
||||
else
|
||||
CalcSubWindowPos(hDlg, NULL);
|
||||
|
||||
ramwatchmenu=GetMenu(hDlg);
|
||||
rwrecentmenu=CreateMenu();
|
||||
UpdateRW_RMenu(rwrecentmenu, RAMMENU_FILE_RECENT, RW_MENU_FIRST_RECENT_FILE);
|
||||
|
|
|
@ -6,7 +6,7 @@ extern bool AutoRWLoad;
|
|||
extern bool RWSaveWindowPos;
|
||||
#define MAX_RECENT_WATCHES 5
|
||||
extern char rw_recent_files[MAX_RECENT_WATCHES][1024];
|
||||
extern bool AskSave();
|
||||
extern bool AskSaveRamWatch();
|
||||
extern int ramw_x;
|
||||
extern int ramw_y;
|
||||
extern bool RWfileChanged;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -299,11 +299,11 @@ BOOL CALLBACK newProjectProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM l
|
|||
break;
|
||||
case IDC_COPY_INPUT:
|
||||
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;
|
||||
case IDC_COPY_MARKERS:
|
||||
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;
|
||||
case IDOK:
|
||||
{
|
||||
|
@ -792,7 +792,7 @@ BOOL CALLBACK ExportProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lPara
|
|||
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;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
|
@ -808,7 +808,7 @@ BOOL CALLBACK ExportProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lPara
|
|||
break;
|
||||
case IDC_NOTES_TO_SUBTITLES:
|
||||
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;
|
||||
case IDOK:
|
||||
EndDialog(hwndDlg, 1);
|
||||
|
|
|
@ -630,7 +630,7 @@ BOOL CALLBACK findNoteWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
|
|||
if (taseditorConfig.findnoteWindowY == -32000) taseditorConfig.findnoteWindowY = 0;
|
||||
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)
|
||||
Button_SetCheck(GetDlgItem(hwndDlg, IDC_RADIO_UP), BST_CHECKED);
|
||||
else
|
||||
|
@ -680,7 +680,7 @@ BOOL CALLBACK findNoteWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
|
|||
break;
|
||||
case IDC_MATCH_CASE:
|
||||
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;
|
||||
case IDOK:
|
||||
{
|
||||
|
|
|
@ -1288,6 +1288,11 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), 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;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "memview.h"
|
||||
#include "tracer.h"
|
||||
#include "cdlogger.h"
|
||||
#include "header_editor.h"
|
||||
#include "throttle.h"
|
||||
#include "monitor.h"
|
||||
#include "keyboard.h"
|
||||
|
@ -100,7 +101,7 @@ using namespace std;
|
|||
|
||||
//Handles----------------------------------------------
|
||||
static HMENU fceumenu = 0; //Main menu.
|
||||
HWND pwindow; //Client Area
|
||||
// HWND pwindow; //Client Area
|
||||
HMENU recentmenu; //Recent Menu
|
||||
HMENU recentluamenu; //Recent Lua 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 ismaximized = 0;
|
||||
WNDPROC DefaultEditCtrlProc;
|
||||
|
||||
//Help Menu subtopics
|
||||
string moviehelp = "MovieRecording"; //Movie Recording
|
||||
|
@ -241,7 +243,7 @@ int GetCheckedAutoFirePattern()
|
|||
if (AFon == 4 && AFoff == 2) return MENU_AUTOFIRE_PATTERN_14;
|
||||
if (AFon == 5 && AFoff == 1) return MENU_AUTOFIRE_PATTERN_15;
|
||||
|
||||
return MENU_AUTOFIRE_PATTERN_1;
|
||||
return MENU_AUTOFIRE_PATTERN_1;
|
||||
}
|
||||
|
||||
int GetCheckedAutoFireOffset()
|
||||
|
@ -366,8 +368,9 @@ void CalcWindowSize(RECT *al)
|
|||
|
||||
/// 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).
|
||||
void updateGameDependentMenus(unsigned int enable)
|
||||
void updateGameDependentMenus()
|
||||
{
|
||||
// they are quite simple, enabled only when game is loaded
|
||||
const int menu_ids[]= {
|
||||
MENU_CLOSE_FILE,
|
||||
ID_FILE_SCREENSHOT,
|
||||
|
@ -395,10 +398,14 @@ void updateGameDependentMenus(unsigned int enable)
|
|||
ID_TOOLS_TEXTHOOKER
|
||||
};
|
||||
|
||||
bool enable = GameInfo != 0;
|
||||
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));
|
||||
}
|
||||
EnableMenuItem(fceumenu, menu_ids[i], MF_BYCOMMAND | enable ? MF_ENABLED : MF_GRAYED | MF_DISABLED);
|
||||
|
||||
// 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.
|
||||
|
@ -1058,8 +1065,8 @@ void CloseGame()
|
|||
{
|
||||
FCEUI_CloseGame();
|
||||
KillMemView();
|
||||
updateGameDependentMenus(GameInfo != 0);
|
||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
||||
updateGameDependentMenus();
|
||||
updateGameDependentMenusDebugger();
|
||||
SetMainWindowText();
|
||||
}
|
||||
}
|
||||
|
@ -1120,8 +1127,8 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
|
|||
SetMainWindowText();
|
||||
ParseGIInput(GameInfo);
|
||||
|
||||
updateGameDependentMenus(GameInfo != 0);
|
||||
updateGameDependentMenusDebugger(GameInfo != 0);
|
||||
updateGameDependentMenus();
|
||||
updateGameDependentMenusDebugger();
|
||||
EmulationPaused = oldPaused;
|
||||
return true;
|
||||
}
|
||||
|
@ -2312,7 +2319,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
case MENU_GAMEGENIEDECODER:
|
||||
DoGGConv();
|
||||
break;
|
||||
|
||||
case MENU_INESHEADEREDITOR:
|
||||
DoHeadEdit();
|
||||
break;
|
||||
//Help Menu--------------------------------------------------------------
|
||||
case MENU_HELP:
|
||||
OpenHelpWindow();
|
||||
|
@ -2679,8 +2688,8 @@ int CreateMainWindow()
|
|||
UpdateLuaRMenu(recentluamenu, recent_lua, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
||||
UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
|
||||
|
||||
updateGameDependentMenus(0);
|
||||
updateGameDependentMenusDebugger(0);
|
||||
updateGameDependentMenus();
|
||||
updateGameDependentMenusDebugger();
|
||||
if (MainWindow_wndx==-32000) MainWindow_wndx=0; //Just in case
|
||||
if (MainWindow_wndy==-32000) MainWindow_wndy=0;
|
||||
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_lua[];
|
||||
extern char *recent_movie[];
|
||||
extern HWND pwindow;
|
||||
// extern HWND pwindow;
|
||||
|
||||
HWND GetMainHWND();
|
||||
|
||||
|
@ -38,6 +38,7 @@ void SetMainWindowStuff();
|
|||
void GetMouseData(uint32 (&md)[3]);
|
||||
void GetMouseRelative(int32 (&md)[3]);
|
||||
//void ChangeMenuItemText(int menuitem, string text);
|
||||
POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||
|
||||
template<int BUFSIZE>
|
||||
inline std::string GetDlgItemText(HWND hDlg, int nIDDlgItem) {
|
||||
|
@ -126,4 +127,21 @@ struct HOTKEYMENUINDEX {
|
|||
|
||||
void UpdateMenuHotkeys(FCEUMENU_INDEX index);
|
||||
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
|
||||
|
|
152
src/fceu.cpp
152
src/fceu.cpp
|
@ -189,7 +189,12 @@ static void FCEU_CloseGame(void)
|
|||
}
|
||||
|
||||
if (GameInfo->type != GIT_NSF) {
|
||||
FCEU_FlushGameCheats(0, 0);
|
||||
if (disableAutoLSCheats == 2)
|
||||
FCEU_FlushGameCheats(0, 1);
|
||||
else if (disableAutoLSCheats == 1)
|
||||
AskSaveCheat();
|
||||
else if (disableAutoLSCheats == 0)
|
||||
FCEU_FlushGameCheats(0, 0);
|
||||
}
|
||||
|
||||
GameInterface(GI_CLOSE);
|
||||
|
@ -432,9 +437,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
|||
strcat(fullname, "|");
|
||||
strcat(fullname, fp->filename.c_str());
|
||||
} else
|
||||
{
|
||||
strcpy(fullname, name);
|
||||
}
|
||||
|
||||
// reset loaded game BEFORE it's loading.
|
||||
ResetGameLoaded();
|
||||
|
@ -469,103 +472,94 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
|||
|
||||
//try to load each different format
|
||||
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)
|
||||
FCEU_PrintError("An error occurred while loading the file.");
|
||||
FCEU_fclose(fp);
|
||||
|
||||
delete GameInfo;
|
||||
GameInfo = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
endlseq:
|
||||
|
||||
FCEU_fclose(fp);
|
||||
if (iNESLoad(fullname, fp, OverwriteVidMode) ||
|
||||
NSFLoad(fullname, fp) ||
|
||||
UNIFLoad(fullname, fp) ||
|
||||
FDSLoad(fullname, fp))
|
||||
{
|
||||
|
||||
#ifdef WIN32
|
||||
// ################################## Start of SP CODE ###########################
|
||||
extern char LoadedRomFName[2048];
|
||||
extern int loadDebugDataFailed;
|
||||
// ################################## Start of SP CODE ###########################
|
||||
extern char LoadedRomFName[2048];
|
||||
extern int loadDebugDataFailed;
|
||||
|
||||
if ((loadDebugDataFailed = loadPreferences(mass_replace(LoadedRomFName, "|", ".").c_str())))
|
||||
if (!silent)
|
||||
FCEU_printf("Couldn't load debugging data.\n");
|
||||
if ((loadDebugDataFailed = loadPreferences(mass_replace(LoadedRomFName, "|", ".").c_str())))
|
||||
if (!silent)
|
||||
FCEU_printf("Couldn't load debugging data.\n");
|
||||
|
||||
// ################################## End of SP CODE ###########################
|
||||
// ################################## End of SP CODE ###########################
|
||||
#endif
|
||||
|
||||
if (OverwriteVidMode)
|
||||
FCEU_ResetVidSys();
|
||||
if (OverwriteVidMode)
|
||||
FCEU_ResetVidSys();
|
||||
|
||||
if (GameInfo->type != GIT_NSF)
|
||||
{
|
||||
if (FSettings.GameGenie)
|
||||
if (GameInfo->type != GIT_NSF &&
|
||||
FSettings.GameGenie &&
|
||||
FCEU_OpenGenie())
|
||||
{
|
||||
if (FCEU_OpenGenie())
|
||||
{
|
||||
FCEUI_SetGameGenie(false);
|
||||
FCEUI_SetGameGenie(false);
|
||||
#ifdef WIN32
|
||||
genie = 0;
|
||||
genie = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
PowerNES();
|
||||
|
||||
if (GameInfo->type != GIT_NSF)
|
||||
FCEU_LoadGamePalette();
|
||||
PowerNES();
|
||||
|
||||
FCEU_ResetPalette();
|
||||
FCEU_ResetMessages(); // Save state, status messages, etc.
|
||||
if (GameInfo->type != GIT_NSF)
|
||||
FCEU_LoadGamePalette();
|
||||
|
||||
if (!lastpal && PAL) {
|
||||
FCEU_DispMessage("PAL mode set", 0);
|
||||
FCEUI_printf("PAL mode set");
|
||||
} else if (!lastdendy && dendy) {
|
||||
// this won't happen, since we don't autodetect dendy, but maybe someday we will?
|
||||
FCEU_DispMessage("Dendy mode set", 0);
|
||||
FCEUI_printf("Dendy mode set");
|
||||
} else if ((lastpal || lastdendy) && !(PAL || dendy)) {
|
||||
FCEU_DispMessage("NTSC mode set", 0);
|
||||
FCEUI_printf("NTSC mode set");
|
||||
}
|
||||
FCEU_ResetPalette();
|
||||
FCEU_ResetMessages(); // Save state, status messages, etc.
|
||||
|
||||
if (GameInfo->type != GIT_NSF)
|
||||
FCEU_LoadGameCheats(0);
|
||||
if (!lastpal && PAL) {
|
||||
FCEU_DispMessage("PAL mode set", 0);
|
||||
FCEUI_printf("PAL mode set");
|
||||
}
|
||||
else if (!lastdendy && dendy) {
|
||||
// this won't happen, since we don't autodetect dendy, but maybe someday we will?
|
||||
FCEU_DispMessage("Dendy mode set", 0);
|
||||
FCEUI_printf("Dendy mode set");
|
||||
}
|
||||
else if ((lastpal || lastdendy) && !(PAL || dendy)) {
|
||||
FCEU_DispMessage("NTSC mode set", 0);
|
||||
FCEUI_printf("NTSC mode set");
|
||||
}
|
||||
|
||||
if (AutoResumePlay)
|
||||
{
|
||||
// load "-resume" savestate
|
||||
if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str(), false))
|
||||
FCEU_DispMessage("Old play session resumed.", 0);
|
||||
}
|
||||
if (GameInfo->type != GIT_NSF && !disableAutoLSCheats)
|
||||
FCEU_LoadGameCheats(0);
|
||||
|
||||
ResetScreenshotsCounter();
|
||||
if (AutoResumePlay)
|
||||
{
|
||||
// load "-resume" savestate
|
||||
if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str(), false))
|
||||
FCEU_DispMessage("Old play session resumed.", 0);
|
||||
}
|
||||
|
||||
ResetScreenshotsCounter();
|
||||
|
||||
#if defined (WIN32) || defined (WIN64)
|
||||
DoDebuggerDataReload(); // Reloads data without reopening window
|
||||
CDLoggerROMChanged();
|
||||
if (hMemView) UpdateColorTable();
|
||||
if (hCheat)
|
||||
{
|
||||
UpdateCheatsAdded();
|
||||
UpdateCheatRelatedWindow();
|
||||
}
|
||||
if (FrozenAddressCount)
|
||||
FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount);
|
||||
DoDebuggerDataReload(); // Reloads data without reopening window
|
||||
CDLoggerROMChanged();
|
||||
if (hMemView) UpdateColorTable();
|
||||
if (hCheat)
|
||||
{
|
||||
UpdateCheatsAdded();
|
||||
UpdateCheatRelatedWindow();
|
||||
}
|
||||
if (FrozenAddressCount)
|
||||
FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (!silent)
|
||||
FCEU_PrintError("An error occurred while loading the file.");
|
||||
|
||||
delete GameInfo;
|
||||
GameInfo = 0;
|
||||
}
|
||||
|
||||
FCEU_fclose(fp);
|
||||
return GameInfo;
|
||||
}
|
||||
|
||||
|
@ -1377,7 +1371,7 @@ uint8 FCEU_ReadRomByte(uint32 i) {
|
|||
void FCEU_WriteRomByte(uint32 i, uint8 value) {
|
||||
if (i < 16)
|
||||
#ifdef WIN32
|
||||
MessageBox(hMemView,"Sorry", "You can't edit the ROM header.", MB_OK);
|
||||
MessageBox(hMemView, "Sorry", "You can't edit the ROM header.", MB_OK);
|
||||
#else
|
||||
printf("Sorry, you can't edit the ROM header.\n");
|
||||
#endif
|
||||
|
|
|
@ -261,9 +261,9 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
|
|||
FILE *ipsfile=0;
|
||||
FCEUFILE *fceufp=0;
|
||||
|
||||
bool read = (std::string)mode == "rb";
|
||||
bool write = (std::string)mode == "wb";
|
||||
if((read&&write) || (!read&&!write))
|
||||
bool read = !strcmp(mode, "rb");
|
||||
bool write = !strcmp(mode, "wb");
|
||||
if(read && write || !read && !write)
|
||||
{
|
||||
FCEU_PrintError("invalid file open mode specified (only wb and rb are supported)");
|
||||
return 0;
|
||||
|
|
16
src/ines.cpp
16
src/ines.cpp
|
@ -63,7 +63,7 @@ static int iNES_Init(int num);
|
|||
|
||||
static int MapperNo = 0;
|
||||
|
||||
static int iNES2 = 0;
|
||||
int iNES2 = 0;
|
||||
|
||||
static DECLFR(TrainerRead) {
|
||||
return(trainerpoo[A & 0x1FF]);
|
||||
|
@ -443,13 +443,8 @@ static int not_power2[] =
|
|||
{
|
||||
53, 198, 228
|
||||
};
|
||||
typedef struct {
|
||||
char *name;
|
||||
int32 number;
|
||||
void (*init)(CartInfo *);
|
||||
} BMAPPINGLocal;
|
||||
|
||||
static BMAPPINGLocal bmap[] = {
|
||||
BMAPPINGLocal bmap[] = {
|
||||
{"NROM", 0, NROM_Init},
|
||||
{"MMC1", 1, Mapper1_Init},
|
||||
{"UNROM", 2, UNROM_Init},
|
||||
|
@ -729,12 +724,9 @@ static BMAPPINGLocal bmap[] = {
|
|||
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
|
||||
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;
|
||||
|
||||
|
||||
head.cleanup();
|
||||
|
||||
memset(&iNESCart, 0, sizeof(iNESCart));
|
||||
|
|
49
src/ines.h
49
src/ines.h
|
@ -51,40 +51,34 @@ extern TMasterRomInfoParams MasterRomInfoParams;
|
|||
|
||||
//mbg merge 7/19/06 changed to c++ decl format
|
||||
struct iNES_HEADER {
|
||||
char ID[4]; /*NES^Z*/
|
||||
uint8 ROM_size;
|
||||
uint8 VROM_size;
|
||||
uint8 ROM_type;
|
||||
uint8 ROM_type2;
|
||||
uint8 ROM_type3;
|
||||
uint8 Upper_ROM_VROM_size;
|
||||
uint8 RAM_size;
|
||||
uint8 VRAM_size;
|
||||
uint8 TV_system;
|
||||
uint8 VS_hardware;
|
||||
uint8 reserved[2];
|
||||
char ID[4]; /*NES^Z*/ // 0-3
|
||||
uint8 ROM_size; // 4
|
||||
uint8 VROM_size; // 5
|
||||
uint8 ROM_type; // 6
|
||||
uint8 ROM_type2; // 7
|
||||
uint8 ROM_type3; // 8
|
||||
uint8 Upper_ROM_VROM_size; // 9
|
||||
uint8 RAM_size; // 10
|
||||
uint8 VRAM_size; // 11
|
||||
uint8 TV_system; // 12
|
||||
uint8 VS_hardware; // 13
|
||||
uint8 reserved[2]; // 14, 15
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
if(!memcmp((char *)(this)+0x7,"DiskDude",8))
|
||||
{
|
||||
memset((char *)(this)+0x7,0,0x9);
|
||||
}
|
||||
if(!memcmp((char*)(this) + 0x7, "DiskDude", 8) || !memcmp((char*)(this) + 0x7, "demiforce", 9))
|
||||
memset((char*)(this) + 0x7, 0, 0x9);
|
||||
|
||||
if(!memcmp((char *)(this)+0x7,"demiforce",9))
|
||||
if(!memcmp((char*)(this) + 0xA, "Ni03", 4))
|
||||
{
|
||||
memset((char *)(this)+0x7,0,0x9);
|
||||
}
|
||||
|
||||
if(!memcmp((char *)(this)+0xA,"Ni03",4))
|
||||
{
|
||||
if(!memcmp((char *)(this)+0x7,"Dis",3))
|
||||
memset((char *)(this)+0x7,0,0x9);
|
||||
if(!memcmp((char*)(this) + 0x7, "Dis", 3))
|
||||
memset((char*)(this) + 0x7, 0, 0x9);
|
||||
else
|
||||
memset((char *)(this)+0xA,0,0x6);
|
||||
memset((char*)(this) + 0xA, 0, 0x6);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
extern struct iNES_HEADER head; //for mappers usage
|
||||
|
||||
void NSFVRC6_Init(void);
|
||||
|
@ -274,4 +268,9 @@ void Mapper252_Init(CartInfo *);
|
|||
void Mapper253_Init(CartInfo *);
|
||||
void Mapper254_Init(CartInfo *);
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int32 number;
|
||||
void (*init)(CartInfo *);
|
||||
} BMAPPINGLocal;
|
||||
#endif
|
||||
|
|
|
@ -1117,8 +1117,8 @@ static void LaunchCodeDataLogger(void)
|
|||
static void LaunchCheats(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
extern HWND pwindow;
|
||||
ConfigCheats(pwindow);
|
||||
extern HWND hCheat;
|
||||
ConfigCheats(hCheat);
|
||||
#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
|
||||
#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?";
|
||||
extern HWND pwindow;
|
||||
int result = MessageBox(pwindow,msg.c_str(),"Error loading savestate",MB_OKCANCEL);
|
||||
int result = MessageBox(hAppWnd, msg.c_str(), "Error loading savestate", MB_OKCANCEL);
|
||||
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
|
||||
|
|
|
@ -557,6 +557,7 @@
|
|||
<ClCompile Include="..\src\drivers\win\directories.cpp" />
|
||||
<ClCompile Include="..\src\drivers\win\gui.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\input.cpp" />
|
||||
<ClCompile Include="..\src\drivers\win\joystick.cpp" />
|
||||
|
@ -1012,6 +1013,7 @@
|
|||
<ClInclude Include="..\src\drivers\win\directories.h" />
|
||||
<ClInclude Include="..\src\drivers\win\gui.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\input.h" />
|
||||
<ClInclude Include="..\src\drivers\win\joystick.h" />
|
||||
|
|
|
@ -1093,6 +1093,9 @@
|
|||
<ClCompile Include="..\src\boards\hp10xx_hp20xx.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\drivers\win\header_editor.cpp">
|
||||
<Filter>drivers\win</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\drivers\common\args.h">
|
||||
|
@ -1599,6 +1602,9 @@
|
|||
<ClInclude Include="..\src\input\fkb.h">
|
||||
<Filter>input</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\drivers\win\header_editor.h">
|
||||
<Filter>drivers\win</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\drivers\win\res.rc">
|
||||
|
|
Loading…
Reference in New Issue