c6c6c9cd |
1 | // (c) Copyright 2006-2009 notaz, All rights reserved. |
e5f426aa |
2 | |
e5f426aa |
3 | typedef enum |
4 | { |
5 | MB_NONE = 1, /* no auto processing */ |
1fb0dd88 |
6 | MB_OPT_ONOFF, /* ON/OFF setting */ |
7 | MB_OPT_RANGE, /* [min-max] setting */ |
713c9224 |
8 | MB_OPT_CUSTOM, /* custom value */ |
9 | MB_OPT_CUSTONOFF, |
10 | MB_OPT_CUSTRANGE, |
e5f426aa |
11 | } menu_behavior; |
12 | |
13 | typedef enum |
14 | { |
15 | MA_NONE = 1, |
16 | MA_MAIN_RESUME_GAME, |
17 | MA_MAIN_SAVE_STATE, |
18 | MA_MAIN_LOAD_STATE, |
19 | MA_MAIN_RESET_GAME, |
20 | MA_MAIN_LOAD_ROM, |
21 | MA_MAIN_OPTIONS, |
22 | MA_MAIN_CONTROLS, |
23 | MA_MAIN_CREDITS, |
24 | MA_MAIN_PATCHES, |
25 | MA_MAIN_EXIT, |
26 | MA_OPT_RENDERER, |
27 | MA_OPT_SCALING, |
e5f426aa |
28 | MA_OPT_ACC_SPRITES, |
29 | MA_OPT_SHOW_FPS, |
30 | MA_OPT_FRAMESKIP, |
31 | MA_OPT_ENABLE_SOUND, |
32 | MA_OPT_SOUND_QUALITY, |
33 | MA_OPT_ARM940_SOUND, |
34 | MA_OPT_6BUTTON_PAD, |
35 | MA_OPT_REGION, |
36 | MA_OPT_SRAM_STATES, |
37 | MA_OPT_CONFIRM_STATES, |
38 | MA_OPT_SAVE_SLOT, |
39 | MA_OPT_CPU_CLOCKS, |
40 | MA_OPT_SCD_OPTS, |
41 | MA_OPT_ADV_OPTS, |
8ab3e3c1 |
42 | MA_OPT_DISP_OPTS, /* psp */ |
e5f426aa |
43 | MA_OPT_SAVECFG, |
44 | MA_OPT_SAVECFG_GAME, |
45 | MA_OPT_LOADCFG, |
a8869ad1 |
46 | MA_OPT_INTERLACED, /* giz */ |
ca482e5d |
47 | MA_OPT_ROTATION, /* uiq */ |
cc41eb4f |
48 | MA_OPT_TEARING_FIX, /* wiz */ |
e5f426aa |
49 | MA_OPT2_GAMMA, |
50 | MA_OPT2_A_SN_GAMMA, |
c77ca79e |
51 | MA_OPT2_DBLBUFF, /* giz */ |
e5f426aa |
52 | MA_OPT2_VSYNC, |
53 | MA_OPT2_ENABLE_Z80, |
54 | MA_OPT2_ENABLE_YM2612, |
55 | MA_OPT2_ENABLE_SN76496, |
56 | MA_OPT2_GZIP_STATES, |
57 | MA_OPT2_NO_LAST_ROM, |
a8869ad1 |
58 | MA_OPT2_RAMTIMINGS, /* gp2x */ |
59 | MA_OPT2_SQUIDGEHACK, /* gp2x */ |
9caf44b5 |
60 | MA_OPT2_STATUS_LINE, /* psp */ |
c6196c0f |
61 | MA_OPT2_NO_FRAME_LIMIT, /* psp */ |
1ca2ea4f |
62 | MA_OPT2_SVP_DYNAREC, |
95dc5c5e |
63 | MA_OPT2_NO_SPRITE_LIM, |
053fd9b4 |
64 | MA_OPT2_NO_IDLE_LOOPS, |
e5f426aa |
65 | MA_OPT2_DONE, |
8ab3e3c1 |
66 | MA_OPT3_SCALE, /* psp (all OPT3) */ |
67 | MA_OPT3_HSCALE32, |
68 | MA_OPT3_HSCALE40, |
69 | MA_OPT3_PRES_NOSCALE, |
c6196c0f |
70 | MA_OPT3_PRES_SCALE43, |
8ab3e3c1 |
71 | MA_OPT3_PRES_FULLSCR, |
72 | MA_OPT3_FILTERING, |
3ec29f01 |
73 | MA_OPT3_VSYNC, |
2445b7cb |
74 | MA_OPT3_GAMMAA, |
6fc57144 |
75 | MA_OPT3_BLACKLVL, |
8ab3e3c1 |
76 | MA_OPT3_DONE, |
e5f426aa |
77 | MA_CDOPT_TESTBIOS_USA, |
78 | MA_CDOPT_TESTBIOS_EUR, |
79 | MA_CDOPT_TESTBIOS_JAP, |
80 | MA_CDOPT_LEDS, |
81 | MA_CDOPT_CDDA, |
82 | MA_CDOPT_PCM, |
83 | MA_CDOPT_READAHEAD, |
84 | MA_CDOPT_SAVERAM, |
85 | MA_CDOPT_SCALEROT_CHIP, |
86 | MA_CDOPT_BETTER_SYNC, |
87 | MA_CDOPT_DONE, |
f0f0d2df |
88 | MA_CTRL_PLAYER1, |
89 | MA_CTRL_PLAYER2, |
90 | MA_CTRL_EMU, |
91 | MA_CTRL_TURBO_RATE, |
713c9224 |
92 | MA_CTRL_DEV_FIRST, |
93 | MA_CTRL_DEV_NEXT, |
f0f0d2df |
94 | MA_CTRL_DONE, |
e5f426aa |
95 | } menu_id; |
96 | |
97 | typedef struct |
98 | { |
42171343 |
99 | const char *name; |
e5f426aa |
100 | menu_behavior beh; |
101 | menu_id id; |
1fb0dd88 |
102 | void *var; /* for on-off/range settings */ |
103 | int mask; /* bit to toggle for on/off */ |
713c9224 |
104 | signed short min; /* for ranged integer settings, to be sign-extended */ |
105 | signed short max; |
106 | int enabled:1; |
107 | int need_to_save:1; |
108 | int selectable:1; |
109 | int (*handler)(menu_id id, int keys); |
110 | const char * (*generate_name)(menu_id id, int *offs); |
e5f426aa |
111 | } menu_entry; |
112 | |
713c9224 |
113 | #define mee_handler_id(name, id, handler) \ |
114 | { name, MB_NONE, id, NULL, 0, 0, 0, 1, 0, 1, handler, NULL } |
1fb0dd88 |
115 | |
713c9224 |
116 | #define mee_handler(name, handler) \ |
117 | mee_handler_id(name, MA_NONE, handler) |
118 | |
119 | #define mee_handler_mkname_id(id, handler, name_func) \ |
120 | { "", MB_NONE, id, NULL, 0, 0, 0, 1, 0, 1, handler, name_func } |
121 | |
122 | #define mee_label(name) \ |
123 | { name, MB_NONE, MA_NONE, NULL, 0, 0, 0, 1, 0, 0, NULL, NULL } |
124 | |
125 | #define mee_label_mk(id, name_func) \ |
126 | { "", MB_NONE, id, NULL, 0, 0, 0, 1, 0, 0, NULL, name_func } |
127 | |
128 | #define mee_onoff(name, id, var, mask) \ |
129 | { name, MB_OPT_ONOFF, id, &(var), mask, 0, 0, 1, 1, 1, NULL, NULL } |
130 | |
131 | #define mee_range(name, id, var, min, max) \ |
132 | { name, MB_OPT_RANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, NULL } |
133 | |
134 | #define mee_cust(name, id, handler, name_func) \ |
135 | { name, MB_OPT_CUSTOM, id, NULL, 0, 0, 0, 1, 1, 1, handler, name_func } |
136 | |
137 | #define mee_onoff_cust(name, id, var, mask, name_func) \ |
138 | { name, MB_OPT_CUSTONOFF, id, &(var), mask, 0, 0, 1, 1, 1, NULL, name_func } |
139 | |
140 | #define mee_range_cust(name, id, var, min, max, name_func) \ |
141 | { name, MB_OPT_CUSTRANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, name_func } |
1fb0dd88 |
142 | |
143 | #define mee_end \ |
713c9224 |
144 | { NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL } |
1fb0dd88 |
145 | |
1ca2ea4f |
146 | typedef struct |
147 | { |
148 | char *name; |
149 | int mask; |
150 | } me_bind_action; |
151 | |
f0f0d2df |
152 | extern me_bind_action me_ctrl_actions[15]; |
1ca2ea4f |
153 | extern me_bind_action emuctrl_actions[]; // platform code |
154 | |
c6c6c9cd |
155 | void menu_init(void); |
ee2a3bdf |
156 | void menu_plat_setup(int is_wiz); |
c6c6c9cd |
157 | void text_out16(int x, int y, const char *texto, ...); |
158 | void me_update_msg(const char *msg); |
159 | |
74f5e726 |
160 | void menu_loop(void); |
161 | int menu_loop_tray(void); |
162 | |
713c9224 |
163 | menu_entry *me_list_get_first(void); |
164 | menu_entry *me_list_get_next(void); |
e5f426aa |
165 | |
1fb0dd88 |
166 | void menu_darken_bg(void *dst, int pixels, int darker); |
167 | |