Skip to content

Commit

Permalink
Fixed ksceIoMount params
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanlu committed Jun 17, 2017
1 parent 6ce7394 commit 44f8542
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,51 +83,28 @@ static int exists(const char *path) {
return 1;
}

static int io_mount(int id, const char *path, int permission, int a4, int a5, int a6) {
uint32_t buf[6];

buf[0] = a4;
buf[1] = a5;
buf[2] = a6;
buf[3] = 0;
buf[4] = 0;
buf[5] = 0;

return ksceIoMount(id, path, permission, buf);
}

static void io_remount(int id) {
ksceIoUmount(id, 0, 0, 0);
ksceIoUmount(id, 1, 0, 0);
io_mount(id, NULL, 0, 0, 0, 0);
ksceIoMount(id, NULL, 0, 0, 0, 0);
}

int shellKernelIsUx0Redirected() {
uint32_t state;
ENTER_SYSCALL(state);

SceIoMountPoint *mount = sceIoFindMountPoint(MOUNT_POINT_ID);
if (!mount) {
EXIT_SYSCALL(state);
return -1;
}

if (mount->dev == &uma_ux0_dev && mount->dev2 == &uma_ux0_dev) {
EXIT_SYSCALL(state);
return 1;
}

EXIT_SYSCALL(state);
return 0;
}

int shellKernelRedirectUx0() {
uint32_t state;
ENTER_SYSCALL(state);

SceIoMountPoint *mount = sceIoFindMountPoint(MOUNT_POINT_ID);
if (!mount) {
EXIT_SYSCALL(state);
return -1;
}

Expand All @@ -139,17 +116,12 @@ int shellKernelRedirectUx0() {
mount->dev = &uma_ux0_dev;
mount->dev2 = &uma_ux0_dev;

EXIT_SYSCALL(state);
return 0;
}

int shellKernelUnredirectUx0() {
uint32_t state;
ENTER_SYSCALL(state);

SceIoMountPoint *mount = sceIoFindMountPoint(MOUNT_POINT_ID);
if (!mount) {
EXIT_SYSCALL(state);
return -1;
}

Expand All @@ -161,7 +133,6 @@ int shellKernelUnredirectUx0() {
ori_dev2 = NULL;
}

EXIT_SYSCALL(state);
return 0;
}

Expand Down Expand Up @@ -211,7 +182,6 @@ int module_start(SceSize args, void *argp) {

// start memory card redirection if we don't disable it
if (exists("sdstor0:uma-lp-act-entire") && !exists("ur0:DISABLE_USB_MC.txt") && !shellKernelIsUx0Redirected()) {
ksceIoUmount(0xF00, 0, 0, 0);
shellKernelRedirectUx0();
io_remount(MOUNT_POINT_ID);
}
Expand Down

0 comments on commit 44f8542

Please sign in to comment.