X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fgp2x%2Fgp2x-video.c;h=7f4159bacbf1be320f1614e71e7f5adeb942d21e;hb=396c448eb538587248ddbf586a90371c71b48183;hp=ef4a4dce4f7d68703b55858999d7bd5f3a8b1189;hpb=21afaa365c97896da6ccbdd6540e20f2d2bb4990;p=fceu.git diff --git a/drivers/gp2x/gp2x-video.c b/drivers/gp2x/gp2x-video.c index ef4a4dc..7f4159b 100644 --- a/drivers/gp2x/gp2x-video.c +++ b/drivers/gp2x/gp2x-video.c @@ -21,10 +21,10 @@ #include "../../video.h" -#include "main.h" +#include "../common/main.h" #include "gp2x.h" #include "minimal.h" -#include "fonts.h" +#include "../libpicofe/fonts.h" #include "asmutils.h" static char fps_str[32]; @@ -99,16 +99,12 @@ int InitVideo(void) } -void ToggleFS(void) -{ -} - - -// 16: rrrr rggg gggb bbbb +// 16: rrrr rggg gg0b bbbb void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b) { + /* note: menu depends on bit5 being 0 */ gp2x_palette[index] = (r << 16) | (g << 8) | b; - gp2x_palette16[index] = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3); + gp2x_palette16[index] = ((r & 0xf8) << 8) | ((g & 0xf8) << 3) | (b >> 3); gp2x_video_setpalette(gp2x_palette, index + 1); paletterefresh = 1; @@ -160,19 +156,17 @@ static INLINE void printFps(uint8 *screen) } -void BlitScreen(uint8 *buf) +void BlitPrepare(int skip) { framesEmulated++; - if (!buf) { + if (skip) { printFps(0); return; } framesRendered++; - printFps(gp2x_screen); - if (eoptions & EO_CLIPSIDES) { int i, *p = (int *) ((char *)gp2x_screen + 32); @@ -182,6 +176,22 @@ void BlitScreen(uint8 *buf) } } + if (Settings.accurate_mode && Settings.scaling < 2) + { + int i, *p = (int *)gp2x_screen + 32/4; + if (srendline > 0) + for (i = srendline; i > 0; i--, p += 320/4) + memset32(p, 0, 256/4); + if (erendline < 239) + { + int *p = (int *)gp2x_screen + erendline*320/4 + 32/4; + for (i = 239-srendline; i > 0; i--, p += 320/4) + memset32(p, 0, 256/4); + } + } + + printFps(gp2x_screen); + if (Settings.scaling == 3) { soft_scale((char *)gp2x_screen + 32, gp2x_palette16, srendline, erendline-srendline); @@ -189,8 +199,18 @@ void BlitScreen(uint8 *buf) memset32((int *)((char *)gp2x_screen + 32), 0, srendline*320*2/4); } - gp2x_video_flip(); - XBuf = gp2x_screen; + /* at this point we should be done with the frame */ + gp2x_video_flush_cache(); +} + + +void BlitScreen(int skip) +{ + if (!skip) + { + gp2x_video_flip(); + XBuf = gp2x_screen; + } }