while (options[cursor_max].index != -1)
++cursor_max;
- while (options[cursor_max].allowed == not_option)
+ while (options[cursor_max].allowed == not_option && cursor_max > 0)
--cursor_max;
}
- // Figure out the max if unset.
+ // Figure out the min if unset.
if (cursor_min == -1) {
cursor_min = 0;
while (options[cursor_min].allowed == not_option)
cursor_y = cursor_min;
}
- header("A:Enter B:Back DPAD:Nav Select:Info");
+ if (cursor_max == cursor_y && cursor_max == 0)
+ header("B:Back");
+ else if (cursor_max == cursor_y)
+ header("A:Enter B:Back");
+ else
+ header("A:Enter B:Back DPAD:Nav Select:Info");
+
int i = window_top;
while (options[i].index != -1) { // -1 Sentinel.
switch (key) {
case BUTTON_UP:
+ if (cursor_min == cursor_max)
+ break;
cursor_y -= 1;
while ((options[cursor_y].allowed == not_option || (options[cursor_y].allowed == boolean_val_n3ds && !is_n3ds)) && cursor_y >= cursor_min)
cursor_y--;
break;
case BUTTON_DOWN:
+ if (cursor_min == cursor_max)
+ break;
cursor_y += 1;
while ((options[cursor_y].allowed == not_option || (options[cursor_y].allowed == boolean_val_n3ds && !is_n3ds)) && cursor_y < cursor_max)
cursor_y++;
break;
case BUTTON_LEFT:
+ if (cursor_min == cursor_max)
+ break;
cursor_y -= 5;
while ((options[cursor_y].allowed == not_option || (options[cursor_y].allowed == boolean_val_n3ds && !is_n3ds)) && cursor_y >= cursor_min)
cursor_y--;
break;
case BUTTON_RIGHT:
+ if (cursor_min == cursor_max)
+ break;
cursor_y += 5;
while ((options[cursor_y].allowed == not_option || (options[cursor_y].allowed == boolean_val_n3ds && !is_n3ds)) && cursor_y < cursor_max)
cursor_y++;
((func_call_t)(options[cursor_y].a))(); // Call 'a' as a function.
} else if (options[cursor_y].allowed == break_menu) {
exit = 1;
+ clear_screen(TOP_SCREEN);
+ cursor_y = cursor_min;
}
break;
case BUTTON_X:
fprintf(stdout, "\x1b[30;42m ");
}
set_cursor(TOP_SCREEN, 0, 0);
- fprintf(stdout, "\x1b[30;42m Corbenik//%s %s\x1b[0m\n\n", VERSION, append);
+ fprintf(stdout, "\x1b[30;42m .Corbenik // %s\x1b[0m\n\n", append);
}
static int current_menu_index_patches = 0;
show_menu(options, config.options);
}
+#ifndef REL
+#define REL "master"
+#endif
+
+static struct options_s info_d[] = {
+ { 0, " Native FIRM: ", "The version of NATIVE_FIRM in use.", not_option, 0, 0},
+ { 0, " AGB FIRM: ", "The version of AGB_FIRM in use. This is used to run GBA games.", not_option, 0, 0},
+ { 0, " TWL FIRM: ", "The version of TWL_FIRM in use. This is used to run DS games and DSiware.", not_option, 0, 0},
+ { 0, " Corbenik: " VERSION " (" REL ")", "Corbenik's version.", not_option, 0, 0},
+ { 0, "", "", not_option, 0, 0},
+ { 0, "[OK]", "", break_menu, 0, 0 }, // Temporary
+ { -1, "", "", not_option, 0, 0 }
+};
+static int is_setup_info = 0;
+
void
menu_info()
{
- // This menu requres firm to be loaded. Unfortunately.
- load_firms(); // Lazy load!
+ if (!is_setup_info) {
+ // This menu requres firm to be loaded. Unfortunately.
+ load_firms(); // Lazy load!
- clear_screen(TOP_SCREEN);
+ struct firm_signature *native = get_firm_info(firm_loc);
+ struct firm_signature *agb = get_firm_info(agb_firm_loc);
+ struct firm_signature *twl = get_firm_info(twl_firm_loc);
- set_cursor(TOP_SCREEN, 0, 0);
+ memcpy(&info_d[0].name[strlen(info_d[0].name)], native->version_string, strlen(native->version_string));
+ memcpy(&info_d[1].name[strlen(info_d[1].name)], agb->version_string, strlen(agb->version_string));
+ memcpy(&info_d[2].name[strlen(info_d[2].name)], twl->version_string, strlen(twl->version_string));
- header("Any:Back");
- struct firm_signature *native = get_firm_info(firm_loc);
- struct firm_signature *agb = get_firm_info(agb_firm_loc);
- struct firm_signature *twl = get_firm_info(twl_firm_loc);
-
- fprintf(stdout, "NATIVE_FIRM / Firmware:\n"
- " Version: %s (%x)\n"
- "AGB_FIRM / GBA Firmware:\n"
- " Version: %s (%x)\n"
- "TWL_FIRM / DSi Firmware:\n"
- " Version: %s (%x)\n",
- native->version_string, native->version, agb->version_string, agb->version, twl->version_string, twl->version);
+ is_setup_info = 1;
+ }
- wait_key(1);
-
- need_redraw = 1;
- clear_screen(TOP_SCREEN);
+ show_menu(info_d, NULL);
}
void