Added HardwareInfo::IsInitialized()
Former-commit-id: ef668ac6d2e92a05730b56c892a693a21c7d651e
This commit is contained in:
parent
4827711c89
commit
73cb237925
|
|
@ -22,6 +22,9 @@ class NAZARA_API NzHardwareInfo
|
|||
static bool HasCapability(nzProcessorCap capability);
|
||||
|
||||
static bool Initialize();
|
||||
|
||||
static bool IsInitialized();
|
||||
|
||||
static void Uninitialize();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ namespace
|
|||
{
|
||||
nzProcessorVendor s_vendorEnum = nzProcessorVendor_Unknown;
|
||||
bool s_capabilities[nzProcessorCap_Max+1] = {false};
|
||||
bool s_initialized = false;
|
||||
|
||||
char s_brandString[48] = "Not initialized";
|
||||
char s_vendor[12] = {'C', 'P', 'U', 'i', 's', 'U', 'n', 'k', 'n', 'o', 'w', 'n'};
|
||||
|
|
@ -84,9 +85,14 @@ bool NzHardwareInfo::HasCapability(nzProcessorCap capability)
|
|||
|
||||
bool NzHardwareInfo::Initialize()
|
||||
{
|
||||
if (s_initialized)
|
||||
return true;
|
||||
|
||||
if (!NzHardwareInfoImpl::IsCpuidSupported())
|
||||
return false;
|
||||
|
||||
s_initialized = true;
|
||||
|
||||
nzUInt32 result[4];
|
||||
|
||||
NzHardwareInfoImpl::Cpuid(0, result);
|
||||
|
|
@ -165,7 +171,13 @@ bool NzHardwareInfo::Initialize()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool NzHardwareInfo::IsInitialized()
|
||||
{
|
||||
return s_initialized;
|
||||
}
|
||||
|
||||
void NzHardwareInfo::Uninitialize()
|
||||
{
|
||||
// Rien à faire
|
||||
s_initialized = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue