From c6328a552dbc9356896bdd6c8c68066f02db5592 Mon Sep 17 00:00:00 2001 From: TheFloW Date: Thu, 12 Jan 2017 17:45:52 +0100 Subject: [PATCH] Release VitaShell 1.5 --- CMakeLists.txt | 26 +++-- README.md | 5 + archive.c | 2 +- archive.h | 2 +- audio/lrcparse.c | 2 +- audio/lrcparse.h | 2 +- audio/player.c | 2 +- audio/player.h | 2 +- audioplayer.c | 2 +- audioplayer.h | 2 +- config.c | 2 +- config.h | 2 +- context_menu.c | 2 +- context_menu.h | 2 +- coredump.c | 2 +- coredump.h | 2 +- elf.c | 2 +- file.c | 2 +- file.h | 2 +- henkaku_config.h | 2 +- hex.c | 2 +- hex.h | 2 +- ime_dialog.c | 2 +- ime_dialog.h | 2 +- init.c | 13 ++- init.h | 2 +- io_process.c | 2 +- io_process.h | 2 +- language.c | 10 +- language.h | 10 +- list_dialog.c | 2 +- list_dialog.h | 2 +- main.c | 117 ++++++++++++++++++--- main.h | 10 +- makezip.c | 2 +- makezip.h | 2 +- message_dialog.c | 2 +- message_dialog.h | 2 +- network_update.c | 2 +- network_update.h | 2 +- package_installer.c | 2 +- package_installer.h | 2 +- photo.c | 2 +- photo.h | 2 +- pkg/sce_sys/livearea/contents/template.xml | 2 +- property_dialog.c | 2 +- property_dialog.h | 2 +- resources/base_head_bin.h | 2 +- resources/changeinfo.txt | 7 ++ resources/english_us.txt | 11 +- resources/usbdevice.skprx | Bin 0 -> 2075 bytes settings.c | 100 +++++++++++++----- settings.h | 5 +- sfo.c | 2 +- sfo.h | 2 +- sha1.c | 1 + text.c | 2 +- text.h | 2 +- theme.c | 2 +- theme.h | 2 +- uncommon_dialog.c | 2 +- uncommon_dialog.h | 2 +- updater/main.c | 2 +- usbdevice/CMakeLists.txt | 27 +++++ usbdevice/exports.yml | 8 ++ usbdevice/main.c | 89 ++++++++++++++++ utils.c | 78 +++++++++++++- utils.h | 7 +- vitashell_config.h | 6 +- 69 files changed, 514 insertions(+), 116 deletions(-) create mode 100644 resources/usbdevice.skprx create mode 100644 usbdevice/CMakeLists.txt create mode 100644 usbdevice/exports.yml create mode 100644 usbdevice/main.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f80a5e1..8d39bf23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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.43") +set(VITA_VERSION "01.50") # Flags and includes set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -Wno-unused-variable -Wno-unused-but-set-variable -fno-lto") @@ -48,7 +48,7 @@ FUNCTION(ADD_RESOURCES out_var) SET(${out_var} "${result}" PARENT_SCOPE) ENDFUNCTION() -file(GLOB res_files RELATIVE ${CMAKE_SOURCE_DIR} resources/*.png resources/*.txt resources/*.bin) +file(GLOB res_files RELATIVE ${CMAKE_SOURCE_DIR} resources/*.png resources/*.txt resources/*.bin resources/*.skprx) add_resources(vitashell_res ${res_files}) add_executable(VitaShell @@ -117,6 +117,8 @@ target_link_libraries(VitaShell m c onigmo + unrar + stdc++ taihen_stub HENkaku_stub SceAppMgr_stub @@ -129,6 +131,7 @@ target_link_libraries(VitaShell SceGxm_stub SceIme_stub SceHttp_stub + SceMtpIfDriver_stub SceMusicExport_stub SceNet_stub SceNetCtl_stub @@ -140,13 +143,14 @@ target_link_libraries(VitaShell ScePower_stub ScePromoterUtil_stub SceTouch_stub - unrar - stdc++ + SceUdcd_stub + SceUsbstorVStorDriver_stub + SceVshBridge_stub ) # Create Vita artifacts -vita_create_self(VitaShell.self VitaShell UNSAFE) -vita_create_vpk(VitaShell.vpk ${VITA_TITLEID} VitaShell.self +vita_create_self(eboot.bin VitaShell UNSAFE) +vita_create_vpk(VitaShell.vpk ${VITA_TITLEID} eboot.bin VERSION ${VITA_VERSION} NAME ${VITA_APP_NAME} FILE pkg/sce_sys/icon0.png sce_sys/icon0.png @@ -154,3 +158,13 @@ vita_create_vpk(VitaShell.vpk ${VITA_TITLEID} VitaShell.self FILE pkg/sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png FILE pkg/sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml ) + +add_custom_target(send + COMMAND curl -T eboot.bin ftp://$(PSVITAIP):1337/ux0:/app/${VITA_TITLEID}/ + DEPENDS eboot.bin +) + +add_custom_target(copy + COMMAND cp eboot.bin F:/app/${VITA_TITLEID}/eboot.bin + DEPENDS eboot.bin +) \ No newline at end of file diff --git a/README.md b/README.md index c27509f6..512aab03 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,11 @@ Be sure you pull request your customized design or language file there. * sakya for Lightmp3 * Everybody who contributed on vitasdk +### Changelog 1.50 ### +- Added USB mass storage transfer support. +- Added RAR archive support (by Mayoshiroi). +- Added coredump viewer. + ### Changelog 1.43 ### - Added taiHEN config.txt reload option available in molecularShell. - Changed default HENkaku spoofed version to 3.63. diff --git a/archive.c b/archive.c index 001bf4a0..fbe1827b 100644 --- a/archive.c +++ b/archive.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/archive.h b/archive.h index 52024cc0..be25f934 100644 --- a/archive.h +++ b/archive.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/audio/lrcparse.c b/audio/lrcparse.c index 293bf9b6..161c1101 100644 --- a/audio/lrcparse.c +++ b/audio/lrcparse.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/audio/lrcparse.h b/audio/lrcparse.h index 96bc7f35..6f30cecf 100644 --- a/audio/lrcparse.h +++ b/audio/lrcparse.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/audio/player.c b/audio/player.c index cc73c4cb..8f44da2d 100644 --- a/audio/player.c +++ b/audio/player.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/audio/player.h b/audio/player.h index 7707203b..4b59e0d0 100644 --- a/audio/player.h +++ b/audio/player.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/audioplayer.c b/audioplayer.c index 17ff13ab..a93dcc48 100644 --- a/audioplayer.c +++ b/audioplayer.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/audioplayer.h b/audioplayer.h index 6b4f442b..10ba9555 100644 --- a/audioplayer.h +++ b/audioplayer.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/config.c b/config.c index 372e66e1..3075c1ab 100644 --- a/config.c +++ b/config.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/config.h b/config.h index 7f5ca8fb..4cc73992 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/context_menu.c b/context_menu.c index b8ebbdb1..34e7c622 100644 --- a/context_menu.c +++ b/context_menu.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/context_menu.h b/context_menu.h index 04294cef..f9e755c3 100644 --- a/context_menu.h +++ b/context_menu.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/coredump.c b/coredump.c index c9776f9d..114936ea 100644 --- a/coredump.c +++ b/coredump.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/coredump.h b/coredump.h index 2b4e3e39..a1ea15a8 100644 --- a/coredump.h +++ b/coredump.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/elf.c b/elf.c index 916fa3f2..333d9a2b 100644 --- a/elf.c +++ b/elf.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/file.c b/file.c index 3cc152f5..1b390822 100644 --- a/file.c +++ b/file.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/file.h b/file.h index 833452fb..5e966cff 100644 --- a/file.h +++ b/file.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/henkaku_config.h b/henkaku_config.h index 91506e33..31023e16 100644 --- a/henkaku_config.h +++ b/henkaku_config.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/hex.c b/hex.c index 95a6d919..7013b3e1 100644 --- a/hex.c +++ b/hex.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/hex.h b/hex.h index fef1cb43..b4a91f5c 100644 --- a/hex.h +++ b/hex.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ime_dialog.c b/ime_dialog.c index 09430b10..23b61d94 100644 --- a/ime_dialog.c +++ b/ime_dialog.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ime_dialog.h b/ime_dialog.h index a87f17ef..cba79e4d 100644 --- a/ime_dialog.h +++ b/ime_dialog.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/init.c b/init.c index 5d22afcd..13f363e6 100644 --- a/init.c +++ b/init.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,8 +22,6 @@ #include "package_installer.h" #include "utils.h" -INCLUDE_EXTERN_RESOURCE(changeinfo_txt); - INCLUDE_EXTERN_RESOURCE(folder_icon_png); INCLUDE_EXTERN_RESOURCE(file_icon_png); INCLUDE_EXTERN_RESOURCE(archive_icon_png); @@ -48,6 +46,10 @@ INCLUDE_EXTERN_RESOURCE(theme_txt); INCLUDE_EXTERN_RESOURCE(colors_txt); INCLUDE_EXTERN_RESOURCE(english_us_txt); +INCLUDE_EXTERN_RESOURCE(usbdevice_skprx); + +INCLUDE_EXTERN_RESOURCE(changeinfo_txt); + #define DEFAULT_FILE(path, name) { path, (void *)&_binary_resources_##name##_start, (int)&_binary_resources_##name##_size } static DefaultFile default_files[] = { @@ -74,7 +76,9 @@ static DefaultFile default_files[] = { DEFAULT_FILE("ux0:VitaShell/theme/Default/pause.png", pause_png), DEFAULT_FILE("ux0:VitaShell/theme/Default/fastforward.png", fastforward_png), DEFAULT_FILE("ux0:VitaShell/theme/Default/fastrewind.png", fastrewind_png), - + + DEFAULT_FILE("ux0:VitaShell/module/usbdevice.skprx", usbdevice_skprx), + DEFAULT_FILE("ux0:patch/VITASHELL/sce_sys/changeinfo/changeinfo.xml", changeinfo_txt), }; @@ -244,6 +248,7 @@ void initVitaShell() { sceIoMkdir("ux0:VitaShell", 0777); sceIoMkdir("ux0:VitaShell/internal", 0777); sceIoMkdir("ux0:VitaShell/language", 0777); + sceIoMkdir("ux0:VitaShell/module", 0777); sceIoMkdir("ux0:VitaShell/theme", 0777); sceIoMkdir("ux0:VitaShell/theme/Default", 0777); diff --git a/init.h b/init.h index c961be28..99d15ba4 100644 --- a/init.h +++ b/init.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/io_process.c b/io_process.c index c8a3c676..396a651b 100644 --- a/io_process.c +++ b/io_process.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/io_process.h b/io_process.h index 5ec7c8d4..3fd37d44 100644 --- a/io_process.h +++ b/io_process.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/language.c b/language.c index 1364789f..5b288837 100644 --- a/language.c +++ b/language.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -184,11 +184,19 @@ void loadLanguage(int id) { LANGUAGE_ENTRY(VITASHELL_SETTINGS_MAIN), LANGUAGE_ENTRY(VITASHELL_SETTINGS_LANGUAGE), LANGUAGE_ENTRY(VITASHELL_SETTINGS_THEME), + LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON), LANGUAGE_ENTRY(VITASHELL_SETTINGS_NO_AUTO_UPDATE), LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWER), LANGUAGE_ENTRY(VITASHELL_SETTINGS_REBOOT), LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWEROFF), LANGUAGE_ENTRY(VITASHELL_SETTINGS_STANDBY), + LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON_USB), + LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON_FTP), + + // USB strings + LANGUAGE_ENTRY(USB_CONNECTED), + LANGUAGE_ENTRY(USB_CONNECTION_PERMISSION), + LANGUAGE_ENTRY(USB_CONNECTION_NOT_AVAILABLE), // Others LANGUAGE_ENTRY(SAFE_MODE), diff --git a/language.h b/language.h index db8db4e6..9f17a55f 100644 --- a/language.h +++ b/language.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -143,11 +143,19 @@ enum LanguageContainer { VITASHELL_SETTINGS_MAIN, VITASHELL_SETTINGS_LANGUAGE, VITASHELL_SETTINGS_THEME, + VITASHELL_SETTINGS_SELECT_BUTTON, VITASHELL_SETTINGS_NO_AUTO_UPDATE, VITASHELL_SETTINGS_POWER, VITASHELL_SETTINGS_REBOOT, VITASHELL_SETTINGS_POWEROFF, VITASHELL_SETTINGS_STANDBY, + VITASHELL_SETTINGS_SELECT_BUTTON_USB, + VITASHELL_SETTINGS_SELECT_BUTTON_FTP, + + // USB strings + USB_CONNECTED, + USB_CONNECTION_PERMISSION, + USB_CONNECTION_NOT_AVAILABLE, // Others SAFE_MODE, diff --git a/list_dialog.c b/list_dialog.c index 47c70ccf..94e7eadb 100644 --- a/list_dialog.c +++ b/list_dialog.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/list_dialog.h b/list_dialog.h index 4c769eb7..747bff5a 100644 --- a/list_dialog.h +++ b/list_dialog.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/main.c b/main.c index 63f0ef65..dfa94370 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,6 +69,8 @@ static int copy_mode = COPY_MODE_NORMAL; static int file_type = FILE_TYPE_UNKNOWN; static char archive_copy_path[MAX_PATH_LENGTH]; +static SceUID usbdevice_modid = -1; + // Archive int is_in_archive = 0; int dir_level_archive = -1; @@ -1021,6 +1023,34 @@ void initFtp() { ftpvita_ext_add_custom_command("PROM", ftpvita_PROM); } +void initUsb() { + if (sceKernelGetModel() == SCE_KERNEL_MODEL_VITATV) { + infoDialog(language_container[USB_CONNECTION_NOT_AVAILABLE]); + } else if (is_safe_mode) { + infoDialog(language_container[USB_CONNECTION_PERMISSION]); + } else { + char *path = "sdstor0:xmc-lp-ign-userext"; + + SceUID fd = sceIoOpen(path, SCE_O_RDONLY, 0); + + if (fd < 0) + path = "sdstor0:int-lp-ign-userext"; + else + sceIoClose(fd); + + usbdevice_modid = startUsb("ux0:VitaShell/module/usbdevice.skprx", path, SCE_USBSTOR_VSTOR_TYPE_FAT); + if (usbdevice_modid >= 0) { + // Lock power timers + powerLock(); + + initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL, language_container[USB_CONNECTED]); + dialog_step = DIALOG_STEP_USB; + } else { + errorDialog(usbdevice_modid); + } + } +} + int dialogSteps() { int refresh = REFRESH_MODE_NONE; @@ -1157,6 +1187,46 @@ int dialogSteps() { break; + case DIALOG_STEP_USB_WAIT: + if (msg_result == MESSAGE_DIALOG_RESULT_RUNNING) { + SceUdcdDeviceState state; + sceUdcdGetDeviceState(&state); + + if (state.connection & SCE_UDCD_STATUS_CONNECTION_ESTABLISHED) { + sceMsgDialogClose(); + } + } else { + if (msg_result == MESSAGE_DIALOG_RESULT_NONE || msg_result == MESSAGE_DIALOG_RESULT_FINISHED) { + dialog_step = DIALOG_STEP_NONE; + + SceUdcdDeviceState state; + sceUdcdGetDeviceState(&state); + + if (state.connection & SCE_UDCD_STATUS_CONNECTION_ESTABLISHED) { + initUsb(); + } + } + } + + break; + + case DIALOG_STEP_USB: + if (msg_result == MESSAGE_DIALOG_RESULT_RUNNING) { + SceUdcdDeviceState state; + sceUdcdGetDeviceState(&state); + + if (state.cable & SCE_UDCD_STATUS_CABLE_DISCONNECTED) { + sceMsgDialogClose(); + } + } else if (msg_result == MESSAGE_DIALOG_RESULT_FINISHED) { + powerUnlock(); + stopUsb(usbdevice_modid); + refresh = REFRESH_MODE_NORMAL; + dialog_step = DIALOG_STEP_NONE; + } + + break; + case DIALOG_STEP_PASTE: if (msg_result == MESSAGE_DIALOG_RESULT_RUNNING) { CopyArguments args; @@ -1502,26 +1572,38 @@ int fileBrowserMenuCtrl() { refresh = 1; } - // FTP + // SELECT button if (pressed_buttons & SCE_CTRL_SELECT) { - // Init FTP - if (!ftpvita_is_initialized()) { - int res = ftpvita_init(vita_ip, &vita_port); - if (res < 0) { - initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL, language_container[PLEASE_WAIT]); - dialog_step = DIALOG_STEP_FTP_WAIT; + if (vitashell_config.select_button == SELECT_BUTTON_MODE_USB) { + SceUdcdDeviceState state; + sceUdcdGetDeviceState(&state); + + if (state.connection & SCE_UDCD_STATUS_CONNECTION_ESTABLISHED) { + initUsb(); } else { - initFtp(); + initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL, language_container[PLEASE_WAIT]); + dialog_step = DIALOG_STEP_USB_WAIT; } + } else if (vitashell_config.select_button == SELECT_BUTTON_MODE_FTP) { + // Init FTP + if (!ftpvita_is_initialized()) { + int res = ftpvita_init(vita_ip, &vita_port); + if (res < 0) { + initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL, language_container[PLEASE_WAIT]); + dialog_step = DIALOG_STEP_FTP_WAIT; + } else { + initFtp(); + } - // Lock power timers - powerLock(); - } + // Lock power timers + powerLock(); + } - // Dialog - if (ftpvita_is_initialized()) { - initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL, language_container[FTP_SERVER], vita_ip, vita_port); - dialog_step = DIALOG_STEP_FTP; + // Dialog + if (ftpvita_is_initialized()) { + initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL, language_container[FTP_SERVER], vita_ip, vita_port); + dialog_step = DIALOG_STEP_FTP; + } } } @@ -1963,6 +2045,9 @@ int main(int argc, const char *argv[]) { // Init SceShellUtil events sceShellUtilInitEvents(0); + // Prevent automatic CMA connection + sceShellUtilLock(SCE_SHELL_UTIL_LOCK_TYPE_USB_CONNECTION); + // Init audio vitaAudioInit(0x40); diff --git a/main.h b/main.h index d4938b73..5e4e66df 100644 --- a/main.h +++ b/main.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,8 @@ #include #include #include +#include +#include #include #include #include @@ -72,7 +75,7 @@ // VitaShell version major.minor #define VITASHELL_VERSION_MAJOR 0x01 -#define VITASHELL_VERSION_MINOR 0x43 +#define VITASHELL_VERSION_MINOR 0x50 #define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10)) @@ -170,6 +173,9 @@ enum DialogSteps { DIALOG_STEP_FTP_WAIT, DIALOG_STEP_FTP, + DIALOG_STEP_USB_WAIT, + DIALOG_STEP_USB, + DIALOG_STEP_RENAME, DIALOG_STEP_NEW_FOLDER, diff --git a/makezip.c b/makezip.c index 19bf28ca..7195e434 100644 --- a/makezip.c +++ b/makezip.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/makezip.h b/makezip.h index f60cac72..dd5b0294 100644 --- a/makezip.h +++ b/makezip.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/message_dialog.c b/message_dialog.c index ff423202..9fbef6f4 100644 --- a/message_dialog.c +++ b/message_dialog.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/message_dialog.h b/message_dialog.h index 5ee47509..0e19cb3d 100644 --- a/message_dialog.h +++ b/message_dialog.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/network_update.c b/network_update.c index 7c0a41ac..a2d0683b 100644 --- a/network_update.c +++ b/network_update.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/network_update.h b/network_update.h index fef701c6..8920893c 100644 --- a/network_update.h +++ b/network_update.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/package_installer.c b/package_installer.c index 1bfe9911..c26e79c3 100644 --- a/package_installer.c +++ b/package_installer.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/package_installer.h b/package_installer.h index 1bebd017..01e7897f 100644 --- a/package_installer.h +++ b/package_installer.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/photo.c b/photo.c index 894d7512..43f3435a 100644 --- a/photo.c +++ b/photo.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/photo.h b/photo.h index 9b3ae11e..19a40c04 100644 --- a/photo.h +++ b/photo.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/pkg/sce_sys/livearea/contents/template.xml b/pkg/sce_sys/livearea/contents/template.xml index f393d540..6248c010 100644 --- a/pkg/sce_sys/livearea/contents/template.xml +++ b/pkg/sce_sys/livearea/contents/template.xml @@ -28,7 +28,7 @@ - v1.43 + v1.50 diff --git a/property_dialog.c b/property_dialog.c index 9370260e..8e225c06 100644 --- a/property_dialog.c +++ b/property_dialog.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/property_dialog.h b/property_dialog.h index 699c1328..cf345ae2 100644 --- a/property_dialog.h +++ b/property_dialog.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/base_head_bin.h b/resources/base_head_bin.h index b3e399cf..493bf57b 100644 --- a/resources/base_head_bin.h +++ b/resources/base_head_bin.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/resources/changeinfo.txt b/resources/changeinfo.txt index 83fe2c61..05e50af4 100644 --- a/resources/changeinfo.txt +++ b/resources/changeinfo.txt @@ -213,4 +213,11 @@ - Fixed bug where you couldn't exit the application.
]]> + + +- Added RAR archive support (by Mayoshiroi).
+- Added coredump viewer.
+ ]]> +
diff --git a/resources/english_us.txt b/resources/english_us.txt index 33ccd8a7..4a03b6f7 100644 --- a/resources/english_us.txt +++ b/resources/english_us.txt @@ -62,7 +62,7 @@ PROPERTY_NAME = "Name" PROPERTY_TYPE = "Type" PROPERTY_FSELF_MODE = "FSELF mode" PROPERTY_SIZE = "Size" -PROPERTY_COMPRESSED_SIZE = "Compressed size" +PROPERTY_COMPRESSED_SIZE = "Compressed size" PROPERTY_CONTAINS = "Contains" PROPERTY_CONTAINS_FILES_FOLDERS = "%d files, %d folders" PROPERTY_CREATION_DATE = "Creation date" @@ -78,7 +78,6 @@ PROPERTY_TYPE_TXT = "Text document" PROPERTY_TYPE_VPK = "VPK package" PROPERTY_TYPE_XML = "XML file" PROPERTY_TYPE_ZIP = "ZIP archive" -PROPERTY_TYPE_RAR = "RAR archive" PROPERTY_TYPE_FSELF = "FSELF file" PROPERTY_FSELF_MODE_SAFE = "Safe" PROPERTY_FSELF_MODE_UNSAFE = "Unsafe" @@ -123,11 +122,19 @@ HENKAKU_UNSAFE_HOMEBREW_MESSAGE = "Unsafe homebrews can damage your device\ VITASHELL_SETTINGS_MAIN = "Main settings" VITASHELL_SETTINGS_LANGUAGE = "Language" VITASHELL_SETTINGS_THEME = "Theme" +VITASHELL_SETTINGS_SELECT_BUTTON = "SELECT button" VITASHELL_SETTINGS_NO_AUTO_UPDATE = "Disable auto-update" VITASHELL_SETTINGS_POWER = "Power" VITASHELL_SETTINGS_REBOOT = "Reboot" VITASHELL_SETTINGS_POWEROFF = "Power off" VITASHELL_SETTINGS_STANDBY = "Standby" +VITASHELL_SETTINGS_SELECT_BUTTON_USB = "USB" +VITASHELL_SETTINGS_SELECT_BUTTON_FTP = "FTP" + +# USB strings +USB_CONNECTED = "USB connected" +USB_CONNECTION_PERMISSION = "USB connection requires extended permission.\Please activate 'Enable unsafe homebrew' first." +USB_CONNECTION_NOT_AVAILABLE = "USB connection is not available on this device." # Others SAFE_MODE = "SAFE MODE" diff --git a/resources/usbdevice.skprx b/resources/usbdevice.skprx new file mode 100644 index 0000000000000000000000000000000000000000..547eedb0b48640844116d47ef6b9502d438256b6 GIT binary patch literal 2075 zcmWG`c4c5@U|=}Fz{tSB24n~TF%Z}Z0{K87%>kz11Phea0Hqf|=?736Mma#VGc178 z8=!On6HEn!h6?M0cnGVYqCl~FS06Vv|CD`4U<8fG&zTEOlW01CpyA-YE{2~M&|;W5&~1(ciu zsF)loZoRz}?-3j*!~Ws^-7?in32L5hr%Gq75t7=}{xxC6i_(Az8-*6K-p(mxPmVL2 zT(i+qp6k`YKbv2z{K~(`-at`)%@JFcApTTa)_p!AdoG;b!JjPn*D}4>@6zxqa%V#S#bLF2|Z8b9@v^Q$pK4CmBqcT(UYCzO!9}2y_`~0_EzW0;8Ua|$x_H(-?-KyN{ zwRXAV%2_*C+_)$ErfyFDO`XM7r$38+QhmDP)7;eerQJmvUrjJFe0=5d)GJdic?#&h zJX|Vw>dqCJ;^3VNA~PyP_FPT-XnS(%?KPXM{wu}Lj$6)J`YrX+#S4G#tjwOe=*q)vJCm3K!Ry>?IE>+2?izj6Olmsp&Z;u3W~x;b*O&&+c*txx_g=?}?Y zxk7ZA=DF-H(J31<<@7zzdX~-;JG1%d?$0bIvLe1|+2}u=|N7=5?{=oY z|K9F*m&`ww?BXfrts|4{Vy<*^-`dG;i(S?(zTN#+rz*x)_y1>muRWboCqA67-dEq{ z`lq|PC`s4+&$5d`G4(%!@7|gH^p4>^_1|79dDoV1xqAN3nK`q+UO!f5rM_PCZN>4e zW{>X7Sib4sH$Kzmdkv5HPclEe{IB4I{FCpmrTV_GGuu^uF0+rz{`G3Xa{hN=er`IybPdLL5=wGmmoV&jFwbmvj?k`jCG_E_j zb>E4y_s#oHet#fev})hK`K*2?j5jFnZ)SgDSmBZ92FXU|Q($YsCK iU3K2x;k4AZJr_3IRyF3%(0(NSNvf**H@kmW(is3{Sp&)d literal 0 HcmV?d00001 diff --git a/settings.c b/settings.c index 90c43aaf..d90f850c 100644 --- a/settings.c +++ b/settings.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,29 +66,36 @@ static char spoofed_version[6]; static SettingsMenuEntry *settings_menu_entries = NULL; static int n_settings_entries = 0; +static char *select_button_options[2]; + static ConfigEntry settings_entries[] = { - { "DISABLE_AUTOUPDATE", CONFIG_TYPE_BOOLEAN, (int *)&vitashell_config.disable_autoupdate } + { "SELECT_BUTTON", CONFIG_TYPE_DECIMAL, (int *)&vitashell_config.select_button }, + { "DISABLE_AUTOUPDATE", CONFIG_TYPE_BOOLEAN, (int *)&vitashell_config.disable_autoupdate }, }; SettingsMenuOption henkaku_settings[] = { - { HENKAKU_ENABLE_PSN_SPOOFING, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, &henkaku_config.use_psn_spoofing }, - { HENKAKU_ENABLE_UNSAFE_HOMEBREW, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, &henkaku_config.allow_unsafe_hb }, - { HENKAKU_ENABLE_VERSION_SPOOFING, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, &henkaku_config.use_spoofed_version }, - { HENKAKU_SPOOFED_VERSION, SETTINGS_OPTION_TYPE_STRING, NULL, spoofed_version, sizeof(spoofed_version) - 1, NULL }, - { HENKAKU_RESTORE_DEFAULT_SETTINGS, SETTINGS_OPTION_TYPE_CALLBACK, (void *)henkakuRestoreDefaultSettings, NULL, 0, NULL }, - { HENKAKU_RELOAD_CONFIG, SETTINGS_OPTION_TYPE_CALLBACK, (void *)taihenReloadConfig, NULL, 0, NULL }, + { HENKAKU_ENABLE_PSN_SPOOFING, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &henkaku_config.use_psn_spoofing }, + { HENKAKU_ENABLE_UNSAFE_HOMEBREW, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &henkaku_config.allow_unsafe_hb }, + { HENKAKU_ENABLE_VERSION_SPOOFING, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &henkaku_config.use_spoofed_version }, + { HENKAKU_SPOOFED_VERSION, SETTINGS_OPTION_TYPE_STRING, NULL, spoofed_version, sizeof(spoofed_version) - 1, NULL, 0, NULL }, + { HENKAKU_RESTORE_DEFAULT_SETTINGS, SETTINGS_OPTION_TYPE_CALLBACK, (void *)henkakuRestoreDefaultSettings, NULL, 0, NULL, 0, NULL }, + { HENKAKU_RELOAD_CONFIG, SETTINGS_OPTION_TYPE_CALLBACK, (void *)taihenReloadConfig, NULL, 0, NULL, 0, NULL }, }; SettingsMenuOption main_settings[] = { - // { VITASHELL_SETTINGS_LANGUAGE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, &language }, - // { VITASHELL_SETTINGS_THEME, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, &theme }, - { VITASHELL_SETTINGS_NO_AUTO_UPDATE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, &vitashell_config.disable_autoupdate }, + // { VITASHELL_SETTINGS_LANGUAGE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &language }, + // { VITASHELL_SETTINGS_THEME, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &theme }, + + { VITASHELL_SETTINGS_SELECT_BUTTON, SETTINGS_OPTION_TYPE_OPTIONS, NULL, NULL, 0, + select_button_options, sizeof(select_button_options) / sizeof(char **), + &vitashell_config.select_button }, + { VITASHELL_SETTINGS_NO_AUTO_UPDATE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &vitashell_config.disable_autoupdate }, }; SettingsMenuOption power_settings[] = { - { VITASHELL_SETTINGS_REBOOT, SETTINGS_OPTION_TYPE_CALLBACK, (void *)rebootDevice, NULL, 0, NULL }, - { VITASHELL_SETTINGS_POWEROFF, SETTINGS_OPTION_TYPE_CALLBACK, (void *)shutdownDevice, NULL, 0, NULL }, - { VITASHELL_SETTINGS_STANDBY, SETTINGS_OPTION_TYPE_CALLBACK, (void *)suspendDevice, NULL, 0, NULL }, + { VITASHELL_SETTINGS_REBOOT, SETTINGS_OPTION_TYPE_CALLBACK, (void *)rebootDevice, NULL, 0, NULL, 0, NULL }, + { VITASHELL_SETTINGS_POWEROFF, SETTINGS_OPTION_TYPE_CALLBACK, (void *)shutdownDevice, NULL, 0, NULL, 0, NULL }, + { VITASHELL_SETTINGS_STANDBY, SETTINGS_OPTION_TYPE_CALLBACK, (void *)suspendDevice, NULL, 0, NULL, 0, NULL }, }; SettingsMenuEntry molecularshell_settings_menu_entries[] = { @@ -165,6 +172,9 @@ void initSettingsMenu() { int i; for (i = 0; i < n_settings_entries; i++) settings_menu.n_options += settings_menu_entries[i].n_options; + + select_button_options[0] = language_container[VITASHELL_SETTINGS_SELECT_BUTTON_USB]; + select_button_options[1] = language_container[VITASHELL_SETTINGS_SELECT_BUTTON_FTP]; } void openSettingsMenu() { @@ -293,10 +303,21 @@ void drawSettingsMenu() { pgf_draw_text(ALIGN_RIGHT(SCREEN_HALF_WIDTH - 10.0f, x), y, SETTINGS_MENU_ITEM_COLOR, FONT_SIZE, language_container[options[j].name]); // Option - if (options[j].type == SETTINGS_OPTION_TYPE_BOOLEAN) { - pgf_draw_text(SCREEN_HALF_WIDTH + 10.0f, y, SETTINGS_MENU_OPTION_COLOR, FONT_SIZE, *(options[j].value) ? language_container[ON] : language_container[OFF]); - } else if (options[j].type == SETTINGS_OPTION_TYPE_STRING) { - pgf_draw_text(SCREEN_HALF_WIDTH + 10.0f, y, SETTINGS_MENU_OPTION_COLOR, FONT_SIZE, options[j].string); + switch (options[j].type) { + case SETTINGS_OPTION_TYPE_BOOLEAN: + pgf_draw_text(SCREEN_HALF_WIDTH + 10.0f, y, SETTINGS_MENU_OPTION_COLOR, FONT_SIZE, *(options[j].value) ? language_container[ON] : language_container[OFF]); + break; + + case SETTINGS_OPTION_TYPE_STRING: + pgf_draw_text(SCREEN_HALF_WIDTH + 10.0f, y, SETTINGS_MENU_OPTION_COLOR, FONT_SIZE, options[j].string); + break; + + case SETTINGS_OPTION_TYPE_OPTIONS: + { + int value = *(options[j].value); + pgf_draw_text(SCREEN_HALF_WIDTH + 10.0f, y, SETTINGS_MENU_OPTION_COLOR, FONT_SIZE, options[j].options[value]); + break; + } } } @@ -341,13 +362,36 @@ void settingsMenuCtrl() { *(option->value) = !*(option->value); } } else { - if (option->type == SETTINGS_OPTION_TYPE_BOOLEAN) { - *(option->value) = !*(option->value); - } else if (option->type == SETTINGS_OPTION_TYPE_STRING) { - initImeDialog(language_container[option->name], option->string, option->size_string, SCE_IME_TYPE_EXTENDED_NUMBER, 0); - dialog_step = DIALOG_STEP_SETTINGS_STRING; - } else if (option->type == SETTINGS_OPTION_TYPE_CALLBACK) { - option->callback(&option); + switch (option->type) { + case SETTINGS_OPTION_TYPE_BOOLEAN: + *(option->value) = !*(option->value); + break; + + case SETTINGS_OPTION_TYPE_STRING: + initImeDialog(language_container[option->name], option->string, option->size_string, SCE_IME_TYPE_EXTENDED_NUMBER, 0); + dialog_step = DIALOG_STEP_SETTINGS_STRING; + break; + + case SETTINGS_OPTION_TYPE_CALLBACK: + option->callback(&option); + break; + + case SETTINGS_OPTION_TYPE_OPTIONS: + { + if (pressed_buttons & SCE_CTRL_LEFT) { + if (*(option->value) > 0) + (*(option->value))--; + else + *(option->value) = option->n_options-1; + } else if (pressed_buttons & (SCE_CTRL_ENTER | SCE_CTRL_RIGHT)) { + if (*(option->value) < option->n_options-1) + (*(option->value))++; + else + *(option->value) = 0; + } + + break; + } } } } @@ -358,12 +402,12 @@ void settingsMenuCtrl() { settings_menu.option_sel--; } else if (settings_menu.entry_sel > 0) { settings_menu.entry_sel--; - settings_menu.option_sel = settings_menu_entries[settings_menu.entry_sel].n_options - 1; + settings_menu.option_sel = settings_menu_entries[settings_menu.entry_sel].n_options-1; } } else if (hold_buttons & SCE_CTRL_DOWN || hold2_buttons & SCE_CTRL_LEFT_ANALOG_DOWN) { - if (settings_menu.option_sel < settings_menu_entries[settings_menu.entry_sel].n_options - 1) { + if (settings_menu.option_sel < settings_menu_entries[settings_menu.entry_sel].n_options-1) { settings_menu.option_sel++; - } else if (settings_menu.entry_sel < n_settings_entries - 1) { + } else if (settings_menu.entry_sel < n_settings_entries-1) { settings_menu.entry_sel++; settings_menu.option_sel = 0; } diff --git a/settings.h b/settings.h index e88963a8..213a84f3 100644 --- a/settings.h +++ b/settings.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ enum SettingsOptionType { SETTINGS_OPTION_TYPE_INTEGER, SETTINGS_OPTION_TYPE_STRING, SETTINGS_OPTION_TYPE_CALLBACK, + SETTINGS_OPTION_TYPE_OPTIONS, }; enum SettingsMenuStatus { @@ -53,6 +54,8 @@ typedef struct { int (* callback)(); char *string; int size_string; + char **options; + int n_options; int *value; } SettingsMenuOption; diff --git a/sfo.c b/sfo.c index b3e81316..d236e216 100644 --- a/sfo.c +++ b/sfo.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sfo.h b/sfo.h index ad7e98e1..3184fd14 100644 --- a/sfo.h +++ b/sfo.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sha1.c b/sha1.c index baf38f47..eb0bda03 100644 --- a/sha1.c +++ b/sha1.c @@ -11,6 +11,7 @@ /*************************** HEADER FILES ***************************/ #include +#include #include "sha1.h" /****************************** MACROS ******************************/ diff --git a/text.c b/text.c index 36ad7de2..9760ce38 100644 --- a/text.c +++ b/text.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/text.h b/text.h index 44c760a0..48c743f6 100644 --- a/text.h +++ b/text.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/theme.c b/theme.c index ad26c6fb..9f280922 100644 --- a/theme.c +++ b/theme.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/theme.h b/theme.h index 675bf734..59ac89d3 100644 --- a/theme.h +++ b/theme.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/uncommon_dialog.c b/uncommon_dialog.c index 0808810a..ce9e5c3e 100644 --- a/uncommon_dialog.c +++ b/uncommon_dialog.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/uncommon_dialog.h b/uncommon_dialog.h index 09228653..28bc55e9 100644 --- a/uncommon_dialog.h +++ b/uncommon_dialog.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/updater/main.c b/updater/main.c index 6460ba4b..e0e88e9b 100644 --- a/updater/main.c +++ b/updater/main.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/usbdevice/CMakeLists.txt b/usbdevice/CMakeLists.txt new file mode 100644 index 00000000..ecebeaf9 --- /dev/null +++ b/usbdevice/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 2.8) + +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + if(DEFINED ENV{VITASDK}) + set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") + else() + message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") + endif() +endif() + +project(usbdevice) +include("${VITASDK}/share/vita.cmake" REQUIRED) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -nostdlib") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions") + +add_executable(usbdevice + main.c +) + +target_link_libraries(usbdevice + SceIofilemgrForDriver_stub + SceSysclibForDriver_stub + taihenForKernel_stub +) + +vita_create_self(usbdevice.skprx usbdevice CONFIG exports.yml UNSAFE) \ No newline at end of file diff --git a/usbdevice/exports.yml b/usbdevice/exports.yml new file mode 100644 index 00000000..ab449a2c --- /dev/null +++ b/usbdevice/exports.yml @@ -0,0 +1,8 @@ +usbdevice: + attributes: 0 + version: + major: 1 + minor: 0 + main: + start: module_start + stop: module_stop \ No newline at end of file diff --git a/usbdevice/main.c b/usbdevice/main.c new file mode 100644 index 00000000..fa6ad93c --- /dev/null +++ b/usbdevice/main.c @@ -0,0 +1,89 @@ +/* + usbdevice + Copyright (C) 2016, TheFloW + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +#include +#include + +#include + +static tai_hook_ref_t ksceIoOpenRef; +static tai_hook_ref_t ksceIoReadRef; + +static SceUID uids[1]; +static int hooks[2]; + +static int first = 1; + +SceUID ksceIoOpenPatched(const char *file, int flags, SceMode mode) { + first = 1; + return TAI_CONTINUE(SceUID, ksceIoOpenRef, file, flags, mode); +} + +int ksceIoReadPatched(SceUID fd, void *data, SceSize size) { + int res = TAI_CONTINUE(int, ksceIoReadRef, fd, data, size); + + if (first) { + first = 0; + + // Manipulate boot sector to support exFAT + if (memcmp(data + 0x3, "EXFAT", 5) == 0) { + // Sector size + *(uint16_t *)(data + 0xB) = 1 << *(uint8_t *)(data + 0x6C); + + // Volume size + *(uint32_t *)(data + 0x20) = *(uint32_t *)(data + 0x48); + } + } + + return res; +} + +void _start() __attribute__ ((weak, alias("module_start"))); +int module_start(SceSize args, void *argp) { + // Get tai module info + tai_module_info_t info; + info.size = sizeof(tai_module_info_t); + if (taiGetModuleInfoForKernel(KERNEL_PID, "SceUsbstorVStorDriver", &info) >= 0) { + // Remove image path limitation + char zero[0x6E]; + memset(zero, 0, 0x6E); + uids[0] = taiInjectDataForKernel(KERNEL_PID, info.modid, 0, 0x1738, zero, 0x6E); + + // Add patches to support exFAT + hooks[0] = taiHookFunctionImportForKernel(KERNEL_PID, &ksceIoOpenRef, "SceUsbstorVStorDriver", 0x40FD29C7, 0x75192972, ksceIoOpenPatched); + hooks[1] = taiHookFunctionImportForKernel(KERNEL_PID, &ksceIoReadRef, "SceUsbstorVStorDriver", 0x40FD29C7, 0xE17EFC03, ksceIoReadPatched); + } + + return SCE_KERNEL_START_SUCCESS; +} + +int module_stop(SceSize args, void *argp) { + if (hooks[1] >= 0) + taiHookReleaseForKernel(hooks[1], ksceIoReadRef); + + if (hooks[0] >= 0) + taiHookReleaseForKernel(hooks[0], ksceIoOpenRef); + + if (uids[0] >= 0) + taiInjectReleaseForKernel(uids[0]); + + return SCE_KERNEL_STOP_SUCCESS; +} \ No newline at end of file diff --git a/utils.c b/utils.c index 8fc3725f..ddaca2e0 100644 --- a/utils.c +++ b/utils.c @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -335,7 +335,81 @@ int launchAppByUriExit(char *titleid) { return 0; } - char *strcasestr(const char *haystack, const char *needle) { return boyer_moore(haystack, needle); } + +int vshIoUmount(int id, int a2, int a3, int a4); +int _vshIoMount(int id, int a2, int permission, void *buf); + +int vshIoMount(int id, int a2, 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 _vshIoMount(id, a2, permission, buf); +} + +SceUID startUsb(const char *usbDevicePath, const char *imgFilePath, int type) { + int res; + + // Load and start usbdevice module + SceUID modid = taiLoadStartKernelModule(usbDevicePath, 0, NULL, 0); + if (modid < 0) + return modid; + + // Stop MTP driver + res = sceMtpIfStopDriver(1); + if (res < 0) + return res; + + // Set device information + res = sceUsbstorVStorSetDeviceInfo("\"PS Vita\" MC", "1.00"); + if (res < 0) + return res; + + // Set image file path + res = sceUsbstorVStorSetImgFilePath(imgFilePath); + if (res < 0) + return res; + + // Start USB storage + res = sceUsbstorVStorStart(type); + if (res < 0) + return res; + + return modid; +} + +int stopUsb(SceUID modid) { + int res; + + // Stop USB storage + res = sceUsbstorVStorStop(); + if (res < 0) + return res; + + // Start MTP driver + res = sceMtpIfStartDriver(1); + if (res < 0) + return res; + + // Stop and unload usbdevice module + res = taiStopUnloadKernelModule(modid, 0, NULL, 0, NULL, NULL); + if (res < 0) + return res; + + // Remount + vshIoUmount(0x800, 0, 0, 0); + vshIoMount(0x800, 0, 0, 0, 0, 0); + + // Trick + sceAppMgrLoadExec("app0:eboot.bin", NULL, 0); + + return 0; +} \ No newline at end of file diff --git a/utils.h b/utils.h index ddda5b38..217eec5b 100644 --- a/utils.h +++ b/utils.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,4 +85,7 @@ int launchAppByUriExit(char *titleid); char *strcasestr(const char *haystack, const char *needle); -#endif +SceUID startUsb(const char *usbDevicePath, const char *imgFilePath, int type); +int stopUsb(SceUID modid); + +#endif \ No newline at end of file diff --git a/vitashell_config.h b/vitashell_config.h index 3ef57dc0..6fdca043 100644 --- a/vitashell_config.h +++ b/vitashell_config.h @@ -1,6 +1,6 @@ /* VitaShell - Copyright (C) 2015-2016, TheFloW + Copyright (C) 2015-2017, TheFloW This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,11 @@ #ifndef __VITASHELL_CONFIGURATION_H__ #define __VITASHELL_CONFIGURATION_H__ +#define SELECT_BUTTON_MODE_USB 0 +#define SELECT_BUTTON_MODE_FTP 1 + typedef struct { + int select_button; int disable_autoupdate; } VitaShellConfig;