X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgizmondo%2Fmenu.c;h=50de347e833c085f537612f385bc973d7b0e9ab7;hb=ca482e5de8bacb70db55f43afe02f93fe6fe3f16;hp=9e1994ddbe2c9c615c09ba38591d55411e22103a;hpb=385760631f8c75fff0882f8764dbcca9c898e896;p=picodrive.git diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index 9e1994d..50de347 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -14,6 +14,9 @@ #include // for opendir #include +#include "kgsdk/Framework.h" +#include "kgsdk/Framework2D.h" + #include "giz.h" #include "emu.h" #include "menu.h" @@ -22,8 +25,6 @@ #include "../common/emu.h" #include "../common/readpng.h" #include "version.h" -#include "kgsdk/Framework.h" -#include "kgsdk/Framework2D.h" #include #include @@ -31,7 +32,7 @@ #define gizKeyUnkn "???" -static const char * const gizKeyNames[] = { +const char * const keyNames[] = { "LEFT", "RIGHT", "UP", "DOWN", "STOP", "PLAY", "FORWARD", "REWIND", "L", "R", "HOME", "VOLUME", "BRIGHTNESS", "ALARM", "POWER", gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, gizKeyUnkn, @@ -41,12 +42,12 @@ static const char * const gizKeyNames[] = { static unsigned char *bg_buffer = gfx_buffer + 321*240*2; unsigned char *menu_screen = gfx_buffer; /* draw here and blit later, to avoid flicker */ -static void menu_darken_bg(void *dst, const void *src, int pixels, int darker); +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 unsigned long wait_for_input(unsigned int interesting) +unsigned long wait_for_input(unsigned int interesting) { unsigned long ret; static int repeats = 0, wait = 20; @@ -70,7 +71,7 @@ static unsigned long wait_for_input(unsigned int interesting) repeats = 0; wait = 20; } - if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT))) + if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT|BTN_L|BTN_R))) wait = 6; inp_prev = ret; @@ -84,25 +85,25 @@ static unsigned long wait_for_input(unsigned int interesting) } -static void menu_draw_begin(int use_bgbuff) +void menu_draw_begin(int use_bgbuff) { if (use_bgbuff) memcpy32((int *)menu_screen, (int *)bg_buffer, 321*240*2/4); } -static void menu_draw_end(void) +void menu_draw_end(void) { - giz_screen = Framework2D_LockBuffer(0); + giz_screen = fb_lock(0); if (giz_screen == NULL) { - lprintf_al("%s: Framework2D_LockBuffer() returned NULL\n", __FUNCTION__); + lprintf("%s: Framework2D_LockBuffer() returned NULL\n", __FUNCTION__); return; } memcpy32(giz_screen, (int *)menu_screen, 321*240*2/4); - Framework2D_UnlockBuffer(); + fb_unlock(); giz_screen = NULL; - Framework2D_Flip(1); + fb_flip(); } @@ -265,10 +266,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:%i: OOM\n", __FILE__, __LINE__); goto fail; } + if (wdir == NULL) { lprintf("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } namelist = malloc(sizeof(*namelist) * name_alloc); - if (namelist == NULL) { lprintf_al("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } + if (namelist == NULL) { lprintf("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } // try to read first.. len = cstr2wstr(wdir, dir); @@ -313,7 +314,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:%i: OOM\n", __FILE__, __LINE__); goto fail; } + if (tmp == NULL) { lprintf("%s:%i: OOM\n", __FILE__, __LINE__); goto fail; } namelist = tmp; } @@ -438,36 +439,6 @@ static char *romsel_loop(char *curr_path) } #endif -// ------------ debug menu ------------ - -char *debugString(void); - -static void draw_debug(void) -{ - char *p, *str = debugString(); - int len, line; - - menu_draw_begin(1); - - p = str; - for (line = 0; line < 24; line++) - { - while (*p && *p != '\n') p++; - len = p - str; - if (len > 55) len = 55; - smalltext_out16_lim(1, line*10, str, 0xffff, len); - if (*p == 0) break; - p++; str = p; - } - menu_draw_end(); -} - -static void debug_menu_loop(void) -{ - draw_debug(); - wait_for_input(BTN_PLAY|BTN_STOP); -} - // ------------ patch/gg menu ------------ static void draw_patchlist(int sel) @@ -578,7 +549,7 @@ static void draw_savestate_bg(int slot) areaClose(file); } - emu_forcedFrame(); + emu_forcedFrame(POPT_EN_SOFTSCALE); menu_prepare_bg(1); memcpy(Pico.vram, tmp_vram, sizeof(Pico.vram)); @@ -661,8 +632,8 @@ static char *action_binds(int player_idx, int action_mask) if (currentConfig.KeyBinds[i] & action_mask) { if (player_idx >= 0 && ((currentConfig.KeyBinds[i] >> 16) & 3) != player_idx) continue; - if (strkeys[0]) { strcat(strkeys, " + "); strcat(strkeys, gizKeyNames[i]); break; } - else strcpy(strkeys, gizKeyNames[i]); + if (strkeys[0]) { strcat(strkeys, " + "); strcat(strkeys, keyNames[i]); break; } + else strcpy(strkeys, keyNames[i]); } } @@ -692,14 +663,14 @@ static int count_bound_keys(int action, int pl_idx) 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; + int x, y, tl_y = 30, i; menu_draw_begin(1); if (player_idx >= 0) { - text_out16(80, 20, "Player %i controls", player_idx + 1); + text_out16(80, 10, "Player %i controls", player_idx + 1); x = 80; } else { - text_out16(80, 20, "Emulator controls"); + text_out16(80, 10, "Emulator controls"); x = 40; } @@ -712,14 +683,14 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_ text_out16(x, y, "Done"); if (sel < opt_cnt) { - text_out16(30, 180, "Press a button to bind/unbind"); - text_out16(30, 190, "Use HOME to clear"); - text_out16(30, 200, "To bind UP/DOWN, hold HOME"); - text_out16(30, 210, "Select \"Done\" to exit"); + text_out16(30, 195, "Press a button to bind/unbind"); + text_out16(30, 205, "Use HOME to clear"); + text_out16(30, 215, "To bind UP/DOWN, hold HOME"); + text_out16(30, 225, "Select \"Done\" to exit"); } else { - text_out16(30, 190, "Use Options -> Save cfg"); - text_out16(30, 200, "to save controls"); - text_out16(30, 210, "Press PLAY or STOP to exit"); + text_out16(30, 205, "Use Options -> Save cfg"); + text_out16(30, 215, "to save controls"); + text_out16(30, 225, "Press PLAY or STOP to exit"); } menu_draw_end(); } @@ -761,6 +732,19 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_ } } +menu_entry ctrlopt_entries[] = +{ + { "Player 1", MB_NONE, MA_CTRL_PLAYER1, NULL, 0, 0, 0, 1, 0 }, + { "Player 2", MB_NONE, MA_CTRL_PLAYER2, NULL, 0, 0, 0, 1, 0 }, + { "Emulator controls", MB_NONE, MA_CTRL_EMU, NULL, 0, 0, 0, 1, 0 }, + { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 }, + { "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, ¤tConfig.turbo_rate, 0, 1, 30, 1, 1 }, + { "Done", MB_NONE, MA_CTRL_DONE, NULL, 0, 0, 0, 1, 0 }, +}; + +#define CTRLOPT_ENTRY_COUNT (sizeof(ctrlopt_entries) / sizeof(ctrlopt_entries[0])) +const int ctrlopt_entry_count = CTRLOPT_ENTRY_COUNT; + static void draw_kc_sel(int menu_sel) { int tl_x = 25+40, tl_y = 60, y; @@ -769,10 +753,7 @@ static void draw_kc_sel(int menu_sel) menu_draw_begin(1); menu_draw_selection(tl_x - 16, tl_y + menu_sel*10, 138); - text_out16(tl_x, y, "Player 1"); - text_out16(tl_x, (y+=10), "Player 2"); - text_out16(tl_x, (y+=10), "Emulator controls"); - text_out16(tl_x, (y+=10), "Done"); + me_draw(ctrlopt_entries, ctrlopt_entry_count, tl_x, tl_y, NULL, NULL); menu_draw_end(); } @@ -795,23 +776,27 @@ me_bind_action emuctrl_actions[] = static void kc_sel_loop(void) { - int menu_sel = 3, menu_sel_max = 3; + int menu_sel = 5, menu_sel_max = 5; unsigned long inp = 0; - int is_6button = currentConfig.PicoOpt & 0x020; + menu_id selected_id; while (1) { draw_kc_sel(menu_sel); inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP); + selected_id = me_index2id(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, menu_sel); + if (inp & (BTN_LEFT|BTN_RIGHT)) // multi choise + me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0); if (inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; } 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(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, -1); return; - case 3: if (!rom_loaded) emu_WriteConfig(0); return; + int is_6button = PicoOpt & 0x020; + switch (selected_id) { + case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return; + case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return; + case MA_CTRL_EMU: key_config_loop(emuctrl_actions, + sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]) - 1, -1); return; + case MA_CTRL_DONE: if (!rom_loaded) emu_WriteConfig(0); return; default: return; } } @@ -824,20 +809,21 @@ static void kc_sel_loop(void) menu_entry cdopt_entries[] = { - { NULL, MB_NONE, MA_CDOPT_TESTBIOS_USA, NULL, 0, 0, 0, 1 }, - { NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1 }, - { NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1 }, - { "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1 }, - { "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, ¤tConfig.PicoOpt, 0x0800, 0, 0, 1 }, - { "PCM audio", MB_ONOFF, MA_CDOPT_PCM, ¤tConfig.PicoOpt, 0x0400, 0, 0, 1 }, - { NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1 }, - { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, ¤tConfig.PicoOpt, 0x8000, 0, 0, 1 }, - { "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,¤tConfig.PicoOpt, 0x1000, 0, 0, 1 }, - { "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, ¤tConfig.PicoOpt, 0x2000, 0, 0, 1 }, - { "done", MB_NONE, MA_CDOPT_DONE, NULL, 0, 0, 0, 1 }, + { NULL, MB_NONE, MA_CDOPT_TESTBIOS_USA, NULL, 0, 0, 0, 1, 0 }, + { NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 }, + { NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 }, + { "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 }, + { "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 }, + { "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 }, + { NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 }, + { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 }, + { "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 }, + { "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 }, + { "done", MB_NONE, MA_CDOPT_DONE, NULL, 0, 0, 0, 1, 0 }, }; #define CDOPT_ENTRY_COUNT (sizeof(cdopt_entries) / sizeof(cdopt_entries[0])) +const int cdopt_entry_count = CDOPT_ENTRY_COUNT; struct bios_names_t @@ -898,17 +884,20 @@ static void cd_menu_loop_options(void) char *bios, *p; if (emu_findBios(4, &bios)) { // US - for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; + for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); + if (*p == '/') p++; strncpy(bios_names.us, p, sizeof(bios_names.us)); bios_names.us[sizeof(bios_names.us)-1] = 0; } else strcpy(bios_names.us, "NOT FOUND"); if (emu_findBios(8, &bios)) { // EU - for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; + for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); + if (*p == '/') p++; strncpy(bios_names.eu, p, sizeof(bios_names.eu)); bios_names.eu[sizeof(bios_names.eu)-1] = 0; } else strcpy(bios_names.eu, "NOT FOUND"); if (emu_findBios(1, &bios)) { // JP - for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; + for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); + if (*p == '/') p++; strncpy(bios_names.jp, p, sizeof(bios_names.jp)); bios_names.jp[sizeof(bios_names.jp)-1] = 0; } else strcpy(bios_names.jp, "NOT FOUND"); @@ -973,17 +962,20 @@ 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 }, + { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 }, + { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 }, + { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 }, + { "Double buffering", MB_ONOFF, MA_OPT2_DBLBUFF, ¤tConfig.EmuOpt, 0x8000, 0, 0, 1, 1 }, + { "Wait for V-sync (slow)", MB_ONOFF, MA_OPT2_VSYNC, ¤tConfig.EmuOpt, 0x2000, 0, 0, 1, 1 }, + { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x0008, 0, 0, 1, 1 }, + { "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x0020, 0, 0, 1, 1 }, + { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 }, + { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 }, + { "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 }, }; #define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0])) +const int opt2_entry_count = OPT2_ENTRY_COUNT; static void draw_amenu_options(int menu_sel) @@ -1042,28 +1034,27 @@ static void amenu_loop_options(void) menu_entry opt_entries[] = { - { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 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, 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, 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, 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 }, - { "[advanced options]", MB_NONE, MA_OPT_ADV_OPTS, NULL, 0, 0, 0, 1 }, - { NULL, MB_NONE, MA_OPT_SAVECFG, NULL, 0, 0, 0, 1 }, - { "Save cfg for current game only",MB_NONE,MA_OPT_SAVECFG_GAME,NULL, 0, 0, 0, 1 }, - { NULL, MB_NONE, MA_OPT_LOADCFG, NULL, 0, 0, 0, 1 }, + { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, + { "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 }, + { "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, ¤tConfig.EmuOpt, 0x4000, 0, 0, 1, 1 }, + { "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, ¤tConfig.scaling, 0x0001, 0, 3, 1, 1 }, + { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1, 1 }, + { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 }, + { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, ¤tConfig.EmuOpt, 0x0004, 0, 0, 1, 1 }, + { NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 }, + { NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1, 1 }, + { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, ¤tConfig.EmuOpt, 0x0001, 0, 0, 1, 1 }, + { NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1, 1 }, + { "Save slot", MB_RANGE, MA_OPT_SAVE_SLOT, &state_slot, 0, 0, 9, 1, 1 }, + { "[Sega/Mega CD options]", MB_NONE, MA_OPT_SCD_OPTS, NULL, 0, 0, 0, 1, 0 }, + { "[advanced options]", MB_NONE, MA_OPT_ADV_OPTS, NULL, 0, 0, 0, 1, 0 }, + { NULL, MB_NONE, MA_OPT_SAVECFG, NULL, 0, 0, 0, 1, 0 }, + { "Save cfg for current game only",MB_NONE,MA_OPT_SAVECFG_GAME,NULL, 0, 0, 0, 1, 0 }, + { NULL, MB_NONE, MA_OPT_LOADCFG, NULL, 0, 0, 0, 1, 0 }, }; #define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0])) +const int opt_entry_count = OPT_ENTRY_COUNT; static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *param) @@ -1073,7 +1064,7 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para switch (entry->id) { case MA_OPT_RENDERER: - if (currentConfig.PicoOpt&0x10) + if (PicoOpt&0x10) str = " 8bit fast"; else if (currentConfig.EmuOpt&0x80) str = "16bit accurate"; @@ -1088,8 +1079,8 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para text_out16(x, y, "Frameskip %s", str24); break; case MA_OPT_SOUND_QUALITY: - str = (currentConfig.PicoOpt&0x08)?"stereo":"mono"; - text_out16(x, y, "Sound Quality: %5iHz %s", currentConfig.PsndRate, str); + str = (PicoOpt&0x08)?"stereo":"mono"; + text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str); break; case MA_OPT_REGION: text_out16(x, y, "Region: %s", me_region_name(PicoRegionOverride, PicoAutoRgnOrder)); @@ -1171,8 +1162,6 @@ static void region_prevnext(int right) static void menu_options_save(void) { - PicoOpt = currentConfig.PicoOpt; - PsndRate = currentConfig.PsndRate; if (PicoRegionOverride) { // force setting possibly changed.. Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0; @@ -1190,9 +1179,6 @@ static int menu_loop_options(void) unsigned long inp = 0; menu_id selected_id; - currentConfig.PicoOpt = PicoOpt; - currentConfig.PsndRate = PsndRate; - 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; @@ -1210,30 +1196,30 @@ static int menu_loop_options(void) switch (selected_id) { case MA_OPT_RENDERER: if (inp & BTN_LEFT) { - if ((currentConfig.PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) { - currentConfig.PicoOpt&= ~0x10; + if ((PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) { + PicoOpt&= ~0x10; currentConfig.EmuOpt |= 0x80; } } else { - if (!(currentConfig.PicoOpt&0x10) || (currentConfig.EmuOpt &0x80)) { - currentConfig.PicoOpt|= 0x10; + if (!(PicoOpt&0x10) || (currentConfig.EmuOpt &0x80)) { + PicoOpt|= 0x10; currentConfig.EmuOpt &= ~0x80; } } break; case MA_OPT_SOUND_QUALITY: - if ((inp & BTN_RIGHT) && currentConfig.PsndRate == 44100 && - !(currentConfig.PicoOpt&0x08)) + if ((inp & BTN_RIGHT) && PsndRate == 44100 && + !(PicoOpt&0x08)) { - currentConfig.PsndRate = 11025; - currentConfig.PicoOpt |= 8; - } else if ((inp & BTN_LEFT) && currentConfig.PsndRate == 11025 && - (currentConfig.PicoOpt&0x08) && !(PicoAHW&1)) + PsndRate = 11025; + PicoOpt |= 8; + } else if ((inp & BTN_LEFT) && PsndRate == 11025 && + (PicoOpt&0x08) && !(PicoAHW&1)) { - currentConfig.PsndRate = 44100; - currentConfig.PicoOpt &= ~8; + PsndRate = 44100; + PicoOpt &= ~8; } else - currentConfig.PsndRate = sndrate_prevnext(currentConfig.PsndRate, inp & BTN_RIGHT); + PsndRate = sndrate_prevnext(PsndRate, inp & BTN_RIGHT); break; case MA_OPT_REGION: region_prevnext(inp & BTN_RIGHT); @@ -1315,7 +1301,7 @@ 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-2008"); @@ -1326,14 +1312,16 @@ static void draw_menu_credits(void) 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(); } @@ -1342,16 +1330,16 @@ static void draw_menu_credits(void) menu_entry main_entries[] = { - { "Resume game", MB_NONE, MA_MAIN_RESUME_GAME, NULL, 0, 0, 0, 0 }, - { "Save State", MB_NONE, MA_MAIN_SAVE_STATE, NULL, 0, 0, 0, 0 }, - { "Load State", MB_NONE, MA_MAIN_LOAD_STATE, NULL, 0, 0, 0, 0 }, - { "Reset game", MB_NONE, MA_MAIN_RESET_GAME, NULL, 0, 0, 0, 0 }, - { "Load new ROM/ISO", MB_NONE, MA_MAIN_LOAD_ROM, NULL, 0, 0, 0, 1 }, - { "Change options", MB_NONE, MA_MAIN_OPTIONS, NULL, 0, 0, 0, 1 }, - { "Configure controls", MB_NONE, MA_MAIN_CONTROLS, NULL, 0, 0, 0, 1 }, - { "Credits", MB_NONE, MA_MAIN_CREDITS, NULL, 0, 0, 0, 1 }, - { "Patches / GameGenie",MB_NONE, MA_MAIN_PATCHES, NULL, 0, 0, 0, 0 }, - { "Exit", MB_NONE, MA_MAIN_EXIT, NULL, 0, 0, 0, 1 } + { "Resume game", MB_NONE, MA_MAIN_RESUME_GAME, NULL, 0, 0, 0, 0, 0 }, + { "Save State", MB_NONE, MA_MAIN_SAVE_STATE, NULL, 0, 0, 0, 0, 0 }, + { "Load State", MB_NONE, MA_MAIN_LOAD_STATE, NULL, 0, 0, 0, 0, 0 }, + { "Reset game", MB_NONE, MA_MAIN_RESET_GAME, NULL, 0, 0, 0, 0, 0 }, + { "Load new ROM/ISO", MB_NONE, MA_MAIN_LOAD_ROM, NULL, 0, 0, 0, 1, 0 }, + { "Change options", MB_NONE, MA_MAIN_OPTIONS, NULL, 0, 0, 0, 1, 0 }, + { "Configure controls", MB_NONE, MA_MAIN_CONTROLS, NULL, 0, 0, 0, 1, 0 }, + { "Credits", MB_NONE, MA_MAIN_CREDITS, NULL, 0, 0, 0, 1, 0 }, + { "Patches / GameGenie",MB_NONE, MA_MAIN_PATCHES, NULL, 0, 0, 0, 0, 0 }, + { "Exit", MB_NONE, MA_MAIN_EXIT, NULL, 0, 0, 0, 1, 0 } }; #define MAIN_ENTRY_COUNT (sizeof(main_entries) / sizeof(main_entries[0])) @@ -1450,10 +1438,10 @@ static void menu_loop_root(void) { char curr_path[MAX_PATH], *selfname; FILE *tstf; - if ( (tstf = fopen(currentConfig.lastRomFile, "rb")) ) + if ( (tstf = fopen(loadedRomFName, "rb")) ) { fclose(tstf); - strcpy(curr_path, currentConfig.lastRomFile); + strcpy(curr_path, loadedRomFName); } else getcwd(curr_path, MAX_PATH); @@ -1500,7 +1488,7 @@ static void menu_loop_root(void) } // warning: alignment -static void menu_darken_bg(void *dst, const void *src, int pixels, int darker) +void menu_darken_bg(void *dst, const void *src, int pixels, int darker) { unsigned int *dest = dst; const unsigned int *srce = src; @@ -1529,11 +1517,11 @@ static void menu_prepare_bg(int use_game_bg) { // darken the active framebuffer if (giz_screen == NULL) - giz_screen = Framework2D_LockBuffer(1); + giz_screen = fb_lock(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); - Framework2D_UnlockBuffer(); + fb_unlock(); giz_screen = NULL; } else @@ -1598,10 +1586,10 @@ int menu_loop_tray(void) menu_gfx_prepare(); - if ( (tstf = fopen(currentConfig.lastRomFile, "rb")) ) + if ( (tstf = fopen(loadedRomFName, "rb")) ) { fclose(tstf); - strcpy(curr_path, currentConfig.lastRomFile); + strcpy(curr_path, loadedRomFName); } else { @@ -1625,7 +1613,7 @@ int menu_loop_tray(void) if (selfname) { int ret = -1; cd_img_type cd_type; - cd_type = emu_cdCheck(NULL); + cd_type = emu_cdCheck(NULL, romFileName); if (cd_type != CIT_NOT_CD) ret = Insert_CD(romFileName, cd_type); if (ret != 0) {