\r
void run_events_pico(unsigned int events)\r
{\r
- int lim_x;\r
-\r
if (events & PEV_PICO_SWINP) {\r
pico_inp_mode++;\r
if (pico_inp_mode > 2)\r
PicoPicohw.page = 6;\r
emu_status_msg("Page %i", PicoPicohw.page);\r
}\r
+ if (events & PEV_PICO_PEN) {\r
+ currentConfig.EmuOpt ^= EOPT_PICO_PEN;\r
+ emu_status_msg("%s Pen", currentConfig.EmuOpt & EOPT_PICO_PEN ? "Show" : "Hide");\r
+ }\r
\r
if (pico_inp_mode == 0)\r
return;\r
if (PicoIn.pad[0] & 8) pico_pen_x++;\r
PicoIn.pad[0] &= ~0x0f; // release UDLR\r
\r
- lim_x = (Pico.video.reg[12]&1) ? 319 : 255;\r
- if (pico_pen_y < 8)\r
- pico_pen_y = 8;\r
+ if (pico_pen_y < PICO_PEN_ADJUST_Y)\r
+ pico_pen_y = PICO_PEN_ADJUST_Y;\r
if (pico_pen_y > 224 - PICO_PEN_ADJUST_Y)\r
pico_pen_y = 224 - PICO_PEN_ADJUST_Y;\r
- if (pico_pen_x < 0)\r
- pico_pen_x = 0;\r
- if (pico_pen_x > lim_x - PICO_PEN_ADJUST_X)\r
- pico_pen_x = lim_x - PICO_PEN_ADJUST_X;\r
-\r
- PicoPicohw.pen_pos[0] = pico_pen_x;\r
- if (!(Pico.video.reg[12] & 1))\r
- PicoPicohw.pen_pos[0] += pico_pen_x / 4;\r
- PicoPicohw.pen_pos[0] += 0x3c;\r
+ if (pico_pen_x < PICO_PEN_ADJUST_X)\r
+ pico_pen_x = PICO_PEN_ADJUST_X;\r
+ if (pico_pen_x > 320 - PICO_PEN_ADJUST_X)\r
+ pico_pen_x = 320 - PICO_PEN_ADJUST_X;\r
+\r
+ PicoPicohw.pen_pos[0] = 0x03c + pico_pen_x;\r
PicoPicohw.pen_pos[1] = pico_inp_mode == 1 ? (0x2f8 + pico_pen_y) : (0x1fc + pico_pen_y);\r
}\r
\r
#define EOPT_NO_FRMLIMIT (1<<18)
#define EOPT_WIZ_TEAR_FIX (1<<19)
#define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc)
+#define EOPT_PICO_PEN (1<<21)
enum {
EOPT_SCALE_NONE = 0,
extern int reset_timing;
extern int flip_after_sync;
-#define PICO_PEN_ADJUST_X 4
+#define PICO_PEN_ADJUST_X 2
#define PICO_PEN_ADJUST_Y 2
extern int pico_pen_x, pico_pen_y;
extern int pico_inp_mode;
#define PEVB_PICO_PNEXT 21
#define PEVB_PICO_PPREV 20
#define PEVB_PICO_SWINP 19
-#define PEVB_RESET 18
+#define PEVB_PICO_PEN 18
+#define PEVB_RESET 17
#define PEV_VOL_DOWN (1 << PEVB_VOL_DOWN)
#define PEV_VOL_UP (1 << PEVB_VOL_UP)
#define PEV_PICO_PNEXT (1 << PEVB_PICO_PNEXT)
#define PEV_PICO_PPREV (1 << PEVB_PICO_PPREV)
#define PEV_PICO_SWINP (1 << PEVB_PICO_SWINP)
+#define PEV_PICO_PEN (1 << PEVB_PICO_PEN)
#define PEV_RESET (1 << PEVB_RESET)
-#define PEV_MASK 0x7ffc0000
+#define PEV_MASK 0x7ffe0000
#endif /* INCLUDE_c48097f3ff2a6a9af1cce8fd7a9b3f0c */
{ SDLK_F6, IN_BINDTYPE_EMU, PEVB_PICO_PPREV },
{ SDLK_F7, IN_BINDTYPE_EMU, PEVB_PICO_PNEXT },
{ SDLK_F8, IN_BINDTYPE_EMU, PEVB_PICO_SWINP },
+ { SDLK_F9, IN_BINDTYPE_EMU, PEVB_PICO_PEN },
{ SDLK_BACKSPACE, IN_BINDTYPE_EMU, PEVB_FF },
{ 0, 0, 0 }
};
{ "Pico Next page ", PEV_PICO_PNEXT },
{ "Pico Prev page ", PEV_PICO_PPREV },
{ "Pico Switch input", PEV_PICO_SWINP },
+ { "Pico Display pen ", PEV_PICO_PEN },
{ NULL, 0 }
};
mee_onoff_h ("FM audio", MA_OPT2_ENABLE_YM2612, PicoIn.opt, POPT_EN_FM, h_fmsound),
mee_onoff_h ("FM filter", MA_OPT_FM_FILTER, PicoIn.opt, POPT_EN_FM_FILTER, h_fmfilter),
mee_onoff_h ("FM DAC noise", MA_OPT2_ENABLE_YM_DAC, PicoIn.opt, POPT_EN_FM_DAC, h_dacnoise),
+ mee_onoff ("Show Pico pen", MA_OPT_PICO_PEN, currentConfig.EmuOpt, EOPT_PICO_PEN),
mee_end,
};
}
}
-static const char *mgn_saveloadcfg(int id, int *offs)
-{
- strcpy(static_buff, " ");
- if (config_slot != 0)
- sprintf(static_buff, "[%i]", config_slot);
- return static_buff;
-}
-
static const char h_hotkeysvld[] = "Slot used for save/load by emulator hotkey";
static menu_entry e_menu_options[] =
return 0;
}
+static const char *mgn_picopage(int id, int *offs)
+{
+ strcpy(static_buff, " ");
+ sprintf(static_buff, "%i", PicoPicohw.page);
+ return static_buff;
+}
+
+static int mh_picopage(int id, int keys)
+{
+ int ret;
+
+ if (keys & (PBTN_LEFT|PBTN_RIGHT)) { // multi choice
+ PicoPicohw.page += (keys & PBTN_LEFT) ? -1 : 1;
+ if (PicoPicohw.page < 0) PicoPicohw.page = 6;
+ else if (PicoPicohw.page > 6) PicoPicohw.page = 0;
+ return 0;
+ }
+ return 1;
+}
+
+static const char *mgn_saveloadcfg(int id, int *offs)
+{
+ strcpy(static_buff, " ");
+ if (config_slot != 0)
+ sprintf(static_buff, "[%i]", config_slot);
+ return static_buff;
+}
+
static int mh_saveloadcfg(int id, int keys)
{
int ret;
mee_label (""),
mee_label (""),
mee_handler_id("Resume game", MA_MAIN_RESUME_GAME, main_menu_handler),
- mee_handler_id("Save State", MA_MAIN_SAVE_STATE, main_menu_handler),
- mee_handler_id("Load State", MA_MAIN_LOAD_STATE, main_menu_handler),
+ mee_handler_id("Save state", MA_MAIN_SAVE_STATE, main_menu_handler),
+ mee_handler_id("Load state", MA_MAIN_LOAD_STATE, main_menu_handler),
mee_handler_id("Reset game", MA_MAIN_RESET_GAME, main_menu_handler),
mee_handler_id("Change CD", MA_MAIN_CHANGE_CD, main_menu_handler),
+ mee_cust_s_h ("Storyware page", MA_MAIN_PICO_PAGE, 0,mh_picopage, mgn_picopage, NULL),
mee_handler_id("Patches / GameGenie",MA_MAIN_PATCHES, main_menu_handler),
mee_handler_id("Load new game", MA_MAIN_LOAD_ROM, main_menu_handler),
mee_handler ("Change options", menu_loop_options),
me_enable(e_menu_main, MA_MAIN_LOAD_STATE, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_RESET_GAME, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_CHANGE_CD, PicoIn.AHW & PAHW_MCD);
+ me_enable(e_menu_main, MA_MAIN_PICO_PAGE, PicoIn.AHW & PAHW_PICO);
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
me_enable(e_menu_main, MA_OPT_SAVECFG_GAME, PicoGameLoaded);
me_enable(e_menu_main, MA_OPT_LOADCFG, PicoGameLoaded && config_slot != config_slot_current);
MA_MAIN_RESET_GAME,
MA_MAIN_LOAD_ROM,
MA_MAIN_CHANGE_CD,
+ MA_MAIN_PICO_PAGE,
MA_MAIN_CONTROLS,
MA_MAIN_CREDITS,
MA_MAIN_PATCHES,
MA_OPT_SOUND_FILTER,
MA_OPT_SOUND_ALPHA,
MA_OPT_FM_FILTER,
+ MA_OPT_PICO_PEN,
MA_OPT2_GAMMA,
MA_OPT2_A_SN_GAMMA,
MA_OPT2_DBLBUFF, /* giz */
const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL };\r
enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT };\r
\r
+static int is_1stblanked;\r
+static int firstline, linecount;\r
+static int firstcol, colcount;\r
+\r
static int (*emu_scan_begin)(unsigned int num) = NULL;\r
static int (*emu_scan_end)(unsigned int num) = NULL;\r
\r
\r
static void draw_pico_ptr(void)\r
{\r
- unsigned short *p = (unsigned short *)g_screen_ptr;\r
- int x, y, pitch = 320;\r
+ int x, y, pitch = 320, offs;\r
\r
- // only if pen enabled and for 16bit modes\r
- if (pico_inp_mode == 0 || !is_16bit_mode())\r
- return;\r
-\r
- x = pico_pen_x + PICO_PEN_ADJUST_X;\r
- y = pico_pen_y + PICO_PEN_ADJUST_Y;\r
- if (!(Pico.video.reg[12]&1) && !(PicoIn.opt & POPT_DIS_32C_BORDER))\r
- x += 32;\r
+ x = ((pico_pen_x * colcount * ((1ULL<<32) / 320)) >> 32) + firstcol;\r
+ y = ((pico_pen_y * linecount * ((1ULL<<32) / 224)) >> 32) + firstline;\r
\r
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {\r
pitch = 240;\r
- p += (319 - x) * pitch + y;\r
+ offs = (319 - x) * pitch + y;\r
} else\r
- p += x + y * pitch;\r
+ offs = x + y * pitch;\r
+\r
+ if (is_16bit_mode()) {\r
+ unsigned short *p = (unsigned short *)g_screen_ptr + offs;\r
\r
- p[0] ^= 0xffff;\r
- p[pitch-1] ^= 0xffff;\r
- p[pitch] ^= 0xffff;\r
- p[pitch+1] ^= 0xffff;\r
- p[pitch*2] ^= 0xffff;\r
+ p[0] ^= 0xffff;\r
+ p[pitch-1] ^= 0xffff; p[pitch] ^= 0xffff; p[pitch+1] ^= 0xffff;\r
+ p[pitch*2] ^= 0xffff;\r
+ } else {\r
+ unsigned char *p = (unsigned char *)g_screen_ptr + offs;\r
+\r
+ p[-1] = 0xe0; p[0] = 0xf0; p[1] = 0xe0;\r
+ p[pitch-1] = 0xf0; p[pitch] = 0xf0; p[pitch+1] = 0xf0;\r
+ p[2*pitch-1] = 0xe0; p[2*pitch] = 0xf0; p[2*pitch+1] = 0xe0;\r
+ }\r
}\r
\r
static void clear_1st_column(int firstcol, int firstline, int linecount)\r
return (Pico.est.SonicPalCount+1)*0x40;\r
}\r
\r
-static int is_1stblanked;\r
-static int firstline, linecount;\r
-static int firstcol, colcount;\r
-\r
void pemu_finalize_frame(const char *fps, const char *notice)\r
{\r
int emu_opt = currentConfig.EmuOpt;\r
osd_text(osd_fps_x, osd_y, fps);\r
if ((PicoIn.AHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))\r
draw_cd_leds();\r
- if (PicoIn.AHW & PAHW_PICO)\r
- draw_pico_ptr();\r
+ if ((PicoIn.AHW & PAHW_PICO) && (currentConfig.EmuOpt & EOPT_PICO_PEN))\r
+ if (pico_inp_mode) draw_pico_ptr();\r
}\r
\r
void plat_video_flip(void)\r
PicoIn.pad[0] &= ~0x0f; // release UDLR
lim_x = (Pico.video.reg[12]&1) ? 319 : 255;
- if (pico_pen_y < 8)
- pico_pen_y = 8;
+ if (pico_pen_y < PICO_PEN_ADJUST_Y)
+ pico_pen_y = PICO_PEN_ADJUST_Y;
if (pico_pen_y > 224 - PICO_PEN_ADJUST_Y)
pico_pen_y = 224 - PICO_PEN_ADJUST_Y;
- if (pico_pen_x < 0)
- pico_pen_x = 0;
+ if (pico_pen_x < PICO_PEN_ADJUST_X)
+ pico_pen_x = PICO_PEN_ADJUST_X;
if (pico_pen_x > lim_x - PICO_PEN_ADJUST_X)
pico_pen_x = lim_x - PICO_PEN_ADJUST_X;
#undef p\r
}\r
\r
+static void draw_pico_ptr(void)\r
+{\r
+ int pitch = g_screen_ppitch;\r
+ u16 *p = g_screen_ptr;\r
+ int x = pico_pen_x, y = pico_pen_y;\r
+\r
+ x = (x * out_w * ((1ULL<<32) / 320)) >> 32;\r
+ y = (y * out_h * ((1ULL<<32) / 224)) >> 32;\r
+ p += (screen_y+y)*pitch + (screen_x+x);\r
+\r
+ p[-pitch] ^= 0xffff;\r
+ p[-1] ^= 0xffff; p[0] ^= 0xffff; p[1] ^= 0xffff;\r
+ p[pitch] ^= 0xffff;\r
+}\r
+\r
/* render/screen buffer handling:\r
* In 16 bit mode, render output is directly placed in the screen buffer.\r
* SW scaling is handled in renderer (x) and in vscaling callbacks here (y).\r
}\r
}\r
\r
+ if ((PicoIn.AHW & PAHW_PICO) && (currentConfig.EmuOpt & EOPT_PICO_PEN))\r
+ if (pico_inp_mode) draw_pico_ptr();\r
if (notice)\r
emu_osd_text16(4, g_screen_height - 8, notice);\r
if (currentConfig.EmuOpt & EOPT_SHOW_FPS)\r
{ KEY_5, IN_BINDTYPE_EMU, PEVB_PICO_PPREV },\r
{ KEY_6, IN_BINDTYPE_EMU, PEVB_PICO_PNEXT },\r
{ KEY_7, IN_BINDTYPE_EMU, PEVB_PICO_SWINP },\r
+ { KEY_8, IN_BINDTYPE_EMU, PEVB_PICO_PEN },\r
{ 0, 0, 0 }\r
};\r
\r
int old_reg;\r
old_reg = Pico_mcd->s68k_regs[0];\r
\r
- if (0) {\r
- // 8-bit modes\r
- unsigned int col_g = (old_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0;\r
- unsigned int col_r = (old_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0;\r
- *(unsigned int *)((char *)g_screen_ptr + g_screen_width*2+ 4) =\r
- *(unsigned int *)((char *)g_screen_ptr + g_screen_width*3+ 4) =\r
- *(unsigned int *)((char *)g_screen_ptr + g_screen_width*4+ 4) = col_g;\r
- *(unsigned int *)((char *)g_screen_ptr + g_screen_width*2+12) =\r
- *(unsigned int *)((char *)g_screen_ptr + g_screen_width*3+12) =\r
- *(unsigned int *)((char *)g_screen_ptr + g_screen_width*4+12) = col_r;\r
- } else {\r
- // 16-bit modes\r
- unsigned int *p = (unsigned int *)((short *)g_screen_ptr + g_screen_width*2+4);\r
- unsigned int col_g = (old_reg & 2) ? 0x06000600 : 0;\r
- unsigned int col_r = (old_reg & 1) ? 0xc000c000 : 0;\r
- *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2;\r
- *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2;\r
- *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r;\r
- }\r
+ // 16-bit modes\r
+ unsigned int *p = (unsigned int *)((short *)g_screen_ptr + g_screen_width*2+4);\r
+ unsigned int col_g = (old_reg & 2) ? 0x06000600 : 0;\r
+ unsigned int col_r = (old_reg & 1) ? 0xc000c000 : 0;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += g_screen_width/2 - 12/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r;\r
+}\r
+\r
+static void draw_pico_ptr(void)\r
+{\r
+ int x = pico_pen_x, y = pico_pen_y, pitch = g_screen_ppitch;\r
+ unsigned short *p = (unsigned short *)g_screen_ptr;\r
+\r
+ x = (x * saved_col_count * ((1ULL<<32) / 320)) >> 32;\r
+ y = (y * saved_line_count * ((1ULL<<32) / 224)) >> 32;\r
+ p += (saved_start_col+x) + (saved_start_line+y) * pitch;\r
+\r
+ p[-pitch] ^= 0xffff;\r
+ p[-1] ^= 0xffff; p[0] ^= 0xffff; p[1] ^= 0xffff;\r
+ p[pitch] ^= 0xffff;\r
}\r
\r
void pemu_finalize_frame(const char *fps, const char *notice)\r
{\r
+ if ((PicoIn.AHW & PAHW_PICO) && (currentConfig.EmuOpt & EOPT_PICO_PEN))\r
+ if (pico_inp_mode) draw_pico_ptr();\r
if (notice && notice[0])\r
emu_osd_text16(2 + g_osd_start_x, g_osd_y, notice);\r
if (fps && fps[0] && (currentConfig.EmuOpt & EOPT_SHOW_FPS))\r
int engineStateSuspend;
-#define PICO_PEN_ADJUST_X 4
-#define PICO_PEN_ADJUST_Y 2
-
struct Vertex
{
short u,v;
static void draw_pico_ptr(void)
{
- unsigned char *p = (unsigned char *)g_screen_ptr + 8;
+ int x = pico_pen_x, y = pico_pen_y, offs;
+
+ x = (x * out_w * ((1ULL<<32) / 320)) >> 32;
+ y = (y * out_h * ((1ULL<<32) / 224)) >> 32;
- // only if pen enabled and for 8bit mode
- if (pico_inp_mode == 0 || is_16bit_mode()) return;
+ offs = 512 * (out_y+y) + (out_x+x);
- p += 512 * (pico_pen_y + PICO_PEN_ADJUST_Y);
- p += pico_pen_x + PICO_PEN_ADJUST_X;
- if (!(Pico.video.reg[12]&1) && !(PicoIn.opt & POPT_DIS_32C_BORDER))
- p += 32;
+ if (is_16bit_mode()) {
+ unsigned short *p = (unsigned short *)g_screen_ptr + offs;
- p[ -1] = 0xe0; p[ 0] = 0xf0; p[ 1] = 0xe0;
- p[ 511] = 0xf0; p[ 512] = 0xf0; p[ 513] = 0xf0;
- p[1023] = 0xe0; p[1024] = 0xf0; p[1025] = 0xe0;
+ p[ -1] = 0x0000; p[ 0] = 0x001f; p[ 1] = 0x0000;
+ p[ 511] = 0x001f; p[ 512] = 0x001f; p[ 513] = 0x001f;
+ p[1023] = 0x0000; p[1024] = 0x001f; p[1025] = 0x0000;
+ } else {
+ unsigned char *p = (unsigned char *)g_screen_ptr + offs + 8;
+
+ p[ -1] = 0xe0; p[ 0] = 0xf0; p[ 1] = 0xe0;
+ p[ 511] = 0xf0; p[ 512] = 0xf0; p[ 513] = 0xf0;
+ p[1023] = 0xe0; p[1024] = 0xf0; p[1025] = 0xe0;
+ }
}
{
int emu_opt = currentConfig.EmuOpt;
- if (PicoIn.AHW & PAHW_PICO)
- draw_pico_ptr();
+ if ((PicoIn.AHW & PAHW_PICO) && (currentConfig.EmuOpt & EOPT_PICO_PEN))
+ if (pico_inp_mode) draw_pico_ptr();
osd_buf_cnt = 0;
- if (notice) osd_text(4, notice);
- if (emu_opt & 2) osd_text(OSD_FPS_X, fps);
+ if (notice)
+ osd_text(4, notice);
+ if (emu_opt & EOPT_SHOW_FPS)
+ osd_text(OSD_FPS_X, fps);
osd_cdleds = 0;
- if ((emu_opt & 0x400) && (PicoIn.AHW & PAHW_MCD))
+ if ((emu_opt & EOPT_EN_CD_LEDS) && (PicoIn.AHW & PAHW_MCD))
cd_leds();
sceKernelDcacheWritebackAll();