28 Commits

Author SHA1 Message Date
ZetaDesigns
674fa9d9bf add "downloading" text to qrcode scanning
i know it's not the prettiest idea to put it in draw_theme_install, but it seemed like the most fitting, and i didnt want to create another function for it
2017-09-06 17:49:10 +02:00
Nils P
897dc52424 Merge pull request #64 from saibotu/pr-bgmcrash
Fixed crash when installing themes without bgm
2017-09-06 17:03:51 +02:00
saibotu
379cea8db1 Fixed crash when installing themes without bgm 2017-09-06 15:36:02 +02:00
saibotu
e46783a3c4 Made buf_to_file always return Result 2017-09-06 15:35:31 +02:00
Helloman892
3fd4548d64 Merge pull request #62 from thedax/warning-fix
Fix potential bugs and two warnings relating to them
2017-09-06 10:19:07 +01:00
thedax
34ede05b93 Fix potential bugs and two warnings relating to them
Memset doesn't automatically set the entire size of each element, it's necessary to multiply by sizeof(<typename>) if it's larger than 1 byte, which in this case, u16, is (two bytes).
2017-09-06 05:01:42 -04:00
Helloman892
80b9aa9cdb Merge pull request #60 from Uyuiyu/master
Fix build warning
2017-09-06 09:20:46 +01:00
Uyuiyu
33cce81914 signed 2017-09-06 02:16:03 +02:00
Nils P
424fffd35f Merge pull request #57 from astronautlevel2/zeta-patch
Make Errorcodes great again (well, sorta)
2017-09-05 21:40:17 +02:00
ZetaDesigns
5b067cfac0 fixing some indentation 2017-09-05 21:37:48 +02:00
ZetaDesigns
539e95253c finish up basic errorcode functions 2017-09-05 21:31:50 +02:00
ZetaDesigns
a77b29da92 add errorcodes 2017-09-05 21:15:19 +02:00
Helloman892
dcac5401c1 several text drawing edits
All info.smdh fields now wrap after 300-odd pixels.
2017-09-05 13:10:43 +01:00
Helloman892
1467b1f72b Merge branch 'master' of https://github.com/astronautlevel2/Anemone3DS 2017-09-05 10:57:20 +01:00
Helloman892
9199936215 per PR #52 2017-09-05 10:56:00 +01:00
Helloman892
91fa4fa412 Resolves #22 (#52)
3 commits squashed and merged
2017-09-05 10:55:21 +01:00
Helloman892
1c6ae493d5 Merge pull request #51 from astronautlevel2/hm892
Fast paging [issue #14]
2017-09-05 01:30:33 +01:00
Helloman892
4eb969e84d fast page scrolling 2017-09-05 01:25:48 +01:00
Helloman892
70a40fae44 issue #14 commit for review (#50) 2017-09-04 19:25:52 -04:00
Helloman892
3d17509229 Merge pull request #49 from Helloman892/master
Resolving #35 as best as possible
2017-09-04 22:50:06 +01:00
Helloman892
a38508c30f undoes part of commit d3a8f79 2017-09-04 22:43:42 +01:00
Helloman892
0ddb35d3d7 see #35
percentage bar isn't practical.
counter was quite simple.
2017-09-04 22:41:26 +01:00
Helloman892
e03d150840 Merge pull request #45 from GreatWizard/optimiz_images
Clean battery images and reduce png size
2017-09-04 21:25:57 +01:00
Guillaume Gérard
4607885fe6 Clean battery images and reduce png size 2017-09-04 22:11:52 +02:00
Helloman892
d3a8f79958 beginnings of shuffled theme counter + a couple qr bugfixes 2017-09-04 20:13:09 +01:00
Helloman892
a08c032ccc Update main.c 2017-09-04 19:54:38 +01:00
Helloman892
bdaa8b52cc Update themes.c 2017-09-04 19:53:41 +01:00
Helloman892
8dc7f54f7e attempt to allow 10 themes to be installed 2017-09-04 19:46:55 +01:00
21 changed files with 115 additions and 53 deletions

View File

@@ -53,7 +53,9 @@ CFLAGS := -g -Wall -Wextra -mword-relocations \
-ffunction-sections \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D_GNU_SOURCE
revision := $(shell git describe --tags --match v[0-9]* --abbrev=8 | sed 's/-[0-9]*-g/-/')
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D_GNU_SOURCE -DVERSION="\"$(revision)\""
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11

View File

@@ -6,6 +6,7 @@ A Theme and Splashscreen Manager for the Nintendo3DS, written in C.
* zlib, which can be retrieved from the [3ds_portlibs](https://github.com/devkitPro/3ds_portlibs).
* [makerom](https://github.com/profi200/Project_CTR) and [bannertool](https://github.com/Steveice10/buildtools), which can be retrieved from [SteveIce10's](https://github.com/Steveice10) buildtools repo. These must be added to your PATH.
* [pp2d](https://github.com/BernardoGiordano/pp2d), which is included in the repo if you do a git clone --recursive.
* Git needs to be on your PATH, if building in a non-*nix environment.
# Building
First of all, make sure devkitPRO is properly installed and added to the PATH.
After that, open the directory you want to clone the repo into, and type: `git clone https://github.com/astronautlevel2/Anemone3DS/ --recursive`.

View File

@@ -40,7 +40,10 @@
#define SHUFFLE_INSTALL 1
#define BGM_INSTALL 2
#define UNINSTALL 3
#define DOWNLOADING 3
#define ERROR 0
#define WARNING 1
static const int THEMES_PER_SCREEN = 4;
enum TextureID {

View File

@@ -37,8 +37,8 @@ void exit_screens(void);
void draw_base_interface(void);
void draw_qr(void);
void draw_theme_install(int install_type);
void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode);
void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode, int shuffle_theme_count);
void draw_splash_install(int install_type);
void draw_splash_interface(Splash_s *splashes_list, int splash_count, int selected_splash, bool preview_mode);
void throw_error(char* error, int error_type);
#endif

View File

@@ -39,7 +39,7 @@ Result close_archives(void);
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);
u32 buf_to_file(u32 size, char *path, FS_Archive archive, char *buf);
Result buf_to_file(u32 size, char *path, FS_Archive archive, char *buf);
void remake_file(char *path, FS_Archive archive, u32 size);
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 466 B

View File

@@ -96,7 +96,7 @@ Result http_get(char *url, char *path)
ret = httpcSetKeepAlive(&context, HTTPC_KEEPALIVE_ENABLED);
ret = httpcAddRequestHeaderField(&context, "User-Agent", "Anemone3DS/1.1.0");
ret = httpcAddRequestHeaderField(&context, "Connection", "Keep-Alive");
draw_theme_install(DOWNLOADING);
ret = httpcBeginRequest(&context);
if (ret != 0)
{
@@ -158,9 +158,9 @@ Result http_get(char *url, char *path)
filename = strtok(NULL, "\"");
char *illegal_characters = "\"?;:/\\+";
for (ssize_t i = 0; i < strlen(filename); i++)
for (size_t i = 0; i < strlen(filename); i++)
{
for (ssize_t n = 0; n < strlen(illegal_characters); n++)
for (size_t n = 0; n < strlen(illegal_characters); n++)
{
if (filename[i] == illegal_characters[n])
{

View File

@@ -37,6 +37,8 @@ enum Colors {
COLOR_WHITE = RGBA8(255, 255, 255, 255),
COLOR_CURSOR = RGBA8(200, 200, 200, 255),
COLOR_BLACK = RGBA8(0, 0, 0, 255),
COLOR_RED = RGBA8(200, 0, 0, 255),
COLOR_YELLOW = RGBA8(239, 220, 11, 255),
};
void init_screens(void)
@@ -139,30 +141,45 @@ void draw_base_interface(void)
pp2d_draw_on(GFX_BOTTOM);
pp2d_draw_rectangle(0, 0, 320, 24, COLOR_ACCENT);
pp2d_draw_rectangle(0, 216, 320, 24, COLOR_ACCENT);
pp2d_draw_text(7, 219, 0.6, 0.6, COLOR_WHITE, VERSION);
pp2d_draw_on(GFX_TOP);
}
void throw_error(char* error, int error_type) {
draw_base_interface();
switch (error_type) {
case ERROR:
pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_RED, error);
break;
case WARNING:
pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_YELLOW, error);
break;
}
pp2d_end_draw();
}
void draw_theme_install(int install_type)
{
draw_base_interface();
switch(install_type)
{
case 0:
pp2d_draw_text(20, 30, 0.7, 0.7, COLOR_WHITE, "Installing a single theme...");
pp2d_draw_text_center(GFX_TOP, 120, 0.8, 0.8, COLOR_WHITE, "Installing a single theme...");
break;
case 1:
pp2d_draw_text(20, 30, 0.7, 0.7, COLOR_WHITE, "Installing a shuffle theme...");
pp2d_draw_text_center(GFX_TOP, 120, 0.8, 0.8, COLOR_WHITE, "Installing a shuffle theme...");
break;
case 2:
pp2d_draw_text(20, 30, 0.7, 0.7, COLOR_WHITE, "Installing BGM...");
pp2d_draw_text_center(GFX_TOP, 120, 0.8, 0.8, COLOR_WHITE, "Installing BGM...");
break;
case 3:
pp2d_draw_text_center(GFX_TOP, 120, 0.8, 0.8, COLOR_WHITE, "Downloading...");
break;
default:
break;
}
pp2d_end_draw();
}
void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode)
void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode, int shuffle_theme_count)
{
if (themes_list == NULL)
@@ -191,14 +208,14 @@ void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_t
pp2d_draw_text_center(GFX_TOP, 4, 0.5, 0.5, COLOR_WHITE, "Theme mode");
wchar_t title[0x40] = {0};
utf16_to_utf32((u32*)title, current_theme.name, 0x40);
pp2d_draw_wtext(20, 30, 0.7, 0.7, COLOR_WHITE, title);
pp2d_draw_wtext_wrap(20, 30, 0.7, 0.7, COLOR_WHITE, 380, title);
wchar_t author[0x40] = {0};
utf16_to_utf32((u32*)author, current_theme.author, 0x40);
pp2d_draw_text(20, 50, 0.5, 0.5, COLOR_WHITE, "By: ");
pp2d_draw_wtext(44, 50, 0.5, 0.5, COLOR_WHITE, author);
wchar_t description[0x80] = {0};
utf16_to_utf32((u32*)description, current_theme.desc, 0x80);
pp2d_draw_wtext(20, 65, 0.5, 0.5, COLOR_WHITE, description);
pp2d_draw_wtext_wrap(44, 50, 0.5, 0.5, COLOR_WHITE, 380, author);
wchar_t description[0xa6] = {0};
utf16_to_utf32((u32*)description, current_theme.desc, 0xb0);
pp2d_draw_wtext_wrap(20, 65, 0.5, 0.5, COLOR_WHITE, 363, description);
pp2d_draw_wtext(20, 150, 0.6, 0.6, COLOR_WHITE, L"\uE046 Install Shuffle Theme");
pp2d_draw_wtext(200, 150, 0.6, 0.6, COLOR_WHITE, L"\uE004 Switch to Splashes");
@@ -206,9 +223,11 @@ void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_t
pp2d_draw_wtext(200, 180, 0.6, 0.6, COLOR_WHITE, L"\uE001 Queue Shuffle");
pp2d_draw_wtext(20, 210, 0.6, 0.6, COLOR_WHITE, L"\uE002 Install BGM");
pp2d_draw_wtext(200, 210, 0.6, 0.6, COLOR_WHITE, L"\uE003 Preview Theme");
pp2d_draw_wtext(130, 120, 0.6, 0.6, COLOR_WHITE, L"\uE005 Scan QRCode");
pp2d_draw_wtext(130, 120, 0.6, 0.6, COLOR_WHITE, L"\uE005 Scan QRCode");
pp2d_draw_on(GFX_BOTTOM);
pp2d_draw_textf(7, 3, 0.6, 0.6, COLOR_WHITE, "Selected: %i/10", shuffle_theme_count);
// Scroll the menu up or down if the selected theme is out of its bounds
//----------------------------------------------------------------
for (int i = 0; i < theme_count; i++) {
@@ -269,10 +288,10 @@ void draw_splash_install(int install_type)
switch (install_type)
{
case SINGLE_INSTALL:
pp2d_draw_textf(20, 30, 0.7, 0.7, COLOR_WHITE, "Installing a splash...");
pp2d_draw_text_center(GFX_TOP, 110, 0.7, 0.7, COLOR_WHITE, "Installing a splash...");
break;
case UNINSTALL:
pp2d_draw_textf(20, 30, 0.7, 0.7, COLOR_WHITE, "Uninstalling a splash...");
pp2d_draw_text_center(GFX_TOP, 110, 0.7, 0.7, COLOR_WHITE, "Uninstalling a splash...");
break;
default:
break;
@@ -300,7 +319,7 @@ void draw_splash_interface(Splash_s *splashes_list, int splash_count, int select
pp2d_draw_text_center(GFX_TOP, 4, 0.5, 0.5, COLOR_WHITE, "Splash mode");
pp2d_draw_wtext_center(GFX_TOP, 180, 0.7, 0.7, COLOR_WHITE, L"\uE000 Install Splash \uE004 Switch to Themes");
pp2d_draw_wtext_center(GFX_TOP, 210, 0.7, 0.7, COLOR_WHITE, L"\uE002 Delete current Splash");
pp2d_draw_wtext_center(GFX_TOP, 210, 0.7, 0.7, COLOR_WHITE, L"\uE002 Delete current Splash");
pp2d_draw_on(GFX_BOTTOM);
for (int i = 0; i < splash_count; i++) {
if (splash_count <= THEMES_PER_SCREEN)

View File

@@ -151,17 +151,16 @@ u32 zip_file_to_buf(char *file_name, u16 *zip_path, char **buf)
}
}
u32 buf_to_file(u32 size, char *path, FS_Archive archive, char *buf)
Result buf_to_file(u32 size, char *path, FS_Archive archive, char *buf)
{
Handle handle;
u32 bytes = 0;
Result res = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_ASCII, path), FS_OPEN_WRITE, 0);
if (R_FAILED(res)) return res;
res = FSFILE_Write(handle, &bytes, 0, buf, size, FS_WRITE_FLUSH);
res = FSFILE_Write(handle, NULL, 0, buf, size, FS_WRITE_FLUSH);
if (R_FAILED(res)) return res;
res = FSFILE_Close(handle);
if (R_FAILED(res)) return res;
return bytes;
return 0;
}
void remake_file(char *path, FS_Archive archive, u32 size)

View File

@@ -107,7 +107,7 @@ int main(void)
draw_qr();
} else if (!splash_mode)
{
draw_theme_interface(themes_list, theme_count, selected_theme, preview_mode);
draw_theme_interface(themes_list, theme_count, selected_theme, preview_mode, shuffle_theme_count);
} else {
draw_splash_interface(splashes_list, splash_count, selected_splash, preview_mode);
}
@@ -125,14 +125,14 @@ int main(void)
splash_mode = !splash_mode;
} else if (kDown & KEY_R)
{
if (splash_mode || preview_mode) {
continue;
} else {
qr_mode = !qr_mode;
if (qr_mode) init_qr();
else exit_qr();
continue;
}
if (splash_mode || preview_mode) {
continue;
} else {
qr_mode = !qr_mode;
if (qr_mode) init_qr();
else exit_qr();
continue;
}
}
if (qr_mode) continue;
@@ -217,6 +217,7 @@ int main(void)
{
draw_theme_install(SHUFFLE_INSTALL);
shuffle_install(themes_list, theme_count);
shuffle_theme_count = 0;
}
}
}
@@ -302,6 +303,32 @@ int main(void)
selected_theme = 0;
}
}
else if (kDown & KEY_CPAD_LEFT)
{
svcSleepThread(100000000);
if (splash_mode)
{
selected_splash -= 4;
if (selected_splash < 0) selected_splash = 0;
} else {
selected_theme -= 4;
if (selected_theme < 0) selected_theme = 0;
}
}
else if (kDown & KEY_CPAD_RIGHT)
{
svcSleepThread(100000000);
if (splash_mode)
{
selected_splash += 4;
if (selected_splash >= splash_count) selected_splash = splash_count-1;
} else {
selected_theme += 4;
if (selected_theme >= theme_count) selected_theme = theme_count-1;
}
}
if (!splash_mode && selected_theme != previously_selected)
{

View File

@@ -68,14 +68,14 @@ Result get_splashes(Splash_s** splashes_list, int *splash_count)
u32 bytes = file_to_buf(fsMakePath(PATH_UTF16, top_path), ArchiveSD, &temp_buf);
if (!bytes)
{
memset(top_path, 0, 0x106);
memset(top_path, 0, 0x106 * sizeof(u16));
}
free(temp_buf);
temp_buf = NULL;
bytes = file_to_buf(fsMakePath(PATH_UTF16, bottom_path), ArchiveSD, &temp_buf);
if (!bytes)
{
memset(bottom_path, 0, 0x106);
memset(bottom_path, 0, 0x106 * sizeof(u16));
}
free(temp_buf);
memcpy(current_splash->name, entry.name, 0x106);

View File

@@ -230,9 +230,11 @@ Result bgm_install(Theme_s bgm_to_install)
memset(&savedata_buf[0x13b8], 0, 8);
savedata_buf[0x13bd] = 3;
savedata_buf[0x13b8] = 0xff;
u32 size = buf_to_file(savedata_size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
Result result = buf_to_file(savedata_size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
free(savedata_buf);
if (!R_SUCCEEDED(result)) return result;
if (bgm_to_install.is_zip) // Same as above but this time with bgm
{
music_size = zip_file_to_buf("bgm.bcstm", bgm_to_install.path, &music);
@@ -245,7 +247,6 @@ Result bgm_install(Theme_s bgm_to_install)
if (music_size == 0)
{
free(music);
music = calloc(1, 3371008);
} else if (music_size > 3371008) {
free(music);
@@ -253,10 +254,10 @@ Result bgm_install(Theme_s bgm_to_install)
return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_TOO_LARGE);
}
size = buf_to_file(music_size, "/BgmCache.bin", ArchiveThemeExt, music);
result = buf_to_file(music_size == 0 ? 3371008 : music_size, "/BgmCache.bin", ArchiveThemeExt, music);
free(music);
if (size == 0) return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_NOT_FOUND);
if (!R_SUCCEEDED(result)) return result;
file_to_buf(fsMakePath(PATH_ASCII, "/ThemeManage.bin"), ArchiveThemeExt, &thememanage_buf);
thememanage_buf[0x00] = 1;
@@ -280,9 +281,11 @@ Result bgm_install(Theme_s bgm_to_install)
memset(&thememanage_buf[0x340], 0, 4);
memset(&thememanage_buf[0x360], 0, 4);
memset(&thememanage_buf[0x368], 0, 4);
size = buf_to_file(0x800, "/ThemeManage.bin", ArchiveThemeExt, thememanage_buf);
result = buf_to_file(0x800, "/ThemeManage.bin", ArchiveThemeExt, thememanage_buf);
free(thememanage_buf);
if (!R_SUCCEEDED(result)) return result;
return 0;
}
@@ -302,9 +305,11 @@ Result single_install(Theme_s theme_to_install)
memset(&savedata_buf[0x13b8], 0, 8);
savedata_buf[0x13bd] = 3;
savedata_buf[0x13b8] = 0xff;
u32 size = buf_to_file(savedata_size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
Result result = buf_to_file(savedata_size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
free(savedata_buf);
if (!R_SUCCEEDED(result)) return result;
// Open body cache file. Test if theme is zipped
if (theme_to_install.is_zip)
{
@@ -325,10 +330,10 @@ Result single_install(Theme_s theme_to_install)
return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_NOT_FOUND);
}
size = buf_to_file(body_size, "/BodyCache.bin", ArchiveThemeExt, body); // Write body data to file
result = buf_to_file(body_size, "/BodyCache.bin", ArchiveThemeExt, body); // Write body data to file
free(body);
if (size == 0) return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_NOT_FOUND);
if (!R_SUCCEEDED(result)) return result;
if (theme_to_install.is_zip) // Same as above but this time with bgm
{
@@ -342,7 +347,6 @@ Result single_install(Theme_s theme_to_install)
if (music_size == 0)
{
free(music);
music = calloc(1, 3371008);
} else if (music_size > 3371008) {
free(music);
@@ -350,10 +354,10 @@ Result single_install(Theme_s theme_to_install)
return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_TOO_LARGE);
}
size = buf_to_file(music_size, "/BgmCache.bin", ArchiveThemeExt, music);
result = buf_to_file(music_size == 0 ? 3371008 : music_size, "/BgmCache.bin", ArchiveThemeExt, music);
free(music);
if (size == 0) return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_NOT_FOUND);
if (!R_SUCCEEDED(result)) return result;
file_to_buf(fsMakePath(PATH_ASCII, "/ThemeManage.bin"), ArchiveThemeExt, &thememanage_buf);
thememanage_buf[0x00] = 1;
@@ -379,9 +383,11 @@ Result single_install(Theme_s theme_to_install)
memset(&thememanage_buf[0x340], 0, 4);
memset(&thememanage_buf[0x360], 0, 4);
memset(&thememanage_buf[0x368], 0, 4);
size = buf_to_file(0x800, "/ThemeManage.bin", ArchiveThemeExt, thememanage_buf);
result = buf_to_file(0x800, "/ThemeManage.bin", ArchiveThemeExt, thememanage_buf);
free(thememanage_buf);
if (!R_SUCCEEDED(result)) return result;
return 0;
}
@@ -393,10 +399,11 @@ Result shuffle_install(Theme_s *themes_list, int theme_count)
u32 bgm_sizes[10] = {0};
for (int i = 0; i < theme_count; i++)
{
if (count > 9) return MAKERESULT(RL_USAGE, RS_INVALIDARG, RM_COMMON, RD_INVALID_SELECTION);
if (count > 10) return MAKERESULT(RL_USAGE, RS_INVALIDARG, RM_COMMON, RD_INVALID_SELECTION);
if (themes_list[i].in_shuffle)
{
shuffle_themes[count++] = &themes_list[i];
themes_list[i].in_shuffle = false;
}
}
for (int i = 0; i < count; i++)
@@ -426,9 +433,11 @@ Result shuffle_install(Theme_s *themes_list, int theme_count)
}
}
buf_to_file(size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
Result result = buf_to_file(size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
free(savedata_buf);
if (!R_SUCCEEDED(result)) return result;
remake_file("/BodyCache_rd.bin", ArchiveThemeExt, 0x150000 * 10); // Enough space for 10 theme files
Handle body_cache_handle;
FSUSER_OpenFile(&body_cache_handle, ArchiveThemeExt, fsMakePath(PATH_ASCII, "/BodyCache_rd.bin"), FS_OPEN_WRITE, 0);
@@ -525,8 +534,10 @@ Result shuffle_install(Theme_s *themes_list, int theme_count)
*bgmsizeloc = bgm_sizes[i];
}
buf_to_file(0x800, "/ThemeManage.bin", ArchiveThemeExt, thememanage_buf);
result = buf_to_file(0x800, "/ThemeManage.bin", ArchiveThemeExt, thememanage_buf);
free(thememanage_buf);
if (!R_SUCCEEDED(result)) return result;
return MAKERESULT(RL_SUCCESS, RS_SUCCESS, RM_COMMON, RD_SUCCESS);
}