+ vout_gp2x_flip();
+ host_screen = g_screen_ptr;
+ return host_screen;
+}
+
+int host_video_init(int *stride, int no_dblbuf)
+{
+ int ret;
+
+ host_stride = 320 * 2;
+ if (stride != 0)
+ *stride = host_stride;
+
+ ret = vout_gp2x_init(no_dblbuf);
+ if (ret != 0)
+ return ret;
+
+ host_video_flip();
+ return 0;
+}
+
+#endif
+
+static unsigned short host_pal[256];
+
+static void host_update_pal(unsigned int *pal)
+{
+ unsigned short *dstp = host_pal;
+ int i;
+
+ for (i = 0; i < 256; i++, pal++, dstp++) {
+ unsigned int t = *pal;
+ *dstp = ((t >> 8) & 0xf800) | ((t >> 5) & 0x07e0) | ((t >> 3) & 0x001f);
+ }
+}
+
+void host_video_blit4(const unsigned char *src, int w, int h, unsigned int *pal)
+{
+ unsigned short *dst = host_screen;
+ unsigned short *hpal = host_pal;
+ int i, u;
+
+ if (pal != NULL)
+ host_update_pal(pal);
+
+ for (i = 0; i < 240; i++, dst += host_stride / 2 - 320) {
+ for (u = 320 / 2; u > 0; u--, src++) {
+ *dst++ = hpal[*src >> 4];
+ *dst++ = hpal[*src & 0x0f];
+ }
+ }
+
+ host_video_flip();