X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgizmondo%2Fmenu.c;h=6e501a89785acf5743b2bef9f6c775183ad55431;hb=9d917eea21607c7c239d4b0cd850d660c0c8e4c5;hp=1662da189bd50cd6d5ed3cd615f5fa52d7f00ce9;hpb=fa283c9a387276360ffb881f2125cbdb7adfa382;p=picodrive.git diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index 1662da1..6e501a8 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -45,7 +45,6 @@ static void menu_darken_bg(void *dst, const void *src, int pixels, int darker); static void menu_prepare_bg(int use_game_bg); static unsigned int inp_prev = 0; -static int inp_prevjoy = 0; static unsigned long wait_for_input(unsigned int interesting) { @@ -71,7 +70,6 @@ static unsigned long wait_for_input(unsigned int interesting) wait = 50; } inp_prev = ret; - inp_prevjoy = 0; // we don't need diagonals in menus if ((ret&BTN_UP) && (ret&BTN_LEFT)) ret &= ~BTN_LEFT; @@ -92,8 +90,7 @@ static void menu_draw_begin(int use_bgbuff) static void menu_draw_end(void) { - Framework2D_WaitVSync(); - giz_screen = Framework2D_LockBuffer(); + giz_screen = Framework2D_LockBuffer(0); if (giz_screen == NULL) { lprintf_al("%s: Framework2D_LockBuffer() returned NULL\n", __FUNCTION__); @@ -102,6 +99,7 @@ static void menu_draw_end(void) memcpy32(giz_screen, (int *)menu_screen, 321*240*2/4); Framework2D_UnlockBuffer(); giz_screen = NULL; + Framework2D_Flip(1); } @@ -264,10 +262,10 @@ static int my_scandir(const char *dir, struct my_dirent ***namelist_out, BOOL bRet; wdir = malloc(sizeof(wdir[0]) * MAX_PATH); - if (wdir == NULL) { lprintf_al("%s:%s: OOM\n", __FILE__, __LINE__); goto fail; } + if (wdir == NULL) { lprintf_al("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } namelist = malloc(sizeof(*namelist) * name_alloc); - if (namelist == NULL) { lprintf_al("%s:%s: OOM\n", __FILE__, __LINE__); goto fail; } + if (namelist == NULL) { lprintf_al("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } // try to read first.. len = cstr2wstr(wdir, dir); @@ -312,7 +310,7 @@ static int my_scandir(const char *dir, struct my_dirent ***namelist_out, void *tmp; name_alloc *= 2; tmp = realloc(namelist, sizeof(*namelist) * name_alloc); - if (tmp == NULL) { lprintf_al("%s:%s: OOM\n", __FILE__, __LINE__); goto fail; } + if (tmp == NULL) { lprintf_al("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } namelist = tmp; } @@ -635,6 +633,7 @@ static int savestate_menu_loop(int is_loading) if(inp & BTN_PLAY) { // save/load if (menu_sel < 10) { state_slot = menu_sel; + PicoStateProgressCB = emu_stateCb; /* also suitable for menu */ if (emu_SaveLoadGame(is_loading, 0)) { strcpy(menuErrorMsg, is_loading ? "Load failed" : "Save failed"); return 1; @@ -991,6 +990,8 @@ menu_entry opt2_entries[] = { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, ¤tConfig.PicoOpt,0x0004, 0, 0, 1 }, { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, ¤tConfig.PicoOpt,0x0001, 0, 0, 1 }, { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,¤tConfig.PicoOpt,0x0002, 0, 0, 1 }, + { "Double buffering", MB_ONOFF, MA_OPT2_DBLBUFF, ¤tConfig.EmuOpt, 0x8000, 0, 0, 1 }, + { "Wait for V-sync (slow)", MB_ONOFF, MA_OPT2_VSYNC, ¤tConfig.EmuOpt, 0x2000, 0, 0, 1 }, { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x0008, 0, 0, 1 }, { "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x0020, 0, 0, 1 }, { "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1 }, @@ -1056,16 +1057,17 @@ static void amenu_loop_options(void) menu_entry opt_entries[] = { { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1 }, - { "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, ¤tConfig.scaling, 0x001, 0, 3, 1 }, - { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, ¤tConfig.PicoOpt, 0x040, 0, 0, 1 }, - { "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, ¤tConfig.PicoOpt, 0x080, 0, 0, 1 }, - { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x002, 0, 0, 1 }, + { "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, ¤tConfig.EmuOpt, 0x4000, 0, 0, 1 }, + { "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, ¤tConfig.scaling, 0x0001, 0, 3, 1 }, + { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, ¤tConfig.PicoOpt, 0x0040, 0, 0, 1 }, + { "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, ¤tConfig.PicoOpt, 0x0080, 0, 0, 1 }, + { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1 }, - { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, ¤tConfig.EmuOpt, 0x004, 0, 0, 1 }, + { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, ¤tConfig.EmuOpt, 0x0004, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1 }, - { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, ¤tConfig.PicoOpt, 0x020, 0, 0, 1 }, + { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, ¤tConfig.PicoOpt, 0x0020, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1 }, - { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, ¤tConfig.EmuOpt, 0x001, 0, 0, 1 }, + { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, ¤tConfig.EmuOpt, 0x0001, 0, 0, 1 }, { NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1 }, { "Save slot", MB_RANGE, MA_OPT_SAVE_SLOT, &state_slot, 0, 0, 9, 1 }, { "[Sega/Mega CD options]", MB_NONE, MA_OPT_SCD_OPTS, NULL, 0, 0, 0, 1 }, @@ -1175,7 +1177,7 @@ static int sndrate_prevnext(int rate, int dir) if (rates[i] == rate) break; i += dir ? 1 : -1; - if (i > 4) return dir ? 44100 : 22050; + if (i > 2) return dir ? 44100 : 22050; if (i < 0) return dir ? 22050 : 11025; return rates[i]; } @@ -1243,21 +1245,30 @@ static int menu_loop_options(void) switch (selected_id) { case MA_OPT_RENDERER: if (inp & BTN_LEFT) { - if ( currentConfig.PicoOpt&0x10) currentConfig.PicoOpt&= ~0x10; - else if (!(currentConfig.EmuOpt &0x80))currentConfig.EmuOpt |= 0x80; - else if ( currentConfig.EmuOpt &0x80) break; + if ((currentConfig.PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) { + currentConfig.PicoOpt&= ~0x10; + currentConfig.EmuOpt |= 0x80; + } } else { - if ( currentConfig.PicoOpt&0x10) break; - else if (!(currentConfig.EmuOpt &0x80))currentConfig.PicoOpt|= 0x10; - else if ( currentConfig.EmuOpt &0x80) currentConfig.EmuOpt &= ~0x80; + if (!(currentConfig.PicoOpt&0x10) || (currentConfig.EmuOpt &0x80)) { + currentConfig.PicoOpt|= 0x10; + currentConfig.EmuOpt &= ~0x80; + } } break; case MA_OPT_SOUND_QUALITY: - if ((inp & BTN_RIGHT) && currentConfig.PsndRate == 44100 && !(currentConfig.PicoOpt&0x08)) { - currentConfig.PsndRate = 11025; currentConfig.PicoOpt|= 0x08; - } else if ((inp & BTN_LEFT) && currentConfig.PsndRate == 11025 && (currentConfig.PicoOpt&0x08)) { - currentConfig.PsndRate = 44100; currentConfig.PicoOpt&=~0x08; - } else currentConfig.PsndRate = sndrate_prevnext(currentConfig.PsndRate, inp & BTN_RIGHT); + if ((inp & BTN_RIGHT) && currentConfig.PsndRate == 44100 && + !(currentConfig.PicoOpt&0x08)) + { + currentConfig.PsndRate = 11025; + currentConfig.PicoOpt |= 8; + } else if ((inp & BTN_LEFT) && currentConfig.PsndRate == 11025 && + (currentConfig.PicoOpt&0x08) && !(PicoMCD&1)) + { + currentConfig.PsndRate = 44100; + currentConfig.PicoOpt &= ~8; + } else + currentConfig.PsndRate = sndrate_prevnext(currentConfig.PsndRate, inp & BTN_RIGHT); break; case MA_OPT_REGION: region_prevnext(inp & BTN_RIGHT); @@ -1343,7 +1354,7 @@ static void draw_menu_credits(void) menu_draw_begin(1); text_out16(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007"); -text_out16(tl_x, 30, "beta1"); + y = tl_y; text_out16(tl_x, y, "Credits:"); text_out16(tl_x, (y+=10), "Dave: Cyclone 68000 core,"); @@ -1551,7 +1562,7 @@ static void menu_prepare_bg(int use_game_bg) { // darken the active framebuffer if (giz_screen == NULL) - giz_screen = Framework2D_LockBuffer(); + giz_screen = Framework2D_LockBuffer(1); memset(bg_buffer, 0, 321*8*2); menu_darken_bg(bg_buffer + 321*8*2, (char *)giz_screen + 321*8*2, 321*224, 1); memset(bg_buffer + 321*232*2, 0, 321*8*2);