main:
// If we're already trying to access the SD, return.
ldr r2, [r0, #4]
- ldr r1, sdmmc // In armips this instruction uses pc-releative loading
+ ldr r1, sdmmc // In armips this instruction uses pc-releative loading. Specifying it like this causes gcc to emit the same code.
cmp r2, r1
beq nand_sd_ret
// Whether to use an EmuNAND
#define OPTION_EMUNAND 16
+// Which EmuNAND to use (currently only allows 10 total, but eh, I can change that if anyone truly needs it)
+#define OPTION_EMUNAND_INDEX 17
+
// Save log files during boot and from loader.
// This will slow things down a bit.
#define OPTION_SAVE_LOGS 253
putc(TOP_SCREEN, ']');
putc(TOP_SCREEN, '\n');
}
- } else if (options[i].allowed == not_option) {
+ } else if (options[i].allowed == ranged_val) {
+ if (cursor_y == i)
+ fprintf(TOP_SCREEN, "\x1b[32m>>\x1b[0m ");
+ else
+ fprintf(TOP_SCREEN, " ");
+
+ fprintf(TOP_SCREEN, "[%u] %s \n", toggles[options[i].index], options[i].name);
+ } else if (options[i].allowed == not_option) {
fprintf(TOP_SCREEN, "%s\n", options[i].name);
}
++i;
cursor_y++;
break;
case BUTTON_A:
- // FIXME - This needs to be part of the patch menu.
- // toggles[OPTION_RECONFIGURED] = 1;
- toggles[options[cursor_y].index] = !toggles[options[cursor_y].index];
+ if (options[cursor_y].allowed == boolean_val) {
+ toggles[options[cursor_y].index] = !toggles[options[cursor_y].index];
+ } else if (options[cursor_y].allowed == ranged_val) {
+ if (toggles[options[cursor_y].index] == options[cursor_y].b)
+ toggles[options[cursor_y].index] = options[cursor_y].a;
+ else
+ toggles[options[cursor_y].index]++;
+ }
+ break;
+ case BUTTON_X:
+ if (options[cursor_y].allowed == ranged_val) {
+ if (toggles[options[cursor_y].index] == options[cursor_y].a)
+ toggles[options[cursor_y].index] = options[cursor_y].b;
+ else
+ toggles[options[cursor_y].index]--;
+ }
break;
case BUTTON_B:
exit = 1;
{ 0, "", "", not_option, 0, 0 },
- { OPTION_EMUNAND, "EmuNAND", "Redirects NAND write/read to EmuNAND #0. Right now, only one is supported (but the work is done)", boolean_val, 0, 0 },
+ { OPTION_EMUNAND, "Use EmuNAND", "Redirects NAND write/read to the SD.", boolean_val, 0, 0 },
+ { OPTION_EMUNAND_INDEX, " Index", "Which EmuNAND to use. Currently, 10 maximum (but this is arbitrary)", ranged_val, 0, 0x9 },
{ 0, "", "", not_option, 0, 0 },
get = BUTTON_A;
else if (HID_PAD & BUTTON_B)
get = BUTTON_B;
+ else if (HID_PAD & BUTTON_X)
+ get = BUTTON_X;
}
while (HID_PAD & get)
;
{
show_menu(options, config.options);
+ // TODO - Determine whether it actually changed.
+ config.options[OPTION_RECONFIGURED] = 1;
+
return MENU_MAIN;
}
wait();
}
- // Use loopback EmuNAND?
+ // Use EmuNAND?
if (config.options[OPTION_EMUNAND]) {
// Yes.
- patch_emunand(0);
-// patch_loop_emunand("/nand.bin");
+ patch_emunand(config.options[OPTION_EMUNAND_INDEX]);
- // FIXME - NYI
wait();
}
{ \
fprintf(stderr, x); \
wait_key(); \
+ clear_disp(stderr); \
menu_poweroff(); \
}