From e2303a4166ec3b78219115c18a0113e24fa48cf6 Mon Sep 17 00:00:00 2001 From: neonloop Date: Sat, 3 Apr 2021 00:38:20 +0000 Subject: Adds overscan scaler and fps display --- shell/video/sdl/video_blit.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'shell/video/sdl') diff --git a/shell/video/sdl/video_blit.c b/shell/video/sdl/video_blit.c index 6a8f748..3e6a0a3 100644 --- a/shell/video/sdl/video_blit.c +++ b/shell/video/sdl/video_blit.c @@ -87,23 +87,35 @@ void Update_Video_Ingame() uint16_t *s, *d; uint32_t h, w; uint8_t PAL = !!(Memory.FillRAM[0x2133] & 4); + uint32_t width = IPPU.RenderedScreenWidth; + uint32_t height = IPPU.RenderedScreenHeight; + if (height == SNES_HEIGHT_EXTENDED) height++; // 239 to 240 SDL_LockSurface(sdl_screen); switch(option.fullscreen) { - case 0: - s = (uint16_t*) GFX.Screen; - d = (uint16_t*) sdl_screen->pixels + ((sdl_screen->w - IPPU.RenderedScreenWidth)/2 + (sdl_screen->h - IPPU.RenderedScreenHeight) * 160) - (PAL ? 0 : 2*320); - for(uint8_t y = 0; y < IPPU.RenderedScreenHeight; y++, s += IPPU.RenderedScreenWidth, d += sdl_screen->w) memmove(d, s, IPPU.RenderedScreenWidth * 2); + case 0: // Native + s = (uint16_t*) GFX.Screen; + d = (uint16_t*) sdl_screen->pixels + ((sdl_screen->w - width)/2 + (sdl_screen->h - height) * 160) - (PAL ? 0 : 2*320); + for(uint8_t y = 0; y < height; y++, s += width, d += sdl_screen->w) memmove(d, s, width * 2); break; - case 1: - upscale_256xXXX_to_320x240((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, IPPU.RenderedScreenWidth, PAL ? 240 : 224); + case 1: // FS Sharp + upscale_256xXXX_to_320x240((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, width, height, height); break; - case 2: - if (IPPU.RenderedScreenHeight == 240) upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, IPPU.RenderedScreenWidth, 239); - else upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels + (160*8), (uint32_t*) GFX.Screen, IPPU.RenderedScreenWidth, 224); + case 2: // FS Smooth + upscale_256xXXX_to_320x240((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, width, height, 240/2); break; + case 3: // Bilinear + if (height == 240) + upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels, (uint32_t*) GFX.Screen, width, 239); + else upscale_256x240_to_320x240_bilinearish((uint32_t*) sdl_screen->pixels + (160*8), (uint32_t*) GFX.Screen, width, 224); + break; + case 4: // Overscan + if (height == 240) + upscale_240x208_to_320x240((uint16_t*) sdl_screen->pixels, (uint16_t*) GFX.Screen + (width*8), width); + else upscale_240x208_to_320x240((uint16_t*) sdl_screen->pixels, (uint16_t*) GFX.Screen, width); + break; } //bitmap_scale(0, 0, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, sdl_screen->w, sdl_screen->h, SNES_WIDTH*2, 0, GFX.Screen, sdl_screen->pixels); -- cgit v1.2.3