Successfully compiled and working on Win32 + tested on steam deck
This commit is contained in:
parent
47008fcefe
commit
e5cca6b23f
19 changed files with 311 additions and 186 deletions
|
@ -10,7 +10,7 @@
|
|||
"DocsURL": "https://github.com/Jordonbc/HarmonyLink",
|
||||
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/92fd511971274d1f955abb7197485041",
|
||||
"SupportURL": "",
|
||||
"CanContainContent": true,
|
||||
"CanContainContent": false,
|
||||
"IsBetaVersion": false,
|
||||
"IsExperimentalVersion": false,
|
||||
"Installed": false,
|
||||
|
@ -18,7 +18,7 @@
|
|||
{
|
||||
"Name": "HarmonyLink",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default",
|
||||
"LoadingPhase": "PreDefault",
|
||||
"WhitelistPlatforms": ["Win64", "Linux"]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -9,7 +9,7 @@ public class HarmonyLink : ModuleRules
|
|||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
IWYUSupport = IWYUSupport.Full;
|
||||
//IWYUSupport = IWYUSupport.Full;
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
|
@ -31,6 +31,8 @@ public class HarmonyLink : ModuleRules
|
|||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
|
||||
"HarmonyLinkLib",
|
||||
// ... add other public dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
@ -40,7 +42,6 @@ public class HarmonyLink : ModuleRules
|
|||
new string[]
|
||||
{
|
||||
// ... add private dependencies that you statically link with here ...
|
||||
"HarmonyLinkLib",
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
#include "HarmonyLinkLibrary.h"
|
||||
#include "HarmonyLink.h"
|
||||
|
||||
#include "HarmonyLinkLib.h"
|
||||
|
||||
UHarmonyLinkLibrary::UHarmonyLinkLibrary()
|
||||
{
|
||||
if (!HarmonyLinkLib::HL_Init())
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Fatal, TEXT("Failed to initialise HarmonyLinkLib!"));
|
||||
return;
|
||||
}
|
||||
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("HarmonyLinkLib Initialised!"));
|
||||
}
|
||||
|
||||
bool UHarmonyLinkLibrary::IsWine()
|
||||
{
|
||||
return HarmonyLinkLib::get_is_wine();
|
||||
|
@ -16,7 +28,7 @@ bool UHarmonyLinkLibrary::IsLinux()
|
|||
|
||||
bool UHarmonyLinkLibrary::IsSteamDeck()
|
||||
{
|
||||
return GetDeviceInfo().Device == EDeviceEnum::STEAM_DECK;
|
||||
return GetDeviceInfo().Device == EDevice::STEAM_DECK;
|
||||
}
|
||||
|
||||
FCPUInfo UHarmonyLinkLibrary::GetCPUInfo()
|
||||
|
|
|
@ -6,10 +6,23 @@
|
|||
#include "HarmonyLink.h"
|
||||
#include "HarmonyLinkLibrary.h"
|
||||
#include "GameFramework/GameUserSettings.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
UHarmonyLinkGraphics* UHarmonyLinkGraphics::_INSTANCE = nullptr;
|
||||
int32 UHarmonyLinkGraphics::_TickRate = 1;
|
||||
FTimerHandle UHarmonyLinkGraphics::_TickTimerHandle = FTimerHandle();
|
||||
TSharedPtr<FConfigFile> UHarmonyLinkGraphics::_ConfigFile = nullptr;
|
||||
bool UHarmonyLinkGraphics::_bAutomaticSwitch = false;
|
||||
int32 UHarmonyLinkGraphics::_LastBatteryPercentage = 0;
|
||||
EProfile UHarmonyLinkGraphics::_ActiveProfile = EProfile::NONE;
|
||||
TMap<EProfile, FSettingsProfile> UHarmonyLinkGraphics::_Profiles = TMap<EProfile, FSettingsProfile>();
|
||||
|
||||
TMap<EProfile, FName> UHarmonyLinkGraphics::_ProfileNames =
|
||||
{
|
||||
{EProfile::BATTERY, "Battery"},
|
||||
{EProfile::CHARGING, "Charging"},
|
||||
{EProfile::DOCKED, "Docked"},
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Default graphics settings for different power states in HarmonyLink.
|
||||
|
@ -25,71 +38,68 @@ FTimerHandle UHarmonyLinkGraphics::_TickTimerHandle = FTimerHandle();
|
|||
*/
|
||||
TMap<FName, TMap<FName, FHLConfigValue>> UHarmonyLinkGraphics::_DefaultSettings = {
|
||||
{ "Battery", {
|
||||
{ TEXT("r.ReflectionMethod"), FHLConfigValue(0) },
|
||||
{ TEXT("r.DynamicGlobalIlluminationMethod"), FHLConfigValue(2) },
|
||||
{ TEXT("r.Shadow.Virtual.Enable"), FHLConfigValue(0) },
|
||||
{ TEXT("r.ScreenPercentage"), FHLConfigValue(50) },
|
||||
// { TEXT("r.ReflectionMethod"), FHLConfigValue(0) },
|
||||
// { TEXT("r.DynamicGlobalIlluminationMethod"), FHLConfigValue(2) },
|
||||
// { TEXT("r.Shadow.Virtual.Enable"), FHLConfigValue(0) },
|
||||
// { TEXT("r.ScreenPercentage"), FHLConfigValue(50) },
|
||||
}},
|
||||
{ "Charging", {
|
||||
{ TEXT("r.ReflectionMethod"), FHLConfigValue(2) },
|
||||
{ TEXT("r.DynamicGlobalIlluminationMethod"), FHLConfigValue(2) },
|
||||
{ TEXT("r.Shadow.Virtual.Enable"), FHLConfigValue(1) },
|
||||
{ TEXT("r.ScreenPercentage"), FHLConfigValue(100) },
|
||||
// { TEXT("r.ReflectionMethod"), FHLConfigValue(2) },
|
||||
// { TEXT("r.DynamicGlobalIlluminationMethod"), FHLConfigValue(2) },
|
||||
// { TEXT("r.Shadow.Virtual.Enable"), FHLConfigValue(1) },
|
||||
// { TEXT("r.ScreenPercentage"), FHLConfigValue(100) },
|
||||
}},
|
||||
{ "Docked", {
|
||||
{ TEXT("r.ReflectionMethod"), FHLConfigValue(2) },
|
||||
{ TEXT("r.DynamicGlobalIlluminationMethod"), FHLConfigValue(2) },
|
||||
{ TEXT("r.Shadow.Virtual.Enable"), FHLConfigValue(1) },
|
||||
{ TEXT("r.ScreenPercentage"), FHLConfigValue(100) },
|
||||
// { TEXT("r.ReflectionMethod"), FHLConfigValue(2) },
|
||||
// { TEXT("r.DynamicGlobalIlluminationMethod"), FHLConfigValue(2) },
|
||||
// { TEXT("r.Shadow.Virtual.Enable"), FHLConfigValue(1) },
|
||||
// { TEXT("r.ScreenPercentage"), FHLConfigValue(100) },
|
||||
}}
|
||||
};
|
||||
|
||||
UHarmonyLinkGraphics::UHarmonyLinkGraphics()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Warning, TEXT("HarmonyLinkGraphics initialized."));
|
||||
if (_INSTANCE != this)
|
||||
{
|
||||
if (_INSTANCE)
|
||||
{
|
||||
DestroySettings();
|
||||
}
|
||||
|
||||
_INSTANCE = this;
|
||||
}
|
||||
|
||||
AddToRoot();
|
||||
|
||||
FWorldDelegates::OnPostWorldInitialization.AddUObject(this, &UHarmonyLinkGraphics::OnPostWorldInitialization);
|
||||
FWorldDelegates::OnPreWorldFinishDestroy.AddUObject(this, &UHarmonyLinkGraphics::OnWorldEnd);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
UHarmonyLinkGraphics::~UHarmonyLinkGraphics()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("~UHarmonyLinkGraphics called."));
|
||||
FWorldDelegates::OnPostWorldInitialization.RemoveAll(this);
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::LoadConfig(const bool bForceReload)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("LoadConfig called."));
|
||||
QUICK_SCOPE_CYCLE_COUNTER(HarmonyLinkGraphics_LoadSettings);
|
||||
|
||||
// Load the settings into the map
|
||||
if (!LoadSettingsFromConfig(false))
|
||||
{
|
||||
if (!LoadSettingsFromConfig(true))
|
||||
{
|
||||
CreateDefaultConfigFile();
|
||||
// Retry 2nd time
|
||||
LoadSettingsFromConfig(true);
|
||||
}
|
||||
}
|
||||
GetConfig();
|
||||
|
||||
DebugPrintProfiles();
|
||||
}
|
||||
|
||||
bool UHarmonyLinkGraphics::LoadSettingsFromConfig(const bool bLoadDefaults)
|
||||
bool UHarmonyLinkGraphics::LoadSettingsFromConfig(FConfigFile* ConfigFile) const
|
||||
{
|
||||
// Load the configuration from the INI file
|
||||
FConfigFile ConfigFile;
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("LoadSettingsFromConfig called."));
|
||||
//const FString Filename = "HarmonyLink"; //GetConfigDirectoryFile(bLoadDefaults);
|
||||
|
||||
const FString Filename = GetConfigDirectoryFile(bLoadDefaults);
|
||||
|
||||
if (!GConfig)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Failed to access GConfig!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GConfig->LoadLocalIniFile(ConfigFile, *Filename, false, nullptr, false))
|
||||
{
|
||||
// Load each profile section
|
||||
bool bLoaded = true;
|
||||
|
||||
|
@ -97,7 +107,7 @@ bool UHarmonyLinkGraphics::LoadSettingsFromConfig(const bool bLoadDefaults)
|
|||
const FString SectionName = TEXT("HarmonyLink");
|
||||
const FString KeyName = TEXT("AutomaticProfileSwitch");
|
||||
|
||||
if (!GConfig->GetBool(*SectionName, *KeyName, _bAutomaticSwitch, Filename))
|
||||
if (!ConfigFile->GetBool(*SectionName, *KeyName, _bAutomaticSwitch))
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Failed to load bAutomaticSwitch from config"));
|
||||
bLoaded = false;
|
||||
|
@ -119,21 +129,34 @@ bool UHarmonyLinkGraphics::LoadSettingsFromConfig(const bool bLoadDefaults)
|
|||
// Check if all profiles and settings were loaded successfully
|
||||
if (bLoaded)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Successfully loaded config file: %s"), *Filename);
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Successfully loaded config."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Failed to load config file: %s"), *Filename);
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Failed to load config file."));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UHarmonyLinkGraphics::LoadSection(const FConfigFile& ConfigFile, const TPair<EProfile, FName> Profile)
|
||||
bool UHarmonyLinkGraphics::LoadSection(FConfigFile* ConfigFile, const TPair<EProfile, FName> Profile)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("LoadSection called."));
|
||||
if (!ensureMsgf(ConfigFile, TEXT("ConfigFile is nullptr!"))) return false;
|
||||
|
||||
const FName& SectionName = Profile.Value;
|
||||
const EProfile ProfileKey = Profile.Key;
|
||||
|
||||
if (const FConfigSection* Section = ConfigFile.FindSection(*SectionName.ToString()))
|
||||
const FConfigSection* Section = nullptr;
|
||||
|
||||
|
||||
#if (ENGINE_MAJOR_VERSION >= 5)
|
||||
Section = ConfigFile->FindSection(*SectionName.ToString())
|
||||
#elif (ENGINE_MAJOR_VERSION == 4) && (ENGINE_MINOR_VERSION >= 27)
|
||||
Section = ConfigFile->FindOrAddSection(*SectionName.ToString());
|
||||
#else
|
||||
#error "Unsupported Unreal Engine version"
|
||||
#endif
|
||||
|
||||
if (Section)
|
||||
{
|
||||
FSettingsProfile& SettingsProfile = _Profiles.FindOrAdd(ProfileKey);
|
||||
SettingsProfile.SectionName = SectionName;
|
||||
|
@ -180,11 +203,13 @@ bool UHarmonyLinkGraphics::LoadSection(const FConfigFile& ConfigFile, const TPai
|
|||
|
||||
void UHarmonyLinkGraphics::SaveConfig() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("SaveConfig called."));
|
||||
Intermal_SaveConfig(false);
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::SetSetting(const EProfile Profile, const FName Setting, const FHLConfigValue Value)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("SetSetting called."));
|
||||
// Ignore if HarmonyLinkSettings is disabled
|
||||
if (Profile == EProfile::NONE)
|
||||
{
|
||||
|
@ -214,7 +239,7 @@ void UHarmonyLinkGraphics::SetSetting(const EProfile Profile, const FName Settin
|
|||
TypeString = TEXT("float");
|
||||
break;
|
||||
case EConfigValueType::Bool:
|
||||
ValueString = Value.GetValue<bool>() ? TEXT("true") : TEXT("false");
|
||||
ValueString = Value.GetValue<bool>() ? TEXT("True") : TEXT("False");
|
||||
TypeString = TEXT("bool");
|
||||
break;
|
||||
case EConfigValueType::String:
|
||||
|
@ -240,6 +265,7 @@ void UHarmonyLinkGraphics::SetSetting(const EProfile Profile, const FName Settin
|
|||
|
||||
UHarmonyLinkGraphics* UHarmonyLinkGraphics::GetSettings()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, VeryVerbose, TEXT("GetSettings called."));
|
||||
// Check if we already initialised
|
||||
if (_INSTANCE)
|
||||
{
|
||||
|
@ -248,14 +274,13 @@ UHarmonyLinkGraphics* UHarmonyLinkGraphics::GetSettings()
|
|||
|
||||
// Proceed to create a new singleton instance
|
||||
_INSTANCE = NewObject<UHarmonyLinkGraphics>();
|
||||
_INSTANCE->AddToRoot();
|
||||
_INSTANCE->Init();
|
||||
|
||||
return _INSTANCE;
|
||||
}
|
||||
|
||||
FSettingsProfile UHarmonyLinkGraphics::GetSettingProfile(const EProfile Profile)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("GetSettingProfile called."));
|
||||
// Ignore if HarmonyLinkSettings is disabled
|
||||
if (Profile == EProfile::NONE)
|
||||
{
|
||||
|
@ -285,35 +310,48 @@ FSettingsProfile UHarmonyLinkGraphics::GetSettingProfile(const EProfile Profile)
|
|||
|
||||
EProfile UHarmonyLinkGraphics::GetActiveProfile() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("GetActiveProfile called."));
|
||||
return _ActiveProfile;
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::SetAutomaticSwitching(const bool bAutomaticSwitch)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("SetAutomaticSwitching called."));
|
||||
_bAutomaticSwitch = bAutomaticSwitch;
|
||||
OnAutomaticSwitchChanged.Broadcast(_bAutomaticSwitch);
|
||||
}
|
||||
|
||||
bool UHarmonyLinkGraphics::GetAutomaticSwitching() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("GetAutomaticSwitching called."));
|
||||
return _bAutomaticSwitch;
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::DestroySettings()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("DestroySettings called."));
|
||||
if (_INSTANCE)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Destroying UHarmonyLinkGraphics."))
|
||||
FWorldDelegates::OnPostWorldInitialization.RemoveAll(_INSTANCE);
|
||||
FWorldDelegates::OnPreWorldFinishDestroy.RemoveAll(_INSTANCE);
|
||||
_INSTANCE->RemoveFromRoot();
|
||||
_INSTANCE->MarkAsGarbage();
|
||||
|
||||
#if (ENGINE_MAJOR_VERSION >= 5)
|
||||
_INSTANCE->MarkAsGarbage(); // For UE 5.0 and above
|
||||
#elif (ENGINE_MAJOR_VERSION == 4) && (ENGINE_MINOR_VERSION >= 27)
|
||||
_INSTANCE->MarkPendingKill(); // For UE 4.27 and above
|
||||
#else
|
||||
#error "Unsupported Unreal Engine version"
|
||||
#endif
|
||||
|
||||
_INSTANCE = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::Init()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Init called."));
|
||||
LoadConfig();
|
||||
|
||||
const FBattery BatteryStatus = UHarmonyLinkLibrary::GetBatteryStatus();
|
||||
|
@ -326,6 +364,7 @@ void UHarmonyLinkGraphics::Init()
|
|||
|
||||
void UHarmonyLinkGraphics::Intermal_SaveConfig(const bool bDefaultConfig) const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Intermal_SaveConfig called."));
|
||||
QUICK_SCOPE_CYCLE_COUNTER(HarmonyLinkGraphics_SaveConfig);
|
||||
|
||||
const FString Filename = GetConfigDirectoryFile(bDefaultConfig);
|
||||
|
@ -343,22 +382,23 @@ void UHarmonyLinkGraphics::Intermal_SaveConfig(const bool bDefaultConfig) const
|
|||
}
|
||||
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Flushing file: '%s'"), *Filename);
|
||||
GetConfig()->Dirty = true;
|
||||
// You'd think that Write would actually write something but for some
|
||||
// reason even if it outputs a success the file doesn't actually get created.
|
||||
// For this reason, Flush seems to work for now.
|
||||
//GetConfig()->Write(Filename);
|
||||
GConfig->Flush(true, Filename);
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::Tick()
|
||||
{
|
||||
Async(EAsyncExecution::Thread, [this]()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, VeryVerbose, TEXT("Tick called."));
|
||||
const FBattery BatteryStatus = UHarmonyLinkLibrary::GetBatteryStatus();
|
||||
|
||||
if (BatteryStatus.BatteryPercent != _LastBatteryPercentage)
|
||||
{
|
||||
// Ensure thread-safe broadcasting
|
||||
Async(EAsyncExecution::TaskGraphMainThread, [this, BatteryStatus]()
|
||||
{
|
||||
OnBatteryLevelChanged.Broadcast(BatteryStatus.BatteryPercent);
|
||||
});
|
||||
}
|
||||
|
||||
if (!_bAutomaticSwitch)
|
||||
|
@ -371,29 +411,23 @@ void UHarmonyLinkGraphics::Tick()
|
|||
if (BatteryStatus.IsACConnected)
|
||||
{
|
||||
if (_ActiveProfile != EProfile::CHARGING)
|
||||
{
|
||||
Async(EAsyncExecution::TaskGraphMainThread, [this]()
|
||||
{
|
||||
ApplyProfileInternal(EProfile::CHARGING);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_ActiveProfile != EProfile::BATTERY)
|
||||
{
|
||||
Async(EAsyncExecution::TaskGraphMainThread, [this]()
|
||||
{
|
||||
ApplyProfileInternal(EProfile::BATTERY);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::CreateDefaultConfigFile()
|
||||
void UHarmonyLinkGraphics::CreateDefaultConfigFile() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("CreateDefaultConfigFile called."));
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Creating default config file."));
|
||||
|
||||
LoadDefaults();
|
||||
|
@ -404,13 +438,17 @@ void UHarmonyLinkGraphics::CreateDefaultConfigFile()
|
|||
|
||||
FString UHarmonyLinkGraphics::GetConfigDirectoryFile(const bool bDefaultFolder)
|
||||
{
|
||||
FString ConfigFileName = bDefaultFolder? "DefaultHarmonyLink.ini" : "HarmonyLink.ini"; // Replace with your actual config file name
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("GetConfigDirectoryFile called."));
|
||||
FString ConfigFileName = bDefaultFolder ? TEXT("DefaultHarmonyLink.ini") : TEXT("HarmonyLink.ini");
|
||||
|
||||
return FPaths::Combine(bDefaultFolder ? FPaths::ProjectConfigDir() : FPaths::GeneratedConfigDir(), ConfigFileName);
|
||||
FString ConfigDirectory = bDefaultFolder ? FPaths::ProjectConfigDir() : FPaths::Combine(FPaths::GeneratedConfigDir(), UGameplayStatics::GetPlatformName());
|
||||
|
||||
return FPaths::Combine(ConfigDirectory, ConfigFileName);
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::SaveSection(const FSettingsProfile& SettingsProfile, const bool bDefaultConfig, const bool bFlush)
|
||||
void UHarmonyLinkGraphics::SaveSection(const FSettingsProfile& SettingsProfile, const bool bDefaultConfig, const bool bFlush) const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("SaveSection called."));
|
||||
if (GConfig)
|
||||
{
|
||||
const FString Filename = GetConfigDirectoryFile(bDefaultConfig);
|
||||
|
@ -430,7 +468,7 @@ void UHarmonyLinkGraphics::SaveSection(const FSettingsProfile& SettingsProfile,
|
|||
TypeString = TEXT("float");
|
||||
break;
|
||||
case EConfigValueType::Bool:
|
||||
ValueString = Setting.Value.GetValue<bool>() ? TEXT("true") : TEXT("false");
|
||||
ValueString = Setting.Value.GetValue<bool>() ? TEXT("True") : TEXT("False");
|
||||
TypeString = TEXT("bool");
|
||||
break;
|
||||
case EConfigValueType::String:
|
||||
|
@ -452,9 +490,9 @@ void UHarmonyLinkGraphics::SaveSection(const FSettingsProfile& SettingsProfile,
|
|||
}
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::LoadDefaults()
|
||||
void UHarmonyLinkGraphics::LoadDefaults() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("LoadDefaults started."));
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("LoadDefaults called."));
|
||||
|
||||
_Profiles.Reset();
|
||||
|
||||
|
@ -475,6 +513,7 @@ void UHarmonyLinkGraphics::LoadDefaults()
|
|||
|
||||
bool UHarmonyLinkGraphics::ApplyProfileInternal(const EProfile Profile)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("ApplyProfileInternal called."));
|
||||
// If the profile is None, revert to the original user game settings
|
||||
if (Profile == EProfile::NONE)
|
||||
{
|
||||
|
@ -536,6 +575,7 @@ bool UHarmonyLinkGraphics::ApplyProfileInternal(const EProfile Profile)
|
|||
|
||||
void UHarmonyLinkGraphics::OnPostWorldInitialization(UWorld* World, UWorld::InitializationValues IVS)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("OnPostWorldInitialization called."));
|
||||
if (!World || !World->IsValidLowLevel())
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Failed to Hook into World Initialisation!"))
|
||||
|
@ -544,7 +584,7 @@ void UHarmonyLinkGraphics::OnPostWorldInitialization(UWorld* World, UWorld::Init
|
|||
|
||||
if (World->IsGameWorld())
|
||||
{
|
||||
if (_INSTANCE)
|
||||
if (IsValid(_INSTANCE))
|
||||
{
|
||||
FTimerManager* TimerManager = &World->GetTimerManager();
|
||||
if (!TimerManager)
|
||||
|
@ -553,11 +593,12 @@ void UHarmonyLinkGraphics::OnPostWorldInitialization(UWorld* World, UWorld::Init
|
|||
return;
|
||||
}
|
||||
|
||||
if (!TimerManager->TimerExists(_INSTANCE->_TickTimerHandle) || !TimerManager->IsTimerActive(_INSTANCE->_TickTimerHandle))
|
||||
if (!TimerManager->TimerExists(_TickTimerHandle) || !TimerManager->IsTimerActive(_TickTimerHandle))
|
||||
{
|
||||
World->GetTimerManager().SetTimer(_INSTANCE->_TickTimerHandle, [&, TimerManager]
|
||||
|
||||
World->GetTimerManager().SetTimer(_TickTimerHandle, [TimerManager]
|
||||
{
|
||||
if (!this)
|
||||
if (!_INSTANCE)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("'This' is destroyed, Clearing timer."))
|
||||
if (TimerManager)
|
||||
|
@ -566,16 +607,29 @@ void UHarmonyLinkGraphics::OnPostWorldInitialization(UWorld* World, UWorld::Init
|
|||
}
|
||||
return;
|
||||
}
|
||||
Tick();
|
||||
_INSTANCE->Tick();
|
||||
}, _TickRate, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Error: Timer already exists."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("'This' is nullptr!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//UE_LOG(LogHarmonyLink, Error, TEXT("Failed to bring up tick!"));
|
||||
}
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::OnWorldEnd(UWorld* World)
|
||||
{
|
||||
if (!World || !World->IsValidLowLevel())
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("OnWorldEnd(UWorld* World) called."));
|
||||
if (!World)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("World Already destroyed"))
|
||||
return;
|
||||
|
@ -592,6 +646,7 @@ void UHarmonyLinkGraphics::OnWorldEnd(UWorld* World)
|
|||
|
||||
bool UHarmonyLinkGraphics::ApplyProfile(const EProfile Profile, const bool bDisableAutomaticSwitch)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Applying Profile."));
|
||||
// Manual profile change, turn off automatic switching
|
||||
if (bDisableAutomaticSwitch)
|
||||
{
|
||||
|
@ -603,6 +658,7 @@ bool UHarmonyLinkGraphics::ApplyProfile(const EProfile Profile, const bool bDisa
|
|||
|
||||
void UHarmonyLinkGraphics::ApplySetting(const TPair<FName, FHLConfigValue>& Setting)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Applying settings."));
|
||||
// Apply the setting based on the key (CVar)
|
||||
IConsoleManager& ConsoleManager = IConsoleManager::Get();
|
||||
IConsoleVariable* CVar = ConsoleManager.FindConsoleVariable(*Setting.Key.ToString());
|
||||
|
@ -646,6 +702,45 @@ void UHarmonyLinkGraphics::DebugPrintProfiles() const
|
|||
UE_LOG(LogHarmonyLink, Log, TEXT("DebugPrintProfiles completed."));
|
||||
}
|
||||
|
||||
FConfigFile* UHarmonyLinkGraphics::GetConfig() const
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("GetConfig Called."));
|
||||
if (_ConfigFile)
|
||||
{
|
||||
return _ConfigFile.Get();
|
||||
}
|
||||
|
||||
FConfigFile* ConfigFile = GConfig->Find(GetConfigDirectoryFile(false), false);
|
||||
|
||||
if (!ConfigFile)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Warning, TEXT("Config file not found, attempting to read DefaultHarmonyLink.ini."));
|
||||
// Look in ProjectFolder->Config->DefaultHarmonyLink.ini
|
||||
ConfigFile = GConfig->Find(GetConfigDirectoryFile(true), true);
|
||||
}
|
||||
|
||||
/*if (!ConfigFile)
|
||||
{
|
||||
CreateDefaultConfigFile();
|
||||
ConfigFile = GConfig->Find(GetConfigDirectoryFile(true), true);
|
||||
}*/
|
||||
|
||||
if (ConfigFile)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Verbose, TEXT("Setting up config."));
|
||||
ConfigFile->Name = "HarmonyLink";
|
||||
LoadSettingsFromConfig(ConfigFile);
|
||||
_ConfigFile = MakeShareable(ConfigFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Error, TEXT("Failed to make config variable!"))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return _ConfigFile.Get();
|
||||
}
|
||||
|
||||
void UHarmonyLinkGraphics::PrintDebugSection(FSettingsProfile& SettingsProfile)
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Warning, TEXT("[%s]"), *SettingsProfile.SectionName.ToString());
|
||||
|
@ -681,6 +776,7 @@ void UHarmonyLinkGraphics::PrintDebugSection(FSettingsProfile& SettingsProfile)
|
|||
|
||||
void UHarmonyLinkGraphics::ResetInstance()
|
||||
{
|
||||
UE_LOG(LogHarmonyLink, Log, TEXT("Resetting instance."));
|
||||
_INSTANCE->DestroySettings();
|
||||
GetSettings();
|
||||
}
|
||||
|
|
|
@ -19,20 +19,20 @@ FDevice::FDevice(HarmonyLinkLib::FDevice* oldDevice)
|
|||
}
|
||||
}
|
||||
|
||||
EDeviceEnum FDevice::Convert(HarmonyLinkLib::EDevice Device)
|
||||
EDevice FDevice::Convert(HarmonyLinkLib::EDevice Device)
|
||||
{
|
||||
switch (Device)
|
||||
{
|
||||
case HarmonyLinkLib::EDevice::DESKTOP:
|
||||
return EDeviceEnum::DESKTOP;
|
||||
return EDevice::DESKTOP;
|
||||
case HarmonyLinkLib::EDevice::LAPTOP:
|
||||
return EDeviceEnum::LAPTOP;
|
||||
return EDevice::LAPTOP;
|
||||
case HarmonyLinkLib::EDevice::HANDHELD:
|
||||
return EDeviceEnum::HANDHELD;
|
||||
return EDevice::HANDHELD;
|
||||
case HarmonyLinkLib::EDevice::STEAM_DECK:
|
||||
return EDeviceEnum::STEAM_DECK;
|
||||
return EDevice::STEAM_DECK;
|
||||
default:
|
||||
return EDeviceEnum::DESKTOP;
|
||||
return EDevice::DESKTOP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* Enum representing different operating system platforms.
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EDeviceEnum : uint8
|
||||
enum class EDevice : uint8
|
||||
{
|
||||
DESKTOP UMETA(DisplayName = "Desktop"),
|
||||
LAPTOP UMETA(DisplayName = "Laptop"),
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
UENUM(BlueprintType)
|
||||
enum class EProfile : uint8
|
||||
{
|
||||
NONE UMETA(DisplayName = "NONE"),
|
||||
NONE = 0 UMETA(DisplayName = "NONE"),
|
||||
BATTERY UMETA(DisplayName = "BATTERY"),
|
||||
CHARGING UMETA(DisplayName = "CHARGING"),
|
||||
DOCKED UMETA(DisplayName = "DOCKED"),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogHarmonyLink, Log, All);
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogHarmonyLink, All, All);
|
||||
|
||||
class FHarmonyLinkModule : public IModuleInterface
|
||||
{
|
||||
|
|
|
@ -21,31 +21,33 @@ class HARMONYLINK_API UHarmonyLinkLibrary : public UBlueprintFunctionLibrary
|
|||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UHarmonyLinkLibrary();
|
||||
|
||||
// Checks if the game is running under Wine.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsWine();
|
||||
|
||||
// Checks if the operating system is Linux.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsLinux();
|
||||
|
||||
// Checks if the game is running on a Steam Deck.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static bool IsSteamDeck();
|
||||
|
||||
// Retrieves information about the CPU of the current device.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FCPUInfo GetCPUInfo();
|
||||
|
||||
// Retrieves information about the current device.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FDevice GetDeviceInfo();
|
||||
|
||||
// Retrieves information about the operating system of the current device.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FOSVerInfo GetOSInfo();
|
||||
|
||||
// Retrieves the current battery status of the device.
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink")
|
||||
static FBattery GetBatteryStatus();
|
||||
};
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
* - Calls the `Init` function on the new instance to perform any necessary initialization.
|
||||
* - Returns the singleton instance.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink Settings")
|
||||
static UHarmonyLinkGraphics* GetSettings();
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
*
|
||||
* @note Uses UE_LOG for logging errors.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category="HarmonyLink Settings")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, BlueprintPure, Category="HarmonyLink Settings")
|
||||
FSettingsProfile GetSettingProfile(const EProfile Profile);
|
||||
|
||||
/**
|
||||
|
@ -245,7 +245,7 @@ private:
|
|||
*
|
||||
* @note Uses UE_LOG for logging the creation process.
|
||||
*/
|
||||
void CreateDefaultConfigFile();
|
||||
void CreateDefaultConfigFile() const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves the path to the configuration file.
|
||||
|
@ -278,7 +278,7 @@ private:
|
|||
*
|
||||
* @note Uses UE_LOG for logging errors and success messages.
|
||||
*/
|
||||
bool LoadSettingsFromConfig(const bool bLoadDefaults);
|
||||
bool LoadSettingsFromConfig(FConfigFile* ConfigFile) const;
|
||||
|
||||
/**
|
||||
* @brief Loads a specific section from the configuration file into a settings profile.
|
||||
|
@ -298,7 +298,7 @@ private:
|
|||
*
|
||||
* @note The function handles settings of types int, float, bool, and string.
|
||||
*/
|
||||
bool LoadSection(const FConfigFile& ConfigFile, const TPair<EProfile, FName> Profile);
|
||||
static bool LoadSection(FConfigFile* ConfigFile, const TPair<EProfile, FName> Profile);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -322,7 +322,7 @@ private:
|
|||
*
|
||||
* @note Uses UE_LOG for logging the save and flush operations.
|
||||
*/
|
||||
static void SaveSection(const FSettingsProfile& SettingsProfile, const bool bDefaultConfig, const bool bFlush = false);
|
||||
void SaveSection(const FSettingsProfile& SettingsProfile, const bool bDefaultConfig, const bool bFlush = false) const;
|
||||
|
||||
/**
|
||||
* @brief Loads the default settings into the profiles.
|
||||
|
@ -340,7 +340,7 @@ private:
|
|||
*
|
||||
* @note Uses UE_LOG for logging the start of the default settings loading process.
|
||||
*/
|
||||
void LoadDefaults();
|
||||
void LoadDefaults() const;
|
||||
|
||||
/**
|
||||
* @brief Applies the specified graphics profile internally.
|
||||
|
@ -451,6 +451,8 @@ private:
|
|||
*/
|
||||
void DebugPrintProfiles() const;
|
||||
|
||||
FConfigFile* GetConfig() const;
|
||||
|
||||
/**
|
||||
* @brief Prints debug information for a specific settings profile.
|
||||
*
|
||||
|
@ -468,10 +470,10 @@ private:
|
|||
static void PrintDebugSection(FSettingsProfile& SettingsProfile);
|
||||
|
||||
// Indicates whether automatic profile switching is enabled.
|
||||
bool _bAutomaticSwitch = false;
|
||||
static bool _bAutomaticSwitch;
|
||||
|
||||
// Stores the last recorded battery percentage.
|
||||
int32 _LastBatteryPercentage = 0;
|
||||
static int32 _LastBatteryPercentage;
|
||||
|
||||
// The rate at which to query HarmonyLinkLib for hardware info.
|
||||
static int32 _TickRate;
|
||||
|
@ -480,17 +482,15 @@ private:
|
|||
static FTimerHandle _TickTimerHandle;
|
||||
|
||||
// The currently active profile.
|
||||
EProfile _ActiveProfile = EProfile::NONE;
|
||||
static EProfile _ActiveProfile;
|
||||
|
||||
// Maps profile enums to their corresponding names.
|
||||
TMap<EProfile, FName> _ProfileNames = {
|
||||
{EProfile::BATTERY, "Battery"},
|
||||
{EProfile::CHARGING, "Charging"},
|
||||
{EProfile::DOCKED, "Docked"},
|
||||
};
|
||||
static TMap<EProfile, FName> _ProfileNames;
|
||||
|
||||
// Stores the settings profiles.
|
||||
TMap<EProfile, FSettingsProfile> _Profiles;
|
||||
static TMap<EProfile, FSettingsProfile> _Profiles;
|
||||
|
||||
static TSharedPtr<FConfigFile> _ConfigFile;
|
||||
|
||||
// The default settings for profiles.
|
||||
static TMap<FName, TMap<FName, FHLConfigValue>> _DefaultSettings;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
#pragma once
|
||||
|
||||
#include <HarmonyLinkLib.h>
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Structs/FBattery.h"
|
||||
|
||||
#include "Battery.generated.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <HarmonyLinkLib.h>
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "Structs/FCPUInfo.h"
|
||||
|
||||
#include "CPUInfo.generated.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include "CoreMinimal.h"
|
||||
#include "Enums/DeviceEnum.h"
|
||||
#include "Enums/Platform.h"
|
||||
#include <Structs/FDevice.h>
|
||||
|
||||
#include "Structs/FDevice.h"
|
||||
|
||||
#include "Device.generated.h"
|
||||
|
||||
|
@ -25,7 +26,7 @@ struct FDevice
|
|||
|
||||
// The type of the device.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
EDeviceEnum Device = EDeviceEnum::DESKTOP;
|
||||
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.
|
||||
|
@ -35,7 +36,7 @@ private:
|
|||
// Converts an external device enum to the internal EDeviceEnum type.
|
||||
// @param Device External device enum to convert.
|
||||
// @returns Converted EDeviceEnum value.
|
||||
static EDeviceEnum Convert(HarmonyLinkLib::EDevice Device);
|
||||
static EDevice Convert(HarmonyLinkLib::EDevice Device);
|
||||
|
||||
// Converts an external platform enum to the internal EPlatform type.
|
||||
// @param Platform External platform enum to convert.
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include <HarmonyLinkLib.h>
|
||||
|
||||
#include "Structs/FOSVerInfo.h"
|
||||
|
||||
#include "OSVerInfo.generated.h"
|
||||
|
||||
|
|
|
@ -8,39 +8,46 @@ public class HarmonyLinkLib : ModuleRules
|
|||
{
|
||||
public HarmonyLinkLib(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
Console.WriteLine("Building HarmonyLinkLib");
|
||||
//Console.WriteLine("Building HarmonyLinkLib");
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
Type = ModuleType.External;
|
||||
|
||||
// Add the standard library
|
||||
bUseRTTI = true;
|
||||
bEnableExceptions = true;
|
||||
//bUseRTTI = true;
|
||||
//bEnableExceptions = true;
|
||||
|
||||
// Optionally, if you need C++17 features
|
||||
CppStandard = CppStandardVersion.Cpp17;
|
||||
//CppStandard = CppStandardVersion.Cpp17;
|
||||
|
||||
string includePath = Path.Combine(ModuleDirectory, "include");
|
||||
Console.WriteLine("Include Path: " + includePath);
|
||||
//Console.WriteLine("Include Path: " + includePath);
|
||||
PublicIncludePaths.Add(includePath);
|
||||
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_STATIC=1");
|
||||
|
||||
string platformString = Target.Platform.ToString();
|
||||
if (Target.Platform == UnrealTargetPlatform.Win64)
|
||||
{
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_STATIC=1");
|
||||
PublicDefinitions.Add("BUILD_WINDOWS=1");
|
||||
string dllPath = Path.Combine(ModuleDirectory, "lib", platformString, "HarmonyLinkLibStatic.lib");
|
||||
Console.WriteLine("DLL Path: " + dllPath);
|
||||
PublicAdditionalLibraries.Add(dllPath);
|
||||
//RuntimeDependencies.Add(dllPath);
|
||||
string libpath = Path.Combine(ModuleDirectory, "lib", platformString, "HarmonyLinkLibStatic.lib");
|
||||
|
||||
PublicAdditionalLibraries.Add(libpath);
|
||||
|
||||
//string dllPath = Path.Combine(ModuleDirectory, "bin", platformString, "HarmonyLinkLibShared.dll");
|
||||
//string dllTargetPath = "$(TargetOutputDir)/HarmonyLinkLibShared.dll";
|
||||
|
||||
//Console.WriteLine("DLL Path: " + dllPath);
|
||||
//RuntimeDependencies.Add(dllTargetPath, dllPath);
|
||||
|
||||
//PublicDelayLoadDLLs.Add("HarmonyLinkLibShared.dll");
|
||||
}
|
||||
else if (Target.Platform == UnrealTargetPlatform.Linux)
|
||||
{
|
||||
Console.WriteLine("Building Linux");
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_SHARED=1");
|
||||
//Console.WriteLine("Building Linux");
|
||||
PublicDefinitions.Add("BUILD_LINUX=1");
|
||||
string libPath = Path.Combine(ModuleDirectory, "bin", platformString, "libHarmonyLinkLibShared.so");
|
||||
Console.WriteLine("Library Path: " + libPath);
|
||||
//Console.WriteLine("Library Path: " + libPath);
|
||||
PublicAdditionalLibraries.Add(libPath);
|
||||
|
||||
// Add the C++ standard library explicitly
|
||||
|
@ -51,9 +58,10 @@ public class HarmonyLinkLib : ModuleRules
|
|||
// I shall include this if anyone wishes to provide Mac binaries of HarmonyLink but these are not included by default as I don't own one.
|
||||
else if (Target.Platform == UnrealTargetPlatform.Mac)
|
||||
{
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_SHARED=1");
|
||||
PublicDefinitions.Add("BUILD_MACOS=1");
|
||||
string dynlibPath = Path.Combine(ModuleDirectory, "lib", platformString, "libHarmonyLinkLibStatic.a");
|
||||
Console.WriteLine("Dynamic Library Path: " + dynlibPath);
|
||||
//Console.WriteLine("Dynamic Library Path: " + dynlibPath);
|
||||
RuntimeDependencies.Add(dynlibPath);
|
||||
}
|
||||
}
|
||||
|
|
BIN
Source/ThirdParty/HarmonyLinkLib/bin/Win64/HarmonyLinkLibShared.dll
(Stored with Git LFS)
vendored
BIN
Source/ThirdParty/HarmonyLinkLib/bin/Win64/HarmonyLinkLibShared.dll
(Stored with Git LFS)
vendored
Binary file not shown.
|
@ -44,17 +44,19 @@ class IPlatformUtilities;
|
|||
|
||||
namespace HarmonyLinkLib
|
||||
{
|
||||
extern "C" HARMONYLINKLIB_API bool get_is_wine();
|
||||
HARMONYLINKLIB_API bool HL_Init();
|
||||
|
||||
extern "C" HARMONYLINKLIB_API bool get_is_linux();
|
||||
HARMONYLINKLIB_API bool get_is_wine();
|
||||
|
||||
extern "C" HARMONYLINKLIB_API bool get_is_docked();
|
||||
HARMONYLINKLIB_API bool get_is_linux();
|
||||
|
||||
extern "C" HARMONYLINKLIB_API FCPUInfo* get_cpu_info();
|
||||
HARMONYLINKLIB_API bool get_is_docked();
|
||||
|
||||
extern "C" HARMONYLINKLIB_API FDevice* get_device_info();
|
||||
HARMONYLINKLIB_API FCPUInfo* get_cpu_info();
|
||||
|
||||
extern "C" HARMONYLINKLIB_API FOSVerInfo* get_os_version();
|
||||
HARMONYLINKLIB_API FDevice* get_device_info();
|
||||
|
||||
extern "C" HARMONYLINKLIB_API FBattery* get_battery_status();
|
||||
HARMONYLINKLIB_API FOSVerInfo* get_os_version();
|
||||
|
||||
HARMONYLINKLIB_API FBattery* get_battery_status();
|
||||
}
|
||||
|
|
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Linux/libHarmonyLinkLibStatic.a
(Stored with Git LFS)
vendored
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Linux/libHarmonyLinkLibStatic.a
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Win64/HarmonyLinkLibStatic.lib
(Stored with Git LFS)
vendored
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Win64/HarmonyLinkLibStatic.lib
(Stored with Git LFS)
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue