8 #include <psp2kern/types.h> 9 #include <psp2kern/kernel/modulemgr.h> 10 #include <taihen/parser.h> 16 #include "taihen_internal.h" 19 unsigned char log_ctr = 0;
22 extern const char *g_config;
78 LOG(
"Failed to find export for %s, NID:0x%08X: 0x%08X", module, func_nid, ret);
122 LOG(
"Failed to find stub for %s, NID:0x%08X: 0x%08X", module, import_func_nid, ret);
127 LOG(
"Failed to read stub %p, %x", stubptr, ret);
131 if (stub[0] == 0xE24FC008 && stub[1] == 0xE12FFF1E) {
132 LOG(
"stub for %p has not been resolved yet!", import_func_nid);
133 return TAI_ERROR_STUB_NOT_RESOLVED;
165 LOG(
"Failed to find offset for mod:%x, segidx:%d, offset:0x%08X: 0x%08X", modid, segidx, offset, ret);
242 LOG(
"Failed to find offset for mod:%x, segidx:%d, offset:0x%08X: 0x%08X", modid, segidx, offset, ret);
278 LOG(
"config not loaded");
279 return TAI_ERROR_SYSTEM;
295 int module_start(SceSize argc,
const void *args) {
297 LOG(
"starting taihen...");
300 LOG(
"proc map init failed: %x", ret);
301 return SCE_KERNEL_START_FAILED;
305 LOG(
"patches init failed: %x", ret);
306 return SCE_KERNEL_START_FAILED;
310 LOG(
"HEN patches failed: %x", ret);
311 return SCE_KERNEL_START_FAILED;
315 LOG(
"HEN config load failed: %x", ret);
316 return SCE_KERNEL_START_FAILED;
319 return SCE_KERNEL_START_SUCCESS;
326 void _start()
__attribute__ ((weak, alias (
"module_start")));
341 int module_stop(SceSize argc,
const void *args) {
346 return SCE_KERNEL_STOP_SUCCESS;
354 void module_exit(
void) {
SceUID taiHookFunctionExportForKernel(SceUID pid, tai_hook_ref_t *p_hook, const char *module, uint32_t library_nid, uint32_t func_nid, const void *hook_func)
Add a hook to a module function export.
SceUID taiHookFunctionAbs(SceUID pid, tai_hook_ref_t *p_hook, void *dest_func, const void *hook_func)
Add a hook given an absolute address.
int taiHookReleaseForKernel(SceUID tai_uid, tai_hook_ref_t hook)
Release a hook.
void proc_map_deinit(void)
Cleans up the map system.
Extended module information.
uintptr_t tai_hook_ref_t
Hook information.
SceUID taiHookFunctionImportForKernel(SceUID pid, tai_hook_ref_t *p_hook, const char *module, uint32_t import_library_nid, uint32_t import_func_nid, const void *hook_func)
Add a hook to a module function import.
SceUID taiHookFunctionOffsetForKernel(SceUID pid, tai_hook_ref_t *p_hook, SceUID modid, int segidx, uint32_t offset, int thumb, const void *hook_func)
Add a hook to a module manually with an offset.
int tai_hook_release(SceUID uid, tai_hook_ref_t hook_ref)
Removes a hook and restores original function if chain is empty.
void hen_load_plugin(const char *path, void *param)
Callback to config parser to load a plugin.
int taiLoadPluginsForTitleForKernel(SceUID pid, const char *titleid, int flags)
Parses the taiHEN config and loads all plugins for a titleid to a process.
int taiInjectReleaseForKernel(SceUID tai_uid)
Release an injection.
SceUID pid
Process to load plugin to.
int patches_init(void)
Initializes the patch system.
SceUID tai_inject_abs(SceUID pid, void *dest, const void *src, size_t size)
Inserts a raw data injection given an absolute address and PID of the address space.
int module_get_by_name_nid(SceUID pid, const char *name, uint32_t nid, tai_module_info_t *info)
Gets a loaded module by name or NID or both.
int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uint32_t funcnid, uintptr_t *func)
Gets an exported function address.
int hen_load_config(void)
Load tai config file.
SceUID tai_hook_func_abs(tai_hook_ref_t *p_hook, SceUID pid, void *dest_func, const void *hook_func)
Inserts a hook given an absolute address and PID of the function.
#define TAI_IGNORE_MODULE_NID
SceUID taiInjectAbsForKernel(SceUID pid, void *dest, const void *src, size_t size)
Injects data into a process bypassing MMU flags.
Arguments passed from taiHEN to config parser back to taiHEN.
int flags
Flags for loading.
int tai_inject_release(SceUID uid)
Removes an injection and restores the original data.
int hen_add_patches(void)
Add kernel patches to disable SELF signature checks.
SceUID taiInjectDataForKernel(SceUID pid, SceUID modid, int segidx, uint32_t offset, const void *data, size_t size)
Inject data into a process bypassing MMU flags given an offset.
int hen_remove_patches(void)
Removes the kernel patches for SELF loading.
int module_get_offset(SceUID pid, SceUID modid, int segidx, size_t offset, uintptr_t *addr)
Gets an offset from a segment in a module.
int tai_memcpy_to_kernel(SceUID src_pid, void *dst, const char *src, size_t size)
Memcpy from a process to kernel.
int taiGetModuleInfoForKernel(SceUID pid, const char *module, tai_module_info_t *info)
Gets information on a currently loaded module.
void patches_deinit(void)
Cleans up the patch system.
int proc_map_init(void)
Initializes the map system.
int module_get_import_func(SceUID pid, const char *modname, uint32_t target_libnid, uint32_t funcnid, uintptr_t *stub)
Gets an imported function stub address.