Skip to content

Commit

Permalink
Make intro skipping work without FPS unlocking
Browse files Browse the repository at this point in the history
When FPS unlocking is disabled, intro skipping depends a wrapper for
QueryPerformanceCounter which artificially speeds up time. A criteria
for the modified behaviour to trigger is that the call stack depth for
the QueryPerformanceCounter call is 1.

At least for the Steam version of DS with exe version 1.0.2.0, the call
stack depth for the relevant call is 2. With intro skipping enabled but
FPS unlocking disabled, this would cause the logos to not appear, since
the Present calls are never made, but there would be a long delay with a
black screen when the logos would usually show.

This change triggers the modified QueryPerformanceCounter behaviour if
the stack depth is either 1 or 2. This makes intro skipping work on this
DS version also with FPS unlocking disabled.
  • Loading branch information
niligulmohar committed Jul 10, 2016
1 parent 9daf199 commit 30f60bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Detouring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BOOL WINAPI DetouredQueryPerformanceCounter(_Out_ LARGE_INTEGER *lpPerformanceCo
int captured = CaptureStackBackTrace(0, 128, traces, &hash);
SDLOG(14, "T %6lu: Detouring: QueryPerformanceCounter, stack depth %3d, hash %20ul\n", GetCurrentThreadId(), captured, hash);
BOOL ret = TrueQueryPerformanceCounter(lpPerformanceCount);
if(timingIntroMode && captured == 1) {
if(timingIntroMode && captured < 3) {
perfCountIncrease.QuadPart += countsPerSec.QuadPart/50;
}
lpPerformanceCount->QuadPart += perfCountIncrease.QuadPart;
Expand Down

0 comments on commit 30f60bc

Please sign in to comment.