+#define make_flip_func(name, blitfunc) \
+static void name(int x, int y) \
+{ \
+ unsigned short *vram = psx_vram; \
+ unsigned char *dst = (unsigned char *)g_menuscreen_ptr + \
+ (fb_offset_y * 320 + fb_offset_x) * psx_bpp / 8; \
+ unsigned int src = (y + psx_offset_y) * 1024 + x + psx_offset_x; \
+ int dst_stride = 320 * psx_bpp / 8; \
+ int len = psx_width * psx_bpp / 8; \
+ int i; \
+ \
+ pcnt_start(PCNT_BLIT); \
+ \
+ for (i = psx_height; i > 0; i--, src += psx_step * 1024, dst += dst_stride) { \
+ src &= 1024*512-1; \
+ blitfunc(dst, vram + src, len); \
+ } \
+ \
+ if (psx_bpp == 16) { \
+ pl_vout_buf = g_menuscreen_ptr; \
+ pl_print_hud(320, fb_offset_y + psx_height, fb_offset_x); \
+ } \
+ \
+ g_menuscreen_ptr = fb_flip(); \
+ pl_flip_cnt++; \
+ \
+ pcnt_end(PCNT_BLIT); \
+}
+
+make_flip_func(raw_flip_soft, memcpy)
+make_flip_func(raw_flip_soft_368, blit320_368)
+make_flip_func(raw_flip_soft_512, blit320_512)
+make_flip_func(raw_flip_soft_640, blit320_640)
+
+static void *pl_vout_set_mode(int w, int h, int bpp)