support more versatility in debugger symbolic name page sizes (not completely debugged yet) as well as hex editor fonts
This commit is contained in:
parent
3334d90235
commit
71718de666
|
@ -280,7 +280,9 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
AC(debuggerDisplayROMoffsets),
|
AC(debuggerDisplayROMoffsets),
|
||||||
AC(debuggerFontSize),
|
AC(debuggerFontSize),
|
||||||
AC(debuggerPageSize),
|
AC(debuggerPageSize),
|
||||||
AC(hexeditorFontSize),
|
AC(hexeditorFontWidth),
|
||||||
|
AC(hexeditorFontHeight),
|
||||||
|
ACS(hexeditorFontName),
|
||||||
AC(fullSaveStateLoads),
|
AC(fullSaveStateLoads),
|
||||||
AC(frameSkipAmt),
|
AC(frameSkipAmt),
|
||||||
AC(fps_scale_frameadvance),
|
AC(fps_scale_frameadvance),
|
||||||
|
|
|
@ -41,12 +41,10 @@
|
||||||
|
|
||||||
#include "debuggersp.h"
|
#include "debuggersp.h"
|
||||||
|
|
||||||
extern Name* lastBankNames;
|
extern Name* pageNames[32];
|
||||||
extern Name* loadedBankNames;
|
|
||||||
extern Name* ramBankNames;
|
extern Name* ramBankNames;
|
||||||
extern bool ramBankNamesLoaded;
|
extern bool ramBankNamesLoaded;
|
||||||
extern int lastBank;
|
extern int pageNumbersLoaded[32];
|
||||||
extern int loadedBank;
|
|
||||||
extern int myNumWPs;
|
extern int myNumWPs;
|
||||||
|
|
||||||
// ################################## End of SP CODE ###########################
|
// ################################## End of SP CODE ###########################
|
||||||
|
@ -525,8 +523,9 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
|
||||||
if (symbDebugEnabled)
|
if (symbDebugEnabled)
|
||||||
{
|
{
|
||||||
replaceNames(ramBankNames, a, &disassembly_operands[i]);
|
replaceNames(ramBankNames, a, &disassembly_operands[i]);
|
||||||
replaceNames(loadedBankNames, a, &disassembly_operands[i]);
|
for(int p=0;p<ARRAY_SIZE(pageNames);p++)
|
||||||
replaceNames(lastBankNames, a, &disassembly_operands[i]);
|
if(pageNames[p] != NULL)
|
||||||
|
replaceNames(pageNames[p], a, &disassembly_operands[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case: an RTS opcode
|
// special case: an RTS opcode
|
||||||
|
@ -2152,7 +2151,8 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
case IDC_DEBUGGER_RELOAD_SYMS:
|
case IDC_DEBUGGER_RELOAD_SYMS:
|
||||||
{
|
{
|
||||||
ramBankNamesLoaded = false;
|
ramBankNamesLoaded = false;
|
||||||
lastBank = loadedBank = -1;
|
for(int i=0;i<ARRAYSIZE(pageNumbersLoaded);i++)
|
||||||
|
pageNumbersLoaded[i] = -1;
|
||||||
loadNameFiles();
|
loadNameFiles();
|
||||||
UpdateDebugger(false);
|
UpdateDebugger(false);
|
||||||
break;
|
break;
|
||||||
|
@ -2307,7 +2307,9 @@ void DoDebug(uint8 halt)
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
DebugSystem* debugSystem;
|
DebugSystem* debugSystem;
|
||||||
unsigned int debuggerFontSize = 15;
|
unsigned int debuggerFontSize = 15;
|
||||||
unsigned int hexeditorFontSize = 15;
|
unsigned int hexeditorFontHeight = 15;
|
||||||
|
unsigned int hexeditorFontWidth = 7;
|
||||||
|
char* hexeditorFontName = 0;
|
||||||
|
|
||||||
DebugSystem::DebugSystem()
|
DebugSystem::DebugSystem()
|
||||||
{
|
{
|
||||||
|
@ -2322,12 +2324,18 @@ void DebugSystem::init()
|
||||||
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
|
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
|
||||||
"Courier New"); /*font name*/
|
"Courier New"); /*font name*/
|
||||||
|
|
||||||
hHexeditorFont = CreateFont(hexeditorFontSize, hexeditorFontSize / 2, /*Height,Width*/
|
//if the user provided his own courier font, use that
|
||||||
|
AddFontResourceEx("coure.fon", FR_PRIVATE, NULL);
|
||||||
|
|
||||||
|
char* hexfn = hexeditorFontName;
|
||||||
|
if(!hexfn) hexfn = "Courier";
|
||||||
|
|
||||||
|
hHexeditorFont = CreateFont(hexeditorFontHeight, hexeditorFontWidth, /*Height,Width*/
|
||||||
0,0, /*escapement,orientation*/
|
0,0, /*escapement,orientation*/
|
||||||
FW_REGULAR,FALSE,FALSE,FALSE, /*weight, italic, underline, strikeout*/
|
FW_REGULAR,FALSE,FALSE,FALSE, /*weight, italic, underline, strikeout*/
|
||||||
ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_MASK, /*charset, precision, clipping*/
|
ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_MASK, /*charset, precision, clipping*/
|
||||||
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
|
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
|
||||||
"Courier"); /*font name*/
|
hexeditorFontName); /*font name*/
|
||||||
|
|
||||||
HDC hdc = GetDC(GetDesktopWindow());
|
HDC hdc = GetDC(GetDesktopWindow());
|
||||||
HGDIOBJ old = SelectObject(hdc,hFixedFont);
|
HGDIOBJ old = SelectObject(hdc,hFixedFont);
|
||||||
|
|
|
@ -24,7 +24,9 @@ extern bool debuggerDisplayROMoffsets;
|
||||||
|
|
||||||
extern unsigned int debuggerPageSize;
|
extern unsigned int debuggerPageSize;
|
||||||
extern unsigned int debuggerFontSize;
|
extern unsigned int debuggerFontSize;
|
||||||
extern unsigned int hexeditorFontSize;
|
extern unsigned int hexeditorFontWidth;
|
||||||
|
extern unsigned int hexeditorFontHeight;
|
||||||
|
extern char* hexeditorFontName;
|
||||||
|
|
||||||
void CenterWindow(HWND hwndDlg);
|
void CenterWindow(HWND hwndDlg);
|
||||||
void DoPatcher(int address,HWND hParent);
|
void DoPatcher(int address,HWND hParent);
|
||||||
|
|
|
@ -32,12 +32,25 @@
|
||||||
|
|
||||||
int GetNesFileAddress(int A);
|
int GetNesFileAddress(int A);
|
||||||
|
|
||||||
Name* lastBankNames = 0;
|
inline int PageIndexForAddress(int addr) { return addr>>(9+debuggerPageSize); }
|
||||||
Name* loadedBankNames = 0;
|
|
||||||
|
//old
|
||||||
|
//Name* lastBankNames = 0;
|
||||||
|
//Name* loadedBankNames = 0;
|
||||||
|
|
||||||
|
//new
|
||||||
|
Name* pageNames[32] = {0}; //the maximum number of pages we could have is 32, based on 1KB debuggerPageSize
|
||||||
|
|
||||||
|
//old
|
||||||
|
//int lastBank = -1;
|
||||||
|
//int loadedBank = -1;
|
||||||
|
|
||||||
|
//new
|
||||||
|
int pageNumbersLoaded[32]; //TODO - need to initialize these to -1 somehow
|
||||||
|
|
||||||
Name* ramBankNames = 0;
|
Name* ramBankNames = 0;
|
||||||
bool ramBankNamesLoaded = false;
|
bool ramBankNamesLoaded = false;
|
||||||
int lastBank = -1;
|
|
||||||
int loadedBank = -1;
|
|
||||||
extern char LoadedRomFName[2048];
|
extern char LoadedRomFName[2048];
|
||||||
char NLfilename[2048];
|
char NLfilename[2048];
|
||||||
bool symbDebugEnabled = true;
|
bool symbDebugEnabled = true;
|
||||||
|
@ -547,29 +560,24 @@ char* generateNLFilenameForAddress(uint16 address)
|
||||||
}
|
}
|
||||||
Name* getNamesPointerForAddress(uint16 address)
|
Name* getNamesPointerForAddress(uint16 address)
|
||||||
{
|
{
|
||||||
// this function is called very often (when using "Symbolic trace"), so this is sorted by frequency
|
if(address >= 0x8000)
|
||||||
if (address >= 0xC000)
|
|
||||||
{
|
{
|
||||||
return lastBankNames;
|
return pageNames[PageIndexForAddress(address)];
|
||||||
} else if (address >= 0x8000)
|
}
|
||||||
{
|
else
|
||||||
return loadedBankNames;
|
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
return ramBankNames;
|
return ramBankNames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setNamesPointerForAddress(uint16 address, Name* newNode)
|
void setNamesPointerForAddress(uint16 address, Name* newNode)
|
||||||
{
|
{
|
||||||
if (address < 0x8000)
|
if (address >= 0x8000)
|
||||||
|
{
|
||||||
|
pageNames[PageIndexForAddress(address)] = newNode;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ramBankNames = newNode;
|
ramBankNames = newNode;
|
||||||
} else if (address < 0xC000)
|
|
||||||
{
|
|
||||||
loadedBankNames = newNode;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
lastBankNames = newNode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,44 +600,32 @@ void loadNameFiles()
|
||||||
ramBankNames = parseNameFile(generateNLFilenameForAddress(0x0000));
|
ramBankNames = parseNameFile(generateNLFilenameForAddress(0x0000));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find out which bank is loaded at 0xC000
|
int nPages = 1<<(15-debuggerPageSize);
|
||||||
cb = getBank(0xC000);
|
|
||||||
if (cb == -1) // No bank was loaded at that offset
|
|
||||||
{
|
|
||||||
free(lastBankNames);
|
|
||||||
lastBankNames = 0;
|
|
||||||
} else if (cb != lastBank)
|
|
||||||
{
|
|
||||||
// If the bank changed since loading the NL files the last time it's necessary
|
|
||||||
// to load the address descriptions of the new bank.
|
|
||||||
lastBank = cb;
|
|
||||||
|
|
||||||
if (lastBankNames)
|
for(int i=0;i<nPages;i++)
|
||||||
freeList(lastBankNames);
|
{
|
||||||
|
int pageIndexAddress = 0x8000 + (1<<debuggerPageSize)*i;
|
||||||
|
|
||||||
// Load new address definitions
|
// Find out which bank is loaded at the page index
|
||||||
lastBankNames = parseNameFile(generateNLFilenameForAddress(0xC000));
|
cb = getBank(pageIndexAddress);
|
||||||
}
|
if (cb == -1) // No bank was loaded at that offset
|
||||||
|
{
|
||||||
// Find out which bank is loaded at 0x8000
|
free(pageNames[i]);
|
||||||
cb = getBank(0x8000);
|
pageNames[i] = 0;
|
||||||
if (cb == -1) // No bank is loaded at that offset
|
}
|
||||||
{
|
else if (cb != pageNumbersLoaded[i])
|
||||||
free(loadedBankNames);
|
{
|
||||||
loadedBankNames = 0;
|
// If the bank changed since loading the NL files the last time it's necessary
|
||||||
} else if (cb != loadedBank)
|
// to load the address descriptions of the new bank.
|
||||||
{
|
pageNumbersLoaded[i] = cb;
|
||||||
// If the bank changed since loading the NL files the last time it's necessary
|
|
||||||
// to load the address descriptions of the new bank.
|
if (pageNames[i])
|
||||||
|
freeList(pageNames[i]);
|
||||||
loadedBank = cb;
|
|
||||||
|
// Load new address definitions
|
||||||
if (loadedBankNames)
|
pageNames[i] = parseNameFile(generateNLFilenameForAddress(pageIndexAddress));
|
||||||
freeList(loadedBankNames);
|
}
|
||||||
|
} //loop across pages
|
||||||
// Load new address definitions
|
|
||||||
loadedBankNames = parseNameFile(generateNLFilenameForAddress(0x8000));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bookmarks
|
// bookmarks
|
||||||
|
|
|
@ -48,8 +48,8 @@ using namespace std;
|
||||||
|
|
||||||
#include "debuggersp.h"
|
#include "debuggersp.h"
|
||||||
|
|
||||||
extern Name* lastBankNames;
|
extern Name* pageNames[32];
|
||||||
extern Name* loadedBankNames;
|
extern int pageNumbersLoaded[32];
|
||||||
extern Name* ramBankNames;
|
extern Name* ramBankNames;
|
||||||
|
|
||||||
// ################################## End of SP CODE ###########################
|
// ################################## End of SP CODE ###########################
|
||||||
|
@ -840,8 +840,8 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceNames(ramBankNames, a, &tempAddressesLog);
|
replaceNames(ramBankNames, a, &tempAddressesLog);
|
||||||
replaceNames(loadedBankNames, a, &tempAddressesLog);
|
for(int i=0;i<ARRAY_SIZE(pageNames);i++)
|
||||||
replaceNames(lastBankNames, a, &tempAddressesLog);
|
replaceNames(pageNames[i], a, &tempAddressesLog);
|
||||||
}
|
}
|
||||||
strncpy(str_disassembly, a, LOG_DISASSEMBLY_MAX_LEN);
|
strncpy(str_disassembly, a, LOG_DISASSEMBLY_MAX_LEN);
|
||||||
str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
|
str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
|
||||||
|
|
Loading…
Reference in New Issue