Static hle implementation

This commit is contained in:
RipleyTom 2018-10-26 12:08:45 +02:00 committed by Ivan
parent a22297f205
commit de5379a69f
7 changed files with 263 additions and 3 deletions

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Utilities/VirtualMemory.h"
#include "Utilities/bin_patch.h"
#include "Crypto/sha1.h"
@ -14,6 +14,8 @@
#include "Emu/Cell/lv2/sys_prx.h"
#include "Emu/Cell/lv2/sys_memory.h"
#include "Emu/Cell/Modules/StaticHLE.h"
#include <map>
#include <set>
#include <algorithm>
@ -255,6 +257,7 @@ static void ppu_initialize_modules(const std::shared_ptr<ppu_linkage_info>& link
&ppu_module_manager::sysPrxForUser,
&ppu_module_manager::sys_libc,
&ppu_module_manager::sys_lv2dbg,
&ppu_module_manager::static_hle,
};
// Initialize double-purpose fake OPD array for HLE functions
@ -1136,6 +1139,18 @@ void ppu_load_exec(const ppu_exec_object& elf)
// Initialize HLE modules
ppu_initialize_modules(link);
// Static HLE patching
if (g_cfg.core.hook_functions)
{
auto shle = fxm::get_always<statichle_handler>();
for (u32 i = _main->segs[0].addr; i < (_main->segs[0].addr + _main->segs[0].size); i += 4)
{
vm::cptr<u8> _ptr = vm::cast(i);
shle->check_against_patterns(_ptr, (_main->segs[0].addr + _main->segs[0].size) - i, i);
}
}
// Load other programs
for (auto& prog : elf.progs)
{