mirror of
https://github.com/joel16/VitaShell.git
synced 2024-11-23 03:39:39 +00:00
Fixed INSTALL_WARNING text crash. Added default files creating.
This commit is contained in:
parent
5521eea923
commit
7903f04675
6
Makefile
6
Makefile
@ -4,10 +4,10 @@ OBJS = main.o init.o io_process.o package_installer.o archive.o photo.o file
|
||||
uncommon_dialog.o message_dialog.o ime_dialog.o config.o theme.o language.o utils.o sha1.o \
|
||||
audioplayer.o minizip/unzip.o minizip/ioapi.o
|
||||
|
||||
RESOURCES_PNG = resources/ftp.png resources/battery.png resources/battery_bar_green.png resources/battery_bar_red.png \
|
||||
RESOURCES_PNG = resources/ftp.png resources/dialog.png resources/context.png resources/battery.png resources/battery_bar_green.png resources/battery_bar_red.png \
|
||||
resources/headphone.png resources/audio_previous.png resources/audio_pause.png resources/audio_play.png \
|
||||
resources/audio_next.png
|
||||
RESOURCES_TXT = resources/colors.txt resources/english_us.txt
|
||||
RESOURCES_TXT = resources/theme.txt resources/colors.txt resources/english_us.txt
|
||||
OBJS += $(RESOURCES_PNG:.png=.o) $(RESOURCES_TXT:.txt=.o)
|
||||
|
||||
LIBS = -lftpvita -lvita2d -lpng -ljpeg -lz -lm -lc \
|
||||
@ -36,7 +36,7 @@ ASFLAGS = $(CFLAGS)
|
||||
all: $(TARGET).vpk
|
||||
|
||||
%.vpk: eboot.bin
|
||||
vita-mksfoex -d PARENTAL_LEVEL=1 -s APP_VER=00.80 -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
|
||||
vita-mksfoex -d PARENTAL_LEVEL=1 -s APP_VER=00.85 -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 \
|
||||
|
4
config.c
4
config.c
@ -95,7 +95,7 @@ char *getString(char *str) {
|
||||
out[len] = '\0';
|
||||
|
||||
int i;
|
||||
for (i = 0; i < strlen(out); i++) {
|
||||
for (i = 0; i < len; i++) {
|
||||
if (out[i] == '\\')
|
||||
out[i] = '\n';
|
||||
}
|
||||
@ -202,7 +202,7 @@ int readConfigBuffer(void *buffer, int size, ConfigEntry *entries, int n_entries
|
||||
}
|
||||
} while (res > 0);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int readConfig(char *path, ConfigEntry *entries, int n_entries) {
|
||||
|
52
init.c
52
init.c
@ -21,12 +21,46 @@
|
||||
#include "file.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern unsigned char _binary_resources_ftp_png_start;
|
||||
extern unsigned char _binary_resources_ftp_png_size;
|
||||
extern unsigned char _binary_resources_dialog_png_start;
|
||||
extern unsigned char _binary_resources_dialog_png_size;
|
||||
extern unsigned char _binary_resources_context_png_start;
|
||||
extern unsigned char _binary_resources_context_png_size;
|
||||
extern unsigned char _binary_resources_battery_png_start;
|
||||
extern unsigned char _binary_resources_battery_png_size;
|
||||
extern unsigned char _binary_resources_battery_bar_red_png_start;
|
||||
extern unsigned char _binary_resources_battery_bar_red_png_size;
|
||||
extern unsigned char _binary_resources_battery_bar_green_png_start;
|
||||
extern unsigned char _binary_resources_battery_bar_green_png_size;
|
||||
|
||||
extern unsigned char _binary_resources_theme_txt_start;
|
||||
extern unsigned char _binary_resources_theme_txt_size;
|
||||
|
||||
extern unsigned char _binary_resources_colors_txt_start;
|
||||
extern unsigned char _binary_resources_colors_txt_size;
|
||||
|
||||
extern unsigned char _binary_resources_english_us_txt_start;
|
||||
extern unsigned char _binary_resources_english_us_txt_size;
|
||||
|
||||
extern unsigned char _binary_resources_headphone_png_start;
|
||||
extern unsigned char _binary_resources_audio_previous_png_start;
|
||||
extern unsigned char _binary_resources_audio_pause_png_start;
|
||||
extern unsigned char _binary_resources_audio_play_png_start;
|
||||
extern unsigned char _binary_resources_audio_next_png_start;
|
||||
|
||||
DefaultFile default_files[] = {
|
||||
{ "ux0:VitaShell/language/english_us.txt", (void *)&_binary_resources_english_us_txt_start, (int)&_binary_resources_english_us_txt_size },
|
||||
{ "ux0:VitaShell/theme/theme.txt", (void *)&_binary_resources_theme_txt_start, (int)&_binary_resources_theme_txt_size },
|
||||
{ "ux0:VitaShell/theme/Default/colors.txt", (void *)&_binary_resources_colors_txt_start, (int)&_binary_resources_colors_txt_size },
|
||||
{ "ux0:VitaShell/theme/Default/ftp.png", (void *)&_binary_resources_ftp_png_start, (int)&_binary_resources_ftp_png_size },
|
||||
{ "ux0:VitaShell/theme/Default/dialog.png", (void *)&_binary_resources_dialog_png_start, (int)&_binary_resources_dialog_png_size },
|
||||
{ "ux0:VitaShell/theme/Default/context.png", (void *)&_binary_resources_context_png_start, (int)&_binary_resources_context_png_size },
|
||||
{ "ux0:VitaShell/theme/Default/battery.png", (void *)&_binary_resources_battery_png_start, (int)&_binary_resources_battery_png_size },
|
||||
{ "ux0:VitaShell/theme/Default/battery_bar_red.png", (void *)&_binary_resources_battery_bar_red_png_start, (int)&_binary_resources_battery_bar_red_png_size },
|
||||
{ "ux0:VitaShell/theme/Default/battery_bar_green.png", (void *)&_binary_resources_battery_bar_green_png_start, (int)&_binary_resources_battery_bar_green_png_size },
|
||||
};
|
||||
|
||||
vita2d_pgf *font = NULL;
|
||||
char font_size_cache[256];
|
||||
|
||||
@ -114,6 +148,9 @@ void finishVita2dLib() {
|
||||
}
|
||||
|
||||
void initVitaShell() {
|
||||
// Init random number generator
|
||||
srand(time(NULL));
|
||||
|
||||
// Set sampling mode
|
||||
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
|
||||
|
||||
@ -136,6 +173,21 @@ void initVitaShell() {
|
||||
|
||||
// Init power tick thread
|
||||
initPowerTickThread();
|
||||
|
||||
// Make VitaShell folders
|
||||
sceIoMkdir("ux0:VitaShell", 0777);
|
||||
sceIoMkdir("ux0:VitaShell/language", 0777);
|
||||
sceIoMkdir("ux0:VitaShell/theme", 0777);
|
||||
sceIoMkdir("ux0:VitaShell/theme/Default", 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)
|
||||
WriteFile(default_files[i].path, default_files[i].buffer, default_files[i].size);
|
||||
}
|
||||
}
|
||||
|
||||
void finishVitaShell() {
|
||||
|
6
init.h
6
init.h
@ -23,6 +23,12 @@
|
||||
|
||||
extern int language, enter_button, date_format, time_format;
|
||||
|
||||
typedef struct {
|
||||
char *path;
|
||||
void *buffer;
|
||||
int size;
|
||||
} DefaultFile;
|
||||
|
||||
void initSceAppUtil();
|
||||
void finishSceAppUtil();
|
||||
|
||||
|
@ -31,8 +31,6 @@ void closeWaitDialog() {
|
||||
while (updateMessageDialog() != MESSAGE_DIALOG_RESULT_NONE) {
|
||||
sceKernelDelayThread(1000);
|
||||
}
|
||||
|
||||
dialog_step = DIALOG_STEP_CANCELLED;
|
||||
}
|
||||
|
||||
int cancelHandler() {
|
||||
@ -145,6 +143,7 @@ int delete_thread(SceSize args_size, DeleteArguments *args) {
|
||||
int res = removePath(path, &value, folders + files, SetProgress, cancelHandler);
|
||||
if (res <= 0) {
|
||||
closeWaitDialog();
|
||||
dialog_step = DIALOG_STEP_CANCELLED;
|
||||
errorDialog(res);
|
||||
goto EXIT;
|
||||
}
|
||||
@ -210,6 +209,7 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
|
||||
|
||||
if (cancelHandler()) {
|
||||
closeWaitDialog();
|
||||
dialog_step = DIALOG_STEP_CANCELLED;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
@ -273,6 +273,7 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
|
||||
int res = extractArchivePath(src_path, dst_path, &value, size + folders, SetProgress, cancelHandler);
|
||||
if (res <= 0) {
|
||||
closeWaitDialog();
|
||||
dialog_step = DIALOG_STEP_CANCELLED;
|
||||
errorDialog(res);
|
||||
goto EXIT;
|
||||
}
|
||||
@ -280,6 +281,7 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
|
||||
int res = copyPath(src_path, dst_path, &value, size + folders, SetProgress, cancelHandler);
|
||||
if (res <= 0) {
|
||||
closeWaitDialog();
|
||||
dialog_step = DIALOG_STEP_CANCELLED;
|
||||
errorDialog(res);
|
||||
goto EXIT;
|
||||
}
|
||||
|
8
main.c
8
main.c
@ -1279,14 +1279,6 @@ int main(int argc, const char *argv[]) {
|
||||
if (current_buttons & SCE_CTRL_LTRIGGER)
|
||||
use_custom_config = 0;
|
||||
|
||||
// Init random number generator
|
||||
srand(time(NULL));
|
||||
|
||||
// Make VitaShell folders
|
||||
sceIoMkdir("ux0:VitaShell", 0777);
|
||||
sceIoMkdir("ux0:VitaShell/language", 0777);
|
||||
sceIoMkdir("ux0:VitaShell/theme", 0777);
|
||||
|
||||
// Load theme
|
||||
loadTheme();
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
static int message_dialog_running = 0;
|
||||
static int message_dialog_type = -1;
|
||||
|
||||
static char message_string[1024];
|
||||
static char message_string[512];
|
||||
|
||||
int initMessageDialog(int type, char *msg, ...) {
|
||||
if (message_dialog_running)
|
||||
|
@ -246,6 +246,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
|
||||
uint64_t authid = *(uint64_t *)(buffer + 0x80);
|
||||
if (authid == 0x2F00000000000001 || authid == 0x2F00000000000003) {
|
||||
closeWaitDialog();
|
||||
|
||||
initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_YESNO, language_container[INSTALL_WARNING]);
|
||||
dialog_step = DIALOG_STEP_INSTALL_WARNING;
|
||||
|
||||
@ -262,6 +263,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
|
||||
|
||||
// Init again
|
||||
initMessageDialog(MESSAGE_DIALOG_PROGRESS_BAR, language_container[INSTALLING]);
|
||||
dialog_step = DIALOG_STEP_INSTALLING;
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,6 +286,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
|
||||
res = extractArchivePath(src_path, PACKAGE_DIR "/", &value, size + folders, SetProgress, cancelHandler);
|
||||
if (res <= 0) {
|
||||
closeWaitDialog();
|
||||
dialog_step = DIALOG_STEP_CANCELLED;
|
||||
errorDialog(res);
|
||||
goto EXIT;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<frame id="frame2">
|
||||
<liveitem>
|
||||
<text valign="bottom" align="left" text-align="left" text-valign="bottom" line-space="3" ellipsis="on">
|
||||
<str color="#ffffff" size="50" bold="on" shadow="on">VitaShell</str>
|
||||
<str color="#ffffff" size="50" bold="on" shadow="on">VitaShell</str>
|
||||
</text>
|
||||
</liveitem>
|
||||
</frame>
|
||||
@ -28,9 +28,8 @@
|
||||
<frame id="frame4">
|
||||
<liveitem>
|
||||
<text align="left" text-align="left" word-wrap="off" ellipsis="on">
|
||||
<str size="18" color="#ffffff" shadow="on">v0.8</str>
|
||||
<str size="18" color="#ffffff" shadow="on">v0.85</str>
|
||||
</text>
|
||||
</liveitem>
|
||||
</frame>
|
||||
|
||||
</livearea>
|
||||
|
BIN
resources/context.png
Normal file
BIN
resources/context.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/dialog.png
Normal file
BIN
resources/dialog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
3
resources/theme.txt
Normal file
3
resources/theme.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# VitaShell theme file
|
||||
|
||||
THEME_NAME = "Default"
|
30
theme.c
30
theme.c
@ -22,6 +22,8 @@
|
||||
#include "theme.h"
|
||||
|
||||
extern unsigned char _binary_resources_ftp_png_start;
|
||||
extern unsigned char _binary_resources_dialog_png_start;
|
||||
extern unsigned char _binary_resources_context_png_start;
|
||||
extern unsigned char _binary_resources_battery_png_start;
|
||||
extern unsigned char _binary_resources_battery_bar_red_png_start;
|
||||
extern unsigned char _binary_resources_battery_bar_green_png_start;
|
||||
@ -144,31 +146,11 @@ void loadTheme() {
|
||||
if (!ftp_image)
|
||||
ftp_image = vita2d_load_PNG_buffer(&_binary_resources_ftp_png_start);
|
||||
|
||||
if (!dialog_image) {
|
||||
dialog_image = vita2d_create_empty_texture(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
void *data = vita2d_texture_get_datap(dialog_image);
|
||||
if (!dialog_image)
|
||||
dialog_image = vita2d_load_PNG_buffer(&_binary_resources_dialog_png_start);
|
||||
|
||||
int y;
|
||||
for (y = 0; y < SCREEN_HEIGHT; y++) {
|
||||
int x;
|
||||
for (x = 0; x < SCREEN_WIDTH; x++) {
|
||||
((uint32_t *)data)[x + y * SCREEN_WIDTH] = DIALOG_BG_COLOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!context_image) {
|
||||
context_image = vita2d_create_empty_texture(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
void *data = vita2d_texture_get_datap(context_image);
|
||||
|
||||
int y;
|
||||
for (y = 0; y < SCREEN_HEIGHT; y++) {
|
||||
int x;
|
||||
for (x = 0; x < SCREEN_WIDTH; x++) {
|
||||
((uint32_t *)data)[x + y * SCREEN_WIDTH] = CONTEXT_MENU_COLOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!context_image)
|
||||
context_image = vita2d_load_PNG_buffer(&_binary_resources_context_png_start);
|
||||
|
||||
if (!battery_image)
|
||||
battery_image = vita2d_load_PNG_buffer(&_binary_resources_battery_png_start);
|
||||
|
Loading…
Reference in New Issue
Block a user