- static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };\r
- static const char *names_short[] = { "", " JP", " JP", " US", " EU" };\r
- int u, i = 0;\r
- if (code) {\r
- code <<= 1;\r
- while((code >>= 1)) i++;\r
- if (i > 4) return "unknown";\r
- return names[i];\r
- } else {\r
- static char name[24];\r
- strcpy(name, "Auto:");\r
- for (u = 0; u < 3; u++) {\r
- i = 0; code = ((auto_order >> u*4) & 0xf) << 1;\r
- while((code >>= 1)) i++;\r
- strcat(name, names_short[i]);\r
- }\r
- return name;\r
+ char buff[64], buff2[32];\r
+ const char *dev_name;\r
+ int x, y, w, i;\r
+\r
+ w = ((player_idx >= 0) ? 20 : 30) * me_mfont_w;\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
+ menu_draw_begin(1);\r
+ if (player_idx >= 0)\r
+ text_out16(x, y, "Player %i controls", player_idx + 1);\r
+ else\r
+ text_out16(x, y, "Emulator controls");\r
+\r
+ y += 2 * me_mfont_h;\r
+ menu_draw_selection(x - me_mfont_w * 2, y + sel * me_mfont_h, w + 2 * me_mfont_w);\r
+\r
+ for (i = 0; i < opt_cnt; i++, y += me_mfont_h)\r
+ text_out16(x, y, "%s : %s", opts[i].name,\r
+ action_binds(player_idx, opts[i].mask, dev_id));\r
+\r
+ if (dev_id < 0)\r
+ dev_name = "(all devices)";\r
+ else\r
+ dev_name = in_get_dev_name(dev_id, 1, 1);\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_menuscreen_w)\r
+ w = g_menuscreen_w;\r
+\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_menuscreen_h - 4 * me_mfont_h, buff);\r
+ }\r
+ else\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_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