Merge pull request #13136 from Tilka/startup_patch

Core: apply Dolphin OnFrame patches right after boot
This commit is contained in:
Admiral H. Curtiss 2024-10-30 04:28:18 +01:00 committed by GitHub
commit 2764a3dc44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 3 deletions

View File

@ -211,7 +211,7 @@ void SConfig::OnNewTitleLoad(const Core::CPUThreadGuard& guard)
} }
CBoot::LoadMapFromFilename(guard, ppc_symbol_db); CBoot::LoadMapFromFilename(guard, ppc_symbol_db);
HLE::Reload(system); HLE::Reload(system);
PatchEngine::Reload(); PatchEngine::Reload(system);
HiresTexture::Update(); HiresTexture::Update();
WC24PatchEngine::Reload(); WC24PatchEngine::Reload();
} }

View File

@ -295,6 +295,13 @@ void RemoveMemoryPatch(std::size_t index)
std::erase(s_on_frame_memory, index); std::erase(s_on_frame_memory, index);
} }
static void ApplyStartupPatches(Core::System& system)
{
ASSERT(Core::IsCPUThread());
Core::CPUThreadGuard guard(system);
ApplyPatches(guard, s_on_frame);
}
bool ApplyFramePatches(Core::System& system) bool ApplyFramePatches(Core::System& system)
{ {
const auto& ppc_state = system.GetPPCState(); const auto& ppc_state = system.GetPPCState();
@ -332,10 +339,11 @@ void Shutdown()
Gecko::Shutdown(); Gecko::Shutdown();
} }
void Reload() void Reload(Core::System& system)
{ {
Shutdown(); Shutdown();
LoadPatches(); LoadPatches();
ApplyStartupPatches(system);
} }
} // namespace PatchEngine } // namespace PatchEngine

View File

@ -61,7 +61,7 @@ void RemoveMemoryPatch(std::size_t index);
bool ApplyFramePatches(Core::System& system); bool ApplyFramePatches(Core::System& system);
void Shutdown(); void Shutdown();
void Reload(); void Reload(Core::System& system);
inline int GetPatchTypeCharLength(PatchType type) inline int GetPatchTypeCharLength(PatchType type)
{ {