use RageTimer instead of direct win32 timer calls
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "GameDef.h"
|
#include "GameDef.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
|
#include "RageTimer.h"
|
||||||
|
|
||||||
|
|
||||||
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
|
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
|
||||||
@@ -31,9 +32,9 @@ ThemeManager::ThemeManager()
|
|||||||
m_pIniMetrics = new IniFile;
|
m_pIniMetrics = new IniFile;
|
||||||
|
|
||||||
/* Update the metric cache on the first call to GetMetric. */
|
/* Update the metric cache on the first call to GetMetric. */
|
||||||
m_uNextReloadTicks = 0;
|
m_fNextReloadTicks = 0;
|
||||||
|
|
||||||
m_sCurThemeName = BASE_THEME_NAME; // Use te base theme for now. It's up to PrefsManager to change this.
|
m_sCurThemeName = BASE_THEME_NAME; // Use the base theme for now. It's up to PrefsManager to change this.
|
||||||
|
|
||||||
CStringArray arrayThemeNames;
|
CStringArray arrayThemeNames;
|
||||||
GetAllThemeNames( arrayThemeNames );
|
GetAllThemeNames( arrayThemeNames );
|
||||||
@@ -233,9 +234,10 @@ try_metric_again:
|
|||||||
CString sDefaultMetricPath = GetMetricsPathFromName(BASE_THEME_NAME);
|
CString sDefaultMetricPath = GetMetricsPathFromName(BASE_THEME_NAME);
|
||||||
|
|
||||||
// Is our metric cache out of date?
|
// Is our metric cache out of date?
|
||||||
if (m_uNextReloadTicks == 0 || ::GetTickCount() > m_uNextReloadTicks)
|
// XXX: GTSS wraps every ~40 days. Need a better way to handler timers like this.
|
||||||
|
if (TIMER->GetTimeSinceStart() >= m_fNextReloadTicks)
|
||||||
{
|
{
|
||||||
m_uNextReloadTicks = GetTickCount()+1000;
|
m_fNextReloadTicks = TIMER->GetTimeSinceStart()+1.0f;
|
||||||
if( m_uHashForCurThemeMetrics != GetHashForFile(sCurMetricPath) ||
|
if( m_uHashForCurThemeMetrics != GetHashForFile(sCurMetricPath) ||
|
||||||
m_uHashForBaseThemeMetrics != GetHashForFile(sDefaultMetricPath) )
|
m_uHashForBaseThemeMetrics != GetHashForFile(sDefaultMetricPath) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ protected:
|
|||||||
CString m_sCurThemeName;
|
CString m_sCurThemeName;
|
||||||
|
|
||||||
IniFile* m_pIniMetrics; // make this a pointer so we don't have to include IniFile in this header!
|
IniFile* m_pIniMetrics; // make this a pointer so we don't have to include IniFile in this header!
|
||||||
DWORD m_uNextReloadTicks;
|
float m_fNextReloadTicks;
|
||||||
unsigned m_uHashForCurThemeMetrics;
|
unsigned m_uHashForCurThemeMetrics;
|
||||||
unsigned m_uHashForBaseThemeMetrics;
|
unsigned m_uHashForBaseThemeMetrics;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user