From 4e2892d85277ab81696d5d93eaef098f0019359a Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 18 Feb 2017 16:09:08 -0600 Subject: [PATCH] gpgx now width-doubles to match height-doubled hi-res video --- .../Consoles/Sega/gpgx/GPGX.IVideoProvider.cs | 69 ++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IVideoProvider.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IVideoProvider.cs index d60ff246dd..541e9aa037 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IVideoProvider.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IVideoProvider.cs @@ -42,34 +42,57 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx LibGPGX.gpgx_get_video(out gpwidth, out gpheight, out gppitch, ref src); + //in case we're receiving high vertical resolution video, we shall double the horizontal resolution to keep the same proportions + //(concept pioneered for snes) + + bool dotDouble = (gpheight == 448); //todo: pal? + vwidth = gpwidth; - vheight = gpheight; - + vheight = gpheight; + if (_settings.PadScreen320 && vwidth == 256) - vwidth = 320; - + vwidth = 320; + int xpad = (vwidth - gpwidth) / 2; - int xpad2 = vwidth - gpwidth - xpad; + int xpad2 = vwidth - gpwidth - xpad; + + if (dotDouble) vwidth *= 2; if (vidbuff.Length < vwidth * vheight) - vidbuff = new int[vwidth * vheight]; - - int rinc = (gppitch / 4) - gpwidth; - fixed (int* pdst_ = &vidbuff[0]) - { - int* pdst = pdst_; - int* psrc = (int*)src; - - for (int j = 0; j < gpheight; j++) - { - for (int i = 0; i < xpad; i++) - *pdst++ = unchecked((int)0xff000000); - for (int i = 0; i < gpwidth; i++) - *pdst++ = *psrc++;// | unchecked((int)0xff000000); - for (int i = 0; i < xpad2; i++) - *pdst++ = unchecked((int)0xff000000); - psrc += rinc; - } + vidbuff = new int[vwidth * vheight]; + + int xskip = 1; + if (dotDouble) + xskip = 2; + + for (int D = 0; D < xskip; D++) + { + int rinc = (gppitch / 4) - gpwidth; + fixed (int* pdst_ = &vidbuff[0]) + { + int* pdst = pdst_ + D; + int* psrc = (int*)src; + + for (int j = 0; j < gpheight; j++) + { + for (int i = 0; i < xpad; i++) + { + *pdst = unchecked((int)0xff000000); + pdst += xskip; + } + for (int i = 0; i < gpwidth; i++) + { + *pdst = *psrc++;// | unchecked((int)0xff000000); + pdst += xskip; + } + for (int i = 0; i < xpad2; i++) + { + *pdst = unchecked((int)0xff000000); + pdst += xskip; + } + psrc += rinc; + } + } } }