Updated to use the new plugin
This commit is contained in:
parent
174a73d160
commit
509d6aab73
36 changed files with 788 additions and 753 deletions
18
Source/HarmonyLink/Private/HarmonyLink.cpp
Normal file
18
Source/HarmonyLink/Private/HarmonyLink.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "HarmonyLink.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FHarmonyLinkModule"
|
||||
|
||||
void FHarmonyLinkModule::StartupModule()
|
||||
{
|
||||
}
|
||||
|
||||
void FHarmonyLinkModule::ShutdownModule()
|
||||
{
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FHarmonyLinkModule, HarmonyLink)
|
53
Source/HarmonyLink/Private/HarmonyLinkLibrary.cpp
Normal file
53
Source/HarmonyLink/Private/HarmonyLinkLibrary.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
// Copyright (C) 2023 Jordon Brooks
|
||||
|
||||
|
||||
#include "HarmonyLinkLibrary.h"
|
||||
|
||||
#include <HarmonyLinkLib.h>
|
||||
|
||||
bool UHarmonyLinkLibrary::IsWine()
|
||||
{
|
||||
static bool IsWine_ = HarmonyLinkLib::get_is_wine();
|
||||
return IsWine_;
|
||||
}
|
||||
|
||||
bool UHarmonyLinkLibrary::IsLinux()
|
||||
{
|
||||
static bool IsLinux_ =
|
||||
#if PLATFORM_WINDOWS
|
||||
IsWine();
|
||||
#elif PLATFORM_LINUX
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
return IsLinux_;
|
||||
}
|
||||
|
||||
bool UHarmonyLinkLibrary::IsSteamDeck()
|
||||
{
|
||||
static bool IsSteamDeck_ = GetDeviceInfo().Device == EDevice::STEAM_DECK;
|
||||
return IsSteamDeck_;
|
||||
}
|
||||
|
||||
FCPUInfo UHarmonyLinkLibrary::GetCPUInfo()
|
||||
{
|
||||
static FCPUInfo CPUInfo(HarmonyLinkLib::get_cpu_info());
|
||||
return CPUInfo;
|
||||
}
|
||||
|
||||
FDevice UHarmonyLinkLibrary::GetDeviceInfo()
|
||||
{
|
||||
return FDevice();
|
||||
}
|
||||
|
||||
FOSVerInfo UHarmonyLinkLibrary::GetOSInfo()
|
||||
{
|
||||
return FOSVerInfo();
|
||||
}
|
||||
|
||||
FBattery UHarmonyLinkLibrary::GetBatteryStatus()
|
||||
{
|
||||
return FBattery(HarmonyLinkLib::get_battery_status());
|
||||
}
|
21
Source/HarmonyLink/Private/Structs/Battery.cpp
Normal file
21
Source/HarmonyLink/Private/Structs/Battery.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2023 Jordon Brooks
|
||||
|
||||
#include "Structs/Battery.h"
|
||||
|
||||
#include <Structs/FBattery.h>
|
||||
|
||||
FBattery::FBattery(HarmonyLinkLib::FBattery* battery)
|
||||
{
|
||||
if (battery)
|
||||
{
|
||||
HasBattery = battery->has_battery;
|
||||
IsACConnected = battery->is_connected_to_ac;
|
||||
BatteryPercent = battery->battery_percent;
|
||||
|
||||
battery->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Failed to convert FBattery."))
|
||||
}
|
||||
}
|
25
Source/HarmonyLink/Private/Structs/CPUInfo.cpp
Normal file
25
Source/HarmonyLink/Private/Structs/CPUInfo.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2023 Jordon Brooks
|
||||
|
||||
#include "Structs/CPUInfo.h"
|
||||
|
||||
FCPUInfo::FCPUInfo(HarmonyLinkLib::FCPUInfo* cpu_info)
|
||||
{
|
||||
if (cpu_info)
|
||||
{
|
||||
VendorID = cpu_info->VendorID.c_str();
|
||||
ModelName = cpu_info->Model_Name.c_str();
|
||||
PhysicalCores = cpu_info->Physical_Cores;
|
||||
LogicalCores = cpu_info->Logical_Cores;
|
||||
|
||||
for (const HarmonyLinkLib::FString& Flag : cpu_info->Flags)
|
||||
{
|
||||
Flags.Add(Flag.c_str());
|
||||
}
|
||||
|
||||
cpu_info->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Failed to convert FCPUInfo."))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue