From 868f450ebfbe23f815dc0e96e33d678a9adc8796 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Fri, 15 Nov 2024 20:14:43 +0000 Subject: [PATCH] Add context button enumeration --- src/menu/ui_components.h | 4 +++- src/menu/ui_components/common.c | 2 +- src/menu/views/browser.c | 10 +++++----- src/menu/views/credits.c | 2 +- src/menu/views/file_info.c | 2 +- src/menu/views/flashcart_info.c | 2 +- src/menu/views/load_disk.c | 6 +++--- src/menu/views/load_emulator.c | 4 ++-- src/menu/views/load_rom.c | 8 ++++---- src/menu/views/music_player.c | 4 ++-- src/menu/views/rtc.c | 14 +++++++------- src/menu/views/settings_editor.c | 4 ++-- src/menu/views/system_info.c | 2 +- src/menu/views/text_viewer.c | 4 ++-- 14 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/menu/ui_components.h b/src/menu/ui_components.h index 50f6463e..86e313f6 100644 --- a/src/menu/ui_components.h +++ b/src/menu/ui_components.h @@ -35,6 +35,7 @@ typedef enum { * Enumeration for different types of joypad button sprites used in the user interface. */ typedef enum { + SPRITE_JOYPAD_BUTTON_NONE, SPRITE_JOYPAD_BUTTON_A, SPRITE_JOYPAD_BUTTON_B, SPRITE_JOYPAD_BUTTON_C_DOWN, @@ -47,6 +48,7 @@ typedef enum { SPRITE_JOYPAD_BUTTON_D_UP, SPRITE_JOYPAD_BUTTON_L, SPRITE_JOYPAD_BUTTON_R, + SPRITE_JOYPAD_BUTTON_START, SPRITE_JOYPAD_BUTTON_Z, SPRITE_JOYPAD_BUTTON_TYPE_END /**< List end marker */ } sprite_joypad_button_type_t; @@ -166,7 +168,7 @@ void ui_components_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char * @param fmt Format string for the text. * @param ... Additional arguments for the format string. */ -void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, char *fmt, ...); +void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, sprite_joypad_button_type_t context_button, char *fmt, ...); /** * @brief Initialize the background component. diff --git a/src/menu/ui_components/common.c b/src/menu/ui_components/common.c index 1d45a80b..9f5e307b 100644 --- a/src/menu/ui_components/common.c +++ b/src/menu/ui_components/common.c @@ -166,7 +166,7 @@ void ui_components_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, cha } } -void ui_components_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, char *fmt, ...) { +void ui_components_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, action_bar_line_t line, sprite_joypad_button_type_t context_button, char *fmt, ...) { char buffer[256]; size_t nbytes = sizeof(buffer); diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index 2e546661..b7ddf672 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -386,23 +386,23 @@ static void draw (menu_t *menu, surface_t *d) { } ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_NONE, "%s", menu->browser.entries == 0 ? "" : action ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "^%02XB: Back^00", path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT ); ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_START, "Start: Settings" ); ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_R, "\n" "^%02XR: Options^00", menu->browser.entries == 0 ? STL_GRAY : STL_DEFAULT @@ -410,7 +410,7 @@ static void draw (menu_t *menu, surface_t *d) { if (menu->current_time >= 0) { ui_components_actions_bar_text_draw( - ALIGN_CENTER, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_CENTER, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_NONE, "\n" "%s", ctime(&menu->current_time) diff --git a/src/menu/views/credits.c b/src/menu/views/credits.c index 034b29f4..1d0cf15d 100644 --- a/src/menu/views/credits.c +++ b/src/menu/views/credits.c @@ -55,7 +55,7 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Exit" ); diff --git a/src/menu/views/file_info.c b/src/menu/views/file_info.c index 0ae04237..2998faa6 100644 --- a/src/menu/views/file_info.c +++ b/src/menu/views/file_info.c @@ -88,7 +88,7 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Exit" ); diff --git a/src/menu/views/flashcart_info.c b/src/menu/views/flashcart_info.c index 8bd8c585..a67119f9 100644 --- a/src/menu/views/flashcart_info.c +++ b/src/menu/views/flashcart_info.c @@ -79,7 +79,7 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" ); diff --git a/src/menu/views/load_disk.c b/src/menu/views/load_disk.c index 97d60926..4e6957e9 100644 --- a/src/menu/views/load_disk.c +++ b/src/menu/views/load_disk.c @@ -81,18 +81,18 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A, "A: Load and run 64DD disk" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Exit" ); if (menu->load.rom_path) { ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_R, "R: Load with ROM" ); } diff --git a/src/menu/views/load_emulator.c b/src/menu/views/load_emulator.c index 7b4958b5..5c07c091 100644 --- a/src/menu/views/load_emulator.c +++ b/src/menu/views/load_emulator.c @@ -66,11 +66,11 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A, "A: Load and run Emulated ROM" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Exit" ); diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index d7bb7d24..d457feac 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -263,21 +263,21 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A, "A: Load and run ROM" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" ); ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_L, "L|Z: Extra Info" ); ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_R, "\n" "R: Options" ); diff --git a/src/menu/views/music_player.c b/src/menu/views/music_player.c index 217fadc1..8e9c5af7 100644 --- a/src/menu/views/music_player.c +++ b/src/menu/views/music_player.c @@ -103,12 +103,12 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A, "A: %s", mp3player_is_playing() ? "Pause" : mp3player_is_finished() ? "Play again" : "Play" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Exit | Left / Right: Rewind / Fast forward" ); diff --git a/src/menu/views/rtc.c b/src/menu/views/rtc.c index 1aab2541..0bab4cdf 100644 --- a/src/menu/views/rtc.c +++ b/src/menu/views/rtc.c @@ -187,11 +187,11 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A, "A: Change" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" ); @@ -211,7 +211,7 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" ); @@ -219,20 +219,20 @@ static void draw (menu_t *menu, surface_t *d) { } else { ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_NONE, "Up/Down: Adjust Field" ); ui_components_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_RIGHT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_NONE, "\n" "Left/Right: Switch Field" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_R, "R: Save" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" ); diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index bb092bbc..4bbaf076 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -164,12 +164,12 @@ static void draw (menu_t *menu, surface_t *d) { ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_A, "A: Change" ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" ); diff --git a/src/menu/views/system_info.c b/src/menu/views/system_info.c index b21e779b..b1550b85 100644 --- a/src/menu/views/system_info.c +++ b/src/menu/views/system_info.c @@ -66,7 +66,7 @@ static void draw (menu_t *menu, surface_t *d) { ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Exit" ); diff --git a/src/menu/views/text_viewer.c b/src/menu/views/text_viewer.c index d41b014c..f9249c4f 100644 --- a/src/menu/views/text_viewer.c +++ b/src/menu/views/text_viewer.c @@ -82,13 +82,13 @@ static void draw (menu_t *menu, surface_t *d) { ui_components_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_ONE, SPRITE_JOYPAD_BUTTON_NONE, "^%02XUp / Down: Scroll^00", text->vertical_scroll_possible ? STL_DEFAULT : STL_GRAY ); ui_components_actions_bar_text_draw( - ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, + ALIGN_LEFT, VALIGN_TOP, ACTION_BAR_LINE_TWO, SPRITE_JOYPAD_BUTTON_B, "\n" "B: Back" );