From ae42b9648c9bd11fb71a5ad0bad8b6bf9626e021 Mon Sep 17 00:00:00 2001 From: Alex Taber Date: Sat, 26 Aug 2017 16:00:10 -0400 Subject: [PATCH] Theme install now works, added fast reboot code --- include/fs.h | 1 + source/fs.c | 14 ++++++++++++++ source/main.c | 4 +++- source/themes.c | 4 ---- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/fs.h b/include/fs.h index 845f47e..6d1f13e 100644 --- a/include/fs.h +++ b/include/fs.h @@ -8,6 +8,7 @@ FS_Archive ArchiveHomeExt; FS_Archive ArchiveThemeExt; Result open_archives(void); +Result close_archives(void); int get_number_entries(char*); u64 file_to_buf(FS_Path path, FS_Archive archive, char** buf); u32 zip_file_to_buf(char *file_name, u16 *zip_path, char **buf); diff --git a/source/fs.c b/source/fs.c index 509a6ce..b452e11 100644 --- a/source/fs.c +++ b/source/fs.c @@ -57,6 +57,20 @@ Result open_archives(void) return 0; } +Result close_archives(void) +{ + Result retValue; + + retValue = FSUSER_CloseArchive(ArchiveSD); + if(R_FAILED(retValue)) return retValue; + retValue = FSUSER_CloseArchive(ArchiveHomeExt); + if(R_FAILED(retValue)) return retValue; + retValue = FSUSER_CloseArchive(ArchiveThemeExt); + if(R_FAILED(retValue)) return retValue; + + return 0; +} + int get_number_entries(char *path) { int count = 0; diff --git a/source/main.c b/source/main.c index 4fcbc06..23d61b3 100644 --- a/source/main.c +++ b/source/main.c @@ -50,7 +50,9 @@ int main(void) u32 kDown = hidKeysDown(); if (kDown & KEY_START) { - break; + close_archives(); + PTMSYSM_ShutdownAsync(0); + ptmSysmExit(); } } diff --git a/source/themes.c b/source/themes.c index a10e107..51ac3ab 100644 --- a/source/themes.c +++ b/source/themes.c @@ -45,8 +45,6 @@ Result single_install(theme theme_to_install) return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_NOT_FOUND); } - remake_file("/BodyCache.bin", ArchiveThemeExt, 0x150000); - size = buf_to_file(body_size, "/BodyCache.bin", ArchiveThemeExt, body); // Write body data to file free(body); @@ -72,8 +70,6 @@ Result single_install(theme theme_to_install) return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_TOO_LARGE); } - remake_file("/BgmCache.bin", ArchiveThemeExt, 3371008); - size = buf_to_file(music_size, "/BgmCache.bin", ArchiveThemeExt, music); free(music);