GaryOderNichts / recovery_menu

Recovery Menu for the Nintendo Wii U
GNU General Public License v2.0
144 stars 17 forks source link

Indicate when waiting for a keypress #18

Open nelgin opened 1 year ago

nelgin commented 1 year ago

When trying to use recovery_menu without the benefit of a display, it would be nice to know if the device has finished a task (dumped logs, dumped roms, loaded network etc). I made a small enhancement to waitButtonInput to flash yellow when it's waiting for a key. It might be good to have it flash red if an operation failed.

Add the following as the first line in the waitButtonInput function in ios_mcp/source/menu.c

    setNotificationLED(NOTIF_LED_ORANGE|NOTIF_LED_ORANGE_BLINKING);

Then before the return, turn it purple again

   setNotificationLED(NOTIF_LED_BLUE|NOTIF_LED_RED);

Hope this helps those working in the dark.

filipe-maia commented 1 year ago

I'm facing the same problem. This would be a nice addition.

filipe-maia commented 1 year ago

Hi,

Thank you @nelgin .

I've changed "setNotificationLED" to "SMC_SetNotificationLED", the end result on the function is:

/**
 * Wait for the user to press a button.
 */
void waitButtonInput(void)
{
    SMC_SetNotificationLED(NOTIF_LED_ORANGE|NOTIF_LED_ORANGE_BLINKING);
    gfx_set_font_color(COLOR_PRIMARY);
    gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);

    gfx_draw_rect_filled(16 - 1, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4,
        SCREEN_WIDTH - 16, CHAR_SIZE_DRC_Y + 2,
        COLOR_BACKGROUND);
    gfx_print(16, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4, 0, "Press EJECT or POWER to proceed...");

    uint8_t cur_flag = 0;
    uint8_t flag = 0;

    while (1) {
        SMC_ReadSystemEventFlag(&flag);
        if (cur_flag != flag) {
            if ((flag & SYSTEM_EVENT_FLAG_EJECT_BUTTON) || (flag & SYSTEM_EVENT_FLAG_POWER_BUTTON)) {
                SMC_SetNotificationLED(NOTIF_LED_BLUE|NOTIF_LED_RED);
                return;
            }

            cur_flag = flag;
        }
    }
}

I've attached the built files (they also contain the changes of issue 19). recovery_menu.zip