Fix Stuff

This commit is contained in:
Jordon Brooks 2024-01-08 03:33:37 +00:00
parent 55d2a1a45c
commit 62cf609a89
No known key found for this signature in database
GPG key ID: 83964894E5D98D57
11 changed files with 321 additions and 39 deletions

View file

@ -7,44 +7,38 @@
bool UHarmonyLinkLibrary::IsWine()
{
static bool IsWine_ = HarmonyLinkLib::get_is_wine();
return IsWine_;
return HarmonyLinkLib::get_is_wine();
}
bool UHarmonyLinkLibrary::IsLinux()
{
static bool IsLinux_ =
#if PLATFORM_WINDOWS
IsWine();
return IsWine();
#elif PLATFORM_LINUX
true;
return true;
#else
false;
return false;
#endif
return IsLinux_;
}
bool UHarmonyLinkLibrary::IsSteamDeck()
{
static bool IsSteamDeck_ = GetDeviceInfo().Device == EDevice::STEAM_DECK;
return IsSteamDeck_;
return GetDeviceInfo().Device == EDeviceEnum::STEAM_DECK;
}
FCPUInfo UHarmonyLinkLibrary::GetCPUInfo()
{
static FCPUInfo CPUInfo(HarmonyLinkLib::get_cpu_info());
return CPUInfo;
return FCPUInfo(HarmonyLinkLib::get_cpu_info());
}
FDevice UHarmonyLinkLibrary::GetDeviceInfo()
{
return FDevice();
return FDevice(HarmonyLinkLib::get_device_info());
}
FOSVerInfo UHarmonyLinkLibrary::GetOSInfo()
{
return FOSVerInfo();
return FOSVerInfo(HarmonyLinkLib::get_os_version());
}
FBattery UHarmonyLinkLibrary::GetBatteryStatus()

View file

@ -0,0 +1,52 @@
#include "Structs/Device.h"
#include <Structs/FDevice.h>
FDevice::FDevice(HarmonyLinkLib::FDevice* oldDevice)
{
if (oldDevice)
{
Device = Convert(oldDevice->device);
Platform = Convert(oldDevice->platform);
oldDevice->free();
}
else
{
UE_LOG(LogTemp, Error, TEXT("Failed to convert FDevice."))
}
}
EDeviceEnum FDevice::Convert(HarmonyLinkLib::EDevice Device)
{
switch (Device)
{
case HarmonyLinkLib::EDevice::DESKTOP:
return EDeviceEnum::DESKTOP;
case HarmonyLinkLib::EDevice::LAPTOP:
return EDeviceEnum::LAPTOP;
case HarmonyLinkLib::EDevice::HANDHELD:
return EDeviceEnum::HANDHELD;
case HarmonyLinkLib::EDevice::STEAM_DECK:
return EDeviceEnum::STEAM_DECK;
default:
return EDeviceEnum::DESKTOP;
}
}
EPlatform FDevice::Convert(HarmonyLinkLib::EPlatform Platform)
{
switch (Platform)
{
case HarmonyLinkLib::EPlatform::WINDOWS:
return EPlatform::WINDOWS;
case HarmonyLinkLib::EPlatform::LINUX:
return EPlatform::LINUX;
case HarmonyLinkLib::EPlatform::MAC:
return EPlatform::MAC;
case HarmonyLinkLib::EPlatform::UNIX:
return EPlatform::UNIX;
default:
return EPlatform::WINDOWS;
}
}

View file

@ -0,0 +1,16 @@
#include "Structs/OSVerInfo.h"
FOSVerInfo::FOSVerInfo(HarmonyLinkLib::FOSVerInfo* oldInfo)
{
if (oldInfo)
{
Name = oldInfo->name.c_str();
Version = oldInfo->version;
ID = oldInfo->id.c_str();
PrettyName = oldInfo->pretty_name.c_str();
VariantID = oldInfo->variant_id.c_str();
VersionID = oldInfo->version_id.c_str();
oldInfo->free();
}
}