Add a setting to autosave the symbol map.

And move it into system, needs to be after the coreParameter too.
This commit is contained in:
Unknown W. Brackets 2013-03-30 21:42:43 -07:00
parent 8155657ea3
commit 8f911a0ebe
8 changed files with 26 additions and 4 deletions

View File

@ -60,6 +60,7 @@ void Config::Load(const char *iniFileName)
general->Get("Recent", recentIsos);
general->Get("WindowX", &iWindowX, 40);
general->Get("WindowY", &iWindowY, 100);
general->Get("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
if (recentIsos.size() > MAX_RECENT)
recentIsos.resize(MAX_RECENT);
@ -139,6 +140,7 @@ void Config::Save()
general->Set("Recent", recentIsos);
general->Set("WindowX", iWindowX);
general->Set("WindowY", iWindowY);
general->Set("AutoSaveSymbolMap", bAutoSaveSymbolMap);
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);

View File

@ -44,6 +44,7 @@ public:
bool bIgnoreBadMemAccess;
bool bFastMemory;
bool bJit;
bool bAutoSaveSymbolMap;
std::string sReportHost;
std::vector<std::string> recentIsos;

View File

@ -391,6 +391,10 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
dontadd = true;
}
}
else if (host->AttemptLoadSymbolMap())
{
dontadd = true;
}
INFO_LOG(LOADER,"Module %s: %08x %08x %08x", modinfo->name, modinfo->gp, modinfo->libent,modinfo->libstub);

View File

@ -57,6 +57,7 @@ public:
virtual bool IsDebuggingEnabled() {return true;}
virtual bool AttemptLoadSymbolMap() {return false;}
virtual void SaveSymbolMap() {}
virtual void SetWindowTitle(const char *message) {}
virtual void SendCoreWait(bool) {}

View File

@ -76,6 +76,8 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
mipsr4k.Reset();
mipsr4k.pc = 0;
host->AttemptLoadSymbolMap();
if (coreParameter.enableSound)
{
mixer = new PSPMixer();
@ -126,6 +128,9 @@ void PSP_Shutdown()
CoreTiming::Shutdown();
if (g_Config.bAutoSaveSymbolMap)
host->SaveSymbolMap();
if (coreParameter.enableSound)
{
host->ShutdownSound();

View File

@ -80,7 +80,6 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) {
}
host->BootDone();
host->AttemptLoadSymbolMap();
host->UpdateDisassembly();
#ifdef _WIN32
@ -99,8 +98,6 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) {
EmuScreen::~EmuScreen() {
if (!invalid_) {
// If we were invalid, it would already be shutdown.
// symbolMap.SaveSymbolMap(SymbolMapFilename(coreParam.fileToStart).c_str());
PSP_Shutdown();
}
}

View File

@ -155,7 +155,16 @@ static std::string SymbolMapFilename(const char *currentFilename)
bool WindowsHost::AttemptLoadSymbolMap()
{
return symbolMap.LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str()).c_str());
if (loadedSymbolMap_)
return true;
loadedSymbolMap_ = symbolMap.LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str()).c_str());
return loadedSymbolMap_;
}
void WindowsHost::SaveSymbolMap()
{
symbolMap.SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str()).c_str());
loadedSymbolMap_ = false;
}
void WindowsHost::AddSymbol(std::string name, u32 addr, u32 size, int type=0)

View File

@ -28,6 +28,7 @@ public:
mainWindow_ = mainWindow;
displayWindow_ = displayWindow;
input = getInputDevices();
loadedSymbolMap_ = false;
}
void UpdateMemView();
void UpdateDisassembly();
@ -47,10 +48,12 @@ public:
bool IsDebuggingEnabled();
void BootDone();
bool AttemptLoadSymbolMap();
void SaveSymbolMap();
void SetWindowTitle(const char *message);
private:
HWND displayWindow_;
HWND mainWindow_;
std::list<std::shared_ptr<InputDevice>> input;
bool loadedSymbolMap_;
};