mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-04 12:37:08 +00:00
Add a config setting to force 60 fps in games.
This commit is contained in:
parent
4f68703cfd
commit
9f3aae873f
@ -105,6 +105,7 @@ void Config::Load(const char *iniFileName)
|
||||
graphics->Get("VBO", &bUseVBO, false);
|
||||
graphics->Get("FrameSkip", &iFrameSkip, 0);
|
||||
graphics->Get("FrameRate", &iFpsLimit, 60);
|
||||
graphics->Get("ForceGameFPS", &iForceGameFPS, 0);
|
||||
#ifdef USING_GLES2
|
||||
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
|
||||
#else
|
||||
@ -222,6 +223,7 @@ void Config::Save()
|
||||
graphics->Set("VBO", bUseVBO);
|
||||
graphics->Set("FrameSkip", iFrameSkip);
|
||||
graphics->Set("FrameRate", iFpsLimit);
|
||||
graphics->Set("ForceGameFPS", iForceGameFPS);
|
||||
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
|
||||
graphics->Set("VertexCache", bVertexCache);
|
||||
graphics->Set("FullScreen", bFullScreen);
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
int iTexScalingType; // 0 = xBRZ, 1 = Hybrid
|
||||
bool bTexDeposterize;
|
||||
int iFpsLimit;
|
||||
int iForceGameFPS;
|
||||
int iMaxRecent;
|
||||
bool bEnableCheats;
|
||||
bool bReloadCheats;
|
||||
|
@ -124,6 +124,7 @@ static size_t fpsHistoryValid = 0;
|
||||
static int lastNumFlips = 0;
|
||||
static int numFlips = 0;
|
||||
static float flips = 0.0f;
|
||||
static u64 lastFlipCycles = 0;
|
||||
|
||||
void hleEnterVblank(u64 userdata, int cyclesLate);
|
||||
void hleLeaveVblank(u64 userdata, int cyclesLate);
|
||||
@ -142,6 +143,7 @@ void __DisplayInit() {
|
||||
framebuf.topaddr = 0x04000000;
|
||||
framebuf.pspFramebufFormat = PSP_DISPLAY_PIXEL_FORMAT_8888;
|
||||
framebuf.pspFramebufLinesize = 480; // ??
|
||||
lastFlipCycles = 0;
|
||||
|
||||
enterVblankEvent = CoreTiming::RegisterEvent("EnterVBlank", &hleEnterVblank);
|
||||
leaveVblankEvent = CoreTiming::RegisterEvent("LeaveVBlank", &hleLeaveVblank);
|
||||
@ -512,6 +514,14 @@ u32 sceDisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync)
|
||||
|
||||
if (topaddr != framebuf.topaddr) {
|
||||
++numFlips;
|
||||
if (g_Config.iForceGameFPS) {
|
||||
u64 now = CoreTiming::GetTicks();
|
||||
u64 expected = msToCycles(1000) / g_Config.iForceGameFPS;
|
||||
u64 actual = now - lastFlipCycles;
|
||||
if (actual < expected)
|
||||
hleEatCycles((int)(expected - actual));
|
||||
lastFlipCycles = CoreTiming::GetTicks();
|
||||
}
|
||||
}
|
||||
|
||||
if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user