-// (c) Copyright 2006-2009 notaz, All rights reserved.\r
+// (c) Copyright 2006-2010 notaz, All rights reserved.\r
// Free for non-commercial use.\r
\r
// For commercial use, separate licencing terms must be obtained.\r
static char static_buff[64];\r
static int menu_error_time = 0;\r
char menu_error_msg[64] = { 0, };\r
+void *g_menuscreen_ptr;\r
+void *g_menubg_src_ptr;\r
void *g_menubg_ptr;\r
\r
#ifndef UIQ3\r
\r
+#if !MSCREEN_SIZE_FIXED\r
+int g_menuscreen_w = MSCREEN_WIDTH;\r
+int g_menuscreen_h = MSCREEN_HEIGHT;\r
+#endif\r
+\r
static unsigned char *menu_font_data = NULL;\r
static int menu_text_color = 0xffff; // default to white\r
static int menu_sel_color = -1; // disabled\r
static void text_out16_(int x, int y, const char *text, int color)\r
{\r
int i, lh, tr, tg, tb, len;\r
- unsigned short *dest = (unsigned short *)g_screen_ptr + x + y * g_screen_width;\r
+ unsigned short *dest = (unsigned short *)g_menuscreen_ptr + x + y * g_menuscreen_w;\r
tr = (color & 0xf800) >> 8;\r
tg = (color & 0x07e0) >> 3;\r
tb = (color & 0x001f) << 3;\r
}\r
\r
lh = me_mfont_h;\r
- if (y + lh > g_screen_height)\r
- lh = g_screen_height - y;\r
+ if (y + lh > g_menuscreen_h)\r
+ lh = g_menuscreen_h - y;\r
\r
for (i = 0; i < len; i++)\r
{\r
unsigned short *dst = dest;\r
int u, l;\r
\r
- for (l = 0; l < lh; l++, dst += g_screen_width - me_mfont_w)\r
+ for (l = 0; l < lh; l++, dst += g_menuscreen_w - me_mfont_w)\r
{\r
for (u = me_mfont_w / 2; u > 0; u--, src++)\r
{\r
{\r
va_list args;\r
char buffer[256];\r
- int maxw = (g_screen_width - x) / me_mfont_w;\r
+ int maxw = (g_menuscreen_w - x) / me_mfont_w;\r
\r
if (maxw < 0)\r
return;\r
break;\r
\r
src = fontdata6x8[c];\r
- dst = (unsigned short *)g_screen_ptr + x + y * g_screen_width;\r
+ dst = (unsigned short *)g_menuscreen_ptr + x + y * g_menuscreen_w;\r
\r
while (h--)\r
{\r
dst += multiplier;\r
}\r
\r
- dst += g_screen_width - me_sfont_w;\r
+ dst += g_menuscreen_w - me_sfont_w;\r
}\r
src++;\r
}\r
static void smalltext_out16(int x, int y, const char *texto, int color)\r
{\r
char buffer[128];\r
- int maxw = (g_screen_width - x) / 6;\r
+ int maxw = (g_menuscreen_w - x) / me_sfont_w;\r
\r
if (maxw < 0)\r
return;\r
if (menu_sel_color < 0) return; // no selection hilight\r
\r
if (y > 0) y--;\r
- dest = (unsigned short *)g_screen_ptr + x + y * g_screen_width + 14;\r
+ dest = (unsigned short *)g_menuscreen_ptr + x + y * g_menuscreen_w + me_mfont_w * 2 - 2;\r
for (h = me_mfont_h + 1; h > 0; h--)\r
{\r
dst = dest;\r
- for (i = w - 14; i > 0; i--)\r
+ for (i = w - (me_mfont_w * 2 - 2); i > 0; i--)\r
*dst++ = menu_sel_color;\r
- dest += g_screen_width;\r
+ dest += g_menuscreen_w;\r
}\r
}\r
\r
\r
// load custom font and selector (stored as 1st symbol in font table)\r
emu_make_path(buff, "skin/font.png", sizeof(buff));\r
- readpng(menu_font_data, buff, READPNG_FONT);\r
+ readpng(menu_font_data, buff, READPNG_FONT,\r
+ MENU_X2 ? 256 : 128, MENU_X2 ? 320 : 160);\r
// default selector symbol is '>'\r
memcpy(menu_font_data, menu_font_data + ((int)'>') * me_mfont_w * me_mfont_h / 2,\r
me_mfont_w * me_mfont_h / 2);\r
emu_make_path(buff, "skin/selector.png", sizeof(buff));\r
- readpng(menu_font_data, buff, READPNG_SELECTOR);\r
+ readpng(menu_font_data, buff, READPNG_SELECTOR, me_mfont_w, me_mfont_h);\r
\r
// load custom colors\r
emu_make_path(buff, "skin/skin.txt", sizeof(buff));\r
}\r
}\r
\r
+static void menu_draw_begin(int need_bg)\r
+{\r
+ plat_video_menu_begin();\r
+ if (need_bg)\r
+ memcpy(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2);\r
+}\r
+\r
+static void menu_draw_end(void)\r
+{\r
+ plat_video_menu_end();\r
+}\r
\r
static void menu_darken_bg(void *dst, void *src, int pixels, int darker)\r
{\r
if (is_rom_loaded)\r
{\r
// darken the active framebuffer\r
- menu_darken_bg(g_menubg_ptr, g_screen_ptr, g_screen_width * g_screen_height, 1);\r
+ menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);\r
}\r
else\r
{\r
\r
// should really only happen once, on startup..\r
emu_make_path(buff, "skin/background.png", sizeof(buff));\r
- if (readpng(g_menubg_ptr, buff, READPNG_BG) < 0)\r
- memset(g_menubg_ptr, 0, g_screen_width * g_screen_height * 2);\r
+ if (readpng(g_menubg_ptr, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h) < 0)\r
+ memset(g_menubg_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);\r
}\r
\r
plat_video_menu_enter(is_rom_loaded);\r
\r
static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))\r
{\r
- const menu_entry *ent;\r
+ const menu_entry *ent, *ent_sel = entries;\r
int x, y, w = 0, h = 0;\r
int offs, col2_offs = 27 * me_mfont_w;\r
+ int vi_sel_ln = 0;\r
const char *name;\r
- int asel = 0;\r
int i, n;\r
\r
/* calculate size of menu rect */\r
if (!ent->enabled)\r
continue;\r
\r
- if (i == sel)\r
- asel = n;\r
+ if (i == sel) {\r
+ ent_sel = ent;\r
+ vi_sel_ln = n;\r
+ }\r
\r
name = NULL;\r
wt = strlen(ent->name) * me_mfont_w;\r
wt = col2_offs;\r
\r
switch (ent->beh) {\r
- case MB_NONE: break;\r
+ case MB_NONE:\r
+ break;\r
case MB_OPT_ONOFF:\r
- case MB_OPT_RANGE: wt += me_mfont_w * 3; break;\r
+ case MB_OPT_RANGE:\r
+ wt += me_mfont_w * 3;\r
+ break;\r
case MB_OPT_CUSTOM:\r
case MB_OPT_CUSTONOFF:\r
case MB_OPT_CUSTRANGE:\r
h = n * me_mfont_h;\r
w += me_mfont_w * 2; /* selector */\r
\r
- if (w > g_screen_width) {\r
- lprintf("width %d > %d\n", w, g_screen_width);\r
- w = g_screen_width;\r
+ if (w > g_menuscreen_w) {\r
+ lprintf("width %d > %d\n", w, g_menuscreen_w);\r
+ w = g_menuscreen_w;\r
}\r
- if (h > g_screen_height) {\r
- lprintf("height %d > %d\n", w, g_screen_height);\r
- h = g_screen_height;\r
+ if (h > g_menuscreen_h) {\r
+ lprintf("height %d > %d\n", w, g_menuscreen_h);\r
+ h = g_menuscreen_h;\r
}\r
\r
- x = g_screen_width / 2 - w / 2;\r
- y = g_screen_height / 2 - h / 2;\r
+ x = g_menuscreen_w / 2 - w / 2;\r
+ y = g_menuscreen_h / 2 - h / 2;\r
\r
/* draw */\r
- plat_video_menu_begin();\r
- menu_draw_selection(x, y + asel * me_mfont_h, w);\r
+ menu_draw_begin(1);\r
+ menu_draw_selection(x, y + vi_sel_ln * me_mfont_h, w);\r
x += me_mfont_w * 2;\r
\r
for (ent = entries; ent->name; ent++)\r
}\r
\r
/* display help or message if we have one */\r
- h = (g_screen_height - h) / 2; // bottom area height\r
+ h = (g_menuscreen_h - h) / 2; // bottom area height\r
if (menu_error_msg[0] != 0) {\r
if (h >= me_mfont_h + 4)\r
- text_out16(5, g_screen_height - me_mfont_h - 4, menu_error_msg);\r
+ text_out16(5, g_menuscreen_h - me_mfont_h - 4, menu_error_msg);\r
else\r
lprintf("menu msg doesn't fit!\n");\r
\r
if (plat_get_ticks_ms() - menu_error_time > 2048)\r
menu_error_msg[0] = 0;\r
}\r
- else if (entries[asel].help != NULL) {\r
- const char *tmp = entries[asel].help;\r
+ else if (ent_sel->help != NULL) {\r
+ const char *tmp = ent_sel->help;\r
int l;\r
for (l = 0; tmp != NULL && *tmp != 0; l++)\r
tmp = strchr(tmp + 1, '\n');\r
if (h >= l * me_sfont_h + 4)\r
- for (tmp = entries[asel].help; l > 0; l--, tmp = strchr(tmp, '\n') + 1)\r
- smalltext_out16(5, g_screen_height - (l * me_sfont_h + 4), tmp, 0xffff);\r
+ for (tmp = ent_sel->help; l > 0; l--, tmp = strchr(tmp, '\n') + 1)\r
+ smalltext_out16(5, g_menuscreen_h - (l * me_sfont_h + 4), tmp, 0xffff);\r
}\r
\r
if (draw_more != NULL)\r
draw_more();\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static int me_process(menu_entry *entry, int is_next, int is_lr)\r
p++;\r
}\r
\r
- x = g_screen_width / 2 - w * me_mfont_w / 2;\r
- y = g_screen_height / 2 - h * me_mfont_h / 2;\r
+ x = g_menuscreen_w / 2 - w * me_mfont_w / 2;\r
+ y = g_menuscreen_h / 2 - h * me_mfont_h / 2;\r
if (x < 0) x = 0;\r
if (y < 0) y = 0;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
- for (p = creds; *p != 0 && y <= g_screen_height - me_mfont_h; y += me_mfont_h) {\r
+ for (p = creds; *p != 0 && y <= g_menuscreen_h - me_mfont_h; y += me_mfont_h) {\r
text_out16(x, y, p);\r
\r
for (; *p != 0 && *p != '\n'; p++)\r
p++;\r
}\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
// --------- loading ROM screen ----------\r
\r
static void load_progress_cb(int percent)\r
{\r
- int ln, len = percent * g_screen_width / 100;\r
- unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2;\r
+ int ln, len = percent * g_menuscreen_w / 100;\r
+ unsigned short *dst;\r
+\r
+ if (len > g_menuscreen_w)\r
+ len = g_menuscreen_w;\r
\r
- if (len > g_screen_width)\r
- len = g_screen_width;\r
- for (ln = 10 - 2; ln > 0; ln--, dst += g_screen_width)\r
+ menu_draw_begin(0);\r
+ dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;\r
+ for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_menuscreen_w)\r
memset(dst, 0xff, len * 2);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static void cdload_progress_cb(const char *fname, int percent)\r
{\r
- int ln, len = percent * g_screen_width / 100;\r
- unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2;\r
+ int ln, len = percent * g_menuscreen_w / 100;\r
+ unsigned short *dst;\r
\r
- memset(dst, 0xff, g_screen_width * (me_sfont_h - 2) * 2);\r
+ menu_draw_begin(0);\r
+ dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;\r
+ memset(dst, 0xff, g_menuscreen_w * (me_sfont_h - 2) * 2);\r
\r
smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff);\r
smalltext_out16(1, 4 * me_sfont_h, fname, 0xffff);\r
- dst += g_screen_width * me_sfont_h * 3;\r
+ dst += g_menuscreen_w * me_sfont_h * 3;\r
+\r
+ if (len > g_menuscreen_w)\r
+ len = g_menuscreen_w;\r
\r
- if (len > g_screen_width)\r
- len = g_screen_width;\r
- for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_screen_width)\r
+ for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_menuscreen_w)\r
memset(dst, 0xff, len * 2);\r
+ menu_draw_end();\r
\r
- plat_video_menu_end();\r
cdload_called = 1;\r
}\r
\r
\r
/* fill all buffers, callbacks won't update in full */\r
for (i = 0; i < 3; i++) {\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
smalltext_out16(1, 1, "Loading", 0xffff);\r
smalltext_out16(1, me_sfont_h, p, 0xffff);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
PicoCartLoadProgressCB = load_progress_cb;\r
{\r
PicoCartLoadProgressCB = NULL;\r
PicoCDLoadProgressCB = NULL;\r
+\r
+ menu_draw_begin(0);\r
smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h,\r
"Starting emulation...", 0xffff);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
// -------------- del confirm ---------------\r
const char *nm;\r
char tmp[64];\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
if (!rom_loaded)\r
- menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0);\r
+ menu_darken_bg(g_menuscreen_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h, 0);\r
\r
len = strlen(fname);\r
- if (len > g_screen_width/6)\r
- len = g_screen_width/6;\r
+ if (len > g_menuscreen_w / me_sfont_w)\r
+ len = g_menuscreen_w / me_sfont_w;\r
\r
- mid = g_screen_width / 2;\r
+ mid = g_menuscreen_w / 2;\r
text_out16(mid - me_mfont_w * 15 / 2, 8 * me_mfont_h, "About to delete");\r
smalltext_out16(mid - len * me_sfont_w / 2, 9 * me_mfont_h + 5, fname, 0xbdff);\r
text_out16(mid - me_mfont_w * 13 / 2, 11 * me_mfont_h, "Are you sure?");\r
len = strlen(tmp);\r
\r
text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
\r
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2));\r
inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100);\r
int max_cnt, start, i, x, pos;\r
void *darken_ptr;\r
\r
- max_cnt = g_screen_height / me_sfont_h;\r
+ max_cnt = g_menuscreen_h / me_sfont_h;\r
start = max_cnt / 2 - sel;\r
n--; // exclude current dir (".")\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
// if (!rom_loaded)\r
// menu_darken_bg(gp2x_screen, 320*240, 0);\r
\r
- darken_ptr = (short *)g_screen_ptr + g_screen_width * max_cnt/2 * me_sfont_h;\r
- menu_darken_bg(darken_ptr, darken_ptr, g_screen_width * me_sfont_h * 8 / 10, 0);\r
+ darken_ptr = (short *)g_menuscreen_ptr + g_menuscreen_w * max_cnt/2 * me_sfont_h;\r
+ menu_darken_bg(darken_ptr, darken_ptr, g_menuscreen_w * me_sfont_h * 8 / 10, 0);\r
\r
x = 5 + me_mfont_w + 1;\r
if (start - 2 >= 0)\r
}\r
}\r
smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static int scandir_cmp(const void *p1, const void *p2)\r
{\r
int max_cnt, start, i, pos, active;\r
\r
- max_cnt = g_screen_height / 10;\r
+ max_cnt = g_menuscreen_h / me_sfont_h;\r
start = max_cnt / 2 - sel;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
for (i = 0; i < PicoPatchCount; i++) {\r
pos = start + i;\r
if (pos < 0) continue;\r
if (pos >= max_cnt) break;\r
active = PicoPatches[i].active;\r
- smalltext_out16(14, pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff);\r
- smalltext_out16(14+6*4, pos * me_sfont_h, PicoPatches[i].name, active ? 0xfff6 : 0xffff);\r
+ smalltext_out16(14, pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff);\r
+ smalltext_out16(14 + me_sfont_w*4, pos * me_sfont_h, PicoPatches[i].name, active ? 0xfff6 : 0xffff);\r
}\r
pos = start + i;\r
if (pos < max_cnt)\r
smalltext_out16(14, pos * me_sfont_h, "done", 0xffff);\r
\r
text_out16(5, max_cnt / 2 * me_sfont_h, ">");\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static void menu_loop_patches(void)\r
PicoStateLoadGfx(fname);\r
\r
/* do a frame and fetch menu bg */\r
- pemu_forced_frame(POPT_EN_SOFTSCALE);\r
- menu_enter(1);\r
+ pemu_forced_frame(0, 0);\r
+\r
+ menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);\r
\r
PicoTmpStateRestore(tmp_state);\r
}\r
\r
w = (13 + 2) * me_mfont_w;\r
h = (1+2+10+1) * me_mfont_h;\r
- x = g_screen_width / 2 - w / 2;\r
+ x = g_menuscreen_w / 2 - w / 2;\r
if (x < 0) x = 0;\r
- y = g_screen_height / 2 - h / 2;\r
+ y = g_menuscreen_h / 2 - h / 2;\r
if (y < 0) y = 0;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
text_out16(x, y, is_loading ? "Load state" : "Save state");\r
y += 3 * me_mfont_h;\r
}\r
text_out16(x, y, "back");\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static int menu_loop_savestate(int is_loading)\r
\r
static char *action_binds(int player_idx, int action_mask, int dev_id)\r
{\r
- int k, count, can_combo, type;\r
+ int k, count = 0, can_combo = 0, type;\r
const int *binds;\r
\r
static_buff[0] = 0;\r
if (binds == NULL)\r
return static_buff;\r
\r
- count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT);\r
- can_combo = in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS);\r
+ in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);\r
+ in_get_config(dev_id, IN_CFG_DOES_COMBOS, &can_combo);\r
\r
type = IN_BINDTYPE_EMU;\r
if (player_idx >= 0) {\r
{\r
const int *binds;\r
int k, keys = 0;\r
- int count;\r
+ int count = 0;\r
\r
binds = in_get_dev_binds(dev_id);\r
if (binds == NULL)\r
return 0;\r
\r
- count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT);\r
+ in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);\r
for (k = 0; k < count; k++)\r
{\r
if (binds[IN_BIND_OFFS(k, bindtype)] & action_mask)\r
int x, y, w, i;\r
\r
w = ((player_idx >= 0) ? 20 : 30) * me_mfont_w;\r
- x = g_screen_width / 2 - w / 2;\r
- y = (g_screen_height - 4 * me_mfont_h) / 2 - (2 + opt_cnt) * me_mfont_h / 2;\r
+ x = g_menuscreen_w / 2 - w / 2;\r
+ y = (g_menuscreen_h - 4 * me_mfont_h) / 2 - (2 + opt_cnt) * me_mfont_h / 2;\r
if (x < me_mfont_w * 2)\r
x = me_mfont_w * 2;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
if (player_idx >= 0)\r
text_out16(x, y, "Player %i controls", player_idx + 1);\r
else\r
w = strlen(dev_name) * me_mfont_w;\r
if (w < 30 * me_mfont_w)\r
w = 30 * me_mfont_w;\r
- if (w > g_screen_width)\r
- w = g_screen_width;\r
+ if (w > g_menuscreen_w)\r
+ w = g_menuscreen_w;\r
\r
- x = g_screen_width / 2 - w / 2;\r
+ x = g_menuscreen_w / 2 - w / 2;\r
\r
if (!is_bind) {\r
snprintf(buff2, sizeof(buff2), "%s", in_get_key_name(-1, -PBTN_MOK));\r
snprintf(buff, sizeof(buff), "%s - bind, %s - clear", buff2,\r
in_get_key_name(-1, -PBTN_MA2));\r
- text_out16(x, g_screen_height - 4 * me_mfont_h, buff);\r
+ text_out16(x, g_menuscreen_h - 4 * me_mfont_h, buff);\r
}\r
else\r
- text_out16(x, g_screen_height - 4 * me_mfont_h, "Press a button to bind/unbind");\r
+ text_out16(x, g_menuscreen_h - 4 * me_mfont_h, "Press a button to bind/unbind");\r
\r
if (dev_count > 1) {\r
- text_out16(x, g_screen_height - 3 * me_mfont_h, dev_name);\r
- text_out16(x, g_screen_height - 2 * me_mfont_h, "Press left/right for other devs");\r
+ text_out16(x, g_menuscreen_h - 3 * me_mfont_h, dev_name);\r
+ text_out16(x, g_menuscreen_h - 2 * me_mfont_h, "Press left/right for other devs");\r
}\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx)\r
{\r
- int i, sel = 0, menu_sel_max = opt_cnt - 1;\r
+ int i, sel = 0, menu_sel_max = opt_cnt - 1, does_combos = 0;\r
int dev_id, dev_count, kc, is_down, mkey;\r
int unbind, bindtype, mask_shift;\r
\r
break;\r
}\r
continue;\r
- case PBTN_MBACK: return;\r
+ case PBTN_MBACK:\r
+ return;\r
case PBTN_MOK:\r
if (sel >= opt_cnt)\r
return;\r
- while (in_menu_wait_any(30) & PBTN_MOK);\r
+ while (in_menu_wait_any(30) & PBTN_MOK)\r
+ ;\r
break;\r
case PBTN_MA2:\r
in_unbind_all(dev_id, opts[sel].mask << mask_shift, bindtype);\r
unbind = (i > 0);\r
\r
/* allow combos if device supports them */\r
- if (i == 1 && bindtype == IN_BINDTYPE_EMU &&\r
- in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS))\r
+ in_get_config(dev_id, IN_CFG_DOES_COMBOS, &does_combos);\r
+ if (i == 1 && bindtype == IN_BINDTYPE_EMU && does_combos)\r
unbind = 0;\r
\r
- in_bind_key(dev_id, kc, opts[sel].mask << mask_shift, bindtype, unbind);\r
+ if (unbind)\r
+ in_unbind_all(dev_id, opts[sel].mask << mask_shift, bindtype);\r
+\r
+ in_bind_key(dev_id, kc, opts[sel].mask << mask_shift, bindtype, 0);\r
}\r
}\r
\r
mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap),\r
mee_onoff ("6 button pad", MA_OPT_6BUTTON_PAD, PicoOpt, POPT_6BTN_PAD),\r
mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30),\r
+ mee_range ("Analog deadzone", MA_CTRL_DEADZONE, currentConfig.analog_deadzone, 1, 99),\r
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),\r
mee_cust_nosave("Save cfg for loaded game", MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),\r
mee_label (""),\r
\r
// ------------ 32X options menu ------------\r
\r
+#ifndef NO_32X\r
+\r
// convert from multiplier of VClk\r
static int mh_opt_sh2cycles(menu_id id, int keys)\r
{\r
{\r
static int sel = 0;\r
\r
- me_enable(e_menu_32x_options, MA_32XOPT_RENDERER, renderer_names32x != NULL);\r
+ me_enable(e_menu_32x_options, MA_32XOPT_RENDERER, renderer_names32x[0] != NULL);\r
me_loop(e_menu_32x_options, &sel, NULL);\r
\r
return 0;\r
}\r
\r
+#endif\r
+\r
// ------------ adv options menu ------------\r
\r
static menu_entry e_menu_adv_options[] =\r
mee_onoff ("Enable sound", MA_OPT_ENABLE_SOUND, currentConfig.EmuOpt, EOPT_EN_SOUND),\r
mee_cust ("Sound Quality", MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound),\r
mee_enum_h ("Confirm savestate", MA_OPT_CONFIRM_STATES,currentConfig.confirm_save, men_confirm_save, h_confirm_save),\r
- mee_range (cpu_clk_name, MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 900),\r
+ mee_range ("", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 1200),\r
mee_handler ("[Display options]", menu_loop_gfx_options),\r
mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options),\r
+#ifndef NO_32X\r
mee_handler ("[32X options]", menu_loop_32x_options),\r
+#endif\r
mee_handler ("[Advanced options]", menu_loop_adv_options),\r
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),\r
mee_cust_nosave("Save cfg for loaded game",MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),\r
static int menu_loop_options(menu_id id, int keys)\r
{\r
static int sel = 0;\r
+ int i;\r
\r
+ i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);\r
+ e_menu_options[i].enabled = e_menu_options[i].name[0] ? 1 : 0;\r
me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, rom_loaded);\r
me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);\r
\r
}\r
\r
str = p;\r
- for (line = from; line < g_screen_height / me_sfont_h; line++)\r
+ for (line = from; line < g_menuscreen_h / me_sfont_h; line++)\r
{\r
smalltext_out16(1, line * me_sfont_h, str, 0xffff);\r
while (*p && *p != '\n')\r
if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);\r
if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4);\r
\r
- memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
- pemu_forced_frame(0);\r
+ pemu_forced_frame(1, 0);\r
+ memcpy(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2);\r
smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff);\r
- smalltext_out16(4, g_screen_height - me_sfont_h, layer_str, 0xffff);\r
+ smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff);\r
}\r
\r
static void debug_menu_loop(void)\r
\r
while (1)\r
{\r
+ menu_draw_begin(1);\r
switch (mode)\r
{\r
- case 0: plat_video_menu_begin();\r
- tmp = PDebugMain();\r
+ case 0: tmp = PDebugMain();\r
plat_debug_cat(tmp);\r
draw_text_debug(tmp, 0, 0);\r
if (dumped) {\r
- smalltext_out16(g_screen_width - 6 * me_sfont_h,\r
- g_screen_height - me_mfont_h, "dumped", 0xffff);\r
+ smalltext_out16(g_menuscreen_w - 6 * me_sfont_h,\r
+ g_menuscreen_h - me_mfont_h, "dumped", 0xffff);\r
dumped = 0;\r
}\r
break;\r
- case 1: draw_frame_debug(); break;\r
- case 2: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
- pemu_forced_frame(0);\r
- menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0);\r
- PDebugShowSpriteStats((unsigned short *)g_screen_ptr + (g_screen_height/2 - 240/2)*g_screen_width +\r
- g_screen_width/2 - 320/2, g_screen_width); break;\r
- case 3: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);\r
- PDebugShowPalette(g_screen_ptr, g_screen_width);\r
- PDebugShowSprite((unsigned short *)g_screen_ptr + g_screen_width*120 + g_screen_width/2 + 16,\r
- g_screen_width, spr_offs);\r
+ case 1: draw_frame_debug();\r
+ break;\r
+ case 2: pemu_forced_frame(1, 0);\r
+ menu_darken_bg(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 0);\r
+ PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w +\r
+ g_menuscreen_w/2 - 320/2, g_menuscreen_w);\r
+ break;\r
+ case 3: memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);\r
+ PDebugShowPalette(g_menuscreen_ptr, g_menuscreen_w);\r
+ PDebugShowSprite((unsigned short *)g_menuscreen_ptr + g_menuscreen_w*120 + g_menuscreen_w/2 + 16,\r
+ g_menuscreen_w, spr_offs);\r
draw_text_debug(PDebugSpriteList(), spr_offs, 6);\r
break;\r
- case 4: plat_video_menu_begin();\r
- tmp = PDebug32x();\r
+ case 4: tmp = PDebug32x();\r
draw_text_debug(tmp, 0, 0);\r
break;\r
}\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
\r
inp = in_menu_wait(PBTN_MOK|PBTN_MBACK|PBTN_MA2|PBTN_MA3|PBTN_L|PBTN_R |\r
PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, 70);\r
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);\r
\r
menu_enter(rom_loaded);\r
- in_set_blocking(1);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 1);\r
me_loop(e_menu_main, &sel, menu_main_plat_draw);\r
\r
if (rom_loaded) {\r
;\r
}\r
\r
- in_set_blocking(0);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
}\r
\r
// --------- CD tray close menu ----------\r
\r
menu_enter(rom_loaded);\r
\r
- in_set_blocking(1);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 1);\r
me_loop(e_menu_tray, &sel, NULL);\r
\r
if (engineState != PGS_RestartRun) {\r
}\r
\r
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK));\r
- in_set_blocking(0);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
\r
return ret;\r
}\r
\r
// ------------ util ------------\r
\r
-/* GP2X/wiz for now, probably extend later */\r
-void menu_plat_setup(int is_wiz)\r
-{\r
- int i;\r
-\r
- if (!is_wiz) {\r
- me_enable(e_menu_gfx_options, MA_OPT_TEARING_FIX, 0);\r
- i = me_id2offset(e_menu_gfx_options, MA_OPT_TEARING_FIX);\r
- e_menu_gfx_options[i].need_to_save = 0;\r
- return;\r
- }\r
-\r
- me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 0);\r
- me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 0);\r
- me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 0);\r
-\r
- i = me_id2offset(e_menu_gfx_options, MA_OPT_SCALING);\r
- e_menu_gfx_options[i].max = 1; /* only off and sw */\r
- i = me_id2offset(e_menu_gfx_options, MA_OPT_ARM940_SOUND);\r
- e_menu_gfx_options[i].need_to_save = 0;\r
-}\r
-\r
/* hidden options for config engine only */\r
static menu_entry e_menu_hidden[] =\r
{\r
e_menu_gfx_options,\r
e_menu_adv_options,\r
e_menu_cd_options,\r
+#ifndef NO_32X\r
e_menu_32x_options,\r
+#endif\r
e_menu_keyconfig,\r
e_menu_hidden,\r
};\r