-
Notifications
You must be signed in to change notification settings - Fork 22
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
base: custom-loader-menu
Are you sure you want to change the base?
Amend button descriptions in game selection menu #51
Conversation
This makes the ‘Control Stick: Select’, ‘B: Cancel’, and ‘A: Confirm’ descriptions appear while in the game selection menu, while still keeping just ‘B: Cancel’ when on the ‘Press Start’ screen. To do this, this patches the function that updates the button descriptions, replacing two jump table entries, allowing our own code to be run (and determine which descriptions to display) while within the gameplay menu.
Compared to just using `asm()` in the .c file, this seems a bit more readable to me, and allows the assembly code to use the `r3` alias in `asm.h`.
patches/source/button_descriptions.c
Outdated
| update_element_alpha(&all_element_alphas->text.three_columns.centre_finish, true); | ||
|
|
||
| // Show 'B: Cancel' on both the loader and start screens | ||
| update_element_alpha(&all_element_alphas->text.three_columns.centre_cancel, false); |
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.
Oh, one difference from the original is that even 'B: Cancel' was conditional on something there, but I wasn't able to work out what that something was. I haven't replicated that condition here, but it could be worth double-checking if we should.
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.
I think I later found that this hid itself if the 'an error has occurred' message is displayed. I don't think I'll lose much sleep if we just don't replicate that 😛
Rather than patching jump tables to point to unrelated addresses, and then having to jump back to the original code, this just replaces the code at the original jump target instead.
Based on the element alpha code for the disc/FlippyDrive selection UI, this: - Wraps `update_button_alphas()` - for now just calling the original function - Moves element alpha structs and functions to its own file - Updates the `element_alpha_state_t`, to name more members - Updates `update_element_alpha` to take a `element_alpha_update_state_t` enum, rather than the `bool` that was there before (as this function also supports a ‘dimmed’ state)
This replaces the patches-within-a-jump-table with straightforward C calls in the `patch_update_button_alphas()`. Either we run the original code, or we call our custom update functions.
The standard `update_button_alphas` has some additional code on PAL systems to update the button alphas for the different languages. This reimplements this behaviour when using custom button description updates.
|
While looking at re-adding disc drive support (and UI for switching between the disc/FlippyDrive), I ended up touching a fair bit of related code. So, I've updated this review to include those updates. Additionally, I've simplified how this works by wrapping the entire function, rather than patching specific parts of jump tables in the original assembly 🙂 |
This makes the ‘Control Stick: Select’, ‘B: Cancel’, and ‘A: Confirm’ descriptions appear while in the game selection menu, while still keeping just ‘B: Cancel’ when on the ‘Press Start’ screen.
To do this, this patches the function that updates the button descriptions, replacing two jump table entries, allowing our own code to be run (and determine which descriptions to display) while within the gameplay menu.
Note that I've only been able to test on PAL 1.0, so please do test on other versions before merging! Cc: @trevor403