From 36a16a48ea22b01f4a15de015bc07cea5e9e52c2 Mon Sep 17 00:00:00 2001 From: TheFloW Date: Mon, 27 Aug 2018 17:51:18 +0200 Subject: [PATCH] Added ability to disable vpk warning --- CHANGELOG.md | 1 + config.c | 5 +---- language.c | 1 + language.h | 1 + modules/kernel/exports.yml | 2 +- modules/kernel/vitashell_kernel.h | 2 +- modules/patch/exports.yml | 2 +- modules/patch/main.c | 2 +- modules/usbdevice/exports.yml | 2 +- modules/user/exports.yml | 2 +- modules/user/main.c | 2 +- modules/user/vitashell_user.h | 2 +- package_installer.c | 9 +++------ refresh.c | 5 +---- resources/english_us.txt | 1 + settings.c | 15 ++++++++------- vitashell_config.h | 1 + 17 files changed, 26 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3c9d6..6398b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Changelog 1.95 +- Added option to disable warning messages when installing vpks. - Fixed bug in USB connection, where your Memory Card could be corrupted. - Fixed line breaks in SFO files and long names will now scroll. - Fixed compatibility with `udcd_uvc.skprx ` thanks to xerpi. diff --git a/config.c b/config.c index 2c4c535..5f74abb 100644 --- a/config.c +++ b/config.c @@ -222,11 +222,8 @@ int readConfigBuffer(void *buffer, int size, ConfigEntry *entries, int n_entries int readConfig(const char *path, ConfigEntry *entries, int n_entries) { void *buffer = NULL; int size = allocateReadFile(path, &buffer); - if (size < 0) { - if (buffer) - free(buffer); + if (size < 0) return size; - } readConfigBuffer(buffer, size, entries, n_entries); diff --git a/language.c b/language.c index eb3efc4..dfb0b5a 100644 --- a/language.c +++ b/language.c @@ -219,6 +219,7 @@ void loadLanguage(int id) { LANGUAGE_ENTRY(VITASHELL_SETTINGS_USBDEVICE), LANGUAGE_ENTRY(VITASHELL_SETTINGS_SELECT_BUTTON), LANGUAGE_ENTRY(VITASHELL_SETTINGS_NO_AUTO_UPDATE), + LANGUAGE_ENTRY(VITASHELL_SETTINGS_WARNING_MESSAGE), LANGUAGE_ENTRY(VITASHELL_SETTINGS_RESTART_SHELL), LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWER), LANGUAGE_ENTRY(VITASHELL_SETTINGS_REBOOT), diff --git a/language.h b/language.h index 8afc307..df4377b 100644 --- a/language.h +++ b/language.h @@ -178,6 +178,7 @@ enum LanguageContainer { VITASHELL_SETTINGS_USBDEVICE, VITASHELL_SETTINGS_SELECT_BUTTON, VITASHELL_SETTINGS_NO_AUTO_UPDATE, + VITASHELL_SETTINGS_WARNING_MESSAGE, VITASHELL_SETTINGS_RESTART_SHELL, VITASHELL_SETTINGS_POWER, VITASHELL_SETTINGS_REBOOT, diff --git a/modules/kernel/exports.yml b/modules/kernel/exports.yml index 7a528f8..a3c3d3e 100644 --- a/modules/kernel/exports.yml +++ b/modules/kernel/exports.yml @@ -13,4 +13,4 @@ VitaShellKernel2: - shellKernelIsUx0Redirected - shellKernelRedirectUx0 - shellKernelMountById - - shellKernelGetRifVitaKey \ No newline at end of file + - shellKernelGetRifVitaKey diff --git a/modules/kernel/vitashell_kernel.h b/modules/kernel/vitashell_kernel.h index 56654ce..5ca10bc 100644 --- a/modules/kernel/vitashell_kernel.h +++ b/modules/kernel/vitashell_kernel.h @@ -33,4 +33,4 @@ int shellKernelRedirectUx0(const char *blkdev, const char *blkdev2); int shellKernelMountById(ShellMountIdArgs *args); int shellKernelGetRifVitaKey(const void *license_buf, void *klicensee); -#endif \ No newline at end of file +#endif diff --git a/modules/patch/exports.yml b/modules/patch/exports.yml index 9c62760..5740da6 100644 --- a/modules/patch/exports.yml +++ b/modules/patch/exports.yml @@ -5,4 +5,4 @@ VitaShellPatch: minor: 0 main: start: module_start - stop: module_stop \ No newline at end of file + stop: module_stop diff --git a/modules/patch/main.c b/modules/patch/main.c index 9f32d56..5206510 100644 --- a/modules/patch/main.c +++ b/modules/patch/main.c @@ -56,4 +56,4 @@ int module_stop(SceSize args, void *argp) { taiInjectReleaseForKernel(hooks[0]); return SCE_KERNEL_STOP_SUCCESS; -} \ No newline at end of file +} diff --git a/modules/usbdevice/exports.yml b/modules/usbdevice/exports.yml index d0899dd..5f3f12f 100644 --- a/modules/usbdevice/exports.yml +++ b/modules/usbdevice/exports.yml @@ -5,4 +5,4 @@ VitaShellUsbDevice: minor: 0 main: start: module_start - stop: module_stop \ No newline at end of file + stop: module_stop diff --git a/modules/user/exports.yml b/modules/user/exports.yml index 1a94a02..3da505f 100644 --- a/modules/user/exports.yml +++ b/modules/user/exports.yml @@ -13,4 +13,4 @@ VitaShellUser: - shellUserIsUx0Redirected - shellUserRedirectUx0 - shellUserMountById - - shellUserGetRifVitaKey \ No newline at end of file + - shellUserGetRifVitaKey diff --git a/modules/user/main.c b/modules/user/main.c index debc2e1..6223b70 100644 --- a/modules/user/main.c +++ b/modules/user/main.c @@ -49,4 +49,4 @@ int module_start(SceSize args, void *argp) { int module_stop(SceSize args, void *argp) { return SCE_KERNEL_STOP_SUCCESS; -} \ No newline at end of file +} diff --git a/modules/user/vitashell_user.h b/modules/user/vitashell_user.h index 31d75b3..14eb7b4 100644 --- a/modules/user/vitashell_user.h +++ b/modules/user/vitashell_user.h @@ -26,4 +26,4 @@ int shellUserRedirectUx0(const char *blkdev, const char *blkdev2); int shellUserMountById(ShellMountIdArgs *args); int shellUserGetRifVitaKey(const void *license_buf, void *klicensee); -#endif \ No newline at end of file +#endif diff --git a/package_installer.c b/package_installer.c index 5d1975c..7cadb36 100644 --- a/package_installer.c +++ b/package_installer.c @@ -193,11 +193,8 @@ int makeHeadBin() { // Read param.sfo void *sfo_buffer = NULL; int res = allocateReadFile(PACKAGE_DIR "/sce_sys/param.sfo", &sfo_buffer); - if (res < 0) { - if (sfo_buffer) - free(sfo_buffer); + if (res < 0) return res; - } // Get title id char titleid[12]; @@ -336,7 +333,7 @@ int install_thread(SceSize args_size, InstallArguments *args) { // Team molecule's request: Full permission access warning uint64_t authid = *(uint64_t *)(buffer + 0x80); - if (authid != 0x2F00000000000002) { + if (!vitashell_config.disable_warning && authid != 0x2F00000000000002) { closeWaitDialog(); initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_YESNO, language_container[INSTALL_WARNING]); @@ -399,7 +396,7 @@ int install_thread(SceSize args_size, InstallArguments *args) { // Team molecule's request: Full permission access warning int unsafe = archiveCheckFilesForUnsafeFself(); // 0: Safe, 1: Unsafe, 2: Dangerous - if (unsafe) { + if (!vitashell_config.disable_warning && unsafe) { closeWaitDialog(); initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_YESNO, language_container[unsafe == 2 ? INSTALL_BRICK_WARNING : INSTALL_WARNING]); diff --git a/refresh.c b/refresh.c index e3baaf9..d3fd87e 100644 --- a/refresh.c +++ b/refresh.c @@ -60,11 +60,8 @@ int refreshNeeded(const char *app_path) snprintf(sfo_path, MAX_PATH_LENGTH, "%s/sce_sys/param.sfo", app_path); void *sfo_buffer = NULL; int sfo_size = allocateReadFile(sfo_path, &sfo_buffer); - if (sfo_size < 0) { - if (sfo_buffer) - free(sfo_buffer); + if (sfo_size < 0) return sfo_size; - } // Get title and content ids char titleid[12], contentid[50]; diff --git a/resources/english_us.txt b/resources/english_us.txt index 9358a61..8977da4 100644 --- a/resources/english_us.txt +++ b/resources/english_us.txt @@ -159,6 +159,7 @@ VITASHELL_SETTINGS_THEME = "Theme" VITASHELL_SETTINGS_USBDEVICE = "USB device" VITASHELL_SETTINGS_SELECT_BUTTON = "SELECT button" VITASHELL_SETTINGS_NO_AUTO_UPDATE = "Disable auto-update" +VITASHELL_SETTINGS_WARNING_MESSAGE = "Disable warning messages" VITASHELL_SETTINGS_RESTART_SHELL = "Restart VitaShell" VITASHELL_SETTINGS_POWER = "Power" VITASHELL_SETTINGS_REBOOT = "Reboot" diff --git a/settings.c b/settings.c index 2913c81..3fdf3f7 100644 --- a/settings.c +++ b/settings.c @@ -57,16 +57,17 @@ static ConfigEntry theme_entries[] = { }; SettingsMenuOption main_settings[] = { - // { VITASHELL_SETTINGS_LANGUAGE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &language }, - { VITASHELL_SETTINGS_THEME, SETTINGS_OPTION_TYPE_OPTIONS, NULL, NULL, 0, NULL, 0, NULL }, + // { VITASHELL_SETTINGS_LANGUAGE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &language }, + { VITASHELL_SETTINGS_THEME, SETTINGS_OPTION_TYPE_OPTIONS, NULL, NULL, 0, NULL, 0, NULL }, - { VITASHELL_SETTINGS_USBDEVICE, SETTINGS_OPTION_TYPE_OPTIONS, NULL, NULL, 0, + { VITASHELL_SETTINGS_USBDEVICE, SETTINGS_OPTION_TYPE_OPTIONS, NULL, NULL, 0, usbdevice_options, sizeof(usbdevice_options) / sizeof(char **), &vitashell_config.usbdevice }, - { VITASHELL_SETTINGS_SELECT_BUTTON, SETTINGS_OPTION_TYPE_OPTIONS, NULL, NULL, 0, + { 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 }, - - { VITASHELL_SETTINGS_RESTART_SHELL, SETTINGS_OPTION_TYPE_CALLBACK, (void *)restartShell, NULL, 0, NULL, 0, NULL }, + { VITASHELL_SETTINGS_NO_AUTO_UPDATE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &vitashell_config.disable_autoupdate }, + { VITASHELL_SETTINGS_WARNING_MESSAGE, SETTINGS_OPTION_TYPE_BOOLEAN, NULL, NULL, 0, NULL, 0, &vitashell_config.disable_warning }, + + { VITASHELL_SETTINGS_RESTART_SHELL, SETTINGS_OPTION_TYPE_CALLBACK, (void *)restartShell, NULL, 0, NULL, 0, NULL }, }; SettingsMenuOption power_settings[] = { diff --git a/vitashell_config.h b/vitashell_config.h index d38fc35..b8ac686 100644 --- a/vitashell_config.h +++ b/vitashell_config.h @@ -35,6 +35,7 @@ typedef struct { int usbdevice; int select_button; int disable_autoupdate; + int disable_warning; } VitaShellConfig; #endif