menu_pico.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. /*
  2. * PicoDrive
  3. * (C) notaz, 2010,2011
  4. *
  5. * This work is licensed under the terms of MAME license.
  6. * See COPYING file in the top-level directory.
  7. */
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include "emu.h"
  11. #include "menu_pico.h"
  12. #include "input_pico.h"
  13. #include <version.h>
  14. #include <pico/pico.h>
  15. #include <pico/patch.h>
  16. #ifdef PANDORA
  17. #define MENU_X2 1
  18. #else
  19. #define MENU_X2 0
  20. #endif
  21. // FIXME
  22. #define REVISION "0"
  23. static const char *rom_exts[] = {
  24. "zip",
  25. "bin", "smd", "gen",
  26. "iso", "cso", "cue",
  27. "32x",
  28. "sms",
  29. NULL
  30. };
  31. // rrrr rggg gggb bbbb
  32. static unsigned short fname2color(const char *fname)
  33. {
  34. const char *ext = fname + strlen(fname) - 3;
  35. static const char *other_exts[] = { "gmv", "pat" };
  36. int i;
  37. if (ext < fname) ext = fname;
  38. for (i = 0; rom_exts[i] != NULL; i++)
  39. if (strcasecmp(ext, rom_exts[i]) == 0) return 0xbdff; // FIXME: mk defines
  40. for (i = 0; i < array_size(other_exts); i++)
  41. if (strcasecmp(ext, other_exts[i]) == 0) return 0xaff5;
  42. return 0xffff;
  43. }
  44. #include "../libpicofe/menu.c"
  45. static const char *men_dummy[] = { NULL };
  46. /* platform specific options and handlers */
  47. #if defined(__GP2X__)
  48. #include "../gp2x/menu.c"
  49. #elif defined(PANDORA)
  50. #include "../pandora/menu.c"
  51. #else
  52. #define MENU_OPTIONS_GFX
  53. #define MENU_OPTIONS_ADV
  54. #define menu_main_plat_draw NULL
  55. #endif
  56. static void make_bg(int no_scale)
  57. {
  58. unsigned short *src = (void *)g_menubg_src_ptr;
  59. int w = g_screen_width, h = g_screen_height;
  60. short *dst;
  61. int x, y;
  62. if (!no_scale && g_menuscreen_w / w >= 2 && g_menuscreen_h / h >= 2)
  63. {
  64. unsigned int t, *d = g_menubg_ptr;
  65. d += (g_menuscreen_h / 2 - h * 2 / 2)
  66. * g_menuscreen_w / 2;
  67. d += (g_menuscreen_w / 2 - w * 2 / 2) / 2;
  68. for (y = 0; y < h; y++, src += w, d += g_menuscreen_w*2/2) {
  69. for (x = 0; x < w; x++) {
  70. t = src[x];
  71. t = ((t & 0xf79e)>>1) - ((t & 0xc618)>>3);
  72. t |= t << 16;
  73. d[x] = d[x + g_menuscreen_w / 2] = t;
  74. }
  75. }
  76. return;
  77. }
  78. if (w > g_menuscreen_w)
  79. w = g_menuscreen_w;
  80. if (h > g_menuscreen_h)
  81. h = g_menuscreen_h;
  82. dst = (short *)g_menubg_ptr +
  83. (g_menuscreen_h / 2 - h / 2) * g_menuscreen_w +
  84. (g_menuscreen_w / 2 - w / 2);
  85. // darken the active framebuffer
  86. for (; h > 0; dst += g_menuscreen_w, src += g_screen_width, h--)
  87. menu_darken_bg(dst, src, w, 1);
  88. }
  89. static void menu_enter(int is_rom_loaded)
  90. {
  91. if (is_rom_loaded)
  92. {
  93. make_bg(0);
  94. }
  95. else
  96. {
  97. char buff[256];
  98. // should really only happen once, on startup..
  99. emu_make_path(buff, "skin/background.png", sizeof(buff));
  100. if (readpng(g_menubg_ptr, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h) < 0)
  101. memset(g_menubg_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
  102. }
  103. plat_video_menu_enter(is_rom_loaded);
  104. }
  105. static void draw_savestate_bg(int slot)
  106. {
  107. const char *fname;
  108. void *tmp_state;
  109. fname = emu_get_save_fname(1, 0, slot);
  110. if (!fname)
  111. return;
  112. tmp_state = PicoTmpStateSave();
  113. PicoStateLoadGfx(fname);
  114. /* do a frame and fetch menu bg */
  115. pemu_forced_frame(0, 0);
  116. make_bg(0);
  117. PicoTmpStateRestore(tmp_state);
  118. }
  119. // --------- loading ROM screen ----------
  120. static int cdload_called = 0;
  121. static void load_progress_cb(int percent)
  122. {
  123. int ln, len = percent * g_menuscreen_w / 100;
  124. unsigned short *dst;
  125. if (len > g_menuscreen_w)
  126. len = g_menuscreen_w;
  127. menu_draw_begin(0, 1);
  128. dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;
  129. for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_menuscreen_w)
  130. memset(dst, 0xff, len * 2);
  131. menu_draw_end();
  132. }
  133. static void cdload_progress_cb(const char *fname, int percent)
  134. {
  135. int ln, len = percent * g_menuscreen_w / 100;
  136. unsigned short *dst;
  137. menu_draw_begin(0, 1);
  138. dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;
  139. memset(dst, 0xff, g_menuscreen_w * (me_sfont_h - 2) * 2);
  140. smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff);
  141. smalltext_out16(1, 4 * me_sfont_h, fname, 0xffff);
  142. dst += g_menuscreen_w * me_sfont_h * 3;
  143. if (len > g_menuscreen_w)
  144. len = g_menuscreen_w;
  145. for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_menuscreen_w)
  146. memset(dst, 0xff, len * 2);
  147. menu_draw_end();
  148. cdload_called = 1;
  149. }
  150. void menu_romload_prepare(const char *rom_name)
  151. {
  152. const char *p = rom_name + strlen(rom_name);
  153. int i;
  154. while (p > rom_name && *p != '/')
  155. p--;
  156. /* fill all buffers, callbacks won't update in full */
  157. for (i = 0; i < 3; i++) {
  158. menu_draw_begin(1, 1);
  159. smalltext_out16(1, 1, "Loading", 0xffff);
  160. smalltext_out16(1, me_sfont_h, p, 0xffff);
  161. menu_draw_end();
  162. }
  163. PicoCartLoadProgressCB = load_progress_cb;
  164. PicoCDLoadProgressCB = cdload_progress_cb;
  165. cdload_called = 0;
  166. }
  167. void menu_romload_end(void)
  168. {
  169. PicoCartLoadProgressCB = NULL;
  170. PicoCDLoadProgressCB = NULL;
  171. menu_draw_begin(0, 1);
  172. smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h,
  173. "Starting emulation...", 0xffff);
  174. menu_draw_end();
  175. }
  176. // ------------ patch/gg menu ------------
  177. static void draw_patchlist(int sel)
  178. {
  179. int max_cnt, start, i, pos, active;
  180. max_cnt = g_menuscreen_h / me_sfont_h;
  181. start = max_cnt / 2 - sel;
  182. menu_draw_begin(1, 0);
  183. for (i = 0; i < PicoPatchCount; i++) {
  184. pos = start + i;
  185. if (pos < 0) continue;
  186. if (pos >= max_cnt) break;
  187. active = PicoPatches[i].active;
  188. smalltext_out16(14, pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff);
  189. smalltext_out16(14 + me_sfont_w*4, pos * me_sfont_h, PicoPatches[i].name, active ? 0xfff6 : 0xffff);
  190. }
  191. pos = start + i;
  192. if (pos < max_cnt)
  193. smalltext_out16(14, pos * me_sfont_h, "done", 0xffff);
  194. text_out16(5, max_cnt / 2 * me_sfont_h, ">");
  195. menu_draw_end();
  196. }
  197. static void menu_loop_patches(void)
  198. {
  199. static int menu_sel = 0;
  200. int inp;
  201. for (;;)
  202. {
  203. draw_patchlist(menu_sel);
  204. inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R
  205. |PBTN_MOK|PBTN_MBACK, NULL, 33);
  206. if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }
  207. if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }
  208. if (inp &(PBTN_LEFT|PBTN_L)) { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }
  209. if (inp &(PBTN_RIGHT|PBTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }
  210. if (inp & PBTN_MOK) { // action
  211. if (menu_sel < PicoPatchCount)
  212. PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;
  213. else break;
  214. }
  215. if (inp & PBTN_MBACK)
  216. break;
  217. }
  218. }
  219. // -------------- key config --------------
  220. // PicoPad[] format: MXYZ SACB RLDU
  221. me_bind_action me_ctrl_actions[] =
  222. {
  223. { "UP ", 0x0001 },
  224. { "DOWN ", 0x0002 },
  225. { "LEFT ", 0x0004 },
  226. { "RIGHT ", 0x0008 },
  227. { "A ", 0x0040 },
  228. { "B ", 0x0010 },
  229. { "C ", 0x0020 },
  230. { "A turbo", 0x4000 },
  231. { "B turbo", 0x1000 },
  232. { "C turbo", 0x2000 },
  233. { "START ", 0x0080 },
  234. { "MODE ", 0x0800 },
  235. { "X ", 0x0400 },
  236. { "Y ", 0x0200 },
  237. { "Z ", 0x0100 },
  238. { NULL, 0 },
  239. };
  240. me_bind_action emuctrl_actions[] =
  241. {
  242. { "Load State ", PEV_STATE_LOAD },
  243. { "Save State ", PEV_STATE_SAVE },
  244. { "Prev Save Slot ", PEV_SSLOT_PREV },
  245. { "Next Save Slot ", PEV_SSLOT_NEXT },
  246. { "Switch Renderer ", PEV_SWITCH_RND },
  247. { "Volume Down ", PEV_VOL_DOWN },
  248. { "Volume Up ", PEV_VOL_UP },
  249. { "Fast forward ", PEV_FF },
  250. { "Enter Menu ", PEV_MENU },
  251. { "Pico Next page ", PEV_PICO_PNEXT },
  252. { "Pico Prev page ", PEV_PICO_PPREV },
  253. { "Pico Switch input", PEV_PICO_SWINP },
  254. { NULL, 0 }
  255. };
  256. static int key_config_loop_wrap(int id, int keys)
  257. {
  258. switch (id) {
  259. case MA_CTRL_PLAYER1:
  260. key_config_loop(me_ctrl_actions, array_size(me_ctrl_actions) - 1, 0);
  261. break;
  262. case MA_CTRL_PLAYER2:
  263. key_config_loop(me_ctrl_actions, array_size(me_ctrl_actions) - 1, 1);
  264. break;
  265. case MA_CTRL_EMU:
  266. key_config_loop(emuctrl_actions, array_size(emuctrl_actions) - 1, -1);
  267. break;
  268. default:
  269. break;
  270. }
  271. return 0;
  272. }
  273. static const char *mgn_dev_name(int id, int *offs)
  274. {
  275. const char *name = NULL;
  276. static int it = 0;
  277. if (id == MA_CTRL_DEV_FIRST)
  278. it = 0;
  279. for (; it < IN_MAX_DEVS; it++) {
  280. name = in_get_dev_name(it, 1, 1);
  281. if (name != NULL)
  282. break;
  283. }
  284. it++;
  285. return name;
  286. }
  287. static int mh_saveloadcfg(int id, int keys);
  288. static const char *mgn_saveloadcfg(int id, int *offs);
  289. static menu_entry e_menu_keyconfig[] =
  290. {
  291. mee_handler_id("Player 1", MA_CTRL_PLAYER1, key_config_loop_wrap),
  292. mee_handler_id("Player 2", MA_CTRL_PLAYER2, key_config_loop_wrap),
  293. mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap),
  294. mee_onoff ("6 button pad", MA_OPT_6BUTTON_PAD, PicoOpt, POPT_6BTN_PAD),
  295. mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30),
  296. mee_range ("Analog deadzone", MA_CTRL_DEADZONE, currentConfig.analog_deadzone, 1, 99),
  297. mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),
  298. mee_cust_nosave("Save cfg for loaded game", MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),
  299. mee_label (""),
  300. mee_label ("Input devices:"),
  301. mee_label_mk (MA_CTRL_DEV_FIRST, mgn_dev_name),
  302. mee_label_mk (MA_CTRL_DEV_NEXT, mgn_dev_name),
  303. mee_label_mk (MA_CTRL_DEV_NEXT, mgn_dev_name),
  304. mee_label_mk (MA_CTRL_DEV_NEXT, mgn_dev_name),
  305. mee_label_mk (MA_CTRL_DEV_NEXT, mgn_dev_name),
  306. mee_label_mk (MA_CTRL_DEV_NEXT, mgn_dev_name),
  307. mee_label_mk (MA_CTRL_DEV_NEXT, mgn_dev_name),
  308. mee_end,
  309. };
  310. static int menu_loop_keyconfig(int id, int keys)
  311. {
  312. static int sel = 0;
  313. me_enable(e_menu_keyconfig, MA_OPT_SAVECFG_GAME, rom_loaded);
  314. me_loop(e_menu_keyconfig, &sel);
  315. return 0;
  316. }
  317. // ------------ SCD options menu ------------
  318. static const char *mgn_cdopt_ra(int id, int *offs)
  319. {
  320. *offs = -5;
  321. if (PicoCDBuffers <= 0)
  322. return " OFF";
  323. sprintf(static_buff, "%5iK", PicoCDBuffers * 2);
  324. return static_buff;
  325. }
  326. static int mh_cdopt_ra(int id, int keys)
  327. {
  328. if (keys & PBTN_LEFT) {
  329. PicoCDBuffers >>= 1;
  330. if (PicoCDBuffers < 2)
  331. PicoCDBuffers = 0;
  332. } else {
  333. if (PicoCDBuffers <= 0)
  334. PicoCDBuffers = 1;
  335. PicoCDBuffers <<= 1;
  336. if (PicoCDBuffers > 8*1024)
  337. PicoCDBuffers = 8*1024; // 16M
  338. }
  339. return 0;
  340. }
  341. static const char h_cdleds[] = "Show power/CD LEDs of emulated console";
  342. static const char h_cdda[] = "Play audio tracks from mp3s/wavs/bins";
  343. static const char h_cdpcm[] = "Emulate PCM audio chip for effects/voices/music";
  344. static const char h_srcart[] = "Emulate the save RAM cartridge accessory\n"
  345. "most games don't need this";
  346. static const char h_scfx[] = "Emulate scale/rotate ASIC chip for graphics effects\n"
  347. "disable to improve performance";
  348. static const char h_bsync[] = "More accurate mode for CPUs (needed for some games)\n"
  349. "disable to improve performance";
  350. static menu_entry e_menu_cd_options[] =
  351. {
  352. mee_onoff_h("CD LEDs", MA_CDOPT_LEDS, currentConfig.EmuOpt, EOPT_EN_CD_LEDS, h_cdleds),
  353. mee_onoff_h("CDDA audio", MA_CDOPT_CDDA, PicoOpt, POPT_EN_MCD_CDDA, h_cdda),
  354. mee_onoff_h("PCM audio", MA_CDOPT_PCM, PicoOpt, POPT_EN_MCD_PCM, h_cdpcm),
  355. mee_cust ("ReadAhead buffer", MA_CDOPT_READAHEAD, mh_cdopt_ra, mgn_cdopt_ra),
  356. mee_onoff_h("SaveRAM cart", MA_CDOPT_SAVERAM, PicoOpt, POPT_EN_MCD_RAMCART, h_srcart),
  357. mee_onoff_h("Scale/Rot. fx (slow)", MA_CDOPT_SCALEROT_CHIP, PicoOpt, POPT_EN_MCD_GFX, h_scfx),
  358. mee_onoff_h("Better sync (slow)", MA_CDOPT_BETTER_SYNC, PicoOpt, POPT_EN_MCD_PSYNC, h_bsync),
  359. mee_end,
  360. };
  361. static int menu_loop_cd_options(int id, int keys)
  362. {
  363. static int sel = 0;
  364. me_loop(e_menu_cd_options, &sel);
  365. return 0;
  366. }
  367. // ------------ 32X options menu ------------
  368. #ifndef NO_32X
  369. // convert from multiplier of VClk
  370. static int mh_opt_sh2cycles(int id, int keys)
  371. {
  372. int *mul = (id == MA_32XOPT_MSH2_CYCLES) ? &p32x_msh2_multiplier : &p32x_ssh2_multiplier;
  373. if (keys & (PBTN_LEFT|PBTN_RIGHT))
  374. *mul += (keys & PBTN_LEFT) ? -10 : 10;
  375. if (keys & (PBTN_L|PBTN_R))
  376. *mul += (keys & PBTN_L) ? -100 : 100;
  377. if (*mul < 1)
  378. *mul = 1;
  379. else if (*mul > (10 << SH2_MULTI_SHIFT))
  380. *mul = 10 << SH2_MULTI_SHIFT;
  381. return 0;
  382. }
  383. static const char *mgn_opt_sh2cycles(int id, int *offs)
  384. {
  385. int mul = (id == MA_32XOPT_MSH2_CYCLES) ? p32x_msh2_multiplier : p32x_ssh2_multiplier;
  386. sprintf(static_buff, "%d", 7670 * mul >> SH2_MULTI_SHIFT);
  387. return static_buff;
  388. }
  389. static const char h_32x_enable[] = "Enable emulation of the 32X addon";
  390. static const char h_pwm[] = "Disabling may improve performance, but break sound";
  391. static const char h_sh2cycles[] = "Cycles/millisecond (similar to DOSBox)\n"
  392. "lower values speed up emulation but break games\n"
  393. "at least 11000 recommended for compatibility";
  394. static menu_entry e_menu_32x_options[] =
  395. {
  396. mee_onoff_h ("32X enabled", MA_32XOPT_ENABLE_32X, PicoOpt, POPT_EN_32X, h_32x_enable),
  397. mee_enum ("32X renderer", MA_32XOPT_RENDERER, currentConfig.renderer32x, renderer_names32x),
  398. mee_onoff_h ("PWM sound", MA_32XOPT_PWM, PicoOpt, POPT_EN_PWM, h_pwm),
  399. mee_cust_h ("Master SH2 cycles", MA_32XOPT_MSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),
  400. mee_cust_h ("Slave SH2 cycles", MA_32XOPT_SSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),
  401. mee_end,
  402. };
  403. static int menu_loop_32x_options(int id, int keys)
  404. {
  405. static int sel = 0;
  406. me_enable(e_menu_32x_options, MA_32XOPT_RENDERER, renderer_names32x[0] != NULL);
  407. me_loop(e_menu_32x_options, &sel);
  408. return 0;
  409. }
  410. #endif
  411. // ------------ adv options menu ------------
  412. static menu_entry e_menu_adv_options[] =
  413. {
  414. mee_onoff ("SRAM/BRAM saves", MA_OPT_SRAM_STATES, currentConfig.EmuOpt, EOPT_EN_SRAM),
  415. mee_onoff ("Disable sprite limit", MA_OPT2_NO_SPRITE_LIM, PicoOpt, POPT_DIS_SPRITE_LIM),
  416. mee_onoff ("Emulate Z80", MA_OPT2_ENABLE_Z80, PicoOpt, POPT_EN_Z80),
  417. mee_onoff ("Emulate YM2612 (FM)", MA_OPT2_ENABLE_YM2612, PicoOpt, POPT_EN_FM),
  418. mee_onoff ("Emulate SN76496 (PSG)", MA_OPT2_ENABLE_SN76496,PicoOpt, POPT_EN_PSG),
  419. mee_onoff ("gzip savestates", MA_OPT2_GZIP_STATES, currentConfig.EmuOpt, EOPT_GZIP_SAVES),
  420. mee_onoff ("Don't save last used ROM", MA_OPT2_NO_LAST_ROM, currentConfig.EmuOpt, EOPT_NO_AUTOSVCFG),
  421. mee_onoff ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoOpt, POPT_DIS_IDLE_DET),
  422. mee_onoff ("Disable frame limiter", MA_OPT2_NO_FRAME_LIMIT,currentConfig.EmuOpt, EOPT_NO_FRMLIMIT),
  423. MENU_OPTIONS_ADV
  424. mee_end,
  425. };
  426. static int menu_loop_adv_options(int id, int keys)
  427. {
  428. static int sel = 0;
  429. me_loop(e_menu_adv_options, &sel);
  430. return 0;
  431. }
  432. // ------------ gfx options menu ------------
  433. static const char h_gamma[] = "Gamma/brightness adjustment (default 100)";
  434. static menu_entry e_menu_gfx_options[] =
  435. {
  436. mee_enum ("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
  437. mee_enum ("Renderer", MA_OPT_RENDERER, currentConfig.renderer, renderer_names),
  438. mee_enum ("Filter", MA_OPT3_FILTERING, currentConfig.filter, men_dummy),
  439. mee_range_h("Gamma adjustment", MA_OPT3_GAMMA, currentConfig.gamma, 1, 200, h_gamma),
  440. MENU_OPTIONS_GFX
  441. mee_end,
  442. };
  443. static int menu_loop_gfx_options(int id, int keys)
  444. {
  445. static int sel = 0;
  446. me_enable(e_menu_gfx_options, MA_OPT_RENDERER, renderer_names[0] != NULL);
  447. me_loop(e_menu_gfx_options, &sel);
  448. return 0;
  449. }
  450. // ------------ options menu ------------
  451. static menu_entry e_menu_options[];
  452. static int sndrate_prevnext(int rate, int dir)
  453. {
  454. static const int rates[] = { 8000, 11025, 16000, 22050, 44100 };
  455. int i;
  456. for (i = 0; i < 5; i++)
  457. if (rates[i] == rate) break;
  458. i += dir ? 1 : -1;
  459. if (i > 4) {
  460. if (!(PicoOpt & POPT_EN_STEREO)) {
  461. PicoOpt |= POPT_EN_STEREO;
  462. return rates[0];
  463. }
  464. return rates[4];
  465. }
  466. if (i < 0) {
  467. if (PicoOpt & POPT_EN_STEREO) {
  468. PicoOpt &= ~POPT_EN_STEREO;
  469. return rates[4];
  470. }
  471. return rates[0];
  472. }
  473. return rates[i];
  474. }
  475. static void region_prevnext(int right)
  476. {
  477. // jp_ntsc=1, jp_pal=2, usa=4, eu=8
  478. static const int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };
  479. int i;
  480. if (right) {
  481. if (!PicoRegionOverride) {
  482. for (i = 0; i < 6; i++)
  483. if (rgn_orders[i] == PicoAutoRgnOrder) break;
  484. if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];
  485. else PicoRegionOverride=1;
  486. }
  487. else
  488. PicoRegionOverride <<= 1;
  489. if (PicoRegionOverride > 8)
  490. PicoRegionOverride = 8;
  491. } else {
  492. if (!PicoRegionOverride) {
  493. for (i = 0; i < 6; i++)
  494. if (rgn_orders[i] == PicoAutoRgnOrder) break;
  495. if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];
  496. }
  497. else
  498. PicoRegionOverride >>= 1;
  499. }
  500. }
  501. static int mh_opt_misc(int id, int keys)
  502. {
  503. switch (id) {
  504. case MA_OPT_SOUND_QUALITY:
  505. PsndRate = sndrate_prevnext(PsndRate, keys & PBTN_RIGHT);
  506. break;
  507. case MA_OPT_REGION:
  508. region_prevnext(keys & PBTN_RIGHT);
  509. break;
  510. default:
  511. break;
  512. }
  513. return 0;
  514. }
  515. static int mh_saveloadcfg(int id, int keys)
  516. {
  517. int ret;
  518. if (keys & (PBTN_LEFT|PBTN_RIGHT)) { // multi choice
  519. config_slot += (keys & PBTN_LEFT) ? -1 : 1;
  520. if (config_slot < 0) config_slot = 9;
  521. else if (config_slot > 9) config_slot = 0;
  522. me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);
  523. return 0;
  524. }
  525. switch (id) {
  526. case MA_OPT_SAVECFG:
  527. case MA_OPT_SAVECFG_GAME:
  528. if (emu_write_config(id == MA_OPT_SAVECFG_GAME ? 1 : 0))
  529. menu_update_msg("config saved");
  530. else
  531. menu_update_msg("failed to write config");
  532. break;
  533. case MA_OPT_LOADCFG:
  534. ret = emu_read_config(rom_fname_loaded, 1);
  535. if (!ret) ret = emu_read_config(NULL, 1);
  536. if (ret) menu_update_msg("config loaded");
  537. else menu_update_msg("failed to load config");
  538. break;
  539. default:
  540. return 0;
  541. }
  542. return 1;
  543. }
  544. static int mh_restore_defaults(int id, int keys)
  545. {
  546. emu_set_defconfig();
  547. menu_update_msg("defaults restored");
  548. return 1;
  549. }
  550. static const char *mgn_opt_fskip(int id, int *offs)
  551. {
  552. if (currentConfig.Frameskip < 0)
  553. return "Auto";
  554. sprintf(static_buff, "%d", currentConfig.Frameskip);
  555. return static_buff;
  556. }
  557. static const char *mgn_opt_sound(int id, int *offs)
  558. {
  559. const char *str2;
  560. *offs = -8;
  561. str2 = (PicoOpt & POPT_EN_STEREO) ? "stereo" : "mono";
  562. sprintf(static_buff, "%5iHz %s", PsndRate, str2);
  563. return static_buff;
  564. }
  565. static const char *mgn_opt_region(int id, int *offs)
  566. {
  567. static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };
  568. static const char *names_short[] = { "", " JP", " JP", " US", " EU" };
  569. int code = PicoRegionOverride;
  570. int u, i = 0;
  571. *offs = -6;
  572. if (code) {
  573. code <<= 1;
  574. while ((code >>= 1)) i++;
  575. if (i > 4)
  576. return "unknown";
  577. return names[i];
  578. } else {
  579. strcpy(static_buff, "Auto:");
  580. for (u = 0; u < 3; u++) {
  581. code = (PicoAutoRgnOrder >> u*4) & 0xf;
  582. for (i = 0; code; code >>= 1, i++)
  583. ;
  584. strcat(static_buff, names_short[i]);
  585. }
  586. return static_buff;
  587. }
  588. }
  589. static const char *mgn_saveloadcfg(int id, int *offs)
  590. {
  591. static_buff[0] = 0;
  592. if (config_slot != 0)
  593. sprintf(static_buff, "[%i]", config_slot);
  594. return static_buff;
  595. }
  596. static const char *men_confirm_save[] = { "OFF", "writes", "loads", "both", NULL };
  597. static const char h_confirm_save[] = "Ask for confirmation when overwriting save,\n"
  598. "loading state or both";
  599. static menu_entry e_menu_options[] =
  600. {
  601. mee_range ("Save slot", MA_OPT_SAVE_SLOT, state_slot, 0, 9),
  602. mee_range_cust("Frameskip", MA_OPT_FRAMESKIP, currentConfig.Frameskip, -1, 16, mgn_opt_fskip),
  603. mee_cust ("Region", MA_OPT_REGION, mh_opt_misc, mgn_opt_region),
  604. mee_onoff ("Show FPS", MA_OPT_SHOW_FPS, currentConfig.EmuOpt, EOPT_SHOW_FPS),
  605. mee_onoff ("Enable sound", MA_OPT_ENABLE_SOUND, currentConfig.EmuOpt, EOPT_EN_SOUND),
  606. mee_cust ("Sound Quality", MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound),
  607. mee_enum_h ("Confirm savestate", MA_OPT_CONFIRM_STATES,currentConfig.confirm_save, men_confirm_save, h_confirm_save),
  608. mee_range ("", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 1200),
  609. mee_handler ("[Display options]", menu_loop_gfx_options),
  610. mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options),
  611. #ifndef NO_32X
  612. mee_handler ("[32X options]", menu_loop_32x_options),
  613. #endif
  614. mee_handler ("[Advanced options]", menu_loop_adv_options),
  615. mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),
  616. mee_cust_nosave("Save cfg for loaded game",MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),
  617. mee_cust_nosave("Load cfg from profile", MA_OPT_LOADCFG, mh_saveloadcfg, mgn_saveloadcfg),
  618. mee_handler ("Restore defaults", mh_restore_defaults),
  619. mee_end,
  620. };
  621. static int menu_loop_options(int id, int keys)
  622. {
  623. static int sel = 0;
  624. int i;
  625. i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
  626. e_menu_options[i].enabled = e_menu_options[i].name[0] ? 1 : 0;
  627. me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, rom_loaded);
  628. me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);
  629. me_loop(e_menu_options, &sel);
  630. return 0;
  631. }
  632. // ------------ debug menu ------------
  633. #include <pico/debug.h>
  634. extern void SekStepM68k(void);
  635. static void mplayer_loop(void)
  636. {
  637. pemu_sound_start();
  638. while (1)
  639. {
  640. PDebugZ80Frame();
  641. if (in_menu_wait_any(NULL, 0) & PBTN_MA3)
  642. break;
  643. emu_sound_wait();
  644. }
  645. emu_sound_stop();
  646. }
  647. static void draw_text_debug(const char *str, int skip, int from)
  648. {
  649. const char *p;
  650. int line;
  651. p = str;
  652. while (skip-- > 0)
  653. {
  654. while (*p && *p != '\n')
  655. p++;
  656. if (*p == 0 || p[1] == 0)
  657. return;
  658. p++;
  659. }
  660. str = p;
  661. for (line = from; line < g_menuscreen_h / me_sfont_h; line++)
  662. {
  663. smalltext_out16(1, line * me_sfont_h, str, 0xffff);
  664. while (*p && *p != '\n')
  665. p++;
  666. if (*p == 0)
  667. break;
  668. p++; str = p;
  669. }
  670. }
  671. #ifdef __GNUC__
  672. #define COMPILER "gcc " __VERSION__
  673. #else
  674. #define COMPILER
  675. #endif
  676. static void draw_frame_debug(void)
  677. {
  678. char layer_str[48] = "layers: ";
  679. if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1);
  680. if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1);
  681. if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6);
  682. if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);
  683. if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4);
  684. pemu_forced_frame(1, 0);
  685. make_bg(1);
  686. smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff);
  687. smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff);
  688. }
  689. static void debug_menu_loop(void)
  690. {
  691. int inp, mode = 0;
  692. int spr_offs = 0, dumped = 0;
  693. char *tmp;
  694. while (1)
  695. {
  696. menu_draw_begin(1, 0);
  697. switch (mode)
  698. {
  699. case 0: tmp = PDebugMain();
  700. plat_debug_cat(tmp);
  701. draw_text_debug(tmp, 0, 0);
  702. if (dumped) {
  703. smalltext_out16(g_menuscreen_w - 6 * me_sfont_h,
  704. g_menuscreen_h - me_mfont_h, "dumped", 0xffff);
  705. dumped = 0;
  706. }
  707. break;
  708. case 1: draw_frame_debug();
  709. break;
  710. case 2: pemu_forced_frame(1, 0);
  711. make_bg(1);
  712. PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w +
  713. g_menuscreen_w/2 - 320/2, g_menuscreen_w);
  714. break;
  715. case 3: memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
  716. PDebugShowPalette(g_menuscreen_ptr, g_menuscreen_w);
  717. PDebugShowSprite((unsigned short *)g_menuscreen_ptr + g_menuscreen_w*120 + g_menuscreen_w/2 + 16,
  718. g_menuscreen_w, spr_offs);
  719. draw_text_debug(PDebugSpriteList(), spr_offs, 6);
  720. break;
  721. case 4: tmp = PDebug32x();
  722. draw_text_debug(tmp, 0, 0);
  723. break;
  724. }
  725. menu_draw_end();
  726. inp = in_menu_wait(PBTN_MOK|PBTN_MBACK|PBTN_MA2|PBTN_MA3|PBTN_L|PBTN_R |
  727. PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, NULL, 70);
  728. if (inp & PBTN_MBACK) return;
  729. if (inp & PBTN_L) { mode--; if (mode < 0) mode = 4; }
  730. if (inp & PBTN_R) { mode++; if (mode > 4) mode = 0; }
  731. switch (mode)
  732. {
  733. case 0:
  734. if (inp & PBTN_MOK)
  735. PDebugCPUStep();
  736. if (inp & PBTN_MA3) {
  737. while (inp & PBTN_MA3)
  738. inp = in_menu_wait_any(NULL, -1);
  739. mplayer_loop();
  740. }
  741. if ((inp & (PBTN_MA2|PBTN_LEFT)) == (PBTN_MA2|PBTN_LEFT)) {
  742. mkdir("dumps", 0777);
  743. PDebugDumpMem();
  744. while (inp & PBTN_MA2) inp = in_menu_wait_any(NULL, -1);
  745. dumped = 1;
  746. }
  747. break;
  748. case 1:
  749. if (inp & PBTN_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;
  750. if (inp & PBTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;
  751. if (inp & PBTN_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;
  752. if (inp & PBTN_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;
  753. if (inp & PBTN_MA2) PicoDrawMask ^= PDRAW_32X_ON;
  754. if (inp & PBTN_MOK) {
  755. PsndOut = NULL; // just in case
  756. PicoSkipFrame = 1;
  757. PicoFrame();
  758. PicoSkipFrame = 0;
  759. while (inp & PBTN_MOK) inp = in_menu_wait_any(NULL, -1);
  760. }
  761. break;
  762. case 3:
  763. if (inp & PBTN_DOWN) spr_offs++;
  764. if (inp & PBTN_UP) spr_offs--;
  765. if (spr_offs < 0) spr_offs = 0;
  766. break;
  767. }
  768. }
  769. }
  770. // ------------ main menu ------------
  771. static const char credits[] =
  772. "PicoDrive v" VERSION " (c) notaz, 2006-2011\n\n\n"
  773. "Credits:\n"
  774. "fDave: Cyclone 68000 core,\n"
  775. " base code of PicoDrive\n"
  776. "Reesy & FluBBa: DrZ80 core\n"
  777. "MAME devs: YM2612 and SN76496 cores\n"
  778. "Inder, ketchupgun: graphics\n"
  779. #ifdef __GP2X__
  780. "rlyeh and others: minimal SDK\n"
  781. "Squidge: mmuhack\n"
  782. "Dzz: ARM940 sample\n"
  783. #endif
  784. "\n"
  785. "special thanks (for docs, ideas):\n"
  786. " Charles MacDonald, Haze,\n"
  787. " Stephane Dallongeville,\n"
  788. " Lordus, Exophase, Rokas,\n"
  789. " Nemesis, Tasco Deluxe";
  790. static int main_menu_handler(int id, int keys)
  791. {
  792. const char *ret_name;
  793. switch (id)
  794. {
  795. case MA_MAIN_RESUME_GAME:
  796. if (rom_loaded)
  797. return 1;
  798. break;
  799. case MA_MAIN_SAVE_STATE:
  800. if (rom_loaded)
  801. return menu_loop_savestate(0);
  802. break;
  803. case MA_MAIN_LOAD_STATE:
  804. if (rom_loaded)
  805. return menu_loop_savestate(1);
  806. break;
  807. case MA_MAIN_RESET_GAME:
  808. if (rom_loaded) {
  809. emu_reset_game();
  810. return 1;
  811. }
  812. break;
  813. case MA_MAIN_LOAD_ROM:
  814. rom_fname_reload = NULL;
  815. ret_name = menu_loop_romsel(rom_fname_loaded,
  816. sizeof(rom_fname_loaded), rom_exts, NULL);
  817. if (ret_name != NULL) {
  818. lprintf("selected file: %s\n", ret_name);
  819. rom_fname_reload = ret_name;
  820. engineState = PGS_ReloadRom;
  821. return 1;
  822. }
  823. break;
  824. case MA_MAIN_CREDITS:
  825. draw_menu_message(credits, NULL);
  826. in_menu_wait(PBTN_MOK|PBTN_MBACK, NULL, 70);
  827. break;
  828. case MA_MAIN_EXIT:
  829. engineState = PGS_Quit;
  830. return 1;
  831. case MA_MAIN_PATCHES:
  832. if (rom_loaded && PicoPatches) {
  833. menu_loop_patches();
  834. PicoPatchApply();
  835. menu_update_msg("Patches applied");
  836. }
  837. break;
  838. default:
  839. lprintf("%s: something unknown selected\n", __FUNCTION__);
  840. break;
  841. }
  842. return 0;
  843. }
  844. static menu_entry e_menu_main[] =
  845. {
  846. mee_label ("PicoDrive " VERSION),
  847. mee_label (""),
  848. mee_label (""),
  849. mee_label (""),
  850. mee_handler_id("Resume game", MA_MAIN_RESUME_GAME, main_menu_handler),
  851. mee_handler_id("Save State", MA_MAIN_SAVE_STATE, main_menu_handler),
  852. mee_handler_id("Load State", MA_MAIN_LOAD_STATE, main_menu_handler),
  853. mee_handler_id("Reset game", MA_MAIN_RESET_GAME, main_menu_handler),
  854. mee_handler_id("Load new ROM/ISO", MA_MAIN_LOAD_ROM, main_menu_handler),
  855. mee_handler ("Change options", menu_loop_options),
  856. mee_handler ("Configure controls", menu_loop_keyconfig),
  857. mee_handler_id("Credits", MA_MAIN_CREDITS, main_menu_handler),
  858. mee_handler_id("Patches / GameGenie",MA_MAIN_PATCHES, main_menu_handler),
  859. mee_handler_id("Exit", MA_MAIN_EXIT, main_menu_handler),
  860. mee_end,
  861. };
  862. void menu_loop(void)
  863. {
  864. static int sel = 0;
  865. me_enable(e_menu_main, MA_MAIN_RESUME_GAME, rom_loaded);
  866. me_enable(e_menu_main, MA_MAIN_SAVE_STATE, rom_loaded);
  867. me_enable(e_menu_main, MA_MAIN_LOAD_STATE, rom_loaded);
  868. me_enable(e_menu_main, MA_MAIN_RESET_GAME, rom_loaded);
  869. me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
  870. menu_enter(rom_loaded);
  871. in_set_config_int(0, IN_CFG_BLOCKING, 1);
  872. me_loop_d(e_menu_main, &sel, NULL, menu_main_plat_draw);
  873. if (rom_loaded) {
  874. if (engineState == PGS_Menu)
  875. engineState = PGS_Running;
  876. /* wait until menu, ok, back is released */
  877. while (in_menu_wait_any(NULL, 50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK))
  878. ;
  879. }
  880. in_set_config_int(0, IN_CFG_BLOCKING, 0);
  881. plat_video_menu_leave();
  882. }
  883. // --------- CD tray close menu ----------
  884. static int mh_tray_load_cd(int id, int keys)
  885. {
  886. const char *ret_name;
  887. rom_fname_reload = NULL;
  888. ret_name = menu_loop_romsel(rom_fname_loaded,
  889. sizeof(rom_fname_loaded), rom_exts, NULL);
  890. if (ret_name == NULL)
  891. return 0;
  892. rom_fname_reload = ret_name;
  893. engineState = PGS_RestartRun;
  894. return emu_swap_cd(ret_name);
  895. }
  896. static int mh_tray_nothing(int id, int keys)
  897. {
  898. return 1;
  899. }
  900. static menu_entry e_menu_tray[] =
  901. {
  902. mee_label ("The CD tray has opened."),
  903. mee_label (""),
  904. mee_label (""),
  905. mee_handler("Load CD image", mh_tray_load_cd),
  906. mee_handler("Insert nothing", mh_tray_nothing),
  907. mee_end,
  908. };
  909. int menu_loop_tray(void)
  910. {
  911. int ret = 1, sel = 0;
  912. menu_enter(rom_loaded);
  913. in_set_config_int(0, IN_CFG_BLOCKING, 1);
  914. me_loop(e_menu_tray, &sel);
  915. if (engineState != PGS_RestartRun) {
  916. engineState = PGS_RestartRun;
  917. ret = 0; /* no CD inserted */
  918. }
  919. while (in_menu_wait_any(NULL, 50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK));
  920. in_set_config_int(0, IN_CFG_BLOCKING, 0);
  921. plat_video_menu_leave();
  922. return ret;
  923. }
  924. void menu_update_msg(const char *msg)
  925. {
  926. strncpy(menu_error_msg, msg, sizeof(menu_error_msg));
  927. menu_error_msg[sizeof(menu_error_msg) - 1] = 0;
  928. menu_error_time = plat_get_ticks_ms();
  929. lprintf("msg: %s\n", menu_error_msg);
  930. }
  931. // ------------ util ------------
  932. /* hidden options for config engine only */
  933. static menu_entry e_menu_hidden[] =
  934. {
  935. mee_onoff("Accurate sprites", MA_OPT_ACC_SPRITES, PicoOpt, 0x080),
  936. mee_end,
  937. };
  938. static menu_entry *e_menu_table[] =
  939. {
  940. e_menu_options,
  941. e_menu_gfx_options,
  942. e_menu_adv_options,
  943. e_menu_cd_options,
  944. #ifndef NO_32X
  945. e_menu_32x_options,
  946. #endif
  947. e_menu_keyconfig,
  948. e_menu_hidden,
  949. };
  950. static menu_entry *me_list_table = NULL;
  951. static menu_entry *me_list_i = NULL;
  952. menu_entry *me_list_get_first(void)
  953. {
  954. me_list_table = me_list_i = e_menu_table[0];
  955. return me_list_i;
  956. }
  957. menu_entry *me_list_get_next(void)
  958. {
  959. int i;
  960. me_list_i++;
  961. if (me_list_i->name != NULL)
  962. return me_list_i;
  963. for (i = 0; i < array_size(e_menu_table); i++)
  964. if (me_list_table == e_menu_table[i])
  965. break;
  966. if (i + 1 < array_size(e_menu_table))
  967. me_list_table = me_list_i = e_menu_table[i + 1];
  968. else
  969. me_list_table = me_list_i = NULL;
  970. return me_list_i;
  971. }
  972. void menu_init(void)
  973. {
  974. int i;
  975. menu_init_base();
  976. i = me_id2offset(e_menu_gfx_options, MA_OPT_VOUT_MODE);
  977. e_menu_gfx_options[i].data = plat_target.vout_methods;
  978. me_enable(e_menu_gfx_options, MA_OPT_VOUT_MODE,
  979. plat_target.vout_methods != NULL);
  980. i = me_id2offset(e_menu_gfx_options, MA_OPT3_FILTERING);
  981. e_menu_gfx_options[i].data = plat_target.hwfilters;
  982. me_enable(e_menu_gfx_options, MA_OPT3_FILTERING,
  983. plat_target.hwfilters != NULL);
  984. me_enable(e_menu_gfx_options, MA_OPT3_GAMMA,
  985. plat_target.gamma_set != NULL);
  986. }