-
Notifications
You must be signed in to change notification settings - Fork 57
Remove menu magic numbers #47
base: main
Are you sure you want to change the base?
Conversation
This allows reuse in other files.
Most arguments are equal, so wrap the function.
for (i = 0; i < 3; i++) { | ||
if (gMenuCursor || i) { | ||
if ((gMenuListCount - 1) != gMenuCursor || (i != 2)) { | ||
UI_PrintString(MenuList[gMenuCursor + i - 1], 0, 127, i * 2, 8, false); | ||
UI_PrintString(MenuList[gMenuCursor + i - 1], 0, SPLIT - 2, i * 2, 8, 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.
This is actually a bug fix 😄
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.
What do you mean with "bug fix" ? The original uses 127. From Ghidra:
if (((cursor | i) != 0) && ((gMenuListCount - 1 != cursor || (i != 2)))) {
GUI_PrintString("SQL" + ((cursor + i) - 1 & 0xff) * 7,0,0x7f,(i << 0x19) >> 0x18,8,0);
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.
If you mean a bug by QS, then I have the "fixes" branch for that. Fixes is rebased on v2.01.31 which is rebased on main.
I have fixed a few bugs in "fixes" that QS firmware (e.g. the 8.33kHz step for airband was not working correctly).
I'll test the "48" here and commit to fixes after the test.
The 127 / " SPLIT - 2" can be anything you like, it's not used, that param is only used when centering the text, which it's not, it's left aligned. |
Yes I just double checked and saw the same code. Still seems wrong to put in 127. |
It would probably make more sense to combine End and bCentered to just End, and it only centers if End > 0 or something. |
Thats what I do. Means 1 less param to pass. |
Do you still plan to pickup the rest of the magic number reduction? The bugfix was more of a consistency thing. |
Add documentation on the code in ui/menu.c
Made all relevant code depend on a single define for the split.