More progress on shuffle theme; now installs properly minus BGM
This commit is contained in:
@@ -23,8 +23,6 @@ void parse_smdh(theme *entry, u16 *path)
|
|||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
// printf("Failed on path: ");
|
|
||||||
// printu(path);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,6 +178,10 @@ Result shuffle_install(theme **themes_list, int num_themes)
|
|||||||
shuffle_themes[count++] = themes_list[i];
|
shuffle_themes[count++] = themes_list[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
printu(shuffle_themes[i]->name);
|
||||||
|
}
|
||||||
|
|
||||||
char *savedata_buf;
|
char *savedata_buf;
|
||||||
u32 size = file_to_buf(fsMakePath(PATH_ASCII, "/SaveData.dat"), ArchiveHomeExt, &savedata_buf);
|
u32 size = file_to_buf(fsMakePath(PATH_ASCII, "/SaveData.dat"), ArchiveHomeExt, &savedata_buf);
|
||||||
@@ -206,6 +208,7 @@ Result shuffle_install(theme **themes_list, int num_themes)
|
|||||||
buf_to_file(size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
|
buf_to_file(size, "/SaveData.dat", ArchiveHomeExt, savedata_buf);
|
||||||
free(savedata_buf);
|
free(savedata_buf);
|
||||||
|
|
||||||
|
remake_file("/BodyCache_rd.bin", ArchiveThemeExt, 0x150000 * 10); // Enough space for 10 theme files
|
||||||
Handle body_cache_handle;
|
Handle body_cache_handle;
|
||||||
FSUSER_OpenFile(&body_cache_handle, ArchiveThemeExt, fsMakePath(PATH_ASCII, "/BodyCache_rd.bin"), FS_OPEN_WRITE, 0);
|
FSUSER_OpenFile(&body_cache_handle, ArchiveThemeExt, fsMakePath(PATH_ASCII, "/BodyCache_rd.bin"), FS_OPEN_WRITE, 0);
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
@@ -238,6 +241,7 @@ Result shuffle_install(theme **themes_list, int num_themes)
|
|||||||
{
|
{
|
||||||
char bgm_cache_path[17] = {0};
|
char bgm_cache_path[17] = {0};
|
||||||
sprintf(bgm_cache_path, "/BgmCache0%i.bin", i);
|
sprintf(bgm_cache_path, "/BgmCache0%i.bin", i);
|
||||||
|
remake_file(bgm_cache_path, ArchiveThemeExt, 3371008);
|
||||||
if (count > i)
|
if (count > i)
|
||||||
{
|
{
|
||||||
char *music_buf;
|
char *music_buf;
|
||||||
@@ -255,6 +259,7 @@ Result shuffle_install(theme **themes_list, int num_themes)
|
|||||||
|
|
||||||
if (!music_size)
|
if (!music_size)
|
||||||
{
|
{
|
||||||
|
printf("Writing empty for: %s\n", bgm_cache_path);
|
||||||
char *empty = calloc(1, 3371008);
|
char *empty = calloc(1, 3371008);
|
||||||
buf_to_file(3371008, bgm_cache_path, ArchiveThemeExt, empty);
|
buf_to_file(3371008, bgm_cache_path, ArchiveThemeExt, empty);
|
||||||
bgm_sizes[i] = 0;
|
bgm_sizes[i] = 0;
|
||||||
@@ -262,9 +267,11 @@ Result shuffle_install(theme **themes_list, int num_themes)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bgm_sizes[i] = music_size;
|
bgm_sizes[i] = music_size;
|
||||||
buf_to_file(music_size, bgm_cache_path, ArchiveThemeExt, music_buf);
|
u32 bytes_written = buf_to_file(music_size, bgm_cache_path, ArchiveThemeExt, music_buf);
|
||||||
|
printf("%lu bytes written\n", bytes_written);
|
||||||
free(music_buf);
|
free(music_buf);
|
||||||
} else {
|
} else {
|
||||||
|
printf("Writing empty for: %s\n", bgm_cache_path);
|
||||||
char *empty = calloc(1, 3371008);
|
char *empty = calloc(1, 3371008);
|
||||||
buf_to_file(3371008, bgm_cache_path, ArchiveThemeExt, empty);
|
buf_to_file(3371008, bgm_cache_path, ArchiveThemeExt, empty);
|
||||||
bgm_sizes[i] = 0;
|
bgm_sizes[i] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user