From 2cf4d23994e7b863690287f2315b807e93ec72f1 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 5 Nov 2009 04:36:46 +0000 Subject: [PATCH] win32 - debugger - added an auto-load feature --- changelog.txt | 2 +- src/drivers/win/config.cpp | 3 ++- src/drivers/win/debugger.cpp | 16 ++++++++++++++-- src/drivers/win/debugger.h | 1 + src/drivers/win/res.rc | 1 + src/drivers/win/resource.h | 1 + src/drivers/win/window.cpp | 6 +++++- 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 391d95ed..7e97b8ac 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,4 @@ - +04-nov-2009 - adelikat - win32 - debugger - added an auto-load feature ---r1527 - FCEUX 2.1.2 Released--- ---November 3, 2009--- diff --git a/src/drivers/win/config.cpp b/src/drivers/win/config.cpp index f14c96d1..247f3406 100644 --- a/src/drivers/win/config.cpp +++ b/src/drivers/win/config.cpp @@ -37,6 +37,7 @@ #include "texthook.h" #include "movieoptions.h" #include "ramwatch.h" +#include "debugger.h" extern CFGSTRUCT NetplayConfig[]; extern CFGSTRUCT InputConfig[]; @@ -219,7 +220,7 @@ static CFGSTRUCT fceuconfig[] = { AC(BindToMain), AC(EnableAutosave), AC(frameAdvanceLagSkip), - + AC(debuggerAutoload), AC(allowUDLR), //window positions diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index 53980ef0..e4b71ee7 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -65,6 +65,8 @@ HWND hDebug; static HFONT hFont; static SCROLLINFO si; +bool debuggerAutoload = false; + #define INVALID_START_OFFSET 1 #define INVALID_END_OFFSET 2 @@ -953,6 +955,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara //these messages get handled at any time switch(uMsg) { case WM_INITDIALOG: { + CheckDlgButton(hwndDlg, DEBUGAUTOLOAD, debuggerAutoload ? MF_CHECKED : MF_UNCHECKED); extern int loadDebugDataFailed; if (DbgPosX==-32000) DbgPosX=0; //Just in case if (DbgPosY==-32000) DbgPosY=0; @@ -1081,6 +1084,15 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara DbgPosX = wrect.left; DbgPosY = wrect.top; break; + + //adelikat: Buttons that don't need a rom loaded to do something, such as autoload + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case DEBUGAUTOLOAD: + debuggerAutoload ^= 1; + break; + } } //these messages only get handled when a game is loaded @@ -1405,8 +1417,8 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara break; } } - - + + return FALSE; //TRUE; } diff --git a/src/drivers/win/debugger.h b/src/drivers/win/debugger.h index f1c1e045..d558de1a 100644 --- a/src/drivers/win/debugger.h +++ b/src/drivers/win/debugger.h @@ -18,6 +18,7 @@ extern int scanline; //current scanline! :D extern HWND hDebug; extern int childwnd,numWPs; //mbg merge 7/18/06 had to make extern +extern bool debuggerAutoload; void CenterWindow(HWND hwndDlg); void DoPatcher(int address,HWND hParent); diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index c3c16006..a481ba48 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -1021,6 +1021,7 @@ BEGIN PUSHBUTTON "Run Line",IDC_DEBUGGER_RUN_LINE,349,39,37,14 PUSHBUTTON "128 Lines",IDC_DEBUGGER_RUN_FRAME2,389,39,37,14 LTEXT "Scanline: PPU Pixel:",IDC_STATIC,436,191,78,8 + CONTROL "Auto-load",DEBUGAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,495,308,46,10 END TRACER DIALOGEX 65527, 65513, 398, 319 diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index ab1ecaea..eb701253 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -413,6 +413,7 @@ #define ID_SOUND_QUALITYNOTIFY 1202 #define IDC_CHECK1 1203 #define CB_ENABLECONTEXTMENU 1203 +#define DEBUGAUTOLOAD 1203 #define IDC_VOLUMEGROUP 1204 #define IDC_RAMLIST 1205 #define IDC_C_SEARCH 1206 diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 6ed5648d..21877f96 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -1044,9 +1044,13 @@ bool ALoad(char *nameo, char* innerFilename) if (AutoRWLoad) { - if (AutoRWLoad) OpenRWRecentFile(0); //adelikat: TODO: This command should be called internally from the RamWatch dialog in order for it to be more portable + OpenRWRecentFile(0); //adelikat: TODO: This command should be called internally from the RamWatch dialog in order for it to be more portable OpenRamWatch(); } + if (debuggerAutoload) + { + DoDebug(0); + } } else {