char *notice_msg = NULL;\r
char fpsbuff[24];\r
int fskip_cnt = 0;\r
- int statclr_cnt = 4;\r
\r
fpsbuff[0] = 0;\r
\r
{\r
notice_msg_time = 0;\r
notice_msg = NULL;\r
- /* clear all buffers if multi buffering */\r
plat_status_msg_clear();\r
- statclr_cnt = 4;\r
}\r
else {\r
int sum = noticeMsg[0] + noticeMsg[1] + noticeMsg[2];\r
if (!skip && flip_after_sync)\r
plat_video_flip();\r
\r
- if (!skip && statclr_cnt > 0) {\r
- // clear stat msg area in case of multi buffering\r
- plat_status_msg_clear();\r
- statclr_cnt --;\r
- }\r
-\r
pprof_end(main);\r
}\r
\r
void plat_update_volume(int has_changed, int is_up);
+/* should be in libpicofe/plat.h */
+void plat_video_clear_status(void);
+void plat_video_clear_buffers(void);
+
#ifdef __cplusplus
} // extern "C"
#endif
}
}
+static int clear_buf_cnt, clear_stat_cnt;
+
void plat_video_flip(void)
{
if (plat_sdl_overlay != NULL) {
SDL_Flip(plat_sdl_screen);
g_screen_ptr = plat_sdl_screen->pixels;
plat_video_set_buffer(g_screen_ptr);
+ if (clear_buf_cnt) {
+ memset(g_screen_ptr, 0, plat_sdl_screen->w*plat_sdl_screen->h * 2);
+ clear_buf_cnt--;
+ }
+ }
+ if (clear_stat_cnt) {
+ unsigned short *d = (unsigned short *)g_screen_ptr + g_screen_ppitch * g_screen_height;
+ int l = g_screen_ppitch * 8;
+ memset((int *)(d - l), 0, l * 2);
+ clear_stat_cnt--;
}
}
{
}
+void plat_video_clear_status(void)
+{
+ clear_stat_cnt = 3; // do it thrice in case of triple buffering
+}
+
+void plat_video_clear_buffers(void)
+{
+ if (plat_sdl_overlay != NULL || plat_sdl_gl_active)
+ memset(shadow_fb, 0, plat_sdl_screen->w*plat_sdl_screen->h * 2);
+ else {
+ memset(g_screen_ptr, 0, plat_sdl_screen->w*plat_sdl_screen->h * 2);
+ clear_buf_cnt = 3; // do it thrice in case of triple buffering
+ }
+}
+
void plat_video_menu_enter(int is_rom_loaded)
{
if (SDL_MUSTLOCK(plat_sdl_screen))
\r
void plat_status_msg_clear(void)\r
{\r
- int is_8bit = !is_16bit_mode();\r
- if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {\r
- /* ugh.. */\r
- int u, *p;\r
- if (is_8bit) {\r
- p = (int *)g_screen_ptr + (240-8) / 4;\r
- for (u = 320; u > 0; u--, p += 240/4)\r
- p[0] = p[1] = 0xe0e0e0e0;\r
- } else {\r
- p = (int *)g_screen_ptr + (240-8)*2 / 4;\r
- for (u = 320; u > 0; u--, p += 240*2/4)\r
- p[0] = p[1] = p[2] = p[3] = 0;\r
- }\r
- return;\r
- } else {\r
- if (is_8bit) {\r
- char *d = (char *)g_screen_ptr + 320 * (240-8);\r
- memset32((int *)d, 0xe0, 320 * 8 / 4);\r
+ int i, is_8bit = !is_16bit_mode();\r
+\r
+ for (i = 0; i < 4; i++) {\r
+ if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {\r
+ /* ugh.. */\r
+ int u, *p;\r
+ if (is_8bit) {\r
+ p = (int *)gp2x_screens[i] + (240-8) / 4;\r
+ for (u = 320; u > 0; u--, p += 240/4)\r
+ p[0] = p[1] = 0xe0e0e0e0;\r
+ } else {\r
+ p = (int *)gp2x_screens[i] + (240-8)*2 / 4;\r
+ for (u = 320; u > 0; u--, p += 240*2/4)\r
+ p[0] = p[1] = p[2] = p[3] = 0;\r
+ }\r
} else {\r
- short *d = (short *)g_screen_ptr + 320 * (240-8);\r
- memset32((int *)d, 0, 2*320 * 8 / 4);\r
+ if (is_8bit) {\r
+ char *d = (char *)gp2x_screens[i] + 320 * (240-8);\r
+ memset32((int *)d, 0xe0, 320 * 8 / 4);\r
+ } else {\r
+ char *d = (char *)gp2x_screens[i] + 320*2 * (240-8);\r
+ memset32((int *)d, 0, 2*320 * 8 / 4);\r
+ }\r
}\r
}\r
}\r
\r
static int out_x, out_y;\r
static int out_w, out_h;\r
-static int clr_cnt;\r
\r
void pemu_prep_defconfig(void)\r
{\r
\r
void plat_video_set_buffer(void *buf)\r
{\r
- if (clr_cnt > 0) {\r
- memset32(g_screen_ptr, 0, g_screen_ppitch*g_screen_height*2 / 4);\r
- clr_cnt --;\r
- }\r
if (currentConfig.renderer == RT_16BIT || (PicoIn.AHW & PAHW_32X))\r
PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);\r
}\r
PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);\r
\r
Pico.m.dirtyPal = 1;\r
- clr_cnt = 4;\r
}\r
\r
void plat_video_toggle_renderer(int change, int is_menu)\r
\r
void plat_status_msg_clear(void)\r
{\r
- unsigned short *d = (unsigned short *)g_screen_ptr + g_screen_ppitch * g_screen_height;\r
- int l = g_screen_ppitch * 8;\r
- memset32((int *)(d - l), 0, l * 2 / 4);\r
+ plat_video_clear_status();\r
}\r
\r
void plat_status_msg_busy_next(const char *msg)\r
\r
void plat_status_msg_busy_first(const char *msg)\r
{\r
- clr_cnt = 4;\r
plat_status_msg_busy_next(msg);\r
}\r
\r
// clear whole screen in all buffers\r
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X))\r
memset32(Pico.est.Draw2FB, 0xe0e0e0e0, (320+8) * (8+240+8) / 4);\r
- clr_cnt = 4;\r
+ plat_video_clear_buffers();\r
\r
out_y = start_line; out_x = (is_32cols ? 32 : 0);\r
out_h = line_count; out_w = (is_32cols ? 256:320);\r
void pemu_loop_prep(void)\r
{\r
apply_renderer();\r
+ plat_video_clear_buffers();\r
}\r
\r
void pemu_loop_end(void)\r