Skip to content

Commit

Permalink
Updated for 3.65/3.67
Browse files Browse the repository at this point in the history
  • Loading branch information
IDBurner committed Mar 14, 2018
1 parent 4fde79a commit e2bd41b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
2 changes: 1 addition & 1 deletion main.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int check_safe_mode(void) {
}

int check_enso(void) {
return exists("ur0:tai/boot_config.txt");
return exists("ur0:tai/boot_config.txt") || exists("vs0:tai/boot_config.txt");
}

int copy_file(const char *dst, const char *src) {
Expand Down
1 change: 0 additions & 1 deletion plugin/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ target_link_libraries(usbmc
SceIofilemgrForDriver_stub
SceSysclibForDriver_stub
SceSysmemForDriver_stub
SceModulemgrForKernel_stub
SceModulemgrForDriver_stub
SceThreadmgrForDriver_stub
taihenForKernel_stub
Expand Down
43 changes: 38 additions & 5 deletions plugin/main.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
const char check_patch[] = { 0x01, 0x20, 0x01, 0x20 };

// External functions
int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uint32_t funcnid, uintptr_t *func);
int module_get_offset(SceUID pid, SceUID modid, int segidx, size_t offset, uintptr_t *addr);

// Structs
Expand Down Expand Up @@ -127,18 +128,50 @@ int importFindMountPointFunction() {
return -1;

// Get important function
module_get_offset(KERNEL_PID, info.modid, 0, 0x138C1, (uintptr_t *)&sceIoFindMountPoint);
switch (info.module_nid) {
case 0x9642948C: // 3.60 retail
module_get_offset(KERNEL_PID, info.modid, 0, 0x138C1, (uintptr_t *)&sceIoFindMountPoint);
break;

case 0xA96ACE9D: // 3.65 retail
case 0x3347A95F: // 3.67 retail
module_get_offset(KERNEL_PID, info.modid, 0, 0x182F5, (uintptr_t *)&sceIoFindMountPoint);
break;

default:
return 0;
}

return 0;
}

SceUID loadSceUsbMassModule() {
int (* _ksceKernelMountBootfs)(const char *bootImagePath);
int (* _ksceKernelUmountBootfs)(void);
int ret;

ret = module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0xC445FA63, 0x01360661, (uintptr_t *)&_ksceKernelMountBootfs);
if (ret < 0)
ret = module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0x92C9FFC2, 0x185FF1BC, (uintptr_t *)&_ksceKernelMountBootfs);
if (ret < 0)
return SCE_KERNEL_START_NO_RESIDENT;

ret = module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0xC445FA63, 0x9C838A6B, (uintptr_t *)&_ksceKernelUmountBootfs);
if (ret < 0)
ret = module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0x92C9FFC2, 0xBD61AD4D, (uintptr_t *)&_ksceKernelUmountBootfs);
if (ret < 0)
return SCE_KERNEL_START_NO_RESIDENT;

SceUID moduleId;
if (ksceKernelMountBootfs("os0:kd/bootimage.skprx") >= 0) { // Try loading from bootimage

// First Try loading bootimage
if (_ksceKernelMountBootfs("os0:kd/bootimage.skprx") >= 0) {
moduleId = ksceKernelLoadModule("os0:kd/umass.skprx", 0x800, NULL);
ksceKernelUmountBootfs();
} else // Try loading from VitaShell
_ksceKernelUmountBootfs();
} else {
// try loading from VitaShell
moduleId = ksceKernelLoadModule("ux0:VitaShell/module/umass.skprx", 0, NULL);
}

return moduleId;
}
Expand Down Expand Up @@ -220,4 +253,4 @@ int module_stop(SceSize args, void *argp) {
if (safeModeHookId >= 0)
taiHookReleaseForKernel(safeModeHookId, ksceSysrootIsSafeModeRef);
return SCE_KERNEL_STOP_SUCCESS;
}
}

0 comments on commit e2bd41b

Please sign in to comment.