Permalink
Browse files

Unity Win32 callback fixes

  • Loading branch information...
1 parent d7808bf commit b7727a10e1720a4cabced24e4a091a3f7f903a16 @garrynewman garrynewman committed Feb 1, 2017
@@ -16,16 +16,29 @@ public static void ForUnity( string platform )
//
// Windows Config
//
- if ( platform == "WindowsEditor" || platform == "Windows" )
+ if ( platform == "WindowsEditor" || platform == "WindowsPlayer" )
{
//
// 32bit windows unity uses a stdcall
//
if ( IntPtr.Size == 4 ) UseThisCall = false;
- ForcePlatform( OperatingSystem.Windows, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
+ ForcePlatform( OperatingSystem.Windows, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
}
+ if ( platform == "OSXEditor" || platform == "OSXPlayer" || platform == "OSXDashboardPlayer" )
+ {
+ ForcePlatform( OperatingSystem.Osx, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
+ }
+
+ if ( platform == "LinuxPlayer" || platform == "LinuxEditor" )
+ {
+ ForcePlatform( OperatingSystem.Linux, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 );
+ }
+
+ Console.WriteLine( "Facepunch.Steamworks Unity: " + platform );
+ Console.WriteLine( "Facepunch.Steamworks Os: " + SteamNative.Platform.Os );
+ Console.WriteLine( "Facepunch.Steamworks Arch: " + SteamNative.Platform.Arch );
}
/// <summary>
@@ -30,9 +30,16 @@ public class VTable
//
internal class ThisCall
{
- [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void Result( IntPtr thisptr, IntPtr pvParam );
- [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfo( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
- [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSize( IntPtr thisptr );
+ [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void Result( IntPtr thisptr, IntPtr pvParam );
+ [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfo( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
+ [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSize( IntPtr thisptr );
+ }
+
+ internal class StdCall
+ {
+ [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void Result( IntPtr pvParam );
+ [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfo( IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
+ [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSize();
}
@@ -8,7 +8,7 @@ internal static partial class Platform
internal class Linux32 : Interface
{
internal IntPtr _ptr;
- public bool IsValid { get{ return _ptr != null; } }
+ public bool IsValid { get{ return _ptr != IntPtr.Zero; } }
//
// Constructor sets pointer to native class
@@ -8,7 +8,7 @@ internal static partial class Platform
internal class Linux64 : Interface
{
internal IntPtr _ptr;
- public bool IsValid { get{ return _ptr != null; } }
+ public bool IsValid { get{ return _ptr != IntPtr.Zero; } }
//
// Constructor sets pointer to native class
@@ -8,7 +8,7 @@ internal static partial class Platform
internal class Mac : Interface
{
internal IntPtr _ptr;
- public bool IsValid { get{ return _ptr != null; } }
+ public bool IsValid { get{ return _ptr != IntPtr.Zero; } }
//
// Constructor sets pointer to native class
@@ -8,7 +8,7 @@ internal static partial class Platform
internal class Win32 : Interface
{
internal IntPtr _ptr;
- public bool IsValid { get{ return _ptr != null; } }
+ public bool IsValid { get{ return _ptr != IntPtr.Zero; } }
//
// Constructor sets pointer to native class
@@ -8,7 +8,7 @@ internal static partial class Platform
internal class Win64 : Interface
{
internal IntPtr _ptr;
- public bool IsValid { get{ return _ptr != null; } }
+ public bool IsValid { get{ return _ptr != IntPtr.Zero; } }
//
// Constructor sets pointer to native class
Oops, something went wrong.

0 comments on commit b7727a1

Please sign in to comment.