mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-20 15:02:20 +00:00
Add missing files.
This commit is contained in:
parent
2c2e37f6fe
commit
5876c2b658
4 changed files with 44 additions and 1 deletions
|
|
@ -41,6 +41,7 @@ set(SWA_KERNEL_CXX_SOURCES
|
||||||
"kernel/xdm.cpp"
|
"kernel/xdm.cpp"
|
||||||
"kernel/heap.cpp"
|
"kernel/heap.cpp"
|
||||||
"kernel/memory.cpp"
|
"kernel/memory.cpp"
|
||||||
|
"kernel/platform.cpp"
|
||||||
"kernel/xam.cpp"
|
"kernel/xam.cpp"
|
||||||
"kernel/io/file_system.cpp"
|
"kernel/io/file_system.cpp"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,13 @@
|
||||||
#define SWA_API extern "C" SWA_DLLIMPORT
|
#define SWA_API extern "C" SWA_DLLIMPORT
|
||||||
#endif
|
#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>
|
template<typename T>
|
||||||
void ByteSwap(T& value)
|
void ByteSwap(T& value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
24
UnleashedRecomp/kernel/platform.cpp
Normal file
24
UnleashedRecomp/kernel/platform.cpp
Normal 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;
|
||||||
|
}
|
||||||
11
UnleashedRecomp/kernel/platform.h
Normal file
11
UnleashedRecomp/kernel/platform.h
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct PlatformVersion
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
uint32_t Major{};
|
||||||
|
uint32_t Minor{};
|
||||||
|
uint32_t Build{};
|
||||||
|
};
|
||||||
|
|
||||||
|
extern PlatformVersion GetPlatformVersion();
|
||||||
Loading…
Add table
Reference in a new issue