X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fplat.c;h=aa60412328872e237b8da70d6418d306cd9e8b51;hb=0aa509f90d056abafd8a9114f11a9ae3df0bfefb;hp=4ae956c4457331a89d9ee68fd10605b7e69e5d53;hpb=fa5e045bdc817112c1abf19e65e2d3481d51c48a;p=libpicofe.git diff --git a/gp2x/plat.c b/gp2x/plat.c index 4ae956c..aa60412 100644 --- a/gp2x/plat.c +++ b/gp2x/plat.c @@ -12,6 +12,8 @@ #include "../common/emu.h" #include "../linux/sndout_oss.h" +#include + /* GP2X local */ int default_cpu_clock; void *gp2x_screens[4]; @@ -76,17 +78,28 @@ void plat_video_menu_enter(int is_rom_loaded) } else { + char buff[256]; + // should really only happen once, on startup.. - readpng(g_screen_ptr, "skin/background.png", READPNG_BG); + emu_make_path(buff, "skin/background.png", sizeof(buff)); + if (readpng(g_screen_ptr, buff, READPNG_BG) < 0) + memset(g_screen_ptr, 0, 320*240*2); } - // copy to buffer2 + // copy to buffer2, switch to black 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) @@ -101,7 +114,24 @@ void plat_video_menu_end(void) gp2x_video_flip2(); } -void plat_init(void) +void plat_validate_config(void) +{ + gp2x_soc_t soc; + + soc = soc_detect(); + if (soc != SOCID_MMSP2) + PicoOpt &= ~POPT_EXT_FM; + if (soc != SOCID_POLLUX) + currentConfig.EmuOpt &= ~EOPT_WIZ_TEAR_FIX; + + 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; @@ -109,11 +139,9 @@ void plat_init(void) switch (soc) { case SOCID_MMSP2: - mmsp2_init(); default_cpu_clock = 200; break; case SOCID_POLLUX: - pollux_init(); strcpy(cpu_clk_name, "Wiz CPU clock"); default_cpu_clock = 533; break; @@ -121,6 +149,25 @@ void plat_init(void) fprintf(stderr, "could not recognize SoC, bailing out.\n"); exit(1); } +} + +void plat_init(void) +{ + gp2x_soc_t soc; + + soc = soc_detect(); + switch (soc) + { + case SOCID_MMSP2: + mmsp2_init(); + break; + case SOCID_POLLUX: + pollux_init(); + menu_plat_setup(1); + break; + default: + break; + } warm_init(); @@ -147,7 +194,6 @@ void plat_finish(void) break; } - gp2x_video_changemode(16); sndout_oss_exit(); }