This commit is contained in:
Jordon Brooks 2024-05-16 01:39:54 +01:00
parent 3f43bdb16b
commit 80ea24a694
Signed by: jordon
GPG key ID: DBD9758CD53E786A
2 changed files with 125 additions and 57 deletions

View file

@ -11,6 +11,7 @@
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnProfileChanged, EProfile, Profile);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAutomaticSwitchChanged, bool, bAutomaticSwich);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnBatteryLevelChanged, int32, BatteryPercent);
/**
*
@ -29,6 +30,9 @@ public:
UPROPERTY(BlueprintAssignable)
FOnAutomaticSwitchChanged OnAutomaticSwitchChanged;
UPROPERTY(BlueprintAssignable)
FOnBatteryLevelChanged OnBatteryLevelChanged;
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings")
void LoadConfig(const bool bForceReload = false);
@ -40,7 +44,7 @@ public:
void SetSetting(EProfile Profile, FName Setting, FHLConfigValue Value);
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings")
bool ApplyProfile(EProfile Profile);
bool ApplyProfile(EProfile Profile, const bool bDisableAuto = true);
/** Returns the game local machine settings (resolution, windowing mode, scalability settings, etc...) */
UFUNCTION(BlueprintCallable, Category="HarmonyLink Settings")
@ -64,25 +68,30 @@ private:
void Init();
void Tick();
void CreateDefaultConfigFile();
static FString GetConfigDirectoryFile();
bool LoadSettingsFromConfig();
bool LoadSection(const FConfigFile& ConfigFile, const TPair<EProfile, FName> Profile);
void SaveSection(FSettingsProfile& SettingsProfile, const bool bFlush = false) const;
static void SaveSection(FSettingsProfile& SettingsProfile, const bool bFlush = false);
void LoadDefaults();
bool ApplyProfileInternal(EProfile Profile);
void OnPostWorldInitialization(UWorld* World, UWorld::InitializationValues IVS);
void OnWorldEnd(UWorld* World);
static void ResetInstance();
// Note: Turning off HarmonyLink Settings requires game restart
static void ApplySetting(const TPair<FName, FHLConfigValue>& Setting);
// Debugging
void DebugPrintProfiles() const;
static void PrintDebugSection(FSettingsProfile& SettingsProfile);
static FString _IniLocation;
uint8 _bAutomaticSwitch :1;
int32 _LastBatteryPercentage = 0;
// How many times to query HarmonyLinkLib for hardware info
static int32 _TickRate;