Introduce Timer Hack.

Has been used in previous Symbian releases to improve speed. Was thought to only work on Wipeout but actually works on most games?
Games that run based on internal timer will experience 60 VPS without frameskip.
This commit is contained in:
Sacha 2013-11-16 02:16:03 +10:00
parent 4a89e2e74f
commit fb7c3d96fd
7 changed files with 24 additions and 0 deletions

View File

@ -187,6 +187,12 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
graphics->Get("VSyncInterval", &bVSync, false);
graphics->Get("DisableStencilTest", &bDisableStencilTest, false);
graphics->Get("AlwaysDepthWrite", &bAlwaysDepthWrite, false);
// Has been in use on Symbian since v0.7. Preferred option.
#ifdef __SYMBIAN32__
graphics->Get("TimerHack", &bTimerHack, true);
#else
graphics->Get("TimerHack", &bTimerHack, false);
#endif
graphics->Get("LowQualitySplineBezier", &bLowQualitySplineBezier, false);
graphics->Get("WipeFramebufferAlpha", &bWipeFramebufferAlpha, false);
graphics->Get("PostShader", &sPostShaderName, "Off");
@ -427,6 +433,7 @@ void Config::Save() {
graphics->Set("VSyncInterval", bVSync);
graphics->Set("DisableStencilTest", bDisableStencilTest);
graphics->Set("AlwaysDepthWrite", bAlwaysDepthWrite);
graphics->Set("TimerHack", bTimerHack);
graphics->Set("LowQualitySplineBezier", bLowQualitySplineBezier);
graphics->Set("PostShader", sPostShaderName);

View File

@ -101,6 +101,7 @@ public:
bool bReloadCheats;
bool bDisableStencilTest;
bool bAlwaysDepthWrite;
bool bTimerHack;
bool bLowQualitySplineBezier;
bool bWipeFramebufferAlpha; // this was meant to be CopyStencilToAlpha but not done yet.
std::string sPostShaderName; // Off for off.

View File

@ -24,8 +24,10 @@
#include "Atomics.h"
#include "CoreTiming.h"
#include "Core.h"
#include "Config.h"
#include "HLE/sceKernelThread.h"
#include "../Common/ChunkFile.h"
#include "HLE/sceDisplay.h"
int CPU_HZ = 222000000;
@ -97,6 +99,12 @@ void SetClockFrequencyMHz(int cpuMhz)
int GetClockFrequencyMHz()
{
if (g_Config.bTimerHack) {
float vps;
__DisplayGetVPS(&vps);
if (vps > 5.0f)
return (int)((float)(CPU_HZ / 1000000)*(vps / 60.0f));
}
return CPU_HZ / 1000000;
}

View File

@ -307,6 +307,10 @@ void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps) {
*out_actual_fps = actualFps;
}
void __DisplayGetVPS(float *out_vps) {
*out_vps = fps;
}
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
float avg = 0.0;
if (fpsHistoryValid > 0) {

View File

@ -35,4 +35,5 @@ void __DisplayListenVblank(VblankCallback callback);
void __DisplayGetDebugStats(char stats[2048]);
void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps);
void __DisplayGetVPS(float *out_vps);
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps);

View File

@ -613,6 +613,8 @@ void EmuScreen::render() {
sprintf(fpsbuf, "FPS: %0.1f", actual_fps); break;
case 3:
sprintf(fpsbuf, "%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / 60.0f * 100.0f); break;
default:
return;
}
ui_draw2d.SetFontScale(0.7f, 0.7f);
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII);

View File

@ -175,6 +175,7 @@ void GameSettingsScreen::CreateViews() {
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), gs, screenManager()));
graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings", "Hack Settings (these WILL cause glitches)")));
graphicsSettings->Add(new CheckBox(&g_Config.bTimerHack, gs->T("Timer Hack")));
// Maybe hide this on non-PVR?
graphicsSettings->Add(new CheckBox(&g_Config.bDisableAlphaTest, gs->T("Disable Alpha Test (PowerVR speedup)")))->OnClick.Handle(this, &GameSettingsScreen::OnShaderChange);
graphicsSettings->Add(new CheckBox(&g_Config.bDisableStencilTest, gs->T("Disable Stencil Test")));