diff --git a/Core/Config.cpp b/Core/Config.cpp index 9d6e45a277..d7feb25fe9 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -100,8 +100,6 @@ void Config::Load(const char *iniFileName) graphics->Get("SSAA", &SSAntiAliasing, 0); graphics->Get("VBO", &bUseVBO, false); graphics->Get("FrameSkip", &iFrameSkip, 0); - graphics->Get("Vps Unlock", &bVpsLimit, false); - graphics->Get("Vps Num", &iNumVps, 90); graphics->Get("UseMediaEngine", &bUseMediaEngine, true); #ifdef USING_GLES2 graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0); diff --git a/Core/Config.h b/Core/Config.h index 4b59b502b9..2d54d90f71 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -61,8 +61,6 @@ public: bool bUseVBO; bool bStretchToDisplay; int iFrameSkip; - int iNumVps; - bool bVpsLimit; bool bUseMediaEngine; int iWindowX; diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index b43b986ef5..1939c85c80 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -26,6 +26,7 @@ #include "Thread.h" #include "../Core/CoreTiming.h" #include "../Core/CoreParameter.h" +#include "Core/Reporting.h" #include "../MIPS/MIPS.h" #include "../HLE/HLE.h" #include "sceAudio.h" @@ -93,8 +94,6 @@ static int height; // Don't include this in the state, time increases regardless of state. static double curFrameTime; static double nextFrameTime; -double vfpLimit; -double vfpLimis; static u64 frameStartTicks; const float hCountPerVblank = 285.72f; // insprired by jpcsp @@ -109,7 +108,7 @@ std::vector vblankListeners; // The vblank period is 731.5 us (0.7315 ms) const double vblankMs = 0.7315; -double frameMs = 1000.0 / 60.0; +const double frameMs = 1000.0 / 60.0; enum { PSP_DISPLAY_SETBUF_IMMEDIATE = 0, @@ -137,11 +136,7 @@ void __DisplayInit() { enterVblankEvent = CoreTiming::RegisterEvent("EnterVBlank", &hleEnterVblank); leaveVblankEvent = CoreTiming::RegisterEvent("LeaveVBlank", &hleLeaveVblank); afterFlipEvent = CoreTiming::RegisterEvent("AfterFlip", &hleAfterFlip); - if (!g_Config.bVpsLimit) { - frameMs = 1000.0 / 60.0; - } else { - frameMs = 1000.0 / g_Config.iNumVps; - } + CoreTiming::ScheduleEvent(msToCycles(frameMs - vblankMs), enterVblankEvent, 0); isVblank = 0; vCount = 0; @@ -312,28 +307,22 @@ void DoFrameTiming(bool &throttle, bool &skipFrame) { time_update(); - if (!g_Config.bVpsLimit) { - vfpLimit=60.0; - vfpLimis=30.0; - } else { - vfpLimit=g_Config.iNumVps; - vfpLimis=g_Config.iNumVps / 2; - } curFrameTime = time_now_d(); if (nextFrameTime == 0.0) - nextFrameTime = time_now_d() + 1.0 / vfpLimit; + nextFrameTime = time_now_d() + 1.0 / 60.0; if (curFrameTime > nextFrameTime && doFrameSkip) { // Argh, we are falling behind! Let's skip a frame and see if we catch up. skipFrame = true; // INFO_LOG(HLE,"FRAMESKIP %i", numSkippedFrames); } + if (curFrameTime < nextFrameTime && throttle) { // If time gap is huge just jump (somebody unthrottled) - if (nextFrameTime - curFrameTime > 1.0 / vfpLimis) { - nextFrameTime = curFrameTime + 1.0 / vfpLimit; + if (nextFrameTime - curFrameTime > 1.0 / 30.0) { + nextFrameTime = curFrameTime + 1.0 / 60.0; } else { // Wait until we've catched up. while (time_now_d() < nextFrameTime) { @@ -348,9 +337,9 @@ void DoFrameTiming(bool &throttle, bool &skipFrame) { const double maxFallBehindFrames = 5.5; if (throttle || doFrameSkip) { - nextFrameTime = std::max(nextFrameTime + 1.0 / vfpLimit, time_now_d() - maxFallBehindFrames / vfpLimit); + nextFrameTime = std::max(nextFrameTime + 1.0 / 60.0, time_now_d() - maxFallBehindFrames / 60.0); } else { - nextFrameTime = nextFrameTime + 1.0 / vfpLimit; + nextFrameTime = nextFrameTime + 1.0 / 60.0; } // Max 4 skipped frames in a row - 15 fps is really the bare minimum for playability. @@ -448,11 +437,6 @@ void hleLeaveVblank(u64 userdata, int cyclesLate) { isVblank = 0; DEBUG_LOG(HLE,"Leave VBlank %i", (int)userdata - 1); frameStartTicks = CoreTiming::GetTicks(); - if (!g_Config.bVpsLimit) { - frameMs = 1000.0 / 60.0; - } else { - frameMs = 1000.0 / g_Config.iNumVps; - } CoreTiming::ScheduleEvent(msToCycles(frameMs - vblankMs) - cyclesLate, enterVblankEvent, userdata); } @@ -542,7 +526,7 @@ u32 sceDisplayWaitVblank() { return 0; } else { DEBUG_LOG(HLE,"sceDisplayWaitVblank() - not waiting since in vBlank"); - hleEatCycles(5 * 222); + hleEatCycles(1110); return 1; } } @@ -562,7 +546,7 @@ u32 sceDisplayWaitVblankCB() { return 0; } else { DEBUG_LOG(HLE,"sceDisplayWaitVblank() - not waiting since in vBlank"); - hleEatCycles(5 * 222); + hleEatCycles(1110); return 1; } } @@ -584,18 +568,19 @@ u32 sceDisplayWaitVblankStartMultiCB(int vblanks) { u32 sceDisplayGetVcount() { VERBOSE_LOG(HLE,"%i=sceDisplayGetVcount()", vCount); - hleEatCycles(2 * 222); + hleEatCycles(150); return vCount; } u32 sceDisplayGetCurrentHcount() { u32 currentHCount = (CoreTiming::GetTicks() - frameStartTicks) / ((u64)CoreTiming::GetClockFrequencyMHz() * 1000000 / 60 / hCountPerVblank); DEBUG_LOG(HLE,"%i=sceDisplayGetCurrentHcount()", currentHCount); + hleEatCycles(275); return currentHCount; } u32 sceDisplayAdjustAccumulatedHcount() { - ERROR_LOG(HLE,"UNIMPL sceDisplayAdjustAccumulatedHcount()"); + ERROR_LOG_REPORT(HLE,"UNIMPL sceDisplayAdjustAccumulatedHcount()"); return 0; } @@ -603,6 +588,7 @@ u32 sceDisplayGetAccumulatedHcount() { u32 currentHCount = (CoreTiming::GetTicks() - frameStartTicks) / ((u64)CoreTiming::GetClockFrequencyMHz() * 1000000 / 60 / hCountPerVblank); u32 accumHCount = currentHCount + (u32) (vCount * hCountPerVblank); DEBUG_LOG(HLE,"%i=sceDisplayGetAccumulatedHcount()", accumHCount); + hleEatCycles(235); return accumHCount; } diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 16af99f343..e0804f6411 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -404,32 +404,13 @@ void PauseScreen::render() { int y = 50; int stride = 40; int columnw = 400; - int columnws = 300; // Shared with settings I18NCategory *ss = GetI18NCategory("System"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *a = GetI18NCategory("Audio"); - UICheckBox(GEN_ID, x, y += stride, gs->T("Unlock VPS"), ALIGN_TOPLEFT, &g_Config.bVpsLimit); - UICheckBox(GEN_ID, x+ columnws, y, ss->T("Show VPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter); - if (g_Config.bVpsLimit) { - float getvps= g_Config.iNumVps; - char showvps[256]; - sprintf(showvps, "VPS Limit: %0.0f", getvps); - ui_draw2d.DrawText(UBUNTU24, showvps, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT); - ui_draw2d.DrawText(UBUNTU24, showvps, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT); - ui_draw2d.DrawText(UBUNTU24, gs->T("VPS :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); - HLinear hlinear1(x + 150 , y + 5, 20); - if (UIButton(GEN_ID, hlinear1, 80, 0, "Auto", ALIGN_LEFT)) - g_Config.iNumVps = 90; - if (UIButton(GEN_ID, hlinear1, 55, 0, "-10", ALIGN_LEFT)) - if(g_Config.iNumVps!=10){ - g_Config.iNumVps -= 10;} - if (UIButton(GEN_ID, hlinear1, 55, 0, "+10", ALIGN_LEFT)) - if(g_Config.iNumVps!=120){ - g_Config.iNumVps += 10;} - } + UICheckBox(GEN_ID, x, y += stride, ss->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter); UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound); // TODO: Maybe shouldn't show this if the screen ratios are very close... UICheckBox(GEN_ID, x, y += stride, gs->T("Stretch to Display"), ALIGN_TOPLEFT, &g_Config.bStretchToDisplay); @@ -449,8 +430,8 @@ void PauseScreen::render() { float getfskip= g_Config.iFrameSkip; char showfskip[256]; sprintf(showfskip, "Skip Frames: %0.0f", getfskip); - ui_draw2d.DrawText(UBUNTU24, showfskip, dp_xres - 8, 42, 0xc0000000, ALIGN_TOPRIGHT); - ui_draw2d.DrawText(UBUNTU24, showfskip, dp_xres - 10, 40, 0xFF3fFF3f, ALIGN_TOPRIGHT); + ui_draw2d.DrawText(UBUNTU24, showfskip, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT); + ui_draw2d.DrawText(UBUNTU24, showfskip, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT); ui_draw2d.DrawText(UBUNTU24, gs->T("Frames :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 200 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, "Auto", ALIGN_LEFT))