Skip to content

Commit

Permalink
Make AA work also when FPS unlocking is disabled
Browse files Browse the repository at this point in the history
Frame time calculations would not be properly initialized or updated
unless FPS unlocking was enabled. This would cause the minimum FPS
handling to keep anti-aliasing disabled all the time.

This change makes frame time calculations and anti-aliasing work wether
FPS unlocking is enabled or not.
  • Loading branch information
niligulmohar committed Jul 9, 2016
1 parent 9daf199 commit 38e7204
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions FPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ void applyFPSPatch() {
return;
}

// Init counter for frame-rate calculations
lastRenderTime = 0.0f;
QueryPerformanceFrequency(&timerFreq);
QueryPerformanceCounter(&counterAtStart);

// Binary patches
//--------------------------------------------------------------
DWORD address;
Expand All @@ -208,3 +203,10 @@ void applyFPSPatch() {

SDLOG(0, "FPS unlocked\n");
}

void initFPSTimer() {
// Init counter for frame-rate calculations
lastRenderTime = 0.0f;
QueryPerformanceFrequency(&timerFreq);
QueryPerformanceCounter(&counterAtStart);
}
1 change: 1 addition & 0 deletions FPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

void initFPSTimer();
void applyFPSPatch();

// returns time since startup in milliseconds
Expand Down
2 changes: 1 addition & 1 deletion RenderstateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,6 @@ void RSManager::frameTimeManagement() {
SwitchToThread();
renderTime = getElapsedTime() - lastPresentTime;
}
lastPresentTime = getElapsedTime();
}
lastPresentTime = getElapsedTime();
}
1 change: 1 addition & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved) {

earlyDetour();

initFPSTimer();
if(Settings::get().getUnlockFPS()) applyFPSPatch();

return true;
Expand Down

0 comments on commit 38e7204

Please sign in to comment.