mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 06:59:07 +01:00
Fix symbol map being loaded too early during title changes
We should only try to load a symbol map for the new title *after* it has been loaded into memory, not before. Likewise for applying HLE patches and loading new custom textures. In practice, loading/repatching too early was only a problem for titles that are launched via ES_Launch. This commit fixes that.
This commit is contained in:
parent
a658cbce16
commit
19667cb801
@ -436,11 +436,7 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||||||
if (!EmulatedBS2(config.bWii, *volume))
|
if (!EmulatedBS2(config.bWii, *volume))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Try to load the symbol map if there is one, and then scan it for
|
SConfig::OnNewTitleLoad();
|
||||||
// and eventually replace code
|
|
||||||
if (LoadMapFromFilename())
|
|
||||||
HLE::PatchFunctions();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,9 +478,11 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||||||
SetupGCMemory();
|
SetupGCMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SConfig::OnNewTitleLoad();
|
||||||
|
|
||||||
PC = executable.reader->GetEntryPoint();
|
PC = executable.reader->GetEntryPoint();
|
||||||
|
|
||||||
if (executable.reader->LoadSymbols() || LoadMapFromFilename())
|
if (executable.reader->LoadSymbols())
|
||||||
{
|
{
|
||||||
UpdateDebugger_MapLoaded();
|
UpdateDebugger_MapLoaded();
|
||||||
HLE::PatchFunctions();
|
HLE::PatchFunctions();
|
||||||
@ -495,13 +493,21 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||||||
bool operator()(const DiscIO::VolumeWAD& wad) const
|
bool operator()(const DiscIO::VolumeWAD& wad) const
|
||||||
{
|
{
|
||||||
SetDefaultDisc();
|
SetDefaultDisc();
|
||||||
return Boot_WiiWAD(wad);
|
if (!Boot_WiiWAD(wad))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SConfig::OnNewTitleLoad();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator()(const BootParameters::NANDTitle& nand_title) const
|
bool operator()(const BootParameters::NANDTitle& nand_title) const
|
||||||
{
|
{
|
||||||
SetDefaultDisc();
|
SetDefaultDisc();
|
||||||
return BootNANDTitle(nand_title.id);
|
if (!BootNANDTitle(nand_title.id))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SConfig::OnNewTitleLoad();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator()(const BootParameters::IPL& ipl) const
|
bool operator()(const BootParameters::IPL& ipl) const
|
||||||
@ -525,9 +531,7 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||||||
SetDisc(DiscIO::CreateDisc(ipl.disc->path), ipl.disc->auto_disc_change_paths);
|
SetDisc(DiscIO::CreateDisc(ipl.disc->path), ipl.disc->auto_disc_change_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadMapFromFilename())
|
SConfig::OnNewTitleLoad();
|
||||||
HLE::PatchFunctions();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,8 +548,6 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
|
|||||||
if (!std::visit(BootTitle(), boot->parameters))
|
if (!std::visit(BootTitle(), boot->parameters))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PatchEngine::LoadPatches();
|
|
||||||
HLE::PatchFixedFunctions();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,19 +706,23 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
|||||||
Config::AddLayer(ConfigLoaders::GenerateLocalGameConfigLoader(game_id, revision));
|
Config::AddLayer(ConfigLoaders::GenerateLocalGameConfigLoader(game_id, revision));
|
||||||
|
|
||||||
if (Core::IsRunning())
|
if (Core::IsRunning())
|
||||||
{
|
|
||||||
// TODO: have a callback mechanism for title changes?
|
|
||||||
if (!g_symbolDB.IsEmpty())
|
|
||||||
{
|
|
||||||
g_symbolDB.Clear();
|
|
||||||
Host_NotifyMapLoaded();
|
|
||||||
}
|
|
||||||
CBoot::LoadMapFromFilename();
|
|
||||||
HLE::Reload();
|
|
||||||
PatchEngine::Reload();
|
|
||||||
HiresTexture::Update();
|
|
||||||
DolphinAnalytics::Instance().ReportGameStart();
|
DolphinAnalytics::Instance().ReportGameStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SConfig::OnNewTitleLoad()
|
||||||
|
{
|
||||||
|
if (!Core::IsRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!g_symbolDB.IsEmpty())
|
||||||
|
{
|
||||||
|
g_symbolDB.Clear();
|
||||||
|
Host_NotifyMapLoaded();
|
||||||
}
|
}
|
||||||
|
CBoot::LoadMapFromFilename();
|
||||||
|
HLE::Reload();
|
||||||
|
PatchEngine::Reload();
|
||||||
|
HiresTexture::Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::LoadDefaults()
|
void SConfig::LoadDefaults()
|
||||||
|
@ -197,6 +197,10 @@ struct SConfig
|
|||||||
void SetRunningGameMetadata(const DiscIO::Volume& volume, const DiscIO::Partition& partition);
|
void SetRunningGameMetadata(const DiscIO::Volume& volume, const DiscIO::Partition& partition);
|
||||||
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform);
|
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform);
|
||||||
void SetRunningGameMetadata(const std::string& game_id);
|
void SetRunningGameMetadata(const std::string& game_id);
|
||||||
|
// Reloads title-specific map files, patches, custom textures, etc.
|
||||||
|
// This should only be called after the new title has been loaded into memory.
|
||||||
|
static void OnNewTitleLoad();
|
||||||
|
|
||||||
void LoadDefaults();
|
void LoadDefaults();
|
||||||
static std::string MakeGameID(std::string_view file_name);
|
static std::string MakeGameID(std::string_view file_name);
|
||||||
// Replaces NTSC-K with some other region, and doesn't replace non-NTSC-K regions
|
// Replaces NTSC-K with some other region, and doesn't replace non-NTSC-K regions
|
||||||
|
@ -856,6 +856,7 @@ IOSC& Kernel::GetIOSC()
|
|||||||
static void FinishPPCBootstrap(u64 userdata, s64 cycles_late)
|
static void FinishPPCBootstrap(u64 userdata, s64 cycles_late)
|
||||||
{
|
{
|
||||||
ReleasePPC();
|
ReleasePPC();
|
||||||
|
SConfig::OnNewTitleLoad();
|
||||||
INFO_LOG_FMT(IOS, "Bootstrapping done.");
|
INFO_LOG_FMT(IOS, "Bootstrapping done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user