X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Fmenu.c;h=8e1da968d1443ad103a636b6671c1b849672dd3f;hb=93f9619ed819dee07948416c98ca2f1c70a22666;hp=55005294b0cf21445f1cf57ddbc6396a0026c224;hpb=4b973b89197c6bfebcfecf0d1778d4dd0479a9c4;p=picodrive.git diff --git a/platform/gp2x/menu.c b/platform/gp2x/menu.c index 5500529..8e1da96 100644 --- a/platform/gp2x/menu.c +++ b/platform/gp2x/menu.c @@ -1,108 +1,53 @@ -#ifdef __GP2X__ +#include "../libpicofe/gp2x/plat_gp2x.h" -#include -#include "soc.h" - -static void menu_main_plat_draw(void) -{ - static time_t last_bat_read = 0; - static int last_bat_val = -1; - unsigned short *bp = g_screen_ptr; - int bat_h = me_mfont_h * 2 / 3; - int i, u, w, wfill, batt_val; - struct tm *tmp; - time_t ltime; - char time_s[16]; - - if (!(currentConfig.EmuOpt & EOPT_SHOW_RTC)) - return; - - ltime = time(NULL); - tmp = gmtime(<ime); - strftime(time_s, sizeof(time_s), "%H:%M", tmp); +// ------------ gfx options menu ------------ - text_out16(g_screen_width - me_mfont_w * 6, me_mfont_h + 2, time_s); - if (ltime - last_bat_read > 10) { - last_bat_read = ltime; - last_bat_val = batt_val = gp2x_read_battery(); - } - else - batt_val = last_bat_val; +const char *men_scaling_opts[] = { "OFF", "software", "hardware", NULL }; - if (batt_val < 0 || batt_val > 100) - return; +#define MENU_OPTIONS_GFX \ + mee_enum ("Horizontal scaling", MA_OPT_SCALING, currentConfig.scaling, men_scaling_opts), \ + mee_enum ("Vertical scaling", MA_OPT_VSCALING, currentConfig.vscaling, men_scaling_opts), \ + mee_onoff ("Tearing Fix", MA_OPT_TEARING_FIX, currentConfig.EmuOpt, EOPT_WIZ_TEAR_FIX), \ + /*mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, EOPT_A_SN_GAMMA),*/ \ + mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), - /* battery info */ - bp += (me_mfont_h * 2 + 2) * g_screen_width + g_screen_width - me_mfont_w * 3 - 3; - for (i = 0; i < me_mfont_w * 2; i++) - bp[i] = menu_text_color; - for (i = 0; i < me_mfont_w * 2; i++) - bp[i + g_screen_width * bat_h] = menu_text_color; - for (i = 0; i <= bat_h; i++) - bp[i * g_screen_width] = - bp[i * g_screen_width + me_mfont_w * 2] = menu_text_color; - for (i = 2; i < bat_h - 1; i++) - bp[i * g_screen_width - 1] = - bp[i * g_screen_width - 2] = menu_text_color; +#define MENU_OPTIONS_ADV \ + mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoIn.opt, POPT_EXT_FM), \ - w = me_mfont_w * 2 - 1; - wfill = batt_val * w / 100; - for (u = 1; u < bat_h; u++) - for (i = 0; i < wfill; i++) - bp[(w - i) + g_screen_width * u] = menu_text_color; -} -// ------------ gfx options menu ------------ +static menu_entry e_menu_adv_options[]; +static menu_entry e_menu_gfx_options[]; +static menu_entry e_menu_options[]; +static menu_entry e_menu_keyconfig[]; -static const char *mgn_opt_renderer(menu_id id, int *offs) +void gp2x_menu_init(void) { - *offs = -11; - if (PicoOpt & POPT_ALT_RENDERER) - return " 8bit fast"; - else if (currentConfig.EmuOpt & EOPT_16BPP) - return "16bit accurate"; - else - return " 8bit accurate"; -} - -static const char *mgn_opt_scaling(menu_id id, int *offs) -{ - *offs = -13; - switch (currentConfig.scaling) { - 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"; + /* disable by default.. */ + me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 0); + me_enable(e_menu_gfx_options, MA_OPT_TEARING_FIX, 0); + me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 0); + me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 0); + + switch (gp2x_dev_id) { + case GP2X_DEV_GP2X: + me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 1); + me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 1); + me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 1); + break; + case GP2X_DEV_WIZ: + me_enable(e_menu_gfx_options, MA_OPT_TEARING_FIX, 1); + break; + case GP2X_DEV_CAANOO: + break; + default: + break; } -} - -static const char *mgn_aopt_gamma(menu_id id, int *offs) -{ - sprintf(static_buff, "%i.%02i", currentConfig.gamma / 100, currentConfig.gamma%100); - return static_buff; -} + if (gp2x_dev_id != GP2X_DEV_GP2X) + men_scaling_opts[2] = NULL; /* leave only off and sw */ -#define MENU_GP2X_OPTIONS_GFX \ - mee_range_cust("Scaling", MA_OPT_SCALING, currentConfig.scaling, 0, 3, mgn_opt_scaling), \ - mee_onoff ("Tearing Fix", MA_OPT_TEARING_FIX, currentConfig.EmuOpt, EOPT_WIZ_TEAR_FIX), \ - 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, EOPT_A_SN_GAMMA), \ - mee_onoff ("Perfect vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_PSYNC), - -#define MENU_GP2X_OPTIONS_ADV \ - mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoOpt, POPT_EXT_FM), \ - 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 ("Status line in main menu", MA_OPT2_STATUS_LINE, currentConfig.EmuOpt, EOPT_SHOW_RTC ), - -#else - -#define MENU_GP2X_OPTIONS_GFX -#define MENU_GP2X_OPTIONS_ADV -#define mgn_opt_renderer NULL /* TODO */ -#define menu_main_plat_draw NULL + if (gp2x_dev_id != GP2X_DEV_CAANOO) + me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0); +} -#endif