Unreal access to the PixoVR Platform
Loading...
Searching...
No Matches
PPlatformCore.cpp
Go to the documentation of this file.
1// Copyright 2023 PixoVR Corp. All Rights Reserved.
2
3#include "PPlatformCore.h"
5
6#include "ISettingsModule.h"
7#include "ISettingsSection.h"
8
9#include "UObject/Package.h"
10
11#define LOCTEXT_NAMESPACE "FPPlatformCoreModule"
12
13DEFINE_LOG_CATEGORY_STATIC(LogPPlatformCoreModule, Log, All);
14
15#define Log(pmt, ...) UE_LOG(LogPPlatformCoreModule, Log, TEXT(pmt), ##__VA_ARGS__)
16#define Warn(pmt, ...) UE_LOG(LogPPlatformCoreModule, Warning, TEXT(pmt), ##__VA_ARGS__)
17#define Fatal(pmt, ...) UE_LOG(LogPPlatformCoreModule, Fatal, TEXT(pmt), ##__VA_ARGS__)
18
20{
21 ModuleSettings = GetMutableDefault<UPPlatformCoreSettings>();
22
23 // Register settings
24 if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
25 {
26 ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "PixoVR", "Platform",
27 LOCTEXT("RuntimeSettingsName", "Platform"),
28 LOCTEXT("RuntimeSettingsDescription", "Configure PixoVR Platform Settings"),
30 );
31
32 if (SettingsSection.IsValid())
33 {
34 SettingsSection->OnModified().BindRaw(this, &FPPlatformCoreModule::HandleSettingsSaved);
35 }
36 }
37
38 Log("PixoVR PlatformCore module started.");
39}
40
42{
43 if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
44 {
45 SettingsModule->UnregisterSettings("Project", "PixoVR", "Platform");
46 }
47
48 if (!GExitPurge)
49 {
50 ModuleSettings->RemoveFromRoot();
51 }
52 else
53 {
54 ModuleSettings = nullptr;
55 }
56}
57
63
65{
66 UPPlatformCoreSettings* Settings = GetMutableDefault<UPPlatformCoreSettings>();
67 bool bIsValidate = false;
68 // Do validate here
69 bIsValidate = true;
70
71 if (bIsValidate)
72 Settings->SaveConfig();
73
74 return true;
75}
76
77IMPLEMENT_MODULE(FPPlatformCoreModule, PixoPlatformCore)
78
79#undef Log
80#undef Warn
81#undef Fatal
82
83#undef LOCTEXT_NAMESPACE
DEFINE_LOG_CATEGORY_STATIC(LogPPlatformCoreModule, Log, All)
#define Log(pmt,...)
#define Log(pmt,...)
UPPlatformCoreSettings * ModuleSettings
virtual void StartupModule() override
UPPlatformCoreSettings * GetSettings() const
virtual void ShutdownModule() override
UCLASS(config = Game, defaultconfig)