-// (c) Copyright 2006,2007 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
+/*\r
+ * PicoDrive\r
+ * (C) notaz, 2006-2008\r
+ *\r
+ * This work is licensed under the terms of MAME license.\r
+ * See COPYING file in the top-level directory.\r
+ */\r
\r
// don't like to use loads of #ifdefs, so duplicating GP2X code\r
// horribly instead\r
#include "../common/menu.h"\r
#include "../common/emu.h"\r
#include "../common/readpng.h"\r
-#include "version.h"\r
+#include "../common/input.h"\r
+#include "../common/version.h"\r
\r
-#include <Pico/PicoInt.h>\r
-#include <Pico/Patch.h>\r
-#include <zlib/zlib.h>\r
+#include <pico/pico_int.h>\r
+#include <pico/patch.h>\r
+#include <zlib.h>\r
\r
\r
#define gizKeyUnkn "???"\r
void menu_darken_bg(void *dst, const void *src, int pixels, int darker);\r
static void menu_prepare_bg(int use_game_bg);\r
\r
-static unsigned int inp_prev = 0;\r
-\r
-unsigned long wait_for_input(unsigned int interesting)\r
-{\r
- unsigned long ret;\r
- static int repeats = 0, wait = 20;\r
- int release = 0, i;\r
-\r
- if (repeats == 2) wait = 3;\r
- else if (repeats == 4) wait = 2;\r
- else if (repeats == 6) wait = 1;\r
-\r
- for (i = 0; i < wait && inp_prev == Framework_PollGetButtons(); i++) {\r
- if (i == 0) repeats++;\r
- Sleep(30);\r
- }\r
-\r
- while ( !((ret = Framework_PollGetButtons()) & interesting) ) {\r
- Sleep(50);\r
- release = 1;\r
- }\r
-\r
- if (release || ret != inp_prev) {\r
- repeats = 0;\r
- wait = 20;\r
- }\r
- if (wait > 6 && (ret&(BTN_UP|BTN_LEFT|BTN_DOWN|BTN_RIGHT|BTN_L|BTN_R)))\r
- wait = 6;\r
- inp_prev = ret;\r
-\r
- // we don't need diagonals in menus\r
- if ((ret&BTN_UP) && (ret&BTN_LEFT)) ret &= ~BTN_LEFT;\r
- if ((ret&BTN_UP) && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;\r
- if ((ret&BTN_DOWN) && (ret&BTN_LEFT)) ret &= ~BTN_LEFT;\r
- if ((ret&BTN_DOWN) && (ret&BTN_RIGHT)) ret &= ~BTN_RIGHT;\r
-\r
- return ret;\r
-}\r
-\r
-\r
void menu_draw_begin(int use_bgbuff)\r
{\r
if (use_bgbuff)\r
- memcpy32((int *)menu_screen, (int *)bg_buffer, 321*240*2/4);\r
+ memcpy((int *)menu_screen, (int *)bg_buffer, 321*240*2);\r
}\r
\r
\r
lprintf("%s: Framework2D_LockBuffer() returned NULL\n", __FUNCTION__);\r
return;\r
}\r
- memcpy32(giz_screen, (int *)menu_screen, 321*240*2/4);\r
+ memcpy(giz_screen, (int *)menu_screen, 321*240*2);\r
fb_unlock();\r
giz_screen = NULL;\r
fb_flip();\r
for (;;)\r
{\r
draw_dirlist(curr_path, namelist, n, sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_PLAY|BTN_STOP);\r
- if(inp & BTN_UP ) { sel--; if (sel < 0) sel = n-2; }\r
- if(inp & BTN_DOWN) { sel++; if (sel > n-2) sel = 0; }\r
- if(inp & BTN_LEFT) { sel-=10; if (sel < 0) sel = 0; }\r
- if(inp & BTN_L) { sel-=24; if (sel < 0) sel = 0; }\r
- if(inp & BTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }\r
- if(inp & BTN_R) { sel+=24; if (sel > n-2) sel = n-2; }\r
- if(inp & BTN_PLAY) { // enter dir/select\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R|PBTN_PLAY|PBTN_STOP);\r
+ if(inp & PBTN_UP ) { sel--; if (sel < 0) sel = n-2; }\r
+ if(inp & PBTN_DOWN) { sel++; if (sel > n-2) sel = 0; }\r
+ if(inp & PBTN_LEFT) { sel-=10; if (sel < 0) sel = 0; }\r
+ if(inp & PBTN_L) { sel-=24; if (sel < 0) sel = 0; }\r
+ if(inp & PBTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }\r
+ if(inp & PBTN_R) { sel+=24; if (sel > n-2) sel = n-2; }\r
+ if(inp & PBTN_PLAY) { // enter dir/select\r
if (namelist[sel+1]->d_type == DT_REG) {\r
strcpy(romFileName, curr_path);\r
strcat(romFileName, "/");\r
break;\r
}\r
}\r
- if(inp & BTN_STOP) break; // cancel\r
+ if(inp & PBTN_STOP) break; // cancel\r
}\r
\r
if (n > 0) {\r
for(;;)\r
{\r
draw_patchlist(menu_sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_L|BTN_R|BTN_PLAY|BTN_STOP);\r
- if(inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }\r
- if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }\r
- if(inp &(BTN_LEFT|BTN_L)) { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }\r
- if(inp &(BTN_RIGHT|BTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }\r
- if(inp & BTN_PLAY) { // action\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_L|PBTN_R|PBTN_PLAY|PBTN_STOP);\r
+ if(inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }\r
+ if(inp & PBTN_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }\r
+ if(inp &(PBTN_LEFT|PBTN_L)) { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }\r
+ if(inp &(PBTN_RIGHT|PBTN_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }\r
+ if(inp & PBTN_PLAY) { // action\r
if (menu_sel < PicoPatchCount)\r
PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;\r
else return;\r
}\r
- if(inp & BTN_STOP) return;\r
+ if(inp & PBTN_STOP) return;\r
}\r
\r
}\r
}\r
\r
if (file) {\r
- if (PicoAHW & 1) {\r
+ if (PicoIn.AHW & 1) {\r
PicoCdLoadStateGfx(file);\r
} else {\r
areaSeek(file, 0x10020, SEEK_SET); // skip header and RAM in state file\r
for(;;)\r
{\r
draw_savestate_menu(menu_sel, is_loading);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP);\r
- if(inp & BTN_UP ) {\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_PLAY|PBTN_STOP);\r
+ if(inp & PBTN_UP ) {\r
do {\r
menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max;\r
} while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);\r
}\r
- if(inp & BTN_DOWN) {\r
+ if(inp & PBTN_DOWN) {\r
do {\r
menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0;\r
} while (!(state_slot_flags & (1 << menu_sel)) && menu_sel != menu_sel_max && is_loading);\r
}\r
- if(inp & BTN_PLAY) { // save/load\r
+ if(inp & PBTN_PLAY) { // save/load\r
if (menu_sel < 10) {\r
state_slot = menu_sel;\r
PicoStateProgressCB = emu_stateCb; /* also suitable for menu */\r
return 0;\r
} else return 1;\r
}\r
- if(inp & BTN_STOP) return 1;\r
+ if(inp & PBTN_STOP) return 1;\r
}\r
}\r
\r
for (;;)\r
{\r
draw_key_config(opts, opt_cnt, player_idx, sel);\r
- inp = wait_for_input(CONFIGURABLE_KEYS|BTN_HOME);\r
- if (!(inp & BTN_HOME)) {\r
+ inp = in_menu_wait(CONFIGURABLE_KEYS|PBTN_HOME);\r
+ if (!(inp & PBTN_HOME)) {\r
prev_select = 0;\r
- if(inp & BTN_UP ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }\r
- if(inp & BTN_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }\r
+ if(inp & PBTN_UP ) { sel--; if (sel < 0) sel = menu_sel_max; continue; }\r
+ if(inp & PBTN_DOWN) { sel++; if (sel > menu_sel_max) sel = 0; continue; }\r
}\r
if (sel >= opt_cnt) {\r
- if (inp & (BTN_PLAY|BTN_STOP)) break;\r
+ if (inp & (PBTN_PLAY|PBTN_STOP)) break;\r
else continue;\r
}\r
// if we are here, we want to bind/unbind something\r
- if ((inp & BTN_HOME) && !prev_select)\r
+ if ((inp & PBTN_HOME) && !prev_select)\r
unbind_action(opts[sel].mask);\r
- prev_select = inp & BTN_HOME;\r
+ prev_select = inp & PBTN_HOME;\r
inp &= CONFIGURABLE_KEYS;\r
- inp &= ~BTN_HOME;\r
+ inp &= ~PBTN_HOME;\r
for (i = 0; i < 32; i++)\r
if (inp & (1 << i)) {\r
if (count_bound_keys(opts[sel].mask, player_idx) >= 2)\r
{ "Player 1", MB_NONE, MA_CTRL_PLAYER1, NULL, 0, 0, 0, 1, 0 },\r
{ "Player 2", MB_NONE, MA_CTRL_PLAYER2, NULL, 0, 0, 0, 1, 0 },\r
{ "Emulator controls", MB_NONE, MA_CTRL_EMU, NULL, 0, 0, 0, 1, 0 },\r
- { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },\r
+ { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoIn.opt, 0x020, 0, 0, 1, 1 },\r
{ "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, ¤tConfig.turbo_rate, 0, 1, 30, 1, 1 },\r
{ "Done", MB_NONE, MA_CTRL_DONE, NULL, 0, 0, 0, 1, 0 },\r
};\r
while (1)\r
{\r
draw_kc_sel(menu_sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP);\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_PLAY|PBTN_STOP);\r
selected_id = me_index2id(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, menu_sel);\r
- if (inp & (BTN_LEFT|BTN_RIGHT)) // multi choise\r
- me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0);\r
- if (inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
- if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
- if (inp & BTN_PLAY) {\r
- int is_6button = PicoOpt & 0x020;\r
+ if (inp & (PBTN_LEFT|PBTN_RIGHT)) // multi choise\r
+ me_process(ctrlopt_entries, CTRLOPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0);\r
+ if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+ if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+ if (inp & PBTN_PLAY) {\r
+ int is_6button = PicoIn.opt & 0x020;\r
switch (selected_id) {\r
case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;\r
case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;\r
default: return;\r
}\r
}\r
- if (inp & BTN_STOP) return;\r
+ if (inp & PBTN_STOP) return;\r
}\r
}\r
\r
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 },\r
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 },\r
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },\r
- { "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },\r
- { "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },\r
+ { "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoIn.opt, 0x0800, 0, 0, 1, 1 },\r
+ { "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoIn.opt, 0x0400, 0, 0, 1, 1 },\r
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },\r
- { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },\r
- { "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },\r
- { "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 },\r
+ { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoIn.opt, 0x8000, 0, 0, 1, 1 },\r
+ { "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoIn.opt, 0x1000, 0, 0, 1, 1 },\r
+ { "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoIn.opt, 0x2000, 0, 0, 1, 1 },\r
{ "done", MB_NONE, MA_CDOPT_DONE, NULL, 0, 0, 0, 1, 0 },\r
};\r
\r
for(;;)\r
{\r
draw_cd_menu_options(menu_sel, &bios_names);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_PLAY|BTN_STOP|BTN_REW);\r
- if (inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
- if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_PLAY|PBTN_STOP|PBTN_REW);\r
+ if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+ if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
selected_id = me_index2id(cdopt_entries, CDOPT_ENTRY_COUNT, menu_sel);\r
- if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise\r
- if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) &&\r
+ if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise\r
+ if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0) &&\r
selected_id == MA_CDOPT_READAHEAD) {\r
- if (inp & BTN_LEFT) {\r
+ if (inp & PBTN_LEFT) {\r
PicoCDBuffers >>= 1;\r
if (PicoCDBuffers < 2) PicoCDBuffers = 0;\r
} else {\r
}\r
}\r
}\r
- if (inp & BTN_PLAY) { // toggleable options\r
+ if (inp & PBTN_PLAY) { // toggleable options\r
if (!me_process(cdopt_entries, CDOPT_ENTRY_COUNT, selected_id, 1) &&\r
selected_id == MA_CDOPT_DONE) {\r
return;\r
break;\r
}\r
}\r
- if (inp & (BTN_STOP|BTN_REW)) return;\r
+ if (inp & (PBTN_STOP|PBTN_REW)) return;\r
}\r
}\r
\r
\r
menu_entry opt2_entries[] =\r
{\r
- { "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },\r
- { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },\r
- { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },\r
- { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },\r
+ { "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoIn.opt, 0x40000, 0, 0, 1, 1 },\r
+ { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoIn.opt, 0x00004, 0, 0, 1, 1 },\r
+ { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoIn.opt, 0x00001, 0, 0, 1, 1 },\r
+ { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoIn.opt, 0x00002, 0, 0, 1, 1 },\r
+ { "Emulate YM2413 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2413, &PicoIn.opt, 0x00020, 0, 0, 1, 1 },\r
{ "Double buffering", MB_ONOFF, MA_OPT2_DBLBUFF, ¤tConfig.EmuOpt, 0x8000, 0, 0, 1, 1 },\r
{ "Wait for V-sync (slow)", MB_ONOFF, MA_OPT2_VSYNC, ¤tConfig.EmuOpt, 0x2000, 0, 0, 1, 1 },\r
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },\r
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x0020, 0, 0, 1, 1 },\r
- { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 },\r
- { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },\r
+ { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoIn.opt, 0x20000, 0, 0, 1, 1 },\r
+ { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoIn.opt, 0x80000, 0, 0, 1, 1 },\r
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 },\r
};\r
\r
for(;;)\r
{\r
draw_amenu_options(menu_sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_PLAY|BTN_STOP|BTN_REW);\r
- if (inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
- if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_PLAY|PBTN_STOP|PBTN_REW);\r
+ if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+ if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
selected_id = me_index2id(opt2_entries, OPT2_ENTRY_COUNT, menu_sel);\r
- if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise\r
- if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0) &&\r
+ if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise\r
+ if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0) &&\r
selected_id == MA_OPT2_GAMMA) {\r
- while ((inp = Framework_PollGetButtons()) & (BTN_LEFT|BTN_RIGHT)) {\r
- currentConfig.gamma += (inp & BTN_LEFT) ? -1 : 1;\r
+ while ((inp = Framework_PollGetButtons()) & (PBTN_LEFT|PBTN_RIGHT)) {\r
+ currentConfig.gamma += (inp & PBTN_LEFT) ? -1 : 1;\r
if (currentConfig.gamma < 1) currentConfig.gamma = 1;\r
if (currentConfig.gamma > 300) currentConfig.gamma = 300;\r
draw_amenu_options(menu_sel);\r
}\r
}\r
}\r
- if (inp & BTN_PLAY) { // toggleable options\r
+ if (inp & PBTN_PLAY) { // toggleable options\r
if (!me_process(opt2_entries, OPT2_ENTRY_COUNT, selected_id, 1) &&\r
selected_id == MA_OPT2_DONE) {\r
return;\r
}\r
}\r
- if (inp & (BTN_STOP|BTN_REW)) return;\r
+ if (inp & (PBTN_STOP|PBTN_REW)) return;\r
}\r
}\r
\r
menu_entry opt_entries[] =\r
{\r
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },\r
- { "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },\r
+ { "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoIn.opt, 0x080, 0, 0, 0, 1 },\r
{ "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, ¤tConfig.EmuOpt, 0x4000, 0, 0, 1, 1 },\r
{ "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, ¤tConfig.scaling, 0x0001, 0, 3, 1, 1 },\r
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1, 1 },\r
switch (entry->id)\r
{\r
case MA_OPT_RENDERER:\r
- if (PicoOpt&0x10)\r
+ if (PicoIn.opt&0x10)\r
str = " 8bit fast";\r
else if (currentConfig.EmuOpt&0x80)\r
str = "16bit accurate";\r
text_out16(x, y, "Frameskip %s", str24);\r
break;\r
case MA_OPT_SOUND_QUALITY:\r
- str = (PicoOpt&0x08)?"stereo":"mono";\r
- text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);\r
+ str = (PicoIn.opt&0x08)?"stereo":"mono";\r
+ text_out16(x, y, "Sound Quality: %5iHz %s", PicoIn.sndRate, str);\r
break;\r
case MA_OPT_REGION:\r
- text_out16(x, y, "Region: %s", me_region_name(PicoRegionOverride, PicoAutoRgnOrder));\r
+ text_out16(x, y, "Region: %s", me_region_name(PicoIn.regionOverride, PicoIn.autoRgnOrder));\r
break;\r
case MA_OPT_CONFIRM_STATES:\r
switch ((currentConfig.EmuOpt >> 9) & 5) {\r
static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };\r
int i;\r
if (right) {\r
- if (!PicoRegionOverride) {\r
+ if (!PicoIn.regionOverride) {\r
for (i = 0; i < 6; i++)\r
- if (rgn_orders[i] == PicoAutoRgnOrder) break;\r
- if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];\r
- else PicoRegionOverride=1;\r
+ if (rgn_orders[i] == PicoIn.autoRgnOrder) break;\r
+ if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];\r
+ else PicoIn.regionOverride=1;\r
}\r
- else PicoRegionOverride<<=1;\r
- if (PicoRegionOverride > 8) PicoRegionOverride = 8;\r
+ else PicoIn.regionOverride<<=1;\r
+ if (PicoIn.regionOverride > 8) PicoIn.regionOverride = 8;\r
} else {\r
- if (!PicoRegionOverride) {\r
+ if (!PicoIn.regionOverride) {\r
for (i = 0; i < 6; i++)\r
- if (rgn_orders[i] == PicoAutoRgnOrder) break;\r
- if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];\r
+ if (rgn_orders[i] == PicoIn.autoRgnOrder) break;\r
+ if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];\r
}\r
- else PicoRegionOverride>>=1;\r
+ else PicoIn.regionOverride>>=1;\r
}\r
}\r
\r
static void menu_options_save(void)\r
{\r
- if (PicoRegionOverride) {\r
+ if (PicoIn.regionOverride) {\r
// force setting possibly changed..\r
- Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;\r
+ Pico.m.pal = (PicoIn.regionOverride == 2 || PicoIn.regionOverride == 8) ? 1 : 0;\r
}\r
- if (!(PicoOpt & 0x20)) {\r
+ if (!(PicoIn.opt & 0x20)) {\r
// unbind XYZ MODE, just in case\r
unbind_action(0xf00);\r
}\r
while (1)\r
{\r
draw_menu_options(menu_sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_PLAY|BTN_STOP|BTN_REW);\r
- if (inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
- if (inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_PLAY|PBTN_STOP|PBTN_REW);\r
+ if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+ if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
selected_id = me_index2id(opt_entries, OPT_ENTRY_COUNT, menu_sel);\r
- if (inp & (BTN_LEFT|BTN_RIGHT)) { // multi choise\r
- if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0)) {\r
+ if (inp & (PBTN_LEFT|PBTN_RIGHT)) { // multi choise\r
+ if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0)) {\r
switch (selected_id) {\r
case MA_OPT_RENDERER:\r
- if (inp & BTN_LEFT) {\r
- if ((PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) {\r
- PicoOpt&= ~0x10;\r
+ if (inp & PBTN_LEFT) {\r
+ if ((PicoIn.opt&0x10) || !(currentConfig.EmuOpt &0x80)) {\r
+ PicoIn.opt&= ~0x10;\r
currentConfig.EmuOpt |= 0x80;\r
}\r
} else {\r
- if (!(PicoOpt&0x10) || (currentConfig.EmuOpt &0x80)) {\r
- PicoOpt|= 0x10;\r
+ if (!(PicoIn.opt&0x10) || (currentConfig.EmuOpt &0x80)) {\r
+ PicoIn.opt|= 0x10;\r
currentConfig.EmuOpt &= ~0x80;\r
}\r
}\r
break;\r
case MA_OPT_SOUND_QUALITY:\r
- if ((inp & BTN_RIGHT) && PsndRate == 44100 &&\r
- !(PicoOpt&0x08))\r
+ if ((inp & PBTN_RIGHT) && PicoIn.sndRate == 44100 &&\r
+ !(PicoIn.opt&0x08))\r
{\r
- PsndRate = 11025;\r
- PicoOpt |= 8;\r
- } else if ((inp & BTN_LEFT) && PsndRate == 11025 &&\r
- (PicoOpt&0x08) && !(PicoAHW&1))\r
+ PicoIn.sndRate = 11025;\r
+ PicoIn.opt |= 8;\r
+ } else if ((inp & PBTN_LEFT) && PicoIn.sndRate == 11025 &&\r
+ (PicoIn.opt&0x08) && !(PicoIn.AHW&1))\r
{\r
- PsndRate = 44100;\r
- PicoOpt &= ~8;\r
+ PicoIn.sndRate = 44100;\r
+ PicoIn.opt &= ~8;\r
} else\r
- PsndRate = sndrate_prevnext(PsndRate, inp & BTN_RIGHT);\r
+ PicoIn.sndRate = sndrate_prevnext(PicoIn.sndRate, inp & PBTN_RIGHT);\r
break;\r
case MA_OPT_REGION:\r
- region_prevnext(inp & BTN_RIGHT);\r
+ region_prevnext(inp & PBTN_RIGHT);\r
break;\r
case MA_OPT_CONFIRM_STATES: {\r
int n = ((currentConfig.EmuOpt>>9)&1) | ((currentConfig.EmuOpt>>10)&2);\r
- n += (inp & BTN_LEFT) ? -1 : 1;\r
+ n += (inp & PBTN_LEFT) ? -1 : 1;\r
if (n < 0) n = 0; else if (n > 3) n = 3;\r
n |= n << 1; n &= ~2;\r
currentConfig.EmuOpt &= ~0xa00;\r
break;\r
}\r
case MA_OPT_SAVE_SLOT:\r
- if (inp & BTN_RIGHT) {\r
+ if (inp & PBTN_RIGHT) {\r
state_slot++; if (state_slot > 9) state_slot = 0;\r
} else {state_slot--; if (state_slot < 0) state_slot = 9;\r
}\r
case MA_OPT_SAVECFG:\r
case MA_OPT_SAVECFG_GAME:\r
case MA_OPT_LOADCFG:\r
- config_slot += (inp&BTN_RIGHT) ? 1 : -1;\r
+ config_slot += (inp&PBTN_RIGHT) ? 1 : -1;\r
if (config_slot > 9) config_slot = 0;\r
if (config_slot < 0) config_slot = 9;\r
me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_LOADCFG, config_slot != config_slot_current);\r
}\r
}\r
}\r
- if (inp & BTN_PLAY) {\r
+ if (inp & PBTN_PLAY) {\r
if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, 1))\r
{\r
switch (selected_id)\r
}\r
}\r
}\r
- if(inp & (BTN_STOP|BTN_REW)) {\r
+ if(inp & (PBTN_STOP|PBTN_REW)) {\r
menu_options_save();\r
return 0; // done (update, no write)\r
}\r
/* make sure action buttons are not pressed on entering menu */\r
draw_menu_root(menu_sel);\r
\r
- while (Framework_PollGetButtons() & (BTN_PLAY|BTN_STOP|BTN_HOME)) Sleep(50);\r
+ while (Framework_PollGetButtons() & (PBTN_PLAY|PBTN_STOP|PBTN_HOME)) Sleep(50);\r
\r
for (;;)\r
{\r
draw_menu_root(menu_sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY|BTN_STOP|BTN_HOME|BTN_L|BTN_R);\r
- if(inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
- if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
- if((inp & (BTN_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop();\r
- if( inp & (BTN_HOME|BTN_STOP)) {\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_PLAY|PBTN_STOP|PBTN_HOME|PBTN_L|PBTN_R);\r
+ if(inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+ if(inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+ if((inp & (PBTN_L|PBTN_R)) == (PBTN_L|PBTN_R)) debug_menu_loop();\r
+ if( inp & (PBTN_HOME|PBTN_STOP)) {\r
if (rom_loaded) {\r
- while (Framework_PollGetButtons() & (BTN_HOME|BTN_STOP)) Sleep(50); // wait until released\r
+ while (Framework_PollGetButtons() & (PBTN_HOME|PBTN_STOP)) Sleep(50); // wait until released\r
engineState = PGS_Running;\r
break;\r
}\r
}\r
- if(inp & BTN_PLAY) {\r
+ if(inp & PBTN_PLAY) {\r
switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel))\r
{\r
case MA_MAIN_RESUME_GAME:\r
if (rom_loaded) {\r
- while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+ while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
engineState = PGS_Running;\r
return;\r
}\r
if (rom_loaded) {\r
if(savestate_menu_loop(1))\r
continue;\r
- while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+ while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
engineState = PGS_Running;\r
return;\r
}\r
case MA_MAIN_RESET_GAME:\r
if (rom_loaded) {\r
emu_ResetGame();\r
- while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+ while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
engineState = PGS_Running;\r
return;\r
}\r
{\r
char curr_path[MAX_PATH], *selfname;\r
FILE *tstf;\r
- if ( (tstf = fopen(lastRomFile, "rb")) )\r
+ if ( (tstf = fopen(loadedRomFName, "rb")) )\r
{\r
fclose(tstf);\r
- strcpy(curr_path, lastRomFile);\r
+ strcpy(curr_path, loadedRomFName);\r
}\r
else\r
getcwd(curr_path, MAX_PATH);\r
case MA_MAIN_CREDITS:\r
draw_menu_credits();\r
Sleep(500);\r
- inp = wait_for_input(BTN_PLAY|BTN_STOP);\r
+ inp = in_menu_wait(PBTN_PLAY|PBTN_STOP);\r
break;\r
case MA_MAIN_EXIT:\r
engineState = PGS_Quit;\r
// warning: alignment\r
void menu_darken_bg(void *dst, const void *src, int pixels, int darker)\r
{\r
- unsigned int *dest = dst;\r
- const unsigned int *srce = src;\r
+ u32 *dest = dst;\r
+ const u32 *srce = src;\r
pixels /= 2;\r
if (darker)\r
{\r
while (pixels--)\r
{\r
- unsigned int p = *srce++;\r
+ u32 p = *srce++;\r
*dest++ = ((p&0xf79ef79e)>>1) - ((p&0xc618c618)>>3);\r
}\r
}\r
{\r
while (pixels--)\r
{\r
- unsigned int p = *srce++;\r
+ u32 p = *srce++;\r
*dest++ = (p&0xf79ef79e)>>1;\r
}\r
}\r
\r
menu_gfx_prepare();\r
\r
- if ( (tstf = fopen(lastRomFile, "rb")) )\r
+ if ( (tstf = fopen(loadedRomFName, "rb")) )\r
{\r
fclose(tstf);\r
- strcpy(curr_path, lastRomFile);\r
+ strcpy(curr_path, loadedRomFName);\r
}\r
else\r
{\r
\r
/* make sure action buttons are not pressed on entering menu */\r
draw_menu_tray(menu_sel);\r
- while (Framework_PollGetButtons() & BTN_PLAY) Sleep(50);\r
+ while (Framework_PollGetButtons() & PBTN_PLAY) Sleep(50);\r
\r
for (;;)\r
{\r
draw_menu_tray(menu_sel);\r
- inp = wait_for_input(BTN_UP|BTN_DOWN|BTN_PLAY);\r
- if(inp & BTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
- if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
- if(inp & BTN_PLAY ) {\r
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_PLAY);\r
+ if(inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }\r
+ if(inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }\r
+ if(inp & PBTN_PLAY) {\r
switch (menu_sel) {\r
case 0: // select image\r
selfname = romsel_loop(curr_path);\r
if (selfname) {\r
int ret = -1;\r
- cd_img_type cd_type;\r
- cd_type = emu_cdCheck(NULL);\r
- if (cd_type != CIT_NOT_CD)\r
+ cd_track_type cd_type;\r
+ cd_type = emu_cdCheck(NULL, romFileName);\r
+ if (cd_type >= 0 && cd_type != CT_UNKNOWN)\r
ret = Insert_CD(romFileName, cd_type);\r
if (ret != 0) {\r
sprintf(menuErrorMsg, "Load failed, invalid CD image?");\r