Skip to content

Commit

Permalink
rosalina: in volume override menu, add support for CPAD too
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxSH committed Oct 1, 2024
1 parent 2a7caa3 commit 684c95c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions sysmodules/rosalina/source/menus/sysconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void SysConfigMenu_AdjustVolume(void)
{
Draw_Lock();
Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu");
u32 posY = Draw_DrawString(10, 30, COLOR_WHITE, "Y: Toggle volume slider override.\nDPAD: Adjust the volume level.\nA: Apply\nB: Go back\n\n");
u32 posY = Draw_DrawString(10, 30, COLOR_WHITE, "Y: Toggle volume slider override.\nDPAD/CPAD: Adjust the volume level.\nA: Apply\nB: Go back\n\n");
Draw_DrawString(10, posY, COLOR_WHITE, "Current status:");
posY = Draw_DrawString(100, posY, (tempVolumeOverride == -1) ? COLOR_RED : COLOR_GREEN, (tempVolumeOverride == -1) ? " DISABLED" : " ENABLED ");
if (tempVolumeOverride != -1) {
Expand All @@ -447,8 +447,12 @@ void SysConfigMenu_AdjustVolume(void)
}

Draw_FlushFramebuffer();
Draw_Unlock();

u32 pressed = waitInputWithTimeout(1000);

Draw_Lock();

if(pressed & KEY_A)
{
currVolumeSliderOverride = tempVolumeOverride;
Expand All @@ -471,23 +475,26 @@ void SysConfigMenu_AdjustVolume(void)
tempVolumeOverride = -1;
}
}
else if ((pressed & (KEY_DUP | KEY_DDOWN | KEY_DLEFT | KEY_DRIGHT)) && tempVolumeOverride != -1)
else if ((pressed & (KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT)) && tempVolumeOverride != -1)
{
Draw_DrawString(10, posY, COLOR_WHITE, "\n ");
if (pressed & KEY_DUP)
if (pressed & KEY_UP)
tempVolumeOverride++;
else if (pressed & KEY_DDOWN)
else if (pressed & KEY_DOWN)
tempVolumeOverride--;
else if (pressed & KEY_DRIGHT)
else if (pressed & KEY_RIGHT)
tempVolumeOverride+=10;
else if (pressed & KEY_DLEFT)
else if (pressed & KEY_LEFT)
tempVolumeOverride-=10;

if (tempVolumeOverride < 0)
tempVolumeOverride = 0;
if (tempVolumeOverride > 100)
tempVolumeOverride = 100;
}

Draw_FlushFramebuffer();
Draw_Unlock();
} while(!menuShouldExit);
}

Expand Down

0 comments on commit 684c95c

Please sign in to comment.