From 43b37d26162c3c1833848b8d4164a350a36b64db Mon Sep 17 00:00:00 2001 From: Alex Taber Date: Thu, 31 Aug 2017 21:57:56 -0400 Subject: [PATCH] Fixed rsf and reboot --- meta/app.rsf | 2 ++ source/main.c | 38 ++++++++++++++++++++++++++------------ source/themes.c | 3 ++- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/meta/app.rsf b/meta/app.rsf index 367e431..ffb0c64 100644 --- a/meta/app.rsf +++ b/meta/app.rsf @@ -154,6 +154,8 @@ AccessControlInfo: - csnd:SND - am:u - ns:s + - ptm:sysm + - mcu::HWC SystemControlInfo: Dependency: diff --git a/source/main.c b/source/main.c index 195e71f..bd056b8 100644 --- a/source/main.c +++ b/source/main.c @@ -32,6 +32,7 @@ int init_services(void) { cfguInit(); open_archives(); + ptmSysmInit(); return 0; } @@ -52,6 +53,7 @@ int main(void) Result res = get_themes(&themes_list, &theme_count); int selected_theme = 0; + int shuffle_theme_count = 0; bool preview_mode = false; while(aptMainLoop()) @@ -61,8 +63,6 @@ int main(void) draw_interface(themes_list, theme_count, selected_theme, preview_mode); - if (kDown & KEY_START) - break; //quit if (themes_list == NULL) continue; @@ -93,13 +93,26 @@ int main(void) { single_install(*current_theme); } + else if (kDown & KEY_B) { - current_theme->in_shuffle = !(current_theme->in_shuffle); + if (shuffle_theme_count < 10) + { + if (current_theme->in_shuffle) shuffle_theme_count--; + else shuffle_theme_count++; + current_theme->in_shuffle = !(current_theme->in_shuffle); + } else { + if (current_theme->in_shuffle) { + shuffle_theme_count--; + current_theme->in_shuffle = false; + } + } } + else if (kDown & KEY_SELECT) { - shuffle_install(themes_list, theme_count); + if (shuffle_theme_count > 0) + shuffle_install(themes_list, theme_count); } // Movement in the UI @@ -124,16 +137,17 @@ int main(void) { selected_theme = theme_count-1; } + + if (kDown & KEY_START) + { + exit_screens(); + exit_services(); + PTMSYSM_RebootAsync(0); + ptmSysmExit(); + } } free(themes_list); - - exit_screens(); - exit_services(); - - ptmSysmInit(); - PTMSYSM_ShutdownAsync(0); - ptmSysmExit(); - + return 0; } diff --git a/source/themes.c b/source/themes.c index 03a23ea..71d573b 100644 --- a/source/themes.c +++ b/source/themes.c @@ -179,7 +179,8 @@ Result get_themes(Theme_s **themes_list, int *theme_count) ssize_t textureID = MAX_TEXTURE + (*theme_count * 2); parse_smdh(current_theme, theme_path, textureID); - load_preview(current_theme, theme_path, textureID+1); + current_theme->has_preview = false; + // load_preview(current_theme, theme_path, textureID+1); } FSDIR_Close(dir_handle);