11 #include <psp2kern/types.h> 34 #define KERNEL_PID 0x10005 37 #define TAI_ANY_LIBRARY 0xFFFFFFFF 40 #define TAI_IGNORE_MODULE_NID 0xFFFFFFFF 43 #define TAI_MAIN_MODULE ((void *)0) 46 #define HELPER inline static __attribute__((unused)) 72 const void *hook_func;
230 SceUID
taiHookFunctionAbs(SceUID pid, tai_hook_ref_t *p_hook,
void *dest_func,
const void *hook_func);
231 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);
232 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);
273 args.size =
sizeof(args);
274 args.module = module;
275 args.library_nid = library_nid;
276 args.func_nid = func_nid;
277 args.hook_func = hook_func;
301 HELPER SceUID
taiHookFunctionImport(tai_hook_ref_t *p_hook,
const char *module, uint32_t import_library_nid, uint32_t import_func_nid,
const void *hook_func) {
303 args.size =
sizeof(args);
304 args.module = module;
305 args.library_nid = import_library_nid;
306 args.func_nid = import_func_nid;
307 args.hook_func = hook_func;
326 args.size =
sizeof(args);
328 args.segidx = segidx;
329 args.offset = offset;
331 args.source = hook_func;
345 #define TAI_CONTINUE(type, hook, ...) ({ \ 346 struct _tai_hook_user *cur, *next; \ 347 cur = (struct _tai_hook_user *)(hook); \ 348 next = (struct _tai_hook_user *)cur->next; \ 350 ((type(*)())cur->old)(__VA_ARGS__) \ 352 ((type(*)())next->func)(__VA_ARGS__) \ 356 #error Non-GCC compatible compilers are currently unsupported 404 args.size =
sizeof(args);
406 args.segidx = segidx;
407 args.offset = offset;
408 args.source_size =
size;
455 argg.size =
sizeof(argg);
474 argg.size =
sizeof(argg);
494 argg.size =
sizeof(argg);
516 argg.size =
sizeof(argg);
537 argg.size =
sizeof(argg);
559 argg.size =
sizeof(argg);
582 argg.size =
sizeof(argg);
SceUID taiLoadStartModuleForPidForUser(const char *path, tai_module_args_t *args)
Loads and starts a user module for another process.
int taiMemcpyKernelToUser(void *user_dst, const void *kernel_src, size_t len)
Copies data from kernel to user.
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.
HELPER int taiStopUnloadKernelModule(SceUID modid, int args, void *argp, int flags, void *opt, int *res)
Helper function for taiStopUnloadKernelModuleForUser.
char name[27]
Module name.
uintptr_t imports_start
Pointer to import table in process address space.
int taiHookReleaseForKernel(SceUID tai_uid, tai_hook_ref_t hook)
Release a hook.
Extended module information.
uintptr_t exports_end
Pointer to end of export table.
int taiMemcpyUserToKernel(void *kernel_dst, const void *user_src, size_t len)
Copies data from user to kernel.
HELPER int taiStopKernelModule(SceUID modid, int args, void *argp, int flags, void *opt, int *res)
Helper function for taiStopKernelModuleForUser.
struct _tai_module_info tai_module_info_t
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.
struct _tai_offset_args tai_offset_args_t
Pass offset arguments to kernel.
SceUID taiHookFunctionExportForUser(tai_hook_ref_t *p_hook, tai_hook_args_t *args)
Add a hook to a module function export for the calling process.
int taiStopKernelModuleForUser(SceUID modid, tai_module_args_t *args, void *opt, int *res)
Stops a kernel module.
HELPER SceUID taiInjectData(SceUID modid, int segidx, uint32_t offset, const void *data, size_t size)
Helper function for taiInjectDataForUser.
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.
HELPER SceUID taiLoadStartModuleForPid(SceUID pid, const char *path, int args, void *argp, int flags)
Helper function for taiLoadStartModuleForPidForUser.
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 taiInjectDataForUser(tai_offset_args_t *args)
Inject data into the current process bypassing MMU flags given an offset.
uintptr_t imports_end
Pointer to end of import table.
SceUID taiHookFunctionImportForUser(tai_hook_ref_t *p_hook, tai_hook_args_t *args)
Add a hook to a module function import for the calling process.
int taiHookRelease(SceUID tai_uid, tai_hook_ref_t hook)
Release a hook for the calling process.
int taiGetModuleInfo(const char *module, tai_module_info_t *info)
Gets information on a currently loaded module.
uint32_t module_nid
Module NID.
int taiStartKernelModuleForUser(SceUID modid, tai_module_args_t *args, void *opt, int *res)
Starts a kernel module.
HELPER int taiStopUnloadModuleForPid(SceUID pid, SceUID modid, int args, void *argp, int flags, void *opt, int *res)
Helper function for taiStopUnloadModuleForPidForUser.
HELPER SceUID taiHookFunctionOffset(tai_hook_ref_t *p_hook, SceUID modid, int segidx, uint32_t offset, int thumb, const void *hook_func)
Helper function for taiHookFunctionOffsetForUser.
int taiUnloadModuleForPid(SceUID pid, SceUID modid, int flags, void *opt)
Unloads a user module for a process directly.
HELPER SceUID taiHookFunctionImport(tai_hook_ref_t *p_hook, const char *module, uint32_t import_library_nid, uint32_t import_func_nid, const void *hook_func)
Helper function for taiHookFunctionImportForUser.
uintptr_t exports_start
Pointer to export table in process address space.
int taiInjectRelease(SceUID tai_uid)
Release an injection for the calling process.
SceUID taiInjectAbsForKernel(SceUID pid, void *dest, const void *src, size_t size)
Injects data into a process bypassing MMU flags.
Pass offset arguments to kernel.
Pass module arguments to kernel.
SceUID taiLoadKernelModule(const char *path, int flags, void *opt)
Loads a kernel module.
SceUID taiInjectAbs(void *dest, const void *src, size_t size)
Injects data into the current process bypassing MMU flags.
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.
HELPER SceUID taiLoadStartKernelModule(const char *path, int args, void *argp, int flags)
Helper function for taiLoadStartKernelModuleForUser.
Pass hook arguments to kernel.
HELPER SceUID taiHookFunctionExport(tai_hook_ref_t *p_hook, const char *module, uint32_t library_nid, uint32_t func_nid, const void *hook_func)
Helper function for taiHookFunctionExportForUser.
int taiUnloadKernelModule(SceUID modid, int flags, void *opt)
Unloads a kernel module directly.
int taiStopModuleForPidForUser(SceUID modid, tai_module_args_t *args, void *opt, int *res)
Stops a user module for another process.
int taiGetModuleInfoForKernel(SceUID pid, const char *module, tai_module_info_t *info)
Gets information on a currently loaded module.
size_t size
Structure size, set to sizeof(tai_module_info_t)
SceUID taiLoadStartKernelModuleForUser(const char *path, tai_module_args_t *args)
Loads and starts a kernel module.
int taiStopUnloadModuleForPidForUser(SceUID modid, tai_module_args_t *args, void *opt, int *res)
Stops and unloads a user module for a process.
HELPER int taiStartKernelModule(SceUID modid, int args, void *argp, int flags, void *opt, int *res)
Helper function for taiStartKernelModuleForUser.
SceUID taiHookFunctionOffsetForUser(tai_hook_ref_t *p_hook, tai_offset_args_t *args)
Add a hook to a module manually with an offset for the calling process.
struct _tai_hook_args tai_hook_args_t
Pass hook arguments to kernel.
int taiStopUnloadKernelModuleForUser(SceUID modid, tai_module_args_t *args, void *opt, int *res)
Stops and unloads a kernel module.
HELPER int taiStopModuleForPid(SceUID pid, SceUID modid, int args, void *argp, int flags, void *opt, int *res)
Helper function for taiStopModuleForPidForUser.
struct _tai_module_args tai_module_args_t
Pass module arguments to kernel.