while (in_menu_wait_any(NULL, 50) & (PBTN_MOK | PBTN_MBACK))\r
;\r
in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
+ plat_status_msg_clear();\r
}\r
if (do_it) {\r
plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING STATE" : "SAVING STATE");\r
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
> ms_to_ticks(STATUS_MSG_TIMEOUT) * 3)\r
{\r
notice_msg_time = 0;\r
- plat_status_msg_clear();\r
-#ifndef __GP2X__\r
- plat_video_flip();\r
- plat_status_msg_clear(); /* Do it again in case of double buffering */\r
-#endif\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_video_toggle_renderer(int change, int menu_call);
void plat_video_loop_prepare(void);
+void plat_video_set_buffer(void *);
void plat_update_volume(int has_changed, int is_up);
len = g_menuscreen_w;
menu_draw_begin(0, 1);
+ memcpy(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2);
dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_pp * me_sfont_h * 2;
for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_menuscreen_pp)
memset(dst, 0xff, len * 2);
menu_draw_begin(0, 1);
dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_pp * me_sfont_h * 2;
+ memcpy(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2);
menuscreen_memset_lines(dst, 0xff, me_sfont_h - 2);
smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff);
void menu_romload_prepare(const char *rom_name)
{
const char *p = rom_name + strlen(rom_name);
- int i;
while (p > rom_name && *p != '/')
p--;
- /* fill all buffers, callbacks won't update in full */
- for (i = 0; i < 3; i++) {
- menu_draw_begin(1, 1);
- smalltext_out16(1, 1, "Loading", 0xffff);
- smalltext_out16(1, me_sfont_h, p, 0xffff);
- menu_draw_end();
- }
+ menu_draw_begin(1, 1);
+ smalltext_out16(1, 1, "Loading", 0xffff);
+ smalltext_out16(1, me_sfont_h, p, 0xffff);
+ /* background screen for callbacks */
+ memcpy(g_menubg_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h * 2);
+ menu_draw_end();
PicoCartLoadProgressCB = load_progress_cb;
PicoCDLoadProgressCB = cdload_progress_cb;
PicoCDLoadProgressCB = NULL;
menu_draw_begin(0, 1);
+ memcpy(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2);
smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h,
"Starting emulation...", 0xffff);
menu_draw_end();
#include <stdio.h>
#include "../libpicofe/input.h"
+#include "../libpicofe/plat.h"
#include "../libpicofe/plat_sdl.h"
#include "../libpicofe/in_sdl.h"
#include "../libpicofe/gl.h"
gl_flip(shadow_fb, g_screen_ppitch, g_screen_height);
}
else {
- if (SDL_MUSTLOCK(plat_sdl_screen))
+ if (SDL_MUSTLOCK(plat_sdl_screen)) {
SDL_UnlockSurface(plat_sdl_screen);
- SDL_Flip(plat_sdl_screen);
- if (g_screen_ptr != shadow_fb) {
- g_screen_ptr = plat_sdl_screen->pixels;
- plat_video_toggle_renderer(0, 0);
- }
+ SDL_Flip(plat_sdl_screen);
+ SDL_LockSurface(plat_sdl_screen);
+ } else
+ SDL_Flip(plat_sdl_screen);
+ g_screen_ptr = plat_sdl_screen->pixels;
+ plat_video_set_buffer(g_screen_ptr);
}
}
void plat_video_menu_enter(int is_rom_loaded)
{
+ if (SDL_MUSTLOCK(plat_sdl_screen))
+ SDL_UnlockSurface(plat_sdl_screen);
plat_sdl_change_video_mode(g_menuscreen_w, g_menuscreen_h, 0);
g_screen_ptr = shadow_fb;
+ plat_video_set_buffer(g_screen_ptr);
}
void plat_video_menu_begin(void)
SDL_Flip(plat_sdl_screen);
}
g_menuscreen_ptr = NULL;
-
}
void plat_video_menu_leave(void)
if (SDL_MUSTLOCK(plat_sdl_screen))
SDL_LockSurface(plat_sdl_screen);
g_screen_ptr = plat_sdl_screen->pixels;
- plat_video_toggle_renderer(0, 0);
}
+ plat_video_set_buffer(g_screen_ptr);
}
void plat_early_init(void)
ret = plat_sdl_init();
if (ret != 0)
exit(1);
+#if defined(__RG350__) || defined(__GCW0__)
+ // opendingux on JZ47x0 may falsely report a HW overlay, fix to window
+ plat_target.vout_method = 0;
+#endif
plat_sdl_quit_cb = plat_sdl_quit;
int is_8bit = !is_16bit_mode();\r
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {\r
/* ugh.. */\r
- int i, u, *p;\r
+ int u, *p;\r
if (is_8bit) {\r
- for (i = 0; i < 4; i++) {\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
- }\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
- for (i = 0; i < 4; i++) {\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
+ 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
+ } else {\r
+ short *d = (short *)g_screen_ptr + 320 * (240-8);\r
+ memset32((int *)d, 0, 2*320 * 8 / 4);\r
+ }\r
}\r
-\r
- if (is_8bit)\r
- gp2x_memset_all_buffers(320*232, 0xe0, 320*8);\r
- else\r
- gp2x_memset_all_buffers(320*232*2, 0, 320*8*2);\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
- gp2x_memcpy_all_buffers(g_screen_ptr, 0, 320*240*2);\r
plat_status_msg_busy_next(msg);\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
led_offs = 4;\r
scr_offs = pitch * 2 + 4;\r
\r
-#if 0\r
- if (currentConfig.renderer != RT_16BIT) {\r
- #define p(x) px[(x) >> 2]\r
- // 8-bit modes\r
- unsigned int *px = (unsigned int *)((char *)g_screen_ptr + scr_offs);\r
- unsigned int col_g = (led_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0;\r
- unsigned int col_r = (led_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0;\r
- p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g;\r
- p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r;\r
- #undef p\r
- } else\r
-#endif\r
- {\r
- #define p(x) px[(x)*2 >> 2] = px[((x)*2 >> 2) + 1]\r
- // 16-bit modes\r
- unsigned int *px = (unsigned int *)((short *)g_screen_ptr + scr_offs);\r
- unsigned int col_g = (led_reg & 2) ? 0x06000600 : 0;\r
- unsigned int col_r = (led_reg & 1) ? 0xc000c000 : 0;\r
- p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g;\r
- p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r;\r
- #undef p\r
- }\r
+#define p(x) px[(x)*2 >> 2] = px[((x)*2 >> 2) + 1]\r
+ // 16-bit modes\r
+ unsigned int *px = (unsigned int *)((short *)g_screen_ptr + scr_offs);\r
+ unsigned int col_g = (led_reg & 2) ? 0x06000600 : 0;\r
+ unsigned int col_r = (led_reg & 1) ? 0xc000c000 : 0;\r
+ p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g;\r
+ p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r;\r
+#undef p\r
}\r
\r
void pemu_finalize_frame(const char *fps, const char *notice)\r
{\r
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X)) {\r
- unsigned short *pd = (unsigned short *)g_screen_ptr + out_y * g_screen_ppitch + out_x;\r
+ unsigned short *pd = (unsigned short *)g_screen_ptr +\r
+ out_y * g_screen_ppitch + out_x;\r
unsigned char *ps = Pico.est.Draw2FB + 328*out_y + 8; //+ out_x;\r
unsigned short *pal = Pico.est.HighPal;\r
int i, x;\r
}\r
}\r
\r
- if (notice || (currentConfig.EmuOpt & EOPT_SHOW_FPS)) {\r
- if (notice)\r
- emu_osd_text16(4, g_screen_height - 8, notice);\r
- if (currentConfig.EmuOpt & EOPT_SHOW_FPS)\r
- emu_osd_text16(g_screen_width - 60, g_screen_height - 8, fps);\r
- }\r
+ if (notice)\r
+ emu_osd_text16(4, g_screen_height - 8, notice);\r
+ if (currentConfig.EmuOpt & EOPT_SHOW_FPS)\r
+ emu_osd_text16(g_screen_width - 60, g_screen_height - 8, fps);\r
if ((PicoIn.AHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS))\r
draw_cd_leds();\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
+\r
static void apply_renderer(void)\r
{\r
switch (currentConfig.renderer) {\r
\r
void plat_status_msg_busy_first(const char *msg)\r
{\r
-// memset32(g_screen_ptr, 0, g_screen_ppitch * g_screen_height * 2 / 4);\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
- memset32(g_screen_ptr, 0, g_screen_ppitch * g_screen_height * 2 / 4);\r
+ clr_cnt = 4;\r
+\r
out_y = start_line; out_x = (is_32cols ? 32 : 0);\r
out_h = line_count; out_w = (is_32cols ? 256:320);\r
}\r
ximage_realloc(xlib_display, DefaultVisual(xlib_display, 0));
// propagate new ponters to renderers
- plat_video_toggle_renderer(0, 0);
+ plat_video_set_buffer(g_screen_ptr);
}
}