Workaround for motogp setting a bogus framebuffer address.

This commit is contained in:
Henrik Rydgard committed 2012-11-19 23:53:38 +01:00
1 parent 8b67975a47
commit 4a49b8ee36
5 files changed
+34 -11

No files matched your search

+10
View File
@@ -167,6 +167,16 @@ template<u32 func(u32, u32, u32, u32)> void WrapU_UUUU() {
RETURN(retval);
}
template<u32 func(u32, u32, u32, int)> void WrapU_UUUI() {
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
RETURN(retval);
}
template<u32 func(u32, int, int, int)> void WrapU_UIII() {
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
RETURN(retval);
}
template<int func(int, u32, u32, u32, u32)> void WrapI_IUUUU() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
RETURN(retval);
+13 -6
View File
@@ -229,10 +229,19 @@ void sceDisplaySetFramebuf()
RETURN(0);
}
void sceDisplayGetFramebuf()
u32 sceDisplayGetFramebuf(u32 topaddrPtr, u32 linesizePtr, u32 pixelFormatPtr, int mode)
{
DEBUG_LOG(HLE,"sceDisplayGetFramebuf()");
RETURN(framebuf.topaddr);
DEBUG_LOG(HLE,"sceDisplayGetFramebuf(%08x, %08x, %08x, %i)");
const FrameBufferState &fbState = mode == 1 ? latchedFramebuf : framebuf;
if (Memory::IsValidAddress(topaddrPtr))
Memory::Write_U32(fbState.topaddr, topaddrPtr);
if (Memory::IsValidAddress(linesizePtr))
Memory::Write_U32(fbState.pspFramebufLinesize, linesizePtr);
if (Memory::IsValidAddress(pixelFormatPtr))
Memory::Write_U32(fbState.pspFramebufFormat, pixelFormatPtr);
return 0;
}
void sceDisplayWaitVblankStart()
@@ -302,6 +311,7 @@ const HLEFunction sceDisplay[] =
{
{0x0E20F177,&WrapU_UUU<sceDisplaySetMode>, "sceDisplaySetMode"},
{0x289D82FE,sceDisplaySetFramebuf, "sceDisplaySetFramebuf"},
{0xEEDA2E54,&WrapU_UUUI<sceDisplayGetFramebuf>,"sceDisplayGetFrameBuf"},
{0x36CDFADE,sceDisplayWaitVblank, "sceDisplayWaitVblank"},
{0x984C27E7,sceDisplayWaitVblankStart, "sceDisplayWaitVblankStart"},
{0x8EB9EC49,sceDisplayWaitVblankCB, "sceDisplayWaitVblankCB"},
@@ -312,12 +322,9 @@ const HLEFunction sceDisplay[] =
{0x773dd3a3,sceDisplayGetCurrentHcount,"sceDisplayGetCurrentHcount"},
{0x210eab3a,sceDisplayGetAccumulatedHcount,"sceDisplayGetAccumulatedHcount"},
{0x9C6EAAD7,sceDisplayGetVcount,"sceDisplayGetVcount"},
{0x984C27E7,0,"sceDisplayWaitVblankStart"},
{0xDEA197D4,0,"sceDisplayGetMode"},
{0x7ED59BC4,0,"sceDisplaySetHoldMode"},
{0xA544C486,0,"sceDisplaySetResumeMode"},
{0x289D82FE,0,"sceDisplaySetFrameBuf"},
{0xEEDA2E54,sceDisplayGetFramebuf,"sceDisplayGetFrameBuf"},
{0xB4F378FA,0,"sceDisplayIsForeground"},
{0x31C4BAA8,0,"sceDisplayGetBrightness"},
{0x4D4E10EC,sceDisplayIsVblank,"sceDisplayIsVblank"},
+9 -3
View File
@@ -89,9 +89,13 @@ void GLES_GPU::BeginFrame()
void GLES_GPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, int format)
{
displayFramebufPtr_ = framebuf;
displayStride_ = stride;
displayFormat_ = format;
if (framebuf & 0x04000000) {
displayFramebufPtr_ = framebuf;
displayStride_ = stride;
displayFormat_ = format;
} else {
DEBUG_LOG(HLE, "Bogus framebufffer address: %08x", framebuf);
}
}
void GLES_GPU::CopyDisplayToOutput()
@@ -135,6 +139,8 @@ GLES_GPU::VirtualFramebuffer *GLES_GPU::GetDisplayFBO()
return *iter;
}
}
return 0;
}
+1 -1
View File
@@ -193,7 +193,7 @@ void DisplayDrawer_DrawFramebuffer(u8 *framebuf, int pixelFormat, int linesize)
DrawActiveTexture(480, 272);
}
void DrawActiveTexture(int w, int h, bool flip)
void DrawActiveTexture(float w, float h, bool flip)
{
float u2 = 1.0f;
float v1 = flip ? 1.0 : 0.0f;
+1 -1
View File
@@ -32,4 +32,4 @@ enum PspDisplayPixelFormat {
void DisplayDrawer_Init();
void DisplayDrawer_DrawFramebuffer(u8 *framebuf, int pixelFormat, int linesize);
void DisplayDrawer_Shutdown();
void DrawActiveTexture(int w, int h, bool flip = false);
void DrawActiveTexture(float w, float h, bool flip = false);