From befc2b8f0a7df4c5d55a1596396a63c19f5040ef Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Tue, 10 Apr 2012 19:03:32 +0000 Subject: [PATCH] [gamecube] better implementation of progressive mode user switch ? --- source/gx/config.c | 34 +++++++++++++++++++++++++--------- source/gx/gui/legal.c | 18 ------------------ source/gx/gx_video.c | 6 ------ source/gx/main.c | 7 +++++-- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/source/gx/config.c b/source/gx/config.c index 631502d..25ac8a6 100644 --- a/source/gx/config.c +++ b/source/gx/config.c @@ -212,25 +212,41 @@ void config_default(void) sprintf (config.lastdir[3][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH); #endif - /* try to restore settings from config file */ - if (!config_load()) GUI_WaitPrompt("Info","Default Settings restored"); - - /* hot swap requires at least a first initialization */ - config.hot_swap &= 1; + /* try to restore user config */ + int loaded = config_load(); /* restore inputs */ input_init(); #ifndef HW_RVL - /* support for progressive mode (480p) if component cable has been detected */ - if (VIDEO_HaveComponentCable()) + /* detect progressive mode enable/disable requests */ + PAD_ScanPads(); + if (PAD_ButtonsHeld(0) & PAD_BUTTON_B) { - /* switch into configured video mode */ - vmode = config.v_prog ? &TVNtsc480Prog : &TVNtsc480IntDf; + /* swap progressive mode enable flag and play some sound to inform user */ + config.v_prog ^= 1; + ASND_Pause(0); + int voice = ASND_GetFirstUnusedVoice(); + ASND_SetVoice(voice,VOICE_MONO_16BIT,44100,0,(u8 *)intro_pcm,intro_pcm_size,200,200,NULL); + } + + /* switch into 480p if component cable has been detected and progressive mode is enabled */ + if (VIDEO_HaveComponentCable() && config.v_prog) + { + vmode = &TVNtsc480Prog; VIDEO_Configure (vmode); VIDEO_Flush(); VIDEO_WaitVSync(); VIDEO_WaitVSync(); } + + /* stop any sound */ + ASND_Pause(1); #endif + + /* inform user if default config is used */ + if (!loaded) + { + GUI_WaitPrompt("Warning","Default Settings restored"); + } } diff --git a/source/gx/gui/legal.c b/source/gx/gui/legal.c index 605c07d..8338196 100644 --- a/source/gx/gui/legal.c +++ b/source/gx/gui/legal.c @@ -120,24 +120,6 @@ void legal () gxTextureClose(&button); gxTextureClose(&logo); - -#ifndef HW_RVL - /* detect video mode switch user request */ - if (PAD_ButtonsHeld(0) & PAD_BUTTON_B) - { - /* switch user progressive mode configuration */ - config.v_prog ^= 1; - - /* play sound to inform user then enter main menu */ - ASND_Pause(0); - int voice = ASND_GetFirstUnusedVoice(); - ASND_SetVoice(voice,VOICE_MONO_16BIT,44100,0,(u8 *)intro_pcm,intro_pcm_size,200,200,NULL); - sleep (2); - ASND_Pause(1); - return; - } -#endif - if (count > 0) { ASND_Pause(0); diff --git a/source/gx/gx_video.c b/source/gx/gx_video.c index 6999b5e..61da77b 100644 --- a/source/gx/gx_video.c +++ b/source/gx/gx_video.c @@ -1384,12 +1384,6 @@ void gx_video_Stop(void) #ifdef HW_RVL VIDEO_SetTrapFilter(1); VIDEO_SetGamma(VI_GM_1_0); -#else - if (VIDEO_HaveComponentCable()) - { - /* switch video mode only if component cable has been detected */ - vmode = config.v_prog ? &TVNtsc480Prog : &TVNtsc480IntDf; - } #endif /* adjust TV width */ diff --git a/source/gx/main.c b/source/gx/main.c index 721e1b3..c18d2ca 100644 --- a/source/gx/main.c +++ b/source/gx/main.c @@ -104,7 +104,10 @@ static void init_machine(void) /* allocate cartridge ROM here (10 MB) */ cart.rom = memalign(32, MAXROMSIZE); - /* mark all BIOS as unloaded */ + /* system is not initialized */ + config.hot_swap &= 0x01; + + /* BIOS are unloaded */ config.bios &= 0x03; /* Genesis BOOT ROM support (2KB max) */ @@ -544,8 +547,8 @@ int main (int argc, char *argv[]) gx_audio_Init(); /* initialize genesis plus core */ - config_default(); history_default(); + config_default(); init_machine(); /* auto-load last ROM file */