├── CMakeLists.txt ├── README.md ├── exports.yml └── main.c /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) 4 | if(DEFINED ENV{VITASDK}) 5 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") 6 | else() 7 | message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") 8 | endif() 9 | endif() 10 | 11 | project(fd_fix) 12 | include("${VITASDK}/share/vita.cmake" REQUIRED) 13 | 14 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -nostdlib") 15 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions") 16 | 17 | add_executable(fd_fix 18 | main.c 19 | ) 20 | 21 | target_link_libraries(fd_fix 22 | SceSysclibForDriver_stub 23 | taihenForKernel_stub 24 | ) 25 | 26 | vita_create_self(fd_fix.skprx fd_fix CONFIG exports.yml UNSAFE) 27 | 28 | add_custom_target(copy 29 | COMMAND cp fd_fix.skprx F:/tai/fd_fix.skprx 30 | DEPENDS fd_fix.skprx 31 | ) 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FdFix 2 | 3 | This plugin fixes an issue in PS Vita homebrews where file descriptors are invalidated after suspend and resume. 4 | 5 | ## Installation 6 | 7 | 1. Download [fd_fix.skprx](https://github.com/TheOfficialFloW/FdFix/releases/download/v1.0/fd_fix.skprx) 8 | 9 | 2. Add these lines to taiHEN config.txt at `ux0:tai/config.txt`: 10 | 11 | ``` 12 | *KERNEL 13 | ux0:tai/fd_fix.skprx 14 | ``` 15 | 16 | 3. Reboot your device and relaunch HENkaku. -------------------------------------------------------------------------------- /exports.yml: -------------------------------------------------------------------------------- 1 | FdFix: 2 | attributes: 0 3 | version: 4 | major: 1 5 | minor: 0 6 | main: 7 | start: module_start 8 | stop: module_stop 9 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static tai_hook_ref_t ksceVfsNodeInitializePartitionRef; 7 | static SceUID uid = -1; 8 | 9 | static int ksceVfsNodeInitializePartitionPatched(int *node, int *new_node_p, 10 | void *opt, int flags) { 11 | int res = TAI_CONTINUE(int, ksceVfsNodeInitializePartitionRef, node, 12 | new_node_p, opt, flags); 13 | 14 | if (res == 0 && new_node_p) { 15 | int *new_node = (int *)*new_node_p; 16 | int *mount = (int *)new_node[19]; 17 | mount[20] &= ~0x10000; 18 | } 19 | 20 | return res; 21 | } 22 | 23 | void _start() __attribute__ ((weak, alias("module_start"))); 24 | int module_start(SceSize args, void *argp) { 25 | uid = taiHookFunctionExportForKernel(KERNEL_PID, 26 | &ksceVfsNodeInitializePartitionRef, 27 | "SceIofilemgr", 28 | TAI_ANY_LIBRARY, 29 | 0xA5A6A55C, 30 | ksceVfsNodeInitializePartitionPatched); 31 | return SCE_KERNEL_START_SUCCESS; 32 | } 33 | 34 | int module_stop(SceSize args, void *argp) { 35 | if (uid >= 0) 36 | taiHookReleaseForKernel(uid, ksceVfsNodeInitializePartitionRef); 37 | return SCE_KERNEL_STOP_SUCCESS; 38 | } 39 | --------------------------------------------------------------------------------