Added Config.ForcePlatform

This commit is contained in:
Garry Newman 2016-10-26 15:28:33 +01:00
parent 79bc9ffe24
commit 9756d15468
2 changed files with 37 additions and 15 deletions

View File

@ -18,5 +18,17 @@ namespace Facepunch.Steamworks
/// </summary> /// </summary>
public static bool UseThisCall { get; set; } = true; public static bool UseThisCall { get; set; } = true;
/// <summary>
/// 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
/// </summary>
public static void ForcePlatform( SteamNative.OperatingSystem os, SteamNative.Architecture arch )
{
SteamNative.Platform.Os = os;
SteamNative.Platform.Arch = arch;
}
} }
} }

View File

@ -3,9 +3,7 @@ using System.Runtime.InteropServices;
namespace SteamNative namespace SteamNative
{ {
internal static partial class Platform public enum OperatingSystem
{
internal enum OperatingSystem
{ {
Unset, Unset,
Windows, Windows,
@ -13,13 +11,15 @@ namespace SteamNative
Osx, Osx,
} }
internal enum Architecture public enum Architecture
{ {
Unset, Unset,
x86, x86,
x64 x64
} }
internal static partial class Platform
{
private static OperatingSystem _os; private static OperatingSystem _os;
private static Architecture _arch; private static Architecture _arch;
@ -49,6 +49,11 @@ namespace SteamNative
return _os; return _os;
} }
set
{
_os = value;
}
} }
internal static Architecture Arch internal static Architecture Arch
@ -70,6 +75,11 @@ namespace SteamNative
return _arch; return _arch;
} }
set
{
_arch = value;
}
} }
public static bool IsWindows64 { get { return Arch == Architecture.x64 && Os == OperatingSystem.Windows; } } public static bool IsWindows64 { get { return Arch == Architecture.x64 && Os == OperatingSystem.Windows; } }