When uploading video pixels, detect w/h by size.

Sometimes the framebuffer size is incorrect, but kinda works... but this
is a problem for the video.  Using the size gets us better.

In Wild Arms XF, the framebuffer is 512x512, but that's not right.  It's
clear it should be 480x272.
This commit is contained in:
Unknown W. Brackets 2014-04-12 21:11:47 -07:00
parent 1f76adb7a3
commit 1a53be45cc

View File

@ -1677,10 +1677,20 @@ void FramebufferManager::UpdateFromMemory(u32 addr, int size, bool safe) {
// However, it doesn't seem to work for Star Ocean, at least
if (useBufferedRendering_ && vfb->fbo) {
DisableState();
glstate.viewport.set(0, 0, vfb->renderWidth, vfb->renderHeight);
fbo_bind_as_render_target(vfb->fbo);
if (gl_extensions.gpuVendor != GPU_VENDOR_POWERVR)
glstate.viewport.restore();
int w = vfb->bufferWidth;
int h = vfb->bufferHeight;
// Often, the framebuffer size is incorrect. But here we have the size. Bit of a hack.
if (vfb->fb_stride == 512 && (size == 512 * 272 * 4 || size == 512 * 272 * 2)) {
// Looks like a standard 480x272 sized framebuffer/video/etc.
w = 480;
h = 272;
}
// Scale by the render resolution factor.
w = (w * vfb->renderWidth) / vfb->bufferWidth;
h = (h * vfb->renderHeight) / vfb->bufferHeight;
glstate.viewport.set(0, vfb->renderHeight - h, w, h);
needUnbind = true;
DrawPixels(Memory::GetPointer(addr | 0x04000000), vfb->format, vfb->fb_stride);
} else {