add reboot option to menu

This commit is contained in:
Joshua Peisach
2024-05-23 11:10:14 -04:00
parent aed0c987f7
commit 152a35882e
2 changed files with 26 additions and 6 deletions

View File

@@ -84,10 +84,11 @@ void m_main_theme_reinit(void) {
for (i = 0; i < v_m_main->widget_count; ++i)
widget_free(&v_m_main->widgets[i]);
if (bootmii_ios)
// Chances are BootMii will be installed - otherwise, this will be enough room anyways for a 'Reboot' option.
// if (bootmii_ios)
yadd = 16;
else
yadd = 32;
// else
// yadd = 32;
x = (view_width - theme_gfx[THEME_BUTTON]->w) / 2;
y = 80;
@@ -106,16 +107,19 @@ void m_main_theme_reinit(void) {
widget_button (&v_m_main->widgets[3], x, y, 0, BTN_NORMAL, _("Exit to System Menu"));
y += theme_gfx[THEME_BUTTON]->h + yadd;
widget_button (&v_m_main->widgets[4], x, y, 0, BTN_NORMAL, _("Shutdown"));
widget_button (&v_m_main->widgets[4], x, y, 0, BTN_NORMAL, _("Reboot"));
y += theme_gfx[THEME_BUTTON]->h + yadd;
widget_label (&v_m_main->widgets[5], view_width / 3 * 2 - 16, 32, 0,
widget_button (&v_m_main->widgets[5], x, y, 0, BTN_NORMAL, _("Shutdown"));
widget_label (&v_m_main->widgets[6], view_width / 3 * 2 - 16, 32, 0,
CHANNEL_VERSION_STR, view_width / 3 - 32, FA_RIGHT,
FA_ASCENDER, FONT_LABEL);
sprintf(buffer, "IOS%d v%d.%d", IOS_GetVersion(), IOS_GetRevisionMajor(),
IOS_GetRevisionMinor());
widget_label (&v_m_main->widgets[6], view_width / 3 * 2 - 16,
widget_label (&v_m_main->widgets[7], view_width / 3 * 2 - 16,
32 + font_get_y_spacing(FONT_LABEL), 0, buffer,
view_width / 3 - 32, FA_RIGHT, FA_ASCENDER, FONT_LABEL);

View File

@@ -291,6 +291,7 @@ void main_real(void) {
bool reloced;
bool ahb_access;
bool launch_bootmii;
bool restart;
u64 frame;
bool exit_about;
@@ -333,6 +334,7 @@ void main_real(void) {
reloced = false;
ahb_access = false;
launch_bootmii = false;
restart = false;
frame = 0;
exit_about = false;
@@ -434,6 +436,7 @@ void main_real(void) {
if (bd & PADS_DOWN)
view_set_focus_next (v_current);
// what to do when a button is pressed
if (bd & PADS_A) {
switch (v_m_main->focus) {
case 0:
@@ -452,16 +455,24 @@ void main_real(void) {
continue;
// "Launch BootMii"
case 2:
launch_bootmii = true;
should_exit = true;
break;
// "Exit to System Menu"
case 3:
should_exit = true;
continue;
// "Reboot"
case 4:
restart = true;
should_exit = true;
// "Shutdown"
case 5:
should_exit = true;
shutdown = true;
break;
@@ -807,6 +818,11 @@ void main_real(void) {
loader_exec (ep);
}
if (restart) {
gprintf ("rebooting console\n");
STM_RebootSystem();
}
if (shutdown) {
gprintf ("shutting down\n");
SYS_ResetSystem(SYS_POWEROFF, 0, 0);