Skip to content

Commit 63acf63

Browse files
committed
Temp save
1 parent 723695c commit 63acf63

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

include/nbl/system/CSystemWin32.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef _NBL_SYSTEM_CSYSTEMWIN32_H_INCLUDED_
22
#define _NBL_SYSTEM_CSYSTEMWIN32_H_INCLUDED_
33
#ifdef _NBL_PLATFORM_WINDOWS_
4+
#include <windows.h>
5+
#include <powerbase.h>
46
#include "ISystem.h"
57
#include "CFileWin32.h"
68

@@ -22,7 +24,28 @@ class CSystemCallerWin32 final : public ISystemCaller
2224

2325
class CSystemWin32 : public ISystem
2426
{
27+
//LOL the struct definition wasn't added to winapi headers do they ask to declare them yourself
28+
typedef struct _PROCESSOR_POWER_INFORMATION {
29+
ULONG Number;
30+
ULONG MaxMhz;
31+
ULONG CurrentMhz;
32+
ULONG MhzLimit;
33+
ULONG MaxIdleState;
34+
ULONG CurrentIdleState;
35+
} PROCESSOR_POWER_INFORMATION, * PPROCESSOR_POWER_INFORMATION;
2536

37+
SystemInfo getSystemInfo() const override
38+
{
39+
SystemInfo info;
40+
PROCESSOR_POWER_INFORMATION cpuInfo;
41+
CallNtPowerInformation(ProcessorInformation, nullptr, 0, &cpuInfo, sizeof(cpuInfo));
42+
info.cpuFrequency = cpuInfo.MaxMhz;
43+
44+
info.desktopResX = GetSystemMetrics(SM_CXSCREEN);
45+
info.desktopResY = GetSystemMetrics(SM_CYSCREEN);
46+
47+
return info;
48+
}
2649
};
2750

2851
}

include/nbl/system/ISystem.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,17 @@ class ISystem : public core::IReferenceCounted
521521

522522
return systemMemory;
523523
}
524+
525+
struct SystemInfo
526+
{
527+
uint64_t cpuFrequency;
528+
//TODO others
529+
530+
uint32_t desktopResX;
531+
uint32_t desktopResY;
532+
std::string OSFullName;
533+
};
534+
virtual SystemInfo getSystemInfo() const = 0;
524535
};
525536

526537
template<typename T>

src/nbl/system/CSystemWin32.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)