X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fplat.c;h=d1e6d809c82e8f589f3d12c88135cd3a0de6f453;hb=662e622b59369f975691a70756f80188d8d27ea0;hp=568d3632de3a701dbe9a86f4ec753f6a7c5d8f61;hpb=71769e27e90704f464bc1844daa044a5b1b24fd4;p=libpicofe.git diff --git a/gp2x/plat.c b/gp2x/plat.c index 568d363..d1e6d80 100644 --- a/gp2x/plat.c +++ b/gp2x/plat.c @@ -69,26 +69,17 @@ char cpu_clk_name[16] = "GP2X CPU clocks"; void plat_video_menu_enter(int is_rom_loaded) { - if (is_rom_loaded) - { - // darken the active framebuffer - memset(g_screen_ptr, 0, 320*8*2); - menu_darken_bg((char *)g_screen_ptr + 320*8*2, 320*224, 1); - memset((char *)g_screen_ptr + 320*232*2, 0, 320*8*2); - } - else - { - // should really only happen once, on startup.. - readpng(g_screen_ptr, "skin/background.png", READPNG_BG); - } - - // copy to buffer2 - gp2x_memcpy_buffers((1<<2), g_screen_ptr, 0, 320*240*2); + /* try to switch nicely avoiding tearing on Wiz */ + gp2x_video_wait_vsync(); + memset(gp2x_screens[0], 0, 320*240*2); + memset(gp2x_screens[1], 0, 320*240*2); + gp2x_video_flip2(); + gp2x_video_wait_vsync(); + gp2x_video_wait_vsync(); // switch to 16bpp gp2x_video_changemode_ll(16); gp2x_video_RGB_setscaling(0, 320, 240); - gp2x_video_flip2(); } void plat_video_menu_begin(void) @@ -103,21 +94,6 @@ void plat_video_menu_end(void) gp2x_video_flip2(); } -void plat_validate_config(void) -{ - gp2x_soc_t soc; - - soc = soc_detect(); - if (soc != SOCID_MMSP2) - PicoOpt &= ~POPT_EXT_FM; - - if (currentConfig.gamma < 10 || currentConfig.gamma > 300) - currentConfig.gamma = 100; - - if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 1024) - currentConfig.CPUclock = default_cpu_clock; -} - void plat_early_init(void) { gp2x_soc_t soc; @@ -133,8 +109,8 @@ void plat_early_init(void) default_cpu_clock = 533; break; default: - fprintf(stderr, "could not recognize SoC, bailing out.\n"); - exit(1); + printf("could not recognize SoC, running in dummy mode.\n"); + break; } } @@ -147,12 +123,14 @@ void plat_init(void) { case SOCID_MMSP2: mmsp2_init(); + menu_plat_setup(0); break; case SOCID_POLLUX: pollux_init(); menu_plat_setup(1); break; default: + dummy_init(); break; } @@ -160,6 +138,9 @@ void plat_init(void) gp2x_memset_all_buffers(0, 0, 320*240*2); + // use buffer2 for menubg to save mem (using only buffers 0, 1 in menu) + g_menubg_ptr = gp2x_screens[2]; + // snd sndout_oss_init(); } @@ -179,6 +160,9 @@ void plat_finish(void) case SOCID_POLLUX: pollux_finish(); break; + default: + dummy_finish(); + break; } sndout_oss_exit();