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

View File

@ -35,6 +35,7 @@ int GetNesFileAddress(int A);
Name* lastBankNames = 0; Name* lastBankNames = 0;
Name* loadedBankNames = 0; Name* loadedBankNames = 0;
Name* ramBankNames = 0; Name* ramBankNames = 0;
bool ramBankNamesLoaded = false;
int lastBank = -1; int lastBank = -1;
int loadedBank = -1; int loadedBank = -1;
extern char LoadedRomFName[2048]; extern char LoadedRomFName[2048];
@ -325,16 +326,16 @@ Name* parse(char* lines, const char* filename)
if (fail == -1) if (fail == -1)
{ {
continue; continue;
} } else if (fail)
else if (fail) // 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\""; // 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); char* msg = (char*)malloc(strlen(fmtString) + 8 + strlen(lines) + strlen(filename) + 1);
sprintf(msg, fmtString, fail, lines, filename); sprintf(msg, fmtString, fail, lines, filename);
MessageBox(0, msg, "Error", MB_OK | MB_ICONERROR); MessageBox(0, msg, "Error", MB_OK | MB_ICONERROR);
free(msg); free(msg);
lines = pos + 1; lines = pos + 1;
MessageBox(0, lines, "Error", MB_OK | MB_ICONERROR); //MessageBox(0, lines, "Error", MB_OK | MB_ICONERROR);
continue; continue;
} }
@ -546,16 +547,21 @@ void loadNameFiles()
{ {
int cb; int cb;
if (ramBankNames) if (!ramBankNamesLoaded)
free(ramBankNames); {
ramBankNamesLoaded = true;
// load RAM names
if (ramBankNames)
free(ramBankNames);
// The NL file for the RAM addresses has the name nesrom.nes.ram.nl // The NL file for the RAM addresses has the name nesrom.nes.ram.nl
strcpy(NLfilename, mass_replace(LoadedRomFName, "|", ".").c_str()); strcpy(NLfilename, mass_replace(LoadedRomFName, "|", ".").c_str());
strcat(NLfilename, ".ram.nl"); 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 // Find out which bank is loaded at 0xC000
cb = getBank(0xC000); cb = getBank(0xC000);
if (cb == -1) // No bank was loaded at that offset 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) int storePreferences(const char* romname)
{ {
if (debuggerSaveLoadDEBFiles == false) { if (debuggerSaveLoadDEBFiles == false)
return 0; return 0;
}
FILE* f; FILE* f;
char* filename; 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 // Moved debugger exit code due to complaints and the Debugger menu option being enabled
if (!debuggerWasActive) if (!debuggerWasActive)
{
return 0; return 0;
}
/* /*
// With some work, this could be made to prevent writing empty .deb files. // 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* lastBankNames;
extern Name* loadedBankNames; extern Name* loadedBankNames;
extern Name* ramBankNames; extern Name* ramBankNames;
extern int lastBank;
extern int loadedBank;
extern int myNumWPs;
// ################################## End of SP CODE ########################### // ################################## End of SP CODE ###########################