From 05448c111530ef825658b5545241141b08154e0b Mon Sep 17 00:00:00 2001 From: dsbomb Date: Thu, 22 May 2008 15:39:00 +0000 Subject: [PATCH] add dpad left/right to menus --- source/drivers/gamecube/info.c | 173 ++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 22 deletions(-) diff --git a/source/drivers/gamecube/info.c b/source/drivers/gamecube/info.c index 82df9f7..733281f 100644 --- a/source/drivers/gamecube/info.c +++ b/source/drivers/gamecube/info.c @@ -407,6 +407,14 @@ void ConfigPAD() { line = 0; scrollerx = 320 - MARGIN; + int TurboSpeedsCount = 8; + u8 TurboSpeeds[8] = { 2, 4, 8, 10, 15, 20, 25, 30 }; + // Default to 30 pps + int TurboNumber = TurboSpeedsCount; + for (i=0; i 70 ) PADCAL = 30; break; - case PAD_SPEED:i = -1; - PADTUR += 1; - if ( PADTUR > 10 ) PADTUR += 4; - if ( PADTUR > 30 ) - PADTUR = 2; + TurboNumber++; + if (TurboNumber >= TurboSpeedsCount) + TurboNumber = 0; + PADTUR = TurboSpeeds[TurboNumber]; break; - case PAD_EXIT: quit = 1; break; @@ -477,6 +482,66 @@ void ConfigPAD() { quit = 1; } + if (j & PAD_BUTTON_LEFT) { + i = -1; + redraw = 1; + switch(menu) { + case PAD_A: i = 0; break; + case PAD_B: i = 1; break; + case PAD_TURBO_A: i = 4; break; + case PAD_TURBO_B: i = 5; break; + case PAD_START: i = 2; break; + case PAD_SELECT: i = 3; break; + case PAD_FOUR_SCORE: i = -1; + FSDisable = 1; + FCEUI_DisableFourScore(FSDisable); + break; + case PAD_CLIP: i = -1; + PADCAL -= 5; + if (PADCAL < 30) + PADCAL = 30; + break; + case PAD_SPEED: i = -1; + TurboNumber--; + if (TurboNumber < 0) TurboNumber = 0; + PADTUR = TurboSpeeds[TurboNumber]; + break; + default: break; + } + if ( (quit == 0) && (i >= 0) && (mpads[i] > 0) ) + mpads[i]--; + } + + if (j & PAD_BUTTON_RIGHT) { + i = -1; + redraw = 1; + switch(menu) { + case PAD_A: i = 0; break; + case PAD_B: i = 1; break; + case PAD_TURBO_A: i = 4; break; + case PAD_TURBO_B: i = 5; break; + case PAD_START: i = 2; break; + case PAD_SELECT: i = 3; break; + case PAD_FOUR_SCORE: i = -1; + FSDisable = 0; + FCEUI_DisableFourScore(FSDisable); + break; + case PAD_CLIP: i = -1; + PADCAL += 5; + if (PADCAL > 70) + PADCAL = 70; + break; + case PAD_SPEED: i = -1; + TurboNumber++; + if (TurboNumber > TurboSpeedsCount) TurboNumber = TurboSpeedsCount; + PADTUR = TurboSpeeds[TurboNumber]; + break; + default: break; + } + if ( (quit == 0) && (i >= 0) && (mpads[i] < 5) ) + mpads[i]++; + } + if ( menu < 0 ) menu = PadMenuCount - 1; if ( menu == PadMenuCount ) menu = 0; @@ -587,19 +652,18 @@ int StateManager() { ChosenSlot = SdSlotCount - 1; redraw = 1; } else if (ChosenMenu == SAVE_DEVICE) { - ChosenDevice ^= 1; + if (ChosenDevice == 0) ChosenDevice = 1; redraw = 1; } } if (j & PAD_BUTTON_LEFT) { if (ChosenMenu == SAVE_SLOT) { - ChosenSlot--; - if (ChosenSlot < 0) - ChosenSlot = 0; + if (ChosenSlot) + ChosenSlot--; redraw = 1; } else if (ChosenMenu == SAVE_DEVICE) { - ChosenDevice ^= 1; + if (ChosenDevice) ChosenDevice = 0; redraw = 1; } } @@ -704,34 +768,100 @@ int VideoEnhancements() { } } break; - case VIDEO_SPRITE: slimit ^=1; FCEUI_DisableSpriteLimitation( slimit ); break; - case VIDEO_TIMING: timing ^= 1; FCEUI_SetVidSystem( timing ); break; - case VIDEO_SAVE: ManageSettings(0, ChosenSlot, ChosenDevice, 0); break; - case VIDEO_LOAD: ManageSettings(1, ChosenSlot, ChosenDevice, 0); break; - case VIDEO_EXIT: quit = 1; break; - default: break; } } + if ( j & PAD_BUTTON_LEFT ) { + redraw = 1; + switch (menu) { + case VIDEO_SCALER: + if (screenscaler) screenscaler--; + break; + case VIDEO_PALETTE: + if (currpal) currpal--; + if ( currpal == 0 ) { + /*** Do palette reset ***/ + FCEU_ResetPalette(); + } else { + /*** Now setup this palette ***/ + for ( i = 0; i < 64; i++ ) { + r = palettes[currpal-1].data[i] >> 16; + g = ( palettes[currpal-1].data[i] & 0xff00 ) >> 8; + b = ( palettes[currpal-1].data[i] & 0xff ); + FCEUD_SetPalette( i, r, g, b); + FCEUD_SetPalette( i+64, r, g, b); + FCEUD_SetPalette( i+128, r, g, b); + FCEUD_SetPalette( i+192, r, g, b); + } + } + break; + case VIDEO_SPRITE: + if (slimit) slimit = 0; + FCEUI_DisableSpriteLimitation(slimit); + break; + case VIDEO_TIMING: + if (timing) timing = 0; + FCEUI_SetVidSystem(timing); + break; + default: break; + } + } + + if ( j & PAD_BUTTON_RIGHT ) { + redraw = 1; + switch (menu) { + case VIDEO_SCALER: + if (screenscaler < 2) screenscaler++; + break; + case VIDEO_PALETTE: + if (currpal < MAXPAL) currpal++; + if ( currpal == 0 ) { + /*** Do palette reset ***/ + FCEU_ResetPalette(); + } else { + /*** Now setup this palette ***/ + for ( i = 0; i < 64; i++ ) { + r = palettes[currpal-1].data[i] >> 16; + g = ( palettes[currpal-1].data[i] & 0xff00 ) >> 8; + b = ( palettes[currpal-1].data[i] & 0xff ); + FCEUD_SetPalette( i, r, g, b); + FCEUD_SetPalette( i+64, r, g, b); + FCEUD_SetPalette( i+128, r, g, b); + FCEUD_SetPalette( i+192, r, g, b); + } + } + break; + case VIDEO_SPRITE: + if (slimit == 0) slimit = 1; + FCEUI_DisableSpriteLimitation(slimit); + break; + case VIDEO_TIMING: + if (timing == 0) timing = 1; + FCEUI_SetVidSystem(timing); + break; + default: break; + } + } + if ( j & PAD_BUTTON_B ) quit = 1; if ( menu < 0 ) menu = VideoMenuCount - 1; @@ -905,9 +1035,8 @@ int MediaSelect() { } if ( (j & PAD_BUTTON_LEFT) && (ChosenMenu == MEDIA_SLOT) ) { - ChosenSlot--; - if (ChosenSlot < 0) - ChosenSlot = 0; + if (ChosenSlot) + ChosenSlot--; redraw = 1; }