fix Wiz timer drift and button name
[libpicofe.git] / common / menu.h
CommitLineData
3ffee69c 1// (c) Copyright 2006-2009 notaz, All rights reserved.
c7a4ff64 2
c7a4ff64 3typedef enum
4{
5 MB_NONE = 1, /* no auto processing */
24b24674 6 MB_OPT_ONOFF, /* ON/OFF setting */
7 MB_OPT_RANGE, /* [min-max] setting */
049a6b3e 8 MB_OPT_CUSTOM, /* custom value */
9 MB_OPT_CUSTONOFF,
10 MB_OPT_CUSTRANGE,
c7a4ff64 11} menu_behavior;
12
13typedef 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,
28 MA_OPT_ACC_TIMING,
29 MA_OPT_ACC_SPRITES,
30 MA_OPT_SHOW_FPS,
31 MA_OPT_FRAMESKIP,
32 MA_OPT_ENABLE_SOUND,
33 MA_OPT_SOUND_QUALITY,
34 MA_OPT_ARM940_SOUND,
35 MA_OPT_6BUTTON_PAD,
36 MA_OPT_REGION,
37 MA_OPT_SRAM_STATES,
38 MA_OPT_CONFIRM_STATES,
39 MA_OPT_SAVE_SLOT,
40 MA_OPT_CPU_CLOCKS,
41 MA_OPT_SCD_OPTS,
42 MA_OPT_ADV_OPTS,
6f748c47 43 MA_OPT_DISP_OPTS, /* psp */
c7a4ff64 44 MA_OPT_SAVECFG,
45 MA_OPT_SAVECFG_GAME,
46 MA_OPT_LOADCFG,
50cdcf97 47 MA_OPT_INTERLACED, /* giz */
36f6fd5a 48 MA_OPT_ROTATION, /* uiq */
b7911801 49 MA_OPT_TEARING_FIX, /* wiz */
c7a4ff64 50 MA_OPT2_GAMMA,
51 MA_OPT2_A_SN_GAMMA,
f3dc5a3a 52 MA_OPT2_DBLBUFF, /* giz */
c7a4ff64 53 MA_OPT2_VSYNC,
54 MA_OPT2_ENABLE_Z80,
55 MA_OPT2_ENABLE_YM2612,
56 MA_OPT2_ENABLE_SN76496,
57 MA_OPT2_GZIP_STATES,
58 MA_OPT2_NO_LAST_ROM,
50cdcf97 59 MA_OPT2_RAMTIMINGS, /* gp2x */
60 MA_OPT2_SQUIDGEHACK, /* gp2x */
16e89bed 61 MA_OPT2_STATUS_LINE, /* psp */
c6334564 62 MA_OPT2_NO_FRAME_LIMIT, /* psp */
367b6f1f 63 MA_OPT2_SVP_DYNAREC,
0fb424db 64 MA_OPT2_NO_SPRITE_LIM,
260f1bcc 65 MA_OPT2_NO_IDLE_LOOPS,
c7a4ff64 66 MA_OPT2_DONE,
6f748c47 67 MA_OPT3_SCALE, /* psp (all OPT3) */
68 MA_OPT3_HSCALE32,
69 MA_OPT3_HSCALE40,
70 MA_OPT3_PRES_NOSCALE,
c6334564 71 MA_OPT3_PRES_SCALE43,
6f748c47 72 MA_OPT3_PRES_FULLSCR,
73 MA_OPT3_FILTERING,
4b8f4f3c 74 MA_OPT3_VSYNC,
93c0d147 75 MA_OPT3_GAMMAA,
960a8e27 76 MA_OPT3_BLACKLVL,
6f748c47 77 MA_OPT3_DONE,
c7a4ff64 78 MA_CDOPT_TESTBIOS_USA,
79 MA_CDOPT_TESTBIOS_EUR,
80 MA_CDOPT_TESTBIOS_JAP,
81 MA_CDOPT_LEDS,
82 MA_CDOPT_CDDA,
83 MA_CDOPT_PCM,
84 MA_CDOPT_READAHEAD,
85 MA_CDOPT_SAVERAM,
86 MA_CDOPT_SCALEROT_CHIP,
87 MA_CDOPT_BETTER_SYNC,
88 MA_CDOPT_DONE,
6589c840 89 MA_CTRL_PLAYER1,
90 MA_CTRL_PLAYER2,
91 MA_CTRL_EMU,
92 MA_CTRL_TURBO_RATE,
049a6b3e 93 MA_CTRL_DEV_FIRST,
94 MA_CTRL_DEV_NEXT,
6589c840 95 MA_CTRL_DONE,
c7a4ff64 96} menu_id;
97
98typedef struct
99{
d572cbad 100 const char *name;
c7a4ff64 101 menu_behavior beh;
102 menu_id id;
24b24674 103 void *var; /* for on-off/range settings */
104 int mask; /* bit to toggle for on/off */
049a6b3e 105 signed short min; /* for ranged integer settings, to be sign-extended */
106 signed short max;
107 int enabled:1;
108 int need_to_save:1;
109 int selectable:1;
110 int (*handler)(menu_id id, int keys);
111 const char * (*generate_name)(menu_id id, int *offs);
c7a4ff64 112} menu_entry;
113
049a6b3e 114#define mee_handler_id(name, id, handler) \
115 { name, MB_NONE, id, NULL, 0, 0, 0, 1, 0, 1, handler, NULL }
24b24674 116
049a6b3e 117#define mee_handler(name, handler) \
118 mee_handler_id(name, MA_NONE, handler)
119
120#define mee_handler_mkname_id(id, handler, name_func) \
121 { "", MB_NONE, id, NULL, 0, 0, 0, 1, 0, 1, handler, name_func }
122
123#define mee_label(name) \
124 { name, MB_NONE, MA_NONE, NULL, 0, 0, 0, 1, 0, 0, NULL, NULL }
125
126#define mee_label_mk(id, name_func) \
127 { "", MB_NONE, id, NULL, 0, 0, 0, 1, 0, 0, NULL, name_func }
128
129#define mee_onoff(name, id, var, mask) \
130 { name, MB_OPT_ONOFF, id, &(var), mask, 0, 0, 1, 1, 1, NULL, NULL }
131
132#define mee_range(name, id, var, min, max) \
133 { name, MB_OPT_RANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, NULL }
134
135#define mee_cust(name, id, handler, name_func) \
136 { name, MB_OPT_CUSTOM, id, NULL, 0, 0, 0, 1, 1, 1, handler, name_func }
137
138#define mee_onoff_cust(name, id, var, mask, name_func) \
139 { name, MB_OPT_CUSTONOFF, id, &(var), mask, 0, 0, 1, 1, 1, NULL, name_func }
140
141#define mee_range_cust(name, id, var, min, max, name_func) \
142 { name, MB_OPT_CUSTRANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, name_func }
24b24674 143
144#define mee_end \
049a6b3e 145 { NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL }
24b24674 146
367b6f1f 147typedef struct
148{
149 char *name;
150 int mask;
151} me_bind_action;
152
6589c840 153extern me_bind_action me_ctrl_actions[15];
367b6f1f 154extern me_bind_action emuctrl_actions[]; // platform code
155
3ffee69c 156void menu_init(void);
fa8d1331 157void menu_plat_setup(int is_wiz);
3ffee69c 158void text_out16(int x, int y, const char *texto, ...);
159void me_update_msg(const char *msg);
160
7fd581f4 161void menu_loop(void);
162int menu_loop_tray(void);
163
049a6b3e 164menu_entry *me_list_get_first(void);
165menu_entry *me_list_get_next(void);
c7a4ff64 166
24b24674 167void menu_darken_bg(void *dst, int pixels, int darker);
168