2014-03-14 14:13:41 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "HTML5TargetPlatformPrivatePCH.h"
|
2014-10-27 07:53:18 -04:00
|
|
|
#include "ISettingsModule.h"
|
|
|
|
|
#include "ModuleManager.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "FHTML5TargetPlatformModule"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Holds the target platform singleton.
|
|
|
|
|
static ITargetPlatform* Singleton = NULL;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Module for the HTML5 target platform.
|
|
|
|
|
*/
|
|
|
|
|
class FHTML5TargetPlatformModule
|
|
|
|
|
: public ITargetPlatformModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor.
|
|
|
|
|
*/
|
|
|
|
|
~FHTML5TargetPlatformModule( )
|
|
|
|
|
{
|
|
|
|
|
Singleton = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// Begin ITargetPlatformModule interface
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual ITargetPlatform* GetTargetPlatform( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if (Singleton == NULL)
|
|
|
|
|
{
|
|
|
|
|
// finally, make the interface object
|
|
|
|
|
Singleton = new FHTML5TargetPlatform();
|
2014-06-20 12:07:15 -04:00
|
|
|
FString OutPath;
|
|
|
|
|
if (!Singleton->IsSdkInstalled(false, OutPath))
|
|
|
|
|
{
|
|
|
|
|
delete Singleton;
|
|
|
|
|
Singleton = NULL;
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Singleton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End ITargetPlatformModule interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// Begin IModuleInterface interface
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void StartupModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
TargetSettings = ConstructObject<UHTML5TargetSettings>(UHTML5TargetSettings::StaticClass(), GetTransientPackage(), "HTML5TargetSettings", RF_Standalone);
|
|
|
|
|
TargetSettings->AddToRoot();
|
|
|
|
|
|
2014-10-27 07:53:18 -04:00
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->RegisterSettings("Project", "Platforms", "HTML5",
|
|
|
|
|
LOCTEXT("TargetSettingsName", "HTML5"),
|
|
|
|
|
LOCTEXT("TargetSettingsDescription", "HTML5 platform settings description text here"),
|
|
|
|
|
TargetSettings
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void ShutdownModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-10-27 07:53:18 -04:00
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->UnregisterSettings("Project", "Platforms", "HTML5");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!GExitPurge)
|
|
|
|
|
{
|
|
|
|
|
// If we're in exit purge, this object has already been destroyed
|
|
|
|
|
TargetSettings->RemoveFromRoot();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TargetSettings = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End IModuleInterface interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// Holds the target settings.
|
|
|
|
|
UHTML5TargetSettings* TargetSettings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE( FHTML5TargetPlatformModule, HTML5TargetPlatform);
|