diff --git a/CHANGELOG.md b/CHANGELOG.md index 987c28238..254a77bee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Features +- Added PlayStation Native Support. The SDK now automatically syncs the scope - tags, breadcrumbs, context - to the native layer, so native crashes have the same rich context as managed events. ([#2433](https://github.com/getsentry/sentry-unity/pull/2433)) - On Windows, and with screenshot capture enabled, the SDK will now also capture and attach a screenshot to native crashes ([#2434](https://github.com/getsentry/sentry-unity/pull/2434)) - Added `SetBeforeSendScreenshot(Func)` callback that provides the captured screenshot as a `Texture2D` before JPEG compression. ([#2428](https://github.com/getsentry/sentry-unity/pull/2428)) @@ -21,7 +22,7 @@ - Access to the event context for conditional processing - Added `SetBeforeSendViewHierarchy(Func)` callback that provides the captured `ViewHierarchy` to be modified before compression. ([#2429](https://github.com/getsentry/sentry-unity/pull/2429)) - + ### Dependencies - Bump Cocoa SDK from v8.57.2 to v8.57.3 ([#2424](https://github.com/getsentry/sentry-unity/pull/2424), [#2427](https://github.com/getsentry/sentry-unity/pull/2427)) diff --git a/package-dev/Plugins/sentry_utils.c b/package-dev/Plugins/sentry_utils.c new file mode 100644 index 000000000..da1e1062e --- /dev/null +++ b/package-dev/Plugins/sentry_utils.c @@ -0,0 +1,16 @@ +#include +#include + +/** + * Wrapper around vsnprintf for Unity C# IL2CPP interop. + * + * This function provides a stable ABI entry point for Unity to call + * vsnprintf functionality across Windows, Linux, and PlayStation platforms. + * + * This wrapper is compiled as native C code where va_list is properly + * understood, then IL2CPP calls this wrapper with generic pointers. + */ +int vsnprintf_sentry(char *buffer, size_t size, const char *format, va_list args) +{ + return vsnprintf(buffer, size, format, args); +} diff --git a/package-dev/Plugins/sentry_utils.c.meta b/package-dev/Plugins/sentry_utils.c.meta new file mode 100644 index 000000000..1eee3502d --- /dev/null +++ b/package-dev/Plugins/sentry_utils.c.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: 6ddd83aa3aac13bc6813ca5bbb004a2d +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 0 + Exclude OSXUniversal: 1 + Exclude PS5: 0 + Exclude WebGL: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + Exclude tvOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + - first: + tvOS: tvOS + second: + enabled: 0 + settings: + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + - first: + GameCoreScarlett: GameCoreScarlett + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + GameCoreXboxOne: GameCoreXboxOne + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + PS5: PS5 + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package-dev/Runtime/Sentry.Unity.Native.dll.meta b/package-dev/Runtime/Sentry.Unity.Native.dll.meta index 9e9780954..e85bd71cc 100644 --- a/package-dev/Runtime/Sentry.Unity.Native.dll.meta +++ b/package-dev/Runtime/Sentry.Unity.Native.dll.meta @@ -20,6 +20,7 @@ PluginImporter: Exclude Editor: 0 Exclude Linux64: 0 Exclude OSXUniversal: 1 + Exclude PS5: 0 Exclude WebGL: 1 Exclude Win: 0 Exclude Win64: 0 @@ -44,12 +45,29 @@ PluginImporter: CPU: AnyCPU DefaultValueInitialized: true OS: AnyOS + - first: + GameCoreScarlett: GameCoreScarlett + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + GameCoreXboxOne: GameCoreXboxOne + second: + enabled: 1 + settings: + CPU: AnyCPU + - first: + PS5: PS5 + second: + enabled: 1 + settings: {} - first: Standalone: Linux64 second: enabled: 1 settings: - CPU: x86_64 + CPU: AnyCPU - first: Standalone: OSXUniversal second: @@ -61,13 +79,13 @@ PluginImporter: second: enabled: 1 settings: - CPU: x86 + CPU: AnyCPU - first: Standalone: Win64 second: enabled: 1 settings: - CPU: x86_64 + CPU: AnyCPU - first: Windows Store Apps: WindowsStoreApps second: @@ -90,19 +108,7 @@ PluginImporter: settings: CPU: AnyCPU CompileFlags: - FrameworkDependencies: - - first: - GameCoreScarlett: GameCoreScarlett - second: - enabled: 1 - settings: - CPU: AnyCPU - - first: - GameCoreXboxOne: GameCoreXboxOne - second: - enabled: 1 - settings: - CPU: AnyCPU + FrameworkDependencies: userData: assetBundleName: assetBundleVariant: diff --git a/package-dev/Runtime/SentryInitialization.cs b/package-dev/Runtime/SentryInitialization.cs index d307d529d..f3ee41ff4 100644 --- a/package-dev/Runtime/SentryInitialization.cs +++ b/package-dev/Runtime/SentryInitialization.cs @@ -7,6 +7,8 @@ #define SENTRY_NATIVE #elif UNITY_GAMECORE #define SENTRY_NATIVE +#elif UNITY_PS5 +#define SENTRY_NATIVE #elif UNITY_WEBGL #define SENTRY_WEBGL #endif @@ -131,7 +133,7 @@ private Il2CppMethods _il2CppMethods return null; } -#if UNITY_ANDROID || UNITY_STANDALONE_LINUX +#if UNITY_ANDROID || UNITY_STANDALONE_LINUX || UNITY_PS5 // For ELF platforms, the 20-byte `NT_GNU_BUILD_ID` needs to be // turned into a "little-endian GUID", which means the first three // components need to be byte-swapped appropriately. diff --git a/package-dev/Runtime/io.sentry.unity.dev.runtime.asmdef b/package-dev/Runtime/io.sentry.unity.dev.runtime.asmdef index 3f2957299..2bd1fdd87 100644 --- a/package-dev/Runtime/io.sentry.unity.dev.runtime.asmdef +++ b/package-dev/Runtime/io.sentry.unity.dev.runtime.asmdef @@ -11,6 +11,7 @@ "LinuxStandalone64", "Lumin", "macOSStandalone", + "PS5", "Stadia", "Switch", "WSA", diff --git a/package/Runtime/io.sentry.unity.runtime.asmdef b/package/Runtime/io.sentry.unity.runtime.asmdef index a1ea874a7..362246eb7 100644 --- a/package/Runtime/io.sentry.unity.runtime.asmdef +++ b/package/Runtime/io.sentry.unity.runtime.asmdef @@ -11,6 +11,7 @@ "LinuxStandalone64", "Lumin", "macOSStandalone", + "PS5", "Stadia", "Switch", "WSA", diff --git a/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs b/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs index 92464500b..081dc3d5c 100644 --- a/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs +++ b/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs @@ -141,8 +141,12 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti GUILayout.Label("Console", EditorStyles.boldLabel); options.XboxNativeSupportEnabled = EditorGUILayout.Toggle( - new GUIContent("Xbox", "Whether to enable native crashes support on Xbox."), + new GUIContent("Xbox", "Whether to enable native crash support on Xbox."), options.XboxNativeSupportEnabled); + + options.PlayStationNativeSupportEnabled = EditorGUILayout.Toggle( + new GUIContent("PlayStation", "Whether to enable native crash support on PlayStation."), + options.PlayStationNativeSupportEnabled); } EditorGUI.indentLevel--; diff --git a/src/Sentry.Unity.Editor/Native/BuildPostProcess.cs b/src/Sentry.Unity.Editor/Native/BuildPostProcess.cs index e45108182..eaabfb48d 100644 --- a/src/Sentry.Unity.Editor/Native/BuildPostProcess.cs +++ b/src/Sentry.Unity.Editor/Native/BuildPostProcess.cs @@ -3,7 +3,6 @@ using Sentry.Extensibility; using Sentry.Unity.Editor.ConfigurationWindow; using System.Text.RegularExpressions; -using Microsoft.Extensions.FileSystemGlobbing; using UnityEngine; using UnityEditor; using UnityEditor.Build; @@ -18,7 +17,9 @@ public static class BuildPostProcess public static void OnPostProcessBuild(BuildTarget target, string executablePath) { var targetGroup = BuildPipeline.GetBuildTargetGroup(target); - if (targetGroup is not BuildTargetGroup.Standalone and not BuildTargetGroup.GameCoreXboxSeries) + if (targetGroup is not BuildTargetGroup.Standalone + and not BuildTargetGroup.GameCoreXboxSeries + and not BuildTargetGroup.PS5) { return; } @@ -47,10 +48,12 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath) // The executable path resolves to the following when pointing Unity into a `build/platform/` directory: // - Desktop: `./samples/unity-of-bugs/builds/windows/unityofbugs.exe` // - Xbox: `./samples/unity-of-bugs/builds/xsx/` + // - PlayStation: `./samples/unity-of-bugs/builds/ps5/` var buildOutputDir = targetGroup switch { BuildTargetGroup.Standalone => Path.GetDirectoryName(executablePath), BuildTargetGroup.GameCoreXboxSeries => executablePath, + BuildTargetGroup.PS5 => executablePath, _ => string.Empty }; @@ -87,6 +90,7 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath) BuildTarget.StandaloneOSX => options.MacosNativeSupportEnabled, BuildTarget.StandaloneLinux64 => options.LinuxNativeSupportEnabled, BuildTarget.GameCoreXboxSeries or BuildTarget.GameCoreXboxOne => options.XboxNativeSupportEnabled, + BuildTarget.PS5 => options.PlayStationNativeSupportEnabled, _ => false, }; @@ -108,6 +112,9 @@ private static void AddCrashHandler(IDiagnosticLogger logger, BuildTarget target case BuildTarget.GameCoreXboxOne: // No standalone crash handler for Xbox - comes with Breakpad return; + case BuildTarget.PS5: + // No standalone crash handler for PlayStation + return; default: throw new ArgumentException($"Unsupported build target: {target}"); } @@ -158,6 +165,13 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar paths += $" \"{xboxSentryPluginPath}\""; } break; + case BuildTarget.PS5: + var playstationSentryPluginPath = Path.GetFullPath("Assets/Plugins/Sentry/"); + if (Directory.Exists(playstationSentryPluginPath)) + { + paths += $" \"{playstationSentryPluginPath}\""; + } + break; case BuildTarget.StandaloneLinux64: var linuxSentryDbg = Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Linux/Sentry/libsentry.dbg.so"); if (File.Exists(linuxSentryDbg)) diff --git a/src/Sentry.Unity.Native/SentryNative.cs b/src/Sentry.Unity.Native/SentryNative.cs index 9cf67a3d6..fb4c5aa59 100644 --- a/src/Sentry.Unity.Native/SentryNative.cs +++ b/src/Sentry.Unity.Native/SentryNative.cs @@ -124,7 +124,6 @@ private static void ReinstallBackend() switch (application.Platform) { case RuntimePlatform.Switch: - case RuntimePlatform.PS4: case RuntimePlatform.PS5: case RuntimePlatform.XboxOne: case RuntimePlatform.GameCoreXboxSeries: diff --git a/src/Sentry.Unity.Native/SentryNativeBridge.cs b/src/Sentry.Unity.Native/SentryNativeBridge.cs index b73f179b4..7d5aaaf1b 100644 --- a/src/Sentry.Unity.Native/SentryNativeBridge.cs +++ b/src/Sentry.Unity.Native/SentryNativeBridge.cs @@ -16,7 +16,10 @@ internal static class SentryNativeBridge { public static bool Init(SentryUnityOptions options) { - _isLinux = Application.platform is RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer; + _options = options; + _useLibC = Application.platform + is RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer + or RuntimePlatform.PS5; _isWindows = Application.platform is RuntimePlatform.WindowsPlayer or RuntimePlatform.WindowsServer; var cOptions = sentry_options_new(); @@ -149,8 +152,9 @@ internal static string GetCacheDirectory(SentryUnityOptions options) // The logger we should forward native messages to. This is referenced by nativeLog() which in turn for. private static IDiagnosticLogger? _logger; - private static bool _isLinux = false; + private static bool _useLibC = false; private static bool _isWindows = false; + private static SentryUnityOptions? _options; // This method is called from the C library and forwards incoming messages to the currently set _logger. [MonoPInvokeCallback(typeof(sentry_logger_function_t))] @@ -194,29 +198,30 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr try { // We cannot access C var-arg (va_list) in c# thus we pass it back to vsnprintf to do the formatting. - // For Linux, we must make a copy of the VaList to be able to pass it back... - if (_isLinux) + // For Linux and PlayStation, we must make a copy of the VaList to be able to pass it back... + if (_useLibC) { var argsStruct = Marshal.PtrToStructure(args); var formattedLength = 0; + WithMarshalledStruct(argsStruct, argsPtr => { - formattedLength = 1 + vsnprintf_linux(IntPtr.Zero, UIntPtr.Zero, format, argsPtr); + formattedLength = 1 + vsnprintf_sentry(IntPtr.Zero, UIntPtr.Zero, format, argsPtr); }); WithAllocatedPtr(formattedLength, buffer => WithMarshalledStruct(argsStruct, argsPtr => { - vsnprintf_linux(buffer, (UIntPtr)formattedLength, format, argsPtr); + vsnprintf_sentry(buffer, (UIntPtr)formattedLength, format, argsPtr); message = Marshal.PtrToStringAnsi(buffer); })); } else { - var formattedLength = 1 + vsnprintf_windows(IntPtr.Zero, UIntPtr.Zero, format, args); + var formattedLength = 1 + vsnprintf_sentry(IntPtr.Zero, UIntPtr.Zero, format, args); WithAllocatedPtr(formattedLength, buffer => { - vsnprintf_windows(buffer, (UIntPtr)formattedLength, format, args); + vsnprintf_sentry(buffer, (UIntPtr)formattedLength, format, args); message = Marshal.PtrToStringAnsi(buffer); }); } @@ -238,12 +243,30 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr } } + // For Mono (Windows/Linux): use platform's native C library directly [DllImport("msvcrt", EntryPoint = "vsnprintf")] private static extern int vsnprintf_windows(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args); [DllImport("libc", EntryPoint = "vsnprintf")] private static extern int vsnprintf_linux(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args); + // For IL2CPP: use __Internal which links to the compiled sentry_utils.c + [DllImport("__Internal")] + private static extern int vsnprintf_il2cpp(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args); + + private static int vsnprintf_sentry(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args) + { + if (_options?.UnityInfo.IL2CPP is true) + { + return vsnprintf_il2cpp(buffer, bufferSize, format, args); + } + + // Mono backend - use native platform libraries + return _isWindows + ? vsnprintf_windows(buffer, bufferSize, format, args) + : vsnprintf_linux(buffer, bufferSize, format, args); + } + // https://stackoverflow.com/a/4958507/2386130 [StructLayout(LayoutKind.Sequential, Pack = 4)] private struct VaListLinux64 diff --git a/src/Sentry.Unity/Il2CppEventProcessor.cs b/src/Sentry.Unity/Il2CppEventProcessor.cs index e7c4b83d5..279b0b846 100644 --- a/src/Sentry.Unity/Il2CppEventProcessor.cs +++ b/src/Sentry.Unity/Il2CppEventProcessor.cs @@ -362,7 +362,8 @@ or RuntimePlatform.LinuxServer or RuntimePlatform.WindowsPlayer or RuntimePlatform.WindowsServer or RuntimePlatform.GameCoreXboxSeries - or RuntimePlatform.GameCoreXboxOne; + or RuntimePlatform.GameCoreXboxOne + or RuntimePlatform.PS5; } private string GetPlatformDebugImageType(RuntimePlatform? platform = null) @@ -373,6 +374,7 @@ private string GetPlatformDebugImageType(RuntimePlatform? platform = null) case RuntimePlatform.Android: case RuntimePlatform.LinuxPlayer: case RuntimePlatform.LinuxServer: + case RuntimePlatform.PS5: return "elf"; case RuntimePlatform.IPhonePlayer: case RuntimePlatform.OSXPlayer: diff --git a/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs b/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs index 6f350b242..056396257 100644 --- a/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs +++ b/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs @@ -83,6 +83,10 @@ is RuntimePlatform.GameCoreXboxSeries { operatingSystemContext.Name = "Xbox"; } + else if (ApplicationAdapter.Instance.Platform is RuntimePlatform.PS5) + { + operatingSystemContext.Name = "PlayStation"; + } else { operatingSystemContext.RawDescription = MainThreadData.OperatingSystem; diff --git a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs index 07afe57fd..db58ecd9a 100644 --- a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs +++ b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs @@ -111,6 +111,7 @@ public static string GetConfigPath(string? notDefaultConfigName = null) [field: SerializeField] public bool MacosNativeSupportEnabled { get; set; } = true; [field: SerializeField] public bool LinuxNativeSupportEnabled { get; set; } = true; [field: SerializeField] public bool XboxNativeSupportEnabled { get; set; } = true; + [field: SerializeField] public bool PlayStationNativeSupportEnabled { get; set; } = true; [field: SerializeField] public bool Il2CppLineNumberSupportEnabled { get; set; } = true; [field: SerializeField] public SentryOptionsConfiguration? OptionsConfiguration { get; set; } @@ -191,6 +192,7 @@ internal SentryUnityOptions ToSentryUnityOptions( MacosNativeSupportEnabled = MacosNativeSupportEnabled, LinuxNativeSupportEnabled = LinuxNativeSupportEnabled, XboxNativeSupportEnabled = XboxNativeSupportEnabled, + PlayStationNativeSupportEnabled = PlayStationNativeSupportEnabled, Il2CppLineNumberSupportEnabled = Il2CppLineNumberSupportEnabled, PerformanceAutoInstrumentationEnabled = AutoAwakeTraces, EnableLogs = EnableStructuredLogging, diff --git a/src/Sentry.Unity/SentryUnityOptions.cs b/src/Sentry.Unity/SentryUnityOptions.cs index de96de324..d826b8be8 100644 --- a/src/Sentry.Unity/SentryUnityOptions.cs +++ b/src/Sentry.Unity/SentryUnityOptions.cs @@ -232,6 +232,11 @@ public sealed class SentryUnityOptions : SentryOptions /// public bool XboxNativeSupportEnabled { get; set; } = true; + /// + /// Whether the SDK should add native support for PlayStation + /// + public bool PlayStationNativeSupportEnabled { get; set; } = true; + /// /// Whether the SDK should add IL2CPP line number support /// @@ -365,8 +370,11 @@ internal SentryUnityOptions(IApplication? application = null, application ??= ApplicationAdapter.Instance; behaviour ??= SentryMonoBehaviour.Instance; - // IL2CPP doesn't support Process.GetCurrentProcess().StartupTime - DetectStartupTime = StartupTimeDetectionMode.Fast; + DetectStartupTime = application.Platform is RuntimePlatform.PS5 + // PlayStation doesn't support startup time + ? StartupTimeDetectionMode.None + // IL2CPP doesn't support Process.GetCurrentProcess().StartupTime + : StartupTimeDetectionMode.Fast; AddInAppExclude("UnityEngine"); AddInAppExclude("UnityEditor"); @@ -428,7 +436,8 @@ or RuntimePlatform.OSXPlayer or RuntimePlatform.OSXServer // Consoles: false RuntimePlatform.GameCoreXboxSeries or RuntimePlatform.GameCoreXboxOne - or RuntimePlatform.PS4 or RuntimePlatform.PS5 or RuntimePlatform.Switch => false, + or RuntimePlatform.PS5 + or RuntimePlatform.Switch => false, // Unknown platforms _ => false @@ -492,7 +501,8 @@ or RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer or RuntimePlatform.WebGLPlayer or RuntimePlatform.GameCoreXboxSeries - or RuntimePlatform.GameCoreXboxOne; + or RuntimePlatform.GameCoreXboxOne + or RuntimePlatform.PS5; } public override string ToString() diff --git a/src/Sentry.Unity/SentryUnityOptionsExtensions.cs b/src/Sentry.Unity/SentryUnityOptionsExtensions.cs index 666c124cb..48e75ef31 100644 --- a/src/Sentry.Unity/SentryUnityOptionsExtensions.cs +++ b/src/Sentry.Unity/SentryUnityOptionsExtensions.cs @@ -59,6 +59,7 @@ internal static bool IsNativeSupportEnabled(this SentryUnityOptions options, Run RuntimePlatform.OSXPlayer or RuntimePlatform.OSXServer => options.MacosNativeSupportEnabled, RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer => options.LinuxNativeSupportEnabled, RuntimePlatform.GameCoreXboxSeries or RuntimePlatform.GameCoreXboxOne => options.XboxNativeSupportEnabled, + RuntimePlatform.PS5 => options.PlayStationNativeSupportEnabled, _ => false }; } diff --git a/test/Scripts.Tests/package-release.zip.snapshot b/test/Scripts.Tests/package-release.zip.snapshot index 3cf060b7f..3087982b7 100644 --- a/test/Scripts.Tests/package-release.zip.snapshot +++ b/test/Scripts.Tests/package-release.zip.snapshot @@ -31,6 +31,8 @@ Plugins/Android.meta Plugins/iOS.meta Plugins/Linux.meta Plugins/macOS.meta +Plugins/sentry_utils.c +Plugins/sentry_utils.c.meta Plugins/Windows.meta Plugins/macOS/Sentry.meta Plugins/macOS/SentryNativeBridge.m diff --git a/test/Sentry.Unity.Tests/SentryUnityOptionsExtensionsTests.cs b/test/Sentry.Unity.Tests/SentryUnityOptionsExtensionsTests.cs index 3a896b357..8ba703b9b 100644 --- a/test/Sentry.Unity.Tests/SentryUnityOptionsExtensionsTests.cs +++ b/test/Sentry.Unity.Tests/SentryUnityOptionsExtensionsTests.cs @@ -1,6 +1,7 @@ using System.Linq; using NUnit.Framework; using Sentry.Unity.Tests.Stubs; +using UnityEngine; namespace Sentry.Unity.Tests; @@ -183,4 +184,27 @@ public void DisableUnhandledExceptionCapture_DoesNotRemoveUnityApplicationLoggin Assert.IsTrue(options.Integrations.Any(i => i is Integrations.UnityApplicationLoggingIntegration)); } + + [Test] + [TestCase(RuntimePlatform.PS5, true, true)] + [TestCase(RuntimePlatform.PS5, false, false)] + [TestCase(RuntimePlatform.GameCoreXboxSeries, true, true)] + [TestCase(RuntimePlatform.GameCoreXboxSeries, false, false)] + [TestCase(RuntimePlatform.GameCoreXboxOne, true, true)] + [TestCase(RuntimePlatform.GameCoreXboxOne, false, false)] + public void IsNativeSupportEnabled_ConsolePlatforms_ReturnsExpectedValue( + RuntimePlatform platform, bool optionEnabled, bool expectedResult) + { + var options = _fixture.GetSut(); + options.PlayStationNativeSupportEnabled = platform is RuntimePlatform.PS5 + ? optionEnabled + : options.PlayStationNativeSupportEnabled; + options.XboxNativeSupportEnabled = platform is RuntimePlatform.GameCoreXboxSeries or RuntimePlatform.GameCoreXboxOne + ? optionEnabled + : options.XboxNativeSupportEnabled; + + var result = options.IsNativeSupportEnabled(platform); + + Assert.AreEqual(expectedResult, result); + } } diff --git a/test/Sentry.Unity.Tests/SentryUnityOptionsTests.cs b/test/Sentry.Unity.Tests/SentryUnityOptionsTests.cs index f837ade73..63c976844 100644 --- a/test/Sentry.Unity.Tests/SentryUnityOptionsTests.cs +++ b/test/Sentry.Unity.Tests/SentryUnityOptionsTests.cs @@ -97,7 +97,6 @@ public void Ctor_Release_IgnoresDotOnlyProductNames() [TestCase(RuntimePlatform.IPhonePlayer, false)] [TestCase(RuntimePlatform.GameCoreXboxSeries, false)] [TestCase(RuntimePlatform.GameCoreXboxOne, false)] - [TestCase(RuntimePlatform.PS4, false)] [TestCase(RuntimePlatform.PS5, false)] [TestCase(RuntimePlatform.Switch, false)] [TestCase(RuntimePlatform.WindowsEditor, false)]