Skip to content

Commit c541aff

Browse files
committed
Removed unnecessary D-Pad checks
1 parent fe1f208 commit c541aff

File tree

1 file changed

+5
-172
lines changed

1 file changed

+5
-172
lines changed

ttyd-tools/rel/source/menufunctions.cpp

Lines changed: 5 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,202 +3186,35 @@ uint32_t checkButtonSingleFrame()
31863186
void default_DPAD_Actions(uint32_t button)
31873187
{
31883188
uint32_t tempCurrentMenu = CurrentMenu;
3189-
uint32_t tempTotalMenuColumns = Menu[tempCurrentMenu].TotalMenuColumns;
3190-
3191-
// Pressing either of these causes the current option to jump to the last option when theres only one column - look into fixing
3192-
if (((button == DPADLEFT) || (button == DPADRIGHT)) &&
3193-
(tempTotalMenuColumns == 1))
3194-
{
3195-
return;
3196-
}
3197-
31983189
uint32_t tempTotalMenuOptions = Menu[tempCurrentMenu].TotalMenuOptions;
31993190
uint32_t tempColumnSplitAmount = Menu[tempCurrentMenu].ColumnSplitAmount;
3191+
uint32_t tempTotalMenuColumns = Menu[tempCurrentMenu].TotalMenuColumns;
32003192
uint32_t MaxOptionsPerPage = tempColumnSplitAmount * tempTotalMenuColumns;
32013193
uint32_t MaxOptionsPerRow = tempTotalMenuColumns;
32023194

32033195
adjustMenuSelectionVertical(button, CurrentMenuOption,
32043196
CurrentPage, tempTotalMenuOptions, MaxOptionsPerPage,
3205-
MaxOptionsPerRow, true);
3197+
MaxOptionsPerRow, false);
32063198
}
32073199

3208-
/*void DPAD_Actions(uint32_t button)
3209-
{
3210-
uint32_t tempCurrentMenu = CurrentMenu;
3211-
uint32_t tempTotalMenuColumns = Menu[tempCurrentMenu].TotalMenuColumns;
3212-
uint32_t tempCurrentMenuOption = CurrentMenuOption;
3213-
uint32_t tempColumnSplitAmount = Menu[tempCurrentMenu].ColumnSplitAmount;
3214-
uint32_t tempTotalMenuOptions = Menu[tempCurrentMenu].TotalMenuOptions;
3215-
3216-
switch (button)
3217-
{
3218-
case DPADLEFT:
3219-
{
3220-
// Make sure the current menu has more than one column
3221-
if (tempTotalMenuColumns == 1)
3222-
{
3223-
return;
3224-
}
3225-
else if (tempCurrentMenuOption == 0)
3226-
{
3227-
// Current option is Return, so do nothing
3228-
return;
3229-
}
3230-
else if (tempCurrentMenuOption <= tempColumnSplitAmount)
3231-
{
3232-
// Currently on the furthest left side, so move to the furthest right option
3233-
tempCurrentMenuOption = ((tempColumnSplitAmount * tempTotalMenuColumns) -
3234-
(tempColumnSplitAmount - tempCurrentMenuOption));
3235-
3236-
// Make sure the current option is valid
3237-
if (tempCurrentMenuOption > (tempTotalMenuOptions - 1))
3238-
{
3239-
// The current option exceeds the total options, so set the current option to the last option
3240-
CurrentMenuOption = (tempTotalMenuOptions - 1);
3241-
}
3242-
else
3243-
{
3244-
CurrentMenuOption = tempCurrentMenuOption;
3245-
}
3246-
}
3247-
else // if (tempCurrentMenuOption > tempColumnSplitAmount)
3248-
{
3249-
// Currently on the right side, so move to the next left option
3250-
CurrentMenuOption = (tempCurrentMenuOption - tempColumnSplitAmount);
3251-
}
3252-
break;
3253-
}
3254-
case DPADRIGHT:
3255-
{
3256-
// Make sure the current menu has more than one column
3257-
if (tempTotalMenuColumns == 1)
3258-
{
3259-
return;
3260-
}
3261-
else if (tempCurrentMenuOption == 0)
3262-
{
3263-
// Current option is Return, so do nothing
3264-
return;
3265-
}
3266-
else if (tempCurrentMenuOption < ((tempColumnSplitAmount *
3267-
tempTotalMenuColumns) - (tempColumnSplitAmount - 1)))
3268-
{
3269-
// Currently not on the furthest right side, so move to the next right option
3270-
tempCurrentMenuOption += tempColumnSplitAmount;
3271-
3272-
// Make sure the current option is valid
3273-
if (tempCurrentMenuOption > (tempTotalMenuOptions - 1))
3274-
{
3275-
// The current option exceeds the total options, so set the current option to the last option
3276-
CurrentMenuOption = (tempTotalMenuOptions - 1);
3277-
}
3278-
else
3279-
{
3280-
CurrentMenuOption = tempCurrentMenuOption;
3281-
}
3282-
}
3283-
else
3284-
{
3285-
// Currently on the furthest right side, so go to the furthest left option
3286-
CurrentMenuOption = (tempCurrentMenuOption -
3287-
(tempColumnSplitAmount * (tempTotalMenuColumns - 1)));
3288-
}
3289-
break;
3290-
}
3291-
case DPADDOWN:
3292-
{
3293-
// Check if currently at the bottom of the current column
3294-
if ((tempCurrentMenuOption != 0) &&
3295-
(tempCurrentMenuOption % tempColumnSplitAmount == 0))
3296-
{
3297-
// Go to the top of the current column
3298-
CurrentMenuOption = (tempCurrentMenuOption - tempColumnSplitAmount);
3299-
}
3300-
else if (tempCurrentMenuOption == (tempTotalMenuOptions - 1))
3301-
{
3302-
// Currently on the last option, so go to the first option of the last column
3303-
if (tempTotalMenuColumns > 1)
3304-
{
3305-
CurrentMenuOption = (((tempTotalMenuColumns - 1) *
3306-
tempColumnSplitAmount) + 1);
3307-
}
3308-
else
3309-
{
3310-
// The current menu only has one column, so go to the first option
3311-
CurrentMenuOption = 0;
3312-
}
3313-
}
3314-
else
3315-
{
3316-
CurrentMenuOption = (tempCurrentMenuOption + 1);
3317-
}
3318-
break;
3319-
}
3320-
case DPADUP:
3321-
{
3322-
// Check if currently at the top of the current column
3323-
if ((tempCurrentMenuOption == 0) ||
3324-
(tempCurrentMenuOption % (tempColumnSplitAmount + 1) == 0))
3325-
{
3326-
// Loop to the last option in the current column
3327-
tempCurrentMenuOption += tempColumnSplitAmount;
3328-
3329-
// Make sure the current option is valid
3330-
if (tempCurrentMenuOption > (tempTotalMenuOptions - 1))
3331-
{
3332-
// The current option exceeds the total options, so set the current option to the last option
3333-
CurrentMenuOption = (tempTotalMenuOptions - 1);
3334-
}
3335-
else
3336-
{
3337-
CurrentMenuOption = tempCurrentMenuOption;
3338-
}
3339-
}
3340-
else
3341-
{
3342-
CurrentMenuOption = (tempCurrentMenuOption - 1);
3343-
}
3344-
break;
3345-
}
3346-
default:
3347-
{
3348-
return;
3349-
}
3350-
}
3351-
}*/
3352-
33533200
void adjustMenuNoPageEdit(uint32_t button)
33543201
{
33553202
uint32_t tempCurrentMenu = CurrentMenu;
3356-
uint32_t tempTotalMenuColumns = Menu[tempCurrentMenu].TotalMenuColumns;
3357-
3358-
// Pressing either of these causes the current option to jump to the last option when theres only one column - look into fixing
3359-
if (((button == DPADLEFT) || (button == DPADRIGHT)) &&
3360-
(tempTotalMenuColumns == 1))
3361-
{
3362-
return;
3363-
}
3364-
33653203
uint32_t tempTotalMenuOptions = Menu[tempCurrentMenu].TotalMenuOptions;
33663204
uint32_t tempColumnSplitAmount = Menu[tempCurrentMenu].ColumnSplitAmount;
3205+
uint32_t tempTotalMenuColumns = Menu[tempCurrentMenu].TotalMenuColumns;
33673206
uint32_t MaxOptionsPerPage = tempColumnSplitAmount * tempTotalMenuColumns;
33683207
uint32_t MaxOptionsPerRow = tempTotalMenuColumns;
33693208
uint8_t tempPage[1];
33703209
tempPage[0] = 0;
33713210

33723211
adjustMenuSelectionVertical(button, CurrentMenuOption,
33733212
tempPage[0], tempTotalMenuOptions, MaxOptionsPerPage,
3374-
MaxOptionsPerRow, true);
3213+
MaxOptionsPerRow, false);
33753214
}
33763215

33773216
void adjustCheatsManageFlagsMainMenu(uint32_t button)
33783217
{
3379-
// Pressing either of these causes the current option to jump to the last option when theres only one column - look into fixing
3380-
if ((button == DPADLEFT) || (button == DPADRIGHT))
3381-
{
3382-
return;
3383-
}
3384-
33853218
uint32_t TotalMenuOptions;
33863219
switch (MenuSelectionStates)
33873220
{
@@ -3587,7 +3420,7 @@ void adjustPartnerStatsSelection(uint32_t button)
35873420

35883421
adjustMenuSelectionVertical(button, CurrentMenuOption,
35893422
CurrentPage, TotalMenuOptions, MaxOptionsPerPage,
3590-
MaxOptionsPerRow, false);
3423+
MaxOptionsPerRow, true);
35913424
}
35923425

35933426
void adjustMemoryWatchSelection(uint32_t button)

0 commit comments

Comments
 (0)