Skip to content

Commit

Permalink
Update v1.61
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Mar 18, 2017
1 parent daf6b30 commit 16e2e1e
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 24 deletions.
2 changes: 1 addition & 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.60")
set(VITA_VERSION "01.61")

# Flags and includes
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -Wno-unused-variable -Wno-unused-but-set-variable -fno-lto")
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
VitaShell is an alternative replacement of the PS Vita's LiveArea. It offers you a file manager, package installer, built-in FTP and much more.
This homebrew was an entry of the Revitalize PS Vita homebrew competition and won the first prize. HENkaku's molecularShell is also based on VitaShell.

### Donation ###
In case you want to support my work on the vita, you can always spend me some beer. Any cent is highly appreciated: goo.gl/uAIPIY

### How to use an USB flash drive as Memory Card on a PS TV ###
- Format your USB flash drive as exFAT or FAT32.
- Launch VitaShell and press /\ in the 'home' section.
- Select 'Mount uma0:' and attach your USB flash drive. You can now copy stuff from/to your USB stick.
- Once 'uma0:' is listed under the partitions, press /\ again and choose 'Mount USB ux0:'.
- Once 'uma0:' is listed under the partitions, press /\ again and choose 'Mount USB ux0:'. This will copy important apps like VitaShell, molecularShell, and other files.
- Your USB flash drive is now acting as a Memory Card.
- To sync all your apps on your USB flash drive, press /\ and choose 'Refresh livearea'. This will NOT refresh PSP games.
- If you wish to revert the patch, press /\ and select 'Umount USB ux0:'.
- Note that this patch is only temporary and you need to redo the procedure everytime you launch your PS TV.

### Customization ###
You can customize those files:
Expand Down Expand Up @@ -102,6 +106,11 @@ Be sure you pull request your customized design or language file there.
* sakya for Lightmp3
* Everybody who contributed on vitasdk

### Changelog 1.61 ###
- Fixed database corruption crash by inheriting 'calendar', 'mms' and 'mtp' when mounting USB ux0:.
- Fixed bug where insufficent memory dialog appeared on uma0:.
- Fixed bug where pressing triangle crashed if unsafe mode was disabled.

### Changelog 1.60 ###
- Added ability to mount uma0: and ability to use uma0: as ux0:.
- Added ability to mount game card as usb device.
Expand Down
6 changes: 4 additions & 2 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ char henkaku_config_path[32];

int is_safe_mode = 0, is_molecular_shell = 0;

SceUID kernel_modid = -1, user_modid = -1;

// System params
int language = 0, enter_button = 0, date_format = 0, time_format = 0;

Expand Down Expand Up @@ -379,8 +381,8 @@ void initVitaShell() {
installDefaultFiles();

// Load modules
taiLoadStartKernelModule("ux0:VitaShell/module/kernel.skprx", 0, NULL, 0);
sceKernelLoadStartModule("ux0:VitaShell/module/user.suprx", 0, NULL, 0, NULL, NULL);
kernel_modid = taiLoadStartKernelModule("ux0:VitaShell/module/kernel.skprx", 0, NULL, 0);
user_modid = sceKernelLoadStartModule("ux0:VitaShell/module/user.suprx", 0, NULL, 0, NULL, NULL);
}

void finishVitaShell() {
Expand Down
2 changes: 2 additions & 0 deletions init.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ extern char henkaku_config_path[32];

extern int is_safe_mode, is_molecular_shell;

extern SceUID kernel_modid, user_modid;

extern int language, enter_button, date_format, time_format;

typedef struct {
Expand Down
4 changes: 2 additions & 2 deletions io_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
}

// Check memory card free space
if (checkMemoryCardFreeSpace(size))
if (checkMemoryCardFreeSpace(args->file_list->path, size))
goto EXIT;

// Update thread
Expand Down Expand Up @@ -560,7 +560,7 @@ int export_thread(SceSize args_size, ExportArguments *args) {
}

// Check memory card free space
if (checkMemoryCardFreeSpace(size))
if (checkMemoryCardFreeSpace("ux0:", size))
goto EXIT;

// Update thread
Expand Down
11 changes: 4 additions & 7 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
#include "archiveRAR.h"
#include "usb.h"

/*
TODO:
- Theme manager
- PFS bypass
*/

int _newlib_heap_size_user = 128 * 1024 * 1024;

// Dialog step
Expand Down Expand Up @@ -1625,7 +1619,10 @@ int main(int argc, const char *argv[]) {
// Remount uma0:
remount(0xF00);

// Copy back iconlayout.ini
// 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);

infoDialog(language_container[USB_UX0_UMOUNTED]);
Expand Down
2 changes: 1 addition & 1 deletion main.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

// VitaShell version major.minor
#define VITASHELL_VERSION_MAJOR 0x01
#define VITASHELL_VERSION_MINOR 0x60
#define VITASHELL_VERSION_MINOR 0x61

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

Expand Down
2 changes: 1 addition & 1 deletion main_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void setContextMenuHomeVisibilities() {
menu_home_entries[MENU_HOME_ENTRY_MOUNT_USB_UX0].visibility = CTX_INVISIBLE;
}

if (shellUserIsUx0Redirected() == 1) {
if ((kernel_modid >= 0 || kernel_modid == 0x8002D013) && user_modid >= 0 && shellUserIsUx0Redirected() == 1) {
menu_home_entries[MENU_HOME_ENTRY_MOUNT_UMA0].visibility = CTX_INVISIBLE;
menu_home_entries[MENU_HOME_ENTRY_MOUNT_USB_UX0].visibility = CTX_INVISIBLE;
} else {
Expand Down
2 changes: 1 addition & 1 deletion makezip.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ int compress_thread(SceSize args_size, CompressArguments *args) {

// Check memory card free space
double guessed_size = (double)size * 0.7f;
if (checkMemoryCardFreeSpace((uint64_t)guessed_size))
if (checkMemoryCardFreeSpace(args->path, (uint64_t)guessed_size))
goto EXIT;

// Update thread
Expand Down
2 changes: 1 addition & 1 deletion package_installer.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
getArchivePathInfo(src_path, &size, &folders, &files);

// Check memory card free space
if (checkMemoryCardFreeSpace(size))
if (checkMemoryCardFreeSpace(PACKAGE_DIR, size))
goto EXIT;

// Update thread
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.60</str>
<str size="18" color="#ffffff" shadow="on">v1.61</str>
</text>
</liveitem>
</frame>
Expand Down
7 changes: 7 additions & 0 deletions resources/changeinfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,11 @@
- Made control smoother.<br>
]]>
</changes>
<changes app_ver="01.61">
<![CDATA[
- Fixed database corruption crash by inheriting 'calendar', 'mms' and 'mtp' when mounting USB ux0:.<br>
- Fixed bug where insufficent memory dialog appeared on uma0:.<br>
- Fixed bug where pressing triangle crashed if unsafe mode was disabled.<br>
]]>
</changes>
</changeinfo>
3 changes: 3 additions & 0 deletions usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ int mountUsbUx0() {
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);
Expand Down
31 changes: 26 additions & 5 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "main.h"
#include "init.h"
#include "file.h"
#include "message_dialog.h"
#include "uncommon_dialog.h"
Expand Down Expand Up @@ -86,15 +87,35 @@ void infoDialog(const char *msg, ...) {
setDialogStep(DIALOG_STEP_INFO);
}

int checkMemoryCardFreeSpace(uint64_t size) {
uint64_t free_size = 0, max_size = 0;
sceAppMgrGetDevInfo("ux0:", &max_size, &free_size);
int checkMemoryCardFreeSpace(const char *path, uint64_t size) {
char device[8];
uint64_t free_size = 0, max_size = 0, extra_space = 0;

char *p = strchr(path, ':');
if (p) {
strncpy(device, path, p-path+1);
device[p-path+1] = '\0';
}

if (strcmp(device, "ux0:") == 0) {
extra_space = 40 * 1024 * 1024;
}

if (is_safe_mode) {
sceAppMgrGetDevInfo(device, &max_size, &free_size);
} else {
SceIoDevInfo info;
memset(&info, 0, sizeof(SceIoDevInfo));
sceIoDevctl(device, 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo));
free_size = info.free_size;
max_size = info.max_size;
}

if (size >= (free_size + (40 * 1024 * 1024))) {
if (size >= (free_size + extra_space)) {
closeWaitDialog();

char size_string[16];
getSizeString(size_string, size - (free_size + (40 * 1024 * 1024)));
getSizeString(size_string, size - (free_size + extra_space));
infoDialog(language_container[NO_SPACE_ERROR], size_string);

return 1;
Expand Down
2 changes: 1 addition & 1 deletion utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void closeWaitDialog();
void errorDialog(int error);
void infoDialog(const char *msg, ...);

int checkMemoryCardFreeSpace(uint64_t size);
int checkMemoryCardFreeSpace(const char *path, uint64_t size);

void initPowerTickThread();
void powerLock();
Expand Down

0 comments on commit 16e2e1e

Please sign in to comment.