Add Switch platform
This commit is contained in:
@@ -46,6 +46,9 @@ public class Audio : EngineModule
|
||||
case TargetPlatform.Android:
|
||||
useOpenAL = true;
|
||||
break;
|
||||
case TargetPlatform.Switch:
|
||||
useNone = true;
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ IMPLEMENT_SETTINGS_GETTER(PS4PlatformSettings, PS4Platform);
|
||||
IMPLEMENT_SETTINGS_GETTER(XboxScarlettPlatformSettings, XboxScarlettPlatform);
|
||||
#elif PLATFORM_ANDROID
|
||||
IMPLEMENT_SETTINGS_GETTER(AndroidPlatformSettings, AndroidPlatform);
|
||||
#elif PLATFORM_SWITCH
|
||||
IMPLEMENT_SETTINGS_GETTER(SwitchPlatformSettings, SwitchPlatform);
|
||||
#else
|
||||
#error Unknown platform
|
||||
#endif
|
||||
@@ -199,6 +201,7 @@ void GameSettings::Deserialize(DeserializeStream& stream, ISerializeModifier* mo
|
||||
DESERIALIZE(PS4Platform);
|
||||
DESERIALIZE(XboxScarlettPlatform);
|
||||
DESERIALIZE(AndroidPlatform);
|
||||
DESERIALIZE(SwitchPlatform);
|
||||
}
|
||||
|
||||
void LayersAndTagsSettings::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace FlaxEditor.Content.Settings
|
||||
{
|
||||
internal const string PS4PlatformSettingsTypename = "FlaxEditor.Content.Settings.PS4PlatformSettings";
|
||||
internal const string XboxScarlettPlatformSettingsTypename = "FlaxEditor.Content.Settings.XboxScarlettPlatformSettings";
|
||||
internal const string SwitchPlatformSettingsTypename = "FlaxEditor.Content.Settings.SwitchPlatformSettings";
|
||||
|
||||
/// <summary>
|
||||
/// The default application icon.
|
||||
@@ -138,6 +139,14 @@ namespace FlaxEditor.Content.Settings
|
||||
public JsonAsset AndroidPlatform;
|
||||
#endif
|
||||
|
||||
#if FLAX_EDITOR || PLATFORM_SWITCH
|
||||
/// <summary>
|
||||
/// Reference to Switch Platform Settings asset. Used to apply configuration on Switch platform.
|
||||
/// </summary>
|
||||
[EditorOrder(2070), EditorDisplay("Platform Settings", "Switch"), AssetReference(SwitchPlatformSettingsTypename, true), Tooltip("Reference to Switch Platform Settings asset")]
|
||||
public JsonAsset SwitchPlatform;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets the absolute path to the game settings asset file.
|
||||
/// </summary>
|
||||
@@ -240,6 +249,10 @@ namespace FlaxEditor.Content.Settings
|
||||
if (type == typeof(AndroidPlatformSettings))
|
||||
return LoadAsset<AndroidPlatformSettings>(gameSettings.AndroidPlatform) as T;
|
||||
#endif
|
||||
#if FLAX_EDITOR || PLATFORM_SWITCH
|
||||
if (type.FullName == SwitchPlatformSettingsTypename)
|
||||
return LoadAsset(gameSettings.SwitchPlatform, SwitchPlatformSettingsTypename) as T;
|
||||
#endif
|
||||
|
||||
if (gameSettings.CustomSettings != null)
|
||||
{
|
||||
@@ -324,6 +337,8 @@ namespace FlaxEditor.Content.Settings
|
||||
return SaveAsset(gameSettings, ref gameSettings.XboxScarlettPlatform, obj);
|
||||
if (type == typeof(AndroidPlatformSettings))
|
||||
return SaveAsset(gameSettings, ref gameSettings.AndroidPlatform, obj);
|
||||
if (type.FullName == SwitchPlatformSettingsTypename)
|
||||
return SaveAsset(gameSettings, ref gameSettings.SwitchPlatform, obj);
|
||||
if (type == typeof(AudioSettings))
|
||||
return SaveAsset(gameSettings, ref gameSettings.Audio, obj);
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
Guid PS4Platform;
|
||||
Guid XboxScarlettPlatform;
|
||||
Guid AndroidPlatform;
|
||||
Guid SwitchPlatform;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -23,3 +23,6 @@
|
||||
#if PLATFORM_ANDROID
|
||||
#include "Engine/Platform/Android/AndroidPlatformSettings.h"
|
||||
#endif
|
||||
#if PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchPlatformSettings.h"
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,9 @@ public class Engine : EngineModule
|
||||
case TargetPlatform.PS4:
|
||||
options.SourcePaths.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "PS4", "Engine", "Engine"));
|
||||
break;
|
||||
case TargetPlatform.Switch:
|
||||
options.SourcePaths.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Switch", "Engine", "Engine"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "Platforms/XboxScarlett/Engine/Engine/XboxScarlettGame.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidGame.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Engine/SwitchGame.h"
|
||||
#else
|
||||
#error Missing Game implementation!
|
||||
#endif
|
||||
|
||||
@@ -75,6 +75,9 @@ public class Graphics : EngineModule
|
||||
case TargetPlatform.Android:
|
||||
options.PrivateDependencies.Add("GraphicsDeviceVulkan");
|
||||
break;
|
||||
case TargetPlatform.Switch:
|
||||
options.PrivateDependencies.Add("GraphicsDeviceNull"); // TODO: use Vulkan on Switch
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@ public class Main : EngineModule
|
||||
case TargetPlatform.Android:
|
||||
options.SourcePaths.Add(Path.Combine(FolderPath, "Android"));
|
||||
break;
|
||||
case TargetPlatform.Switch:
|
||||
options.SourcePaths.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Switch", "Engine", "Main"));
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,6 +534,8 @@ const Char* ToString(PlatformType type)
|
||||
return TEXT("Xbox Scarlett");
|
||||
case PlatformType::Android:
|
||||
return TEXT("Android");
|
||||
case PlatformType::Switch:
|
||||
return TEXT("Switch");
|
||||
default:
|
||||
return TEXT("");
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Base/ClipboardBase.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Base/ClipboardBase.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Base/ClipboardBase.h"
|
||||
#else
|
||||
#error Missing Clipboard implementation!
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Win32/Win32ConditionVariable.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Unix/UnixConditionVariable.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchConditionVariable.h"
|
||||
#else
|
||||
#error Missing Condition Variable implementation!
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Win32/Win32CriticalSection.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Unix/UnixCriticalSection.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchCriticalSection.h"
|
||||
#else
|
||||
#error Missing Critical Section implementation!
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,11 @@ API_ENUM() enum class PlatformType
|
||||
/// Running on Android.
|
||||
/// </summary>
|
||||
Android = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Running on Switch.
|
||||
/// </summary>
|
||||
Switch = 8,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -113,6 +118,9 @@ API_ENUM() enum class ArchitectureType
|
||||
#if !defined(PLATFORM_IOS)
|
||||
#define PLATFORM_IOS 0
|
||||
#endif
|
||||
#if !defined(PLATFORM_SWITCH)
|
||||
#define PLATFORM_SWITCH 0
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#include "Windows/WindowsDefines.h"
|
||||
@@ -126,6 +134,8 @@ API_ENUM() enum class ArchitectureType
|
||||
#include "Platforms/XboxScarlett/Engine/Platform/XboxScarlettDefines.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidDefines.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchDefines.h"
|
||||
#else
|
||||
#error Missing Defines implementation!
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Win32/Win32File.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidFile.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchFile.h"
|
||||
#else
|
||||
#error Missing File implementation!
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Platforms/XboxScarlett/Engine/Platform/XboxScarlettFileSystem.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidFileSystem.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchFileSystem.h"
|
||||
#else
|
||||
#error Missing File System implementation!
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Base/FileSystemWatcherBase.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Base/FileSystemWatcherBase.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Base/FileSystemWatcherBase.h"
|
||||
#else
|
||||
#error Missing File System Watcher implementation!
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Win32/Win32Network.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Base/NetworkBase.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Base/NetworkBase.h"
|
||||
#else
|
||||
#error Missing Network implementation!
|
||||
#endif
|
||||
|
||||
@@ -65,6 +65,9 @@ public class Platform : EngineModule
|
||||
options.SourcePaths.Add(Path.Combine(FolderPath, "Unix"));
|
||||
options.SourcePaths.Add(Path.Combine(FolderPath, "Android"));
|
||||
break;
|
||||
case TargetPlatform.Switch:
|
||||
options.SourcePaths.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Switch", "Engine", "Platform"));
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target);
|
||||
}
|
||||
if (options.Target.IsEditor)
|
||||
@@ -76,6 +79,7 @@ public class Platform : EngineModule
|
||||
options.SourceFiles.Add(Path.Combine(FolderPath, "Android", "AndroidPlatformSettings.h"));
|
||||
AddSourceFileIfExists(options, Path.Combine(Globals.EngineRoot, "Source", "Platforms", "XboxScarlett", "Engine", "Platform", "XboxScarlettPlatformSettings.h"));
|
||||
AddSourceFileIfExists(options, Path.Combine(Globals.EngineRoot, "Source", "Platforms", "PS4", "Engine", "Platform", "PS4PlatformSettings.h"));
|
||||
AddSourceFileIfExists(options, Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Switch", "Engine", "Platform", "SwitchPlatformSettings.h"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "Platforms/XboxScarlett/Engine/Platform/XboxScarlettPlatform.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidPlatform.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchPlatform.h"
|
||||
#else
|
||||
#error Missing Platform implementation!
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Win32/Win32Thread.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidThread.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchThread.h"
|
||||
#else
|
||||
#error Missing Thread implementation!
|
||||
#endif
|
||||
|
||||
@@ -140,6 +140,29 @@ typedef AndroidWindow Window;
|
||||
class NetworkBase;
|
||||
typedef NetworkBase Network;
|
||||
|
||||
#elif PLATFORM_SWITCH
|
||||
|
||||
class ClipboardBase;
|
||||
typedef ClipboardBase Clipboard;
|
||||
class SwitchCriticalSection;
|
||||
typedef SwitchCriticalSection CriticalSection;
|
||||
class SwitchConditionVariable;
|
||||
typedef SwitchConditionVariable ConditionVariable;
|
||||
class SwitchFileSystem;
|
||||
typedef SwitchFileSystem FileSystem;
|
||||
class FileSystemWatcherBase;
|
||||
typedef FileSystemWatcherBase FileSystemWatcher;
|
||||
class SwitchFile;
|
||||
typedef SwitchFile File;
|
||||
class SwitchPlatform;
|
||||
typedef SwitchPlatform Platform;
|
||||
class SwitchThread;
|
||||
typedef SwitchThread Thread;
|
||||
class SwitchWindow;
|
||||
typedef SwitchWindow Window;
|
||||
class NetworkBase;
|
||||
typedef NetworkBase Network;
|
||||
|
||||
#else
|
||||
|
||||
#error Missing Types implementation!
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Platforms/XboxScarlett/Engine/Platform/XboxScarlettWindow.h"
|
||||
#elif PLATFORM_ANDROID
|
||||
#include "Android/AndroidWindow.h"
|
||||
#elif PLATFORM_SWITCH
|
||||
#include "Platforms/Switch/Engine/Platform/SwitchWindow.h"
|
||||
#else
|
||||
#error Missing Window implementation!
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,7 @@ public class TextureTool : EngineModule
|
||||
case TargetPlatform.Linux:
|
||||
case TargetPlatform.PS4:
|
||||
case TargetPlatform.Android:
|
||||
case TargetPlatform.Switch:
|
||||
useStb = true;
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target);
|
||||
|
||||
@@ -767,6 +767,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
|
||||
PLATFORM_CASE(6, "PLATFORM_PS4");
|
||||
PLATFORM_CASE(7, "PLATFORM_XBOX_SCARLETT");
|
||||
PLATFORM_CASE(8, "PLATFORM_ANDROID");
|
||||
PLATFORM_CASE(9, "PLATFORM_SWITCH");
|
||||
#undef PLATFORM_CASE
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -714,6 +714,9 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
|
||||
case PlatformType::Android:
|
||||
boxId = 8;
|
||||
break;
|
||||
case PlatformType::Switch:
|
||||
boxId = 9;
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
value = tryGetValue(node->GetBox(node->GetBox(boxId)->HasConnection() ? boxId : 1), Value::Zero);
|
||||
|
||||
Reference in New Issue
Block a user