X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgizmondo%2Fmenu.c;h=52a5edb4b59e7a45b7008e142fd1e105b52d7c80;hb=2aa27095f2dbf5b38950fcb1f856d5ffc6a70361;hp=b062ffdc85ff78a54ad0df13feba09a399263d5d;hpb=f3d1de29dacce5e79cc644ce05064da9bc44af62;p=picodrive.git diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index b062ffd..52a5edb 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -45,20 +45,20 @@ 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) { - unsigned int ret; - static int repeats = 0, wait = 50; + unsigned long ret; + static int repeats = 0, wait = 20; int release = 0, i; - if (repeats == 2 || repeats == 4) wait /= 2; - if (repeats == 6) wait = 15; + if (repeats == 2) wait = 3; + else if (repeats == 4) wait = 2; + else if (repeats == 6) wait = 1; - for (i = 0; i < 6 && inp_prev == Framework_PollGetButtons(); i++) { + for (i = 0; i < wait && inp_prev == Framework_PollGetButtons(); i++) { if (i == 0) repeats++; - Sleep(wait); + Sleep(30); } while ( !((ret = Framework_PollGetButtons()) & interesting) ) { @@ -68,10 +68,11 @@ static unsigned long wait_for_input(unsigned int interesting) if (release || ret != inp_prev) { repeats = 0; - wait = 50; + wait = 20; } + if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT|BTN_L|BTN_R))) + wait = 6; 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 +93,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 +102,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); } @@ -126,7 +127,7 @@ void menu_romload_prepare(const char *rom_name) const char *p = rom_name + strlen(rom_name); while (p > rom_name && *p != '/') p--; - if (rom_data == NULL) + if (!rom_loaded) memset(menu_screen, 0, 321*240*2); menu_draw_begin(1); @@ -160,7 +161,7 @@ struct my_dirent static unsigned short file2color(const char *fname) { const char *ext = fname + strlen(fname) - 3; - static const char *rom_exts[] = { "zip", "bin", "smd", "gen", "iso" }; + static const char *rom_exts[] = { "zip", "bin", "smd", "gen", "iso", "cso" }; static const char *other_exts[] = { "gmv", "pat" }; int i; @@ -181,7 +182,7 @@ static void draw_dirlist(char *curdir, struct my_dirent **namelist, int n, int s menu_draw_begin(1); - if (rom_data == NULL) { + if (!rom_loaded) { menu_darken_bg(menu_screen, menu_screen, 321*240, 0); } @@ -264,10 +265,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 +313,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; } @@ -563,7 +564,7 @@ static void draw_savestate_bg(int slot) } if (file) { - if (PicoMCD & 1) { + if (PicoAHW & 1) { PicoCdLoadStateGfx(file); } else { areaSeek(file, 0x10020, SEEK_SET); // skip header and RAM in state file @@ -635,6 +636,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; @@ -688,9 +690,7 @@ static int count_bound_keys(int action, int pl_idx) return keys; } -typedef struct { char *name; int mask; } bind_action_t; - -static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_idx, int sel) +static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_idx, int sel) { int x, y, tl_y = 40, i; @@ -724,7 +724,7 @@ static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_i menu_draw_end(); } -static void key_config_loop(const bind_action_t *opts, int opt_cnt, int player_idx) +static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx) { int sel = 0, menu_sel_max = opt_cnt, prev_select = 0, i; unsigned long inp = 0; @@ -778,27 +778,10 @@ static void draw_kc_sel(int menu_sel) } -// PicoPad[] format: MXYZ SACB RLDU -static bind_action_t ctrl_actions[] = -{ - { "UP ", 0x001 }, - { "DOWN ", 0x002 }, - { "LEFT ", 0x004 }, - { "RIGHT ", 0x008 }, - { "A ", 0x040 }, - { "B ", 0x010 }, - { "C ", 0x020 }, - { "START ", 0x080 }, - { "MODE ", 0x800 }, - { "X ", 0x400 }, - { "Y ", 0x200 }, - { "Z ", 0x100 }, -}; - // player2_flag, ?, ?, ?, ?, ?, ?, menu // "NEXT SAVE SLOT", "PREV SAVE SLOT", "SWITCH RENDERER", "SAVE STATE", // "LOAD STATE", "VOLUME UP", "VOLUME DOWN", "DONE" -static bind_action_t emuctrl_actions[] = +me_bind_action emuctrl_actions[] = { { "Load State ", 1<<28 }, { "Save State ", 1<<27 }, @@ -807,6 +790,7 @@ static bind_action_t emuctrl_actions[] = { "Switch Renderer", 1<<26 }, { "Volume Down ", 1<<30 }, { "Volume Up ", 1<<29 }, + { NULL, 0 } }; static void kc_sel_loop(void) @@ -823,11 +807,11 @@ static void kc_sel_loop(void) if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; } if (inp & BTN_PLAY) { switch (menu_sel) { - case 0: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 0); return; - case 1: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 1); return; + case 0: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 0); return; + case 1: key_config_loop(me_ctrl_actions, is_6button ? 12 : 8, 1); return; case 2: key_config_loop(emuctrl_actions, - sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]), -1); return; - case 3: if (rom_data == NULL) emu_WriteConfig(0); return; + sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return; + case 3: if (!rom_loaded) emu_WriteConfig(0); return; default: return; } } @@ -940,9 +924,9 @@ static void cd_menu_loop_options(void) selected_id == MA_CDOPT_READAHEAD) { if (inp & BTN_LEFT) { PicoCDBuffers >>= 1; - if (PicoCDBuffers < 64) PicoCDBuffers = 0; + if (PicoCDBuffers < 2) PicoCDBuffers = 0; } else { - if (PicoCDBuffers < 64) PicoCDBuffers = 64; + if (PicoCDBuffers < 2) PicoCDBuffers = 2; else PicoCDBuffers <<= 1; if (PicoCDBuffers > 8*1024) PicoCDBuffers = 8*1024; // 16M } @@ -988,9 +972,12 @@ static void cd_menu_loop_options(void) menu_entry opt2_entries[] = { + { "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 }, { "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 +1043,16 @@ 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 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 }, @@ -1078,29 +1065,6 @@ menu_entry opt_entries[] = #define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0])) -static const char *region_name(unsigned int code) -{ - static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" }; - static const char *names_short[] = { "", " JP", " JP", " US", " EU" }; - int u, i = 0; - if (code) { - code <<= 1; - while((code >>= 1)) i++; - if (i > 4) return "unknown"; - return names[i]; - } else { - static char name[24]; - strcpy(name, "Auto:"); - for (u = 0; u < 3; u++) { - i = 0; code = ((PicoAutoRgnOrder >> u*4) & 0xf) << 1; - while((code >>= 1)) i++; - strcat(name, names_short[i]); - } - return name; - } -} - - static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *param) { char *str, str24[24]; @@ -1127,7 +1091,7 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para text_out16(x, y, "Sound Quality: %5iHz %s", currentConfig.PsndRate, str); break; case MA_OPT_REGION: - text_out16(x, y, "Region: %s", region_name(currentConfig.PicoRegion)); + text_out16(x, y, "Region: %s", me_region_name(PicoRegionOverride, PicoAutoRgnOrder)); break; case MA_OPT_CONFIRM_STATES: switch ((currentConfig.EmuOpt >> 9) & 5) { @@ -1186,21 +1150,21 @@ static void region_prevnext(int right) static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 }; int i; if (right) { - if (!currentConfig.PicoRegion) { + if (!PicoRegionOverride) { for (i = 0; i < 6; i++) if (rgn_orders[i] == PicoAutoRgnOrder) break; if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1]; - else currentConfig.PicoRegion=1; + else PicoRegionOverride=1; } - else currentConfig.PicoRegion<<=1; - if (currentConfig.PicoRegion > 8) currentConfig.PicoRegion = 8; + else PicoRegionOverride<<=1; + if (PicoRegionOverride > 8) PicoRegionOverride = 8; } else { - if (!currentConfig.PicoRegion) { + if (!PicoRegionOverride) { for (i = 0; i < 6; i++) if (rgn_orders[i] == PicoAutoRgnOrder) break; if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1]; } - else currentConfig.PicoRegion>>=1; + else PicoRegionOverride>>=1; } } @@ -1208,7 +1172,10 @@ static void menu_options_save(void) { PicoOpt = currentConfig.PicoOpt; PsndRate = currentConfig.PsndRate; - PicoRegionOverride = currentConfig.PicoRegion; + if (PicoRegionOverride) { + // force setting possibly changed.. + Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0; + } if (!(PicoOpt & 0x20)) { // unbind XYZ MODE, just in case unbind_action(0xf00); @@ -1224,9 +1191,8 @@ static int menu_loop_options(void) currentConfig.PicoOpt = PicoOpt; currentConfig.PsndRate = PsndRate; - currentConfig.PicoRegion = PicoRegionOverride; - me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_SAVECFG_GAME, rom_data != NULL); + me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_SAVECFG_GAME, rom_loaded); me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_LOADCFG, config_slot != config_slot_current); menu_sel_max = me_count_enabled(opt_entries, OPT_ENTRY_COUNT) - 1; if (menu_sel > menu_sel_max) menu_sel = menu_sel_max; @@ -1243,21 +1209,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) && !(PicoAHW&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); @@ -1339,25 +1314,27 @@ static int menu_loop_options(void) static void draw_menu_credits(void) { - int tl_x = 15, tl_y = 64, y; + int tl_x = 15, tl_y = 56, y; menu_draw_begin(1); - text_out16(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006,2007"); -text_out16(tl_x, 30, "beta1"); + text_out16(tl_x, 20, "PicoDrive v" VERSION " (c) notaz, 2006-2008"); + y = tl_y; text_out16(tl_x, y, "Credits:"); - text_out16(tl_x, (y+=10), "Dave: Cyclone 68000 core,"); + text_out16(tl_x, (y+=10), "fDave: Cyclone 68000 core,"); text_out16(tl_x, (y+=10), " base code of PicoDrive"); text_out16(tl_x, (y+=10), "Reesy & FluBBa: DrZ80 core"); text_out16(tl_x, (y+=10), "MAME devs: YM2612 and SN76496 cores"); - text_out16(tl_x, (y+=10), "Charles MacDonald: Genesis hw docs"); - text_out16(tl_x, (y+=10), "Stephane Dallongeville:"); - text_out16(tl_x, (y+=10), " opensource Gens"); - text_out16(tl_x, (y+=10), "Haze: Genesis hw info"); text_out16(tl_x, (y+=10), "Reesy: kgsdk wrapper, sound code"); text_out16(tl_x, (y+=10), "jens.l: gizmondo hardware"); text_out16(tl_x, (y+=10), "ketchupgun: skin design"); + text_out16(tl_x, (y+=20), "special thanks (for docs, ideas)"); + text_out16(tl_x, (y+=10), " Charles MacDonald, Haze,"); + text_out16(tl_x, (y+=10), " Stephane Dallongeville,"); + text_out16(tl_x, (y+=10), " Lordus, Exophase, Rokas,"); + text_out16(tl_x, (y+=10), " Nemesis, Tasco Deluxe"); + menu_draw_end(); } @@ -1407,10 +1384,10 @@ static void menu_loop_root(void) int ret, menu_sel_max; unsigned long inp = 0; - me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESUME_GAME, rom_data != NULL); - me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_SAVE_STATE, rom_data != NULL); - me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_LOAD_STATE, rom_data != NULL); - me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESET_GAME, rom_data != NULL); + me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESUME_GAME, rom_loaded); + me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_SAVE_STATE, rom_loaded); + me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_LOAD_STATE, rom_loaded); + me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESET_GAME, rom_loaded); me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_PATCHES, PicoPatches != NULL); menu_sel_max = me_count_enabled(main_entries, MAIN_ENTRY_COUNT) - 1; @@ -1429,7 +1406,7 @@ static void menu_loop_root(void) if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; } if((inp & (BTN_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop(); if( inp & (BTN_HOME|BTN_STOP)) { - if (rom_data) { + if (rom_loaded) { while (Framework_PollGetButtons() & (BTN_HOME|BTN_STOP)) Sleep(50); // wait until released engineState = PGS_Running; break; @@ -1439,14 +1416,14 @@ static void menu_loop_root(void) switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel)) { case MA_MAIN_RESUME_GAME: - if (rom_data) { + if (rom_loaded) { while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50); engineState = PGS_Running; return; } break; case MA_MAIN_SAVE_STATE: - if (rom_data) { + if (rom_loaded) { if(savestate_menu_loop(0)) continue; engineState = PGS_Running; @@ -1454,16 +1431,18 @@ static void menu_loop_root(void) } break; case MA_MAIN_LOAD_STATE: - if (rom_data) { + if (rom_loaded) { if(savestate_menu_loop(1)) continue; + while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50); engineState = PGS_Running; return; } break; case MA_MAIN_RESET_GAME: - if (rom_data) { + if (rom_loaded) { emu_ResetGame(); + while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50); engineState = PGS_Running; return; } @@ -1505,7 +1484,7 @@ static void menu_loop_root(void) engineState = PGS_Quit; return; case MA_MAIN_PATCHES: - if (rom_data && PicoPatches) { + if (rom_loaded && PicoPatches) { patches_menu_loop(); PicoPatchApply(); strcpy(menuErrorMsg, "Patches applied"); @@ -1551,7 +1530,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); @@ -1571,7 +1550,7 @@ static void menu_prepare_bg(int use_game_bg) static void menu_gfx_prepare(void) { - menu_prepare_bg(rom_data != NULL); + menu_prepare_bg(rom_loaded); menu_draw_begin(1); menu_draw_end(); @@ -1645,10 +1624,11 @@ int menu_loop_tray(void) case 0: // select image selfname = romsel_loop(curr_path); if (selfname) { - int ret = -1, cd_type; + int ret = -1; + cd_img_type cd_type; cd_type = emu_cdCheck(NULL); - if (cd_type > 0) - ret = Insert_CD(romFileName, cd_type == 2); + if (cd_type != CIT_NOT_CD) + ret = Insert_CD(romFileName, cd_type); if (ret != 0) { sprintf(menuErrorMsg, "Load failed, invalid CD image?"); lprintf("%s\n", menuErrorMsg);