Add missing files.

This commit is contained in:
Skyth 2024-12-04 12:48:38 +03:00
parent 2c2e37f6fe
commit 5876c2b658
4 changed files with 44 additions and 1 deletions

View file

@ -41,6 +41,7 @@ set(SWA_KERNEL_CXX_SOURCES
"kernel/xdm.cpp"
"kernel/heap.cpp"
"kernel/memory.cpp"
"kernel/platform.cpp"
"kernel/xam.cpp"
"kernel/io/file_system.cpp"
)

View file

@ -14,6 +14,13 @@
#define SWA_API extern "C" SWA_DLLIMPORT
#endif
#define PROC_ADDRESS(libraryName, procName) \
GetProcAddress(LoadLibrary(TEXT(libraryName)), procName)
#define LIB_FUNCTION(returnType, libraryName, procName, ...) \
typedef returnType _##procName(__VA_ARGS__); \
_##procName* procName = (_##procName*)PROC_ADDRESS(libraryName, #procName);
template<typename T>
void ByteSwap(T& value)
{
@ -66,4 +73,4 @@ constexpr size_t FirstBitLow(TValue value)
}
return 0;
}
}

View file

@ -0,0 +1,24 @@
#include <kernel/platform.h>
#if _WIN32
LIB_FUNCTION(LONG, "ntdll.dll", RtlGetVersion, PRTL_OSVERSIONINFOW);
#endif
PlatformVersion GetPlatformVersion()
{
auto result = PlatformVersion{};
#if _WIN32
OSVERSIONINFOEXW osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
if (RtlGetVersion((PRTL_OSVERSIONINFOW)&osvi) != 0)
return result;
result.Major = osvi.dwMajorVersion;
result.Minor = osvi.dwMinorVersion;
result.Build = osvi.dwBuildNumber;
#endif
return result;
}

View file

@ -0,0 +1,11 @@
#pragma once
struct PlatformVersion
{
public:
uint32_t Major{};
uint32_t Minor{};
uint32_t Build{};
};
extern PlatformVersion GetPlatformVersion();