Skip to content

Commit

Permalink
Boot: Restore symbol map loading
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Jun 6, 2017
1 parent 9a3fb85 commit d50b440
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
8 changes: 2 additions & 6 deletions Source/Core/Core/Boot/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
5 changes: 1 addition & 4 deletions Source/Core/Core/Boot/Boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,8 @@ class CBoot
// 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:
Expand Down
17 changes: 17 additions & 0 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>(title_id >> 32), static_cast<u32>(title_id));
}
else
{
m_debugger_game_id.clear();
}

if (!was_changed)
return;

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d50b440

Please sign in to comment.