Overlay the user Maps/ over the shared one to avoid copying files
This commit is contained in:
parent
b587af3ea3
commit
6bdb6585d6
|
@ -71,59 +71,73 @@ void CBoot::UpdateDebugger_MapLoaded(const char *_gameID)
|
|||
Host_NotifyMapLoaded();
|
||||
}
|
||||
|
||||
std::string CBoot::GenerateMapFilename()
|
||||
bool CBoot::FindMapFile(std::string* existing_map_file,
|
||||
std::string* writable_map_file)
|
||||
{
|
||||
std::string title_id_str;
|
||||
|
||||
SCoreStartupParameter& _StartupPara = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
switch (_StartupPara.m_BootType)
|
||||
{
|
||||
case SCoreStartupParameter::BOOT_WII_NAND:
|
||||
{
|
||||
const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(_StartupPara.m_strFilename);
|
||||
const DiscIO::INANDContentLoader& Loader =
|
||||
DiscIO::CNANDContentManager::Access().GetNANDLoader(_StartupPara.m_strFilename);
|
||||
if (Loader.IsValid())
|
||||
{
|
||||
u64 TitleID = Loader.GetTitleID();
|
||||
char tmpBuffer[32];
|
||||
sprintf(tmpBuffer, "%08x_%08x", (u32)(TitleID >> 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF );
|
||||
return File::GetUserPath(D_MAPS_IDX) + std::string(tmpBuffer) + ".map";
|
||||
title_id_str = StringFromFormat("%08X_%08X",
|
||||
(u32)(TitleID >> 32) & 0xFFFFFFFF,
|
||||
(u32)TitleID & 0xFFFFFFFF);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCoreStartupParameter::BOOT_ELF:
|
||||
case SCoreStartupParameter::BOOT_DOL:
|
||||
return _StartupPara.m_strFilename.substr(0, _StartupPara.m_strFilename.size()-4) + ".map";
|
||||
// Strip the .elf/.dol file extension
|
||||
title_id_str = _StartupPara.m_strFilename.substr(
|
||||
0, _StartupPara.m_strFilename.size() - 4);
|
||||
break;
|
||||
|
||||
default:
|
||||
return File::GetUserPath(D_MAPS_IDX) + _StartupPara.GetUniqueID() + ".map";
|
||||
title_id_str = _StartupPara.GetUniqueID();
|
||||
break;
|
||||
}
|
||||
|
||||
return std::string("unknown map");
|
||||
}
|
||||
if (writable_map_file)
|
||||
*writable_map_file = File::GetUserPath(D_MAPS_IDX) + title_id_str + ".map";
|
||||
|
||||
bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_gameID)
|
||||
{
|
||||
if (_rFilename.size() == 0)
|
||||
return false;
|
||||
|
||||
std::string strMapFilename = GenerateMapFilename();
|
||||
|
||||
bool success = false;
|
||||
if (!g_symbolDB.LoadMap(strMapFilename.c_str()))
|
||||
bool found = false;
|
||||
static const std::string maps_directories[] = {
|
||||
File::GetUserPath(D_MAPS_IDX),
|
||||
File::GetSysDirectory() + MAPS_DIR DIR_SEP
|
||||
};
|
||||
for (size_t i = 0; !found && i < ArraySize(maps_directories); ++i)
|
||||
{
|
||||
if (_gameID != NULL)
|
||||
std::string path = maps_directories[i] + title_id_str + ".map";
|
||||
if (File::Exists(path))
|
||||
{
|
||||
BuildCompleteFilename(strMapFilename, "maps", std::string(_gameID) + ".map");
|
||||
success = g_symbolDB.LoadMap(strMapFilename.c_str());
|
||||
found = true;
|
||||
if (existing_map_file)
|
||||
*existing_map_file = path;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
bool CBoot::LoadMapFromFilename()
|
||||
{
|
||||
std::string strMapFilename;
|
||||
bool found = FindMapFile(&strMapFilename, NULL);
|
||||
if (found && g_symbolDB.LoadMap(strMapFilename.c_str()))
|
||||
{
|
||||
success = true;
|
||||
UpdateDebugger_MapLoaded();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (success)
|
||||
UpdateDebugger_MapLoaded();
|
||||
|
||||
return success;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If ipl.bin is not found, this function does *some* of what BS1 does:
|
||||
|
@ -201,10 +215,6 @@ bool CBoot::BootUp()
|
|||
PanicAlertT("Warning - starting ISO in wrong console mode!");
|
||||
}
|
||||
|
||||
char gameID[7];
|
||||
memcpy(gameID, pVolume->GetUniqueID().c_str(), 6);
|
||||
gameID[6] = 0;
|
||||
|
||||
// setup the map from ISOFile ID
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strFilename);
|
||||
|
||||
|
@ -252,7 +262,7 @@ bool CBoot::BootUp()
|
|||
|
||||
/* Try to load the symbol map if there is one, and then scan it for
|
||||
and eventually replace code */
|
||||
if (LoadMapFromFilename(_StartupPara.m_strFilename, gameID))
|
||||
if (LoadMapFromFilename())
|
||||
HLE::PatchFunctions();
|
||||
|
||||
// We don't need the volume any more
|
||||
|
@ -298,7 +308,7 @@ bool CBoot::BootUp()
|
|||
PC = dolLoader.GetEntryPoint();
|
||||
}
|
||||
|
||||
if (LoadMapFromFilename(_StartupPara.m_strFilename))
|
||||
if (LoadMapFromFilename())
|
||||
HLE::PatchFunctions();
|
||||
|
||||
break;
|
||||
|
@ -368,7 +378,7 @@ bool CBoot::BootUp()
|
|||
case SCoreStartupParameter::BOOT_WII_NAND:
|
||||
Boot_WiiWAD(_StartupPara.m_strFilename.c_str());
|
||||
|
||||
if (LoadMapFromFilename(_StartupPara.m_strFilename))
|
||||
if (LoadMapFromFilename())
|
||||
HLE::PatchFunctions();
|
||||
|
||||
// load default image or create virtual drive from directory
|
||||
|
@ -387,7 +397,7 @@ bool CBoot::BootUp()
|
|||
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
|
||||
if (Load_BS2(_StartupPara.m_strBootROM))
|
||||
{
|
||||
if (LoadMapFromFilename(_StartupPara.m_strFilename))
|
||||
if (LoadMapFromFilename())
|
||||
HLE::PatchFunctions();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -16,14 +16,26 @@ public:
|
|||
|
||||
static bool BootUp();
|
||||
static bool IsElfWii(const char *filename);
|
||||
static std::string GenerateMapFilename();
|
||||
|
||||
// Tries to find a map file for the current game by looking first in the
|
||||
// local user directory, then in the shared user directory.
|
||||
//
|
||||
// If existing_map_file is not NULL and a map file exists, it is set to the
|
||||
// path to the existing map file.
|
||||
//
|
||||
// If writable_map_file is not NULL, it is set to the path to where a map
|
||||
// file should be saved.
|
||||
//
|
||||
// Returns true if a map file exists, false if none could be found.
|
||||
static bool FindMapFile(std::string* existing_map_file,
|
||||
std::string* writable_map_file);
|
||||
|
||||
private:
|
||||
static void RunFunction(u32 _iAddr);
|
||||
|
||||
static void UpdateDebugger_MapLoaded(const char* _gameID = NULL);
|
||||
|
||||
static bool LoadMapFromFilename(const std::string& _rFilename, const char* _gameID = NULL);
|
||||
static bool LoadMapFromFilename();
|
||||
static bool Boot_ELF(const char *filename);
|
||||
static bool Boot_WiiWAD(const char *filename);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ bool CBoot::Boot_ELF(const char *filename)
|
|||
reader.LoadInto(0x80000000);
|
||||
if (!reader.LoadSymbols())
|
||||
{
|
||||
if (LoadMapFromFilename(filename))
|
||||
if (LoadMapFromFilename())
|
||||
HLE::PatchFunctions();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -211,7 +211,9 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
|||
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
||||
|
||||
std::string mapfile = CBoot::GenerateMapFilename();
|
||||
std::string existing_map_file, writable_map_file;
|
||||
bool map_exists = CBoot::FindMapFile(&existing_map_file,
|
||||
&writable_map_file);
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_CLEARSYMBOLS:
|
||||
|
@ -238,28 +240,28 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
|||
break;
|
||||
}
|
||||
case IDM_LOADMAPFILE:
|
||||
if (!File::Exists(mapfile))
|
||||
if (!map_exists)
|
||||
{
|
||||
g_symbolDB.Clear();
|
||||
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
|
||||
SignatureDB db;
|
||||
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
||||
db.Apply(&g_symbolDB);
|
||||
Parent->StatusBarMessage("'%s' not found, scanning for common functions instead", mapfile.c_str());
|
||||
Parent->StatusBarMessage("'%s' not found, scanning for common functions instead", writable_map_file.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
g_symbolDB.LoadMap(mapfile.c_str());
|
||||
Parent->StatusBarMessage("Loaded symbols from '%s'", mapfile.c_str());
|
||||
g_symbolDB.LoadMap(existing_map_file.c_str());
|
||||
Parent->StatusBarMessage("Loaded symbols from '%s'", existing_map_file.c_str());
|
||||
}
|
||||
HLE::PatchFunctions();
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
case IDM_SAVEMAPFILE:
|
||||
g_symbolDB.SaveMap(mapfile.c_str());
|
||||
g_symbolDB.SaveMap(writable_map_file.c_str());
|
||||
break;
|
||||
case IDM_SAVEMAPFILEWITHCODES:
|
||||
g_symbolDB.SaveMap(mapfile.c_str(), true);
|
||||
g_symbolDB.SaveMap(writable_map_file.c_str(), true);
|
||||
break;
|
||||
|
||||
case IDM_RENAME_SYMBOLS:
|
||||
|
|
|
@ -253,8 +253,6 @@ bool DolphinApp::OnInit()
|
|||
//TODO : detect the revision and upgrade where necessary
|
||||
File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP),
|
||||
File::GetUserPath(D_GAMECONFIG_IDX));
|
||||
File::CopyDir(std::string(SHARED_USER_DIR MAPS_DIR DIR_SEP),
|
||||
File::GetUserPath(D_MAPS_IDX));
|
||||
File::CopyDir(std::string(SHARED_USER_DIR SHADERS_DIR DIR_SEP),
|
||||
File::GetUserPath(D_SHADERS_IDX));
|
||||
File::CopyDir(std::string(SHARED_USER_DIR WII_USER_DIR DIR_SEP),
|
||||
|
@ -272,6 +270,7 @@ bool DolphinApp::OnInit()
|
|||
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_MAPS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP);
|
||||
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP);
|
||||
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);
|
||||
|
|
Loading…
Reference in New Issue