From 9756d154687cdb2e17eb3bc9e2811787d73cc414 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 26 Oct 2016 15:28:33 +0100 Subject: [PATCH] Added Config.ForcePlatform --- Facepunch.Steamworks/Config.cs | 12 ++++++ .../SteamNative/SteamNative.Platform.cs | 40 ++++++++++++------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Facepunch.Steamworks/Config.cs b/Facepunch.Steamworks/Config.cs index 0ae3964..e9bbfdc 100644 --- a/Facepunch.Steamworks/Config.cs +++ b/Facepunch.Steamworks/Config.cs @@ -18,5 +18,17 @@ namespace Facepunch.Steamworks /// public static bool UseThisCall { get; set; } = true; + + /// + /// You can force the platform to a particular one here. + /// This is useful if you're on OSX because some versions of mono don't have a way + /// to tell which platform we're running + /// + public static void ForcePlatform( SteamNative.OperatingSystem os, SteamNative.Architecture arch ) + { + SteamNative.Platform.Os = os; + SteamNative.Platform.Arch = arch; + } + } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.cs index c3695d0..91709e3 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.cs @@ -3,23 +3,23 @@ using System.Runtime.InteropServices; namespace SteamNative { + public enum OperatingSystem + { + Unset, + Windows, + Linux, + Osx, + } + + public enum Architecture + { + Unset, + x86, + x64 + } + internal static partial class Platform { - internal enum OperatingSystem - { - Unset, - Windows, - Linux, - Osx, - } - - internal enum Architecture - { - Unset, - x86, - x64 - } - private static OperatingSystem _os; private static Architecture _arch; @@ -49,6 +49,11 @@ namespace SteamNative return _os; } + + set + { + _os = value; + } } internal static Architecture Arch @@ -70,6 +75,11 @@ namespace SteamNative return _arch; } + + set + { + _arch = value; + } } public static bool IsWindows64 { get { return Arch == Architecture.x64 && Os == OperatingSystem.Windows; } }