unsafe void update_video() { int pitch = 0; IntPtr src = IntPtr.Zero; LibGPGX.gpgx_get_video(ref vwidth, ref vheight, ref pitch, ref src); if (vidbuff.Length < vwidth * vheight) { vidbuff = new int[vwidth * vheight]; } int rinc = (pitch / 4) - vwidth; fixed(int *pdst_ = &vidbuff[0]) { int *pdst = pdst_; int *psrc = (int *)src; for (int j = 0; j < vheight; j++) { for (int i = 0; i < vwidth; i++) { *pdst++ = *psrc++; // | unchecked((int)0xff000000); } psrc += rinc; } } }
unsafe void update_video() { int gppitch, gpwidth, gpheight; IntPtr src = IntPtr.Zero; LibGPGX.gpgx_get_video(out gpwidth, out gpheight, out gppitch, ref src); vwidth = gpwidth; vheight = gpheight; if (_Settings.PadScreen320 && vwidth == 256) { vwidth = 320; } int xpad = (vwidth - gpwidth) / 2; int xpad2 = vwidth - gpwidth - xpad; 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; } } }
private unsafe void UpdateVideo() { int gppitch, gpwidth, gpheight; IntPtr src = IntPtr.Zero; 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? bool lineDouble = false; vwidth = gpwidth; vheight = gpheight; if (_settings.AlwaysDoubleSize) { dotDouble = true; if (gpheight == 224 || gpheight == 240) { lineDouble = true; vheight *= 2; } } if (_settings.PadScreen320 && vwidth == 256) { vwidth = 320; } int xpad = (vwidth - gpwidth) / 2; int xpad2 = vwidth - gpwidth - xpad; if (dotDouble) { vwidth *= 2; } if (vidbuff.Length < vwidth * vheight) { vidbuff = new int[vwidth * vheight]; } int xskip = 1; if (dotDouble) { xskip = 2; } int lines = lineDouble ? 2: 1; 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++) { int *ppsrc = psrc; for (int L = 0; L < lines; L++) { int *pppsrc = ppsrc; for (int i = 0; i < xpad; i++) { *pdst = unchecked ((int)0xff000000); pdst += xskip; } for (int i = 0; i < gpwidth; i++) { *pdst = *pppsrc++; // | unchecked((int)0xff000000); pdst += xskip; } for (int i = 0; i < xpad2; i++) { *pdst = unchecked ((int)0xff000000); pdst += xskip; } psrc = pppsrc; } psrc += rinc; } } } }