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(debuggerFontSize),
|
||||
AC(debuggerPageSize),
|
||||
AC(hexeditorFontSize),
|
||||
AC(hexeditorFontWidth),
|
||||
AC(hexeditorFontHeight),
|
||||
ACS(hexeditorFontName),
|
||||
AC(fullSaveStateLoads),
|
||||
AC(frameSkipAmt),
|
||||
AC(fps_scale_frameadvance),
|
||||
|
|
|
@ -41,12 +41,10 @@
|
|||
|
||||
#include "debuggersp.h"
|
||||
|
||||
extern Name* lastBankNames;
|
||||
extern Name* loadedBankNames;
|
||||
extern Name* pageNames[32];
|
||||
extern Name* ramBankNames;
|
||||
extern bool ramBankNamesLoaded;
|
||||
extern int lastBank;
|
||||
extern int loadedBank;
|
||||
extern int pageNumbersLoaded[32];
|
||||
extern int myNumWPs;
|
||||
|
||||
// ################################## End of SP CODE ###########################
|
||||
|
@ -525,8 +523,9 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
|
|||
if (symbDebugEnabled)
|
||||
{
|
||||
replaceNames(ramBankNames, a, &disassembly_operands[i]);
|
||||
replaceNames(loadedBankNames, a, &disassembly_operands[i]);
|
||||
replaceNames(lastBankNames, a, &disassembly_operands[i]);
|
||||
for(int p=0;p<ARRAY_SIZE(pageNames);p++)
|
||||
if(pageNames[p] != NULL)
|
||||
replaceNames(pageNames[p], a, &disassembly_operands[i]);
|
||||
}
|
||||
|
||||
// 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:
|
||||
{
|
||||
ramBankNamesLoaded = false;
|
||||
lastBank = loadedBank = -1;
|
||||
for(int i=0;i<ARRAYSIZE(pageNumbersLoaded);i++)
|
||||
pageNumbersLoaded[i] = -1;
|
||||
loadNameFiles();
|
||||
UpdateDebugger(false);
|
||||
break;
|
||||
|
@ -2307,7 +2307,9 @@ void DoDebug(uint8 halt)
|
|||
//-----------------------------------------
|
||||
DebugSystem* debugSystem;
|
||||
unsigned int debuggerFontSize = 15;
|
||||
unsigned int hexeditorFontSize = 15;
|
||||
unsigned int hexeditorFontHeight = 15;
|
||||
unsigned int hexeditorFontWidth = 7;
|
||||
char* hexeditorFontName = 0;
|
||||
|
||||
DebugSystem::DebugSystem()
|
||||
{
|
||||
|
@ -2322,12 +2324,18 @@ void DebugSystem::init()
|
|||
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
|
||||
"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*/
|
||||
FW_REGULAR,FALSE,FALSE,FALSE, /*weight, italic, underline, strikeout*/
|
||||
ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_MASK, /*charset, precision, clipping*/
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
|
||||
"Courier"); /*font name*/
|
||||
hexeditorFontName); /*font name*/
|
||||
|
||||
HDC hdc = GetDC(GetDesktopWindow());
|
||||
HGDIOBJ old = SelectObject(hdc,hFixedFont);
|
||||
|
|
|
@ -24,7 +24,9 @@ extern bool debuggerDisplayROMoffsets;
|
|||
|
||||
extern unsigned int debuggerPageSize;
|
||||
extern unsigned int debuggerFontSize;
|
||||
extern unsigned int hexeditorFontSize;
|
||||
extern unsigned int hexeditorFontWidth;
|
||||
extern unsigned int hexeditorFontHeight;
|
||||
extern char* hexeditorFontName;
|
||||
|
||||
void CenterWindow(HWND hwndDlg);
|
||||
void DoPatcher(int address,HWND hParent);
|
||||
|
|
|
@ -32,12 +32,25 @@
|
|||
|
||||
int GetNesFileAddress(int A);
|
||||
|
||||
Name* lastBankNames = 0;
|
||||
Name* loadedBankNames = 0;
|
||||
inline int PageIndexForAddress(int addr) { return addr>>(9+debuggerPageSize); }
|
||||
|
||||
//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;
|
||||
bool ramBankNamesLoaded = false;
|
||||
int lastBank = -1;
|
||||
int loadedBank = -1;
|
||||
|
||||
extern char LoadedRomFName[2048];
|
||||
char NLfilename[2048];
|
||||
bool symbDebugEnabled = true;
|
||||
|
@ -547,29 +560,24 @@ char* generateNLFilenameForAddress(uint16 address)
|
|||
}
|
||||
Name* getNamesPointerForAddress(uint16 address)
|
||||
{
|
||||
// this function is called very often (when using "Symbolic trace"), so this is sorted by frequency
|
||||
if (address >= 0xC000)
|
||||
if(address >= 0x8000)
|
||||
{
|
||||
return lastBankNames;
|
||||
} else if (address >= 0x8000)
|
||||
{
|
||||
return loadedBankNames;
|
||||
} else
|
||||
return pageNames[PageIndexForAddress(address)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return ramBankNames;
|
||||
}
|
||||
}
|
||||
void setNamesPointerForAddress(uint16 address, Name* newNode)
|
||||
{
|
||||
if (address < 0x8000)
|
||||
if (address >= 0x8000)
|
||||
{
|
||||
pageNames[PageIndexForAddress(address)] = newNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
ramBankNames = newNode;
|
||||
} else if (address < 0xC000)
|
||||
{
|
||||
loadedBankNames = newNode;
|
||||
} else
|
||||
{
|
||||
lastBankNames = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,44 +600,32 @@ void loadNameFiles()
|
|||
ramBankNames = parseNameFile(generateNLFilenameForAddress(0x0000));
|
||||
}
|
||||
|
||||
// Find out which bank is loaded at 0xC000
|
||||
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;
|
||||
int nPages = 1<<(15-debuggerPageSize);
|
||||
|
||||
if (lastBankNames)
|
||||
freeList(lastBankNames);
|
||||
for(int i=0;i<nPages;i++)
|
||||
{
|
||||
int pageIndexAddress = 0x8000 + (1<<debuggerPageSize)*i;
|
||||
|
||||
// Load new address definitions
|
||||
lastBankNames = parseNameFile(generateNLFilenameForAddress(0xC000));
|
||||
}
|
||||
|
||||
// Find out which bank is loaded at 0x8000
|
||||
cb = getBank(0x8000);
|
||||
if (cb == -1) // No bank is loaded at that offset
|
||||
{
|
||||
free(loadedBankNames);
|
||||
loadedBankNames = 0;
|
||||
} else if (cb != loadedBank)
|
||||
{
|
||||
// If the bank changed since loading the NL files the last time it's necessary
|
||||
// to load the address descriptions of the new bank.
|
||||
|
||||
loadedBank = cb;
|
||||
|
||||
if (loadedBankNames)
|
||||
freeList(loadedBankNames);
|
||||
|
||||
// Load new address definitions
|
||||
loadedBankNames = parseNameFile(generateNLFilenameForAddress(0x8000));
|
||||
}
|
||||
// Find out which bank is loaded at the page index
|
||||
cb = getBank(pageIndexAddress);
|
||||
if (cb == -1) // No bank was loaded at that offset
|
||||
{
|
||||
free(pageNames[i]);
|
||||
pageNames[i] = 0;
|
||||
}
|
||||
else if (cb != pageNumbersLoaded[i])
|
||||
{
|
||||
// If the bank changed since loading the NL files the last time it's necessary
|
||||
// to load the address descriptions of the new bank.
|
||||
pageNumbersLoaded[i] = cb;
|
||||
|
||||
if (pageNames[i])
|
||||
freeList(pageNames[i]);
|
||||
|
||||
// Load new address definitions
|
||||
pageNames[i] = parseNameFile(generateNLFilenameForAddress(pageIndexAddress));
|
||||
}
|
||||
} //loop across pages
|
||||
}
|
||||
|
||||
// bookmarks
|
||||
|
|
|
@ -48,8 +48,8 @@ using namespace std;
|
|||
|
||||
#include "debuggersp.h"
|
||||
|
||||
extern Name* lastBankNames;
|
||||
extern Name* loadedBankNames;
|
||||
extern Name* pageNames[32];
|
||||
extern int pageNumbersLoaded[32];
|
||||
extern Name* ramBankNames;
|
||||
|
||||
// ################################## End of SP CODE ###########################
|
||||
|
@ -840,8 +840,8 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
|
|||
}
|
||||
|
||||
replaceNames(ramBankNames, a, &tempAddressesLog);
|
||||
replaceNames(loadedBankNames, a, &tempAddressesLog);
|
||||
replaceNames(lastBankNames, a, &tempAddressesLog);
|
||||
for(int i=0;i<ARRAY_SIZE(pageNames);i++)
|
||||
replaceNames(pageNames[i], a, &tempAddressesLog);
|
||||
}
|
||||
strncpy(str_disassembly, a, LOG_DISASSEMBLY_MAX_LEN);
|
||||
str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
|
||||
|
|
Loading…
Reference in New Issue