diff --git a/Facepunch.Steamworks/Callbacks/Callback.VTable.cs b/Facepunch.Steamworks/Callbacks/Callback.VTable.cs index c3b5602..af56e10 100644 --- a/Facepunch.Steamworks/Callbacks/Callback.VTable.cs +++ b/Facepunch.Steamworks/Callbacks/Callback.VTable.cs @@ -7,35 +7,43 @@ namespace Steamworks { internal partial class Callback { - [StructLayout( LayoutKind.Sequential, Pack = 1 )] - public class VTable + internal static class VTable { - [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam ); - [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ); - [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD(); + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] + public delegate void Run( IntPtr thisptr, IntPtr pvParam ); - public ResultD ResultA; - public ResultWithInfoD ResultB; - public GetSizeD GetSize; + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] + public delegate void RunCall( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ); - internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List allocations ) + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] + public delegate int GetCallbackSizeBytes( IntPtr thisptr ); + + internal static IntPtr GetVTable( Run run, RunCall runInfo, GetCallbackSizeBytes size, List allocations ) { - var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + allocations.Add( GCHandle.Alloc( run ) ); + allocations.Add( GCHandle.Alloc( runInfo ) ); + allocations.Add( GCHandle.Alloc( size ) ); - var vTable = new Callback.VTable + var a = Marshal.GetFunctionPointerForDelegate( run ); + var b = Marshal.GetFunctionPointerForDelegate( runInfo ); + var c = Marshal.GetFunctionPointerForDelegate( size ); + + var vt = Marshal.AllocHGlobal( IntPtr.Size * 3 ); + + if ( Config.Os == OsType.Windows ) { - ResultA = onResultThis, - ResultB = onResultWithInfoThis, - GetSize = onGetSizeThis, - }; + Marshal.WriteIntPtr( vt, IntPtr.Size * 0, b ); + Marshal.WriteIntPtr( vt, IntPtr.Size * 1, a ); + Marshal.WriteIntPtr( vt, IntPtr.Size * 2, c ); + } + else + { + Marshal.WriteIntPtr( vt, IntPtr.Size * 0, a ); + Marshal.WriteIntPtr( vt, IntPtr.Size * 1, b ); + Marshal.WriteIntPtr( vt, IntPtr.Size * 2, c ); + } - allocations.Add( GCHandle.Alloc( vTable.ResultA ) ); - allocations.Add( GCHandle.Alloc( vTable.ResultB ) ); - allocations.Add( GCHandle.Alloc( vTable.GetSize ) ); - - Marshal.StructureToPtr( vTable, vTablePtr, false ); - - return vTablePtr; + return vt; } } }; diff --git a/Facepunch.Steamworks/Callbacks/Callback.VTableThis.cs b/Facepunch.Steamworks/Callbacks/Callback.VTableThis.cs deleted file mode 100644 index 87aadc1..0000000 --- a/Facepunch.Steamworks/Callbacks/Callback.VTableThis.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; -using Steamworks.Data; - -namespace Steamworks -{ - internal partial class Callback - { - [StructLayout( LayoutKind.Sequential, Pack = 1 )] - public class VTableThis - { - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam ); - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ); - - internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List allocations ) - { - var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); - - var vTable = new Callback.VTableThis - { - ResultA = onResultThis, - ResultB = onResultWithInfoThis, - GetSize = onGetSizeThis, - }; - - allocations.Add( GCHandle.Alloc( vTable.ResultA ) ); - allocations.Add( GCHandle.Alloc( vTable.ResultB ) ); - allocations.Add( GCHandle.Alloc( vTable.GetSize ) ); - - Marshal.StructureToPtr( vTable, vTablePtr, false ); - - return vTablePtr; - } - - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr ); - - public ResultD ResultA; - public ResultWithInfoD ResultB; - public GetSizeD GetSize; - } - }; -} diff --git a/Facepunch.Steamworks/Callbacks/Callback.VTableWin.cs b/Facepunch.Steamworks/Callbacks/Callback.VTableWin.cs deleted file mode 100644 index eef0365..0000000 --- a/Facepunch.Steamworks/Callbacks/Callback.VTableWin.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; -using Steamworks.Data; - -namespace Steamworks -{ - internal partial class Callback - { - [StructLayout( LayoutKind.Sequential, Pack = 1 )] - public class VTableWin - { - [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam ); - [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ); - [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD(); - - public ResultWithInfoD ResultB; - public ResultD ResultA; - public GetSizeD GetSize; - - internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List allocations ) - { - var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); - - var vTable = new Callback.VTableWin - { - ResultA = onResultThis, - ResultB = onResultWithInfoThis, - GetSize = onGetSizeThis, - }; - - allocations.Add( GCHandle.Alloc( vTable.ResultA ) ); - allocations.Add( GCHandle.Alloc( vTable.ResultB ) ); - allocations.Add( GCHandle.Alloc( vTable.GetSize ) ); - - Marshal.StructureToPtr( vTable, vTablePtr, false ); - - return vTablePtr; - } - } - }; -} diff --git a/Facepunch.Steamworks/Callbacks/Callback.VTableWinThis.cs b/Facepunch.Steamworks/Callbacks/Callback.VTableWinThis.cs deleted file mode 100644 index ec839cb..0000000 --- a/Facepunch.Steamworks/Callbacks/Callback.VTableWinThis.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; -using Steamworks.Data; - -namespace Steamworks -{ - internal partial class Callback - { - [StructLayout( LayoutKind.Sequential, Pack = 1 )] - public class VTableWinThis - { - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam ); - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ); - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr ); - - public ResultWithInfoD ResultB; - public ResultD ResultA; - public GetSizeD GetSize; - - internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List allocations ) - { - var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); - - var vTable = new Callback.VTableWinThis - { - ResultA = onResultThis, - ResultB = onResultWithInfoThis, - GetSize = onGetSizeThis, - }; - - allocations.Add( GCHandle.Alloc( vTable.ResultA ) ); - allocations.Add( GCHandle.Alloc( vTable.ResultB ) ); - allocations.Add( GCHandle.Alloc( vTable.GetSize ) ); - - Marshal.StructureToPtr( vTable, vTablePtr, false ); - - return vTablePtr; - } - } - }; -} diff --git a/Facepunch.Steamworks/Callbacks/Events.cs b/Facepunch.Steamworks/Callbacks/Events.cs index 1099a58..ebd7fc4 100644 --- a/Facepunch.Steamworks/Callbacks/Events.cs +++ b/Facepunch.Steamworks/Callbacks/Events.cs @@ -36,9 +36,10 @@ namespace Steamworks // // Created on registration of a callback // - internal class Event : IDisposable where T : struct, Steamworks.ISteamCallback + internal class Event : IDisposable { - public Action Action; + Steamworks.ISteamCallback template; + public Action Action; bool IsAllocated; List Allocations = new List(); @@ -79,86 +80,60 @@ namespace Steamworks public virtual bool IsValid { get { return true; } } - T template; - - internal Event( Action onresult, bool gameserver = false ) + internal static Event CreateEvent( Action onresult, bool gameserver = false ) where T: struct, Steamworks.ISteamCallback { - Action = onresult; + var r = new Event(); - template = new T(); + r.Action = ( x ) => onresult( (T) x ); - // - // Create the functions we need for the vtable - // - if ( Config.UseThisCall ) - { - // - // Create the VTable by manually allocating the memory and copying across - // - if ( Config.Os == OsType.Windows ) - { - vTablePtr = Callback.VTableWinThis.GetVTable( OnResultThis, OnResultWithInfoThis, OnGetSizeThis, Allocations ); - } - else - { - vTablePtr = Callback.VTableThis.GetVTable( OnResultThis, OnResultWithInfoThis, OnGetSizeThis, Allocations ); - } - } - else - { - // - // Create the VTable by manually allocating the memory and copying across - // - if ( Config.Os == OsType.Windows ) - { - vTablePtr = Callback.VTableWin.GetVTable( OnResult, OnResultWithInfo, OnGetSize, Allocations ); - } - else - { - vTablePtr = Callback.VTable.GetVTable( OnResult, OnResultWithInfo, OnGetSize, Allocations ); - } - } + r.template = new T(); + r.vTablePtr = Callback.VTable.GetVTable( r.OnResult, RunStub, SizeStub, r.Allocations ); // // Create the callback object // var cb = new Callback(); - cb.vTablePtr = vTablePtr; + cb.vTablePtr = r.vTablePtr; cb.CallbackFlags = gameserver ? (byte)0x02 : (byte)0; - cb.CallbackId = template.GetCallbackId(); + cb.CallbackId = r.template.GetCallbackId(); // // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native // - PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + r.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); // // Register the callback with Steam // - SteamClient.RegisterCallback( PinnedCallback.AddrOfPinnedObject(), cb.CallbackId ); + SteamClient.RegisterCallback( r.PinnedCallback.AddrOfPinnedObject(), cb.CallbackId ); - IsAllocated = true; + r.IsAllocated = true; if ( gameserver ) - Events.AllServer.Add( this ); + Events.AllServer.Add( r ); else - Events.AllClient.Add( this ); + Events.AllClient.Add( r ); + + return r; } - [MonoPInvokeCallback] internal void OnResultThis( IntPtr self, IntPtr param ) => OnResult( param ); - [MonoPInvokeCallback] internal void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamAPICall_t call ) => OnResultWithInfo( param, failure, call ); - [MonoPInvokeCallback] internal int OnGetSizeThis( IntPtr self ) => OnGetSize(); - [MonoPInvokeCallback] internal int OnGetSize() => template.GetStructSize(); - [MonoPInvokeCallback] internal void OnResult( IntPtr param ) => OnResultWithInfo( param, false, 0 ); + [MonoPInvokeCallback] + internal void OnResult( IntPtr self, IntPtr param ) + { + var value = template.Fill( param ); + Action( value ); + } [MonoPInvokeCallback] - internal void OnResultWithInfo( IntPtr param, bool failure, SteamAPICall_t call ) + static void RunStub( IntPtr self, IntPtr param, bool failure, SteamAPICall_t call ) { - if ( failure ) return; + throw new System.Exception( "Something changed in the Steam API and now CCallbackBack is calling the CallResult function [Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall )]" ); + } - var value = (T)template.Fill( param ); - - Action( value ); + [MonoPInvokeCallback] + static int SizeStub( IntPtr self ) + { + throw new System.Exception( "Something changed in the Steam API and now CCallbackBack is calling the GetSize function [GetCallbackSizeBytes()]" ); } } } \ No newline at end of file diff --git a/Facepunch.Steamworks/Config.cs b/Facepunch.Steamworks/Config.cs index 4b0dc7d..203a473 100644 --- a/Facepunch.Steamworks/Config.cs +++ b/Facepunch.Steamworks/Config.cs @@ -38,17 +38,6 @@ namespace Steamworks } public static bool PackSmall => Os != OsType.Windows; - - /// - /// Some platforms allow/need CallingConvention.ThisCall. If you're crashing with argument null - /// errors on certain platforms, try flipping this to true. - /// - /// I owe this logic to Riley Labrecque's hard work on Steamworks.net - I don't have the knowledge - /// or patience to find this shit on my own, so massive thanks to him. And also massive thanks to him - /// for releasing his shit open source under the MIT license so we can all learn and iterate. - /// - /// - public static bool UseThisCall { get; set; } = true; } public enum OsType diff --git a/Facepunch.Steamworks/SteamApps.cs b/Facepunch.Steamworks/SteamApps.cs index acb9cce..fdb95e4 100644 --- a/Facepunch.Steamworks/SteamApps.cs +++ b/Facepunch.Steamworks/SteamApps.cs @@ -32,8 +32,8 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnDlcInstalled?.Invoke( x.AppID ) ); - new Event( x => OnNewLaunchParameters?.Invoke() ); + Event.CreateEvent( x => OnDlcInstalled?.Invoke( x.AppID ) ); + Event.CreateEvent( x => OnNewLaunchParameters?.Invoke() ); } /// diff --git a/Facepunch.Steamworks/SteamFriends.cs b/Facepunch.Steamworks/SteamFriends.cs index 42fc926..dd38f2e 100644 --- a/Facepunch.Steamworks/SteamFriends.cs +++ b/Facepunch.Steamworks/SteamFriends.cs @@ -36,13 +36,13 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnPersonaStateChange?.Invoke( new Friend( x.SteamID ) ) ); - new Event( x => OnGameRichPresenceJoinRequested?.Invoke( new Friend( x.SteamIDFriend), x.Connect ) ); - new Event( OnFriendChatMessage ); - new Event( x => OnGameOverlayActivated?.Invoke() ); - new Event( x => OnGameServerChangeRequested?.Invoke( x.Server, x.Password ) ); - new Event( x => OnGameLobbyJoinRequested?.Invoke( x.SteamIDLobby, x.SteamIDFriend ) ); - new Event( x => OnFriendRichPresenceUpdate?.Invoke( new Friend( x.SteamIDFriend ) ) ); + Event.CreateEvent( x => OnPersonaStateChange?.Invoke( new Friend( x.SteamID ) ) ); + Event.CreateEvent( x => OnGameRichPresenceJoinRequested?.Invoke( new Friend( x.SteamIDFriend), x.Connect ) ); + Event.CreateEvent( OnFriendChatMessage ); + Event.CreateEvent( x => OnGameOverlayActivated?.Invoke() ); + Event.CreateEvent( x => OnGameServerChangeRequested?.Invoke( x.Server, x.Password ) ); + Event.CreateEvent( x => OnGameLobbyJoinRequested?.Invoke( x.SteamIDLobby, x.SteamIDFriend ) ); + Event.CreateEvent( x => OnFriendRichPresenceUpdate?.Invoke( new Friend( x.SteamIDFriend ) ) ); } /// diff --git a/Facepunch.Steamworks/SteamInventory.cs b/Facepunch.Steamworks/SteamInventory.cs index a4582fc..ef6fb8a 100644 --- a/Facepunch.Steamworks/SteamInventory.cs +++ b/Facepunch.Steamworks/SteamInventory.cs @@ -32,11 +32,11 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnInventoryUpdated?.Invoke() ); - new Event( x => DefinitionsUpdated() ); + Event.CreateEvent( x => OnInventoryUpdated?.Invoke( x.Handle ) ); + Event.CreateEvent( x => DefinitionsUpdated() ); } - public static event Action OnInventoryUpdated; + public static event Action OnInventoryUpdated; public static event Action OnDefinitionsUpdated; internal static int defUpdateCount = 0; diff --git a/Facepunch.Steamworks/SteamMusic.cs b/Facepunch.Steamworks/SteamMusic.cs index 11b835c..1ac1ada 100644 --- a/Facepunch.Steamworks/SteamMusic.cs +++ b/Facepunch.Steamworks/SteamMusic.cs @@ -30,8 +30,8 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnPlaybackChanged?.Invoke() ); - new Event( x => OnVolumeChanged?.Invoke( x.NewVolume ) ); + Event.CreateEvent( x => OnPlaybackChanged?.Invoke() ); + Event.CreateEvent( x => OnVolumeChanged?.Invoke( x.NewVolume ) ); } /// diff --git a/Facepunch.Steamworks/SteamParental.cs b/Facepunch.Steamworks/SteamParental.cs index 10145bd..3ee3dbd 100644 --- a/Facepunch.Steamworks/SteamParental.cs +++ b/Facepunch.Steamworks/SteamParental.cs @@ -30,7 +30,7 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnSettingsChanged?.Invoke() ); + Event.CreateEvent( x => OnSettingsChanged?.Invoke() ); } /// diff --git a/Facepunch.Steamworks/SteamScreenshots.cs b/Facepunch.Steamworks/SteamScreenshots.cs index 972baa6..394c100 100644 --- a/Facepunch.Steamworks/SteamScreenshots.cs +++ b/Facepunch.Steamworks/SteamScreenshots.cs @@ -30,8 +30,8 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnScreenshotRequested?.Invoke() ); - new Event( x => + Event.CreateEvent( x => OnScreenshotRequested?.Invoke() ); + Event.CreateEvent( x => { if ( x.Result != Result.OK ) OnScreenshotFailed?.Invoke( x.Result ); diff --git a/Facepunch.Steamworks/SteamServer.cs b/Facepunch.Steamworks/SteamServer.cs index 6a1fd49..e2ffec7 100644 --- a/Facepunch.Steamworks/SteamServer.cs +++ b/Facepunch.Steamworks/SteamServer.cs @@ -30,7 +30,7 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true ); + Event.CreateEvent( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true ); SteamServerInventory.InstallEvents(); } diff --git a/Facepunch.Steamworks/SteamServerInventory.cs b/Facepunch.Steamworks/SteamServerInventory.cs index d4f3420..ebd2d49 100644 --- a/Facepunch.Steamworks/SteamServerInventory.cs +++ b/Facepunch.Steamworks/SteamServerInventory.cs @@ -29,7 +29,7 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => DefinitionsUpdated(), true ); + Event.CreateEvent( x => DefinitionsUpdated(), true ); } public static event Action OnDefinitionsUpdated; diff --git a/Facepunch.Steamworks/SteamUser.cs b/Facepunch.Steamworks/SteamUser.cs index 02ddd75..62e6f74 100644 --- a/Facepunch.Steamworks/SteamUser.cs +++ b/Facepunch.Steamworks/SteamUser.cs @@ -40,14 +40,14 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnSteamServersConnected?.Invoke() ); - new Event( x => OnSteamServerConnectFailure?.Invoke() ); - new Event( x => OnSteamServersDisconnected?.Invoke() ); - new Event( x => OnClientGameServerDeny?.Invoke() ); - new Event( x => OnLicensesUpdated?.Invoke() ); - new Event( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ) ); - new Event( x => OnMicroTxnAuthorizationResponse?.Invoke( x.AppID, x.OrderID, x.Authorized != 0 ) ); - new Event( x => OnGameWebCallback?.Invoke( x.URL ) ); + Event.CreateEvent( x => OnSteamServersConnected?.Invoke() ); + Event.CreateEvent( x => OnSteamServerConnectFailure?.Invoke() ); + Event.CreateEvent( x => OnSteamServersDisconnected?.Invoke() ); + Event.CreateEvent( x => OnClientGameServerDeny?.Invoke() ); + Event.CreateEvent( x => OnLicensesUpdated?.Invoke() ); + Event.CreateEvent( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ) ); + Event.CreateEvent( x => OnMicroTxnAuthorizationResponse?.Invoke( x.AppID, x.OrderID, x.Authorized != 0 ) ); + Event.CreateEvent( x => OnGameWebCallback?.Invoke( x.URL ) ); } /// diff --git a/Facepunch.Steamworks/SteamUserStats.cs b/Facepunch.Steamworks/SteamUserStats.cs index 43fdfe2..505986b 100644 --- a/Facepunch.Steamworks/SteamUserStats.cs +++ b/Facepunch.Steamworks/SteamUserStats.cs @@ -32,7 +32,7 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => + Event.CreateEvent( x => { if ( x.SteamIDUser == SteamClient.SteamId ) StatsRecieved = true; @@ -40,9 +40,9 @@ namespace Steamworks OnUserStatsReceived?.Invoke( x.SteamIDUser, x.Result ); } ); - new Event( x => OnUserStatsStored?.Invoke( x.Result ) ); - new Event( x => OnAchievementProgress?.Invoke( x.AchievementName, (int) x.CurProgress, (int)x.MaxProgress ) ); - new Event( x => OnUserStatsUnloaded?.Invoke( x.SteamIDUser ) ); + Event.CreateEvent( x => OnUserStatsStored?.Invoke( x.Result ) ); + Event.CreateEvent( x => OnAchievementProgress?.Invoke( x.AchievementName, (int) x.CurProgress, (int)x.MaxProgress ) ); + Event.CreateEvent( x => OnUserStatsUnloaded?.Invoke( x.SteamIDUser ) ); } /// diff --git a/Facepunch.Steamworks/SteamUtils.cs b/Facepunch.Steamworks/SteamUtils.cs index c14940d..3b591fc 100644 --- a/Facepunch.Steamworks/SteamUtils.cs +++ b/Facepunch.Steamworks/SteamUtils.cs @@ -31,10 +31,10 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnIpCountryChanged?.Invoke() ); - new Event( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ) ); - new Event( x => OnSteamShutdown?.Invoke() ); - new Event( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ) ); + Event.CreateEvent( x => OnIpCountryChanged?.Invoke() ); + Event.CreateEvent( x => OnLowBatteryPower?.Invoke( x.MinutesBatteryLeft ) ); + Event.CreateEvent( x => OnSteamShutdown?.Invoke() ); + Event.CreateEvent( x => OnGamepadTextInputDismissed?.Invoke( x.Submitted ) ); } /// @@ -166,7 +166,7 @@ namespace Steamworks /// Asynchronous call to check if an executable file has been signed using the public key set on the signing tab /// of the partner site, for example to refuse to load modified executable files. /// - public static async Task CheckFileSignature( string filename ) + public static async Task CheckFileSignatureAsync( string filename ) { var r = await Internal.CheckFileSignature( filename ); diff --git a/Facepunch.Steamworks/SteamVideo.cs b/Facepunch.Steamworks/SteamVideo.cs index b183a26..05cce60 100644 --- a/Facepunch.Steamworks/SteamVideo.cs +++ b/Facepunch.Steamworks/SteamVideo.cs @@ -31,8 +31,8 @@ namespace Steamworks internal static void InstallEvents() { - new Event( x => OnBroadcastStarted?.Invoke() ); - new Event( x => OnBroadcastStopped?.Invoke( x.Result ) ); + Event.CreateEvent( x => OnBroadcastStarted?.Invoke() ); + Event.CreateEvent( x => OnBroadcastStopped?.Invoke( x.Result ) ); } public static event Action OnBroadcastStarted;