Keep a separate pointer for non-VRAM displayptr. Fixes GTA intro movie while still not breaking MotoGP.

This commit is contained in:
Henrik Rydgard 2013-06-06 00:01:43 +02:00
parent 443e9eca8e
commit 9ae044de43
3 changed files with 11 additions and 6 deletions

View File

@ -1009,9 +1009,9 @@ void GLES_GPU::DoBlockTransfer() {
// A few games use this INSTEAD of actually drawing the video image to the screen, they just blast it to
// the backbuffer. Detect this and have the framebuffermanager draw the pixels.
u32 backBuffer = 0x04000000 | framebufferManager_.PrevDisplayFramebufAddr();
u32 backBuffer = framebufferManager_.PrevDisplayFramebufAddr();
if (dstBasePtr == backBuffer && width == 512 && height == 272) {
if (backBuffer != 0 && dstBasePtr == backBuffer && width == 512 && height == 272) {
framebufferManager_.DrawPixels(Memory::GetPointer(dstBasePtr), 3, 512);
}
}

View File

@ -106,6 +106,7 @@ void CenterRect(float *x, float *y, float *w, float *h,
}
FramebufferManager::FramebufferManager() :
displayFramebuf_(0),
displayFramebufPtr_(0),
prevDisplayFramebuf_(0),
prevPrevDisplayFramebuf_(0),
@ -268,7 +269,7 @@ VirtualFramebuffer *FramebufferManager::GetDisplayFBO() {
VirtualFramebuffer *match = NULL;
for (auto iter = vfbs_.begin(); iter != vfbs_.end(); ++iter) {
VirtualFramebuffer *v = *iter;
if (MaskedEqual(v->fb_address, displayFramebufPtr_) && v->format == displayFormat_) {
if (MaskedEqual(v->fb_address, displayFramebufPtr_) && v->format == displayFormat_ && v->width >= 480) {
// Could check w too but whatever
if (match == NULL || match->last_frame_used < v->last_frame_used) {
match = v;
@ -502,9 +503,9 @@ void FramebufferManager::CopyDisplayToOutput() {
VirtualFramebuffer *vfb = GetDisplayFBO();
if (!vfb) {
if (Memory::IsValidAddress(displayFramebufPtr_)) {
if (Memory::IsValidAddress(ramDisplayFramebufPtr_)) {
// The game is displaying something directly from RAM. In GTA, it's decoded video.
DrawPixels(Memory::GetPointer(displayFramebufPtr_), displayFormat_, displayStride_);
DrawPixels(Memory::GetPointer(ramDisplayFramebufPtr_), displayFormat_, displayStride_);
} else {
DEBUG_LOG(HLE, "Found no FBO to display! displayFBPtr = %08x", displayFramebufPtr_);
// No framebuffer to display! Clear to black.
@ -585,6 +586,9 @@ void FramebufferManager::SetDisplayFramebuffer(u32 framebuf, u32 stride, int for
if ((framebuf & 0x04000000) == 0) {
DEBUG_LOG(HLE, "Non-VRAM display framebuffer address set: %08x", framebuf);
ramDisplayFramebufPtr_ = framebuf;
displayStride_ = stride;
displayFormat_ = format;
} else {
displayFramebufPtr_ = framebuf;
displayStride_ = stride;

View File

@ -109,10 +109,11 @@ public:
int GetTargetHeight() const { return currentRenderVfb_ ? currentRenderVfb_->height : 272; }
u32 PrevDisplayFramebufAddr() {
return prevDisplayFramebuf_ ? prevDisplayFramebuf_->fb_address : 0;
return prevDisplayFramebuf_ ? (0x04000000 | prevDisplayFramebuf_->fb_address) : 0;
}
private:
u32 ramDisplayFramebufPtr_; // workaround for MotoGP insanity
u32 displayFramebufPtr_;
u32 displayStride_;
int displayFormat_;