- unsigned int *dst = d;
- const unsigned short *src = s;
- int r0, g0, b0, r1, g1, b1;
- int y0, y1, u, v;
-
- for (; pixels > 0; src += 2, dst++, pixels -= 2) {
- r0 = src[0] >> 11;
- g0 = (src[0] >> 6) & 0x1f;
- b0 = src[0] & 0x1f;
- r1 = src[1] >> 11;
- g1 = (src[1] >> 6) & 0x1f;
- b1 = src[1] & 0x1f;
- y0 = (int)((0.299f * r0) + (0.587f * g0) + (0.114f * b0));
- y1 = (int)((0.299f * r1) + (0.587f * g1) + (0.114f * b1));
- //u = (int)(((-0.169f * r0) + (-0.331f * g0) + ( 0.499f * b0)) * 8) + 128;
- //v = (int)((( 0.499f * r0) + (-0.418f * g0) + (-0.0813f * b0)) * 8) + 128;
- u = (int)(8 * 0.565f * (b0 - y0)) + 128;
- v = (int)(8 * 0.713f * (r0 - y0)) + 128;
- // valid Y range seems to be 16..235
- y0 = 16 + 219 * y0 / 31;
- y1 = 16 + 219 * y1 / 31;
-
- if (y0 < 0 || y0 > 255 || y1 < 0 || y1 > 255
- || u < 0 || u > 255 || v < 0 || v > 255)
- {
- printf("oor: %d, %d, %d, %d\n", y0, y1, u, v);
- }
- *dst = (y1 << 24) | (v << 16) | (y0 << 8) | u;
+ SDL_LockYUVOverlay(plat_sdl_overlay);
+ basic_text_out_uyvy_nf(plat_sdl_overlay->pixels[0], plat_sdl_overlay->w, x, y, str);
+ SDL_UnlockYUVOverlay(plat_sdl_overlay);
+}
+
+void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
+{
+ psx_w = *w;
+ psx_h = *h;
+ change_video_mode(0);
+ if (plat_sdl_overlay != NULL) {
+ pl_plat_clear = plat_sdl_overlay_clear;
+ pl_plat_blit = overlay_blit;
+ pl_plat_hud_print = overlay_hud_print;
+ return NULL;
+ }
+ else {
+ pl_plat_clear = NULL;
+ pl_plat_blit = NULL;
+ pl_plat_hud_print = NULL;
+ if (plat_sdl_gl_active)
+ return shadow_fb;
+ else
+ return plat_sdl_screen->pixels;