* Debugger: do not reload ram.nl every time automatically

This commit is contained in:
ansstuff 2013-07-03 13:08:41 +00:00
parent 20702c7267
commit 4a9a8f9bdd
4 changed files with 21 additions and 20 deletions

View File

@ -44,6 +44,7 @@
extern Name* lastBankNames;
extern Name* loadedBankNames;
extern Name* ramBankNames;
extern bool ramBankNamesLoaded;
extern int lastBank;
extern int loadedBank;
extern int myNumWPs;
@ -1974,6 +1975,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case IDC_DEBUGGER_RELOAD_SYMS:
{
ramBankNamesLoaded = false;
lastBank = loadedBank = -1;
loadNameFiles();
UpdateDebugger(false);

View File

@ -35,6 +35,7 @@ int GetNesFileAddress(int A);
Name* lastBankNames = 0;
Name* loadedBankNames = 0;
Name* ramBankNames = 0;
bool ramBankNamesLoaded = false;
int lastBank = -1;
int loadedBank = -1;
extern char LoadedRomFName[2048];
@ -325,16 +326,16 @@ Name* parse(char* lines, const char* filename)
if (fail == -1)
{
continue;
}
else if (fail) // Show an error to allow the user to correct the defect line
} else if (fail)
{
const char* fmtString = "Error (Code: %d): Invalid line \"%s\" in NL file \"%s\"";
// Show an error to allow the user to correct the defect line
const char* fmtString = "Error (Code: %d): Invalid line \"%s\" in NL file \"%s\"\n";
char* msg = (char*)malloc(strlen(fmtString) + 8 + strlen(lines) + strlen(filename) + 1);
sprintf(msg, fmtString, fail, lines, filename);
MessageBox(0, msg, "Error", MB_OK | MB_ICONERROR);
free(msg);
lines = pos + 1;
MessageBox(0, lines, "Error", MB_OK | MB_ICONERROR);
//MessageBox(0, lines, "Error", MB_OK | MB_ICONERROR);
continue;
}
@ -546,16 +547,21 @@ void loadNameFiles()
{
int cb;
if (ramBankNames)
free(ramBankNames);
if (!ramBankNamesLoaded)
{
ramBankNamesLoaded = true;
// load RAM names
if (ramBankNames)
free(ramBankNames);
// The NL file for the RAM addresses has the name nesrom.nes.ram.nl
strcpy(NLfilename, mass_replace(LoadedRomFName, "|", ".").c_str());
strcat(NLfilename, ".ram.nl");
// The NL file for the RAM addresses has the name nesrom.nes.ram.nl
strcpy(NLfilename, mass_replace(LoadedRomFName, "|", ".").c_str());
strcat(NLfilename, ".ram.nl");
// Load the address descriptions for the RAM addresses
ramBankNames = parseNameFile(NLfilename);
}
// Load the address descriptions for the RAM addresses
ramBankNames = parseNameFile(NLfilename);
// Find out which bank is loaded at 0xC000
cb = getBank(0xC000);
if (cb == -1) // No bank was loaded at that offset

View File

@ -160,10 +160,8 @@ int storeHexPreferences(FILE* f)
int storePreferences(const char* romname)
{
if (debuggerSaveLoadDEBFiles == false) {
if (debuggerSaveLoadDEBFiles == false)
return 0;
}
FILE* f;
char* filename;
@ -174,9 +172,7 @@ int storePreferences(const char* romname)
// Moved debugger exit code due to complaints and the Debugger menu option being enabled
if (!debuggerWasActive)
{
return 0;
}
/*
// With some work, this could be made to prevent writing empty .deb files.

View File

@ -51,9 +51,6 @@ using namespace std;
extern Name* lastBankNames;
extern Name* loadedBankNames;
extern Name* ramBankNames;
extern int lastBank;
extern int loadedBank;
extern int myNumWPs;
// ################################## End of SP CODE ###########################