PhysicsFS 2.0.3 imported.
This commit is contained in:
parent
bcc0937726
commit
993311d151
459 changed files with 87785 additions and 0 deletions
64
lib/physfs-2.0.3/lzma/CPP/Windows/System.cpp
Normal file
64
lib/physfs-2.0.3/lzma/CPP/Windows/System.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Windows/System.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "System.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NSystem {
|
||||
|
||||
UInt32 GetNumberOfProcessors()
|
||||
{
|
||||
SYSTEM_INFO systemInfo;
|
||||
GetSystemInfo(&systemInfo);
|
||||
return (UInt32)systemInfo.dwNumberOfProcessors;
|
||||
}
|
||||
|
||||
#if !defined(_WIN64) && defined(__GNUC__)
|
||||
|
||||
typedef struct _MY_MEMORYSTATUSEX {
|
||||
DWORD dwLength;
|
||||
DWORD dwMemoryLoad;
|
||||
DWORDLONG ullTotalPhys;
|
||||
DWORDLONG ullAvailPhys;
|
||||
DWORDLONG ullTotalPageFile;
|
||||
DWORDLONG ullAvailPageFile;
|
||||
DWORDLONG ullTotalVirtual;
|
||||
DWORDLONG ullAvailVirtual;
|
||||
DWORDLONG ullAvailExtendedVirtual;
|
||||
} MY_MEMORYSTATUSEX, *MY_LPMEMORYSTATUSEX;
|
||||
|
||||
#else
|
||||
|
||||
#define MY_MEMORYSTATUSEX MEMORYSTATUSEX
|
||||
#define MY_LPMEMORYSTATUSEX LPMEMORYSTATUSEX
|
||||
|
||||
#endif
|
||||
|
||||
typedef BOOL (WINAPI *GlobalMemoryStatusExP)(MY_LPMEMORYSTATUSEX lpBuffer);
|
||||
|
||||
UInt64 GetRamSize()
|
||||
{
|
||||
MY_MEMORYSTATUSEX stat;
|
||||
stat.dwLength = sizeof(stat);
|
||||
#ifdef _WIN64
|
||||
if (!::GlobalMemoryStatusEx(&stat))
|
||||
return 0;
|
||||
return stat.ullTotalPhys;
|
||||
#else
|
||||
GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
|
||||
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GlobalMemoryStatusEx");
|
||||
if (globalMemoryStatusEx != 0)
|
||||
if (globalMemoryStatusEx(&stat))
|
||||
return stat.ullTotalPhys;
|
||||
{
|
||||
MEMORYSTATUS stat;
|
||||
stat.dwLength = sizeof(stat);
|
||||
GlobalMemoryStatus(&stat);
|
||||
return stat.dwTotalPhys;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
Loading…
Add table
Add a link
Reference in a new issue