mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Merge pull request #5215 from sepalani/hle-reload
Fix a regression when reloading a title
This commit is contained in:
@ -21,7 +21,6 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||||
#include "Core/GeckoCode.h"
|
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HW/DVD/DVDInterface.h"
|
#include "Core/HW/DVD/DVDInterface.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
||||||
@ -479,19 +478,6 @@ bool CBoot::BootUp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HLE jump to loader (homebrew). Disabled when Gecko is active as it interferes with the code
|
HLE::PatchFixedFunctions();
|
||||||
// handler
|
|
||||||
if (!SConfig::GetInstance().bEnableCheats)
|
|
||||||
{
|
|
||||||
HLE::Patch(0x80001800, "HBReload");
|
|
||||||
Memory::CopyToEmu(0x00001804, "STUBHAXX", 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not part of the binary itself, but either we or Gecko OS might insert
|
|
||||||
// this, and it doesn't clear the icache properly.
|
|
||||||
HLE::Patch(Gecko::ENTRY_POINT, "GeckoCodehandler");
|
|
||||||
// This has to always be installed even if cheats are not enabled because of the possiblity of
|
|
||||||
// loading a savestate where PC is inside the code handler while cheats are disabled.
|
|
||||||
HLE::Patch(Gecko::HLE_TRAMPOLINE_ADDRESS, "GeckoHandlerReturnTrampoline");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -785,10 +785,8 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, u64 title_id, u
|
|||||||
// TODO: have a callback mechanism for title changes?
|
// TODO: have a callback mechanism for title changes?
|
||||||
g_symbolDB.Clear();
|
g_symbolDB.Clear();
|
||||||
CBoot::LoadMapFromFilename();
|
CBoot::LoadMapFromFilename();
|
||||||
HLE::Clear();
|
HLE::Reload();
|
||||||
HLE::PatchFunctions();
|
PatchEngine::Reload();
|
||||||
PatchEngine::Shutdown();
|
|
||||||
PatchEngine::LoadPatches();
|
|
||||||
HiresTexture::Update();
|
HiresTexture::Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||||
|
#include "Core/GeckoCode.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/HLE_Misc.h"
|
#include "Core/HLE/HLE_Misc.h"
|
||||||
#include "Core/HLE/HLE_OS.h"
|
#include "Core/HLE/HLE_OS.h"
|
||||||
@ -88,6 +89,24 @@ void Patch(u32 addr, const char* hle_func_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PatchFixedFunctions()
|
||||||
|
{
|
||||||
|
// HLE jump to loader (homebrew). Disabled when Gecko is active as it interferes with the code
|
||||||
|
// handler
|
||||||
|
if (!SConfig::GetInstance().bEnableCheats)
|
||||||
|
{
|
||||||
|
Patch(0x80001800, "HBReload");
|
||||||
|
Memory::CopyToEmu(0x00001804, "STUBHAXX", 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not part of the binary itself, but either we or Gecko OS might insert
|
||||||
|
// this, and it doesn't clear the icache properly.
|
||||||
|
Patch(Gecko::ENTRY_POINT, "GeckoCodehandler");
|
||||||
|
// This has to always be installed even if cheats are not enabled because of the possiblity of
|
||||||
|
// loading a savestate where PC is inside the code handler while cheats are disabled.
|
||||||
|
Patch(Gecko::HLE_TRAMPOLINE_ADDRESS, "GeckoHandlerReturnTrampoline");
|
||||||
|
}
|
||||||
|
|
||||||
void PatchFunctions()
|
void PatchFunctions()
|
||||||
{
|
{
|
||||||
// Remove all hooks that aren't fixed address hooks
|
// Remove all hooks that aren't fixed address hooks
|
||||||
@ -141,6 +160,13 @@ void Clear()
|
|||||||
s_original_instructions.clear();
|
s_original_instructions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reload()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
PatchFixedFunctions();
|
||||||
|
PatchFunctions();
|
||||||
|
}
|
||||||
|
|
||||||
void Execute(u32 _CurrentPC, u32 _Instruction)
|
void Execute(u32 _CurrentPC, u32 _Instruction)
|
||||||
{
|
{
|
||||||
unsigned int FunctionIndex = _Instruction & 0xFFFFF;
|
unsigned int FunctionIndex = _Instruction & 0xFFFFF;
|
||||||
|
@ -24,8 +24,10 @@ enum HookFlag
|
|||||||
HLE_TYPE_FIXED = 2, // An arbitrary hook mapped to a fixed address instead of a symbol
|
HLE_TYPE_FIXED = 2, // An arbitrary hook mapped to a fixed address instead of a symbol
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void PatchFixedFunctions();
|
||||||
void PatchFunctions();
|
void PatchFunctions();
|
||||||
void Clear();
|
void Clear();
|
||||||
|
void Reload();
|
||||||
|
|
||||||
void Patch(u32 pc, const char* func_name);
|
void Patch(u32 pc, const char* func_name);
|
||||||
u32 UnPatch(const std::string& patchName);
|
u32 UnPatch(const std::string& patchName);
|
||||||
|
@ -246,4 +246,10 @@ void Shutdown()
|
|||||||
Gecko::Shutdown();
|
Gecko::Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reload()
|
||||||
|
{
|
||||||
|
Shutdown();
|
||||||
|
LoadPatches();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -45,6 +45,7 @@ void LoadPatchSection(const std::string& section, std::vector<Patch>& patches, I
|
|||||||
void LoadPatches();
|
void LoadPatches();
|
||||||
bool ApplyFramePatches();
|
bool ApplyFramePatches();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
void Reload();
|
||||||
|
|
||||||
inline int GetPatchTypeCharLength(PatchType type)
|
inline int GetPatchTypeCharLength(PatchType type)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user