From a9b4f7ca94e898f9a722d2891e36e0bdb1253064 Mon Sep 17 00:00:00 2001 From: TheFloW Date: Wed, 2 Nov 2016 19:54:40 +0100 Subject: [PATCH] molecularShell v1.42 --- Makefile | 2 +- README.md | 11 ++++ language.c | 1 + language.h | 1 + main.c | 15 +++-- main.h | 5 +- network_update.c | 2 +- pkg/sce_sys/livearea/contents/template.xml | 2 +- resources/changeinfo.txt | 13 +++++ resources/english_us.txt | 1 + settings.c | 67 +++++++++++++++------- settings.h | 3 + vitashell_config.h | 26 +++++++++ 13 files changed, 120 insertions(+), 29 deletions(-) create mode 100644 vitashell_config.h diff --git a/Makefile b/Makefile index 51937f49..b58c4a23 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ ASFLAGS = $(CFLAGS) all: $(TARGET).vpk %.vpk: eboot.bin - vita-mksfoex -d PARENTAL_LEVEL=1 -s APP_VER=01.41 -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo + vita-mksfoex -d PARENTAL_LEVEL=1 -s APP_VER=01.42 -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo vita-pack-vpk -s param.sfo -b eboot.bin \ --add pkg/sce_sys/icon0.png=sce_sys/icon0.png \ --add pkg/sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \ diff --git a/README.md b/README.md index 4e2ada6f..5b06be05 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,17 @@ Be sure you pull request your customized design or language file there. * sakya for Lightmp3 * Everybody who contributed on vitasdk +### Changelog 1.42 ### +- Added a brand new settings menu which is accessible by pressing START (design by WesleyPolicena). + This adds the ability to disable auto-update and power options have been added where you can + reboot, enter standby or turn off your device. +- Fixed local date being incorrect. +- The name 'molecularShell' will now be displayed if it's runned as molecularShell, otherwise 'VitaShell'. + This will help differentiating the two applications, as molecularShell is from now on a safe homebrew + and doesn't have the full range of features like VitaShell. Additionally in molecularShell you can see + the HENkaku settings section which are hidden in VitaShell (note that both still share the same eboot.bin, + only the flag is different). + ### Changelog 1.41 ### - Added ability to sort files and folders by size and date. Press R to switch sort method. - Added the long desired 'Properties' feature. You can also check whether an eboot.bin is safe or not. diff --git a/language.c b/language.c index 4a219c6c..b10eb807 100644 --- a/language.c +++ b/language.c @@ -180,6 +180,7 @@ void loadLanguage(int id) { LANGUAGE_ENTRY(VITASHELL_SETTINGS_MAIN), LANGUAGE_ENTRY(VITASHELL_SETTINGS_LANGUAGE), LANGUAGE_ENTRY(VITASHELL_SETTINGS_THEME), + LANGUAGE_ENTRY(VITASHELL_SETTINGS_NO_AUTO_UPDATE), LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWER), LANGUAGE_ENTRY(VITASHELL_SETTINGS_REBOOT), LANGUAGE_ENTRY(VITASHELL_SETTINGS_POWEROFF), diff --git a/language.h b/language.h index 16062beb..a71fd726 100644 --- a/language.h +++ b/language.h @@ -139,6 +139,7 @@ enum LanguageContainer { VITASHELL_SETTINGS_MAIN, VITASHELL_SETTINGS_LANGUAGE, VITASHELL_SETTINGS_THEME, + VITASHELL_SETTINGS_NO_AUTO_UPDATE, VITASHELL_SETTINGS_POWER, VITASHELL_SETTINGS_REBOOT, VITASHELL_SETTINGS_POWEROFF, diff --git a/main.c b/main.c index 182892bb..718b6b39 100644 --- a/main.c +++ b/main.c @@ -84,6 +84,8 @@ static int dir_level_archive = -1; static char vita_ip[16]; static unsigned short int vita_port; +VitaShellConfig vitashell_config; + char henkaku_config_path[32]; int is_molecular_shell = 0; @@ -349,7 +351,7 @@ void drawShellInfo(char *path) { if (version[3] == '0') version[3] = '\0'; - pgf_draw_textf(SHELL_MARGIN_X, SHELL_MARGIN_Y, TITLE_COLOR, FONT_SIZE, "VitaShell %s", version); + pgf_draw_textf(SHELL_MARGIN_X, SHELL_MARGIN_Y, TITLE_COLOR, FONT_SIZE, "%s %s", is_molecular_shell ? "molecularShell" : "VitaShell", version); // Battery float battery_x = ALIGN_RIGHT(SCREEN_WIDTH - SHELL_MARGIN_X, vita2d_texture_get_width(battery_image)); @@ -1978,6 +1980,9 @@ int main(int argc, const char *argv[]) { if (current_buttons & SCE_CTRL_LTRIGGER) use_custom_config = 0; + // Load settings + loadSettingsConfig(); + // Load theme loadTheme(); @@ -1989,9 +1994,11 @@ int main(int argc, const char *argv[]) { initTextContextMenuWidth(); // Automatic network update - SceUID thid = sceKernelCreateThread("network_update_thread", (SceKernelThreadEntry)network_update_thread, 0x10000100, 0x100000, 0, 0, NULL); - if (thid >= 0) - sceKernelStartThread(thid, 0, NULL); + if (!vitashell_config.disable_autoupdate) { + SceUID thid = sceKernelCreateThread("network_update_thread", (SceKernelThreadEntry)network_update_thread, 0x10000100, 0x100000, 0, 0, NULL); + if (thid >= 0) + sceKernelStartThread(thid, 0, NULL); + } // Main shellMain(); diff --git a/main.h b/main.h index 927094c9..8df0bd52 100644 --- a/main.h +++ b/main.h @@ -62,6 +62,7 @@ #include #include "functions.h" +#include "vitashell_config.h" #define INCLUDE_EXTERN_RESOURCE(name) extern unsigned char _binary_resources_##name##_start; extern unsigned char _binary_resources_##name##_size; \ @@ -69,7 +70,7 @@ // VitaShell version major.minor #define VITASHELL_VERSION_MAJOR 0x01 -#define VITASHELL_VERSION_MINOR 0x41 +#define VITASHELL_VERSION_MINOR 0x42 #define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10)) @@ -208,6 +209,8 @@ enum DialogSteps { extern vita2d_pgf *font; extern char font_size_cache[256]; +extern VitaShellConfig vitashell_config; + extern char henkaku_config_path[32]; extern int is_molecular_shell; diff --git a/network_update.c b/network_update.c index f6a6e10e..94c7a1dc 100644 --- a/network_update.c +++ b/network_update.c @@ -27,7 +27,7 @@ #include "utils.h" #define BASE_ADDRESS "https://github.com/TheOfficialFloW/VitaShell/releases/download" -#define VERSION_URL "/0.1/version.bin" +#define VERSION_URL "/0.2/version.bin" #define VITASHELL_UPDATE_FILE "ux0:VitaShell/internal/VitaShell.vpk" #define VITASHELL_VERSION_FILE "ux0:VitaShell/internal/version.bin" diff --git a/pkg/sce_sys/livearea/contents/template.xml b/pkg/sce_sys/livearea/contents/template.xml index d1113505..d77e036b 100644 --- a/pkg/sce_sys/livearea/contents/template.xml +++ b/pkg/sce_sys/livearea/contents/template.xml @@ -28,7 +28,7 @@ - v1.41 + v1.42 diff --git a/resources/changeinfo.txt b/resources/changeinfo.txt index 58faf15c..75bd202d 100644 --- a/resources/changeinfo.txt +++ b/resources/changeinfo.txt @@ -193,4 +193,17 @@ - Added the long desired 'Properties' feature. You can also check whether an eboot.bin is safe or not.
]]> + + + This adds the ability to disable auto-update and power options have been added where you can
+ reboot, enter standby or turn off your device.
+- Fixed local date being incorrect.
+- The name 'molecularShell' will now be displayed if it's runned as molecularShell, otherwise 'VitaShell'.
+ This will help differentiating the two applications, as molecularShell is from now on a safe homebrew
+ and doesn't have the full range of features like VitaShell. Additionally in molecularShell you can see
+ the HENkaku settings section which are hidden in VitaShell (note that both still share the same eboot.bin,
+ only the flag is different).
+ ]]> +
diff --git a/resources/english_us.txt b/resources/english_us.txt index 30633405..42fc7712 100644 --- a/resources/english_us.txt +++ b/resources/english_us.txt @@ -119,6 +119,7 @@ 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_NO_AUTO_UPDATE = "Disable auto-update" VITASHELL_SETTINGS_POWER = "Power" VITASHELL_SETTINGS_REBOOT = "Reboot" VITASHELL_SETTINGS_POWEROFF = "Power off" diff --git a/settings.c b/settings.c index 8fca2f1e..e8de686c 100644 --- a/settings.c +++ b/settings.c @@ -17,6 +17,7 @@ */ #include "main.h" +#include "config.h" #include "init.h" #include "theme.h" #include "language.h" @@ -35,9 +36,10 @@ - Spoofed version * Main * - - CPU - Language - Theme + - CPU + - Disable auto-update * FTP * - Auto-start @@ -51,16 +53,19 @@ void rebootDevice(); void shutdownDevice(); void suspendDevice(); +static int changed = 0; + static HENkakuConfig henkaku_config; static char spoofed_version[6]; -// Dummy -int language, theme; - static SettingsMenuEntry *settings_menu_entries = NULL; static int n_settings_entries = 0; +static ConfigEntry settings_entries[] = { + { "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 }, @@ -70,8 +75,9 @@ SettingsMenuOption henkaku_settings[] = { }; 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_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 }, }; SettingsMenuOption power_settings[] = { @@ -82,12 +88,12 @@ SettingsMenuOption power_settings[] = { SettingsMenuEntry molecularshell_settings_menu_entries[] = { { HENKAKU_SETTINGS, henkaku_settings, sizeof(henkaku_settings) / sizeof(SettingsMenuOption) }, - // { VITASHELL_SETTINGS_MAIN, main_settings, sizeof(main_settings) / sizeof(SettingsMenuOption) }, + { VITASHELL_SETTINGS_MAIN, main_settings, sizeof(main_settings) / sizeof(SettingsMenuOption) }, { VITASHELL_SETTINGS_POWER, power_settings, sizeof(power_settings) / sizeof(SettingsMenuOption) }, }; SettingsMenuEntry vitashell_settings_menu_entries[] = { - // { VITASHELL_SETTINGS_MAIN, main_settings, sizeof(main_settings) / sizeof(SettingsMenuOption) }, + { VITASHELL_SETTINGS_MAIN, main_settings, sizeof(main_settings) / sizeof(SettingsMenuOption) }, { VITASHELL_SETTINGS_POWER, power_settings, sizeof(power_settings) / sizeof(SettingsMenuOption) }, }; @@ -98,6 +104,17 @@ static float easeOut(float x0, float x1, float a) { return ((dx * a) > 0.01f) ? (dx * a) : dx; } +void loadSettingsConfig() { + // Load settings config file + memset(&vitashell_config, 0, sizeof(VitaShellConfig)); + readConfig("ux0:VitaShell/settings.txt", settings_entries, sizeof(settings_entries) / sizeof(ConfigEntry)); +} + +void saveSettingsConfig() { + // Save settings config file + writeConfig("ux0:VitaShell/settings.txt", settings_entries, sizeof(settings_entries) / sizeof(ConfigEntry)); +} + void rebootDevice() { closeSettingsMenu(); scePowerRequestColdReset(); @@ -169,27 +186,33 @@ void openSettingsMenu() { strcpy(spoofed_version, HENKAKU_DEFAULT_VERSION_STRING); } } + + changed = 0; } void closeSettingsMenu() { settings_menu.status = SETTINGS_MENU_CLOSING; - if (is_molecular_shell) { - if (IS_DIGIT(spoofed_version[0]) && spoofed_version[1] == '.' && IS_DIGIT(spoofed_version[2]) && IS_DIGIT(spoofed_version[3])) { - char a = spoofed_version[0] - '0'; - char b = spoofed_version[2] - '0'; - char c = spoofed_version[3] - '0'; - char d = IS_DIGIT(spoofed_version[4]) ? spoofed_version[4] - '0' : '\0'; + if (changed) { + if (is_molecular_shell) { + if (IS_DIGIT(spoofed_version[0]) && spoofed_version[1] == '.' && IS_DIGIT(spoofed_version[2]) && IS_DIGIT(spoofed_version[3])) { + char a = spoofed_version[0] - '0'; + char b = spoofed_version[2] - '0'; + char c = spoofed_version[3] - '0'; + char d = IS_DIGIT(spoofed_version[4]) ? spoofed_version[4] - '0' : '\0'; - henkaku_config.spoofed_version = ((a << 28) | (b << 24) | (c << 20) | (d << 16)); - } else { - henkaku_config.spoofed_version = 0; - } + henkaku_config.spoofed_version = ((a << 28) | (b << 24) | (c << 20) | (d << 16)); + } else { + henkaku_config.spoofed_version = 0; + } + + henkaku_config.magic = HENKAKU_CONFIG_MAGIC; + henkaku_config.version = HENKAKU_VERSION; - henkaku_config.magic = HENKAKU_CONFIG_MAGIC; - henkaku_config.version = HENKAKU_VERSION; + WriteFile(henkaku_config_path, &henkaku_config, sizeof(HENkakuConfig)); + } - WriteFile(henkaku_config_path, &henkaku_config, sizeof(HENkakuConfig)); + saveSettingsConfig(); } } @@ -288,6 +311,8 @@ void settingsMenuCtrl() { // Change options if (pressed_buttons & (SCE_CTRL_ENTER | SCE_CTRL_LEFT | SCE_CTRL_RIGHT)) { + changed = 1; + if (option->name == HENKAKU_ENABLE_UNSAFE_HOMEBREW) { if (*(option->value) == 0) { initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_OK, language_container[HENKAKU_UNSAFE_HOMEBREW_MESSAGE]); diff --git a/settings.h b/settings.h index 0648b49c..e88963a8 100644 --- a/settings.h +++ b/settings.h @@ -62,6 +62,9 @@ typedef struct { int n_options; } SettingsMenuEntry; +void loadSettingsConfig(); +void saveSettingsConfig(); + void initSettingsMenu(); void openSettingsMenu(); void closeSettingsMenu(); diff --git a/vitashell_config.h b/vitashell_config.h new file mode 100644 index 00000000..3ef57dc0 --- /dev/null +++ b/vitashell_config.h @@ -0,0 +1,26 @@ +/* + VitaShell + Copyright (C) 2015-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 . +*/ + +#ifndef __VITASHELL_CONFIGURATION_H__ +#define __VITASHELL_CONFIGURATION_H__ + +typedef struct { + int disable_autoupdate; +} VitaShellConfig; + +#endif \ No newline at end of file