Files
David Harvey 3592ba635a Adding ISaveGameSystemModule module, comparable to the platform chunk install module.
Example usage added to Windows platform, allowing Windows platform extensions to override the default save system.
```
[PlatformFeatures]
SaveGameSystemModule=MySaveModule
```

#jira UE-143574, UE-179187
#rb Wojciech.Krywult
#preflight 6447ee14864f15ebf5c5bd01

[CL 25181389 by David Harvey in ue5-main branch]
2023-04-25 11:33:54 -04:00

61 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "WindowsPlatformFeatures.h"
#include "WmfPrivate.h"
#include "WindowsVideoRecordingSystem.h"
#include "SaveGameSystem.h"
#include "Misc/CommandLine.h"
#include "Misc/ConfigCacheIni.h"
IMPLEMENT_MODULE(FWindowsPlatformFeaturesModule, WindowsPlatformFeatures);
FWindowsPlatformFeaturesModule::FWindowsPlatformFeaturesModule()
{
}
IVideoRecordingSystem* FWindowsPlatformFeaturesModule::GetVideoRecordingSystem()
{
static FWindowsVideoRecordingSystem VideoRecordingSystem;
return &VideoRecordingSystem;
}
ISaveGameSystem* FWindowsPlatformFeaturesModule::GetSaveGameSystem()
{
static ISaveGameSystem* SaveGameSystem = nullptr;
static bool bIniChecked = false;
if (!SaveGameSystem || !bIniChecked)
{
ISaveGameSystemModule* SaveGameSystemModule = nullptr;
if (!GEngineIni.IsEmpty())
{
FString SaveGameModule;
GConfig->GetString(TEXT("PlatformFeatures"), TEXT("SaveGameSystemModule"), SaveGameModule, GEngineIni);
if (!SaveGameModule.IsEmpty())
{
SaveGameSystemModule = FModuleManager::LoadModulePtr<ISaveGameSystemModule>(*SaveGameModule);
if (SaveGameSystemModule != nullptr)
{
// Attempt to grab the save game system
SaveGameSystem = SaveGameSystemModule->GetSaveGameSystem();
}
}
bIniChecked = true;
}
if (SaveGameSystem == nullptr)
{
// Placeholder/default instance
SaveGameSystem = IPlatformFeaturesModule::GetSaveGameSystem();
}
}
return SaveGameSystem;
}
void FWindowsPlatformFeaturesModule::StartupModule()
{
FModuleManager::Get().LoadModule(TEXT("GameplayMediaEncoder"));
}