Skip to content

Instantly share code, notes, and snippets.

@TheOfficialFloW
Last active February 27, 2019 19:45
Show Gist options
  • Select an option

  • Save TheOfficialFloW/5791f4bc0e18812ca8ae12713c19fdb7 to your computer and use it in GitHub Desktop.

Select an option

Save TheOfficialFloW/5791f4bc0e18812ca8ae12713c19fdb7 to your computer and use it in GitHub Desktop.
File descriptor fix
#include <psp2kern/kernel/modulemgr.h>
#include <stdio.h>
#include <string.h>
#include <taihen.h>
static tai_hook_ref_t ksceVfsNodeInitializePartitionRef;
static SceUID hookid = -1;
static int ksceVfsNodeInitializePartitionPatched(int *node, int *new_node_p, void *opt, int flags) {
int res = TAI_CONTINUE(int, ksceVfsNodeInitializePartitionRef, node, new_node_p, opt, flags);
if (res == 0 && new_node_p) {
int *new_node = (int *)*new_node_p;
int *mount = (int *)new_node[19];
mount[20] &= ~0x10000;
}
return res;
}
void _start() __attribute__ ((weak, alias("module_start")));
int module_start(SceSize args, void *argp) {
hookid = taiHookFunctionExportForKernel(KERNEL_PID, &ksceVfsNodeInitializePartitionRef, "SceIofilemgr",
TAI_ANY_LIBRARY, 0xA5A6A55C, ksceVfsNodeInitializePartitionPatched);
return SCE_KERNEL_START_SUCCESS;
}
int module_stop(SceSize args, void *argp) {
if (hookid >= 0)
taiHookReleaseForKernel(hookid, ksceVfsNodeInitializePartitionRef);
return SCE_KERNEL_STOP_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment