Rename plugin to HarmonyLinkUE
This commit is contained in:
parent
8ba9caeb27
commit
9a5194dc3a
26 changed files with 190 additions and 107 deletions
19
Source/HarmonyLinkUE/Public/Enums/DeviceEnum.h
Normal file
19
Source/HarmonyLinkUE/Public/Enums/DeviceEnum.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "DeviceEnum.generated.h"
|
||||
|
||||
/*
|
||||
* Enum representing different operating system platforms.
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EDevice : uint8
|
||||
{
|
||||
DESKTOP UMETA(DisplayName = "Desktop"),
|
||||
LAPTOP UMETA(DisplayName = "Laptop"),
|
||||
HANDHELD UMETA(DisplayName = "Handheld"),
|
||||
|
||||
STEAM_DECK UMETA(DisplayName = "Steam Deck")
|
||||
};
|
21
Source/HarmonyLinkUE/Public/Enums/Platform.h
Normal file
21
Source/HarmonyLinkUE/Public/Enums/Platform.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Platform.generated.h"
|
||||
|
||||
// Undefine the LINUX macro to avoid conflicts with the enum definition.
|
||||
#undef LINUX
|
||||
|
||||
/*
|
||||
* Enum representing different operating system platforms.
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EPlatform : uint8
|
||||
{
|
||||
WINDOWS UMETA(DisplayName = "Windows"),
|
||||
LINUX UMETA(DisplayName = "Linux"),
|
||||
MAC UMETA(DisplayName = "Mac"),
|
||||
UNIX UMETA(DisplayName = "Unix")
|
||||
};
|
75
Source/HarmonyLinkUE/Public/HarmonyLinkLibrary.h
Normal file
75
Source/HarmonyLinkUE/Public/HarmonyLinkLibrary.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Structs/Battery.h"
|
||||
#include "Structs/CPUInfo.h"
|
||||
#include "Structs/Device.h"
|
||||
#include "Structs/OSVerInfo.h"
|
||||
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "HarmonyLinkLibrary.generated.h"
|
||||
|
||||
/**
|
||||
* Library of static functions for accessing various system information, particularly for the HarmonyLink project.
|
||||
*/
|
||||
UCLASS()
|
||||
class HARMONYLINKUE_API UHarmonyLinkLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UHarmonyLinkLibrary();
|
||||
|
||||
// IsInitialised
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsInitialised();
|
||||
|
||||
// Checks if the game is running under Wine.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsWine(bool bForce = false);
|
||||
|
||||
// Checks if the operating system is Linux.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsLinux(bool bForce = false);
|
||||
|
||||
// Checks if the game is running on a Steam Deck.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsSteamDeck(bool bForce = false);
|
||||
|
||||
// Retrieves information about the CPU of the current device.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FCPUInfo GetCPUInfo(bool bForce = false);
|
||||
|
||||
// Retrieves information about the current device.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FDevice GetDeviceInfo(bool bForce = false);
|
||||
|
||||
// Retrieves information about the operating system of the current device.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FOSVerInfo GetOSInfo(bool bForce = false);
|
||||
|
||||
// Retrieves the current battery status of the device.
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FBattery GetBatteryStatus();
|
||||
|
||||
private:
|
||||
static bool bIsWineCached;
|
||||
static bool bIsWine;
|
||||
static bool bIsLinuxCached;
|
||||
static bool bIsLinux;
|
||||
static bool bIsSteamDeckCached;
|
||||
static bool bIsSteamDeck;
|
||||
|
||||
static bool bCPUInfoCached;
|
||||
static bool bDeviceInfoCached;
|
||||
static bool bOSInfoCached;
|
||||
|
||||
static FCPUInfo CachedCPUInfo;
|
||||
static FDevice CachedDeviceInfo;
|
||||
static FOSVerInfo CachedOSInfo;
|
||||
|
||||
static bool bIsInitialised;
|
||||
};
|
16
Source/HarmonyLinkUE/Public/HarmonyLinkUE.h
Normal file
16
Source/HarmonyLinkUE/Public/HarmonyLinkUE.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogHarmonyLink, All, All);
|
||||
|
||||
class FHarmonyLinkUEModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
};
|
35
Source/HarmonyLinkUE/Public/Structs/Battery.h
Normal file
35
Source/HarmonyLinkUE/Public/Structs/Battery.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Structs/FBattery.h"
|
||||
|
||||
#include "Battery.generated.h"
|
||||
|
||||
/*
|
||||
* Represents the battery status and information of a device.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBattery
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FBattery() {}
|
||||
|
||||
// Indicates whether the device has a battery.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
bool HasBattery = false;
|
||||
|
||||
// Indicates whether the device is connected to AC power.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
bool IsACConnected = false;
|
||||
|
||||
// The current battery percentage of the device.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
int32 BatteryPercent = 0;
|
||||
|
||||
// Constructor that initializes the struct with information from an external battery source.
|
||||
// @param battery Pointer to an external FBattery structure to copy data from.
|
||||
FBattery(HarmonyLinkLib::FBattery* battery);
|
||||
};
|
40
Source/HarmonyLinkUE/Public/Structs/CPUInfo.h
Normal file
40
Source/HarmonyLinkUE/Public/Structs/CPUInfo.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Structs/FCPUInfo.h"
|
||||
|
||||
#include "CPUInfo.generated.h"
|
||||
|
||||
/*
|
||||
* Represents information about the CPU of a device.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FCPUInfo
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FCPUInfo() {}
|
||||
|
||||
// The vendor identifier for the CPU.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString VendorID;
|
||||
|
||||
// The model name of the CPU.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString ModelName;
|
||||
|
||||
// The number of physical cores in the CPU.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
int32 PhysicalCores = 0;
|
||||
|
||||
// The number of logical cores in the CPU (may be different from physical cores).
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
int32 LogicalCores = 0;
|
||||
|
||||
// Constructor that initializes the struct with information from an external CPU info source.
|
||||
// @param cpu_info Pointer to an external FCPUInfo structure to copy data from.
|
||||
FCPUInfo(HarmonyLinkLib::FCPUInfo* cpu_info);
|
||||
};
|
45
Source/HarmonyLinkUE/Public/Structs/Device.h
Normal file
45
Source/HarmonyLinkUE/Public/Structs/Device.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Enums/DeviceEnum.h"
|
||||
#include "Enums/Platform.h"
|
||||
|
||||
#include "Structs/FDevice.h"
|
||||
|
||||
#include "Device.generated.h"
|
||||
|
||||
// Represents information about a specific device.
|
||||
USTRUCT(BlueprintType)
|
||||
struct FDevice
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FDevice() {}
|
||||
|
||||
// The platform on which the device operates. Note: This can differ from the build platform.
|
||||
// For example, if the device is identified as running on Wine, this will show Linux,
|
||||
// regardless of the build being an executable for Windows.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
EPlatform Platform = EPlatform::WINDOWS;
|
||||
|
||||
// The type of the device.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
EDevice Device = EDevice::DESKTOP;
|
||||
|
||||
// Constructor that initializes the struct with information from an external source.
|
||||
// @param oldDevice Pointer to an external FDevice structure to copy data from.
|
||||
FDevice(HarmonyLinkLib::FDevice* oldDevice);
|
||||
|
||||
private:
|
||||
// Converts an external device enum to the internal EDeviceEnum type.
|
||||
// @param Device External device enum to convert.
|
||||
// @returns Converted EDeviceEnum value.
|
||||
static EDevice Convert(HarmonyLinkLib::EDevice Device);
|
||||
|
||||
// Converts an external platform enum to the internal EPlatform type.
|
||||
// @param Platform External platform enum to convert.
|
||||
// @returns Converted EPlatform value.
|
||||
static EPlatform Convert(HarmonyLinkLib::EPlatform Platform);
|
||||
};
|
49
Source/HarmonyLinkUE/Public/Structs/OSVerInfo.h
Normal file
49
Source/HarmonyLinkUE/Public/Structs/OSVerInfo.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Structs/FOSVerInfo.h"
|
||||
|
||||
#include "OSVerInfo.generated.h"
|
||||
|
||||
// Represents information about an operating system version.
|
||||
USTRUCT(BlueprintType)
|
||||
struct FOSVerInfo
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FOSVerInfo() {}
|
||||
|
||||
// The name of the operating system.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString Name;
|
||||
|
||||
// Numerical version of the operating system.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
int32 Version = 0;
|
||||
|
||||
// Unique identifier for the operating system.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString ID;
|
||||
|
||||
// Identifier for the specific version of the operating system.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString VersionID;
|
||||
|
||||
// Codename for the operating system version.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString VersionCodename;
|
||||
|
||||
// User-friendly name for the operating system version.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString PrettyName;
|
||||
|
||||
// Variant identifier of the operating system.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
FString VariantID;
|
||||
|
||||
// Constructor that initializes the struct with information from an external source.
|
||||
// @param oldInfo Pointer to an external FOSVerInfo structure to copy data from.
|
||||
FOSVerInfo(HarmonyLinkLib::FOSVerInfo* oldInfo);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue