2016-08-06 06:59:41 +00:00
|
|
|
/*
|
2017-10-13 10:42:36 +00:00
|
|
|
VitaShell
|
2017-12-30 10:43:37 +00:00
|
|
|
Copyright (C) 2015-2018, TheFloW
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
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.
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
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.
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-08-06 06:59:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "main.h"
|
2018-09-13 12:46:10 +00:00
|
|
|
#include "browser.h"
|
2016-08-06 06:59:41 +00:00
|
|
|
#include "init.h"
|
|
|
|
#include "file.h"
|
2016-09-20 14:18:24 +00:00
|
|
|
#include "package_installer.h"
|
2016-08-06 06:59:41 +00:00
|
|
|
#include "utils.h"
|
2017-09-16 09:18:56 +00:00
|
|
|
#include "qr.h"
|
2017-10-29 00:10:36 +00:00
|
|
|
#include "rif.h"
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-02-13 10:06:23 +00:00
|
|
|
#include "audio/vita_audio.h"
|
|
|
|
|
2017-03-17 21:48:36 +00:00
|
|
|
INCLUDE_EXTERN_RESOURCE(english_us_txt);
|
2016-08-29 17:07:12 +00:00
|
|
|
|
2016-09-12 13:49:51 +00:00
|
|
|
INCLUDE_EXTERN_RESOURCE(theme_txt);
|
2017-03-17 21:48:36 +00:00
|
|
|
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_colors_txt);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_archive_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_audio_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_battery_bar_charge_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_battery_bar_green_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_battery_bar_red_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_battery_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_cover_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_fastforward_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_fastrewind_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_file_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_folder_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_ftp_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_image_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_pause_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_play_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_sfo_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_text_icon_png);
|
2018-09-13 10:00:30 +00:00
|
|
|
INCLUDE_EXTERN_RESOURCE(default_file_symlink_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(default_folder_symlink_icon_png);
|
2017-03-17 21:48:36 +00:00
|
|
|
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_colors_txt);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_archive_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_audio_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_battery_bar_charge_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_battery_bar_green_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_battery_bar_red_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_battery_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_bg_audioplayer_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_bg_browser_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_bg_hexeditor_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_bg_photoviewer_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_bg_texteditor_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_context_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_context_more_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_cover_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_dialog_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_fastforward_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_fastrewind_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_file_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_folder_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_ftp_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_image_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_pause_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_play_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_sfo_icon_png);
|
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_text_icon_png);
|
2018-01-01 11:47:49 +00:00
|
|
|
INCLUDE_EXTERN_RESOURCE(electron_settings_png);
|
2016-09-12 13:49:51 +00:00
|
|
|
|
2017-03-17 21:48:36 +00:00
|
|
|
INCLUDE_EXTERN_RESOURCE(umass_skprx);
|
2018-08-27 13:29:02 +00:00
|
|
|
|
2020-02-10 21:24:11 +00:00
|
|
|
extern unsigned char _binary_modules_kernel_kernel_skprx_start;
|
|
|
|
extern unsigned char _binary_modules_kernel_kernel_skprx_size;
|
|
|
|
extern unsigned char _binary_modules_user_user_suprx_start;
|
|
|
|
extern unsigned char _binary_modules_user_user_suprx_size;
|
|
|
|
extern unsigned char _binary_modules_patch_patch_skprx_start;
|
|
|
|
extern unsigned char _binary_modules_patch_patch_skprx_size;
|
|
|
|
extern unsigned char _binary_modules_usbdevice_usbdevice_skprx_start;
|
|
|
|
extern unsigned char _binary_modules_usbdevice_usbdevice_skprx_size;
|
2017-01-12 16:45:52 +00:00
|
|
|
|
2017-01-13 16:41:04 +00:00
|
|
|
#define DEFAULT_FILE(path, name, replace) { path, (void *)&_binary_resources_##name##_start, (int)&_binary_resources_##name##_size, replace }
|
2016-08-29 17:07:12 +00:00
|
|
|
|
2016-08-29 17:27:14 +00:00
|
|
|
static DefaultFile default_files[] = {
|
2017-10-13 10:42:36 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/language/english_us.txt", english_us_txt, 0),
|
|
|
|
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/theme.txt", theme_txt, 0),
|
|
|
|
|
2018-01-01 11:11:02 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/colors.txt", default_colors_txt, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/archive_icon.png", default_archive_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/audio_icon.png", default_audio_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/battery.png", default_battery_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/battery_bar_charge.png", default_battery_bar_charge_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/battery_bar_green.png", default_battery_bar_green_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/battery_bar_red.png", default_battery_bar_red_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/cover.png", default_cover_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/fastforward.png", default_fastforward_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/fastrewind.png", default_fastrewind_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/file_icon.png", default_file_icon_png, 1),
|
2018-09-13 10:00:30 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/file_symlink_icon.png",default_file_symlink_icon_png, 1),
|
2018-01-01 11:11:02 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/folder_icon.png", default_folder_icon_png, 1),
|
2018-09-13 10:00:30 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/folder_symlink_icon.png",default_folder_symlink_icon_png, 1),
|
2018-01-01 11:11:02 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/ftp.png", default_ftp_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/image_icon.png", default_image_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/pause.png", default_pause_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/play.png", default_play_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/sfo_icon.png", default_sfo_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Default/text_icon.png", default_text_icon_png, 1),
|
|
|
|
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/colors.txt", electron_colors_txt, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/archive_icon.png", electron_archive_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/audio_icon.png", electron_audio_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/battery.png", electron_battery_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/battery_bar_charge.png", electron_battery_bar_charge_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/battery_bar_green.png", electron_battery_bar_green_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/battery_bar_red.png", electron_battery_bar_red_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/bg_audioplayer.png", electron_bg_audioplayer_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/bg_browser.png", electron_bg_browser_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/bg_hexeditor.png", electron_bg_hexeditor_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/bg_photoviewer.png", electron_bg_photoviewer_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/bg_texteditor.png", electron_bg_texteditor_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/context.png", electron_context_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/context_more.png", electron_context_more_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/cover.png", electron_cover_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/dialog.png", electron_dialog_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/fastforward.png", electron_fastforward_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/fastrewind.png", electron_fastrewind_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/file_icon.png", electron_file_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/folder_icon.png", electron_folder_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/ftp.png", electron_ftp_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/image_icon.png", electron_image_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/pause.png", electron_pause_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/play.png", electron_play_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/sfo_icon.png", electron_sfo_icon_png, 1),
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/text_icon.png", electron_text_icon_png, 1),
|
2018-01-01 11:47:49 +00:00
|
|
|
DEFAULT_FILE("ux0:VitaShell/theme/Electron/settings.png", electron_settings_png, 1),
|
2017-10-13 10:42:36 +00:00
|
|
|
|
|
|
|
DEFAULT_FILE("ux0:VitaShell/module/umass.skprx", umass_skprx, 1),
|
2018-08-27 13:29:02 +00:00
|
|
|
|
2020-02-10 21:24:11 +00:00
|
|
|
{ "ux0:VitaShell/module/kernel.skprx", (void *)&_binary_modules_kernel_kernel_skprx_start,
|
|
|
|
(int)&_binary_modules_kernel_kernel_skprx_size, 1 },
|
|
|
|
{ "ux0:VitaShell/module/user.suprx", (void *)&_binary_modules_user_user_suprx_start,
|
|
|
|
(int)&_binary_modules_user_user_suprx_size, 1 },
|
|
|
|
{ "ux0:VitaShell/module/patch.skprx", (void *)&_binary_modules_patch_patch_skprx_start,
|
|
|
|
(int)&_binary_modules_patch_patch_skprx_size, 1 },
|
|
|
|
{ "ux0:VitaShell/module/usbdevice.skprx", (void *)&_binary_modules_usbdevice_usbdevice_skprx_start,
|
|
|
|
(int)&_binary_modules_usbdevice_usbdevice_skprx_size, 1 },
|
2016-08-29 17:07:12 +00:00
|
|
|
};
|
|
|
|
|
2017-02-27 20:53:38 +00:00
|
|
|
char vitashell_titleid[12];
|
2017-02-13 20:07:09 +00:00
|
|
|
|
2017-06-22 22:21:00 +00:00
|
|
|
int is_safe_mode = 0;
|
2017-02-13 20:07:09 +00:00
|
|
|
|
2017-10-02 09:14:15 +00:00
|
|
|
SceUID patch_modid = -1, kernel_modid = -1, user_modid = -1;
|
2017-03-18 09:56:46 +00:00
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
// System params
|
|
|
|
int language = 0, enter_button = 0, date_format = 0, time_format = 0;
|
|
|
|
|
2018-09-13 12:46:10 +00:00
|
|
|
int isSafeMode() {
|
|
|
|
return is_safe_mode;
|
|
|
|
}
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
static void initSceAppUtil() {
|
2017-10-13 10:42:36 +00:00
|
|
|
// Init SceAppUtil
|
|
|
|
SceAppUtilInitParam init_param;
|
|
|
|
SceAppUtilBootParam boot_param;
|
|
|
|
memset(&init_param, 0, sizeof(SceAppUtilInitParam));
|
|
|
|
memset(&boot_param, 0, sizeof(SceAppUtilBootParam));
|
|
|
|
sceAppUtilInit(&init_param, &boot_param);
|
|
|
|
|
|
|
|
// Mount
|
|
|
|
sceAppUtilMusicMount();
|
|
|
|
sceAppUtilPhotoMount();
|
|
|
|
|
|
|
|
// System params
|
|
|
|
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG, &language);
|
|
|
|
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_ENTER_BUTTON, &enter_button);
|
|
|
|
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_DATE_FORMAT, &date_format);
|
|
|
|
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_TIME_FORMAT, &time_format);
|
|
|
|
|
|
|
|
// Set common dialog config
|
|
|
|
SceCommonDialogConfigParam config;
|
|
|
|
sceCommonDialogConfigParamInit(&config);
|
|
|
|
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG, (int *)&config.language);
|
|
|
|
sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_ENTER_BUTTON, (int *)&config.enterButtonAssign);
|
|
|
|
sceCommonDialogSetConfigParam(&config);
|
2016-08-06 06:59:41 +00:00
|
|
|
}
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
static void finishSceAppUtil() {
|
2017-10-13 10:42:36 +00:00
|
|
|
// Unmount
|
|
|
|
sceAppUtilPhotoUmount();
|
|
|
|
sceAppUtilMusicUmount();
|
2016-08-18 16:13:18 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
// Shutdown AppUtil
|
|
|
|
sceAppUtilShutdown();
|
2016-08-06 06:59:41 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 15:27:43 +00:00
|
|
|
static int isKoreanChar(unsigned int c) {
|
2017-10-13 10:42:36 +00:00
|
|
|
unsigned short ch = c;
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
// Hangul compatibility jamo block
|
|
|
|
if (0x3130 <= ch && ch <= 0x318F) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
// Hangul syllables block
|
|
|
|
if (0xAC00 <= ch && ch <= 0xD7AF) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
// Korean won sign
|
|
|
|
if (ch == 0xFFE6) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
return 0;
|
2016-12-12 18:56:02 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 15:27:43 +00:00
|
|
|
static int isLatinChar(unsigned int c) {
|
2017-10-13 10:42:36 +00:00
|
|
|
unsigned short ch = c;
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
// Basic latin block + latin-1 supplement block
|
|
|
|
if (ch <= 0x00FF) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
// Cyrillic block
|
|
|
|
if (0x0400 <= ch && ch <= 0x04FF) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
return 0;
|
2016-12-12 18:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
vita2d_pgf *loadSystemFonts() {
|
2017-10-13 10:42:36 +00:00
|
|
|
vita2d_system_pgf_config configs[] = {
|
|
|
|
{ SCE_FONT_LANGUAGE_KOREAN, isKoreanChar },
|
|
|
|
{ SCE_FONT_LANGUAGE_LATIN, isLatinChar },
|
|
|
|
{ SCE_FONT_LANGUAGE_DEFAULT, NULL },
|
|
|
|
};
|
2016-12-12 18:56:02 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
return vita2d_load_system_pgf(3, configs);
|
2016-12-12 18:56:02 +00:00
|
|
|
}
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
static void initVita2dLib() {
|
2017-10-13 10:42:36 +00:00
|
|
|
vita2d_init();
|
2016-08-06 06:59:41 +00:00
|
|
|
}
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
static void finishVita2dLib() {
|
2017-10-13 10:42:36 +00:00
|
|
|
vita2d_free_pgf(font);
|
|
|
|
vita2d_fini();
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
font = NULL;
|
2016-08-06 06:59:41 +00:00
|
|
|
}
|
|
|
|
|
Add DLC refresh + restore license from Sqlite DB
DLC from ux0:addcont/ is now installed during refresh, provided there exists an sce_sys/package/
directory containing: body.bin, head.bin, inst.bin stat.bin, tail.bin, temp.bin and work.bin.
Apart from work.bin, all of these files can be be restored from the official PKG downloads, as
demonstrated by pkg_dec.
Moreover, this patch adds the ability to restore one's RIFs from an ux0:/license/licenses.db
SQLite database with the schema described hereafter (the RIF column being the uncompressed
512-byte binary license):
CREATE TABLE `Licenses` (
`CONTENT_ID` TEXT NOT NULL UNIQUE,
`RIF` BLOB NOT NULL,
PRIMARY KEY(`CONTENT_ID`)
);
With both these feature and provided that one's personal licenses have been backed up in
ux0:/license/licenses.db, Vita users can conveniently restore or reinstall their legally
owned content, straight from Sony's PKG files.
2017-10-26 21:52:22 +00:00
|
|
|
static int initSQLite() {
|
2017-10-29 00:10:36 +00:00
|
|
|
return sqlite_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int finishSQLite() {
|
|
|
|
return sqlite_exit();
|
Add DLC refresh + restore license from Sqlite DB
DLC from ux0:addcont/ is now installed during refresh, provided there exists an sce_sys/package/
directory containing: body.bin, head.bin, inst.bin stat.bin, tail.bin, temp.bin and work.bin.
Apart from work.bin, all of these files can be be restored from the official PKG downloads, as
demonstrated by pkg_dec.
Moreover, this patch adds the ability to restore one's RIFs from an ux0:/license/licenses.db
SQLite database with the schema described hereafter (the RIF column being the uncompressed
512-byte binary license):
CREATE TABLE `Licenses` (
`CONTENT_ID` TEXT NOT NULL UNIQUE,
`RIF` BLOB NOT NULL,
PRIMARY KEY(`CONTENT_ID`)
);
With both these feature and provided that one's personal licenses have been backed up in
ux0:/license/licenses.db, Vita users can conveniently restore or reinstall their legally
owned content, straight from Sony's PKG files.
2017-10-26 21:52:22 +00:00
|
|
|
}
|
|
|
|
|
2018-01-27 21:37:09 +00:00
|
|
|
#define NET_MEMORY_SIZE (4 * 1024 * 1024)
|
|
|
|
|
|
|
|
static char *net_memory = NULL;
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
static void initNet() {
|
2018-01-27 21:37:09 +00:00
|
|
|
net_memory = malloc(NET_MEMORY_SIZE);
|
2016-09-04 08:44:48 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
SceNetInitParam param;
|
2018-01-27 21:37:09 +00:00
|
|
|
param.memory = net_memory;
|
|
|
|
param.size = NET_MEMORY_SIZE;
|
2017-10-13 10:42:36 +00:00
|
|
|
param.flags = 0;
|
2016-09-04 08:44:48 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
sceNetInit(¶m);
|
|
|
|
sceNetCtlInit();
|
2016-09-04 08:44:48 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
sceSslInit(300 * 1024);
|
|
|
|
sceHttpInit(40 * 1024);
|
2017-09-17 20:59:38 +00:00
|
|
|
|
2017-10-13 10:42:36 +00:00
|
|
|
sceHttpsDisableOption(SCE_HTTPS_FLAG_SERVER_VERIFY);
|
2018-01-26 10:36:14 +00:00
|
|
|
|
|
|
|
sceNetAdhocInit();
|
|
|
|
|
|
|
|
SceNetAdhocctlAdhocId adhocId;
|
|
|
|
memset(&adhocId, 0, sizeof(SceNetAdhocctlAdhocId));
|
|
|
|
adhocId.type = SCE_NET_ADHOCCTL_ADHOCTYPE_RESERVED;
|
2018-01-27 14:28:51 +00:00
|
|
|
memcpy(&adhocId.data[0], VITASHELL_TITLEID, SCE_NET_ADHOCCTL_ADHOCID_LEN);
|
2018-01-26 10:36:14 +00:00
|
|
|
sceNetAdhocctlInit(&adhocId);
|
2016-09-04 08:44:48 +00:00
|
|
|
}
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
static void finishNet() {
|
2018-01-26 10:36:14 +00:00
|
|
|
sceNetAdhocctlTerm();
|
|
|
|
sceNetAdhocTerm();
|
2017-10-13 10:42:36 +00:00
|
|
|
sceSslTerm();
|
|
|
|
sceHttpTerm();
|
|
|
|
sceNetCtlTerm();
|
2018-01-27 21:37:09 +00:00
|
|
|
sceNetTerm();
|
|
|
|
free(net_memory);
|
2016-09-04 08:44:48 +00:00
|
|
|
}
|
|
|
|
|
2017-02-26 21:02:29 +00:00
|
|
|
void installDefaultFiles() {
|
2017-10-13 10:42:36 +00:00
|
|
|
// Make VitaShell folders
|
|
|
|
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);
|
|
|
|
sceIoMkdir("ux0:VitaShell/theme/Electron", 0777);
|
|
|
|
|
|
|
|
// Write default files if they don't exist
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < (sizeof(default_files) / sizeof(DefaultFile)); i++) {
|
|
|
|
SceIoStat stat;
|
|
|
|
memset(&stat, 0, sizeof(stat));
|
|
|
|
if (sceIoGetstat(default_files[i].path, &stat) < 0 || (default_files[i].replace && (int)stat.st_size != default_files[i].size))
|
|
|
|
WriteFile(default_files[i].path, default_files[i].buffer, default_files[i].size);
|
|
|
|
}
|
2017-02-26 21:02:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void initVitaShell() {
|
2017-10-13 10:42:36 +00:00
|
|
|
// Set CPU to 444mhz
|
|
|
|
scePowerSetArmClockFrequency(444);
|
|
|
|
|
|
|
|
// Init SceShellUtil events
|
|
|
|
sceShellUtilInitEvents(0);
|
|
|
|
|
|
|
|
// Prevent automatic CMA connection
|
|
|
|
sceShellUtilLock(SCE_SHELL_UTIL_LOCK_TYPE_USB_CONNECTION);
|
|
|
|
|
|
|
|
// Get titleid
|
|
|
|
memset(vitashell_titleid, 0, sizeof(vitashell_titleid));
|
|
|
|
sceAppMgrAppParamGetString(sceKernelGetProcessId(), 12, vitashell_titleid, sizeof(vitashell_titleid));
|
|
|
|
|
|
|
|
// Allow writing to ux0:app/VITASHELL
|
|
|
|
sceAppMgrUmount("app0:");
|
2018-03-27 15:15:16 +00:00
|
|
|
sceAppMgrUmount("savedata0:");
|
2017-10-13 10:42:36 +00:00
|
|
|
|
|
|
|
// Is safe mode
|
|
|
|
if (sceIoDevctl("ux0:", 0x3001, NULL, 0, NULL, 0) == 0x80010030)
|
|
|
|
is_safe_mode = 1;
|
|
|
|
|
|
|
|
// Set sampling mode
|
|
|
|
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
|
|
|
|
|
|
|
|
// Load modules
|
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_VIDEO_EXPORT);
|
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_PGF);
|
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_MUSIC_EXPORT);
|
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_PHOTO_EXPORT);
|
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_NET);
|
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_HTTPS);
|
2018-01-26 10:36:14 +00:00
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_PSPNET_ADHOC);
|
Add DLC refresh + restore license from Sqlite DB
DLC from ux0:addcont/ is now installed during refresh, provided there exists an sce_sys/package/
directory containing: body.bin, head.bin, inst.bin stat.bin, tail.bin, temp.bin and work.bin.
Apart from work.bin, all of these files can be be restored from the official PKG downloads, as
demonstrated by pkg_dec.
Moreover, this patch adds the ability to restore one's RIFs from an ux0:/license/licenses.db
SQLite database with the schema described hereafter (the RIF column being the uncompressed
512-byte binary license):
CREATE TABLE `Licenses` (
`CONTENT_ID` TEXT NOT NULL UNIQUE,
`RIF` BLOB NOT NULL,
PRIMARY KEY(`CONTENT_ID`)
);
With both these feature and provided that one's personal licenses have been backed up in
ux0:/license/licenses.db, Vita users can conveniently restore or reinstall their legally
owned content, straight from Sony's PKG files.
2017-10-26 21:52:22 +00:00
|
|
|
sceSysmoduleLoadModule(SCE_SYSMODULE_SQLITE);
|
2017-10-13 10:42:36 +00:00
|
|
|
|
|
|
|
// Init
|
|
|
|
vitaAudioInit(0x40);
|
|
|
|
initVita2dLib();
|
|
|
|
initSceAppUtil();
|
|
|
|
initNet();
|
|
|
|
initQR();
|
Add DLC refresh + restore license from Sqlite DB
DLC from ux0:addcont/ is now installed during refresh, provided there exists an sce_sys/package/
directory containing: body.bin, head.bin, inst.bin stat.bin, tail.bin, temp.bin and work.bin.
Apart from work.bin, all of these files can be be restored from the official PKG downloads, as
demonstrated by pkg_dec.
Moreover, this patch adds the ability to restore one's RIFs from an ux0:/license/licenses.db
SQLite database with the schema described hereafter (the RIF column being the uncompressed
512-byte binary license):
CREATE TABLE `Licenses` (
`CONTENT_ID` TEXT NOT NULL UNIQUE,
`RIF` BLOB NOT NULL,
PRIMARY KEY(`CONTENT_ID`)
);
With both these feature and provided that one's personal licenses have been backed up in
ux0:/license/licenses.db, Vita users can conveniently restore or reinstall their legally
owned content, straight from Sony's PKG files.
2017-10-26 21:52:22 +00:00
|
|
|
initSQLite();
|
2017-10-13 10:42:36 +00:00
|
|
|
|
|
|
|
// Init power tick thread
|
|
|
|
initPowerTickThread();
|
|
|
|
|
|
|
|
// Delete VitaShell updater if available
|
|
|
|
if (checkAppExist("VSUPDATER")) {
|
|
|
|
deleteApp("VSUPDATER");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Install default files
|
|
|
|
installDefaultFiles();
|
|
|
|
|
|
|
|
// Load modules
|
2019-01-25 20:06:08 +00:00
|
|
|
int search_unk[2];
|
|
|
|
SceUID search_modid;
|
|
|
|
search_modid = _vshKernelSearchModuleByName("VitaShellPatch", search_unk);
|
|
|
|
if(search_modid < 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);
|
|
|
|
}
|
2018-06-17 17:39:58 +00:00
|
|
|
}
|
2019-01-25 20:06:08 +00:00
|
|
|
search_modid = _vshKernelSearchModuleByName("VitaShellKernel2", search_unk);
|
|
|
|
if(search_modid < 0) {
|
|
|
|
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);
|
|
|
|
}
|
2018-06-17 17:39:58 +00:00
|
|
|
}
|
2017-10-13 10:42:36 +00:00
|
|
|
user_modid = sceKernelLoadStartModule("ux0:VitaShell/module/user.suprx", 0, NULL, 0, NULL, NULL);
|
2018-09-13 10:00:30 +00:00
|
|
|
|
|
|
|
// clear up recent folder frequently
|
|
|
|
SceIoStat stat;
|
|
|
|
SceDateTime now;
|
|
|
|
sceRtcGetCurrentClock(&now, 0);
|
|
|
|
int res = sceIoGetstat(VITASHELL_RECENT_PATH, &stat);
|
|
|
|
if (res >= 0) {
|
|
|
|
if (now.year * 365 + now.day - stat.st_ctime.year * 365 - stat.st_ctime.day
|
|
|
|
>= VITASHELL_RECENT_PATH_DELETE_INTERVAL_DAYS) {
|
|
|
|
removePath(VITASHELL_RECENT_PATH, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!checkFolderExist(VITASHELL_BOOKMARKS_PATH)) {
|
|
|
|
sceIoMkdir(VITASHELL_BOOKMARKS_PATH, 0777);
|
|
|
|
}
|
|
|
|
if (!checkFolderExist(VITASHELL_RECENT_PATH)) {
|
|
|
|
sceIoMkdir(VITASHELL_RECENT_PATH, 0777);
|
|
|
|
}
|
|
|
|
time_last_recent_files = 0;
|
2018-09-13 12:46:10 +00:00
|
|
|
time_last_bookmarks = 0;
|
2016-08-06 06:59:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void finishVitaShell() {
|
2017-10-13 10:42:36 +00:00
|
|
|
// Finish
|
2017-10-29 00:10:36 +00:00
|
|
|
finishSQLite();
|
2017-10-13 10:42:36 +00:00
|
|
|
finishNet();
|
|
|
|
finishSceAppUtil();
|
|
|
|
finishVita2dLib();
|
|
|
|
finishQR();
|
|
|
|
vitaAudioShutdown();
|
|
|
|
|
|
|
|
// Unload modules
|
2018-01-26 10:36:14 +00:00
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_SQLITE);
|
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_PSPNET_ADHOC);
|
2017-10-13 10:42:36 +00:00
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_HTTPS);
|
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_NET);
|
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_PHOTO_EXPORT);
|
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_MUSIC_EXPORT);
|
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_PGF);
|
|
|
|
sceSysmoduleUnloadModule(SCE_SYSMODULE_VIDEO_EXPORT);
|
2016-08-12 19:30:04 +00:00
|
|
|
}
|