1. Debugger no longer reloads itself to load new game .DEB data

2. Added checkbox for .DEB loading
3. Updated Symbolic Debugging info in help documents
4. Made bookmarks work (need to check the rest of the //MBG TODO items too)
This commit is contained in:
ugetab 2010-05-06 00:34:45 +00:00
parent 62628250b2
commit 05c76ec6c2
12 changed files with 106 additions and 47 deletions

View File

@ -657,11 +657,22 @@ void EditBreakList() {
void FillBreakList(HWND hwndDlg) {
int i;
for (i = 0; i < numWPs; i++) {
SendDlgItemMessage(hDebug,IDC_DEBUGGER_BP_LIST,LB_DELETESTRING,i,0);
}
for (i = 0; i < numWPs; i++) {
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BP_LIST,LB_INSERTSTRING,-1,(LPARAM)(LPSTR)BreakToText(i));
}
}
void ClearBreakList(HWND hwndDlg) {
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BP_LIST,LB_RESETCONTENT,0,0);
numWPs = 0;
}
void EnableBreak(int sel) {
watchpoint[sel].flags^=WP_E;
SendDlgItemMessage(hDebug,IDC_DEBUGGER_BP_LIST,LB_DELETESTRING,sel,0);
@ -945,6 +956,46 @@ BOOL CALLBACK DebuggerEnumWindowsProc(HWND hwnd, LPARAM lParam)
return TRUE;
}
void LoadGameDebuggerData(HWND hwndDlg = hDebug) {
extern int loadDebugDataFailed;
if (!hwndDlg)
return;
if (!loadDebugDataFailed)
{
ClearDebuggerBookmarkListbox(hwndDlg);
if (bookmarks)
{
unsigned int i;
for (i=0;i<bookmarks;i++)
{
char buffer[5];
sprintf(buffer, "%X", bookmarkData[i]);
AddDebuggerBookmark2(hwndDlg, buffer);
}
}
if (symbDebugEnabled)
{
CheckDlgButton(hwndDlg, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED);
}
ClearBreakList(hwndDlg);
numWPs = myNumWPs;
}
else
{
bookmarks = 0;
}
FillBreakList(hwndDlg);
}
BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
RECT wrect;
char str[256]={0},*ptr,dotdot[4];
@ -956,8 +1007,8 @@ 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, DEBUGLOADDEB, debuggerSaveLoadDEBFiles ? MF_CHECKED : MF_UNCHECKED);
CheckDlgButton(hwndDlg, DEBUGAUTOLOAD, debuggerAutoload ? MF_CHECKED : MF_UNCHECKED);
extern int loadDebugDataFailed;
if (DbgPosX==-32000) DbgPosX=0; //Just in case
if (DbgPosY==-32000) DbgPosY=0;
SetWindowPos(hwndDlg,0,DbgPosX,DbgPosY,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
@ -1000,33 +1051,9 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// ################################## Start of SP CODE ###########################
SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BOOKMARK,EM_SETLIMITTEXT,4,0);
if (!loadDebugDataFailed)
{
if (bookmarks)
{
unsigned int i;
for (i=0;i<bookmarks;i++)
{
char buffer[5];
sprintf(buffer, "%X", bookmarkData[i]);
AddDebuggerBookmark2(hwndDlg, buffer);
}
}
if (symbDebugEnabled)
{
CheckDlgButton(hwndDlg, IDC_DEBUGGER_ENABLE_SYMBOLIC, BST_CHECKED);
}
numWPs = myNumWPs;
}
else
{
bookmarks = 0;
}
LoadGameDebuggerData(hwndDlg);
debuggerWasActive = 1;
// ################################## End of SP CODE ###########################
@ -1034,7 +1061,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
FCEUI_Debugger().badopbreak = false;
debugger_open = 1;
inDebugger = true;
FillBreakList(hwndDlg);
break;
}
@ -1099,6 +1125,10 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case DEBUGAUTOLOAD:
debuggerAutoload ^= 1;
break;
case DEBUGLOADDEB:
debuggerSaveLoadDEBFiles = !debuggerSaveLoadDEBFiles;
break;
}
}
@ -1472,6 +1502,15 @@ void UpdatePatcher(HWND hwndDlg){
else EnableWindow(GetDlgItem(hwndDlg,IDC_ROMPATCHER_BTN_SAVE),TRUE);
}
/// 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) {
if (!hDebug)
return;
EnableWindow(GetDlgItem(hDebug,DEBUGLOADDEB),(enable ? 0 : 1));
}
void DoDebug(uint8 halt) {
if (!debugger_open) {
hDebug = CreateDialog(fceu_hInstance,"DEBUGGER",NULL,DebuggerCallB);
@ -1480,6 +1519,9 @@ void DoDebug(uint8 halt) {
}
if (hDebug) {
SetWindowPos(hDebug,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER);
updateGameDependentMenusDebugger(GameInfo != 0);
if (GameInfo) UpdateDebugger();
}
}

View File

@ -32,6 +32,9 @@ void UpdateDebugger();
void DoDebug(uint8 halt);
void DebuggerExit();
void LoadGameDebuggerData(HWND hwndDlg);
void updateGameDependentMenusDebugger(unsigned int enable);
extern bool inDebugger;
extern class DebugSystem {

View File

@ -772,6 +772,17 @@ void DeleteDebuggerBookmark(HWND hwnd)
}
}
/**
* Removes all debugger bookmarks
*
* @param hwnd HWND of the debugger window
**/
void ClearDebuggerBookmarkListbox(HWND hwnd)
{
SendDlgItemMessage(hwnd, LIST_DEBUGGER_BOOKMARKS, LB_RESETCONTENT, 0, 0);
//dumpBookmarks(hwnd);
}
void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr);
/**
@ -789,6 +800,5 @@ void GoToDebuggerBookmark(HWND hwnd)
n = getBookmarkAddress(hwnd, selectedItem);
//Disassemble(hwnd, 300, 301, n);
//MBG TODO
Disassemble(hwnd, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, n);
}

View File

@ -41,6 +41,8 @@ void replaceNames(Name* list, char* str);
void AddDebuggerBookmark(HWND hwnd);
void AddDebuggerBookmark2(HWND hwnd, char* buffer);
void DeleteDebuggerBookmark(HWND hwnd);
void ClearDebuggerBookmarkListbox(HWND hwnd);
void GoToDebuggerBookmark(HWND hwnd);
void dumpBookmarks(HWND hwmd);
int isHex(char c);

View File

@ -29,7 +29,6 @@
#include "../../debug.h"
extern char symbDebugEnabled;
bool wasinDebugger = false;
/**
* Stores debugger preferences in a file
@ -134,11 +133,6 @@ int storePreferences(char* romname)
char* filename;
int result;
int Counter = 0;
// Prevent any attempts at file usage if the debugger is open
//if (inDebugger) return 0;
wasinDebugger = inDebugger;
// Prevent any attempts at file usage if the debugger is open
// Moved debugger exit code due to complaints and the Debugger menu option being enabled
@ -182,16 +176,20 @@ int storePreferences(char* romname)
return result;
}
void DoDebuggerRunCheck()
void DoDebuggerDataReload()
{
if (debuggerSaveLoadDEBFiles == false) {
return;
}
extern HWND hDebug;
LoadGameDebuggerData(hDebug);
// if (wasinDebugger){
// DebuggerExit();
// DoDebug(0);
// }
if (wasinDebugger){
DebuggerExit();
DoDebug(0);
}
}
int myNumWPs = 0;
@ -231,9 +229,9 @@ int loadDebuggerPreferences(FILE* f)
// conditional text loading when reusing a used condText.
for (i=0;i<65;i++)
{
watchpoint[i].cond = NULL;
watchpoint[i].condText = NULL;
watchpoint[i].desc = NULL;
watchpoint[i].cond = 0;
watchpoint[i].condText = 0;
watchpoint[i].desc = 0;
}
// Read the breakpoints

View File

@ -25,4 +25,4 @@ extern bool inDebugger;
int storePreferences(char* romname);
int loadPreferences(char* romname);
void DoDebuggerRunCheck();
void DoDebuggerDataReload();

View File

@ -1038,6 +1038,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 "Load .DEB",DEBUGLOADDEB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,495,297,46,10
CONTROL "Auto-load",DEBUGAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,495,308,46,10
END

View File

@ -470,6 +470,7 @@
#define IDC_LUACONSOLE_CHOOSEFONT 1255
#define IDC_EDIT_LUAARGS 1256
#define CB_PARTIALVISUALTHEME 1257
#define DEBUGLOADDEB 1258
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042

View File

@ -1005,6 +1005,7 @@ void CloseGame()
FCEUI_CloseGame();
KillMemView();
updateGameDependentMenus(GameInfo != 0);
updateGameDependentMenusDebugger(GameInfo != 0);
SetWindowText(hAppWnd, FCEU_NAME_AND_VERSION);
}
}
@ -1067,6 +1068,7 @@ bool ALoad(char *nameo, char* innerFilename)
ParseGIInput(GameInfo);
updateGameDependentMenus(GameInfo != 0);
updateGameDependentMenusDebugger(GameInfo != 0);
return true;
}
@ -2272,6 +2274,7 @@ int CreateMainWindow()
UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
updateGameDependentMenus(0);
updateGameDependentMenusDebugger(0);
if (MainWindow_wndx==-32000) MainWindow_wndx=0; //Just in case
if (MainWindow_wndy==-32000) MainWindow_wndy=0;
hAppWnd = CreateWindowEx(

View File

@ -34,7 +34,6 @@ void UpdateCheckedMenuItems();
bool ALoad(char* nameo, char* innerFilename=0);
void LoadNewGamey(HWND hParent, const char *initialdir);
int BrowseForFolder(HWND hParent, const char *htext, char *buf);
void UpdateCheckedMenuItems();
void SetMainWindowStuff();
void GetMouseData(uint32 (&md)[3]);
//void ChangeMenuItemText(int menuitem, string text);

View File

@ -485,7 +485,7 @@ endlseq:
FCEU_LoadGameCheats(0);
#if defined (WIN32) || defined (WIN64)
DoDebuggerRunCheck(); //Can't safely do it in loadPreferences
DoDebuggerDataReload(); // Reloads data without reopening window
#endif
return GameInfo;

Binary file not shown.