+// ------------ 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
+ int *mul = (id == MA_32XOPT_MSH2_CYCLES) ? &p32x_msh2_multiplier : &p32x_ssh2_multiplier;\r
+\r
+ if (keys & (PBTN_LEFT|PBTN_RIGHT))\r
+ *mul += (keys & PBTN_LEFT) ? -10 : 10;\r
+ if (keys & (PBTN_L|PBTN_R))\r
+ *mul += (keys & PBTN_L) ? -100 : 100;\r
+\r
+ if (*mul < 1)\r
+ *mul = 1;\r
+ else if (*mul > (10 << SH2_MULTI_SHIFT))\r
+ *mul = 10 << SH2_MULTI_SHIFT;\r
+\r
+ return 0;\r
+}\r
+\r
+static const char *mgn_opt_sh2cycles(menu_id id, int *offs)\r
+{\r
+ int mul = (id == MA_32XOPT_MSH2_CYCLES) ? p32x_msh2_multiplier : p32x_ssh2_multiplier;\r
+ \r
+ sprintf(static_buff, "%d", 7670 * mul >> SH2_MULTI_SHIFT);\r
+ return static_buff;\r
+}\r
+\r
+static const char h_32x_enable[] = "Enable emulation of the 32X addon";\r
+static const char h_pwm[] = "Disabling may improve performance, but break sound";\r
+static const char h_sh2cycles[] = "Cycles/millisecond (similar to DOSBox)\n"\r
+ "lower values speed up emulation but break games\n"\r
+ "at least 11000 recommended for compatibility";\r
+\r
+static menu_entry e_menu_32x_options[] =\r
+{\r
+ mee_onoff_h ("32X enabled", MA_32XOPT_ENABLE_32X, PicoOpt, POPT_EN_32X, h_32x_enable),\r
+ mee_enum ("32X renderer", MA_32XOPT_RENDERER, currentConfig.renderer32x, renderer_names32x),\r
+ mee_onoff_h ("PWM sound", MA_32XOPT_PWM, PicoOpt, POPT_EN_PWM, h_pwm),\r
+ mee_cust_h ("Master SH2 cycles", MA_32XOPT_MSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),\r
+ mee_cust_h ("Slave SH2 cycles", MA_32XOPT_SSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),\r
+ mee_end,\r
+};\r
+\r
+static int menu_loop_32x_options(menu_id id, int keys)\r
+{\r
+ static int sel = 0;\r
+\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