From d50b4406a66f1d9e09ad095df38fae9d57a3a729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 5 Jun 2017 13:55:54 +0200 Subject: [PATCH] Boot: Restore symbol map loading --- Source/Core/Core/Boot/Boot.cpp | 8 ++------ Source/Core/Core/Boot/Boot.h | 5 +---- Source/Core/Core/ConfigManager.cpp | 17 +++++++++++++++++ Source/Core/Core/ConfigManager.h | 1 + .../DolphinWX/Debugger/CodeWindowFunctions.cpp | 5 +++-- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index aec784cec3..e428129226 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -178,17 +178,13 @@ void CBoot::UpdateDebugger_MapLoaded() } // Get map file paths for the active title. -bool CBoot::FindMapFile(std::string* existing_map_file, std::string* writable_map_file, - std::string* title_id) +bool CBoot::FindMapFile(std::string* existing_map_file, std::string* writable_map_file) { - const std::string game_id = SConfig::GetInstance().GetGameID(); + const std::string& game_id = SConfig::GetInstance().m_debugger_game_id; if (writable_map_file) *writable_map_file = File::GetUserPath(D_MAPS_IDX) + game_id + ".map"; - if (title_id) - *title_id = game_id; - bool found = false; static const std::string maps_directories[] = {File::GetUserPath(D_MAPS_IDX), File::GetSysDirectory() + MAPS_DIR DIR_SEP}; diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h index 562c067685..a178edaf75 100644 --- a/Source/Core/Core/Boot/Boot.h +++ b/Source/Core/Core/Boot/Boot.h @@ -81,11 +81,8 @@ public: // If writable_map_file is not nullptr, it is set to the path to where a map // file should be saved. // - // If title_id is not nullptr, it is set to the title id - // // 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, - std::string* title_id = nullptr); + static bool FindMapFile(std::string* existing_map_file, std::string* writable_map_file); static bool LoadMapFromFilename(); private: diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index b94f06e820..b63702b6d2 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -753,6 +753,20 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, u64 title_id, u m_title_id = title_id; m_revision = revision; + if (game_id.length() == 6) + { + m_debugger_game_id = game_id; + } + else if (title_id != 0) + { + m_debugger_game_id = + StringFromFormat("%08X_%08X", static_cast(title_id >> 32), static_cast(title_id)); + } + else + { + m_debugger_game_id.clear(); + } + if (!was_changed) return; @@ -906,6 +920,9 @@ struct SetGameMetadata // In the future, it probably makes sense to add a Region setting for homebrew somewhere in // the emulator config. *region = config->bWii ? DiscIO::Region::PAL : DiscIO::Region::NTSC_U; + + // Strip the .elf/.dol file extension and directories before the name + SplitPath(executable.path, nullptr, &config->m_debugger_game_id, nullptr); return true; } diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 3fd85fdfb9..69947125fc 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -202,6 +202,7 @@ struct SConfig : NonCopyable std::string m_perfDir; + std::string m_debugger_game_id; // TODO: remove this as soon as the ticket view hack in IOS/ES/Views is dropped. bool m_disc_booted_from_game_list = false; diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index ffca4d0273..2452e85b38 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -173,8 +173,9 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) if (!Core::IsRunning()) return; - std::string existing_map_file, writable_map_file, title_id_str; - bool map_exists = CBoot::FindMapFile(&existing_map_file, &writable_map_file, &title_id_str); + const std::string& title_id_str = SConfig::GetInstance().m_debugger_game_id; + std::string existing_map_file, writable_map_file; + bool map_exists = CBoot::FindMapFile(&existing_map_file, &writable_map_file); switch (event.GetId()) { case IDM_CLEAR_SYMBOLS: