ui, revise status line handling

This commit is contained in:
kub 2020-11-12 21:51:35 +01:00
parent ae61303f86
commit 69b7b2641b
5 changed files with 56 additions and 40 deletions

View file

@ -1366,7 +1366,6 @@ void emu_loop(void)
char *notice_msg = NULL;
char fpsbuff[24];
int fskip_cnt = 0;
int statclr_cnt = 4;
fpsbuff[0] = 0;
@ -1415,9 +1414,7 @@ void emu_loop(void)
{
notice_msg_time = 0;
notice_msg = NULL;
/* clear all buffers if multi buffering */
plat_status_msg_clear();
statclr_cnt = 4;
}
else {
int sum = noticeMsg[0] + noticeMsg[1] + noticeMsg[2];
@ -1527,12 +1524,6 @@ void emu_loop(void)
if (!skip && flip_after_sync)
plat_video_flip();
if (!skip && statclr_cnt > 0) {
// clear stat msg area in case of multi buffering
plat_status_msg_clear();
statclr_cnt --;
}
pprof_end(main);
}

View file

@ -176,6 +176,10 @@ void plat_video_set_buffer(void *);
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

View file

@ -159,6 +159,8 @@ void rgb565_to_uyvy(void *d, const void *s, int pixels)
}
}
static int clear_buf_cnt, clear_stat_cnt;
void plat_video_flip(void)
{
if (plat_sdl_overlay != NULL) {
@ -183,6 +185,16 @@ void plat_video_flip(void)
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--;
}
}
@ -190,6 +202,21 @@ void plat_video_wait_vsync(void)
{
}
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))