Skip to content

Commit

Permalink
Update v1.93
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Jun 17, 2018
1 parent a4ea561 commit 475d5e4
Show file tree
Hide file tree
Showing 21 changed files with 138 additions and 41 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ project(VitaShell)
include("${VITASDK}/share/vita.cmake" REQUIRED)
set(VITA_APP_NAME "VitaShell")
set(VITA_TITLEID "VITASHELL")
set(VITA_VERSION "01.91")
set(VITA_VERSION "01.92")

# Flags and includes
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-format-truncation -fno-lto")
Expand Down Expand Up @@ -193,6 +193,7 @@ add_custom_target(release
COMMAND cp eboot.bin ../release/eboot.bin
COMMAND cp VitaShell.vpk_param.sfo ../release/param.sfo
COMMAND cp VitaShell.vpk ../release/VitaShell.vpk
COMMAND cp ../pkg/sce_sys/livearea/contents/template.xml ../release/template.xml
DEPENDS eboot.bin
DEPENDS VitaShell.vpk
DEPENDS VitaShell.vpk_param.sfo
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ Credits
Changelog
---------

### Changelog 1.92
- Added ability to mount gamesd ux0:
- Fixed bug where the VitaShell kernel module was loaded but not started, thus it'd run out of memory after some launches.

### Changelog 1.91
- Added ability to create new files, thanks to abertschi.
- Added ability to skip last dir by holding L on startup.
Expand Down
14 changes: 12 additions & 2 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,18 @@ void initVitaShell() {
installDefaultFiles();

// Load modules
patch_modid = taiLoadStartKernelModule("ux0:VitaShell/module/patch.skprx", 0, NULL, 0);
kernel_modid = taiLoadStartKernelModule("ux0:VitaShell/module/kernel.skprx", 0, NULL, 0);
patch_modid = taiLoadKernelModule("ux0:VitaShell/module/patch.skprx", 0, NULL);
if (patch_modid >= 0) {
int res = taiStartKernelModule(patch_modid, 0, NULL, 0, NULL, NULL);
if (res < 0)
taiStopUnloadKernelModule(patch_modid, 0, NULL, 0, NULL, NULL);
}
kernel_modid = taiLoadKernelModule("ux0:VitaShell/module/kernel.skprx", 0, NULL);
if (kernel_modid >= 0) {
int res = taiStartKernelModule(kernel_modid, 0, NULL, 0, NULL, NULL);
if (res < 0)
taiStopUnloadKernelModule(kernel_modid, 0, NULL, 0, NULL, NULL);
}
user_modid = sceKernelLoadStartModule("ux0:VitaShell/module/user.suprx", 0, NULL, 0, NULL, NULL);
}

Expand Down
4 changes: 4 additions & 0 deletions language.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ void loadLanguage(int id) {
LANGUAGE_ENTRY(MOUNT_IMC0),
LANGUAGE_ENTRY(MOUNT_USB_UX0),
LANGUAGE_ENTRY(UMOUNT_USB_UX0),
LANGUAGE_ENTRY(MOUNT_GAMECARD_UX0),
LANGUAGE_ENTRY(UMOUNT_GAMECARD_UX0),
LANGUAGE_ENTRY(SORT_BY),
LANGUAGE_ENTRY(BY_NAME),
LANGUAGE_ENTRY(BY_SIZE),
Expand Down Expand Up @@ -230,6 +232,8 @@ void loadLanguage(int id) {
LANGUAGE_ENTRY(USB_UMA0_MOUNTED),
LANGUAGE_ENTRY(USB_UX0_MOUNTED),
LANGUAGE_ENTRY(USB_UX0_UMOUNTED),
LANGUAGE_ENTRY(GAMECARD_UX0_MOUNTED),
LANGUAGE_ENTRY(GAMECARD_UX0_UMOUNTED),
LANGUAGE_ENTRY(USB_NOT_CONNECTED),
LANGUAGE_ENTRY(USB_CONNECTION_NOT_AVAILABLE),
LANGUAGE_ENTRY(USB_WAIT_ATTACH),
Expand Down
4 changes: 4 additions & 0 deletions language.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ enum LanguageContainer {
MOUNT_IMC0,
MOUNT_USB_UX0,
UMOUNT_USB_UX0,
MOUNT_GAMECARD_UX0,
UMOUNT_GAMECARD_UX0,
SORT_BY,
BY_NAME,
BY_SIZE,
Expand Down Expand Up @@ -192,6 +194,8 @@ enum LanguageContainer {
USB_UMA0_MOUNTED,
USB_UX0_MOUNTED,
USB_UX0_UMOUNTED,
GAMECARD_UX0_MOUNTED,
GAMECARD_UX0_UMOUNTED,

// QR strings
QR_SCANNING,
Expand Down
2 changes: 1 addition & 1 deletion main.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

// VitaShell version major.minor
#define VITASHELL_VERSION_MAJOR 0x01
#define VITASHELL_VERSION_MINOR 0x91
#define VITASHELL_VERSION_MINOR 0x92

#define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10))

Expand Down
33 changes: 33 additions & 0 deletions main_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ enum MenuHomeEntrys {
MENU_HOME_ENTRY_MOUNT_IMC0,
MENU_HOME_ENTRY_MOUNT_USB_UX0,
MENU_HOME_ENTRY_UMOUNT_USB_UX0,
MENU_HOME_ENTRY_MOUNT_GAMECARD_UX0,
MENU_HOME_ENTRY_UMOUNT_GAMECARD_UX0,
};

MenuEntry menu_home_entries[] = {
Expand All @@ -49,6 +51,8 @@ MenuEntry menu_home_entries[] = {
{ MOUNT_IMC0, 3, 0, CTX_INVISIBLE },
{ MOUNT_USB_UX0, 5, 0, CTX_INVISIBLE },
{ UMOUNT_USB_UX0, 6, 0, CTX_INVISIBLE },
{ MOUNT_GAMECARD_UX0, 8, 0, CTX_INVISIBLE },
{ UMOUNT_GAMECARD_UX0,9, 0, CTX_INVISIBLE },
};

#define N_MENU_HOME_ENTRIES (sizeof(menu_home_entries) / sizeof(MenuEntry))
Expand Down Expand Up @@ -333,6 +337,17 @@ void setContextMenuHomeVisibilities() {
menu_home_entries[MENU_HOME_ENTRY_UMOUNT_USB_UX0].visibility = CTX_INVISIBLE;
}

if (!checkFileExist("sdstor0:gcd-lp-ign-entire")) {
menu_home_entries[MENU_HOME_ENTRY_MOUNT_GAMECARD_UX0].visibility = CTX_INVISIBLE;
menu_home_entries[MENU_HOME_ENTRY_UMOUNT_GAMECARD_UX0].visibility = CTX_INVISIBLE;
} else {
if ((kernel_modid >= 0 || kernel_modid == 0x8002D013) && user_modid >= 0 && shellUserIsUx0Redirected() == 1) {
menu_home_entries[MENU_HOME_ENTRY_MOUNT_GAMECARD_UX0].visibility = CTX_INVISIBLE;
} else {
menu_home_entries[MENU_HOME_ENTRY_UMOUNT_GAMECARD_UX0].visibility = CTX_INVISIBLE;
}
}

// Invisible if already mounted or there is no internal storage
if (!checkFileExist("sdstor0:int-lp-ign-userext") || checkFolderExist("imc0:"))
menu_home_entries[MENU_HOME_ENTRY_MOUNT_IMC0].visibility = CTX_INVISIBLE;
Expand Down Expand Up @@ -663,6 +678,24 @@ static int contextMenuHomeEnterCallback(int sel, void *context) {
}
break;
}

case MENU_HOME_ENTRY_MOUNT_GAMECARD_UX0:
{
if (mountGamecardUx0() >= 0) {
infoDialog(language_container[GAMECARD_UX0_MOUNTED]);
refreshFileList();
}
break;
}

case MENU_HOME_ENTRY_UMOUNT_GAMECARD_UX0:
{
if (umountGamecardUx0() >= 0) {
infoDialog(language_container[GAMECARD_UX0_UMOUNTED]);
refreshFileList();
}
break;
}
}

return CONTEXT_MENU_CLOSING;
Expand Down
17 changes: 11 additions & 6 deletions modules/kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ typedef struct {
int unk7;
} SceIoMountPoint;

static SceIoDevice uma_ux0_dev = { "ux0:", "exfatux0", "sdstor0:uma-pp-act-a", "sdstor0:uma-lp-act-entire", MOUNT_POINT_ID };
static char ux0_blkdev[64], ux0_blkdev2[64];

static SceIoDevice ux0_dev = { "ux0:", "exfatux0", ux0_blkdev, ux0_blkdev2, MOUNT_POINT_ID };

static SceIoMountPoint *(* sceIoFindMountPoint)(int id) = NULL;

Expand Down Expand Up @@ -89,7 +91,7 @@ int shellKernelIsUx0Redirected() {
return -1;
}

if (mount->dev == &uma_ux0_dev && mount->dev2 == &uma_ux0_dev) {
if (mount->dev == &ux0_dev && mount->dev2 == &ux0_dev) {
EXIT_SYSCALL(state);
return 1;
}
Expand All @@ -98,7 +100,7 @@ int shellKernelIsUx0Redirected() {
return 0;
}

int shellKernelRedirectUx0() {
int shellKernelRedirectUx0(const char *blkdev, const char *blkdev2) {
uint32_t state;
ENTER_SYSCALL(state);

Expand All @@ -108,13 +110,16 @@ int shellKernelRedirectUx0() {
return -1;
}

if (mount->dev != &uma_ux0_dev && mount->dev2 != &uma_ux0_dev) {
if (mount->dev != &ux0_dev && mount->dev2 != &ux0_dev) {
ori_dev = mount->dev;
ori_dev2 = mount->dev2;
}

mount->dev = &uma_ux0_dev;
mount->dev2 = &uma_ux0_dev;
ksceKernelStrncpyUserToKernel(ux0_blkdev, blkdev, sizeof(ux0_blkdev)-1);
ksceKernelStrncpyUserToKernel(ux0_blkdev2, blkdev2, sizeof(ux0_blkdev2)-1);

mount->dev = &ux0_dev;
mount->dev2 = &ux0_dev;

EXIT_SYSCALL(state);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion modules/kernel/vitashell_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct {
} ShellMountIdArgs;

int shellKernelIsUx0Redirected();
int shellKernelRedirectUx0();
int shellKernelRedirectUx0(const char *blkdev, const char *blkdev2);
int shellKernelUnredirectUx0();
int shellKernelMountById(ShellMountIdArgs *args);
int shellKernelGetRifVitaKey(const void *license_buf, void *klicensee);
Expand Down
4 changes: 2 additions & 2 deletions modules/user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ int shellUserIsUx0Redirected() {
return shellKernelIsUx0Redirected();
}

int shellUserRedirectUx0() {
return shellKernelRedirectUx0();
int shellUserRedirectUx0(const char *blkdev, const char *blkdev2) {
return shellKernelRedirectUx0(blkdev, blkdev2);
}

int shellUserUnredirectUx0() {
Expand Down
2 changes: 1 addition & 1 deletion modules/user/vitashell_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <vitashell_kernel.h>

int shellUserIsUx0Redirected();
int shellUserRedirectUx0();
int shellUserRedirectUx0(const char *blkdev, const char *blkdev2);
int shellUserUnredirectUx0();
int shellUserMountById(ShellMountIdArgs *args);
int shellUserGetRifVitaKey(const void *license_buf, void *klicensee);
Expand Down
2 changes: 1 addition & 1 deletion pkg/sce_sys/livearea/contents/template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<frame id="frame4">
<liveitem>
<text align="left" text-align="left" word-wrap="off" ellipsis="on">
<str size="18" color="#ffffff" shadow="on">v1.91</str>
<str size="18" color="#ffffff" shadow="on">v1.92</str>
</text>
</liveitem>
</frame>
Expand Down
Binary file modified release/VitaShell.vpk
Binary file not shown.
Binary file modified release/eboot.bin
Binary file not shown.
Binary file modified release/param.sfo
Binary file not shown.
2 changes: 1 addition & 1 deletion release/template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<frame id="frame4">
<liveitem>
<text align="left" text-align="left" word-wrap="off" ellipsis="on">
<str size="18" color="#ffffff" shadow="on">v1.91</str>
<str size="18" color="#ffffff" shadow="on">v1.92</str>
</text>
</liveitem>
</frame>
Expand Down
Binary file modified release/version.bin
Binary file not shown.
4 changes: 4 additions & 0 deletions resources/english_us.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ MOUNT_UMA0 = "Mount uma0:"
MOUNT_IMC0 = "Mount imc0:"
MOUNT_USB_UX0 = "Mount USB ux0:"
UMOUNT_USB_UX0 = "Umount USB ux0:"
MOUNT_GAMECARD_UX0 = "Mount gamecard ux0:"
UMOUNT_GAMECARD_UX0 = "Umount gamecard ux0:"
SORT_BY = "Sort by"
BY_NAME = "By name"
BY_SIZE = "By size"
Expand Down Expand Up @@ -170,6 +172,8 @@ USB_CONNECTED = "USB connected"
USB_UMA0_MOUNTED = "uma0: mounted."
USB_UX0_MOUNTED = "USB ux0: mounted."
USB_UX0_UMOUNTED = "USB ux0: umounted."
GAMECARD_UX0_MOUNTED = "gamecard ux0: mounted."
GAMECARD_UX0_uMOUNTED = "gamecard ux0: umounted."
USB_NOT_CONNECTED = "Connect this system to a PC system using a USB cable."
USB_CONNECTION_NOT_AVAILABLE = "USB connection is not available on this device."
USB_WAIT_ATTACH = "Please attach an USB flash drive to continue.\If it has already been attached, please detach\and reattach it."
Expand Down
Binary file modified resources/kernel.skprx
Binary file not shown.
79 changes: 54 additions & 25 deletions usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,58 @@
#include "file.h"
#include "utils.h"

int mountGamecardUx0() {
// Destroy other apps
sceAppMgrDestroyOtherApp();

// Copy VitaShell
copyPath("ux0:app/VITASHELL", "ur0:temp/app", NULL);
copyPath("ux0:appmeta/VITASHELL", "ur0:temp/appmeta", NULL);
copyPath("ux0:license/app/VITASHELL", "ur0:temp/license", NULL);

// Redirect ux0: to gamecard
shellUserRedirectUx0("sdstor0:gcd-lp-ign-entire", "sdstor0:gcd-lp-ign-entire");

// Remount Memory Card
remount(0x800);

// Create dirs
sceIoMkdir("ux0:app", 0006);
sceIoMkdir("ux0:appmeta", 0006);
sceIoMkdir("ux0:license", 0006);
sceIoMkdir("ux0:license/app", 0006);
sceIoMkdir("ux0:app/VITASHELL", 0006);
sceIoMkdir("ux0:appmeta/VITASHELL", 0006);
sceIoMkdir("ux0:license/app/VITASHELL", 0006);

// Create important dirs
sceIoMkdir("ux0:data", 0777);
sceIoMkdir("ux0:temp", 0006);

// Remove lastdir.txt file
sceIoRemove("ux0:VitaShell/internal/lastdir.txt");

// Copy VitaShell
copyPath("ur0:temp/app", "ux0:app/VITASHELL", NULL);
copyPath("ur0:temp/appmeta", "ux0:appmeta/VITASHELL", NULL);
copyPath("ur0:temp/license", "ux0:license/app/VITASHELL", NULL);

return 0;
}

int umountGamecardUx0() {
// Destroy other apps
sceAppMgrDestroyOtherApp();

// Restore ux0: patch
shellUserUnredirectUx0();

// Remount Memory Card
remount(0x800);

return 0;
}

int mountUsbUx0() {
// Destroy other apps
sceAppMgrDestroyOtherApp();
Expand All @@ -30,41 +82,24 @@ int mountUsbUx0() {
sceIoMkdir("uma0:appmeta", 0006);
sceIoMkdir("uma0:license", 0006);
sceIoMkdir("uma0:license/app", 0006);
sceIoMkdir("uma0:app/MLCL00001", 0006);
sceIoMkdir("uma0:appmeta/MLCL00001", 0006);
sceIoMkdir("uma0:license/app/MLCL00001", 0006);
sceIoMkdir("uma0:app/VITASHELL", 0006);
sceIoMkdir("uma0:appmeta/VITASHELL", 0006);
sceIoMkdir("uma0:license/app/VITASHELL", 0006);

// Copy molecularShell and VitaShell
copyPath("ux0:app/MLCL00001", "uma0:app/MLCL00001", NULL);
copyPath("ux0:appmeta/MLCL00001", "uma0:appmeta/MLCL00001", NULL);
copyPath("ux0:license/app/MLCL00001", "uma0:license/app/MLCL00001", NULL);
// Copy VitaShell
copyPath("ux0:app/VITASHELL", "uma0:app/VITASHELL", NULL);
copyPath("ux0:appmeta/VITASHELL", "uma0:appmeta/VITASHELL", NULL);
copyPath("ux0:license/app/VITASHELL", "uma0:license/app/VITASHELL", NULL);

// Create important dirs
sceIoMkdir("uma0:data", 0777);
sceIoMkdir("uma0:temp", 0006);
sceIoMkdir("uma0:temp/app_work/", 0006);
sceIoMkdir("uma0:temp/app_work/MLCL00001", 0006);
sceIoMkdir("uma0:temp/app_work/MLCL00001/rec", 0006);

// Copy important files
copyPath("ux0:calendar", "uma0:calendar", NULL);
copyPath("ux0:mms", "uma0:mms", NULL);
copyPath("ux0:mtp", "uma0:mtp", NULL);
copyPath("ux0:temp/app_work/MLCL00001/rec/config.bin", "uma0:temp/app_work/MLCL00001/rec/config.bin", NULL);
copyPath("ux0:iconlayout.ini", "uma0:iconlayout.ini", NULL);
copyPath("ux0:id.dat", "uma0:id.dat", NULL);

// Remove lastdir.txt file
sceIoRemove("uma0:VitaShell/internal/lastdir.txt");

// Redirect ux0: to uma0:
shellUserRedirectUx0();
shellUserRedirectUx0("sdstor0:uma-pp-act-a", "sdstor0:uma-lp-act-entire");

// Umount uma0:
vshIoUmount(0xF00, 0, 0, 0);
Expand All @@ -88,12 +123,6 @@ int umountUsbUx0() {
// Remount uma0:
remount(0xF00);

// Copy back important files
copyPath("uma0:calendar", "ux0:calendar", NULL);
copyPath("uma0:mms", "ux0:mms", NULL);
copyPath("uma0:mtp", "ux0:mtp", NULL);
copyPath("uma0:iconlayout.ini", "ux0:iconlayout.ini", NULL);

return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#ifndef __USB_H__
#define __USB_H__

int mountGamecardUx0();
int umountGamecardUx0();

int mountUsbUx0();
int umountUsbUx0();

Expand Down

0 comments on commit 475d5e4

Please sign in to comment.