Skip to content

Commit

Permalink
molecularShell v1.42
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Nov 2, 2016
1 parent c17c07b commit a9b4f7c
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -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 \
Expand Down
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions language.c
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions language.h
Expand Up @@ -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,
Expand Down
15 changes: 11 additions & 4 deletions main.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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();

Expand All @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion main.h
Expand Up @@ -62,14 +62,15 @@
#include <ftpvita.h>

#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; \

#define ENABLE_FILE_LOGGING 1

// 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))

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion network_update.c
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion pkg/sce_sys/livearea/contents/template.xml
Expand Up @@ -28,7 +28,7 @@
<frame id="frame4">
<liveitem>
<text align="left" text-align="left" word-wrap="off" ellipsis="on">
<str size="18" color="#ffffff" shadow="on">v1.41</str>
<str size="18" color="#ffffff" shadow="on">v1.42</str>
</text>
</liveitem>
</frame>
Expand Down
13 changes: 13 additions & 0 deletions resources/changeinfo.txt
Expand Up @@ -193,4 +193,17 @@
- Added the long desired 'Properties' feature. You can also check whether an eboot.bin is safe or not.<br>
]]>
</changes>
<changes app_ver="01.42">
<![CDATA[
- Added a brand new settings menu which is accessible by pressing START (design by WesleyPolicena).<br>
This adds the ability to disable auto-update and power options have been added where you can<br>
reboot, enter standby or turn off your device.<br>
- Fixed local date being incorrect.<br>
- The name 'molecularShell' will now be displayed if it's runned as molecularShell, otherwise 'VitaShell'.<br>
This will help differentiating the two applications, as molecularShell is from now on a safe homebrew<br>
and doesn't have the full range of features like VitaShell. Additionally in molecularShell you can see<br>
the HENkaku settings section which are hidden in VitaShell (note that both still share the same eboot.bin,<br>
only the flag is different).<br>
]]>
</changes>
</changeinfo>
1 change: 1 addition & 0 deletions resources/english_us.txt
Expand Up @@ -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"
Expand Down
67 changes: 46 additions & 21 deletions settings.c
Expand Up @@ -17,6 +17,7 @@
*/

#include "main.h"
#include "config.h"
#include "init.h"
#include "theme.h"
#include "language.h"
Expand All @@ -35,9 +36,10 @@
- Spoofed version
* Main *
- CPU
- Language
- Theme
- CPU
- Disable auto-update
* FTP *
- Auto-start
Expand All @@ -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 },
Expand All @@ -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[] = {
Expand All @@ -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) },
};

Expand All @@ -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();
Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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]);
Expand Down
3 changes: 3 additions & 0 deletions settings.h
Expand Up @@ -62,6 +62,9 @@ typedef struct {
int n_options;
} SettingsMenuEntry;

void loadSettingsConfig();
void saveSettingsConfig();

void initSettingsMenu();
void openSettingsMenu();
void closeSettingsMenu();
Expand Down
26 changes: 26 additions & 0 deletions 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 <http://www.gnu.org/licenses/>.
*/

#ifndef __VITASHELL_CONFIGURATION_H__
#define __VITASHELL_CONFIGURATION_H__

typedef struct {
int disable_autoupdate;
} VitaShellConfig;

#endif

0 comments on commit a9b4f7c

Please sign in to comment.