Fix multi RedNAND 2x not being set up properly

This commit is contained in:
ZeroSkill1 2024-11-08 12:29:01 +03:00 committed by d0k3
parent 7b6b478582
commit 208f12bde7

View File

@ -434,7 +434,7 @@ u32 SdFormatMenu(const char* slabel) {
u32 cluster_size = 0; u32 cluster_size = 0;
u64 sdcard_size_mb = 0; u64 sdcard_size_mb = 0;
u64 emunand_size_mb = (u64) -1; u64 emunand_size_mb = (u64) -1;
u32 user_select; u32 user_select = 0;
// check actual SD card size // check actual SD card size
sdcard_size_mb = GetSDCardSize() / 0x100000; sdcard_size_mb = GetSDCardSize() / 0x100000;
@ -471,18 +471,24 @@ u32 SdFormatMenu(const char* slabel) {
if (emunand_size_mb >= sysnand_min_size_mb) { if (emunand_size_mb >= sysnand_min_size_mb) {
u32 emunand_offset = 1; u32 emunand_offset = 1;
u32 n_emunands = 1; u32 n_emunands = 1;
if (emunand_size_mb >= 2 * sysnand_size_mb) { if (emunand_size_mb >= 2 * sysnand_multi_size_mb) { /* space can fit single/multi RedNAND or GW type */
const char* option_emunand_type[4] = { STR_REDNAND_TYPE_MULTI, STR_REDNAND_TYPE_SINGLE, STR_GW_EMUNAND_TYPE, STR_DONT_SET_UP }; const char* option_emunand_type[4] = { STR_REDNAND_TYPE_MULTI, STR_REDNAND_TYPE_SINGLE, STR_DONT_SET_UP, 0 };
user_select = ShowSelectPrompt(4, option_emunand_type, "%s", STR_CHOOSE_EMUNAND_TYPE); u32 n_opt = 3;
if (user_select > 3) return 0; if (emunand_size_mb >= sysnand_size_mb) {
emunand_offset = (user_select == 3) ? 0 : 1; option_emunand_type[2] = STR_GW_EMUNAND_TYPE;
option_emunand_type[3] = STR_DONT_SET_UP;
n_opt++;
}
user_select = ShowSelectPrompt(n_opt, option_emunand_type, "%s", STR_CHOOSE_EMUNAND_TYPE);
if (user_select == n_opt) return 0;
emunand_offset = (n_opt == 4 && user_select == 3) ? 0 : 1;
if (user_select == 1) n_emunands = 4; if (user_select == 1) n_emunands = 4;
} else if (emunand_size_mb >= sysnand_size_mb) { } else if (emunand_size_mb >= sysnand_size_mb) { /* space can fit single RedNAND or GW type, but not multi RedNAND */
const char* option_emunand_type[3] = { STR_REDNAND_TYPE, STR_GW_EMUNAND_TYPE, STR_DONT_SET_UP }; const char* option_emunand_type[3] = { STR_REDNAND_TYPE, STR_GW_EMUNAND_TYPE, STR_DONT_SET_UP };
user_select = ShowSelectPrompt(3, option_emunand_type, "%s", STR_CHOOSE_EMUNAND_TYPE); user_select = ShowSelectPrompt(3, option_emunand_type, "%s", STR_CHOOSE_EMUNAND_TYPE);
if (user_select > 2) return 0; if (user_select > 2) return 0;
emunand_offset = (user_select == 2) ? 0 : 1; // 0 -> GW EmuNAND emunand_offset = (user_select == 2) ? 0 : 1; // 0 -> GW EmuNAND
} else user_select = ShowPrompt(true, "%s", STR_CLONE_SYSNAND_TO_REDNAND) ? 1 : 0; } else user_select = ShowPrompt(true, "%s", STR_CLONE_SYSNAND_TO_REDNAND) ? 1 : 0; /* space can only fit a single RedNAND */
if (!user_select) return 0; if (!user_select) return 0;
u8 ncsd[0x200]; u8 ncsd[0x200];