Skip to content

Commit ad3f1e5

Browse files
Merge pull request #1236 from EOS-Contrib/upgrade/switch2-public-merge
Merge Switch 2 support to Public
2 parents 33e1486 + e1875e9 commit ad3f1e5

7 files changed

Lines changed: 41 additions & 15 deletions

File tree

Assets/Plugins/Source/Editor/Build/EOSConfigBuildValidator.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ private enum ErrorCode : uint
6161
{ BuildTarget.PS4, PlatformManager.Platform.PS4 },
6262
{ BuildTarget.PS5, PlatformManager.Platform.PS5 },
6363
{ BuildTarget.Switch, PlatformManager.Platform.Switch },
64+
#if UNITY_6000_0_61_OR_NEWER || UNITY_6000_3_0_OR_NEWER
65+
{ BuildTarget.Switch2, PlatformManager.Platform.Switch2 },
66+
#endif
6467
{ BuildTarget.StandaloneOSX, PlatformManager.Platform.macOS },
6568
{ BuildTarget.StandaloneWindows, PlatformManager.Platform.Windows },
6669
{ BuildTarget.StandaloneWindows64, PlatformManager.Platform.Windows },

Assets/Scripts/StandardSamples/UI/Login/UILoginMenu.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void Awake()
104104
tokenInputField.InputField.onEndEdit.AddListener(CacheTokenField);
105105
#if UNITY_EDITOR
106106
loginType = LoginCredentialType.AccountPortal; // Default in editor
107-
#elif UNITY_SWITCH
107+
#elif UNITY_SWITCH || UNITY_SWITCH2
108108
loginType = LoginCredentialType.PersistentAuth; // Default on switch
109109
#elif UNITY_PS4 || UNITY_PS5 || UNITY_GAMECORE
110110
loginType = LoginCredentialType.ExternalAuth; // Default on other consoles
@@ -117,7 +117,7 @@ private void Awake()
117117
idInputField.InputField.text = "localhost:7777"; //default on pc
118118
#endif
119119

120-
#if !ENABLE_INPUT_SYSTEM && (UNITY_XBOXONE || UNITY_GAMECORE_XBOXONE || UNITY_GAMECORE_SCARLETT || UNITY_PS4 || UNITY_PS5 || UNITY_SWITCH)
120+
#if !ENABLE_INPUT_SYSTEM && (UNITY_XBOXONE || UNITY_GAMECORE_XBOXONE || UNITY_GAMECORE_SCARLETT || UNITY_PS4 || UNITY_PS5 || UNITY_SWITCH || UNITY_SWITCH2)
121121
Debug.LogError("Input currently handled by Input Manager. Input System Package is required for controller support on consoles.");
122122
#endif
123123
}
@@ -1030,8 +1030,12 @@ public void OnLoginButtonClick()
10301030

10311031
///TOO(mendsley): Use activating controller index here
10321032
psnManager.StartLoginWithPSN(0, StartLoginWithLoginTypeAndTokenCallback);
1033-
#elif UNITY_SWITCH && !UNITY_EDITOR
1033+
#elif (UNITY_SWITCH || UNITY_SWITCH2) && !UNITY_EDITOR
1034+
#if UNITY_SWITCH
10341035
var nintendoManager = EOSManager.Instance.GetOrCreateManager<EOSNintendoManager>();
1036+
#elif UNITY_SWITCH2
1037+
var nintendoManager = EOSManager.Instance.GetOrCreateManager<EOSNintendo2Manager>();
1038+
#endif
10351039
nintendoManager.StartLoginWithNSAPreselectedUser(StartLoginWithLoginTypeAndTokenCallback);
10361040
#elif UNITY_GAMECORE && !UNITY_EDITOR
10371041
EOSXBLManager xblManager = EOSManager.Instance.GetOrCreateManager<EOSXBLManager>();
@@ -1042,10 +1046,14 @@ public void OnLoginButtonClick()
10421046
}
10431047
else if (loginType == LoginCredentialType.PersistentAuth)
10441048
{
1045-
#if UNITY_SWITCH && !UNITY_EDITOR
1049+
#if (UNITY_SWITCH || UNITY_SWITCH2) && !UNITY_EDITOR
1050+
#if UNITY_SWITCH
10461051
var nintendoManager = EOSManager.Instance.GetOrCreateManager<EOSNintendoManager>();
1052+
#elif UNITY_SWITCH2
1053+
var nintendoManager = EOSManager.Instance.GetOrCreateManager<EOSNintendo2Manager>();
1054+
#endif
10471055
nintendoManager.StartLoginWithPersistantAuthPreselectedUser((LoginCallbackInfo callbackInfo) =>
1048-
{
1056+
{
10491057
if (callbackInfo.ResultCode == Result.Success)
10501058
{
10511059
ConfigureUIForLogout();
@@ -1355,7 +1363,7 @@ public void StartLoginWithLoginTypeAndTokenCallback(LoginCallbackInfo loginCallb
13551363
{
13561364
print("Trying Auth link with external account: " + loginCallbackInfo.ContinuanceToken);
13571365
EOSManager.Instance.AuthLinkExternalAccountWithContinuanceToken(loginCallbackInfo.ContinuanceToken,
1358-
#if UNITY_SWITCH
1366+
#if UNITY_SWITCH || UNITY_SWITCH2
13591367
LinkAccountFlags.NintendoNsaId,
13601368
#else
13611369
LinkAccountFlags.NoFlags,

Assets/Scripts/com.playeveryware.eos.samples.asmdef

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"GUID:2ced8f3cc58f63843bc26c7591a35628",
88
"GUID:3a63500f0eef43a438c0553491f7c5da",
99
"GUID:575987b8fe219a04c8864880f8ca646b",
10+
"GUID:6055be8ebefd69e48b49212b09b47b2f",
1011
"GUID:75469ad4d38634e559750d17036d5f7c",
1112
"GUID:8979f042b0046d344a016c4b2f59e32b",
1213
"GUID:e0c32ae092d640a42bb7d7442a830160",
@@ -15,7 +16,8 @@
1516
"GUID:a095d5f0621c943d19ea12b9bd6fc47a",
1617
"GUID:be1f6e9efffcfce41aeb5c2f4c27cf75",
1718
"GUID:d05351cc96cc28c41bee26cf7187c9e6",
18-
"GUID:da388c951237dad49ac09ebed548a2dd"
19+
"GUID:da388c951237dad49ac09ebed548a2dd",
20+
"GUID:5f00bdf6fc07ba947b1950c4e5382a2d"
1921
],
2022
"includePlatforms": [],
2123
"excludePlatforms": [],

com.playeveryware.eos/Runtime/Core/PlatformManager.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ public enum Platform
5656
PS4 = 0x80,
5757
PS5 = 0x100,
5858
Switch = 0x200,
59+
Switch2 = 0x300,
5960
Steam = 0x400,
60-
Console = PS4 | PS5 | XboxOne | XboxSeriesX | Switch,
61-
Any = Unknown | Windows | Android | XboxOne | XboxSeriesX | iOS | Linux | macOS | PS4 | PS5 | Switch | Steam
61+
Console = PS4 | PS5 | XboxOne | XboxSeriesX | Switch | Switch2,
62+
Any = Unknown | Windows | Android | XboxOne | XboxSeriesX | iOS | Linux | macOS | PS4 | PS5 | Switch | Switch2 | Steam
6263
}
6364

6465
internal readonly struct PlatformInfo
@@ -89,7 +90,7 @@ public static PlatformInfo Create<T>(string fullName, string configFileName, str
8990
}
9091

9192
/// <summary>
92-
/// Private collection to store information about each platform.
93+
/// Internal collection to store information about each platform.
9394
/// </summary>
9495
internal static IDictionary<Platform, PlatformInfo> PlatformInformation = new Dictionary<Platform, PlatformInfo>();
9596

@@ -281,6 +282,9 @@ public static PlatformConfig GetPlatformConfig()
281282
{ RuntimePlatform.GameCoreXboxOne, Platform.XboxOne},
282283
{ RuntimePlatform.XboxOne, Platform.XboxOne},
283284
{ RuntimePlatform.Switch, Platform.Switch},
285+
#if UNITY_6000_0_61_OR_NEWER || UNITY_6000_3_0_OR_NEWER
286+
{ RuntimePlatform.Switch2, Platform.Switch2},
287+
#endif
284288
{ RuntimePlatform.GameCoreXboxSeries, Platform.XboxSeriesX},
285289
{ RuntimePlatform.LinuxPlayer, Platform.Linux},
286290
{ RuntimePlatform.LinuxEditor, Platform.Linux},
@@ -322,6 +326,9 @@ public static bool TryGetPlatform(RuntimePlatform runtimePlatform, out Platform
322326
{ BuildTarget.PS4, Platform.PS4 },
323327
{ BuildTarget.PS5, Platform.PS5 },
324328
{ BuildTarget.Switch, Platform.Switch },
329+
#if UNITY_6000_0_61_OR_NEWER || UNITY_6000_3_0_OR_NEWER
330+
{ BuildTarget.Switch2, Platform.Switch2 },
331+
#endif
325332
{ BuildTarget.StandaloneOSX, Platform.macOS },
326333
{ BuildTarget.StandaloneWindows, Platform.Windows },
327334
{ BuildTarget.StandaloneWindows64, Platform.Windows },

com.playeveryware.eos/Runtime/Core/SystemDynamicLibrary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public partial class SystemDynamicLibrary
116116
[DllImport(DLLHBinaryName, SetLastError = true, CharSet = CharSet.Ansi)]
117117
private static extern IntPtr DLLH_load_library_at_path(IntPtr ctx, string library_path);
118118

119-
#if !UNITY_SWITCH && !UNITY_PS4 && !UNITY_PS5
119+
#if !UNITY_SWITCH && !UNITY_SWITCH2 && !UNITY_PS4 && !UNITY_PS5
120120
[DllImport(DLLHBinaryName)]
121121
private static extern bool DLLH_unload_library_at_path(IntPtr ctx, IntPtr library_handle);
122122
#endif

com.playeveryware.eos/Runtime/Core/SystemMemory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
* SOFTWARE.
2121
*/
2222

23-
#if UNITY_PS5 || UNITY_PS4 || UNITY_GAMECORE_XBOXONE || UNITY_GAMECORE_SCARLETT || UNITY_SWITCH
23+
#if UNITY_PS5 || UNITY_PS4 || UNITY_GAMECORE_XBOXONE || UNITY_GAMECORE_SCARLETT || UNITY_SWITCH || UNITY_SWITCH2
2424
#define ENABLE_GET_ALLOCATOR_FUNCTION
2525
#endif
2626

27-
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_PS4 || UNITY_PS5 || UNITY_SWITCH)
27+
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_PS4 || UNITY_PS5 || UNITY_SWITCH || UNITY_SWITCH2)
2828
#define DLLHELPER_HAS_INTERNAL_LINKAGE
2929
#endif
3030

31-
#if UNITY_STANDALONE || UNITY_EDITOR_WIN || UNITY_PS4 || UNITY_PS5 || UNITY_GAMECORE_XBOXONE || UNITY_GAMECORE_SCARLETT || UNITY_SWITCH
31+
#if UNITY_STANDALONE || UNITY_EDITOR_WIN || UNITY_PS4 || UNITY_PS5 || UNITY_GAMECORE_XBOXONE || UNITY_GAMECORE_SCARLETT || UNITY_SWITCH || UNITY_SWITCH2
3232
#define DYNAMIC_MEMORY_ALLOCATION_AVAILABLE
3333
#endif
3434

com.playeveryware.eos/Runtime/EOS_SDK/Core/Common.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define EOS_EDITOR
99
#endif
1010

11-
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_PS4 || UNITY_PS5 || UNITY_XBOXONE || UNITY_SWITCH || UNITY_IOS || UNITY_ANDROID || UNITY_WSA
11+
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_PS4 || UNITY_PS5 || UNITY_XBOXONE || UNITY_SWITCH || UNITY_SWITCH2 || UNITY_IOS || UNITY_ANDROID || UNITY_WSA
1212
#define EOS_UNITY
1313
#endif
1414

@@ -42,6 +42,9 @@
4242
#elif UNITY_SWITCH
4343
#define EOS_PLATFORM_SWITCH
4444

45+
#elif UNITY_SWITCH2
46+
#define EOS_PLATFORM_SWITCH2
47+
4548
#elif UNITY_IOS || __IOS__
4649
#define EOS_PLATFORM_IOS
4750

@@ -98,6 +101,9 @@ public sealed partial class Common
98101
#elif EOS_PLATFORM_SWITCH
99102
"EOSSDK-Switch-Shipping"
100103

104+
#elif EOS_PLATFORM_SWITCH2
105+
"EOSSDK-Switch2-Shipping"
106+
101107
#elif EOS_PLATFORM_XBOXONE_GDK
102108
"EOSSDK-XboxOneGDK-Shipping"
103109

0 commit comments

Comments
 (0)