From 3bd5cfed737294f2583e310bfb84082d58bf8ebe Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Mon, 17 Dec 2012 22:52:31 +0100 Subject: [PATCH] Work around for strange idling issue, various fixes --- Core/CoreTiming.cpp | 2 ++ Core/HLE/sceDisplay.cpp | 13 +++++++++---- Core/HLE/sceUmd.cpp | 16 +++++++++++++++- GPU/GLES/DisplayListInterpreter.cpp | 3 ++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index c9bc5a6db7..6cffd3d3eb 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -504,6 +504,8 @@ void Idle(int maxIdle) idledCycles += cyclesDown; downcount -= cyclesDown; + if (downcount == 0) + downcount = -1; } std::string GetScheduledEventsSummary() diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 591c1b382d..df34fda23c 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -359,13 +359,18 @@ void sceDisplayWaitVblankStartMultiCB() __KernelWaitCurThread(WAITTYPE_VBLANK, 0, 0, 0, true); } -void sceDisplayGetVcount() +u32 sceDisplayGetVcount() { // Too spammy // DEBUG_LOG(HLE,"%i=sceDisplayGetVcount()", vCount); - // Games like Puyo Puyo call this in a tight loop at end-of-frame. We could have it consume some time from CoreTiming? + + // Puyo Puyo Fever polls this as a substitute for waiting vblank. + // As a result, the game never gets to reschedule so it doesn't mix audio and things break. + // I added this as a workaround until we figure out what call actually does reschedule - it doesn't call much though... + CoreTiming::Idle(1000000); - RETURN(vCount); + __KernelReSchedule(); // Puyo puyo hack? + return vCount; } void sceDisplayGetCurrentHcount() @@ -403,7 +408,7 @@ const HLEFunction sceDisplay[] = {0xdba6c4c4,WrapF_V,"sceDisplayGetFramePerSec"}, {0x773dd3a3,sceDisplayGetCurrentHcount,"sceDisplayGetCurrentHcount"}, {0x210eab3a,sceDisplayGetAccumulatedHcount,"sceDisplayGetAccumulatedHcount"}, - {0x9C6EAAD7,sceDisplayGetVcount,"sceDisplayGetVcount"}, + {0x9C6EAAD7,WrapU_V,"sceDisplayGetVcount"}, {0xDEA197D4,0,"sceDisplayGetMode"}, {0x7ED59BC4,0,"sceDisplaySetHoldMode"}, {0xA544C486,0,"sceDisplaySetResumeMode"}, diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 35f4534173..fbe74b1ce8 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -300,6 +300,19 @@ u32 sceUmdGetErrorStat() return umdErrorStat; } +u32 sceUmdReplaceProhibit() +{ + DEBUG_LOG(HLE,"sceUmdReplaceProhibit()"); + return 0; +} + +u32 sceUmdReplacePermit() +{ + DEBUG_LOG(HLE,"sceUmdReplacePermit()"); + return 0; +} + + const HLEFunction sceUmdUser[] = { @@ -316,7 +329,8 @@ const HLEFunction sceUmdUser[] = {0x340B7686,WrapU_U,"sceUmdGetDiscInfo"}, {0xAEE7404D,&WrapU_U,"sceUmdRegisterUMDCallBack"}, {0xBD2BDE07,&WrapU_U,"sceUmdUnRegisterUMDCallBack"}, - {0x87533940,0,"sceUmdReplaceProhibit"}, // ??? sounds bogus + {0x87533940,WrapU_V,"sceUmdReplaceProhibit"}, + {0x87533940,WrapU_V,"sceUmdReplacePermit"}, }; void Register_sceUmdUser() diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 856710c134..90931d75bc 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -47,7 +47,8 @@ GLES_GPU::GLES_GPU(int renderWidth, int renderHeight) : interruptsEnabled_(true), renderWidth_(renderWidth), renderHeight_(renderHeight), - dlIdGenerator(1) + dlIdGenerator(1), + displayFramebufPtr_(0) { renderWidthFactor_ = (float)renderWidth / 480.0f; renderHeightFactor_ = (float)renderHeight / 272.0f;