-
Notifications
You must be signed in to change notification settings - Fork 27
Amend button descriptions in game selection menu #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BenHetherington
wants to merge
7
commits into
OffBroadway:custom-loader-menu
Choose a base branch
from
BenHetherington:button-descriptions-in-game-selection
base: custom-loader-menu
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
343f84e
Amend button descriptions in game selection menu
BenHetherington 0665938
Split assembly into a separate file
BenHetherington dbe53f8
Simplify the patches for button descriptions
BenHetherington e2b2875
Merge branch 'custom-loader-menu' into button-descriptions-in-game-se…
BenHetherington 02b8be9
Add shared element alpha code
BenHetherington e0862da
Move custom button updating code to wrapper
BenHetherington 0c9b96b
Add additional PAL code after custom button update
BenHetherington File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| #include "button_descriptions.h" | ||
|
|
||
| #include "menu.h" | ||
| #include "attr.h" | ||
| #include "reloc.h" | ||
|
|
||
| #define NUM_PAL_LANGUAGES 6 | ||
|
|
||
| __attribute_reloc__ void (*update_button_alphas)(); | ||
|
|
||
| __attribute_reloc__ all_element_alphas_t* all_element_alphas; | ||
|
|
||
| __attribute_reloc__ u16 *current_pal_buttons_language; | ||
| __attribute_reloc__ element_alpha_state_t *pal_button_language_elements; | ||
|
|
||
| static void update_gameplay_button_text() { | ||
| // Disable button descriptions used by the outer menu | ||
| update_element_alpha(&all_element_alphas->text.one_column.menu_selection, element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->text.two_columns.left_cancel, element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->text.two_columns.right_confirm, element_alpha_hidden); | ||
|
|
||
| // And also disable button descriptions used by other menus | ||
| update_element_alpha(&all_element_alphas->text.three_columns.left_change, element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->text.three_columns.centre_finish, element_alpha_hidden); | ||
|
|
||
| // Show 'B: Cancel' on both the loader and start screens | ||
| update_element_alpha(&all_element_alphas->text.three_columns.centre_cancel, element_alpha_visible); | ||
|
|
||
| // Show 'Control Stick: Select' and 'A: Confirm' just on the loader menu | ||
| update_element_alpha(&all_element_alphas->text.three_columns.left_select, current_gameselect_state == SUBMENU_GAMESELECT_LOADER ? element_alpha_visible : element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->text.three_columns.right_confirm, current_gameselect_state == SUBMENU_GAMESELECT_LOADER ? element_alpha_visible : element_alpha_hidden); | ||
| } | ||
|
|
||
| static void update_gameplay_button_icons() { | ||
| // Disable button icons used by the outer menu | ||
| update_element_alpha(&all_element_alphas->icons.one_column.control_stick, element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->icons.two_columns.left_b_button, element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->icons.two_columns.right_a_button, element_alpha_hidden); | ||
|
|
||
| // Show 'B: Cancel' on both the loader and start screens | ||
| update_element_alpha(&all_element_alphas->icons.three_columns.centre_b_button, element_alpha_visible); | ||
|
|
||
| // Show 'Control Stick: Select' and 'A: Confirm' just on the loader menu | ||
| update_element_alpha(&all_element_alphas->icons.three_columns.left_control_stick, current_gameselect_state == SUBMENU_GAMESELECT_LOADER ? element_alpha_visible : element_alpha_hidden); | ||
| update_element_alpha(&all_element_alphas->icons.three_columns.right_a_button, current_gameselect_state == SUBMENU_GAMESELECT_LOADER ? element_alpha_visible : element_alpha_hidden); | ||
| } | ||
|
|
||
| static void update_pal_button_languages() { | ||
| if (!current_pal_buttons_language || !pal_button_language_elements) { | ||
| // Only PAL 1.0 and 1.2 have runtime-configurable languages; other versions don't need this additional step | ||
| return; | ||
| } | ||
|
|
||
| for (int i = 0; i < NUM_PAL_LANGUAGES; i++) { | ||
| element_alpha_update_state_t language_state = (i == *current_pal_buttons_language) ? element_alpha_visible : element_alpha_hidden; | ||
| update_element_alpha(&pal_button_language_elements[i], language_state); | ||
| } | ||
| } | ||
|
|
||
| __attribute_used__ void patch_update_button_alphas() { | ||
| bool ran_default_code = false; | ||
|
|
||
| switch (*cur_menu_id) { | ||
| case MENU_GAMESELECT_TRANSITION_ID: | ||
| update_gameplay_button_text(); | ||
| update_gameplay_button_icons(); | ||
| break; | ||
|
|
||
| default: | ||
| update_button_alphas(); | ||
| ran_default_code = true; | ||
| break; | ||
| } | ||
|
|
||
| if (!ran_default_code) { | ||
| // If we didn't run the default code, we also have to take care of updating the per-language elements on PAL systems | ||
| update_pal_button_languages(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #include <gctypes.h> | ||
|
|
||
| #include "element_alpha.h" | ||
|
|
||
| typedef struct { | ||
| struct { | ||
| struct { | ||
| element_alpha_state_t left_control_stick; | ||
| element_alpha_state_t centre_b_button; | ||
| element_alpha_state_t right_a_button; | ||
| } three_columns; | ||
|
|
||
| struct { | ||
| element_alpha_state_t control_stick; | ||
| } one_column; | ||
|
|
||
| struct { | ||
| element_alpha_state_t left_b_button; | ||
| element_alpha_state_t right_a_button; | ||
| } two_columns; | ||
| } icons; | ||
|
|
||
| struct { | ||
| struct { | ||
| element_alpha_state_t menu_selection; | ||
| } one_column; | ||
|
|
||
| struct { | ||
| element_alpha_state_t left_cancel; | ||
| element_alpha_state_t right_confirm; | ||
| } two_columns; | ||
|
|
||
| struct { | ||
| element_alpha_state_t left_select; | ||
| element_alpha_state_t left_change; | ||
| element_alpha_state_t centre_cancel; | ||
| element_alpha_state_t centre_finish; | ||
| element_alpha_state_t right_confirm; | ||
| } three_columns; | ||
| } text; | ||
|
|
||
| // There are more elements past this point that relate to other elements, e.g. menus | ||
| } all_element_alphas_t; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #include "element_alpha.h" | ||
|
|
||
| #include "attr.h" | ||
|
|
||
| __attribute_reloc__ void (*update_element_alpha)(element_alpha_state_t *element, element_alpha_update_state_t new_state); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #pragma once | ||
|
|
||
| #include <gctypes.h> | ||
|
|
||
| typedef struct { | ||
| u16 current_alpha; // Ranges from 0 to (fade_duration + start_delay) | ||
| u16 fade_duration; // Frames; typically 0x14 | ||
| u16 start_delay; // Frames; typically 0 | ||
| u16 frame_counter; // Incremented with every update | ||
| u8 unk0; | ||
| u8 max_output; | ||
| u16 unknown_output_multiplier; | ||
| u32 unk1; | ||
| } element_alpha_state_t; | ||
|
|
||
| typedef enum { | ||
| element_alpha_visible, | ||
| element_alpha_hidden, | ||
| element_alpha_dimmed | ||
| } element_alpha_update_state_t; | ||
|
|
||
| extern void (*update_element_alpha)(element_alpha_state_t *element, element_alpha_update_state_t new_state); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🇬🇧