lprintf("failed to create: %s\n", path_with_reserve);\r
}\r
\r
-void emu_cmn_forced_frame(int no_scale, int do_emu)\r
+void emu_cmn_forced_frame(int no_scale, int do_emu, void *buf)\r
{\r
int po_old = PicoIn.opt;\r
int y;\r
PicoIn.opt |= POPT_EN_SOFTSCALE;\r
\r
PicoDrawSetOutFormat(PDF_RGB555, 1);\r
- PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);\r
+ PicoDrawSetOutBuf(buf, g_screen_ppitch * 2);\r
Pico.m.dirtyPal = 1;\r
Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;\r
if (do_emu)\r
void emu_sound_wait(void);
/* used by some (but not all) platforms */
-void emu_cmn_forced_frame(int no_scale, int do_emu);
+void emu_cmn_forced_frame(int no_scale, int do_emu, void *buf);
/* stuff to be implemented by platform code */
extern const char *renderer_names[];
void plat_video_loop_prepare(void)
{
- plat_sdl_change_video_mode(g_screen_width, g_screen_height, 0);
-
if (plat_sdl_overlay != NULL || plat_sdl_gl_active) {
g_screen_ptr = shadow_fb;
+ g_screen_width = 320;
+ g_screen_height = 240;
+ g_screen_ppitch = g_screen_width;
}
else {
if (SDL_MUSTLOCK(plat_sdl_screen))
SDL_LockSurface(plat_sdl_screen);
g_screen_ptr = plat_sdl_screen->pixels;
+ g_screen_width = g_menuscreen_w;
+ g_screen_height = g_menuscreen_h;
+ g_screen_ppitch = g_menuscreen_pp;
}
plat_video_set_buffer(g_screen_ptr);
+
+ plat_sdl_change_video_mode(g_screen_width, g_screen_height, 0);
}
void plat_early_init(void)
\r
if (!no_scale)\r
no_scale = currentConfig.scaling == EOPT_SCALE_NONE;\r
- emu_cmn_forced_frame(no_scale, do_emu);\r
+ emu_cmn_forced_frame(no_scale, do_emu, g_screen_ptr);\r
\r
g_menubg_src_ptr = g_screen_ptr;\r
doing_bg_frame = 0;\r
#undef p\r
}\r
\r
+static unsigned short *get_16bit_start(unsigned short *buf)\r
+{\r
+ // center the output on the screen\r
+ int offs = (g_screen_height-240)/2 * g_screen_ppitch + (g_screen_width-320)/2;\r
+ return buf + offs;\r
+}\r
+\r
void pemu_finalize_frame(const char *fps, const char *notice)\r
{\r
if (!is_16bit_mode()) {\r
unsigned short *pal = Pico.est.HighPal;\r
int i, x;\r
\r
+ pd = get_16bit_start(pd);\r
PicoDrawUpdateHighPal();\r
for (i = 0; i < out_h; i++, ps += 8) {\r
for (x = 0; x < out_w; x++)\r
*pd++ = pal[*ps++];\r
- pd += 320 - out_w;\r
+ pd += g_screen_ppitch - out_w;\r
ps += 320 - out_w;\r
}\r
}\r
void plat_video_set_buffer(void *buf)\r
{\r
if (is_16bit_mode())\r
- PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);\r
+ PicoDrawSetOutBuf(get_16bit_start(buf), g_screen_ppitch * 2);\r
}\r
\r
static void apply_renderer(void)\r
PicoIn.opt &= ~POPT_ALT_RENDERER;\r
PicoIn.opt &= ~POPT_DIS_32C_BORDER;\r
PicoDrawSetOutFormat(PDF_RGB555, 0);\r
- PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);\r
+ PicoDrawSetOutBuf(get_16bit_start(g_screen_ptr), g_screen_ppitch * 2);\r
break;\r
case RT_8BIT_ACC:\r
PicoIn.opt &= ~POPT_ALT_RENDERER;\r
}\r
\r
if (PicoIn.AHW & PAHW_32X)\r
- PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);\r
+ PicoDrawSetOutBuf(get_16bit_start(g_screen_ptr), g_screen_ppitch * 2);\r
\r
Pico.m.dirtyPal = 1;\r
}\r
\r
void pemu_forced_frame(int no_scale, int do_emu)\r
{\r
+ unsigned short *pd = get_16bit_start(g_screen_ptr);\r
+\r
PicoIn.opt &= ~POPT_DIS_32C_BORDER;\r
PicoDrawSetCallbacks(NULL, NULL);\r
Pico.m.dirtyPal = 1;\r
\r
- emu_cmn_forced_frame(no_scale, do_emu);\r
+ emu_cmn_forced_frame(no_scale, do_emu, pd);\r
\r
g_menubg_src_ptr = g_screen_ptr;\r
}\r
void pemu_forced_frame(int no_scale, int do_emu)\r
{\r
doing_bg_frame = 1;\r
- emu_cmn_forced_frame(no_scale, do_emu);\r
+ // making a copy because enabling the layer clears it's mem\r
+ emu_cmn_forced_frame(no_scale, do_emu, fb_copy);\r
doing_bg_frame = 0;\r
\r
- // making a copy because enabling the layer clears it's mem\r
- memcpy((void *)fb_copy, g_screen_ptr, sizeof(fb_copy));\r
g_menubg_src_ptr = fb_copy;\r
}\r
\r
if (!no_scale)
no_scale = currentConfig.scaling == EOPT_SCALE_NONE;
- emu_cmn_forced_frame(no_scale, do_emu);
+ emu_cmn_forced_frame(no_scale, do_emu, g_screen_ptr);
}
/* change the platform output rendering */