make shuffle work on consoles that never used it

This commit is contained in:
LiquidFenrir
2021-03-31 15:27:58 +02:00
parent 7745530764
commit cea9b8655a
2 changed files with 7 additions and 3 deletions

View File

@@ -49,8 +49,9 @@ typedef struct {
u8 _padding1[0x13b8];
ThemeEntry_s theme_entry;
ThemeEntry_s shuffle_themes[MAX_SHUFFLE_THEMES];
u8 _padding2[0xb];
bool shuffle;
u8 shuffle_seedA[0xb];
u8 shuffle;
u8 shuffle_seedB[0xa];
} SaveData_dat_s;
typedef struct {

View File

@@ -264,7 +264,7 @@ static Result install_theme_internal(Entry_List_s themes, int installmode)
savedata->theme_entry.type = 3;
savedata->theme_entry.index = 0xff;
savedata->shuffle = (installmode & THEME_INSTALL_SHUFFLE);
savedata->shuffle = (installmode & THEME_INSTALL_SHUFFLE) ? 1 : 0;
if(installmode & THEME_INSTALL_SHUFFLE)
{
memset(savedata->shuffle_themes, 0, sizeof(ThemeEntry_s)*MAX_SHUFFLE_THEMES);
@@ -273,6 +273,9 @@ static Result install_theme_internal(Entry_List_s themes, int installmode)
savedata->shuffle_themes[i].type = 3;
savedata->shuffle_themes[i].index = i;
}
const u8 shuffle_seed[0xB] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
memcpy(savedata->shuffle_seedA, shuffle_seed, 0xB);
memcpy(savedata->shuffle_seedB, shuffle_seed, 0xA);
}
res = buf_to_file(savedata_size, fsMakePath(PATH_ASCII, "/SaveData.dat"), ArchiveHomeExt, savedata_buf);