Fixed usb

This commit is contained in:
TheFloW 2018-08-27 10:33:07 +02:00
parent 2ca899c1c7
commit c559a8a0fd
6 changed files with 33 additions and 29 deletions

View File

@ -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.94")
set(VITA_VERSION "01.95")
# 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")
@ -205,6 +205,6 @@ add_custom_target(send
)
add_custom_target(copy
COMMAND cp eboot.bin H:/app/${VITA_TITLEID}/eboot.bin
COMMAND cp eboot.bin G:/app/${VITA_TITLEID}/eboot.bin
DEPENDS eboot.bin
)

View File

@ -102,7 +102,12 @@ Credits
Changelog
---------
### Changelog 1.95
- Fixed bug in USB connection, where your Memory Card could be corrupted.
### Changelog 1.94
- Added ability to umount all partitions that you can mount.
- Fixed crash when using StorageMgr.

2
main.h
View File

@ -54,7 +54,7 @@
// VitaShell version major.minor
#define VITASHELL_VERSION_MAJOR 0x01
#define VITASHELL_VERSION_MINOR 0x94
#define VITASHELL_VERSION_MINOR 0x95
#define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10))

View File

@ -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.94</str>
<str size="18" color="#ffffff" shadow="on">v1.95</str>
</text>
</liveitem>
</frame>

View File

@ -207,7 +207,7 @@ PLEASE_WAIT = "Please wait..."
MEMORY_CARD_NOT_FOUND = "Please insert a Memory Card."
GAME_CARD_NOT_FOUND = "Please insert a Game Card."
MICROSD_NOT_FOUND = "Please insert a microSD."
NO_SPACE_ERROR = "There is not enough free space on the memory\card.\At least %s more space is needed."
NO_SPACE_ERROR = "There is not enough free space on the Memory\Card.\At least %s more space is needed."
EXTENDED_PERMISSIONS_REQUIRED = "This feature requires extended permissions.\Please activate 'Enable unsafe homebrew' first."
WIFI_ERROR = "You must use Wi-Fi to do this."
FTP_SERVER = "FTP server is now running at\ftp://%s:%i\\Select 'OK' to keep it in background.\Select 'Cancel' to disconnect."

47
usb.c
View File

@ -135,7 +135,6 @@ int umountUsbUx0() {
int remount_uma0 = 0, remount_xmc0 = 0, remount_imc0 = 0, remount_ux0 = 0;
void remount_partitions() {
// Remount partitions
if (remount_ux0)
vshIoMount(0x800, NULL, 0, 0, 0, 0);
if (remount_imc0)
@ -154,6 +153,28 @@ SceUID startUsb(const char *usbDevicePath, const char *imgFilePath, int type) {
// Destroy other apps
sceAppMgrDestroyOtherApp();
// Load and start usbdevice module
res = taiLoadStartKernelModule(usbDevicePath, 0, NULL, 0);
if (res < 0)
goto ERROR_LOAD_MODULE;
modid = res;
// Stop MTP driver
res = sceMtpIfStopDriver(1);
if (res < 0)
goto ERROR_STOP_DRIVER;
// Set device information
res = sceUsbstorVStorSetDeviceInfo("\"PS Vita\" MC", "1.00");
if (res < 0)
goto ERROR_USBSTOR_VSTOR;
// Set image file path
res = sceUsbstorVStorSetImgFilePath(imgFilePath);
if (res < 0)
goto ERROR_USBSTOR_VSTOR;
// Umount all partitions
remount_uma0 = remount_xmc0 = remount_imc0 = remount_ux0 = 0;
if (checkFolderExist("uma0:")) {
@ -173,28 +194,6 @@ SceUID startUsb(const char *usbDevicePath, const char *imgFilePath, int type) {
remount_ux0 = 1;
}
// Load and start usbdevice module
res = taiLoadStartKernelModule(usbDevicePath, 0, NULL, 0);
if (res < 0)
goto ERROR_LOAD_MODULE;
modid = res;
// Stop MTP driver
res = sceMtpIfStopDriver(1);
if (res < 0 && res != 0x8054360C)
goto ERROR_STOP_DRIVER;
// Set device information
res = sceUsbstorVStorSetDeviceInfo("\"PS Vita\" MC", "1.00");
if (res < 0)
goto ERROR_USBSTOR_VSTOR;
// Set image file path
res = sceUsbstorVStorSetImgFilePath(imgFilePath);
if (res < 0)
goto ERROR_USBSTOR_VSTOR;
// Start USB storage
res = sceUsbstorVStorStart(type);
if (res < 0)
@ -203,13 +202,13 @@ SceUID startUsb(const char *usbDevicePath, const char *imgFilePath, int type) {
return modid;
ERROR_USBSTOR_VSTOR:
remount_partitions();
sceMtpIfStartDriver(1);
ERROR_STOP_DRIVER:
taiStopUnloadKernelModule(modid, 0, NULL, 0, NULL, NULL);
ERROR_LOAD_MODULE:
remount_partitions();
return res;
}