| 1 | #include <time.h> |
| 2 | #include "soc.h" |
| 3 | |
| 4 | static void menu_main_plat_draw(void) |
| 5 | { |
| 6 | static time_t last_bat_read = 0; |
| 7 | static int last_bat_val = -1; |
| 8 | unsigned short *bp = g_screen_ptr; |
| 9 | int bat_h = me_mfont_h * 2 / 3; |
| 10 | int i, u, w, wfill, batt_val; |
| 11 | struct tm *tmp; |
| 12 | time_t ltime; |
| 13 | char time_s[16]; |
| 14 | |
| 15 | if (!(currentConfig.EmuOpt & EOPT_SHOW_RTC)) |
| 16 | return; |
| 17 | |
| 18 | ltime = time(NULL); |
| 19 | tmp = gmtime(<ime); |
| 20 | strftime(time_s, sizeof(time_s), "%H:%M", tmp); |
| 21 | |
| 22 | text_out16(g_screen_width - me_mfont_w * 6, me_mfont_h + 2, time_s); |
| 23 | |
| 24 | if (ltime - last_bat_read > 10) { |
| 25 | last_bat_read = ltime; |
| 26 | last_bat_val = batt_val = gp2x_read_battery(); |
| 27 | } |
| 28 | else |
| 29 | batt_val = last_bat_val; |
| 30 | |
| 31 | if (batt_val < 0 || batt_val > 100) |
| 32 | return; |
| 33 | |
| 34 | /* battery info */ |
| 35 | bp += (me_mfont_h * 2 + 2) * g_screen_width + g_screen_width - me_mfont_w * 3 - 3; |
| 36 | for (i = 0; i < me_mfont_w * 2; i++) |
| 37 | bp[i] = menu_text_color; |
| 38 | for (i = 0; i < me_mfont_w * 2; i++) |
| 39 | bp[i + g_screen_width * bat_h] = menu_text_color; |
| 40 | for (i = 0; i <= bat_h; i++) |
| 41 | bp[i * g_screen_width] = |
| 42 | bp[i * g_screen_width + me_mfont_w * 2] = menu_text_color; |
| 43 | for (i = 2; i < bat_h - 1; i++) |
| 44 | bp[i * g_screen_width - 1] = |
| 45 | bp[i * g_screen_width - 2] = menu_text_color; |
| 46 | |
| 47 | w = me_mfont_w * 2 - 1; |
| 48 | wfill = batt_val * w / 100; |
| 49 | for (u = 1; u < bat_h; u++) |
| 50 | for (i = 0; i < wfill; i++) |
| 51 | bp[(w - i) + g_screen_width * u] = menu_text_color; |
| 52 | } |
| 53 | |
| 54 | // ------------ gfx options menu ------------ |
| 55 | |
| 56 | static const char *mgn_aopt_gamma(menu_id id, int *offs) |
| 57 | { |
| 58 | sprintf(static_buff, "%i.%02i", currentConfig.gamma / 100, currentConfig.gamma % 100); |
| 59 | return static_buff; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | const char *men_scaling_opts[] = { "OFF", "sw horizontal", "hw horizontal", "hw horiz. + vert", NULL }; |
| 64 | |
| 65 | #define MENU_OPTIONS_GFX \ |
| 66 | mee_enum ("Scaling", MA_OPT_SCALING, currentConfig.scaling, men_scaling_opts), \ |
| 67 | mee_onoff ("Tearing Fix", MA_OPT_TEARING_FIX, currentConfig.EmuOpt, EOPT_WIZ_TEAR_FIX), \ |
| 68 | mee_range_cust("Gamma correction", MA_OPT2_GAMMA, currentConfig.gamma, 1, 300, mgn_aopt_gamma), \ |
| 69 | mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, EOPT_A_SN_GAMMA), \ |
| 70 | mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), |
| 71 | |
| 72 | #define MENU_OPTIONS_ADV \ |
| 73 | mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoOpt, POPT_EXT_FM), \ |
| 74 | mee_onoff ("RAM overclock", MA_OPT2_RAMTIMINGS, currentConfig.EmuOpt, EOPT_RAM_TIMINGS), \ |
| 75 | mee_onoff ("MMU hack", MA_OPT2_SQUIDGEHACK, currentConfig.EmuOpt, EOPT_MMUHACK), \ |
| 76 | mee_onoff ("SVP dynarec", MA_OPT2_SVP_DYNAREC, PicoOpt, POPT_EN_SVP_DRC), \ |
| 77 | mee_onoff ("Status line in main menu", MA_OPT2_STATUS_LINE, currentConfig.EmuOpt, EOPT_SHOW_RTC), |
| 78 | |