Implement runtime PPU executable code modification via Cheat Manager

This commit is contained in:
Eladash 2019-11-14 23:03:58 +02:00 committed by Ivan
parent 93a6e9e4e4
commit 8427af8886
2 changed files with 47 additions and 5 deletions

View file

@ -165,6 +165,7 @@ extern void ppu_initialize();
extern void ppu_initialize(const ppu_module& info);
static void ppu_initialize2(class jit_compiler& jit, const ppu_module& module_part, const std::string& cache_path, const std::string& obj_name);
extern void ppu_execute_syscall(ppu_thread& ppu, u64 code);
static bool ppu_break(ppu_thread& ppu, ppu_opcode_t op);
// Get pointer to executable cache
template<typename T = u64>
@ -308,11 +309,11 @@ extern void ppu_register_function_at(u32 addr, u32 size, ppu_function_t ptr)
}
// Initialize interpreter cache
const u32 fallback = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(ppu_fallback));
const u32 _break = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(ppu_break));
while (size)
{
if (ppu_ref<u32>(addr) == fallback)
if (ppu_ref<u32>(addr) != _break)
{
ppu_ref(addr) = ppu_cache(addr);
}