Fix Stuff
This commit is contained in:
parent
55d2a1a45c
commit
62cf609a89
11 changed files with 321 additions and 39 deletions
|
@ -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()
|
||||
|
|
52
Source/HarmonyLink/Private/Structs/Device.cpp
Normal file
52
Source/HarmonyLink/Private/Structs/Device.cpp
Normal 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;
|
||||
}
|
||||
}
|
16
Source/HarmonyLink/Private/Structs/OSVerInfo.cpp
Normal file
16
Source/HarmonyLink/Private/Structs/OSVerInfo.cpp
Normal 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();
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Device.generated.h"
|
||||
#include "DeviceEnum.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EDevice : uint8
|
||||
enum class EDeviceEnum : uint8
|
||||
{
|
||||
DESKTOP UMETA(DisplayName = "Desktop"),
|
||||
LAPTOP UMETA(DisplayName = "Laptop"),
|
|
@ -6,7 +6,7 @@
|
|||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Structs/Battery.h"
|
||||
#include "Structs/CPUInfo.h"
|
||||
#include "Structs/FDevice.h"
|
||||
#include "Structs/Device.h"
|
||||
#include "Structs/OSVerInfo.h"
|
||||
#include "HarmonyLinkLibrary.generated.h"
|
||||
|
||||
|
|
30
Source/HarmonyLink/Public/Structs/Device.h
Normal file
30
Source/HarmonyLink/Public/Structs/Device.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Enums/DeviceEnum.h"
|
||||
#include "Enums/Platform.h"
|
||||
#include <Structs/FDevice.h>
|
||||
|
||||
#include "Device.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FDevice
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FDevice() {}
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
EPlatform Platform = EPlatform::WINDOWS;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
EDeviceEnum Device = EDeviceEnum::DESKTOP;
|
||||
|
||||
FDevice(HarmonyLinkLib::FDevice* oldDevice);
|
||||
|
||||
static EDeviceEnum Convert(HarmonyLinkLib::EDevice Device);
|
||||
static EPlatform Convert(HarmonyLinkLib::EPlatform Platform);
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Enums/Device.h"
|
||||
#include "Enums/Platform.h"
|
||||
|
||||
#include "FDevice.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FDevice
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
EPlatform Platform = EPlatform::WINDOWS;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
EDevice Device = EDevice::DESKTOP;
|
||||
};
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright (C) 2023 Jordon Brooks
|
||||
#pragma once
|
||||
|
||||
#include <HarmonyLinkLib.h>
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "OSVerInfo.generated.h"
|
||||
|
@ -13,6 +15,8 @@ struct FOSVerInfo
|
|||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FOSVerInfo() {}
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
FString Name;
|
||||
|
||||
|
@ -33,4 +37,6 @@ struct FOSVerInfo
|
|||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
FString VariantID;
|
||||
|
||||
FOSVerInfo(HarmonyLinkLib::FOSVerInfo* oldInfo);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue