X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=74e7a6d24ae6704a1dea560ae6bf19de67dd5dff;hb=388947f33d88ce3de0d9cb3e873244fbb5162a59;hp=b4a76cc2ae25ad2ba38f7cba9e5ec5e5d0bb8d5b;hpb=f15ca4db35a3466cc59b796c2a5d8b963721a02c;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index b4a76cc..74e7a6d 100644 --- a/common/menu.c +++ b/common/menu.c @@ -12,11 +12,11 @@ #include "fonts.h" #include "readpng.h" #include "lprintf.h" -#include "common.h" #include "input.h" #include "emu.h" #include "plat.h" #include "posix.h" +#include #include #include @@ -641,6 +641,44 @@ void menu_romload_end(void) plat_video_menu_end(); } +// -------------- del confirm --------------- + +static void do_delete(const char *fpath, const char *fname) +{ + int len, mid, inp; + const char *nm; + char tmp[64]; + + plat_video_menu_begin(); + + if (!rom_loaded) + menu_darken_bg(g_screen_ptr, g_screen_width * g_screen_height, 0); + + len = strlen(fname); + if (len > g_screen_width/6) + len = g_screen_width/6; + + mid = g_screen_width / 2; + text_out16(mid - me_mfont_w * 15 / 2, 8 * me_mfont_h, "About to delete"); + smalltext_out16(mid - len * me_sfont_w / 2, 9 * me_mfont_h + 5, fname, 0xbdff); + text_out16(mid - me_mfont_w * 13 / 2, 11 * me_mfont_h, "Are you sure?"); + + nm = in_get_key_name(-1, -PBTN_MA3); + snprintf(tmp, sizeof(tmp), "(%s - confirm, ", nm); + len = strlen(tmp); + nm = in_get_key_name(-1, -PBTN_MBACK); + snprintf(tmp + len, sizeof(tmp) - len, "%s - cancel)", nm); + len = strlen(tmp); + + text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp); + plat_video_menu_end(); + + while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2)); + inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100); + if (inp & PBTN_MA3) + remove(fpath); +} + // -------------- ROM selector -------------- // rrrr rggg gggb bbbb @@ -788,7 +826,7 @@ rescan: ret = rom_fname_reload; break; } -// do_delete(rom_fname_reload, namelist[sel+1]->d_name); // TODO + do_delete(rom_fname_reload, namelist[sel+1]->d_name); if (n > 0) { while (n--) free(namelist[n]); free(namelist); @@ -1055,7 +1093,7 @@ static char *action_binds(int player_idx, int action_mask, int dev_id) if (binds == NULL) return static_buff; - count = in_get_dev_bind_count(dev_id); + count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT); for (k = 0; k < count; k++) { const char *xname; @@ -1088,7 +1126,7 @@ static int count_bound_keys(int dev_id, int action_mask, int player_idx) if (binds == NULL) return 0; - count = in_get_dev_bind_count(dev_id); + count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT); for (k = 0; k < count; k++) { if (!(binds[k] & action_mask)) @@ -1206,7 +1244,12 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_ for (is_down = 1; is_down; ) kc = in_update_keycode(&dev_id, &is_down, -1); - unbind = count_bound_keys(dev_id, opts[sel].mask, player_idx) >= 2; + i = count_bound_keys(dev_id, opts[sel].mask, player_idx); + unbind = (i > 0); + + /* allow combos if device supports them */ + if (i == 1 && in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS)) + unbind = 0; in_bind_key(dev_id, kc, opts[sel].mask, unbind); if (player_idx >= 0) { @@ -1243,19 +1286,19 @@ me_bind_action me_ctrl_actions[15] = // "LOAD STATE", "VOLUME UP", "VOLUME DOWN", "DONE" me_bind_action emuctrl_actions[] = { - { "Load State ", 1<<28 }, - { "Save State ", 1<<27 }, - { "Prev Save Slot ", 1<<25 }, - { "Next Save Slot ", 1<<24 }, - { "Switch Renderer ", 1<<26 }, - { "Volume Down ", 1<<30 }, - { "Volume Up ", 1<<29 }, - { "Fast forward ", 1<<22 }, - { "Enter Menu ", 1<<23 }, - { "Pico Next page ", 1<<21 }, - { "Pico Prev page ", 1<<20 }, - { "Pico Switch input", 1<<19 }, - { NULL, 0 } + { "Load State ", 1 << PEVB_STATE_LOAD }, + { "Save State ", 1 << PEVB_STATE_SAVE }, + { "Prev Save Slot ", 1 << PEVB_SSLOT_PREV }, + { "Next Save Slot ", 1 << PEVB_SSLOT_NEXT }, + { "Switch Renderer ", 1 << PEVB_SWITCH_RND }, + { "Volume Down ", 1 << PEVB_VOL_DOWN }, + { "Volume Up ", 1 << PEVB_VOL_UP }, + { "Fast forward ", 1 << PEVB_FF }, + { "Enter Menu ", 1 << PEVB_MENU }, + { "Pico Next page ", 1 << 21 }, /* TODO */ + { "Pico Prev page ", 1 << 20 }, + { "Pico Switch input", 1 << 19 }, + { NULL, 0 } }; static int key_config_loop_wrap(menu_id id, int keys) @@ -1373,15 +1416,6 @@ static int menu_loop_cd_options(menu_id id, int keys) // ------------ adv options menu ------------ -// TODO FIXME fix if and mv -static const char *mgn_aopt_sqhack(menu_id id, int *offs) -{ - *offs = -10; - sprintf(static_buff, "%s, %s", 111 ? " active" : "inactive", - (currentConfig.EmuOpt & 0x10) ? "ON" : "OFF"); - return static_buff; -} - static menu_entry e_menu_adv_options[] = { mee_onoff ("SRAM/BRAM saves", MA_OPT_SRAM_STATES, currentConfig.EmuOpt, EOPT_USE_SRAM), @@ -1392,9 +1426,8 @@ static menu_entry e_menu_adv_options[] = mee_onoff ("Emulate SN76496 (PSG)", MA_OPT2_ENABLE_SN76496,PicoOpt, POPT_EN_PSG), mee_onoff ("gzip savestates", MA_OPT2_GZIP_STATES, currentConfig.EmuOpt, EOPT_GZIP_SAVES), mee_onoff ("Don't save last used ROM", MA_OPT2_NO_LAST_ROM, currentConfig.EmuOpt, EOPT_NO_AUTOSVCFG), - mee_label ("- needs restart -"), - mee_onoff ("craigix's RAM timings", MA_OPT2_RAMTIMINGS, currentConfig.EmuOpt, 0x0100), - mee_onoff_cust("Squidgehack", MA_OPT2_SQUIDGEHACK, currentConfig.EmuOpt, 0x0010, mgn_aopt_sqhack), + mee_onoff ("RAM overclock", MA_OPT2_RAMTIMINGS, currentConfig.EmuOpt, EOPT_RAM_TIMINGS), + mee_onoff ("MMU hack", MA_OPT2_SQUIDGEHACK, currentConfig.EmuOpt, EOPT_MMUHACK), mee_onoff ("SVP dynarec", MA_OPT2_SVP_DYNAREC, PicoOpt, POPT_EN_SVP_DRC), mee_onoff ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoOpt, POPT_DIS_IDLE_DET), mee_end, @@ -1411,12 +1444,12 @@ static int menu_loop_adv_options(menu_id id, int keys) static const char *mgn_opt_scaling(menu_id id, int *offs) { - *offs = -12; + *offs = -13; switch (currentConfig.scaling) { - default: return " OFF"; - case 1: return "hw horizontal"; - case 2: return "hw horiz. + vert."; - case 3: return "sw horizontal"; + default: return " OFF"; + case EOPT_SCALE_HW_H: return " hw horizontal"; + case EOPT_SCALE_HW_HV: return "hw horiz. + vert"; + case EOPT_SCALE_SW_H: return " sw horizontal"; } } @@ -1430,8 +1463,8 @@ static menu_entry e_menu_gfx_options[] = { mee_range_cust("Scaling", MA_OPT_SCALING, currentConfig.scaling, 0, 3, mgn_opt_scaling), mee_range_cust("Gamma correction", MA_OPT2_GAMMA, currentConfig.gamma, 1, 300, mgn_aopt_gamma), - mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, 0x1000), - mee_onoff ("Perfect vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, 0x2000), + mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, EOPT_A_SN_GAMMA), + mee_onoff ("Perfect vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_PSYNC), mee_end, }; @@ -1660,11 +1693,7 @@ static menu_entry e_menu_options[] = mee_onoff ("Enable sound", MA_OPT_ENABLE_SOUND, currentConfig.EmuOpt, 0x004), mee_cust ("Sound Quality", MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound), mee_cust ("Confirm savestate", MA_OPT_CONFIRM_STATES,mh_opt_misc, mgn_opt_c_saves), -#if defined(__GP2X__) - mee_range ("GP2X CPU clocks", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 400), -#elif defined(PSP) - mee_range ("PSP CPU clock", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, ) -#endif + mee_range (cpu_clk_name, MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 900), mee_handler ("[Display options]", menu_loop_gfx_options), mee_handler ("[Advanced options]", menu_loop_adv_options), mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options), @@ -1748,6 +1777,7 @@ static void draw_frame_debug(void) memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2); emu_forcedFrame(0); + smalltext_out16(4, 1, "build: " __DATE__ " " __TIME__, 0xffff); smalltext_out16(4, g_screen_height - me_sfont_h, layer_str, 0xffff); } @@ -2015,6 +2045,22 @@ void me_update_msg(const char *msg) // ------------ util ------------ +/* wiz for now, probably extend later */ +void menu_plat_setup(int is_wiz) +{ + int i; + + if (!is_wiz) + return; + + me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 0); + me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 0); + me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 0); + + i = me_id2offset(e_menu_gfx_options, MA_OPT_SCALING); + e_menu_gfx_options[i].max = 1; /* only off and sw */ +} + /* TODO: rename */ void menu_darken_bg(void *dst, int pixels, int darker) {