From: Pat Date: Wed, 13 Apr 2011 02:49:47 +0000 (-0700) Subject: add LightsDriver_ActorMessage to win32 vs2008 project, fix Timer.cpp so it compiles... X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=ba47a3594535fd24033265b8b889ec129a578fcf;p=openitg.git add LightsDriver_ActorMessage to win32 vs2008 project, fix Timer.cpp so it compiles on win32 --- diff --git a/src/StepMania-net2008.vcproj b/src/StepMania-net2008.vcproj index c6978d73..5ebb798f 100644 --- a/src/StepMania-net2008.vcproj +++ b/src/StepMania-net2008.vcproj @@ -2314,6 +2314,14 @@ > + + + + @@ -3798,6 +3806,14 @@ RelativePath="glext.h" > + + + + diff --git a/src/timer/Timer.cpp b/src/timer/Timer.cpp index dfbb6489..643fe90c 100644 --- a/src/timer/Timer.cpp +++ b/src/timer/Timer.cpp @@ -1,12 +1,16 @@ #include "Timer.h" ProfilingTimer::ProfilingTimer() { - elapsedSoFarInNS = 0; - lastStart = 0; isRunning = false; + elapsedSoFarInNS = 0; + #ifdef _WINDOWS // This initializes the frequency of the ticks, which does not change. - QueryPerformanceFrequency(&frequency) + LARGE_INTEGER frequencyInfo; + QueryPerformanceFrequency(&frequencyInfo); + frequency = frequencyInfo.QuadPart; +#else + lastStart = 0; #endif // _WINDOWS } @@ -37,21 +41,21 @@ void ProfilingTimer::Stop() { QueryPerformanceCounter(&endTime); // frequency is ticks per second, 1 sec = 1 000 000 000 ns // ticks / (tics/sec) * (ns / sec) = ns - elapsedSoFarInNS += (endTime - lastStart) / frequency * 1000000000; + elapsedSoFarInNS += (endTime.QuadPart - lastStart.QuadPart) / frequency * 1000000000; #else timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); elapsedSoFarInNS += ts.tv_nsec - lastStart; #endif // _WINDOWS - lastStart = 0; + lastStart.QuadPart = 0; isRunning = false; } void ProfilingTimer::Reset() { // if running, stop - isRunning = 0; - lastStart = 0; + isRunning = false; + lastStart.QuadPart = 0; } double ProfilingTimer::GetElapsedSoFarInNS() const { @@ -65,7 +69,7 @@ double ProfilingTimer::GetElapsedSoFarInNS() const { QueryPerformanceCounter(&curTime); // frequency is ticks per second, 1 sec = 1 000 000 000 ns // ticks / (tics/sec) * (ns / sec) = ns - LARGE_INTEGER curElapsed = elapsedSoFarInNS + ( (curTime - lastStart) / frequency * 1000000000 ); + LONG curElapsed = elapsedSoFarInNS + ( (curTime.QuadPart - lastStart.QuadPart) / frequency * 1000000000 ); #else timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); @@ -78,7 +82,7 @@ double ProfilingTimer::GetElapsedSoFarInNS() const { double ProfilingTimer::GetElapsedSoFarInS() const { if (!isRunning) { // then we just return the current total - return (double) elapsedSoFarInNS / 1000000000; + return (double) elapsedSoFarInNS / 1000000000UL; } #ifdef _WINDOWS @@ -86,7 +90,7 @@ double ProfilingTimer::GetElapsedSoFarInS() const { QueryPerformanceCounter(&curTime); // frequency is ticks per second, 1 sec = 1 000 000 000 ns // ticks / (tics/sec) * (ns / sec) = ns - LARGE_INTEGER curElapsed = elapsedSoFarInNS + ( (curTime - lastStart) / frequency * 1000000000 ); + LONG curElapsed = elapsedSoFarInNS + ( (curTime.QuadPart - lastStart.QuadPart) / frequency * 1000000000UL ); #else timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/src/timer/Timer.h b/src/timer/Timer.h index 088b1b27..ebb50470 100644 --- a/src/timer/Timer.h +++ b/src/timer/Timer.h @@ -42,8 +42,8 @@ class ProfilingTimer { bool isRunning; #ifdef _WINDOWS - LARGE_INTEGEER frequency; - LARGE_INTEGER elapsedSoFarInNS; + LONGLONG frequency; + LONG elapsedSoFarInNS; LARGE_INTEGER lastStart; #else // UNIX platforms long elapsedSoFarInNS;