diff --git a/Facepunch.Steamworks.Test/Client/AppTest.cs b/Facepunch.Steamworks.Test/Client/AppTest.cs index f24f6a4..fb3e71f 100644 --- a/Facepunch.Steamworks.Test/Client/AppTest.cs +++ b/Facepunch.Steamworks.Test/Client/AppTest.cs @@ -51,5 +51,15 @@ public void PurchaseTime() } } + [TestMethod] + public void AppName() + { + using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) + { + var name = client.App.GetName( 4000 ); + Console.WriteLine( name ); + } + } + } } diff --git a/Facepunch.Steamworks.Test/Client/FriendsTest.cs b/Facepunch.Steamworks.Test/Client/FriendsTest.cs index d8fc65a..bcaf8a4 100644 --- a/Facepunch.Steamworks.Test/Client/FriendsTest.cs +++ b/Facepunch.Steamworks.Test/Client/FriendsTest.cs @@ -50,16 +50,23 @@ public void Avatar() { Assert.IsTrue( client.IsValid ); - var friend = client.Friends.All.First(); + ulong id = (ulong)( 76561197960279927 + (new Random().Next() % 10000)); bool passed = false; - client.Friends.GetAvatar( Steamworks.Friends.AvatarSize.Medium, friend.Id, (avatar) => + client.Friends.GetAvatar( Steamworks.Friends.AvatarSize.Medium, id, ( avatar) => { - Assert.AreEqual(avatar.Width, 64); - Assert.AreEqual(avatar.Height, 64); - Assert.AreEqual(avatar.Data.Length, avatar.Width * avatar.Height * 4); + if ( avatar == null ) + { + Console.WriteLine( "No Avatar" ); + } + else + { + Assert.AreEqual( avatar.Width, 64 ); + Assert.AreEqual( avatar.Height, 64 ); + Assert.AreEqual( avatar.Data.Length, avatar.Width * avatar.Height * 4 ); - DrawImage(avatar); + DrawImage( avatar ); + } passed = true; }); @@ -105,6 +112,7 @@ public static void DrawImage( Image img ) var brightness = 1 - ((float)(p.r + p.g + p.b) / (255.0f * 3.0f)); var c = (int) ((grad.Length) * brightness); + if ( c > 3 ) c = 3; str += grad[c]; } diff --git a/Facepunch.Steamworks.Test/Client/InventoryTest.cs b/Facepunch.Steamworks.Test/Client/InventoryTest.cs index 1bcdb8d..837b1b8 100644 --- a/Facepunch.Steamworks.Test/Client/InventoryTest.cs +++ b/Facepunch.Steamworks.Test/Client/InventoryTest.cs @@ -15,6 +15,12 @@ public void InventoryDefinitions() { using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + Assert.IsNotNull( client.Inventory.Definitions ); Assert.AreNotEqual( 0, client.Inventory.Definitions.Length ); @@ -36,6 +42,12 @@ public void InventoryDefinitionExchange() { using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + Assert.IsNotNull( client.Inventory.Definitions ); Assert.AreNotEqual( 0, client.Inventory.Definitions.Length ); @@ -58,6 +70,12 @@ public void InventoryDefinitionIngredients() { using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + Assert.IsNotNull( client.Inventory.Definitions ); Assert.AreNotEqual( 0, client.Inventory.Definitions.Length ); @@ -80,6 +98,12 @@ public void InventoryItemList() { using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + bool CallbackCalled = false; // OnUpdate hsould be called when we receive a list of our items @@ -146,6 +170,12 @@ public void Deserialize() { using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + Assert.IsTrue( client.IsValid ); Assert.IsNotNull(client.Inventory.Definitions); Assert.AreNotEqual(0, client.Inventory.Definitions.Length); @@ -202,6 +232,12 @@ public void PurchaseItems() { using (var client = new Facepunch.Steamworks.Client(252490)) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + Assert.IsNotNull(client.Inventory.Definitions); Assert.AreNotEqual(0, client.Inventory.Definitions.Length); @@ -235,6 +271,12 @@ public void ListPrices() { using (var client = new Facepunch.Steamworks.Client(252490)) { + while ( client.Inventory.Definitions == null ) + { + client.Update(); + System.Threading.Thread.Sleep( 10 ); + } + Assert.IsNotNull(client.Inventory.Definitions); Assert.AreNotEqual(0, client.Inventory.Definitions.Length); diff --git a/Facepunch.Steamworks.Test/Client/LeaderboardTest.cs b/Facepunch.Steamworks.Test/Client/LeaderboardTest.cs index cc1986a..3628d11 100644 --- a/Facepunch.Steamworks.Test/Client/LeaderboardTest.cs +++ b/Facepunch.Steamworks.Test/Client/LeaderboardTest.cs @@ -171,6 +171,11 @@ public void AddScoresCallback() Thread.Sleep(10); client.Update(); + if ( board.IsError ) + { + throw new Exception( "Board is Error" ); + } + if (time.Elapsed.TotalSeconds > 10) { throw new Exception("board.IsValid took too long"); diff --git a/Facepunch.Steamworks.Test/Client/ServerlistTest.cs b/Facepunch.Steamworks.Test/Client/ServerlistTest.cs index bba5e01..c96c19c 100644 --- a/Facepunch.Steamworks.Test/Client/ServerlistTest.cs +++ b/Facepunch.Steamworks.Test/Client/ServerlistTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -12,6 +13,23 @@ namespace Facepunch.Steamworks.Test [DeploymentItem( "steam_api64.dll" )] public partial class ServerList { + [TestMethod] + public void IpAddressConversions() + { + var ipstr = "185.38.150.40"; + var ip = IPAddress.Parse( ipstr ); + + var ip_int = Facepunch.Steamworks.Utility.IpToInt32( ip ); + + var ip_back = Facepunch.Steamworks.Utility.Int32ToIp( ip_int ); + + Console.WriteLine( "ipstr: " + ipstr ); + Console.WriteLine( "ip: " + ip ); + Console.WriteLine( "ip int: " + ip_int ); + Console.WriteLine( "ip_back: " + ip_back ); + } + + [TestMethod] public void InternetList() { @@ -27,7 +45,7 @@ public void InternetList() for ( int i = 0; i < 1000; i++ ) { client.Update(); - System.Threading.Thread.Sleep( 5 ); + System.Threading.Thread.Sleep( 100 ); foreach ( var s in query.Responded ) { @@ -388,9 +406,10 @@ public void Rules() filter.Add( "gamedir", "rust" ); filter.Add( "secure", "1" ); + filter.Add( "addr", "185.97.254.146" ); + using ( var query = client.ServerList.Internet( filter ) ) { - for ( int i = 0; i < 1000; i++ ) { GC.Collect(); @@ -398,8 +417,8 @@ public void Rules() GC.Collect(); System.Threading.Thread.Sleep( 10 ); - if ( query.Responded.Count > 20 ) - break; + // if ( query.Responded.Count > 20 ) + // break; if ( query.Finished ) break; @@ -407,20 +426,18 @@ public void Rules() query.Dispose(); - foreach ( var server in query.Responded.Take( 20 ) ) + var servers = query.Responded.Take( 100 ); + + foreach ( var server in servers ) { - GC.Collect(); server.FetchRules(); - GC.Collect(); int i = 0; while ( !server.HasRules ) { i++; - GC.Collect(); client.Update(); - GC.Collect(); - System.Threading.Thread.Sleep( 2 ); + System.Threading.Thread.Sleep( 10 ); if ( i > 100 ) break; @@ -428,11 +445,20 @@ public void Rules() if ( server.HasRules ) { + Console.WriteLine( "" ); + Console.WriteLine( "" ); + Console.WriteLine( server.Address ); + Console.WriteLine( "" ); + foreach ( var rule in server.Rules ) { Console.WriteLine( rule.Key + " = " + rule.Value ); } } + else + { + Console.WriteLine( "SERVER HAS NO RULES :(" ); + } } diff --git a/Facepunch.Steamworks/BaseSteamworks.cs b/Facepunch.Steamworks/BaseSteamworks.cs index 9b6db62..e32744c 100644 --- a/Facepunch.Steamworks/BaseSteamworks.cs +++ b/Facepunch.Steamworks/BaseSteamworks.cs @@ -25,6 +25,8 @@ public class BaseSteamworks : IDisposable internal Interop.NativeInterface native; private List CallbackHandles = new List(); + private List CallResults = new List(); + protected bool disposed = false; protected BaseSteamworks( uint appId ) @@ -38,14 +40,29 @@ protected BaseSteamworks( uint appId ) System.Environment.SetEnvironmentVariable("SteamGameId", AppId.ToString()); } + ~BaseSteamworks() + { + Dispose(); + } + public virtual void Dispose() { + if ( disposed ) return; + + Callbacks.Clear(); + foreach ( var h in CallbackHandles ) { h.Dispose(); } CallbackHandles.Clear(); + foreach ( var h in CallResults ) + { + h.Dispose(); + } + CallResults.Clear(); + if ( Workshop != null ) { Workshop.Dispose(); @@ -72,6 +89,7 @@ public virtual void Dispose() System.Environment.SetEnvironmentVariable("SteamAppId", null ); System.Environment.SetEnvironmentVariable("SteamGameId", null ); + disposed = true; } protected void SetupCommonInterfaces() @@ -98,10 +116,18 @@ internal void RegisterCallbackHandle( SteamNative.CallbackHandle handle ) CallbackHandles.Add( handle ); } + internal void RegisterCallResult( SteamNative.CallResult handle ) + { + CallResults.Add( handle ); + } + + internal void UnregisterCallResult( SteamNative.CallResult handle ) + { + CallResults.Remove( handle ); + } + public virtual void Update() { - Inventory.Update(); - Networking.Update(); RunUpdateCallbacks(); @@ -114,6 +140,18 @@ public void RunUpdateCallbacks() { if ( OnUpdate != null ) OnUpdate(); + + for( int i=0; i < CallResults.Count; i++ ) + { + CallResults[i].Try(); + } + + // + // The SourceServerQuery's happen in another thread, so we + // query them to see if they're finished, and if so post a callback + // in our main thread. This will all suck less once we have async. + // + Facepunch.Steamworks.SourceServerQuery.Cycle(); } /// @@ -135,5 +173,47 @@ public void UpdateWhile( Func func ) #endif } } + + /// + /// Debug function, called for every callback. Only really used to confirm that callbacks are working properly. + /// + public Action OnAnyCallback; + + Dictionary>> Callbacks = new Dictionary>>(); + + internal List> CallbackList( Type T ) + { + List> list = null; + + if ( !Callbacks.TryGetValue( T, out list ) ) + { + list = new List>(); + Callbacks[T] = list; + } + + return list; + } + + internal void OnCallback( T data ) + { + var list = CallbackList( typeof( T ) ); + + foreach ( var i in list ) + { + i( data ); + } + + if ( OnAnyCallback != null ) + { + OnAnyCallback.Invoke( data ); + } + } + + internal void RegisterCallback( Action func ) + { + var list = CallbackList( typeof( T ) ); + list.Add( ( o ) => func( (T) o ) ); + } + } } \ No newline at end of file diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index af65c20..677dfaa 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -84,6 +84,12 @@ public Client( uint appId ) : base( appId ) return; } + // + // Register Callbacks + // + + SteamNative.Callbacks.RegisterCallbacks( this ); + // // Setup interfaces that client and server both have // @@ -115,20 +121,25 @@ public Client( uint appId ) : base( appId ) BetaName = native.apps.GetCurrentBetaName(); OwnerSteamId = native.apps.GetAppOwner(); var appInstallDir = native.apps.GetAppInstallDir(AppId); + if (!String.IsNullOrEmpty(appInstallDir) && Directory.Exists(appInstallDir)) InstallFolder = new DirectoryInfo(appInstallDir); + BuildId = native.apps.GetAppBuildId(); CurrentLanguage = native.apps.GetCurrentGameLanguage(); AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated - - // // Run update, first call does some initialization // Update(); } + ~Client() + { + Dispose(); + } + /// /// Should be called at least once every frame /// @@ -139,6 +150,7 @@ public override void Update() RunCallbacks(); Voice.Update(); + Friends.Cycle(); base.Update(); } @@ -156,6 +168,8 @@ public void RunCallbacks() /// public override void Dispose() { + if ( disposed ) return; + if ( Voice != null ) { Voice = null; diff --git a/Facepunch.Steamworks/Client/Achievements.cs b/Facepunch.Steamworks/Client/Achievements.cs index ba152cf..40abfc5 100644 --- a/Facepunch.Steamworks/Client/Achievements.cs +++ b/Facepunch.Steamworks/Client/Achievements.cs @@ -22,8 +22,8 @@ internal Achievements( Client c ) client = c; All = new Achievement[0]; - SteamNative.UserStatsReceived_t.RegisterCallback( c, UserStatsReceived ); - SteamNative.UserStatsStored_t.RegisterCallback( c, UserStatsStored ); + c.RegisterCallback( UserStatsReceived ); + c.RegisterCallback( UserStatsStored ); Refresh(); } @@ -100,9 +100,8 @@ public bool Reset( string identifier ) return client.native.userstats.ClearAchievement( identifier ); } - private void UserStatsReceived( UserStatsReceived_t stats, bool isError ) + private void UserStatsReceived( UserStatsReceived_t stats ) { - if ( isError ) return; if ( stats.GameID != client.AppId ) return; Refresh(); @@ -110,9 +109,8 @@ private void UserStatsReceived( UserStatsReceived_t stats, bool isError ) OnUpdated?.Invoke(); } - private void UserStatsStored( UserStatsStored_t stats, bool isError ) + private void UserStatsStored( UserStatsStored_t stats ) { - if ( isError ) return; if ( stats.GameID != client.AppId ) return; Refresh(); diff --git a/Facepunch.Steamworks/Client/App.cs b/Facepunch.Steamworks/Client/App.cs index 8fc959a..404887b 100644 --- a/Facepunch.Steamworks/Client/App.cs +++ b/Facepunch.Steamworks/Client/App.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using SteamNative; namespace Facepunch.Steamworks { @@ -12,6 +13,23 @@ public class App : IDisposable internal App( Client c ) { client = c; + + client.RegisterCallback( DlcInstalled ); + } + + public delegate void DlcInstalledDelegate( uint appid ); + + /// + /// Triggered after the current user gains ownership of DLC and that DLC is installed. + /// + public event DlcInstalledDelegate OnDlcInstalled; + + private void DlcInstalled( DlcInstalled_t data ) + { + if ( OnDlcInstalled != null ) + { + OnDlcInstalled( data.AppID ); + } } public void Dispose() @@ -72,5 +90,42 @@ public bool IsInstalled(uint appId) { return client.native.apps.BIsAppInstalled(appId); } + + /// + /// Returns true if specified app is installed. + /// + public bool IsDlcInstalled( uint appId ) + { + return client.native.apps.BIsDlcInstalled( appId ); + } + + /// + /// Returns the appid's name + /// Returns error if the current app Id does not have permission to use this interface + /// + public string GetName( uint appId ) + { + var str = client.native.applist.GetAppName( appId ); + if ( str == null ) return "error"; + return str; + } + + /// + /// Returns the app's install folder + /// Returns error if the current app Id does not have permission to use this interface + /// + public string GetInstallFolder( uint appId ) + { + return client.native.applist.GetAppInstallDir( appId ); + } + + /// + /// Returns the app's current build id + /// Returns 0 if the current app Id does not have permission to use this interface + /// + public int GetBuildId( uint appId ) + { + return client.native.applist.GetAppBuildId( appId ); + } } } diff --git a/Facepunch.Steamworks/Client/Friends.cs b/Facepunch.Steamworks/Client/Friends.cs index 36cd95d..0a95d0a 100644 --- a/Facepunch.Steamworks/Client/Friends.cs +++ b/Facepunch.Steamworks/Client/Friends.cs @@ -22,130 +22,6 @@ public Friends Friends } } - public class SteamFriend - { - /// - /// Steam Id - /// - public ulong Id { get; internal set; } - - - /// - /// Return true if blocked - /// - public bool IsBlocked => relationship == FriendRelationship.Blocked; - - /// - /// Return true if is a friend. Returns false if blocked, request etc. - /// - public bool IsFriend => relationship == FriendRelationship.Friend; - - /// - /// Their current display name - /// - public string Name; - - /// - /// Returns true if this friend is online - /// - public bool IsOnline => personaState != PersonaState.Offline; - - /// - /// Returns true if this friend is marked as away - /// - public bool IsAway => personaState == PersonaState.Away; - - /// - /// Returns true if this friend is marked as busy - /// - public bool IsBusy => personaState == PersonaState.Busy; - - /// - /// Returns true if this friend is marked as snoozing - /// - public bool IsSnoozing => personaState == PersonaState.Snooze; - - /// - /// Returns true if this friend is online and playing this game - /// - public bool IsPlayingThisGame => CurrentAppId == Client.AppId; - - /// - /// Returns true if this friend is online and playing this game - /// - public bool IsPlaying => CurrentAppId != 0; - - /// - /// The AppId this guy is playing - /// - public ulong CurrentAppId { get; internal set; } - - public uint ServerIp { get; internal set; } - public int ServerGamePort { get; internal set; } - public int ServerQueryPort { get; internal set; } - public ulong ServerLobbyId { get; internal set; } - - internal Client Client { get; set; } - private PersonaState personaState; - private FriendRelationship relationship; - - /// - /// Returns null if the value doesn't exist - /// - public string GetRichPresence( string key ) - { - var val = Client.native.friends.GetFriendRichPresence( Id, key ); - if ( string.IsNullOrEmpty( val ) ) return null; - return val; - } - - /// - /// Update this friend, request the latest data from Steam's servers - /// - public void Refresh() - { - Name = Client.native.friends.GetFriendPersonaName( Id ); - - relationship = Client.native.friends.GetFriendRelationship( Id ); - personaState = Client.native.friends.GetFriendPersonaState( Id ); - - CurrentAppId = 0; - ServerIp = 0; - ServerGamePort = 0; - ServerQueryPort = 0; - ServerLobbyId = 0; - - var gameInfo = new SteamNative.FriendGameInfo_t(); - if ( Client.native.friends.GetFriendGamePlayed( Id, ref gameInfo ) && gameInfo.GameID > 0 ) - { - CurrentAppId = gameInfo.GameID; - ServerIp = gameInfo.GameIP; - ServerGamePort = gameInfo.GamePort; - ServerQueryPort = gameInfo.QueryPort; - ServerLobbyId = gameInfo.SteamIDLobby; - } - - Client.native.friends.RequestFriendRichPresence( Id ); - } - - /// - /// This will return null if you don't have the target user's avatar in your cache. - /// Which usually happens for people not on your friends list. - /// - public Image GetAvatar( Friends.AvatarSize size ) - { - return Client.Friends.GetCachedAvatar( size, Id ); - } - - /// - /// Invite this friend to the game that we are playing - /// - public bool InviteToGame(string Text) - { - return Client.native.friends.InviteUserToGame(Id, Text); - } - } - /// /// Handles most interactions with people in Steam, not just friends as the name would suggest. /// @@ -158,12 +34,82 @@ public bool InviteToGame(string Text) public class Friends { internal Client client; + private byte[] buffer = new byte[1024 * 128]; internal Friends( Client c ) { client = c; - SteamNative.PersonaStateChange_t.RegisterCallback( client, OnPersonaStateChange ); + client.RegisterCallback( OnAvatarImageLoaded ); + client.RegisterCallback( OnPersonaStateChange ); + client.RegisterCallback( OnGameJoinRequested ); + client.RegisterCallback( OnFriendChatMessage ); + } + + public delegate void ChatMessageDelegate( SteamFriend friend, string type, string message ); + + /// + /// Called when chat message has been received from a friend. You'll need to turn on + /// ListenForFriendsMessages to recieve this. + /// + public event ChatMessageDelegate OnChatMessage; + + private unsafe void OnFriendChatMessage( GameConnectedFriendChatMsg_t data ) + { + if ( OnChatMessage == null ) return; + + var friend = Get( data.SteamIDUser ); + var type = ChatEntryType.ChatMsg; + fixed ( byte* ptr = buffer ) + { + var len = client.native.friends.GetFriendMessage( data.SteamIDUser, data.MessageID, (IntPtr)ptr, buffer.Length, out type ); + + if ( len == 0 && type == ChatEntryType.Invalid ) + return; + + var typeName = type.ToString(); + var message = Encoding.UTF8.GetString( buffer, 0, len ); + + OnChatMessage( friend, typeName, message ); + } + } + + private bool _listenForFriendsMessages; + + /// + /// Listens for Steam friends chat messages. + /// You can then show these chats inline in the game. For example with a Blizzard style chat message system or the chat system in Dota 2. + /// After enabling this you will receive callbacks when ever the user receives a chat message. + /// + public bool ListenForFriendsMessages + { + get + { + return _listenForFriendsMessages; + } + + set + { + _listenForFriendsMessages = value; + client.native.friends.SetListenForFriendsMessages( value ); + } + } + + + public delegate void JoinRequestedDelegate( SteamFriend friend, string connect ); + + // + // Called when a friend has invited you to their game (using InviteToGame) + // + public event JoinRequestedDelegate OnInvitedToGame; + + + private void OnGameJoinRequested( GameRichPresenceJoinRequested_t data ) + { + if ( OnInvitedToGame != null ) + { + OnInvitedToGame( Get( data.SteamIDFriend ), data.Connect ); + } } /// @@ -292,21 +238,25 @@ public Image GetCachedAvatar( AvatarSize size, ulong steamid ) break; } + if ( imageid == 1 ) return null; // Placeholder large + if ( imageid == 2 ) return null; // Placeholder medium + if ( imageid == 3 ) return null; // Placeholder small + var img = new Image() { Id = imageid }; - if (imageid != 0 && img.TryLoad(client.native.utils)) - return img; + if ( !img.TryLoad( client.native.utils ) ) + return null; - return null; + return img; } /// /// Callback will be called when the avatar is ready. If we fail to get an - /// avatar, it'll be called with a null Image. + /// avatar, might be called with a null Image. /// public void GetAvatar( AvatarSize size, ulong steamid, Action callback ) { @@ -329,23 +279,27 @@ public void GetAvatar( AvatarSize size, ulong steamid, Action callback ) PersonaCallbacks.Add( new PersonaCallback { SteamId = steamid, - Callback = () => - { - callback( GetCachedAvatar(size, steamid) ); - } + Size = size, + Callback = callback, + Time = DateTime.Now }); } private class PersonaCallback { public ulong SteamId; - public Action Callback; + public AvatarSize Size; + public Action Callback; + public DateTime Time; } List PersonaCallbacks = new List(); public SteamFriend Get( ulong steamid ) { + var friend = All.Where( x => x.Id == steamid ).FirstOrDefault(); + if ( friend != null ) return friend; + var f = new SteamFriend() { Id = steamid, @@ -357,9 +311,72 @@ public SteamFriend Get( ulong steamid ) return f; } - private void OnPersonaStateChange( PersonaStateChange_t data, bool error ) + internal void Cycle() { - + if ( PersonaCallbacks.Count == 0 ) return; + + var timeOut = DateTime.Now.AddSeconds( -10 ); + + for ( int i = PersonaCallbacks.Count-1; i >= 0; i-- ) + { + var cb = PersonaCallbacks[i]; + + // Timeout + if ( cb.Time < timeOut ) + { + if ( cb.Callback != null ) + { + cb.Callback( null ); + } + + PersonaCallbacks.Remove( cb ); + continue; + } + } + } + + + private void OnPersonaStateChange( PersonaStateChange_t data ) + { + // k_EPersonaChangeAvatar + if ( (data.ChangeFlags & 0x0040) == 0x0040 ) + { + LoadAvatarForSteamId( data.SteamID ); + } + + // + // Find and refresh this friend's status + // + foreach ( var friend in All ) + { + if ( friend.Id != data.SteamID ) continue; + + friend.Refresh(); + } + } + + void LoadAvatarForSteamId( ulong Steamid ) + { + for ( int i = PersonaCallbacks.Count - 1; i >= 0; i-- ) + { + var cb = PersonaCallbacks[i]; + if ( cb.SteamId != Steamid ) continue; + + var image = GetCachedAvatar( cb.Size, cb.SteamId ); + if ( image == null ) continue; + + PersonaCallbacks.Remove( cb ); + + if ( cb.Callback != null ) + { + cb.Callback( image ); + } + } + } + + private void OnAvatarImageLoaded( AvatarImageLoaded_t data ) + { + LoadAvatarForSteamId( data.SteamID ); } } diff --git a/Facepunch.Steamworks/Client/Image.cs b/Facepunch.Steamworks/Client/Image.cs index 0dc56ea..03d3ed5 100644 --- a/Facepunch.Steamworks/Client/Image.cs +++ b/Facepunch.Steamworks/Client/Image.cs @@ -29,7 +29,7 @@ unsafe internal bool TryLoad( SteamNative.SteamUtils utils ) if ( utils.GetImageSize( Id, out width, out height ) == false ) { IsError = true; - return true; + return false; } var buffer = new byte[ width * height * 4 ]; @@ -39,7 +39,7 @@ unsafe internal bool TryLoad( SteamNative.SteamUtils utils ) if ( utils.GetImageRGBA( Id, (IntPtr) ptr, buffer.Length ) == false ) { IsError = true; - return true; + return false; } } diff --git a/Facepunch.Steamworks/Client/Leaderboard.cs b/Facepunch.Steamworks/Client/Leaderboard.cs index ff5b5e0..dcd9f39 100644 --- a/Facepunch.Steamworks/Client/Leaderboard.cs +++ b/Facepunch.Steamworks/Client/Leaderboard.cs @@ -107,6 +107,9 @@ private bool DeferOnCreated( Action onValid, FailureCallback onFailure = null ) internal void OnBoardCreated( LeaderboardFindResult_t result, bool error ) { + Console.WriteLine( $"result.LeaderboardFound: {result.LeaderboardFound}" ); + Console.WriteLine( $"result.SteamLeaderboard: {result.SteamLeaderboard}" ); + if ( error || ( result.LeaderboardFound == 0 ) ) { IsError = true; @@ -234,7 +237,7 @@ public bool AttachRemoteFile( RemoteFile file, AttachRemoteFileCallback onSucces } } ); - return handle.CallResultHandle != 0; + return handle.IsValid; } file.Share( () => diff --git a/Facepunch.Steamworks/Client/Lobby.LobbyData.cs b/Facepunch.Steamworks/Client/Lobby.LobbyData.cs new file mode 100644 index 0000000..63e4e84 --- /dev/null +++ b/Facepunch.Steamworks/Client/Lobby.LobbyData.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; + +namespace Facepunch.Steamworks +{ + public partial class Lobby + { + /// + /// Class to hold global lobby data. This is stuff like maps/modes/etc. Data set here can be filtered by LobbyList. + /// + public class LobbyData + { + internal Client client; + internal ulong lobby; + internal Dictionary data; + + public LobbyData( Client c, ulong l ) + { + client = c; + lobby = l; + data = new Dictionary(); + } + + /// + /// Get the lobby value for the specific key + /// + /// The key to find + /// The value at key + public string GetData( string k ) + { + if ( data.ContainsKey( k ) ) + { + return data[k]; + } + + return "ERROR: key not found"; + } + + /// + /// Get a list of all the data in the Lobby + /// + /// Dictionary of all the key/value pairs in the data + public Dictionary GetAllData() + { + Dictionary returnData = new Dictionary(); + foreach ( KeyValuePair item in data ) + { + returnData.Add( item.Key, item.Value ); + } + return returnData; + } + + /// + /// Set the value for specified Key. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use. + /// + /// The key to set the value for + /// The value of the Key + /// True if data successfully set + public bool SetData( string k, string v ) + { + if ( data.ContainsKey( k ) ) + { + if ( data[k] == v ) { return true; } + if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) ) + { + data[k] = v; + return true; + } + } + else + { + if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) ) + { + data.Add( k, v ); + return true; + } + } + + return false; + } + + /// + /// Remove the key from the LobbyData. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use. + /// + /// The key to remove + /// True if Key successfully removed + public bool RemoveData( string k ) + { + if ( data.ContainsKey( k ) ) + { + if ( client.native.matchmaking.DeleteLobbyData( lobby, k ) ) + { + data.Remove( k ); + return true; + } + } + + return false; + } + + } + + /*not implemented + + //set the game server of the lobby + client.native.matchmaking.GetLobbyGameServer; + client.native.matchmaking.SetLobbyGameServer; + + //used with game server stuff + SteamNative.LobbyGameCreated_t + */ + } +} diff --git a/Facepunch.Steamworks/Client/Lobby.cs b/Facepunch.Steamworks/Client/Lobby.cs index f0a4dcb..fb2c163 100644 --- a/Facepunch.Steamworks/Client/Lobby.cs +++ b/Facepunch.Steamworks/Client/Lobby.cs @@ -13,35 +13,39 @@ public Lobby Lobby { get { - if (_lobby == null) - _lobby = new Steamworks.Lobby(this); + if ( _lobby == null ) + _lobby = new Steamworks.Lobby( this ); return _lobby; } } } - public class Lobby : IDisposable + public partial class Lobby : IDisposable { //The type of lobby you are creating public enum Type : int { Private = SteamNative.LobbyType.Private, FriendsOnly = SteamNative.LobbyType.FriendsOnly, - Public = SteamNative.LobbyType.Public, + Public = SteamNative.LobbyType.Public, Invisible = SteamNative.LobbyType.Invisible, Error //happens if you try to get this when you aren't in a valid lobby } internal Client client; - public Lobby(Client c) + public Lobby( Client c ) { client = c; - SteamNative.LobbyDataUpdate_t.RegisterCallback(client, OnLobbyDataUpdatedAPI); - SteamNative.LobbyChatMsg_t.RegisterCallback(client, OnLobbyChatMessageRecievedAPI); - SteamNative.LobbyChatUpdate_t.RegisterCallback(client, OnLobbyStateUpdatedAPI); - SteamNative.GameLobbyJoinRequested_t.RegisterCallback(client, OnLobbyJoinRequestedAPI); - SteamNative.LobbyInvite_t.RegisterCallback(client, OnUserInvitedToLobbyAPI); - SteamNative.PersonaStateChange_t.RegisterCallback(client, OnLobbyMemberPersonaChangeAPI); + + // For backwards compatibility + OnLobbyJoinRequested = Join; + + client.RegisterCallback( OnLobbyDataUpdatedAPI ); + client.RegisterCallback( OnLobbyChatMessageRecievedAPI ); + client.RegisterCallback( OnLobbyStateUpdatedAPI ); + client.RegisterCallback( OnLobbyJoinRequestedAPI ); + client.RegisterCallback( OnUserInvitedToLobbyAPI ); + client.RegisterCallback( OnLobbyMemberPersonaChangeAPI ); } /// @@ -63,23 +67,23 @@ public Lobby(Client c) /// Join a Lobby through its LobbyID. OnLobbyJoined is called with the result of the Join attempt. /// /// CSteamID of lobby to join - public void Join(ulong lobbyID) + public void Join( ulong lobbyID ) { Leave(); - client.native.matchmaking.JoinLobby(lobbyID, OnLobbyJoinedAPI); + client.native.matchmaking.JoinLobby( lobbyID, OnLobbyJoinedAPI ); } - void OnLobbyJoinedAPI(LobbyEnter_t callback, bool error) + void OnLobbyJoinedAPI( LobbyEnter_t callback, bool error ) { - if (error || (callback.EChatRoomEnterResponse != (uint)(SteamNative.ChatRoomEnterResponse.Success))) + if ( error || (callback.EChatRoomEnterResponse != (uint)(SteamNative.ChatRoomEnterResponse.Success)) ) { - if (OnLobbyJoined != null) { OnLobbyJoined(false); } + if ( OnLobbyJoined != null ) { OnLobbyJoined( false ); } return; } CurrentLobby = callback.SteamIDLobby; UpdateLobbyData(); - if (OnLobbyJoined != null) { OnLobbyJoined(true); } + if ( OnLobbyJoined != null ) { OnLobbyJoined( true ); } } /// @@ -88,37 +92,37 @@ void OnLobbyJoinedAPI(LobbyEnter_t callback, bool error) public Action OnLobbyJoined; /// - /// Creates a lobby and returns the created lobby. You auto join the created lobby. The lobby is stored in Client.CurrentLobby if successful. + /// Creates a lobby and returns the created lobby. You auto join the created lobby. The lobby is stored in Client.Lobby.CurrentLobby if successful. /// /// The Lobby.Type of Lobby to be created /// The maximum amount of people you want to be able to be in this lobby, including yourself - public void Create(Lobby.Type lobbyType, int maxMembers) + public void Create( Lobby.Type lobbyType, int maxMembers ) { - client.native.matchmaking.CreateLobby((SteamNative.LobbyType)lobbyType, maxMembers, OnLobbyCreatedAPI); + client.native.matchmaking.CreateLobby( (SteamNative.LobbyType)lobbyType, maxMembers, OnLobbyCreatedAPI ); createdLobbyType = lobbyType; } internal Type createdLobbyType; - internal void OnLobbyCreatedAPI(LobbyCreated_t callback, bool error) + internal void OnLobbyCreatedAPI( LobbyCreated_t callback, bool error ) { //from SpaceWarClient.cpp 793 - if (error || (callback.Result != Result.OK)) + if ( error || (callback.Result != Result.OK) ) { - if ( OnLobbyCreated != null) { OnLobbyCreated(false); } + if ( OnLobbyCreated != null ) { OnLobbyCreated( false ); } return; } //set owner specific properties Owner = client.SteamId; CurrentLobby = callback.SteamIDLobby; - CurrentLobbyData = new LobbyData(client, CurrentLobby); + CurrentLobbyData = new LobbyData( client, CurrentLobby ); Name = client.Username + "'s Lobby"; - CurrentLobbyData.SetData("appid", client.AppId.ToString()); + CurrentLobbyData.SetData( "appid", client.AppId.ToString() ); LobbyType = createdLobbyType; - CurrentLobbyData.SetData("lobbytype", LobbyType.ToString()); + CurrentLobbyData.SetData( "lobbytype", LobbyType.ToString() ); Joinable = true; - if (OnLobbyCreated != null) { OnLobbyCreated(true); } + if ( OnLobbyCreated != null ) { OnLobbyCreated( true ); } } /// @@ -126,108 +130,13 @@ internal void OnLobbyCreatedAPI(LobbyCreated_t callback, bool error) /// public Action OnLobbyCreated; - /// - /// Class to hold global lobby data. This is stuff like maps/modes/etc. Data set here can be filtered by LobbyList. - /// - public class LobbyData - { - internal Client client; - internal ulong lobby; - internal Dictionary data; - - public LobbyData(Client c, ulong l) - { - client = c; - lobby = l; - data = new Dictionary(); - } - - /// - /// Get the lobby value for the specific key - /// - /// The key to find - /// The value at key - public string GetData(string k) - { - if (data.ContainsKey(k)) - { - return data[k]; - } - - return "ERROR: key not found"; - } - - /// - /// Get a list of all the data in the Lobby - /// - /// Dictionary of all the key/value pairs in the data - public Dictionary GetAllData() - { - Dictionary returnData = new Dictionary(); - foreach(KeyValuePair item in data) - { - returnData.Add(item.Key, item.Value); - } - return returnData; - } - - /// - /// Set the value for specified Key. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use. - /// - /// The key to set the value for - /// The value of the Key - /// True if data successfully set - public bool SetData(string k, string v) - { - if (data.ContainsKey(k)) - { - if (data[k] == v) { return true; } - if (client.native.matchmaking.SetLobbyData(lobby, k, v)) - { - data[k] = v; - return true; - } - } - else - { - if (client.native.matchmaking.SetLobbyData(lobby, k, v)) - { - data.Add(k, v); - return true; - } - } - - return false; - } - - /// - /// Remove the key from the LobbyData. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use. - /// - /// The key to remove - /// True if Key successfully removed - public bool RemoveData(string k) - { - if (data.ContainsKey(k)) - { - if (client.native.matchmaking.DeleteLobbyData(lobby, k)) - { - data.Remove(k); - return true; - } - } - - return false; - } - - } - /// /// Sets user data for the Lobby. Things like Character, Skin, Ready, etc. Can only set your own member data /// - public void SetMemberData(string key, string value) + public void SetMemberData( string key, string value ) { - if(CurrentLobby == 0) { return; } - client.native.matchmaking.SetLobbyMemberData(CurrentLobby, key, value); + if ( CurrentLobby == 0 ) { return; } + client.native.matchmaking.SetLobbyMemberData( CurrentLobby, key, value ); } /// @@ -236,23 +145,24 @@ public void SetMemberData(string key, string value) /// ulong SteamID of the user you want to get data from /// String key of the type of data you want to get /// - public string GetMemberData(ulong steamID, string key) + public string GetMemberData( ulong steamID, string key ) { - if (CurrentLobby == 0) { return "ERROR: NOT IN ANY LOBBY"; } - return client.native.matchmaking.GetLobbyMemberData(CurrentLobby, steamID, key); + if ( CurrentLobby == 0 ) { return "ERROR: NOT IN ANY LOBBY"; } + return client.native.matchmaking.GetLobbyMemberData( CurrentLobby, steamID, key ); } - internal void OnLobbyDataUpdatedAPI(LobbyDataUpdate_t callback, bool error) + internal void OnLobbyDataUpdatedAPI( LobbyDataUpdate_t callback ) { - if(error || (callback.SteamIDLobby != CurrentLobby)) { return; } - if(callback.SteamIDLobby == CurrentLobby) //actual lobby data was updated by owner + if ( callback.SteamIDLobby != CurrentLobby ) return; + + if ( callback.SteamIDLobby == CurrentLobby ) //actual lobby data was updated by owner { UpdateLobbyData(); } - if(UserIsInCurrentLobby(callback.SteamIDMember)) //some member of this lobby updated their information + if ( UserIsInCurrentLobby( callback.SteamIDMember ) ) //some member of this lobby updated their information { - if (OnLobbyMemberDataUpdated != null) { OnLobbyMemberDataUpdated(callback.SteamIDMember); } + if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamIDMember ); } } } @@ -261,17 +171,17 @@ internal void OnLobbyDataUpdatedAPI(LobbyDataUpdate_t callback, bool error) /// internal void UpdateLobbyData() { - int dataCount = client.native.matchmaking.GetLobbyDataCount(CurrentLobby); - CurrentLobbyData = new LobbyData(client, CurrentLobby); - for (int i = 0; i < dataCount; i++) + int dataCount = client.native.matchmaking.GetLobbyDataCount( CurrentLobby ); + CurrentLobbyData = new LobbyData( client, CurrentLobby ); + for ( int i = 0; i < dataCount; i++ ) { - if (client.native.matchmaking.GetLobbyDataByIndex(CurrentLobby, i, out string key, out string value)) + if ( client.native.matchmaking.GetLobbyDataByIndex( CurrentLobby, i, out string key, out string value ) ) { - CurrentLobbyData.SetData(key, value); + CurrentLobbyData.SetData( key, value ); } } - if(OnLobbyDataUpdated != null) { OnLobbyDataUpdated(); } + if ( OnLobbyDataUpdated != null ) { OnLobbyDataUpdated(); } } /// @@ -289,12 +199,12 @@ public Type LobbyType { get { - if (!IsValid) { return Type.Error; } //if we're currently in a valid server - + if ( !IsValid ) { return Type.Error; } //if we're currently in a valid server + //we know that we've set the lobby type via the lobbydata in the creation function //ps this is important because steam doesn't have an easy way to get lobby type (why idk) - string lobbyType = CurrentLobbyData.GetData("lobbytype"); - switch (lobbyType) + string lobbyType = CurrentLobbyData.GetData( "lobbytype" ); + switch ( lobbyType ) { case "Private": return Type.Private; @@ -310,32 +220,37 @@ public Type LobbyType } set { - if(!IsValid) { return; } - if(client.native.matchmaking.SetLobbyType(CurrentLobby, (SteamNative.LobbyType)value)) + if ( !IsValid ) { return; } + if ( client.native.matchmaking.SetLobbyType( CurrentLobby, (SteamNative.LobbyType)value ) ) { - CurrentLobbyData.SetData("lobbytype", value.ToString()); + CurrentLobbyData.SetData( "lobbytype", value.ToString() ); } } } private static byte[] chatMessageData = new byte[1024 * 4]; - private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback, bool error) + private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callback ) { //from Client.Networking - if(error || callback.SteamIDLobby != CurrentLobby) + if ( callback.SteamIDLobby != CurrentLobby ) return; SteamNative.CSteamID steamid = 1; ChatEntryType chatEntryType; // "If set then this will just always return k_EChatEntryTypeChatMsg. This can usually just be set to NULL." int readData = 0; - fixed (byte* p = chatMessageData) + fixed ( byte* p = chatMessageData ) { - readData = client.native.matchmaking.GetLobbyChatEntry(CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType); + readData = client.native.matchmaking.GetLobbyChatEntry( CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType ); } - OnChatMessageRecieved?.Invoke(steamid, chatMessageData, readData); - OnChatStringRecieved?.Invoke(steamid, Encoding.UTF8.GetString(chatMessageData)); + + OnChatMessageRecieved?.Invoke( steamid, chatMessageData, readData ); + + if ( readData > 0 ) + { + OnChatStringRecieved?.Invoke( steamid, Encoding.UTF8.GetString( chatMessageData, 0, readData ) ); + } } /// @@ -352,14 +267,14 @@ private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback, bool /// Broadcasts a chat message to the all the users in the lobby users in the lobby (including the local user) will receive a LobbyChatMsg_t callback. /// /// True if message successfully sent - public unsafe bool SendChatMessage(string message) + public unsafe bool SendChatMessage( string message ) { - var data = Encoding.UTF8.GetBytes(message); - fixed (byte* p = data) + var data = Encoding.UTF8.GetBytes( message ); + fixed ( byte* p = data ) { // pvMsgBody can be binary or text data, up to 4k // if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator - return client.native.matchmaking.SendLobbyChatMsg(CurrentLobby, (IntPtr)p, data.Length); + return client.native.matchmaking.SendLobbyChatMsg( CurrentLobby, (IntPtr)p, data.Length ); } } @@ -375,16 +290,16 @@ public enum MemberStateChange Banned = ChatMemberStateChange.Banned, } - internal void OnLobbyStateUpdatedAPI(LobbyChatUpdate_t callback, bool error) + internal void OnLobbyStateUpdatedAPI( LobbyChatUpdate_t callback ) { - if (error || callback.SteamIDLobby != CurrentLobby) + if ( callback.SteamIDLobby != CurrentLobby ) return; MemberStateChange change = (MemberStateChange)callback.GfChatMemberStateChange; ulong initiator = callback.SteamIDMakingChange; ulong affected = callback.SteamIDUserChanged; - OnLobbyStateChanged?.Invoke(change, initiator, affected); + OnLobbyStateChanged?.Invoke( change, initiator, affected ); } /// @@ -401,13 +316,24 @@ public string Name { get { - if (!IsValid) { return ""; } - return CurrentLobbyData.GetData("name"); + if ( !IsValid ) { return ""; } + return CurrentLobbyData.GetData( "name" ); } set { - if (!IsValid) { return; } - CurrentLobbyData.SetData("name", value); + if ( !IsValid ) { return; } + CurrentLobbyData.SetData( "name", value ); + } + } + + /// + /// returns true if we're the current owner + /// + public bool IsOwner + { + get + { + return Owner == client.SteamId; } } @@ -418,16 +344,16 @@ public ulong Owner { get { - if (IsValid) + if ( IsValid ) { - return client.native.matchmaking.GetLobbyOwner(CurrentLobby); + return client.native.matchmaking.GetLobbyOwner( CurrentLobby ); } return 0; } set { - if (Owner == value) return; - client.native.matchmaking.SetLobbyOwner(CurrentLobby, value); + if ( Owner == value ) return; + client.native.matchmaking.SetLobbyOwner( CurrentLobby, value ); } } @@ -438,9 +364,9 @@ public bool Joinable { get { - if (!IsValid) { return false; } - string joinable = CurrentLobbyData.GetData("joinable"); - switch (joinable) + if ( !IsValid ) { return false; } + string joinable = CurrentLobbyData.GetData( "joinable" ); + switch ( joinable ) { case "true": return true; @@ -452,10 +378,10 @@ public bool Joinable } set { - if (!IsValid) { return; } - if (client.native.matchmaking.SetLobbyJoinable(CurrentLobby, value)) + if ( !IsValid ) { return; } + if ( client.native.matchmaking.SetLobbyJoinable( CurrentLobby, value ) ) { - CurrentLobbyData.SetData("joinable", value.ToString()); + CurrentLobbyData.SetData( "joinable", value.ToString() ); } } } @@ -467,13 +393,13 @@ public int MaxMembers { get { - if (!IsValid) { return 0; } //0 is default, but value is inited when lobby is created. - return client.native.matchmaking.GetLobbyMemberLimit(CurrentLobby); + if ( !IsValid ) { return 0; } //0 is default, but value is inited when lobby is created. + return client.native.matchmaking.GetLobbyMemberLimit( CurrentLobby ); } set { - if (!IsValid) { return; } - client.native.matchmaking.SetLobbyMemberLimit(CurrentLobby, value); + if ( !IsValid ) { return; } + client.native.matchmaking.SetLobbyMemberLimit( CurrentLobby, value ); } } @@ -482,7 +408,7 @@ public int MaxMembers /// public int NumMembers { - get { return client.native.matchmaking.GetNumLobbyMembers(CurrentLobby);} + get { return client.native.matchmaking.GetNumLobbyMembers( CurrentLobby ); } } /// @@ -490,9 +416,9 @@ public int NumMembers /// public void Leave() { - if (CurrentLobby != 0) + if ( CurrentLobby != 0 ) { - client.native.matchmaking.LeaveLobby(CurrentLobby); + client.native.matchmaking.LeaveLobby( CurrentLobby ); } CurrentLobby = 0; @@ -513,9 +439,9 @@ public void Dispose() public ulong[] GetMemberIDs() { ulong[] memIDs = new ulong[NumMembers]; - for (int i = 0; i < NumMembers; i++) + for ( int i = 0; i < NumMembers; i++ ) { - memIDs[i] = client.native.matchmaking.GetLobbyMemberByIndex(CurrentLobby, i); + memIDs[i] = client.native.matchmaking.GetLobbyMemberByIndex( CurrentLobby, i ); } return memIDs; } @@ -525,14 +451,14 @@ public ulong[] GetMemberIDs() /// /// SteamID of the user to check for /// - public bool UserIsInCurrentLobby(ulong steamID) + public bool UserIsInCurrentLobby( ulong steamID ) { if ( CurrentLobby == 0 ) return false; ulong[] mems = GetMemberIDs(); - for (int i = 0; i < mems.Length; i++) + for ( int i = 0; i < mems.Length; i++ ) { if ( mems[i] == steamID ) return true; @@ -545,39 +471,119 @@ public bool UserIsInCurrentLobby(ulong steamID) /// Invites the specified user to the CurrentLobby the user is in. /// /// ulong ID of person to invite - public bool InviteUserToLobby(ulong friendID) + public bool InviteUserToLobby( ulong friendID ) { - return client.native.matchmaking.InviteUserToLobby(CurrentLobby, friendID); + return client.native.matchmaking.InviteUserToLobby( CurrentLobby, friendID ); } - internal void OnUserInvitedToLobbyAPI(LobbyInvite_t callback, bool error) + internal void OnUserInvitedToLobbyAPI( LobbyInvite_t callback ) { - if (error || (callback.GameID != client.AppId)) { return; } - if (OnUserInvitedToLobby != null) { OnUserInvitedToLobby(callback.SteamIDLobby, callback.SteamIDUser); } + if ( callback.GameID != client.AppId ) return; + if ( OnUserInvitedToLobby != null ) { OnUserInvitedToLobby( callback.SteamIDLobby, callback.SteamIDUser ); } } + /// + /// Activates the steam overlay to invite friends to the CurrentLobby the user is in. + /// + public void OpenFriendInviteOverlay() + { + client.native.friends.ActivateGameOverlayInviteDialog(CurrentLobby); + } + /// /// Called when a user invites the current user to a lobby. The first parameter is the lobby the user was invited to, the second is the CSteamID of the person who invited this user /// public Action OnUserInvitedToLobby; + /// + /// Called when a user accepts an invitation to a lobby while the game is running. The parameter is a lobby id. + /// + public Action OnLobbyJoinRequested; + /// /// Joins a lobby if a request was made to join the lobby through the friends list or an invite /// - internal void OnLobbyJoinRequestedAPI(GameLobbyJoinRequested_t callback, bool error) + internal void OnLobbyJoinRequestedAPI( GameLobbyJoinRequested_t callback ) { - if (error) { return; } - Join(callback.SteamIDLobby); + if (OnLobbyJoinRequested != null) { OnLobbyJoinRequested(callback.SteamIDLobby); } } /// /// Makes sure we send an update callback if a Lobby user updates their information /// - internal void OnLobbyMemberPersonaChangeAPI(PersonaStateChange_t callback, bool error) + internal void OnLobbyMemberPersonaChangeAPI( PersonaStateChange_t callback ) { - if (error || !UserIsInCurrentLobby(callback.SteamID)) { return; } - if (OnLobbyMemberDataUpdated != null) { OnLobbyMemberDataUpdated(callback.SteamID); } + if ( !UserIsInCurrentLobby( callback.SteamID ) ) return; + if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamID ); } + } + + /// + /// Sets the game server associated with the lobby. + /// This can only be set by the owner of the lobby. + /// Either the IP/Port or the Steam ID of the game server must be valid, depending on how you want the clients to be able to connect. + /// + public bool SetGameServer( System.Net.IPAddress ip, int port, ulong serverSteamId = 0 ) + { + if ( !IsValid || !IsOwner ) return false; + + var ipint = System.Net.IPAddress.NetworkToHostOrder( ip.Address ); + client.native.matchmaking.SetLobbyGameServer( CurrentLobby, (uint)ipint, (ushort)port, serverSteamId ); + return true; + } + + /// + /// Gets the details of a game server set in a lobby. + /// + public System.Net.IPAddress GameServerIp + { + get + { + uint ip; + ushort port; + CSteamID steamid; + + if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) || ip == 0 ) + return null; + + return new System.Net.IPAddress( System.Net.IPAddress.HostToNetworkOrder( ip ) ); + } + } + + /// + /// Gets the details of a game server set in a lobby. + /// + public int GameServerPort + { + get + { + uint ip; + ushort port; + CSteamID steamid; + + if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) ) + return 0; + + return (int)port; + } + } + + /// + /// Gets the details of a game server set in a lobby. + /// + public ulong GameServerSteamId + { + get + { + uint ip; + ushort port; + CSteamID steamid; + + if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) ) + return 0; + + return steamid; + } } /*not implemented diff --git a/Facepunch.Steamworks/Client/LobbyList.cs b/Facepunch.Steamworks/Client/LobbyList.cs index 905695d..4470973 100644 --- a/Facepunch.Steamworks/Client/LobbyList.cs +++ b/Facepunch.Steamworks/Client/LobbyList.cs @@ -41,6 +41,8 @@ public void Refresh ( Filter filter = null) { filter = new Filter(); filter.StringFilters.Add("appid", client.AppId.ToString()); + client.native.matchmaking.RequestLobbyList(OnLobbyList); + return; } client.native.matchmaking.AddRequestLobbyListDistanceFilter((SteamNative.LobbyDistanceFilter)filter.DistanceFilter); @@ -101,7 +103,7 @@ void OnLobbyList(LobbyMatchList_t callback, bool error) { //else we need to get the info for the missing lobby client.native.matchmaking.RequestLobbyData(lobby); - SteamNative.LobbyDataUpdate_t.RegisterCallback(client, OnLobbyDataUpdated); + client.RegisterCallback( OnLobbyDataUpdated ); } } @@ -121,7 +123,7 @@ void checkFinished() Finished = false; } - void OnLobbyDataUpdated(LobbyDataUpdate_t callback, bool error) + void OnLobbyDataUpdated(LobbyDataUpdate_t callback) { if (callback.Success == 1) //1 if success, 0 if failure { diff --git a/Facepunch.Steamworks/Client/MicroTransactions.cs b/Facepunch.Steamworks/Client/MicroTransactions.cs index 6c7af88..240b35b 100644 --- a/Facepunch.Steamworks/Client/MicroTransactions.cs +++ b/Facepunch.Steamworks/Client/MicroTransactions.cs @@ -23,10 +23,10 @@ internal MicroTransactions( Client c ) { client = c; - SteamNative.MicroTxnAuthorizationResponse_t.RegisterCallback( client, onMicroTxnAuthorizationResponse ); + client.RegisterCallback( onMicroTxnAuthorizationResponse ); } - private void onMicroTxnAuthorizationResponse( MicroTxnAuthorizationResponse_t arg1, bool arg2 ) + private void onMicroTxnAuthorizationResponse( MicroTxnAuthorizationResponse_t arg1 ) { if ( OnAuthorizationResponse != null ) { diff --git a/Facepunch.Steamworks/Client/ServerList.Server.cs b/Facepunch.Steamworks/Client/ServerList.Server.cs index a750f2d..fbe10b8 100644 --- a/Facepunch.Steamworks/Client/ServerList.Server.cs +++ b/Facepunch.Steamworks/Client/ServerList.Server.cs @@ -86,7 +86,7 @@ internal static Server FromSteam( Client client, SteamNative.gameserveritem_t it /// public bool HasRules { get { return Rules != null && Rules.Count > 0; } } - internal Interop.ServerRules RulesRequest; + internal SourceServerQuery RulesRequest; /// /// Populates Rules for this server @@ -96,18 +96,23 @@ public void FetchRules() if ( RulesRequest != null ) return; - Rules = new Dictionary(); - - RulesRequest = new Interop.ServerRules( this, Address, QueryPort ); + Rules = null; + RulesRequest = new SourceServerQuery( this, Address, QueryPort ); } - internal void OnServerRulesReceiveFinished( bool Success ) + internal void OnServerRulesReceiveFinished( Dictionary rules, bool Success ) { - RulesRequest.Dispose(); RulesRequest = null; + if ( Success ) + { + Rules = rules; + } + if ( OnReceivedRules != null ) + { OnReceivedRules( Success ); + } } internal const uint k_unFavoriteFlagNone = 0x00; diff --git a/Facepunch.Steamworks/Client/ServerQuery.cs b/Facepunch.Steamworks/Client/ServerQuery.cs deleted file mode 100644 index b1abaac..0000000 --- a/Facepunch.Steamworks/Client/ServerQuery.cs +++ /dev/null @@ -1,513 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.Net.Sockets; -using System.IO; - -#if !NET_CORE - -internal class SourceServerQuery :IDisposable -{ - public class PlayersResponse - { - public short player_count; - public List players = new List(); - - public class Player - { - public String name { get; set; } - public int score { get; set; } - public float playtime { get; set; } - } - } - - private IPEndPoint endPoint; - - private Socket socket; - private UdpClient client; - - // send & receive timeouts - private int send_timeout = 2500; - private int receive_timeout = 2500; - - // raw response returned from the server - private byte[] raw_data; - - private int offset = 0; - - // constants - private readonly byte[] FFFFFFFF = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }; - - public SourceServerQuery( String ip, int port ) - { - this.endPoint = new IPEndPoint( IPAddress.Parse( ip ), port ); - } - - /// - /// Get a list of currently in-game clients on the specified gameserver. - /// Please note: the playtime is stored as a float in seconds, you might want to convert it. - /// - /// See https://developer.valvesoftware.com/wiki/Server_queries#A2S_PLAYER for more Information - /// - /// A PLayersResponse Object containing the name, score and playtime of each player - public PlayersResponse GetPlayerList() - { - // open socket if not already open - this.GetSocket(); - // we don't need the header, so set pointer to where the payload begins - this.offset = 5; - - try - { - PlayersResponse pr = new PlayersResponse(); - - // since A2S_PLAYER requests require a valid challenge, get it first - byte[] challenge = this.GetChallenge(0x55, true); - - byte[] request = new byte[challenge.Length + this.FFFFFFFF.Length + 1]; - Array.Copy( this.FFFFFFFF, 0, request, 0, this.FFFFFFFF.Length ); - request[this.FFFFFFFF.Length] = 0x55; - Array.Copy( challenge, 0, request, this.FFFFFFFF.Length + 1, challenge.Length ); - - this.socket.Send( request ); - - // MODIFIED BY ZACKBOE - // Increased byte size from 1024 in order to receive more player data - // Previously returned a socket exception at >~ 51 players. - this.raw_data = new byte[2048]; - // END MODIFICATION - this.socket.Receive( this.raw_data ); - - byte player_count = this.ReadByte(); - - // fill up the list of players - for ( int i = 0; i < player_count; i++ ) - { - this.ReadByte(); - - PlayersResponse.Player p = new PlayersResponse.Player(); - - p.name = this.ReadString(); - p.score = this.ReadInt32(); - p.playtime = this.ReadFloat(); - - pr.players.Add( p ); - } - - pr.player_count = player_count; - - return pr; - } - catch ( SocketException ) - { - return null; - } - } - - /// - /// Get a list of all publically available CVars ("rules") from the server. - /// Note: Due to a bug in the Source Engine, it might happen that some CVars/values are cut off. - /// - /// Example: mp_idlemaxtime = [nothing] - /// Only Valve can fix that. - /// - /// A RulesResponse Object containing a Name-Value pair of each CVar - public Dictionary GetRules() - { - // open udpclient if not already open - this.GetClient(); - - try - { - var d = new Dictionary(); - - // similar to A2S_PLAYER requests, A2S_RULES require a valid challenge - byte[] challenge = this.GetChallenge(0x56, false); - - byte[] request = new byte[challenge.Length + this.FFFFFFFF.Length + 1]; - Array.Copy( this.FFFFFFFF, 0, request, 0, this.FFFFFFFF.Length ); - request[this.FFFFFFFF.Length] = 0x56; - Array.Copy( challenge, 0, request, this.FFFFFFFF.Length + 1, challenge.Length ); - - this.client.Send( request, request.Length ); - - // - // Since A2S_RULES responses might be split up into several packages/compressed, we have to do a special handling of them - // - int bytesRead; - - // this will keep our assembled message - byte[] buffer = new byte[4096]; - - // send first request - - this.raw_data = this.client.Receive( ref this.endPoint ); - - bytesRead = this.raw_data.Length; - - // reset pointer - this.offset = 0; - - int is_split = this.ReadInt32(); - int requestid = this.ReadInt32(); - - this.offset = 4; - - // response is split up into several packets - if ( this.PacketIsSplit( is_split ) ) - { - bool isCompressed = false; - byte[] splitData; - int packetCount, packetNumber, requestId; - int packetsReceived = 1; - int packetChecksum = 0; - int packetSplit = 0; - short splitSize; - int uncompressedSize = 0; - List splitPackets = new List(); - - do - { - // unique request id - requestId = this.ReverseBytes( this.ReadInt32() ); - isCompressed = this.PacketIsCompressed( requestId ); - - packetCount = this.ReadByte(); - packetNumber = this.ReadByte() + 1; - // so we know how big our byte arrays have to be - splitSize = this.ReadInt16(); - splitSize -= 4; // fix - - if ( packetsReceived == 1 ) - { - for ( int i = 0; i < packetCount; i++ ) - { - splitPackets.Add( new byte[] { } ); - } - } - - // if the packets are compressed, get some data to decompress them - if ( isCompressed ) - { - uncompressedSize = ReverseBytes( this.ReadInt32() ); - packetChecksum = ReverseBytes( this.ReadInt32() ); - } - - // ommit header in first packet - if ( packetNumber == 1 ) this.ReadInt32(); - - splitData = new byte[splitSize]; - splitPackets[packetNumber - 1] = this.ReadBytes(); - - // fixes a case where the returned package might still contain a character after the last \0 terminator (truncated name => value) - // please note: this therefore also removes the value of said variable, but atleast the program won't crash - if ( splitPackets[packetNumber - 1].Length - 1 > 0 && splitPackets[packetNumber - 1][splitPackets[packetNumber - 1].Length - 1] != 0x00 ) - { - splitPackets[packetNumber - 1][splitPackets[packetNumber - 1].Length - 1] = 0x00; - } - - // reset pointer again, so we can copy over the contents - this.offset = 0; - - if ( packetsReceived < packetCount ) - { - - this.raw_data = this.client.Receive( ref this.endPoint ); - bytesRead = this.raw_data.Length; - - // continue with the next packets - packetSplit = this.ReadInt32(); - packetsReceived++; - } - else - { - // all packets received - bytesRead = 0; - } - } - while ( packetsReceived <= packetCount && bytesRead > 0 && packetSplit == -2 ); - - // decompress - if ( isCompressed ) - { - buffer = ReassemblePacket( splitPackets, true, uncompressedSize, packetChecksum ); - } - else - { - buffer = ReassemblePacket( splitPackets, false, 0, 0 ); - } - } - else - { - buffer = this.raw_data; - } - - // move our final result over to handle it - this.raw_data = buffer; - - // omitting header - this.offset += 1; - var count = this.ReadInt16(); - - for ( int i = 0; i < count; i++ ) - { - var k = this.ReadString(); - var v = this.ReadString(); - - if ( !d.ContainsKey( k ) ) - d.Add( k, v ); - } - - return d; - } - catch ( SocketException e ) - { - Console.WriteLine( e ); - return null; - } - } - - /// - /// Close all currently open socket/UdpClient connections - /// - public void Dispose() - { - if ( this.socket != null ) this.socket.Close(); - if ( this.client != null ) this.client.Close(); - } - - /// - /// Open up a new Socket-based connection to a server, if not already open. - /// - private void GetSocket() - { - if ( this.socket == null ) - { - this.socket = new Socket( - AddressFamily.InterNetwork, - SocketType.Dgram, - ProtocolType.Udp ); - - this.socket.SendTimeout = this.send_timeout; - this.socket.ReceiveTimeout = this.receive_timeout; - - this.socket.Connect( this.endPoint ); - } - } - - /// - /// Create a new UdpClient connection to a server (mostly used for multi-packet answers) - /// - private void GetClient() - { - if ( this.client == null ) - { - this.client = new UdpClient(); - this.client.Connect( this.endPoint ); - this.client.DontFragment = true; - - this.client.Client.SendTimeout = this.send_timeout; - this.client.Client.ReceiveTimeout = this.receive_timeout; - } - } - - /// - /// Reassmble a multi-packet response. - /// - /// The packets to assemble - /// true: packets are compressed; false: not - /// The size of the message after decompression (for comparison) - /// Validation of the result - /// A byte-array containing all packets assembled together/decompressed. - private byte[] ReassemblePacket( List splitPackets, bool isCompressed, int uncompressedSize, int packetChecksum ) - { - byte[] packetData, tmpData; - packetData = new byte[0]; - - foreach ( byte[] splitPacket in splitPackets ) - { - if ( splitPacket == null ) - { - throw new Exception(); - } - - tmpData = packetData; - packetData = new byte[tmpData.Length + splitPacket.Length]; - - MemoryStream memStream = new MemoryStream(packetData); - memStream.Write( tmpData, 0, tmpData.Length ); - memStream.Write( splitPacket, 0, splitPacket.Length ); - } - - if ( isCompressed ) - { - throw new System.NotImplementedException(); - } - - return packetData; - } - - /// - /// Invert the Byte-order Mark of an value, used for compatibility between Little Large BOM - /// - /// The value to invert - /// BOM-inversed value (if needed), otherwise the original value - private int ReverseBytes( int value ) - { - byte[] bytes = BitConverter.GetBytes(value); - if ( BitConverter.IsLittleEndian ) - { - Array.Reverse( bytes ); - } - return BitConverter.ToInt32( bytes, 0 ); - } - - /// - /// Determine whetever or not a message is compressed. - /// Simply detects if the most significant bit is 1. - /// - /// The value to check - /// true, if message is compressed, false otherwise - private bool PacketIsCompressed( int value ) - { - return ( value & 0x8000 ) != 0; - } - - /// - /// Determine whetever or not a message is split up. - /// - /// The value to check - /// true, if message is split up, false otherwise - private bool PacketIsSplit( int paket ) - { - return ( paket == -2 ); - } - - /// - /// Request the 4-byte challenge id from the server, required for A2S_RULES and A2S_PLAYER. - /// - /// The type of message to request the challenge for (see constants) - /// Request method to use (performance reasons) - /// A Byte Array (4-bytes) containing the challenge - private Byte[] GetChallenge( byte type, bool socket = true ) - { - byte[] request = new byte[this.FFFFFFFF.Length + this.FFFFFFFF.Length + 1]; - Array.Copy( this.FFFFFFFF, 0, request, 0, this.FFFFFFFF.Length ); - request[FFFFFFFF.Length] = type; - Array.Copy( this.FFFFFFFF, 0, request, this.FFFFFFFF.Length + 1, this.FFFFFFFF.Length ); - - byte[] raw_response = new byte[24]; - byte[] challenge = new byte[4]; - - // using sockets - if ( socket ) - { - this.socket.Send( request ); - this.socket.Receive( raw_response ); - } - else - { - this.client.Send( request, request.Length ); - raw_response = this.client.Receive( ref this.endPoint ); - } - - Array.Copy( raw_response, 5, challenge, 0, 4 ); // change this valve modifies the protocol! - - return challenge; - } - - /// - /// Read a single byte value from our raw data. - /// - /// A single Byte at the next Offset Address - private Byte ReadByte() - { - byte[] b = new byte[1]; - Array.Copy( this.raw_data, this.offset, b, 0, 1 ); - - this.offset++; - return b[0]; - } - - /// - /// Read all remaining Bytes from our raw data. - /// Used for multi-packet responses. - /// - /// All remaining data - private Byte[] ReadBytes() - { - int size = (this.raw_data.Length - this.offset - 4); - if ( size < 1 ) return new Byte[] { }; - - byte[] b = new byte[size]; - Array.Copy( this.raw_data, this.offset, b, 0, this.raw_data.Length - this.offset - 4 ); - - this.offset += ( this.raw_data.Length - this.offset - 4 ); - return b; - } - - /// - /// Read a 32-Bit Integer value from the next offset address. - /// - /// The Int32 Value found at the offset address - private Int32 ReadInt32() - { - byte[] b = new byte[4]; - Array.Copy( this.raw_data, this.offset, b, 0, 4 ); - - this.offset += 4; - return BitConverter.ToInt32( b, 0 ); - } - - /// - /// Read a 16-Bit Integer (also called "short") value from the next offset address. - /// - /// The Int16 Value found at the offset address - private Int16 ReadInt16() - { - byte[] b = new byte[2]; - Array.Copy( this.raw_data, this.offset, b, 0, 2 ); - - this.offset += 2; - return BitConverter.ToInt16( b, 0 ); - } - - /// - /// Read a Float value from the next offset address. - /// - /// The Float Value found at the offset address - private float ReadFloat() - { - byte[] b = new byte[4]; - Array.Copy( this.raw_data, this.offset, b, 0, 4 ); - - this.offset += 4; - return BitConverter.ToSingle( b, 0 ); - } - - /// - /// Read a String until its end starting from the next offset address. - /// Reading stops once the method detects a 0x00 Character at the next position (\0 terminator) - /// - /// The String read - private String ReadString() - { - byte[] cache = new byte[1] { 0x01 }; - String output = ""; - - while ( cache[0] != 0x00 ) - { - if ( this.offset == this.raw_data.Length ) break; // fixes Valve's inability to code a proper query protocol - Array.Copy( this.raw_data, this.offset, cache, 0, 1 ); - this.offset++; - - if ( cache[0] != 0x00) - output += Encoding.UTF8.GetString( cache ); - } - - return output; - } -} - -#endif \ No newline at end of file diff --git a/Facepunch.Steamworks/Client/SteamFriend.cs b/Facepunch.Steamworks/Client/SteamFriend.cs new file mode 100644 index 0000000..91206dd --- /dev/null +++ b/Facepunch.Steamworks/Client/SteamFriend.cs @@ -0,0 +1,136 @@ +using SteamNative; + +namespace Facepunch.Steamworks +{ + public class SteamFriend + { + /// + /// Steam Id + /// + public ulong Id { get; internal set; } + + + /// + /// Return true if blocked + /// + public bool IsBlocked => relationship == FriendRelationship.Blocked; + + /// + /// Return true if is a friend. Returns false if blocked, request etc. + /// + public bool IsFriend => relationship == FriendRelationship.Friend; + + /// + /// Their current display name + /// + public string Name; + + /// + /// Returns true if this friend is online + /// + public bool IsOnline => personaState != PersonaState.Offline; + + /// + /// Returns true if this friend is marked as away + /// + public bool IsAway => personaState == PersonaState.Away; + + /// + /// Returns true if this friend is marked as busy + /// + public bool IsBusy => personaState == PersonaState.Busy; + + /// + /// Returns true if this friend is marked as snoozing + /// + public bool IsSnoozing => personaState == PersonaState.Snooze; + + /// + /// Returns true if this friend is online and playing this game + /// + public bool IsPlayingThisGame => CurrentAppId == Client.AppId; + + /// + /// Returns true if this friend is online and playing this game + /// + public bool IsPlaying => CurrentAppId != 0; + + /// + /// The AppId this guy is playing + /// + public ulong CurrentAppId { get; internal set; } + + public uint ServerIp { get; internal set; } + public int ServerGamePort { get; internal set; } + public int ServerQueryPort { get; internal set; } + public ulong ServerLobbyId { get; internal set; } + + internal Client Client { get; set; } + private PersonaState personaState; + private FriendRelationship relationship; + + /// + /// Returns null if the value doesn't exist + /// + public string GetRichPresence( string key ) + { + var val = Client.native.friends.GetFriendRichPresence( Id, key ); + if ( string.IsNullOrEmpty( val ) ) return null; + return val; + } + + /// + /// Update this friend, request the latest data from Steam's servers + /// + public void Refresh() + { + Name = Client.native.friends.GetFriendPersonaName( Id ); + + relationship = Client.native.friends.GetFriendRelationship( Id ); + personaState = Client.native.friends.GetFriendPersonaState( Id ); + + CurrentAppId = 0; + ServerIp = 0; + ServerGamePort = 0; + ServerQueryPort = 0; + ServerLobbyId = 0; + + var gameInfo = new SteamNative.FriendGameInfo_t(); + if ( Client.native.friends.GetFriendGamePlayed( Id, ref gameInfo ) && gameInfo.GameID > 0 ) + { + CurrentAppId = gameInfo.GameID; + ServerIp = gameInfo.GameIP; + ServerGamePort = gameInfo.GamePort; + ServerQueryPort = gameInfo.QueryPort; + ServerLobbyId = gameInfo.SteamIDLobby; + } + + Client.native.friends.RequestFriendRichPresence( Id ); + } + + /// + /// This will return null if you don't have the target user's avatar in your cache. + /// Which usually happens for people not on your friends list. + /// + public Image GetAvatar( Friends.AvatarSize size ) + { + return Client.Friends.GetCachedAvatar( size, Id ); + } + + /// + /// Invite this friend to the game that we are playing + /// + public bool InviteToGame(string Text) + { + return Client.native.friends.InviteUserToGame(Id, Text); + } + + /// + /// Sends a message to a Steam friend. Returns true if success + /// + public bool SendMessage( string message ) + { + return Client.native.friends.ReplyToFriendMessage( Id, message ); + } + } +} diff --git a/Facepunch.Steamworks/Config.cs b/Facepunch.Steamworks/Config.cs index 6ac0dee..8bf4f54 100644 --- a/Facepunch.Steamworks/Config.cs +++ b/Facepunch.Steamworks/Config.cs @@ -18,11 +18,6 @@ public static void ForUnity( string platform ) // 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 ); } @@ -36,9 +31,14 @@ public static void ForUnity( string platform ) ForcePlatform( OperatingSystem.Linux, IntPtr.Size == 4 ? Architecture.x86 : Architecture.x64 ); } + IsUnity = true; + UseThisCall = true; + Console.WriteLine( "Facepunch.Steamworks Unity: " + platform ); Console.WriteLine( "Facepunch.Steamworks Os: " + SteamNative.Platform.Os ); Console.WriteLine( "Facepunch.Steamworks Arch: " + SteamNative.Platform.Arch ); + + } /// @@ -50,7 +50,13 @@ public static void ForUnity( string platform ) /// 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 static bool UseThisCall { get; set; } = SteamNative.Platform.Os == OperatingSystem.Windows; + + + /// + /// Should be true if we're using Unity + /// + internal static bool IsUnity { get; set; } /// diff --git a/Facepunch.Steamworks/Facepunch.Steamworks.csproj b/Facepunch.Steamworks/Facepunch.Steamworks.csproj index a910c47..e72ed9e 100644 --- a/Facepunch.Steamworks/Facepunch.Steamworks.csproj +++ b/Facepunch.Steamworks/Facepunch.Steamworks.csproj @@ -8,6 +8,7 @@ true false + true @@ -26,7 +27,7 @@ - + @@ -35,6 +36,18 @@ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client + Garry Newman + Facepunch.Steamworks + https://github.com/Facepunch/Facepunch.Steamworks + https://github.com/Facepunch/Facepunch.Steamworks/blob/master/LICENSE + https://avatars2.githubusercontent.com/u/3371040 + facepunch;steam;unity;steamworks;valve + 0.7.5 + + + + full + true diff --git a/Facepunch.Steamworks/Interfaces/Inventory.Item.cs b/Facepunch.Steamworks/Interfaces/Inventory.Item.cs index f85754e..84c4383 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.Item.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.Item.cs @@ -11,8 +11,16 @@ public partial class Inventory /// /// An item in your inventory. /// - public struct Item : IEquatable + public class Item : IEquatable { + internal Item( Inventory Inventory, ulong Id, int Quantity, int DefinitionId ) + { + this.Inventory = Inventory; + this.Id = Id; + this.Quantity = Quantity; + this.DefinitionId = DefinitionId; + } + public struct Amount { public Item Item; @@ -24,12 +32,26 @@ public struct Amount public int DefinitionId; + internal Inventory Inventory; + public Dictionary Properties { get; internal set; } + private Definition _cachedDefinition; + /// /// Careful, this might not be available. Especially on a game server. /// - public Definition Definition; + public Definition Definition + { + get + { + if ( _cachedDefinition != null ) + return _cachedDefinition; + + _cachedDefinition = Inventory.FindDefinition( DefinitionId ); + return _cachedDefinition; + } + } public bool TradeLocked; @@ -64,41 +86,68 @@ public override int GetHashCode() return !c1.Equals( c2 ); } + /// + /// Consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed. + /// Once an item is removed it cannot be recovered.This is not for the faint of heart - if your game implements item removal at all, + /// a high-friction UI confirmation process is highly recommended.ConsumeItem can be restricted to certain item definitions or fully + /// blocked via the Steamworks website to minimize support/abuse issues such as the classic "my brother borrowed my laptop and deleted all of my rare items". + /// + public Result Consume( int amount = 1 ) + { + SteamNative.SteamInventoryResult_t resultHandle = -1; + if ( !Inventory.inventory.ConsumeItem( ref resultHandle, Id, (uint)amount ) ) + return null; + + return new Result( Inventory, resultHandle, true ); + } + + /// + /// Split stack into two items + /// + public Result SplitStack( int quantity = 1 ) + { + SteamNative.SteamInventoryResult_t resultHandle = -1; + if ( !Inventory.inventory.TransferItemQuantity( ref resultHandle, Id, (uint)quantity, ulong.MaxValue ) ) + return null; + + return new Result( Inventory, resultHandle, true ); + } + SteamNative.SteamInventoryUpdateHandle_t updateHandle; private void UpdatingProperties() { if (updateHandle != 0) return; - updateHandle = Definition.inventory.inventory.StartUpdateProperties(); + updateHandle = Inventory.inventory.StartUpdateProperties(); } public bool SetProperty( string name, string value ) { UpdatingProperties(); Properties[name] = value.ToString(); - return Definition.inventory.inventory.SetProperty(updateHandle, Id, name, value); + return Inventory.inventory.SetProperty(updateHandle, Id, name, value); } public bool SetProperty(string name, bool value) { UpdatingProperties(); Properties[name] = value.ToString(); - return Definition.inventory.inventory.SetProperty0(updateHandle, Id, name, value); + return Inventory.inventory.SetProperty0(updateHandle, Id, name, value); } public bool SetProperty(string name, long value) { UpdatingProperties(); Properties[name] = value.ToString(); - return Definition.inventory.inventory.SetProperty1(updateHandle, Id, name, value); + return Inventory.inventory.SetProperty1(updateHandle, Id, name, value); } public bool SetProperty(string name, float value) { UpdatingProperties(); Properties[name] = value.ToString(); - return Definition.inventory.inventory.SetProperty2(updateHandle, Id, name, value); + return Inventory.inventory.SetProperty2(updateHandle, Id, name, value); } /// @@ -113,12 +162,12 @@ public bool SubmitProperties() { SteamNative.SteamInventoryResult_t result = -1; - if (!Definition.inventory.inventory.SubmitUpdateProperties(updateHandle, ref result)) + if (!Inventory.inventory.SubmitUpdateProperties(updateHandle, ref result)) { return false; } - Definition.inventory.inventory.DestroyResult(result); + Inventory.inventory.DestroyResult(result); return true; } diff --git a/Facepunch.Steamworks/Interfaces/Inventory.Result.cs b/Facepunch.Steamworks/Interfaces/Inventory.Result.cs index 1c80b94..68935bb 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.Result.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.Result.cs @@ -14,7 +14,7 @@ public class Result : IDisposable internal static Dictionary< int, Result > Pending; internal Inventory inventory; - private SteamNative.SteamInventoryResult_t Handle { get; set; } + private SteamNative.SteamInventoryResult_t Handle { get; set; } = -1; /// /// Called when result is successfully returned @@ -139,9 +139,9 @@ internal void Fill() } } - internal void OnSteamResult( SteamInventoryResultReady_t data, bool error ) + internal void OnSteamResult( SteamInventoryResultReady_t data ) { - var success = data.Result == SteamNative.Result.OK && !error; + var success = data.Result == SteamNative.Result.OK; if ( success ) { @@ -169,8 +169,12 @@ internal unsafe byte[] Serialize() public void Dispose() { - inventory.inventory.DestroyResult( Handle ); - Handle = -1; + if ( Handle != -1 && inventory != null ) + { + inventory.inventory.DestroyResult( Handle ); + Handle = -1; + } + inventory = null; } } @@ -190,15 +194,8 @@ internal Item ItemFrom( SteamInventoryResult_t handle, SteamItemDetails_t detail } } - var item = new Item() - { - Quantity = detail.Quantity, - Id = detail.ItemId, - DefinitionId = detail.Definition, - TradeLocked = ((int)detail.Flags & (int)SteamNative.SteamItemFlags.NoTrade) != 0, - Definition = FindDefinition(detail.Definition), - Properties = props - }; + var item = new Item( this, detail.ItemId, detail.Quantity, detail.Definition ); + item.Properties = props; return item; } diff --git a/Facepunch.Steamworks/Interfaces/Inventory.cs b/Facepunch.Steamworks/Interfaces/Inventory.cs index 97b6837..c0517e3 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.cs @@ -37,25 +37,28 @@ public partial class Inventory : IDisposable internal SteamNative.SteamInventory inventory; - private Stopwatch fetchRetryTimer; - private bool IsServer { get; set; } + public event Action OnDefinitionsUpdated; + internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server ) { IsServer = server; inventory = c; + steamworks.RegisterCallback( onDefinitionsUpdated ); + Result.Pending = new Dictionary(); - inventory.LoadItemDefinitions(); FetchItemDefinitions(); + LoadDefinitions(); UpdatePrices(); if ( !server ) { - SteamNative.SteamInventoryResultReady_t.RegisterCallback( steamworks, onResultReady ); - SteamNative.SteamInventoryFullUpdate_t.RegisterCallback( steamworks, onFullUpdate ); + steamworks.RegisterCallback( onResultReady ); + steamworks.RegisterCallback( onFullUpdate ); + // // Get a list of our items immediately @@ -64,13 +67,41 @@ internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, boo } } + /// + /// Should get called when the definitions get updated from Steam. + /// + private void onDefinitionsUpdated( SteamInventoryDefinitionUpdate_t obj ) + { + LoadDefinitions(); + UpdatePrices(); + + if ( OnDefinitionsUpdated != null ) + { + OnDefinitionsUpdated.Invoke(); + } + } + + private bool LoadDefinitions() + { + var ids = inventory.GetItemDefinitionIDs(); + if ( ids == null ) + return false; + + Definitions = ids.Select( x => CreateDefinition( x ) ).ToArray(); + + foreach ( var def in Definitions ) + { + def.Link( Definitions ); + } + + return true; + } + /// /// We've received a FULL update /// - private void onFullUpdate( SteamInventoryFullUpdate_t data, bool error ) + private void onFullUpdate( SteamInventoryFullUpdate_t data ) { - if ( error ) return; - var result = new Result( this, data.Handle, false ); result.Fill(); @@ -80,15 +111,15 @@ private void onFullUpdate( SteamInventoryFullUpdate_t data, bool error ) /// /// A generic result has returned. /// - private void onResultReady( SteamInventoryResultReady_t data, bool error ) + private void onResultReady( SteamInventoryResultReady_t data ) { if ( Result.Pending.ContainsKey( data.Handle ) ) { var result = Result.Pending[data.Handle]; - result.OnSteamResult( data, error ); + result.OnSteamResult( data ); - if ( !error && data.Result == SteamNative.Result.OK ) + if ( data.Result == SteamNative.Result.OK ) { onResult( result, false ); } @@ -200,22 +231,12 @@ public Definition CreateDefinition( int id ) return new Definition( this, id ); } - internal void FetchItemDefinitions() + /// + /// Fetch item definitions in case new ones have been added since we've initialized + /// + public void FetchItemDefinitions() { - // - // Make sure item definitions are loaded, because we're going to be using them. - // - - var ids = inventory.GetItemDefinitionIDs(); - if ( ids == null ) - return; - - Definitions = ids.Select( x => CreateDefinition( x ) ).ToArray(); - - foreach ( var def in Definitions ) - { - def.Link( Definitions ); - } + inventory.LoadItemDefinitions(); } /// @@ -223,25 +244,7 @@ internal void FetchItemDefinitions() /// public void Update() { - if ( Definitions == null ) - { - // - // Don't try every frame, just try every 10 seconds. - // - { - if ( fetchRetryTimer != null && fetchRetryTimer.Elapsed.TotalSeconds < 10.0f ) - return; - if ( fetchRetryTimer == null ) - fetchRetryTimer = Stopwatch.StartNew(); - - fetchRetryTimer.Reset(); - fetchRetryTimer.Start(); - } - - FetchItemDefinitions(); - inventory.LoadItemDefinitions(); - } } /// @@ -257,7 +260,10 @@ public IEnumerable DefinitionsWithPrices { get { - for( int i=0; i< Definitions.Length; i++ ) + if ( Definitions == null ) + yield break; + + for ( int i=0; i< Definitions.Length; i++ ) { if (Definitions[i].LocalPrice > 0) yield return Definitions[i]; @@ -283,14 +289,19 @@ public static float PriceCategoryToFloat( string price ) } /// - /// You really need me to explain what this does? - /// Use your brains. + /// We might be better off using a dictionary for this, once there's 1000+ definitions /// public Definition FindDefinition( int DefinitionId ) { if ( Definitions == null ) return null; - return Definitions.FirstOrDefault( x => x.Id == DefinitionId ); + for( int i=0; i< Definitions.Length; i++ ) + { + if ( Definitions[i].Id == DefinitionId ) + return Definitions[i]; + } + + return null; } public unsafe Result Deserialize( byte[] data, int dataLength = -1 ) @@ -362,11 +373,7 @@ public Result CraftItem( Item.Amount[] list, Definition target ) /// public Result SplitStack( Item item, int quantity = 1 ) { - SteamNative.SteamInventoryResult_t resultHandle = -1; - if ( !inventory.TransferItemQuantity( ref resultHandle, item.Id, (uint)quantity, ulong.MaxValue ) ) - return null; - - return new Result( this, resultHandle, true ); + return item.SplitStack( quantity ); } /// diff --git a/Facepunch.Steamworks/Interfaces/Networking.cs b/Facepunch.Steamworks/Interfaces/Networking.cs index 8d3b0c4..ee8bca2 100644 --- a/Facepunch.Steamworks/Interfaces/Networking.cs +++ b/Facepunch.Steamworks/Interfaces/Networking.cs @@ -26,8 +26,8 @@ internal Networking( BaseSteamworks steamworks, SteamNative.SteamNetworking netw { this.networking = networking; - SteamNative.P2PSessionRequest_t.RegisterCallback( steamworks, onP2PConnectionRequest ); - SteamNative.P2PSessionConnectFail_t.RegisterCallback( steamworks, onP2PConnectionFailed ); + steamworks.RegisterCallback( onP2PConnectionRequest ); + steamworks.RegisterCallback( onP2PConnectionFailed ); } public void Dispose() @@ -80,7 +80,7 @@ public void SetListenChannel( int ChannelId, bool Listen ) } } - private void onP2PConnectionRequest( SteamNative.P2PSessionRequest_t o, bool b ) + private void onP2PConnectionRequest( SteamNative.P2PSessionRequest_t o ) { if ( OnIncomingConnection != null ) { @@ -116,7 +116,7 @@ public enum SessionError : byte Max = 5 }; - private void onP2PConnectionFailed( SteamNative.P2PSessionConnectFail_t o, bool b ) + private void onP2PConnectionFailed( SteamNative.P2PSessionConnectFail_t o ) { if ( OnConnectionFailed != null ) { @@ -186,5 +186,14 @@ private unsafe bool ReadP2PPacket( int channel ) return true; } } + + /// + /// This should be called when you're done communicating with a user, as this will free up all of the resources allocated for the connection under-the-hood. + /// If the remote user tries to send data to you again, a new onP2PConnectionRequest callback will be posted. + /// + public bool CloseSession( ulong steamId ) + { + return networking.CloseP2PSessionWithUser( steamId ); + } } } diff --git a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs index 21d943d..24fda87 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs @@ -48,19 +48,20 @@ internal static Item From( SteamNative.SteamUGCDetails_t details, Workshop works return item; } - public void Download( bool highPriority = true ) + public bool Download( bool highPriority = true ) { - if ( Installed ) return; - if ( Downloading ) return; + if ( Installed ) return true; + if ( Downloading ) return true; if ( !workshop.ugc.DownloadItem( Id, highPriority ) ) { Console.WriteLine( "Download Failed" ); - return; + return false; } workshop.OnFileDownloaded += OnFileDownloaded; workshop.OnItemInstalled += OnItemInstalled; + return true; } public void Subscribe() diff --git a/Facepunch.Steamworks/Interfaces/Workshop.cs b/Facepunch.Steamworks/Interfaces/Workshop.cs index c32713a..64ae67e 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.cs @@ -46,8 +46,8 @@ internal Workshop( BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNat this.steamworks = steamworks; this.remoteStorage = remoteStorage; - SteamNative.DownloadItemResult_t.RegisterCallback( steamworks, onDownloadResult ); - SteamNative.ItemInstalled_t.RegisterCallback( steamworks, onItemInstalled ); + steamworks.RegisterCallback( onDownloadResult ); + steamworks.RegisterCallback( onItemInstalled ); } /// @@ -64,13 +64,13 @@ public void Dispose() OnItemInstalled = null; } - private void onItemInstalled( SteamNative.ItemInstalled_t obj, bool failed ) + private void onItemInstalled( SteamNative.ItemInstalled_t obj ) { if ( OnItemInstalled != null && obj.AppID == Client.Instance.AppId ) OnItemInstalled( obj.PublishedFileId ); } - private void onDownloadResult( SteamNative.DownloadItemResult_t obj, bool failed ) + private void onDownloadResult( SteamNative.DownloadItemResult_t obj ) { if ( OnFileDownloaded != null && obj.AppID == Client.Instance.AppId ) OnFileDownloaded( obj.PublishedFileId, (Callbacks.Result) obj.Result ); diff --git a/Facepunch.Steamworks/Interop/ServerRules.cs b/Facepunch.Steamworks/Interop/ServerRules.cs deleted file mode 100644 index 2cdb16a..0000000 --- a/Facepunch.Steamworks/Interop/ServerRules.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Runtime.InteropServices; -using System.Text; - -namespace Facepunch.Steamworks.Interop -{ - class ServerRules : IDisposable - { - // Pins and pointers for the created vtable - private GCHandle vTablePin; - private IntPtr vTablePtr; - - // Pins for the functions - private GCHandle RulesRespondPin; - private GCHandle FailedRespondPin; - private GCHandle CompletePin; - - // The server that called us - private ServerList.Server Server; - - public ServerRules( ServerList.Server server, IPAddress address, int queryPort ) - { - Server = server; - - // - // Create a fake VTable to pass to c++ - // - InstallVTable(); - - // - // Ask Steam to get the server rules, respond to our fake vtable - // - Server.Client.native.servers.ServerRules( Utility.IpToInt32( address ), (ushort)queryPort, GetPtr() ); - } - - public void Dispose() - { - if ( vTablePtr != IntPtr.Zero ) - { - Marshal.FreeHGlobal( vTablePtr ); - vTablePtr = IntPtr.Zero; - } - - if ( vTablePin.IsAllocated ) - vTablePin.Free(); - - if ( RulesRespondPin.IsAllocated ) - RulesRespondPin.Free(); - - if ( FailedRespondPin.IsAllocated ) - FailedRespondPin.Free(); - - if ( CompletePin.IsAllocated ) - CompletePin.Free(); - } - - void InstallVTable() - { - - // - // Depending on platform, we either use ThisCall or stdcall. - // This is a bit of a fuckabout but you need to define Client.UseThisCall - // - - if ( Config.UseThisCall ) - { - ThisVTable.InternalRulesResponded da = ( _, k, v ) => InternalOnRulesResponded( k, v ); - ThisVTable.InternalRulesFailedToRespond db = ( _ ) => InternalOnRulesFailedToRespond(); - ThisVTable.InternalRulesRefreshComplete dc = ( _ ) => InternalOnRulesRefreshComplete(); - - RulesRespondPin = GCHandle.Alloc( da ); - FailedRespondPin = GCHandle.Alloc( db ); - CompletePin = GCHandle.Alloc( dc ); - - var t = new ThisVTable() - { - m_VTRulesResponded = da, - m_VTRulesFailedToRespond = db, - m_VTRulesRefreshComplete = dc, - }; - vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( ThisVTable ) ) ); - Marshal.StructureToPtr( t, vTablePtr, false ); - - vTablePin = GCHandle.Alloc( vTablePtr, GCHandleType.Pinned ); - - } - else - { - StdVTable.InternalRulesResponded da = InternalOnRulesResponded; - StdVTable.InternalRulesFailedToRespond db = InternalOnRulesFailedToRespond; - StdVTable.InternalRulesRefreshComplete dc = InternalOnRulesRefreshComplete; - - RulesRespondPin = GCHandle.Alloc( da ); - FailedRespondPin = GCHandle.Alloc( db ); - CompletePin = GCHandle.Alloc( dc ); - - var t = new StdVTable() - { - m_VTRulesResponded = da, - m_VTRulesFailedToRespond = db, - m_VTRulesRefreshComplete = dc - }; - vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( StdVTable ) ) ); - Marshal.StructureToPtr( t, vTablePtr, false ); - - vTablePin = GCHandle.Alloc( vTablePtr, GCHandleType.Pinned ); - } - } - - private void InternalOnRulesResponded( string k, string v ) - { - Server.Rules.Add( k, v ); - } - private void InternalOnRulesFailedToRespond() - { - Server.OnServerRulesReceiveFinished( false ); - } - private void InternalOnRulesRefreshComplete() - { - Server.OnServerRulesReceiveFinished( true ); - } - - [StructLayout( LayoutKind.Sequential )] - private class StdVTable - { - [MarshalAs(UnmanagedType.FunctionPtr)] - public InternalRulesResponded m_VTRulesResponded; - - [MarshalAs(UnmanagedType.FunctionPtr)] - public InternalRulesFailedToRespond m_VTRulesFailedToRespond; - - [MarshalAs(UnmanagedType.FunctionPtr)] - public InternalRulesRefreshComplete m_VTRulesRefreshComplete; - - [UnmanagedFunctionPointer( CallingConvention.StdCall )] - public delegate void InternalRulesResponded( string pchRule, string pchValue ); - [UnmanagedFunctionPointer( CallingConvention.StdCall )] - public delegate void InternalRulesFailedToRespond(); - [UnmanagedFunctionPointer( CallingConvention.StdCall )] - public delegate void InternalRulesRefreshComplete(); - } - - [StructLayout( LayoutKind.Sequential )] - private class ThisVTable - { - [MarshalAs(UnmanagedType.FunctionPtr)] - public InternalRulesResponded m_VTRulesResponded; - - [MarshalAs(UnmanagedType.FunctionPtr)] - public InternalRulesFailedToRespond m_VTRulesFailedToRespond; - - [MarshalAs(UnmanagedType.FunctionPtr)] - public InternalRulesRefreshComplete m_VTRulesRefreshComplete; - - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] - public delegate void InternalRulesResponded( IntPtr thisptr, string pchRule, string pchValue ); - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] - public delegate void InternalRulesFailedToRespond( IntPtr thisptr ); - [UnmanagedFunctionPointer( CallingConvention.ThisCall )] - public delegate void InternalRulesRefreshComplete( IntPtr thisptr ); - } - - public System.IntPtr GetPtr() - { - return vTablePin.AddrOfPinnedObject(); - } - }; -} diff --git a/Facepunch.Steamworks/Server.cs b/Facepunch.Steamworks/Server.cs index 900a983..e2091c0 100644 --- a/Facepunch.Steamworks/Server.cs +++ b/Facepunch.Steamworks/Server.cs @@ -33,13 +33,15 @@ public Server( uint appId, ServerInit init) : base( appId ) Instance = this; native = new Interop.NativeInterface(); + uint ipaddress = 0; // Any Port if ( init.SteamPort == 0 ) init.RandomSteamPort(); + if ( init.IpAddress != null ) ipaddress = Utility.IpToInt32( init.IpAddress ); // // Get other interfaces // - if ( !native.InitServer( this, init.IpAddress, init.SteamPort, init.GamePort, init.QueryPort, init.Secure ? 3 : 2, init.VersionString ) ) + if ( !native.InitServer( this, ipaddress, init.SteamPort, init.GamePort, init.QueryPort, init.Secure ? 3 : 2, init.VersionString ) ) { native.Dispose(); native = null; @@ -47,15 +49,18 @@ public Server( uint appId, ServerInit init) : base( appId ) return; } + // + // Register Callbacks + // + + SteamNative.Callbacks.RegisterCallbacks( this ); + // // Setup interfaces that client and server both have // SetupCommonInterfaces(); - // - // Cache common, unchanging info - // - AppId = appId; + // // Initial settings @@ -82,6 +87,11 @@ public Server( uint appId, ServerInit init) : base( appId ) Update(); } + ~Server() + { + Dispose(); + } + /// /// Should be called at least once every frame /// @@ -255,6 +265,8 @@ public void UpdatePlayer( ulong steamid, string name, int score ) /// public override void Dispose() { + if ( disposed ) return; + if ( Query != null ) { Query = null; @@ -290,7 +302,7 @@ public System.Net.IPAddress PublicIp var ip = native.gameServer.GetPublicIP(); if ( ip == 0 ) return null; - return new System.Net.IPAddress( Utility.SwapBytes( ip ) ); + return Utility.Int32ToIp( ip ); } } diff --git a/Facepunch.Steamworks/Server/Auth.cs b/Facepunch.Steamworks/Server/Auth.cs index 24ded75..f94cddc 100644 --- a/Facepunch.Steamworks/Server/Auth.cs +++ b/Facepunch.Steamworks/Server/Auth.cs @@ -35,10 +35,10 @@ internal ServerAuth( Server s ) { server = s; - SteamNative.ValidateAuthTicketResponse_t.RegisterCallback( server, OnAuthTicketValidate ); + server.RegisterCallback( OnAuthTicketValidate ); } - void OnAuthTicketValidate( SteamNative.ValidateAuthTicketResponse_t data, bool b ) + void OnAuthTicketValidate( SteamNative.ValidateAuthTicketResponse_t data ) { if ( OnAuthChange != null ) OnAuthChange( data.SteamID, data.OwnerSteamID, (Status) data.AuthSessionResponse ); diff --git a/Facepunch.Steamworks/Server/ServerInit.cs b/Facepunch.Steamworks/Server/ServerInit.cs index cb37dee..cf1f99b 100644 --- a/Facepunch.Steamworks/Server/ServerInit.cs +++ b/Facepunch.Steamworks/Server/ServerInit.cs @@ -13,7 +13,7 @@ namespace Facepunch.Steamworks /// public class ServerInit { - public uint IpAddress = 0; + public IPAddress IpAddress; public ushort SteamPort; public ushort GamePort = 27015; public ushort QueryPort = 27016; diff --git a/Facepunch.Steamworks/Server/Stats.cs b/Facepunch.Steamworks/Server/Stats.cs index 22c25ec..e30a22d 100644 --- a/Facepunch.Steamworks/Server/Stats.cs +++ b/Facepunch.Steamworks/Server/Stats.cs @@ -113,40 +113,34 @@ public float GetFloat( ulong steamid, string name, float defaultValue = 0 ) } /// - /// Resets the unlock state of an achievement for the given user. Useful mainly for testing purposes. - /// If the "set by" field says "Official GS", only a registerd server IP may do this. - /// You should have called Refresh for this userid - which downloads the stats from the backend. - /// If you didn't call it this will always return false. + /// Unlocks the specified achievement for the specified user. Must have called Refresh on a steamid first. + /// Remember to use Commit after use. /// - public bool ClearUserAchievement(ulong steamid, string name) + public bool SetAchievement( ulong steamid, string name ) { - return server.native.gameServerStats.ClearUserAchievement(steamid, name); + return server.native.gameServerStats.SetUserAchievement( steamid, name ); } /// - /// Awards an achievement for the given user. The achievement must have been set up in the steam backand. - /// If the "set by" field says "Official GS", only a registerd server IP may do this. - /// You should have called Refresh for this userid - which downloads the stats from the backend. - /// If you didn't call it this will always return false. + /// Resets the unlock status of an achievement for the specified user. Must have called Refresh on a steamid first. + /// Remember to use Commit after use. /// - public bool SetUserAchievement(ulong steamid, string name) + public bool ClearAchievement( ulong steamid, string name ) { - return server.native.gameServerStats.SetUserAchievement(steamid, name); + return server.native.gameServerStats.ClearUserAchievement( steamid, name ); } /// - /// Returns true if the given user has the given achievement unlocked. The achievement must have been set up in the steam backand. - /// You should have called Refresh for this userid - which downloads the stats from the backend. - /// If you didn't call it this will always return false. + /// Return true if available, exists and unlocked /// - public bool GetUserAchievement(ulong steamid, string name) + public bool GetAchievement( ulong steamid, string name ) { - bool result = false; - if(!server.native.gameServerStats.GetUserAchievement(steamid, name, ref result)) + bool achieved = false; + + if ( !server.native.gameServerStats.GetUserAchievement( steamid, name, ref achieved ) ) return false; - return result; + return achieved; } - } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Callback.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Callback.cs index 9d89b07..238b63f 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Callback.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Callback.cs @@ -20,29 +20,50 @@ internal enum Flags : byte [StructLayout( LayoutKind.Sequential, Pack = 1 )] public class VTable { - public IntPtr ResultA; - public IntPtr ResultB; - public IntPtr GetSize; + [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam ); + [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall ); + [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD(); + + public ResultD ResultA; + public ResultWithInfoD ResultB; + public GetSizeD GetSize; } - // - // All possible functions - // - internal class ThisCall + [StructLayout( LayoutKind.Sequential, Pack = 1 )] + public class VTableWin { - [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 ); + [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam ); + [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall ); + [UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD(); + + public ResultWithInfoD ResultB; + public ResultD ResultA; + public GetSizeD GetSize; } - internal class StdCall + [StructLayout( LayoutKind.Sequential, Pack = 1 )] + public class VTableThis { - [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(); + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam ); + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall ); + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr ); + + public ResultD ResultA; + public ResultWithInfoD ResultB; + public GetSizeD GetSize; } + [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, SteamNative.SteamAPICall_t hSteamAPICall ); + [UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr ); + public ResultWithInfoD ResultB; + public ResultD ResultA; + public GetSizeD GetSize; + } }; // @@ -50,21 +71,23 @@ internal class StdCall // internal class CallbackHandle : IDisposable { - internal BaseSteamworks steamworks; - internal SteamAPICall_t CallResultHandle; - internal bool CallResult; + internal BaseSteamworks Steamworks; + + // Get Rid internal GCHandle FuncA; internal GCHandle FuncB; internal GCHandle FuncC; internal IntPtr vTablePtr; internal GCHandle PinnedCallback; + internal CallbackHandle( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + Steamworks = steamworks; + } + public void Dispose() { - if ( CallResult ) - UnregisterCallResult(); - else - UnregisterCallback(); + UnregisterCallback(); if ( FuncA.IsAllocated ) FuncA.Free(); @@ -90,19 +113,86 @@ private void UnregisterCallback() if ( !PinnedCallback.IsAllocated ) return; - steamworks.native.api.SteamAPI_UnregisterCallback( PinnedCallback.AddrOfPinnedObject() ); + Steamworks.native.api.SteamAPI_UnregisterCallback( PinnedCallback.AddrOfPinnedObject() ); } - private void UnregisterCallResult() + public virtual bool IsValid { get { return true; } } + } + + internal abstract class CallResult : CallbackHandle + { + internal SteamAPICall_t Call; + public override bool IsValid { get { return Call > 0; } } + + + internal CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call ) : base( steamworks ) { - if ( CallResultHandle == 0 ) + Call = call; + } + + internal void Try() + { + bool failed = false; + + if ( !Steamworks.native.utils.IsAPICallCompleted( Call, ref failed )) return; - if ( !PinnedCallback.IsAllocated ) - return; + Steamworks.UnregisterCallResult( this ); - steamworks.native.api.SteamAPI_UnregisterCallResult( PinnedCallback.AddrOfPinnedObject(), CallResultHandle ); + RunCallback(); + } + + internal abstract void RunCallback(); + } + + + internal class CallResult : CallResult + { + private static byte[] resultBuffer = new byte[1024 * 16]; + + internal delegate T ConvertFromPointer( IntPtr p ); + + Action CallbackFunction; + ConvertFromPointer ConvertFromPointerFunction; + + internal int ResultSize = -1; + internal int CallbackId = 0; + + internal CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action callbackFunction, ConvertFromPointer fromPointer, int resultSize, int callbackId ) : base( steamworks, call ) + { + ResultSize = resultSize; + CallbackId = callbackId; + CallbackFunction = callbackFunction; + ConvertFromPointerFunction = fromPointer; + + Steamworks.RegisterCallResult( this ); + } + + public override string ToString() + { + return $"CallResult( {typeof(T).Name}, {CallbackId}, {ResultSize}b )"; + } + + unsafe internal override void RunCallback() + { + bool failed = false; + + fixed ( byte* ptr = resultBuffer ) + { + if ( !Steamworks.native.utils.GetAPICallResult( Call, (IntPtr)ptr, resultBuffer.Length, CallbackId, ref failed ) || failed ) + { + CallbackFunction( default(T), true ); + return; + } + + var val = ConvertFromPointerFunction( (IntPtr)ptr ); + CallbackFunction( val, false ); + } } } + internal class MonoPInvokeCallbackAttribute : Attribute + { + public MonoPInvokeCallbackAttribute() { } + } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs index 411274d..802775a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs @@ -41,6 +41,7 @@ internal static class CallbackIdentifiers public const int ClientRemoteClientManager = 3300; public const int ClientUGC = 3400; public const int SteamStreamClient = 3500; + public const int ClientProductBuilder = 3600; public const int ClientShortcuts = 3700; public const int ClientRemoteControlManager = 3800; public const int SteamAppList = 3900; @@ -54,6 +55,7 @@ internal static class CallbackIdentifiers public const int ClientInventory = 4700; public const int ClientBluetoothManager = 4800; public const int ClientSharedConnection = 4900; + public const int SteamParentalSettings = 5000; public const int ClientShader = 5100; } internal static class Defines diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs index d990c9e..cef1b83 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs @@ -4263,799 +4263,799 @@ internal static unsafe class Native // // ISteamClient // - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); // // ISteamUser // - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); // // ISteamFriends // - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t.PackSmall /*struct FriendGameInfo_t **/ pFriendGameInfo ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t.PackSmall /*struct FriendGameInfo_t **/ pFriendGameInfo ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); // // ISteamUtils // - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); // // ISteamMatchmaking // - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); // // ISteamMatchmakingServers // - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); // // ISteamRemoteStorage // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pExcludedTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pUserTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pExcludedTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pUserTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); // // ISteamUserStats // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t.PackSmall /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t.PackSmall /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); // // ISteamApps // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); // // ISteamNetworking // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t.PackSmall /*struct P2PSessionState_t **/ pConnectionState ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t.PackSmall /*struct P2PSessionState_t **/ pConnectionState ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); // // ISteamScreenshots // - [DllImportAttribute( "libsteam_api.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); // // ISteamMusic // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); // // ISteamMusicRemote // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); // // ISteamHTTP // - [DllImportAttribute( "libsteam_api.so" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); // // ISteamController // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); // // ISteamUGC // - [DllImportAttribute( "libsteam_api.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t.PackSmall /*struct SteamUGCDetails_t **/ pDetails ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*const struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t.PackSmall /*struct SteamUGCDetails_t **/ pDetails ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*const struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); // // ISteamAppList // - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); // // ISteamHTMLSurface // - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); // // ISteamInventory // - [DllImportAttribute( "libsteam_api.so" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); // // ISteamVideo // - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); // // ISteamParentalSettings // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); // // ISteamGameServer // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); // // ISteamGameServerStats // - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); // // SteamApi // - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_Init(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_Shutdown(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); - [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_Init(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_Shutdown(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamGameServer_Shutdown(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); + [DllImport( "libsteam_api.so", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs index cb38993..3b155bf 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs @@ -4263,799 +4263,799 @@ internal static unsafe class Native // // ISteamClient // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); // // ISteamUser // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "libsteam_api64.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "libsteam_api64.so" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api64.so" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); + [DllImport( "libsteam_api64.so" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); // // ISteamFriends // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t.PackSmall /*struct FriendGameInfo_t **/ pFriendGameInfo ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); + [DllImport( "libsteam_api64.so" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api64.so" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t.PackSmall /*struct FriendGameInfo_t **/ pFriendGameInfo ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); // // ISteamUtils // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); + [DllImport( "libsteam_api64.so" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); // // ISteamMatchmaking // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); // // ISteamMatchmakingServers // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); // // ISteamRemoteStorage // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pExcludedTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pUserTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); + [DllImport( "libsteam_api64.so" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api64.so" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); + [DllImport( "libsteam_api64.so" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pExcludedTags ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pUserTags ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); // // ISteamUserStats // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t.PackSmall /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api64.so" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api64.so" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t.PackSmall /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); // // ISteamApps // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); // // ISteamNetworking // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t.PackSmall /*struct P2PSessionState_t **/ pConnectionState ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t.PackSmall /*struct P2PSessionState_t **/ pConnectionState ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); + [DllImport( "libsteam_api64.so" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "libsteam_api64.so" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "libsteam_api64.so" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); + [DllImport( "libsteam_api64.so" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); // // ISteamScreenshots // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); + [DllImport( "libsteam_api64.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "libsteam_api64.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); + [DllImport( "libsteam_api64.so" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); // // ISteamMusic // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); + [DllImport( "libsteam_api64.so" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); // // ISteamMusicRemote // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); // // ISteamHTTP // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); + [DllImport( "libsteam_api64.so" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); + [DllImport( "libsteam_api64.so" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); // // ISteamController // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); + [DllImport( "libsteam_api64.so" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); // // ISteamUGC // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t.PackSmall /*struct SteamUGCDetails_t **/ pDetails ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*const struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "libsteam_api64.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "libsteam_api64.so" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t.PackSmall /*struct SteamUGCDetails_t **/ pDetails ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); + [DllImport( "libsteam_api64.so" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*const struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); + [DllImport( "libsteam_api64.so" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); // // ISteamAppList // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); // // ISteamHTMLSurface // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); // // ISteamInventory // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); // // ISteamVideo // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); // // ISteamParentalSettings // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); // // ISteamGameServer // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); + [DllImport( "libsteam_api64.so" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); + [DllImport( "libsteam_api64.so" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api64.so" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); + [DllImport( "libsteam_api64.so" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); + [DllImport( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); // // ISteamGameServerStats // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); // // SteamApi // - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_Init(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_Shutdown(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_Init(); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_Shutdown(); + [DllImport( "libsteam_api64.so" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); + [DllImport( "libsteam_api64.so" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); + [DllImport( "libsteam_api64.so" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); + [DllImport( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs index d475f22..989ad11 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs @@ -4263,799 +4263,799 @@ internal static unsafe class Native // // ISteamClient // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); // // ISteamUser // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "libsteam_api.dylib" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "libsteam_api.dylib" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api.dylib" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); + [DllImport( "libsteam_api.dylib" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); // // ISteamFriends // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t.PackSmall /*struct FriendGameInfo_t **/ pFriendGameInfo ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); + [DllImport( "libsteam_api.dylib" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api.dylib" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t.PackSmall /*struct FriendGameInfo_t **/ pFriendGameInfo ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); // // ISteamUtils // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); + [DllImport( "libsteam_api.dylib" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); // // ISteamMatchmaking // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); // // ISteamMatchmakingServers // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); // // ISteamRemoteStorage // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pExcludedTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pUserTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); + [DllImport( "libsteam_api.dylib" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); + [DllImport( "libsteam_api.dylib" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); + [DllImport( "libsteam_api.dylib" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pExcludedTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t.PackSmall /*struct SteamParamStringArray_t **/ pUserTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); // // ISteamUserStats // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t.PackSmall /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.dylib" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.dylib" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t.PackSmall /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); // // ISteamApps // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); // // ISteamNetworking // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t.PackSmall /*struct P2PSessionState_t **/ pConnectionState ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t.PackSmall /*struct P2PSessionState_t **/ pConnectionState ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); + [DllImport( "libsteam_api.dylib" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "libsteam_api.dylib" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "libsteam_api.dylib" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); + [DllImport( "libsteam_api.dylib" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); // // ISteamScreenshots // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); + [DllImport( "libsteam_api.dylib" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "libsteam_api.dylib" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); + [DllImport( "libsteam_api.dylib" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); // // ISteamMusic // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); + [DllImport( "libsteam_api.dylib" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); // // ISteamMusicRemote // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); // // ISteamHTTP // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); + [DllImport( "libsteam_api.dylib" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); // // ISteamController // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); + [DllImport( "libsteam_api.dylib" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); // // ISteamUGC // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t.PackSmall /*struct SteamUGCDetails_t **/ pDetails ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*const struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "libsteam_api.dylib" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "libsteam_api.dylib" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t.PackSmall /*struct SteamUGCDetails_t **/ pDetails ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); + [DllImport( "libsteam_api.dylib" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t.PackSmall /*const struct SteamParamStringArray_t **/ pTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); + [DllImport( "libsteam_api.dylib" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); // // ISteamAppList // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); // // ISteamHTMLSurface // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); // // ISteamInventory // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); // // ISteamVideo // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); // // ISteamParentalSettings // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); // // ISteamGameServer // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); + [DllImport( "libsteam_api.dylib" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "libsteam_api.dylib" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); + [DllImport( "libsteam_api.dylib" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); + [DllImport( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); // // ISteamGameServerStats // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); // // SteamApi // - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_Init(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_Shutdown(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_Init(); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_Shutdown(); + [DllImport( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); + [DllImport( "libsteam_api.dylib" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); + [DllImport( "libsteam_api.dylib" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); + [DllImport( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs index 750b297..8343ee2 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs @@ -4229,799 +4229,799 @@ internal static unsafe class Native // // ISteamClient // - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); // // ISteamUser // - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "steam_api.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "steam_api.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); // // ISteamFriends // - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t /*struct FriendGameInfo_t **/ pFriendGameInfo ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t /*struct FriendGameInfo_t **/ pFriendGameInfo ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); // // ISteamUtils // - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); - [DllImportAttribute( "steam_api.dll" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); // // ISteamMatchmaking // - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); // // ISteamMatchmakingServers // - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); // // ISteamRemoteStorage // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pExcludedTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pUserTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pExcludedTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pUserTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); // // ISteamUserStats // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api.dll" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api.dll" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); // // ISteamApps // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); // // ISteamNetworking // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t /*struct P2PSessionState_t **/ pConnectionState ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t /*struct P2PSessionState_t **/ pConnectionState ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); // // ISteamScreenshots // - [DllImportAttribute( "steam_api.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); // // ISteamMusic // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); - [DllImportAttribute( "steam_api.dll" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); // // ISteamMusicRemote // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); // // ISteamHTTP // - [DllImportAttribute( "steam_api.dll" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); // // ISteamController // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); // // ISteamUGC // - [DllImportAttribute( "steam_api.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t /*struct SteamUGCDetails_t **/ pDetails ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t /*const struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); - [DllImportAttribute( "steam_api.dll" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t /*struct SteamUGCDetails_t **/ pDetails ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t /*const struct SteamParamStringArray_t **/ pTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); // // ISteamAppList // - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); // // ISteamHTMLSurface // - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); // // ISteamInventory // - [DllImportAttribute( "steam_api.dll" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); // // ISteamVideo // - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); // // ISteamParentalSettings // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); // // ISteamGameServer // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); - [DllImportAttribute( "steam_api.dll" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); - [DllImportAttribute( "steam_api.dll" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); - [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); // // ISteamGameServerStats // - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); // // SteamApi // - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_Init(); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_Shutdown(); - [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); - [DllImportAttribute( "steam_api.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); - [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_Init(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamAPI_Shutdown(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern void /*void*/ SteamGameServer_Shutdown(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); + [DllImport( "steam_api.dll", CallingConvention = CallingConvention.Cdecl )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs index dbfcb38..9b5fd80 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs @@ -4229,799 +4229,799 @@ internal static unsafe class Native // // ISteamClient // - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_ISteamClient_CreateSteamPipe( IntPtr ISteamClient ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr ISteamClient, int hSteamPipe ); + [DllImport( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamClient_CreateLocalUser( IntPtr ISteamClient, out int phSteamPipe, AccountType /*EAccountType*/ eAccountType ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_ReleaseUser( IntPtr ISteamClient, int hSteamPipe, int hUser ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUser **/ SteamAPI_ISteamClient_GetISteamUser( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamGameServer **/ SteamAPI_ISteamClient_GetISteamGameServer( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr ISteamClient, uint /*uint32*/ unIP, ushort /*uint16*/ usPort ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamFriends **/ SteamAPI_ISteamClient_GetISteamFriends( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUtils **/ SteamAPI_ISteamClient_GetISteamUtils( IntPtr ISteamClient, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMatchmaking **/ SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMatchmakingServers **/ SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*void **/ SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUserStats **/ SteamAPI_ISteamClient_GetISteamUserStats( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamGameServerStats **/ SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamApps **/ SteamAPI_ISteamClient_GetISteamApps( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamNetworking **/ SteamAPI_ISteamClient_GetISteamNetworking( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamRemoteStorage **/ SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamScreenshots **/ SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamClient_GetIPCCallCount( IntPtr ISteamClient ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamClient_SetWarningMessageHook( IntPtr ISteamClient, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr ISteamClient ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamHTTP **/ SteamAPI_ISteamClient_GetISteamHTTP( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamController **/ SteamAPI_ISteamClient_GetISteamController( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamUGC **/ SteamAPI_ISteamClient_GetISteamUGC( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamAppList **/ SteamAPI_ISteamClient_GetISteamAppList( IntPtr ISteamClient, int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMusic **/ SteamAPI_ISteamClient_GetISteamMusic( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamMusicRemote **/ SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamHTMLSurface **/ SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamInventory **/ SteamAPI_ISteamClient_GetISteamInventory( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamVideo **/ SteamAPI_ISteamClient_GetISteamVideo( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class ISteamParentalSettings **/ SteamAPI_ISteamClient_GetISteamParentalSettings( IntPtr ISteamClient, int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion ); // // ISteamUser // - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_ISteamUser_GetHSteamUser( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BLoggedOn( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamUser_GetSteamID( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_InitiateGameConnection( IntPtr ISteamUser, IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TerminateGameConnection( IntPtr ISteamUser, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_TrackAppUsageEvent( IntPtr ISteamUser, ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetUserDataFolder( IntPtr ISteamUser, System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StartVoiceRecording( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_StopVoiceRecording( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetAvailableVoice( IntPtr ISteamUser, out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "steam_api64.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_GetVoice( IntPtr ISteamUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated ); + [DllImport( "steam_api64.dll" )] internal static extern VoiceResult /*EVoiceResult*/ SteamAPI_ISteamUser_DecompressVoice( IntPtr ISteamUser, IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUser_GetVoiceOptimalSampleRate( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamUser_GetAuthSessionTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "steam_api64.dll" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamUser_BeginAuthSession( IntPtr ISteamUser, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_EndAuthSession( IntPtr ISteamUser, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_CancelAuthTicket( IntPtr ISteamUser, uint hAuthTicket ); + [DllImport( "steam_api64.dll" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamUser_UserHasLicenseForApp( IntPtr ISteamUser, ulong steamID, uint appID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsBehindNAT( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUser_AdvertiseGame( IntPtr ISteamUser, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_GetEncryptedAppTicket( IntPtr ISteamUser, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetGameBadgeLevel( IntPtr ISteamUser, int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUser_GetPlayerSteamLevel( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUser_RequestStoreAuthURL( IntPtr ISteamUser, string /*const char **/ pchRedirectURL ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneVerified( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsTwoFactorEnabled( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneIdentifying( IntPtr ISteamUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUser_BIsPhoneRequiringVerification( IntPtr ISteamUser ); // // ISteamFriends // - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t /*struct FriendGameInfo_t **/ pFriendGameInfo ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPersonaName( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_SetPersonaName( IntPtr ISteamFriends, string /*const char **/ pchPersonaName ); + [DllImport( "steam_api64.dll" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetPersonaState( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCount( IntPtr ISteamFriends, int /*int*/ iFriendFlags ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendByIndex( IntPtr ISteamFriends, int /*int*/ iFriend, int /*int*/ iFriendFlags ); + [DllImport( "steam_api64.dll" )] internal static extern FriendRelationship /*EFriendRelationship*/ SteamAPI_ISteamFriends_GetFriendRelationship( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern PersonaState /*EPersonaState*/ SteamAPI_ISteamFriends_GetFriendPersonaState( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaName( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetFriendGamePlayed( IntPtr ISteamFriends, ulong steamIDFriend, ref FriendGameInfo_t /*struct FriendGameInfo_t **/ pFriendGameInfo ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendPersonaNameHistory( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iPersonaName ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendSteamLevel( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetPlayerNickname( IntPtr ISteamFriends, ulong steamIDPlayer ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupCount( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern FriendsGroupID_t /*(FriendsGroupID_t)*/ SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex( IntPtr ISteamFriends, int /*int*/ iFG ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendsGroupName( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersCount( IntPtr ISteamFriends, short friendsGroupID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_GetFriendsGroupMembersList( IntPtr ISteamFriends, short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_HasFriend( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iFriendFlags ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanCount( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanByIndex( IntPtr ISteamFriends, int /*int*/ iClan ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanName( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetClanTag( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_GetClanActivityCounts( IntPtr ISteamFriends, ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_DownloadClanActivityCounts( IntPtr ISteamFriends, IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCountFromSource( IntPtr ISteamFriends, ulong steamIDSource ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetFriendFromSourceByIndex( IntPtr ISteamFriends, ulong steamIDSource, int /*int*/ iFriend ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsUserInSource( IntPtr ISteamFriends, ulong steamIDUser, ulong steamIDSource ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetInGameVoiceSpeaking( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlay( IntPtr ISteamFriends, string /*const char **/ pchDialog ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToUser( IntPtr ISteamFriends, string /*const char **/ pchDialog, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( IntPtr ISteamFriends, string /*const char **/ pchURL ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayToStore( IntPtr ISteamFriends, uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_SetPlayedWith( IntPtr ISteamFriends, ulong steamIDUserPlayedWith ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog( IntPtr ISteamFriends, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetSmallFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetMediumFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetLargeFriendAvatar( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_RequestUserInformation( IntPtr ISteamFriends, ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_RequestClanOfficerList( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOwner( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanOfficerCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetClanOfficerByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iOfficer ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamFriends_GetUserRestrictions( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetRichPresence( IntPtr ISteamFriends, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_ClearRichPresence( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendRichPresenceKeyCount( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamFriends_GetFriendRichPresenceKeyByIndex( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iKey ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamFriends_RequestFriendRichPresence( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_InviteUserToGame( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchConnectString ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetCoplayFriendCount( IntPtr ISteamFriends ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetCoplayFriend( IntPtr ISteamFriends, int /*int*/ iCoplayFriend ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendCoplayTime( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern AppId_t /*(AppId_t)*/ SteamAPI_ISteamFriends_GetFriendCoplayGame( IntPtr ISteamFriends, ulong steamIDFriend ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_JoinClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_LeaveClanChatRoom( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMemberCount( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamFriends_GetChatMemberByIndex( IntPtr ISteamFriends, ulong steamIDClan, int /*int*/ iUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SendClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, string /*const char **/ pchText ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetClanChatMessage( IntPtr ISteamFriends, ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatAdmin( IntPtr ISteamFriends, ulong steamIDClanChat, ulong steamIDUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanChatWindowOpenInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_OpenClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_CloseClanChatWindowInSteam( IntPtr ISteamFriends, ulong steamIDClanChat ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_SetListenForFriendsMessages( IntPtr ISteamFriends, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_ReplyToFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, string /*const char **/ pchMsgToSend ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamFriends_GetFriendMessage( IntPtr ISteamFriends, ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_GetFollowerCount( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_IsFollowing( IntPtr ISteamFriends, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamFriends_EnumerateFollowingList( IntPtr ISteamFriends, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanPublic( IntPtr ISteamFriends, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamFriends_IsClanOfficialGameGroup( IntPtr ISteamFriends, ulong steamIDClan ); // // ISteamUtils // - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceAppActive( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern Universe /*EUniverse*/ SteamAPI_ISteamUtils_GetConnectedUniverse( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetServerRealTime( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetIPCountry( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageSize( IntPtr ISteamUtils, int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetImageRGBA( IntPtr ISteamUtils, int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetCSERIPPort( IntPtr ISteamUtils, out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort ); + [DllImport( "steam_api64.dll" )] internal static extern byte /*uint8*/ SteamAPI_ISteamUtils_GetCurrentBatteryPower( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetAppID( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationPosition( IntPtr ISteamUtils, NotificationPosition /*ENotificationPosition*/ eNotificationPosition ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsAPICallCompleted( IntPtr ISteamUtils, ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICallFailure /*ESteamAPICallFailure*/ SteamAPI_ISteamUtils_GetAPICallFailureReason( IntPtr ISteamUtils, ulong hSteamAPICall ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetAPICallResult( IntPtr ISteamUtils, ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetIPCCallCount( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetWarningMessageHook( IntPtr ISteamUtils, IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsOverlayEnabled( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_BOverlayNeedsPresent( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUtils_CheckFileSignature( IntPtr ISteamUtils, string /*const char **/ szFileName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_ShowGamepadTextInput( IntPtr ISteamUtils, GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextLength( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_GetEnteredGamepadTextInput( IntPtr ISteamUtils, System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUtils_GetSteamUILanguage( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamRunningInVR( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetOverlayNotificationInset( IntPtr ISteamUtils, int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsSteamInBigPictureMode( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_StartVRDashboard( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( IntPtr ISteamUtils ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( IntPtr ISteamUtils, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); // // ISteamMatchmaking // - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetFavoriteGameCount( IntPtr ISteamMatchmaking ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetFavoriteGame( IntPtr ISteamMatchmaking, int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_AddFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RemoveFavoriteGame( IntPtr ISteamMatchmaking, uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_RequestLobbyList( IntPtr ISteamMatchmaking ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListStringFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNumericalFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListNearValueFilter( IntPtr ISteamMatchmaking, string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( IntPtr ISteamMatchmaking, int /*int*/ nSlotsAvailable ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter( IntPtr ISteamMatchmaking, LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListResultCountFilter( IntPtr ISteamMatchmaking, int /*int*/ cMaxResults ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyByIndex( IntPtr ISteamMatchmaking, int /*int*/ iLobby ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_CreateLobby( IntPtr ISteamMatchmaking, LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamMatchmaking_JoinLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_LeaveLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_InviteUserToLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDInvitee ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetNumLobbyMembers( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iMember ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyDataCount( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyDataByIndex( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_DeleteLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamMatchmaking_GetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberData( IntPtr ISteamMatchmaking, ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SendLobbyChatMsg( IntPtr ISteamMatchmaking, ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyChatEntry( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_RequestLobbyData( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmaking_SetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_GetLobbyGameServer( IntPtr ISteamMatchmaking, ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby, int /*int*/ cMaxMembers ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmaking_GetLobbyMemberLimit( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyType( IntPtr ISteamMatchmaking, ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyJoinable( IntPtr ISteamMatchmaking, ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamMatchmaking_GetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLobbyOwner( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDNewOwner ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmaking_SetLinkedLobby( IntPtr ISteamMatchmaking, ulong steamIDLobby, ulong steamIDLobbyDependent ); // // ISteamMatchmakingServers // - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); + [DllImport( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestInternetServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestLANServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFriendsServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestFavoritesServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestHistoryServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerListRequest /*(HServerListRequest)*/ SteamAPI_ISteamMatchmakingServers_RequestSpectatorServerList( IntPtr ISteamMatchmakingServers, uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_ReleaseRequest( IntPtr ISteamMatchmakingServers, IntPtr hServerListRequest ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*class gameserveritem_t **/ SteamAPI_ISteamMatchmakingServers_GetServerDetails( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshQuery( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMatchmakingServers_IsRefreshing( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamMatchmakingServers_GetServerCount( IntPtr ISteamMatchmakingServers, IntPtr hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_RefreshServer( IntPtr ISteamMatchmakingServers, IntPtr hRequest, int /*int*/ iServer ); + [DllImport( "steam_api64.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PingServer( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_PlayerDetails( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern HServerQuery /*(HServerQuery)*/ SteamAPI_ISteamMatchmakingServers_ServerRules( IntPtr ISteamMatchmakingServers, uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMatchmakingServers_CancelServerQuery( IntPtr ISteamMatchmakingServers, int hServerQuery ); // // ISteamRemoteStorage // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pExcludedTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pUserTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWrite( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_FileRead( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileReadAsync( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete( IntPtr ISteamRemoteStorage, ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileForget( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileDelete( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_FileShare( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_SetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform ); + [DllImport( "steam_api64.dll" )] internal static extern UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamOpen( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamWriteChunk( IntPtr ISteamRemoteStorage, ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamClose( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileWriteStreamCancel( IntPtr ISteamRemoteStorage, ulong writeHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FileExists( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_FilePersisted( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileSize( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern long /*int64*/ SteamAPI_ISteamRemoteStorage_GetFileTimestamp( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern RemoteStoragePlatform /*ERemoteStoragePlatform*/ SteamAPI_ISteamRemoteStorage_GetSyncPlatforms( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetFileCount( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamRemoteStorage_GetFileNameAndSize( IntPtr ISteamRemoteStorage, int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForAccount( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_IsCloudEnabledForApp( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamRemoteStorage_SetCloudEnabledForApp( IntPtr ISteamRemoteStorage, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownload( IntPtr ISteamRemoteStorage, ulong hContent, uint /*uint32*/ unPriority ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress( IntPtr ISteamRemoteStorage, ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetUGCDetails( IntPtr ISteamRemoteStorage, ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_UGCRead( IntPtr ISteamRemoteStorage, ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCCount( IntPtr ISteamRemoteStorage ); + [DllImport( "steam_api64.dll" )] internal static extern UGCHandle_t /*(UGCHandle_t)*/ SteamAPI_ISteamRemoteStorage_GetCachedUGCHandle( IntPtr ISteamRemoteStorage, int /*int32*/ iCachedContent ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishWorkshopFile( IntPtr ISteamRemoteStorage, string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType ); + [DllImport( "steam_api64.dll" )] internal static extern PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ SteamAPI_ISteamRemoteStorage_CreatePublishedFileUpdateRequest( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFilePreviewFile( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchPreviewFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTitle( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchTitle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchDescription ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileVisibility( IntPtr ISteamRemoteStorage, ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileTags( IntPtr ISteamRemoteStorage, ulong updateHandle, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_CommitPublishedFileUpdate( IntPtr ISteamRemoteStorage, ulong updateHandle ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedFileDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_DeletePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserPublishedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSubscribedFiles( IntPtr ISteamRemoteStorage, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UnsubscribePublishedFile( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( IntPtr ISteamRemoteStorage, ulong updateHandle, string /*const char **/ pchChangeDescription ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UpdateUserPublishedItemVote( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_GetUserPublishedItemVoteDetails( IntPtr ISteamRemoteStorage, ulong unPublishedFileId ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( IntPtr ISteamRemoteStorage, ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pExcludedTags ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_PublishVideo( IntPtr ISteamRemoteStorage, WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_SetUserPublishedFileAction( IntPtr ISteamRemoteStorage, ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( IntPtr ISteamRemoteStorage, WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( IntPtr ISteamRemoteStorage, WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pUserTags ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamRemoteStorage_UGCDownloadToLocation( IntPtr ISteamRemoteStorage, ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority ); // // ISteamUserStats // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_RequestCurrentStats( IntPtr ISteamUserStats ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat( IntPtr ISteamUserStats, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetStat0( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_UpdateAvgRateStat( IntPtr ISteamUserStats, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_SetAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ClearAchievement( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime( IntPtr ISteamUserStats, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_StoreStats( IntPtr ISteamUserStats ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetAchievementIcon( IntPtr ISteamUserStats, string /*const char **/ pchName ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute( IntPtr ISteamUserStats, string /*const char **/ pchName, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_IndicateAchievementProgress( IntPtr ISteamUserStats, string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUserStats_GetNumAchievements( IntPtr ISteamUserStats ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetAchievementName( IntPtr ISteamUserStats, uint /*uint32*/ iAchievement ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestUserStats( IntPtr ISteamUserStats, ulong steamIDUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserStat0( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievement( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime( IntPtr ISteamUserStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_ResetAllStats( IntPtr ISteamUserStats, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindOrCreateLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_FindLeaderboard( IntPtr ISteamUserStats, string /*const char **/ pchLeaderboardName ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamUserStats_GetLeaderboardName( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetLeaderboardEntryCount( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api64.dll" )] internal static extern LeaderboardSortMethod /*ELeaderboardSortMethod*/ SteamAPI_ISteamUserStats_GetLeaderboardSortMethod( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api64.dll" )] internal static extern LeaderboardDisplayType /*ELeaderboardDisplayType*/ SteamAPI_ISteamUserStats_GetLeaderboardDisplayType( IntPtr ISteamUserStats, ulong hSteamLeaderboard ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntries( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_DownloadLeaderboardEntriesForUsers( IntPtr ISteamUserStats, ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetDownloadedLeaderboardEntry( IntPtr ISteamUserStats, ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_UploadLeaderboardScore( IntPtr ISteamUserStats, ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_AttachLeaderboardUGC( IntPtr ISteamUserStats, ulong hSteamLeaderboard, ulong hUGC ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers( IntPtr ISteamUserStats ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalAchievementPercentages( IntPtr ISteamUserStats ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetMostAchievedAchievementInfo( IntPtr ISteamUserStats, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamUserStats_GetNextMostAchievedAchievementInfo( IntPtr ISteamUserStats, int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetAchievementAchievedPercent( IntPtr ISteamUserStats, string /*const char **/ pchName, out float /*float **/ pflPercent ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUserStats_RequestGlobalStats( IntPtr ISteamUserStats, int /*int*/ nHistoryDays ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUserStats_GetGlobalStat0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int32*/ SteamAPI_ISteamUserStats_GetGlobalStatHistory0( IntPtr ISteamUserStats, string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData ); // // ISteamApps // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribed( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsLowViolence( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsCybercafe( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsVACBanned( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetCurrentGameLanguage( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetAvailableGameLanguages( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedApp( IntPtr ISteamApps, uint appID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsDlcInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetDLCCount( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BGetDLCDataByIndex( IntPtr ISteamApps, int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_InstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_UninstallDLC( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey( IntPtr ISteamApps, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetCurrentBetaName( IntPtr ISteamApps, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_MarkContentCorrupt( IntPtr ISteamApps, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetInstalledDepots( IntPtr ISteamApps, uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamApps_GetAppInstallDir( IntPtr ISteamApps, uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_BIsAppInstalled( IntPtr ISteamApps, uint appID ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamApps_GetAppOwner( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamApps_GetLaunchQueryParam( IntPtr ISteamApps, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamApps_GetDlcDownloadProgress( IntPtr ISteamApps, uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamApps_GetAppBuildId( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys( IntPtr ISteamApps ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamApps_GetFileDetails( IntPtr ISteamApps, string /*const char **/ pszFileName ); // // ISteamNetworking // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t /*struct P2PSessionState_t **/ pConnectionState ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendP2PPacket( IntPtr ISteamNetworking, ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsP2PPacketAvailable( IntPtr ISteamNetworking, out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_ReadP2PPacket( IntPtr ISteamNetworking, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PSessionWithUser( IntPtr ISteamNetworking, ulong steamIDRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_CloseP2PChannelWithUser( IntPtr ISteamNetworking, ulong steamIDRemote, int /*int*/ nChannel ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetP2PSessionState( IntPtr ISteamNetworking, ulong steamIDRemote, ref P2PSessionState_t /*struct P2PSessionState_t **/ pConnectionState ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_AllowP2PPacketRelay( IntPtr ISteamNetworking, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow ); + [DllImport( "steam_api64.dll" )] internal static extern SNetListenSocket_t /*(SNetListenSocket_t)*/ SteamAPI_ISteamNetworking_CreateListenSocket( IntPtr ISteamNetworking, int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "steam_api64.dll" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateP2PConnectionSocket( IntPtr ISteamNetworking, ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay ); + [DllImport( "steam_api64.dll" )] internal static extern SNetSocket_t /*(SNetSocket_t)*/ SteamAPI_ISteamNetworking_CreateConnectionSocket( IntPtr ISteamNetworking, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroySocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_DestroyListenSocket( IntPtr ISteamNetworking, uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_SendDataOnSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailableOnSocket( IntPtr ISteamNetworking, uint hSocket, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveDataFromSocket( IntPtr ISteamNetworking, uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_IsDataAvailable( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_RetrieveData( IntPtr ISteamNetworking, uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetSocketInfo( IntPtr ISteamNetworking, uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamNetworking_GetListenSocketInfo( IntPtr ISteamNetworking, uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort ); + [DllImport( "steam_api64.dll" )] internal static extern SNetSocketConnectionType /*ESNetSocketConnectionType*/ SteamAPI_ISteamNetworking_GetSocketConnectionType( IntPtr ISteamNetworking, uint hSocket ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamNetworking_GetMaxPacketSize( IntPtr ISteamNetworking, uint hSocket ); // // ISteamScreenshots // - [DllImportAttribute( "steam_api64.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); + [DllImport( "steam_api64.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_WriteScreenshot( IntPtr ISteamScreenshots, IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "steam_api64.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddScreenshotToLibrary( IntPtr ISteamScreenshots, string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_TriggerScreenshot( IntPtr ISteamScreenshots ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamScreenshots_HookScreenshots( IntPtr ISteamScreenshots, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_SetLocation( IntPtr ISteamScreenshots, uint hScreenshot, string /*const char **/ pchLocation ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagUser( IntPtr ISteamScreenshots, uint hScreenshot, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_TagPublishedFile( IntPtr ISteamScreenshots, uint hScreenshot, ulong unPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamScreenshots_IsScreenshotsHooked( IntPtr ISteamScreenshots ); + [DllImport( "steam_api64.dll" )] internal static extern ScreenshotHandle /*(ScreenshotHandle)*/ SteamAPI_ISteamScreenshots_AddVRScreenshotToLibrary( IntPtr ISteamScreenshots, VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename ); // // ISteamMusic // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsEnabled( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusic_BIsPlaying( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern AudioPlayback_Status /*AudioPlayback_Status*/ SteamAPI_ISteamMusic_GetPlaybackStatus( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Play( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_Pause( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayPrevious( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_PlayNext( IntPtr ISteamMusic ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamMusic_SetVolume( IntPtr ISteamMusic, float /*float*/ flVolume ); + [DllImport( "steam_api64.dll" )] internal static extern float /*float*/ SteamAPI_ISteamMusic_GetVolume( IntPtr ISteamMusic ); // // ISteamMusicRemote // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_RegisterSteamMusicRemote( IntPtr ISteamMusicRemote, string /*const char **/ pchName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_DeregisterSteamMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BIsCurrentMusicRemote( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_BActivationSuccess( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetDisplayName( IntPtr ISteamMusicRemote, string /*const char **/ pchDisplayName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPNGIcon_64x64( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayPrevious( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlayNext( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnableQueue( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_EnablePlaylists( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdatePlaybackStatus( IntPtr ISteamMusicRemote, AudioPlayback_Status /*AudioPlayback_Status*/ nStatus ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateShuffled( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateLooped( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateVolume( IntPtr ISteamMusicRemote, float /*float*/ flValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryIsAvailable( IntPtr ISteamMusicRemote, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryText( IntPtr ISteamMusicRemote, string /*const char **/ pchText ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( IntPtr ISteamMusicRemote, int /*int*/ nValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr ISteamMusicRemote, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_CurrentEntryDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetQueueEntries( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentQueueEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_QueueDidChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistWillChange( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_ResetPlaylistEntries( IntPtr ISteamMusicRemote ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_SetCurrentPlaylistEntry( IntPtr ISteamMusicRemote, int /*int*/ nID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamMusicRemote_PlaylistDidChange( IntPtr ISteamMusicRemote ); // // ISteamHTTP // - [DllImportAttribute( "steam_api64.dll" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); + [DllImport( "steam_api64.dll" )] internal static extern HTTPRequestHandle /*(HTTPRequestHandle)*/ SteamAPI_ISteamHTTP_CreateHTTPRequest( IntPtr ISteamHTTP, HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestContextValue( IntPtr ISteamHTTP, uint hRequest, ulong /*uint64*/ ulContextValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unTimeoutSeconds ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestGetOrPostParameter( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequest( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SendHTTPRequestAndStreamResponse( IntPtr ISteamHTTP, uint hRequest, ref ulong pCallHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_DeferHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_PrioritizeHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderSize( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseHeaderValue( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( IntPtr ISteamHTTP, uint hRequest, out uint /*uint32 **/ unBodySize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( IntPtr ISteamHTTP, uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPStreamingResponseBodyData( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseHTTPRequest( IntPtr ISteamHTTP, uint hRequest ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPDownloadProgressPct( IntPtr ISteamHTTP, uint hRequest, out float /*float **/ pflPercentOut ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRawPostBody( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen ); + [DllImport( "steam_api64.dll" )] internal static extern HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ SteamAPI_ISteamHTTP_CreateCookieContainer( IntPtr ISteamHTTP, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_ReleaseCookieContainer( IntPtr ISteamHTTP, uint hCookieContainer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetCookie( IntPtr ISteamHTTP, uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestCookieContainer( IntPtr ISteamHTTP, uint hRequest, uint hCookieContainer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo( IntPtr ISteamHTTP, uint hRequest, string /*const char **/ pchUserAgentInfo ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( IntPtr ISteamHTTP, uint hRequest, uint /*uint32*/ unMilliseconds ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut( IntPtr ISteamHTTP, uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut ); // // ISteamController // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Init( IntPtr ISteamController ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_Shutdown( IntPtr ISteamController ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_RunFrame( IntPtr ISteamController ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetConnectedControllers( IntPtr ISteamController, IntPtr /*ControllerHandle_t **/ handlesOut ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowBindingPanel( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetActionSetHandle( IntPtr ISteamController, string /*const char **/ pszActionSetName ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSet( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ SteamAPI_ISteamController_GetCurrentActionSet( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_ActivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateActionSetLayer( IntPtr ISteamController, ulong controllerHandle, ulong actionSetLayerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_DeactivateAllActionSetLayers( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetActiveActionSetLayers( IntPtr ISteamController, ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ SteamAPI_ISteamController_GetDigitalActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerDigitalActionData_t /*struct ControllerDigitalActionData_t*/ SteamAPI_ISteamController_GetDigitalActionData( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ SteamAPI_ISteamController_GetAnalogActionHandle( IntPtr ISteamController, string /*const char **/ pszActionName ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerAnalogActionData_t /*struct ControllerAnalogActionData_t*/ SteamAPI_ISteamController_GetAnalogActionData( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); + [DllImport( "steam_api64.dll" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImport( "steam_api64.dll" )] internal static extern SteamInputType /*ESteamInputType*/ SteamAPI_ISteamController_GetInputTypeForHandle( IntPtr ISteamController, ulong controllerHandle ); // // ISteamUGC // - [DllImportAttribute( "steam_api64.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t /*struct SteamUGCDetails_t **/ pDetails ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t /*const struct SteamParamStringArray_t **/ pTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( IntPtr ISteamUGC, uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "steam_api64.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryAllUGCRequest( IntPtr ISteamUGC, UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ); + [DllImport( "steam_api64.dll" )] internal static extern UGCQueryHandle_t /*(UGCQueryHandle_t)*/ SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SendQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCResult( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t /*struct SteamUGCDetails_t **/ pDetails ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCPreviewURL( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCMetadata( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCChildren( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCStatistic( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( IntPtr ISteamUGC, ulong handle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddExcludedTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pTagName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnOnlyIDs( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnKeyValueTags( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnLongDescription( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnMetadata( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnChildren( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnAdditionalPreviews( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnTotalOnly( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetReturnPlaytimeStats( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetAllowCachedResponse( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetCloudFileNameFilter( IntPtr ISteamUGC, ulong handle, string /*const char **/ pMatchCloudFileName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetMatchAnyTag( IntPtr ISteamUGC, ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetSearchText( IntPtr ISteamUGC, ulong handle, string /*const char **/ pSearchText ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetRankedByTrendDays( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ unDays ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddRequiredKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RequestUGCDetails( IntPtr ISteamUGC, ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_CreateItem( IntPtr ISteamUGC, uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType ); + [DllImport( "steam_api64.dll" )] internal static extern UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ SteamAPI_ISteamUGC_StartItemUpdate( IntPtr ISteamUGC, uint nConsumerAppId, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTitle( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchTitle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemDescription( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchDescription ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemUpdateLanguage( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchLanguage ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemMetadata( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchMetaData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemVisibility( IntPtr ISteamUGC, ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemTags( IntPtr ISteamUGC, ulong updateHandle, ref SteamParamStringArray_t /*const struct SteamParamStringArray_t **/ pTags ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemContent( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszContentFolder ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_SetItemPreview( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemKeyValueTags( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemKeyValueTag( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewFile( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_AddItemPreviewVideo( IntPtr ISteamUGC, ulong handle, string /*const char **/ pszVideoID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewFile( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_UpdateItemPreviewVideo( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_RemoveItemPreview( IntPtr ISteamUGC, ulong handle, uint /*uint32*/ index ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubmitItemUpdate( IntPtr ISteamUGC, ulong handle, string /*const char **/ pchChangeNote ); + [DllImport( "steam_api64.dll" )] internal static extern ItemUpdateStatus /*EItemUpdateStatus*/ SteamAPI_ISteamUGC_GetItemUpdateProgress( IntPtr ISteamUGC, ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetUserItemVote( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddItemToFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveItemFromFavorites( IntPtr ISteamUGC, uint nAppId, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_SubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_UnsubscribeItem( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetNumSubscribedItems( IntPtr ISteamUGC ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetSubscribedItems( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamUGC_GetItemState( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemInstallInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_GetItemDownloadInfo( IntPtr ISteamUGC, ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_DownloadItem( IntPtr ISteamUGC, ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamUGC_BInitWorkshopForGameServer( IntPtr ISteamUGC, uint unWorkshopDepotID, string /*const char **/ pszFolder ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamUGC_SuspendDownloads( IntPtr ISteamUGC, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StartPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTracking( IntPtr ISteamUGC, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems( IntPtr ISteamUGC ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveDependency( IntPtr ISteamUGC, ulong nParentPublishedFileID, ulong nChildPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_AddAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_RemoveAppDependency( IntPtr ISteamUGC, ulong nPublishedFileID, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_GetAppDependencies( IntPtr ISteamUGC, ulong nPublishedFileID ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamUGC_DeleteItem( IntPtr ISteamUGC, ulong nPublishedFileID ); // // ISteamAppList // - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetNumInstalledApps( IntPtr ISteamAppList ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamAppList_GetInstalledApps( IntPtr ISteamAppList, IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppName( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppInstallDir( IntPtr ISteamAppList, uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamAppList_GetAppBuildId( IntPtr ISteamAppList, uint nAppID ); // // ISteamHTMLSurface // - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_DestructISteamHTMLSurface( IntPtr ISteamHTMLSurface ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Init( IntPtr ISteamHTMLSurface ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamHTMLSurface_Shutdown( IntPtr ISteamHTMLSurface ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamHTMLSurface_CreateBrowser( IntPtr ISteamHTMLSurface, string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_RemoveBrowser( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_LoadURL( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetSize( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopLoad( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Reload( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoBack( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GoForward( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AddHeader( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ExecuteJavascript( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchScript ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseDoubleClick( IntPtr ISteamHTMLSurface, uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseMove( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_MouseWheel( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int32*/ nDelta ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyDown( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyUp( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_KeyChar( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetHorizontalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetVerticalScroll( IntPtr ISteamHTMLSurface, uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetKeyFocus( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_ViewSource( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_CopyToClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_PasteFromClipboard( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_Find( IntPtr ISteamHTMLSurface, uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_StopFind( IntPtr ISteamHTMLSurface, uint unBrowserHandle ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_GetLinkAtPosition( IntPtr ISteamHTMLSurface, uint unBrowserHandle, int /*int*/ x, int /*int*/ y ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetCookie( IntPtr ISteamHTMLSurface, string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetPageScaleFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetBackgroundMode( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor( IntPtr ISteamHTMLSurface, uint unBrowserHandle, float /*float*/ flDPIScaling ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_AllowStartRequest( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr ISteamHTMLSurface, uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult ); // // ISteamInventory // - [DllImportAttribute( "steam_api64.dll" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); + [DllImport( "steam_api64.dll" )] internal static extern Result /*EResult*/ SteamAPI_ISteamInventory_GetResultStatus( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItems( IntPtr ISteamInventory, int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetResultItemProperty( IntPtr ISteamInventory, int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetResultTimestamp( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_CheckResultSteamID( IntPtr ISteamInventory, int resultHandle, ulong steamIDExpected ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_DestroyResult( IntPtr ISteamInventory, int resultHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetAllItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsByID( IntPtr ISteamInventory, ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SerializeResult( IntPtr ISteamInventory, int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_DeserializeResult( IntPtr ISteamInventory, ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GenerateItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GrantPromoItems( IntPtr ISteamInventory, ref int pResultHandle ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItem( IntPtr ISteamInventory, ref int pResultHandle, int itemDef ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_AddPromoItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ConsumeItem( IntPtr ISteamInventory, ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_ExchangeItems( IntPtr ISteamInventory, ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TransferItemQuantity( IntPtr ISteamInventory, ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamInventory_SendItemDropHeartbeat( IntPtr ISteamInventory ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TriggerItemDrop( IntPtr ISteamInventory, ref int pResultHandle, int dropListDefinition ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_TradeItems( IntPtr ISteamInventory, ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_StartPurchase( IntPtr ISteamInventory, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestPrices( IntPtr ISteamInventory ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamInventory_GetNumItemsWithPrices( IntPtr ISteamInventory ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemsWithPrices( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pPrices, uint /*uint32*/ unArrayLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemPrice( IntPtr ISteamInventory, int iDefinition, out ulong /*uint64 **/ pPrice ); + [DllImport( "steam_api64.dll" )] internal static extern SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ SteamAPI_ISteamInventory_StartUpdateProperties( IntPtr ISteamInventory ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_RemoveProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SetProperty0( IntPtr ISteamInventory, ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_SubmitUpdateProperties( IntPtr ISteamInventory, ulong handle, ref int pResultHandle ); // // ISteamVideo // - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetVideoURL( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_IsBroadcasting( IntPtr ISteamVideo, IntPtr /*int **/ pnNumViewers ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamVideo_GetOPFSettings( IntPtr ISteamVideo, uint unVideoAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamVideo_GetOPFStringForApp( IntPtr ISteamVideo, uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize ); // // ISteamParentalSettings // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockEnabled( IntPtr ISteamParentalSettings ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsParentalLockLocked( IntPtr ISteamParentalSettings ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppBlocked( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsAppInBlockList( IntPtr ISteamParentalSettings, uint nAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureBlocked( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList( IntPtr ISteamParentalSettings, ParentalFeature /*EParentalFeature*/ eFeature ); // // ISteamGameServer // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_InitGameServer( IntPtr ISteamGameServer, uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetProduct( IntPtr ISteamGameServer, string /*const char **/ pszProduct ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameDescription( IntPtr ISteamGameServer, string /*const char **/ pszGameDescription ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetModDir( IntPtr ISteamGameServer, string /*const char **/ pszModDir ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetDedicatedServer( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOn( IntPtr ISteamGameServer, string /*const char **/ pszToken ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOnAnonymous( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_LogOff( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BLoggedOn( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BSecure( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_GetSteamID( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_WasRestartRequested( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMaxPlayerCount( IntPtr ISteamGameServer, int /*int*/ cPlayersMax ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetBotPlayerCount( IntPtr ISteamGameServer, int /*int*/ cBotplayers ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetServerName( IntPtr ISteamGameServer, string /*const char **/ pszServerName ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetMapName( IntPtr ISteamGameServer, string /*const char **/ pszMapName ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetPasswordProtected( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorPort( IntPtr ISteamGameServer, ushort /*uint16*/ unSpectatorPort ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetSpectatorServerName( IntPtr ISteamGameServer, string /*const char **/ pszSpectatorServerName ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ClearAllKeyValues( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetKeyValue( IntPtr ISteamGameServer, string /*const char **/ pKey, string /*const char **/ pValue ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameTags( IntPtr ISteamGameServer, string /*const char **/ pchGameTags ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetGameData( IntPtr ISteamGameServer, string /*const char **/ pchGameData ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetRegion( IntPtr ISteamGameServer, string /*const char **/ pszRegion ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate( IntPtr ISteamGameServer, uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser ); + [DllImport( "steam_api64.dll" )] internal static extern CSteamID /*(class CSteamID)*/ SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SendUserDisconnect( IntPtr ISteamGameServer, ulong steamIDUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_BUpdateUserData( IntPtr ISteamGameServer, ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore ); + [DllImport( "steam_api64.dll" )] internal static extern HAuthTicket /*(HAuthTicket)*/ SteamAPI_ISteamGameServer_GetAuthSessionTicket( IntPtr ISteamGameServer, IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket ); + [DllImport( "steam_api64.dll" )] internal static extern BeginAuthSessionResult /*EBeginAuthSessionResult*/ SteamAPI_ISteamGameServer_BeginAuthSession( IntPtr ISteamGameServer, IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EndAuthSession( IntPtr ISteamGameServer, ulong steamID ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_CancelAuthTicket( IntPtr ISteamGameServer, uint hAuthTicket ); + [DllImport( "steam_api64.dll" )] internal static extern UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ SteamAPI_ISteamGameServer_UserHasLicenseForApp( IntPtr ISteamGameServer, ulong steamID, uint appID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_RequestUserGroupStatus( IntPtr ISteamGameServer, ulong steamIDUser, ulong steamIDGroup ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_GetGameplayStats( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_GetServerReputation( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern uint /*uint32*/ SteamAPI_ISteamGameServer_GetPublicIP( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServer_HandleIncomingPacket( IntPtr ISteamGameServer, IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort ); + [DllImport( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamGameServer_GetNextOutgoingPacket( IntPtr ISteamGameServer, IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_EnableHeartbeats( IntPtr ISteamGameServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_SetHeartbeatInterval( IntPtr ISteamGameServer, int /*int*/ iHeartbeatInterval ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamGameServer_ForceHeartbeat( IntPtr ISteamGameServer ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_AssociateWithClan( IntPtr ISteamGameServer, ulong steamIDClan ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServer_ComputeNewPlayerCompatibility( IntPtr ISteamGameServer, ulong steamIDNewPlayer ); // // ISteamGameServerStats // - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_RequestUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_GetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserStat0( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_UpdateUserAvgRateStat( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_SetUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamGameServerStats_ClearUserAchievement( IntPtr ISteamGameServerStats, ulong steamIDUser, string /*const char **/ pchName ); + [DllImport( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamGameServerStats_StoreUserStats( IntPtr ISteamGameServerStats, ulong steamIDUser ); // // SteamApi // - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_Init(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_Shutdown(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); - [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_Init(); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_RunCallbacks(); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamGameServer_RunCallbacks(); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString ); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_Shutdown(); + [DllImport( "steam_api64.dll" )] internal static extern void /*void*/ SteamGameServer_Shutdown(); + [DllImport( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamAPI_GetHSteamUser(); + [DllImport( "steam_api64.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamAPI_GetHSteamPipe(); + [DllImport( "steam_api64.dll" )] internal static extern HSteamUser /*(HSteamUser)*/ SteamGameServer_GetHSteamUser(); + [DllImport( "steam_api64.dll" )] internal static extern HSteamPipe /*(HSteamPipe)*/ SteamGameServer_GetHSteamPipe(); + [DllImport( "steam_api64.dll" )] internal static extern IntPtr /*void **/ SteamInternal_CreateInterface( string /*const char **/ version ); + [DllImport( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID ); } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs index af487a0..a37a3c1 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs @@ -7,27 +7,36 @@ namespace SteamNative [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct CallbackMsg_t { - public int SteamUser; // m_hSteamUser HSteamUser - public int Callback; // m_iCallback int - public IntPtr ParamPtr; // m_pubParam uint8 * - public int ParamCount; // m_cubParam int + internal int SteamUser; // m_hSteamUser HSteamUser + internal int Callback; // m_iCallback int + internal IntPtr ParamPtr; // m_pubParam uint8 * + internal int ParamCount; // m_cubParam int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static CallbackMsg_t FromPointer( IntPtr p ) + internal static CallbackMsg_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (CallbackMsg_t) Marshal.PtrToStructure( p, typeof(CallbackMsg_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(CallbackMsg_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public int SteamUser; // m_hSteamUser HSteamUser - public int Callback; // m_iCallback int - public IntPtr ParamPtr; // m_pubParam uint8 * - public int ParamCount; // m_cubParam int + internal int SteamUser; // m_hSteamUser HSteamUser + internal int Callback; // m_iCallback int + internal IntPtr ParamPtr; // m_pubParam uint8 * + internal int ParamCount; // m_cubParam int // // Easily convert from PackSmall to CallbackMsg_t @@ -48,26 +57,35 @@ public static implicit operator CallbackMsg_t ( CallbackMsg_t.PackSmall d ) [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamServerConnectFailure_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 2; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUser + 2; + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool StillRetrying; // m_bStillRetrying _Bool + internal bool StillRetrying; // m_bStillRetrying _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamServerConnectFailure_t FromPointer( IntPtr p ) + internal static SteamServerConnectFailure_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamServerConnectFailure_t) Marshal.PtrToStructure( p, typeof(SteamServerConnectFailure_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamServerConnectFailure_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool StillRetrying; // m_bStillRetrying _Bool + internal bool StillRetrying; // m_bStillRetrying _Bool // // Easily convert from PackSmall to SteamServerConnectFailure_t @@ -82,95 +100,80 @@ public static implicit operator SteamServerConnectFailure_t ( SteamServerConnec } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamServerConnectFailure_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamServerConnectFailure_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -193,27 +196,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamServersDisconnected_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 3; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUser + 3; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamServersDisconnected_t FromPointer( IntPtr p ) + internal static SteamServersDisconnected_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamServersDisconnected_t) Marshal.PtrToStructure( p, typeof(SteamServersDisconnected_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamServersDisconnected_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to SteamServersDisconnected_t @@ -227,95 +268,80 @@ public static implicit operator SteamServersDisconnected_t ( SteamServersDiscon } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamServersDisconnected_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamServersDisconnected_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -338,35 +364,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct ClientGameServerDeny_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 13; - public uint AppID; // m_uAppID uint32 - public uint GameServerIP; // m_unGameServerIP uint32 - public ushort GameServerPort; // m_usGameServerPort uint16 - public ushort Secure; // m_bSecure uint16 - public uint Reason; // m_uReason uint32 + internal const int CallbackId = CallbackIdentifiers.SteamUser + 13; + internal uint AppID; // m_uAppID uint32 + internal uint GameServerIP; // m_unGameServerIP uint32 + internal ushort GameServerPort; // m_usGameServerPort uint16 + internal ushort Secure; // m_bSecure uint16 + internal uint Reason; // m_uReason uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ClientGameServerDeny_t FromPointer( IntPtr p ) + internal static ClientGameServerDeny_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ClientGameServerDeny_t) Marshal.PtrToStructure( p, typeof(ClientGameServerDeny_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ClientGameServerDeny_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_uAppID uint32 - public uint GameServerIP; // m_unGameServerIP uint32 - public ushort GameServerPort; // m_usGameServerPort uint16 - public ushort Secure; // m_bSecure uint16 - public uint Reason; // m_uReason uint32 + internal uint AppID; // m_uAppID uint32 + internal uint GameServerIP; // m_unGameServerIP uint32 + internal ushort GameServerPort; // m_usGameServerPort uint16 + internal ushort Secure; // m_bSecure uint16 + internal uint Reason; // m_uReason uint32 // // Easily convert from PackSmall to ClientGameServerDeny_t @@ -384,95 +448,80 @@ public static implicit operator ClientGameServerDeny_t ( ClientGameServerDeny_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ClientGameServerDeny_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ClientGameServerDeny_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -495,31 +544,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct ValidateAuthTicketResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 43; - public ulong SteamID; // m_SteamID class CSteamID - public AuthSessionResponse AuthSessionResponse; // m_eAuthSessionResponse enum EAuthSessionResponse - public ulong OwnerSteamID; // m_OwnerSteamID class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamUser + 43; + internal ulong SteamID; // m_SteamID class CSteamID + internal AuthSessionResponse AuthSessionResponse; // m_eAuthSessionResponse enum EAuthSessionResponse + internal ulong OwnerSteamID; // m_OwnerSteamID class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ValidateAuthTicketResponse_t FromPointer( IntPtr p ) + internal static ValidateAuthTicketResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ValidateAuthTicketResponse_t) Marshal.PtrToStructure( p, typeof(ValidateAuthTicketResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ValidateAuthTicketResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_SteamID class CSteamID - public AuthSessionResponse AuthSessionResponse; // m_eAuthSessionResponse enum EAuthSessionResponse - public ulong OwnerSteamID; // m_OwnerSteamID class CSteamID + internal ulong SteamID; // m_SteamID class CSteamID + internal AuthSessionResponse AuthSessionResponse; // m_eAuthSessionResponse enum EAuthSessionResponse + internal ulong OwnerSteamID; // m_OwnerSteamID class CSteamID // // Easily convert from PackSmall to ValidateAuthTicketResponse_t @@ -535,95 +622,80 @@ public static implicit operator ValidateAuthTicketResponse_t ( ValidateAuthTick } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ValidateAuthTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ValidateAuthTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -646,31 +718,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MicroTxnAuthorizationResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 52; - public uint AppID; // m_unAppID uint32 - public ulong OrderID; // m_ulOrderID uint64 - public byte Authorized; // m_bAuthorized uint8 + internal const int CallbackId = CallbackIdentifiers.SteamUser + 52; + internal uint AppID; // m_unAppID uint32 + internal ulong OrderID; // m_ulOrderID uint64 + internal byte Authorized; // m_bAuthorized uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MicroTxnAuthorizationResponse_t FromPointer( IntPtr p ) + internal static MicroTxnAuthorizationResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MicroTxnAuthorizationResponse_t) Marshal.PtrToStructure( p, typeof(MicroTxnAuthorizationResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MicroTxnAuthorizationResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_unAppID uint32 - public ulong OrderID; // m_ulOrderID uint64 - public byte Authorized; // m_bAuthorized uint8 + internal uint AppID; // m_unAppID uint32 + internal ulong OrderID; // m_ulOrderID uint64 + internal byte Authorized; // m_bAuthorized uint8 // // Easily convert from PackSmall to MicroTxnAuthorizationResponse_t @@ -686,95 +796,80 @@ public static implicit operator MicroTxnAuthorizationResponse_t ( MicroTxnAutho } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MicroTxnAuthorizationResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MicroTxnAuthorizationResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -797,27 +892,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct EncryptedAppTicketResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 54; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUser + 54; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static EncryptedAppTicketResponse_t FromPointer( IntPtr p ) + internal static EncryptedAppTicketResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (EncryptedAppTicketResponse_t) Marshal.PtrToStructure( p, typeof(EncryptedAppTicketResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(EncryptedAppTicketResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to EncryptedAppTicketResponse_t @@ -831,225 +964,85 @@ public static implicit operator EncryptedAppTicketResponse_t ( EncryptedAppTick } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( EncryptedAppTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( EncryptedAppTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( EncryptedAppTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( EncryptedAppTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -1072,29 +1065,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GetAuthSessionTicketResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 63; - public uint AuthTicket; // m_hAuthTicket HAuthTicket - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUser + 63; + internal uint AuthTicket; // m_hAuthTicket HAuthTicket + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GetAuthSessionTicketResponse_t FromPointer( IntPtr p ) + internal static GetAuthSessionTicketResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GetAuthSessionTicketResponse_t) Marshal.PtrToStructure( p, typeof(GetAuthSessionTicketResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GetAuthSessionTicketResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AuthTicket; // m_hAuthTicket HAuthTicket - public Result Result; // m_eResult enum EResult + internal uint AuthTicket; // m_hAuthTicket HAuthTicket + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to GetAuthSessionTicketResponse_t @@ -1109,95 +1140,80 @@ public static implicit operator GetAuthSessionTicketResponse_t ( GetAuthSession } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetAuthSessionTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetAuthSessionTicketResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -1220,29 +1236,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GameWebCallback_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 64; + internal const int CallbackId = CallbackIdentifiers.SteamUser + 64; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_szURL char [256] + internal string URL; // m_szURL char [256] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameWebCallback_t FromPointer( IntPtr p ) + internal static GameWebCallback_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameWebCallback_t) Marshal.PtrToStructure( p, typeof(GameWebCallback_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameWebCallback_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_szURL char [256] + internal string URL; // m_szURL char [256] // // Easily convert from PackSmall to GameWebCallback_t @@ -1256,95 +1310,80 @@ public static implicit operator GameWebCallback_t ( GameWebCallback_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameWebCallback_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameWebCallback_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -1367,29 +1406,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct StoreAuthURLResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 65; + internal const int CallbackId = CallbackIdentifiers.SteamUser + 65; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)] - public string URL; // m_szURL char [512] + internal string URL; // m_szURL char [512] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static StoreAuthURLResponse_t FromPointer( IntPtr p ) + internal static StoreAuthURLResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (StoreAuthURLResponse_t) Marshal.PtrToStructure( p, typeof(StoreAuthURLResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(StoreAuthURLResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)] - public string URL; // m_szURL char [512] + internal string URL; // m_szURL char [512] // // Easily convert from PackSmall to StoreAuthURLResponse_t @@ -1403,225 +1480,85 @@ public static implicit operator StoreAuthURLResponse_t ( StoreAuthURLResponse_t } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( StoreAuthURLResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( StoreAuthURLResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( StoreAuthURLResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( StoreAuthURLResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -1644,34 +1581,72 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct FriendGameInfo_t { - public ulong GameID; // m_gameID class CGameID - public uint GameIP; // m_unGameIP uint32 - public ushort GamePort; // m_usGamePort uint16 - public ushort QueryPort; // m_usQueryPort uint16 - public ulong SteamIDLobby; // m_steamIDLobby class CSteamID + internal ulong GameID; // m_gameID class CGameID + internal uint GameIP; // m_unGameIP uint32 + internal ushort GamePort; // m_usGamePort uint16 + internal ushort QueryPort; // m_usQueryPort uint16 + internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FriendGameInfo_t FromPointer( IntPtr p ) + internal static FriendGameInfo_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FriendGameInfo_t) Marshal.PtrToStructure( p, typeof(FriendGameInfo_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendGameInfo_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_gameID class CGameID - public uint GameIP; // m_unGameIP uint32 - public ushort GamePort; // m_usGamePort uint16 - public ushort QueryPort; // m_usQueryPort uint16 - public ulong SteamIDLobby; // m_steamIDLobby class CSteamID + internal ulong GameID; // m_gameID class CGameID + internal uint GameIP; // m_unGameIP uint32 + internal ushort GamePort; // m_usGamePort uint16 + internal ushort QueryPort; // m_usQueryPort uint16 + internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID // // Easily convert from PackSmall to FriendGameInfo_t @@ -1693,23 +1668,32 @@ public static implicit operator FriendGameInfo_t ( FriendGameInfo_t.PackSmall d [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct FriendSessionStateInfo_t { - public uint IOnlineSessionInstances; // m_uiOnlineSessionInstances uint32 - public byte IPublishedToFriendsSessionInstance; // m_uiPublishedToFriendsSessionInstance uint8 + internal uint IOnlineSessionInstances; // m_uiOnlineSessionInstances uint32 + internal byte IPublishedToFriendsSessionInstance; // m_uiPublishedToFriendsSessionInstance uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FriendSessionStateInfo_t FromPointer( IntPtr p ) + internal static FriendSessionStateInfo_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FriendSessionStateInfo_t) Marshal.PtrToStructure( p, typeof(FriendSessionStateInfo_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendSessionStateInfo_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint IOnlineSessionInstances; // m_uiOnlineSessionInstances uint32 - public byte IPublishedToFriendsSessionInstance; // m_uiPublishedToFriendsSessionInstance uint8 + internal uint IOnlineSessionInstances; // m_uiOnlineSessionInstances uint32 + internal byte IPublishedToFriendsSessionInstance; // m_uiPublishedToFriendsSessionInstance uint8 // // Easily convert from PackSmall to FriendSessionStateInfo_t @@ -1728,24 +1712,33 @@ public static implicit operator FriendSessionStateInfo_t ( FriendSessionStateIn [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct PersonaStateChange_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 4; - public ulong SteamID; // m_ulSteamID uint64 - public int ChangeFlags; // m_nChangeFlags int + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 4; + internal ulong SteamID; // m_ulSteamID uint64 + internal int ChangeFlags; // m_nChangeFlags int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static PersonaStateChange_t FromPointer( IntPtr p ) + internal static PersonaStateChange_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (PersonaStateChange_t) Marshal.PtrToStructure( p, typeof(PersonaStateChange_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PersonaStateChange_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_ulSteamID uint64 - public int ChangeFlags; // m_nChangeFlags int + internal ulong SteamID; // m_ulSteamID uint64 + internal int ChangeFlags; // m_nChangeFlags int // // Easily convert from PackSmall to PersonaStateChange_t @@ -1760,95 +1753,80 @@ public static implicit operator PersonaStateChange_t ( PersonaStateChange_t.Pac } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( PersonaStateChange_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( PersonaStateChange_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -1871,27 +1849,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GameOverlayActivated_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 31; - public byte Active; // m_bActive uint8 + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 31; + internal byte Active; // m_bActive uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameOverlayActivated_t FromPointer( IntPtr p ) + internal static GameOverlayActivated_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameOverlayActivated_t) Marshal.PtrToStructure( p, typeof(GameOverlayActivated_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameOverlayActivated_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public byte Active; // m_bActive uint8 + internal byte Active; // m_bActive uint8 // // Easily convert from PackSmall to GameOverlayActivated_t @@ -1905,95 +1921,80 @@ public static implicit operator GameOverlayActivated_t ( GameOverlayActivated_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameOverlayActivated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameOverlayActivated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -2016,33 +2017,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GameServerChangeRequested_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 32; + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 32; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string Server; // m_rgchServer char [64] + internal string Server; // m_rgchServer char [64] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string Password; // m_rgchPassword char [64] + internal string Password; // m_rgchPassword char [64] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameServerChangeRequested_t FromPointer( IntPtr p ) + internal static GameServerChangeRequested_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameServerChangeRequested_t) Marshal.PtrToStructure( p, typeof(GameServerChangeRequested_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameServerChangeRequested_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string Server; // m_rgchServer char [64] + internal string Server; // m_rgchServer char [64] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string Password; // m_rgchPassword char [64] + internal string Password; // m_rgchPassword char [64] // // Easily convert from PackSmall to GameServerChangeRequested_t @@ -2057,95 +2096,80 @@ public static implicit operator GameServerChangeRequested_t ( GameServerChangeR } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameServerChangeRequested_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameServerChangeRequested_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -2168,29 +2192,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GameLobbyJoinRequested_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 33; - public ulong SteamIDLobby; // m_steamIDLobby class CSteamID - public ulong SteamIDFriend; // m_steamIDFriend class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 33; + internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID + internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameLobbyJoinRequested_t FromPointer( IntPtr p ) + internal static GameLobbyJoinRequested_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameLobbyJoinRequested_t) Marshal.PtrToStructure( p, typeof(GameLobbyJoinRequested_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameLobbyJoinRequested_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_steamIDLobby class CSteamID - public ulong SteamIDFriend; // m_steamIDFriend class CSteamID + internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID + internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID // // Easily convert from PackSmall to GameLobbyJoinRequested_t @@ -2205,95 +2267,80 @@ public static implicit operator GameLobbyJoinRequested_t ( GameLobbyJoinRequest } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameLobbyJoinRequested_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameLobbyJoinRequested_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -2316,33 +2363,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct AvatarImageLoaded_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 34; - public ulong SteamID; // m_steamID class CSteamID - public int Image; // m_iImage int - public int Wide; // m_iWide int - public int Tall; // m_iTall int + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 34; + internal ulong SteamID; // m_steamID class CSteamID + internal int Image; // m_iImage int + internal int Wide; // m_iWide int + internal int Tall; // m_iTall int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static AvatarImageLoaded_t FromPointer( IntPtr p ) + internal static AvatarImageLoaded_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (AvatarImageLoaded_t) Marshal.PtrToStructure( p, typeof(AvatarImageLoaded_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(AvatarImageLoaded_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_steamID class CSteamID - public int Image; // m_iImage int - public int Wide; // m_iWide int - public int Tall; // m_iTall int + internal ulong SteamID; // m_steamID class CSteamID + internal int Image; // m_iImage int + internal int Wide; // m_iWide int + internal int Tall; // m_iTall int // // Easily convert from PackSmall to AvatarImageLoaded_t @@ -2359,95 +2444,80 @@ public static implicit operator AvatarImageLoaded_t ( AvatarImageLoaded_t.PackS } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AvatarImageLoaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AvatarImageLoaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -2470,31 +2540,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct ClanOfficerListResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 35; - public ulong SteamIDClan; // m_steamIDClan class CSteamID - public int COfficers; // m_cOfficers int - public byte Success; // m_bSuccess uint8 + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 35; + internal ulong SteamIDClan; // m_steamIDClan class CSteamID + internal int COfficers; // m_cOfficers int + internal byte Success; // m_bSuccess uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ClanOfficerListResponse_t FromPointer( IntPtr p ) + internal static ClanOfficerListResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ClanOfficerListResponse_t) Marshal.PtrToStructure( p, typeof(ClanOfficerListResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ClanOfficerListResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDClan; // m_steamIDClan class CSteamID - public int COfficers; // m_cOfficers int - public byte Success; // m_bSuccess uint8 + internal ulong SteamIDClan; // m_steamIDClan class CSteamID + internal int COfficers; // m_cOfficers int + internal byte Success; // m_bSuccess uint8 // // Easily convert from PackSmall to ClanOfficerListResponse_t @@ -2510,225 +2618,85 @@ public static implicit operator ClanOfficerListResponse_t ( ClanOfficerListResp } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ClanOfficerListResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ClanOfficerListResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ClanOfficerListResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ClanOfficerListResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -2751,29 +2719,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct FriendRichPresenceUpdate_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 36; - public ulong SteamIDFriend; // m_steamIDFriend class CSteamID - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 36; + internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FriendRichPresenceUpdate_t FromPointer( IntPtr p ) + internal static FriendRichPresenceUpdate_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FriendRichPresenceUpdate_t) Marshal.PtrToStructure( p, typeof(FriendRichPresenceUpdate_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendRichPresenceUpdate_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDFriend; // m_steamIDFriend class CSteamID - public uint AppID; // m_nAppID AppId_t + internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to FriendRichPresenceUpdate_t @@ -2788,95 +2794,80 @@ public static implicit operator FriendRichPresenceUpdate_t ( FriendRichPresence } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendRichPresenceUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendRichPresenceUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -2899,31 +2890,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GameRichPresenceJoinRequested_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 37; - public ulong SteamIDFriend; // m_steamIDFriend class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 37; + internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string Connect; // m_rgchConnect char [256] + internal string Connect; // m_rgchConnect char [256] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameRichPresenceJoinRequested_t FromPointer( IntPtr p ) + internal static GameRichPresenceJoinRequested_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameRichPresenceJoinRequested_t) Marshal.PtrToStructure( p, typeof(GameRichPresenceJoinRequested_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameRichPresenceJoinRequested_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDFriend; // m_steamIDFriend class CSteamID + internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string Connect; // m_rgchConnect char [256] + internal string Connect; // m_rgchConnect char [256] // // Easily convert from PackSmall to GameRichPresenceJoinRequested_t @@ -2938,95 +2967,80 @@ public static implicit operator GameRichPresenceJoinRequested_t ( GameRichPrese } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameRichPresenceJoinRequested_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameRichPresenceJoinRequested_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -3049,31 +3063,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GameConnectedClanChatMsg_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 38; - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ulong SteamIDUser; // m_steamIDUser class CSteamID - public int MessageID; // m_iMessageID int + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 38; + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID + internal int MessageID; // m_iMessageID int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameConnectedClanChatMsg_t FromPointer( IntPtr p ) + internal static GameConnectedClanChatMsg_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameConnectedClanChatMsg_t) Marshal.PtrToStructure( p, typeof(GameConnectedClanChatMsg_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedClanChatMsg_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ulong SteamIDUser; // m_steamIDUser class CSteamID - public int MessageID; // m_iMessageID int + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID + internal int MessageID; // m_iMessageID int // // Easily convert from PackSmall to GameConnectedClanChatMsg_t @@ -3089,95 +3141,80 @@ public static implicit operator GameConnectedClanChatMsg_t ( GameConnectedClanC } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameConnectedClanChatMsg_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameConnectedClanChatMsg_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -3200,29 +3237,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GameConnectedChatJoin_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 39; - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 39; + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameConnectedChatJoin_t FromPointer( IntPtr p ) + internal static GameConnectedChatJoin_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameConnectedChatJoin_t) Marshal.PtrToStructure( p, typeof(GameConnectedChatJoin_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedChatJoin_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Easily convert from PackSmall to GameConnectedChatJoin_t @@ -3237,95 +3312,80 @@ public static implicit operator GameConnectedChatJoin_t ( GameConnectedChatJoin } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameConnectedChatJoin_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameConnectedChatJoin_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -3348,37 +3408,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GameConnectedChatLeave_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 40; - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 40; + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID [MarshalAs(UnmanagedType.I1)] - public bool Kicked; // m_bKicked _Bool + internal bool Kicked; // m_bKicked _Bool [MarshalAs(UnmanagedType.I1)] - public bool Dropped; // m_bDropped _Bool + internal bool Dropped; // m_bDropped _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameConnectedChatLeave_t FromPointer( IntPtr p ) + internal static GameConnectedChatLeave_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameConnectedChatLeave_t) Marshal.PtrToStructure( p, typeof(GameConnectedChatLeave_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedChatLeave_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID [MarshalAs(UnmanagedType.I1)] - public bool Kicked; // m_bKicked _Bool + internal bool Kicked; // m_bKicked _Bool [MarshalAs(UnmanagedType.I1)] - public bool Dropped; // m_bDropped _Bool + internal bool Dropped; // m_bDropped _Bool // // Easily convert from PackSmall to GameConnectedChatLeave_t @@ -3395,95 +3493,80 @@ public static implicit operator GameConnectedChatLeave_t ( GameConnectedChatLea } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameConnectedChatLeave_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameConnectedChatLeave_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -3506,29 +3589,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct DownloadClanActivityCountsResult_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 41; + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 41; [MarshalAs(UnmanagedType.I1)] - public bool Success; // m_bSuccess _Bool + internal bool Success; // m_bSuccess _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static DownloadClanActivityCountsResult_t FromPointer( IntPtr p ) + internal static DownloadClanActivityCountsResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (DownloadClanActivityCountsResult_t) Marshal.PtrToStructure( p, typeof(DownloadClanActivityCountsResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(DownloadClanActivityCountsResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool Success; // m_bSuccess _Bool + internal bool Success; // m_bSuccess _Bool // // Easily convert from PackSmall to DownloadClanActivityCountsResult_t @@ -3542,95 +3663,80 @@ public static implicit operator DownloadClanActivityCountsResult_t ( DownloadCl } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( DownloadClanActivityCountsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( DownloadClanActivityCountsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -3653,29 +3759,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct JoinClanChatRoomCompletionResult_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 42; - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ChatRoomEnterResponse ChatRoomEnterResponse; // m_eChatRoomEnterResponse enum EChatRoomEnterResponse + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 42; + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ChatRoomEnterResponse ChatRoomEnterResponse; // m_eChatRoomEnterResponse enum EChatRoomEnterResponse // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static JoinClanChatRoomCompletionResult_t FromPointer( IntPtr p ) + internal static JoinClanChatRoomCompletionResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (JoinClanChatRoomCompletionResult_t) Marshal.PtrToStructure( p, typeof(JoinClanChatRoomCompletionResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(JoinClanChatRoomCompletionResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID - public ChatRoomEnterResponse ChatRoomEnterResponse; // m_eChatRoomEnterResponse enum EChatRoomEnterResponse + internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID + internal ChatRoomEnterResponse ChatRoomEnterResponse; // m_eChatRoomEnterResponse enum EChatRoomEnterResponse // // Easily convert from PackSmall to JoinClanChatRoomCompletionResult_t @@ -3690,225 +3834,85 @@ public static implicit operator JoinClanChatRoomCompletionResult_t ( JoinClanCh } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( JoinClanChatRoomCompletionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( JoinClanChatRoomCompletionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( JoinClanChatRoomCompletionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( JoinClanChatRoomCompletionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -3931,29 +3935,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GameConnectedFriendChatMsg_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 43; - public ulong SteamIDUser; // m_steamIDUser class CSteamID - public int MessageID; // m_iMessageID int + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 43; + internal ulong SteamIDUser; // m_steamIDUser class CSteamID + internal int MessageID; // m_iMessageID int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GameConnectedFriendChatMsg_t FromPointer( IntPtr p ) + internal static GameConnectedFriendChatMsg_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GameConnectedFriendChatMsg_t) Marshal.PtrToStructure( p, typeof(GameConnectedFriendChatMsg_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedFriendChatMsg_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDUser; // m_steamIDUser class CSteamID - public int MessageID; // m_iMessageID int + internal ulong SteamIDUser; // m_steamIDUser class CSteamID + internal int MessageID; // m_iMessageID int // // Easily convert from PackSmall to GameConnectedFriendChatMsg_t @@ -3968,95 +4010,80 @@ public static implicit operator GameConnectedFriendChatMsg_t ( GameConnectedFri } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GameConnectedFriendChatMsg_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GameConnectedFriendChatMsg_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -4079,31 +4106,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct FriendsGetFollowerCount_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 44; - public Result Result; // m_eResult enum EResult - public ulong SteamID; // m_steamID class CSteamID - public int Count; // m_nCount int + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 44; + internal Result Result; // m_eResult enum EResult + internal ulong SteamID; // m_steamID class CSteamID + internal int Count; // m_nCount int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FriendsGetFollowerCount_t FromPointer( IntPtr p ) + internal static FriendsGetFollowerCount_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FriendsGetFollowerCount_t) Marshal.PtrToStructure( p, typeof(FriendsGetFollowerCount_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsGetFollowerCount_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong SteamID; // m_steamID class CSteamID - public int Count; // m_nCount int + internal Result Result; // m_eResult enum EResult + internal ulong SteamID; // m_steamID class CSteamID + internal int Count; // m_nCount int // // Easily convert from PackSmall to FriendsGetFollowerCount_t @@ -4119,225 +4184,85 @@ public static implicit operator FriendsGetFollowerCount_t ( FriendsGetFollowerC } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendsGetFollowerCount_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendsGetFollowerCount_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendsGetFollowerCount_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendsGetFollowerCount_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -4360,33 +4285,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct FriendsIsFollowing_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 45; - public Result Result; // m_eResult enum EResult - public ulong SteamID; // m_steamID class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 45; + internal Result Result; // m_eResult enum EResult + internal ulong SteamID; // m_steamID class CSteamID [MarshalAs(UnmanagedType.I1)] - public bool IsFollowing; // m_bIsFollowing _Bool + internal bool IsFollowing; // m_bIsFollowing _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FriendsIsFollowing_t FromPointer( IntPtr p ) + internal static FriendsIsFollowing_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FriendsIsFollowing_t) Marshal.PtrToStructure( p, typeof(FriendsIsFollowing_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsIsFollowing_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong SteamID; // m_steamID class CSteamID + internal Result Result; // m_eResult enum EResult + internal ulong SteamID; // m_steamID class CSteamID [MarshalAs(UnmanagedType.I1)] - public bool IsFollowing; // m_bIsFollowing _Bool + internal bool IsFollowing; // m_bIsFollowing _Bool // // Easily convert from PackSmall to FriendsIsFollowing_t @@ -4402,225 +4365,85 @@ public static implicit operator FriendsIsFollowing_t ( FriendsIsFollowing_t.Pac } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendsIsFollowing_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendsIsFollowing_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendsIsFollowing_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendsIsFollowing_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -4643,35 +4466,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct FriendsEnumerateFollowingList_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 46; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 46; + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GSteamID; // m_rgSteamID class CSteamID [50] - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal ulong[] GSteamID; // m_rgSteamID class CSteamID [50] + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FriendsEnumerateFollowingList_t FromPointer( IntPtr p ) + internal static FriendsEnumerateFollowingList_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FriendsEnumerateFollowingList_t) Marshal.PtrToStructure( p, typeof(FriendsEnumerateFollowingList_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsEnumerateFollowingList_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GSteamID; // m_rgSteamID class CSteamID [50] - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal ulong[] GSteamID; // m_rgSteamID class CSteamID [50] + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 // // Easily convert from PackSmall to FriendsEnumerateFollowingList_t @@ -4688,225 +4549,85 @@ public static implicit operator FriendsEnumerateFollowingList_t ( FriendsEnumer } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendsEnumerateFollowingList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendsEnumerateFollowingList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FriendsEnumerateFollowingList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FriendsEnumerateFollowingList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -4929,35 +4650,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SetPersonaNameResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamFriends + 47; + internal const int CallbackId = CallbackIdentifiers.SteamFriends + 47; [MarshalAs(UnmanagedType.I1)] - public bool Success; // m_bSuccess _Bool + internal bool Success; // m_bSuccess _Bool [MarshalAs(UnmanagedType.I1)] - public bool LocalSuccess; // m_bLocalSuccess _Bool - public Result Result; // m_result enum EResult + internal bool LocalSuccess; // m_bLocalSuccess _Bool + internal Result Result; // m_result enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SetPersonaNameResponse_t FromPointer( IntPtr p ) + internal static SetPersonaNameResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SetPersonaNameResponse_t) Marshal.PtrToStructure( p, typeof(SetPersonaNameResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SetPersonaNameResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool Success; // m_bSuccess _Bool + internal bool Success; // m_bSuccess _Bool [MarshalAs(UnmanagedType.I1)] - public bool LocalSuccess; // m_bLocalSuccess _Bool - public Result Result; // m_result enum EResult + internal bool LocalSuccess; // m_bLocalSuccess _Bool + internal Result Result; // m_result enum EResult // // Easily convert from PackSmall to SetPersonaNameResponse_t @@ -4973,225 +4732,85 @@ public static implicit operator SetPersonaNameResponse_t ( SetPersonaNameRespon } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SetPersonaNameResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SetPersonaNameResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SetPersonaNameResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SetPersonaNameResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -5214,27 +4833,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LowBatteryPower_t { - public const int CallbackId = CallbackIdentifiers.SteamUtils + 2; - public byte MinutesBatteryLeft; // m_nMinutesBatteryLeft uint8 + internal const int CallbackId = CallbackIdentifiers.SteamUtils + 2; + internal byte MinutesBatteryLeft; // m_nMinutesBatteryLeft uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LowBatteryPower_t FromPointer( IntPtr p ) + internal static LowBatteryPower_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LowBatteryPower_t) Marshal.PtrToStructure( p, typeof(LowBatteryPower_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LowBatteryPower_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public byte MinutesBatteryLeft; // m_nMinutesBatteryLeft uint8 + internal byte MinutesBatteryLeft; // m_nMinutesBatteryLeft uint8 // // Easily convert from PackSmall to LowBatteryPower_t @@ -5248,95 +4905,80 @@ public static implicit operator LowBatteryPower_t ( LowBatteryPower_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LowBatteryPower_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LowBatteryPower_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -5359,31 +5001,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamAPICallCompleted_t { - public const int CallbackId = CallbackIdentifiers.SteamUtils + 3; - public ulong AsyncCall; // m_hAsyncCall SteamAPICall_t - public int Callback; // m_iCallback int - public uint ParamCount; // m_cubParam uint32 + internal const int CallbackId = CallbackIdentifiers.SteamUtils + 3; + internal ulong AsyncCall; // m_hAsyncCall SteamAPICall_t + internal int Callback; // m_iCallback int + internal uint ParamCount; // m_cubParam uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamAPICallCompleted_t FromPointer( IntPtr p ) + internal static SteamAPICallCompleted_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamAPICallCompleted_t) Marshal.PtrToStructure( p, typeof(SteamAPICallCompleted_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamAPICallCompleted_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong AsyncCall; // m_hAsyncCall SteamAPICall_t - public int Callback; // m_iCallback int - public uint ParamCount; // m_cubParam uint32 + internal ulong AsyncCall; // m_hAsyncCall SteamAPICall_t + internal int Callback; // m_iCallback int + internal uint ParamCount; // m_cubParam uint32 // // Easily convert from PackSmall to SteamAPICallCompleted_t @@ -5399,95 +5079,80 @@ public static implicit operator SteamAPICallCompleted_t ( SteamAPICallCompleted } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamAPICallCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamAPICallCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -5510,27 +5175,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct CheckFileSignature_t { - public const int CallbackId = CallbackIdentifiers.SteamUtils + 5; - public CheckFileSignature CheckFileSignature; // m_eCheckFileSignature enum ECheckFileSignature + internal const int CallbackId = CallbackIdentifiers.SteamUtils + 5; + internal CheckFileSignature CheckFileSignature; // m_eCheckFileSignature enum ECheckFileSignature // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static CheckFileSignature_t FromPointer( IntPtr p ) + internal static CheckFileSignature_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (CheckFileSignature_t) Marshal.PtrToStructure( p, typeof(CheckFileSignature_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(CheckFileSignature_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public CheckFileSignature CheckFileSignature; // m_eCheckFileSignature enum ECheckFileSignature + internal CheckFileSignature CheckFileSignature; // m_eCheckFileSignature enum ECheckFileSignature // // Easily convert from PackSmall to CheckFileSignature_t @@ -5544,225 +5247,85 @@ public static implicit operator CheckFileSignature_t ( CheckFileSignature_t.Pac } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( CheckFileSignature_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( CheckFileSignature_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( CheckFileSignature_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( CheckFileSignature_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -5785,31 +5348,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GamepadTextInputDismissed_t { - public const int CallbackId = CallbackIdentifiers.SteamUtils + 14; + internal const int CallbackId = CallbackIdentifiers.SteamUtils + 14; [MarshalAs(UnmanagedType.I1)] - public bool Submitted; // m_bSubmitted _Bool - public uint SubmittedText; // m_unSubmittedText uint32 + internal bool Submitted; // m_bSubmitted _Bool + internal uint SubmittedText; // m_unSubmittedText uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GamepadTextInputDismissed_t FromPointer( IntPtr p ) + internal static GamepadTextInputDismissed_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GamepadTextInputDismissed_t) Marshal.PtrToStructure( p, typeof(GamepadTextInputDismissed_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GamepadTextInputDismissed_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool Submitted; // m_bSubmitted _Bool - public uint SubmittedText; // m_unSubmittedText uint32 + internal bool Submitted; // m_bSubmitted _Bool + internal uint SubmittedText; // m_unSubmittedText uint32 // // Easily convert from PackSmall to GamepadTextInputDismissed_t @@ -5824,95 +5425,80 @@ public static implicit operator GamepadTextInputDismissed_t ( GamepadTextInputD } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GamepadTextInputDismissed_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GamepadTextInputDismissed_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -5935,32 +5521,70 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MatchMakingKeyValuePair_t { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string Key; // m_szKey char [256] + internal string Key; // m_szKey char [256] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string Value; // m_szValue char [256] + internal string Value; // m_szValue char [256] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MatchMakingKeyValuePair_t FromPointer( IntPtr p ) + internal static MatchMakingKeyValuePair_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MatchMakingKeyValuePair_t) Marshal.PtrToStructure( p, typeof(MatchMakingKeyValuePair_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MatchMakingKeyValuePair_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string Key; // m_szKey char [256] + internal string Key; // m_szKey char [256] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string Value; // m_szValue char [256] + internal string Value; // m_szValue char [256] // // Easily convert from PackSmall to MatchMakingKeyValuePair_t @@ -5979,25 +5603,34 @@ public static implicit operator MatchMakingKeyValuePair_t ( MatchMakingKeyValue [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct servernetadr_t { - public ushort ConnectionPort; // m_usConnectionPort uint16 - public ushort QueryPort; // m_usQueryPort uint16 - public uint IP; // m_unIP uint32 + internal ushort ConnectionPort; // m_usConnectionPort uint16 + internal ushort QueryPort; // m_usQueryPort uint16 + internal uint IP; // m_unIP uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static servernetadr_t FromPointer( IntPtr p ) + internal static servernetadr_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (servernetadr_t) Marshal.PtrToStructure( p, typeof(servernetadr_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(servernetadr_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ushort ConnectionPort; // m_usConnectionPort uint16 - public ushort QueryPort; // m_usQueryPort uint16 - public uint IP; // m_unIP uint32 + internal ushort ConnectionPort; // m_usConnectionPort uint16 + internal ushort QueryPort; // m_usQueryPort uint16 + internal uint IP; // m_unIP uint32 // // Easily convert from PackSmall to servernetadr_t @@ -6017,73 +5650,82 @@ public static implicit operator servernetadr_t ( servernetadr_t.PackSmall d ) [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct gameserveritem_t { - public servernetadr_t NetAdr; // m_NetAdr class servernetadr_t - public int Ping; // m_nPing int + internal servernetadr_t NetAdr; // m_NetAdr class servernetadr_t + internal int Ping; // m_nPing int [MarshalAs(UnmanagedType.I1)] - public bool HadSuccessfulResponse; // m_bHadSuccessfulResponse _Bool + internal bool HadSuccessfulResponse; // m_bHadSuccessfulResponse _Bool [MarshalAs(UnmanagedType.I1)] - public bool DoNotRefresh; // m_bDoNotRefresh _Bool + internal bool DoNotRefresh; // m_bDoNotRefresh _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string GameDir; // m_szGameDir char [32] + internal string GameDir; // m_szGameDir char [32] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string Map; // m_szMap char [32] + internal string Map; // m_szMap char [32] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string GameDescription; // m_szGameDescription char [64] - public uint AppID; // m_nAppID uint32 - public int Players; // m_nPlayers int - public int MaxPlayers; // m_nMaxPlayers int - public int BotPlayers; // m_nBotPlayers int + internal string GameDescription; // m_szGameDescription char [64] + internal uint AppID; // m_nAppID uint32 + internal int Players; // m_nPlayers int + internal int MaxPlayers; // m_nMaxPlayers int + internal int BotPlayers; // m_nBotPlayers int [MarshalAs(UnmanagedType.I1)] - public bool Password; // m_bPassword _Bool + internal bool Password; // m_bPassword _Bool [MarshalAs(UnmanagedType.I1)] - public bool Secure; // m_bSecure _Bool - public uint TimeLastPlayed; // m_ulTimeLastPlayed uint32 - public int ServerVersion; // m_nServerVersion int + internal bool Secure; // m_bSecure _Bool + internal uint TimeLastPlayed; // m_ulTimeLastPlayed uint32 + internal int ServerVersion; // m_nServerVersion int [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string ServerName; // m_szServerName char [64] + internal string ServerName; // m_szServerName char [64] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string GameTags; // m_szGameTags char [128] - public ulong SteamID; // m_steamID class CSteamID + internal string GameTags; // m_szGameTags char [128] + internal ulong SteamID; // m_steamID class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static gameserveritem_t FromPointer( IntPtr p ) + internal static gameserveritem_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (gameserveritem_t) Marshal.PtrToStructure( p, typeof(gameserveritem_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(gameserveritem_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public servernetadr_t NetAdr; // m_NetAdr class servernetadr_t - public int Ping; // m_nPing int + internal servernetadr_t NetAdr; // m_NetAdr class servernetadr_t + internal int Ping; // m_nPing int [MarshalAs(UnmanagedType.I1)] - public bool HadSuccessfulResponse; // m_bHadSuccessfulResponse _Bool + internal bool HadSuccessfulResponse; // m_bHadSuccessfulResponse _Bool [MarshalAs(UnmanagedType.I1)] - public bool DoNotRefresh; // m_bDoNotRefresh _Bool + internal bool DoNotRefresh; // m_bDoNotRefresh _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string GameDir; // m_szGameDir char [32] + internal string GameDir; // m_szGameDir char [32] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string Map; // m_szMap char [32] + internal string Map; // m_szMap char [32] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string GameDescription; // m_szGameDescription char [64] - public uint AppID; // m_nAppID uint32 - public int Players; // m_nPlayers int - public int MaxPlayers; // m_nMaxPlayers int - public int BotPlayers; // m_nBotPlayers int + internal string GameDescription; // m_szGameDescription char [64] + internal uint AppID; // m_nAppID uint32 + internal int Players; // m_nPlayers int + internal int MaxPlayers; // m_nMaxPlayers int + internal int BotPlayers; // m_nBotPlayers int [MarshalAs(UnmanagedType.I1)] - public bool Password; // m_bPassword _Bool + internal bool Password; // m_bPassword _Bool [MarshalAs(UnmanagedType.I1)] - public bool Secure; // m_bSecure _Bool - public uint TimeLastPlayed; // m_ulTimeLastPlayed uint32 - public int ServerVersion; // m_nServerVersion int + internal bool Secure; // m_bSecure _Bool + internal uint TimeLastPlayed; // m_ulTimeLastPlayed uint32 + internal int ServerVersion; // m_nServerVersion int [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] - public string ServerName; // m_szServerName char [64] + internal string ServerName; // m_szServerName char [64] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string GameTags; // m_szGameTags char [128] - public ulong SteamID; // m_steamID class CSteamID + internal string GameTags; // m_szGameTags char [128] + internal ulong SteamID; // m_steamID class CSteamID // // Easily convert from PackSmall to gameserveritem_t @@ -6118,36 +5760,45 @@ public static implicit operator gameserveritem_t ( gameserveritem_t.PackSmall d [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct FavoritesListChanged_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 2; - public uint IP; // m_nIP uint32 - public uint QueryPort; // m_nQueryPort uint32 - public uint ConnPort; // m_nConnPort uint32 - public uint AppID; // m_nAppID uint32 - public uint Flags; // m_nFlags uint32 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 2; + internal uint IP; // m_nIP uint32 + internal uint QueryPort; // m_nQueryPort uint32 + internal uint ConnPort; // m_nConnPort uint32 + internal uint AppID; // m_nAppID uint32 + internal uint Flags; // m_nFlags uint32 [MarshalAs(UnmanagedType.I1)] - public bool Add; // m_bAdd _Bool - public uint AccountId; // m_unAccountId AccountID_t + internal bool Add; // m_bAdd _Bool + internal uint AccountId; // m_unAccountId AccountID_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FavoritesListChanged_t FromPointer( IntPtr p ) + internal static FavoritesListChanged_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FavoritesListChanged_t) Marshal.PtrToStructure( p, typeof(FavoritesListChanged_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FavoritesListChanged_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint IP; // m_nIP uint32 - public uint QueryPort; // m_nQueryPort uint32 - public uint ConnPort; // m_nConnPort uint32 - public uint AppID; // m_nAppID uint32 - public uint Flags; // m_nFlags uint32 + internal uint IP; // m_nIP uint32 + internal uint QueryPort; // m_nQueryPort uint32 + internal uint ConnPort; // m_nConnPort uint32 + internal uint AppID; // m_nAppID uint32 + internal uint Flags; // m_nFlags uint32 [MarshalAs(UnmanagedType.I1)] - public bool Add; // m_bAdd _Bool - public uint AccountId; // m_unAccountId AccountID_t + internal bool Add; // m_bAdd _Bool + internal uint AccountId; // m_unAccountId AccountID_t // // Easily convert from PackSmall to FavoritesListChanged_t @@ -6167,95 +5818,80 @@ public static implicit operator FavoritesListChanged_t ( FavoritesListChanged_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FavoritesListChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FavoritesListChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -6278,31 +5914,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyInvite_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 3; - public ulong SteamIDUser; // m_ulSteamIDUser uint64 - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong GameID; // m_ulGameID uint64 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 3; + internal ulong SteamIDUser; // m_ulSteamIDUser uint64 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong GameID; // m_ulGameID uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyInvite_t FromPointer( IntPtr p ) + internal static LobbyInvite_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyInvite_t) Marshal.PtrToStructure( p, typeof(LobbyInvite_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyInvite_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDUser; // m_ulSteamIDUser uint64 - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong GameID; // m_ulGameID uint64 + internal ulong SteamIDUser; // m_ulSteamIDUser uint64 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong GameID; // m_ulGameID uint64 // // Easily convert from PackSmall to LobbyInvite_t @@ -6318,95 +5992,80 @@ public static implicit operator LobbyInvite_t ( LobbyInvite_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyInvite_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyInvite_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -6429,35 +6088,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyEnter_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 4; - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public uint GfChatPermissions; // m_rgfChatPermissions uint32 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 4; + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal uint GfChatPermissions; // m_rgfChatPermissions uint32 [MarshalAs(UnmanagedType.I1)] - public bool Locked; // m_bLocked _Bool - public uint EChatRoomEnterResponse; // m_EChatRoomEnterResponse uint32 + internal bool Locked; // m_bLocked _Bool + internal uint EChatRoomEnterResponse; // m_EChatRoomEnterResponse uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyEnter_t FromPointer( IntPtr p ) + internal static LobbyEnter_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyEnter_t) Marshal.PtrToStructure( p, typeof(LobbyEnter_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyEnter_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public uint GfChatPermissions; // m_rgfChatPermissions uint32 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal uint GfChatPermissions; // m_rgfChatPermissions uint32 [MarshalAs(UnmanagedType.I1)] - public bool Locked; // m_bLocked _Bool - public uint EChatRoomEnterResponse; // m_EChatRoomEnterResponse uint32 + internal bool Locked; // m_bLocked _Bool + internal uint EChatRoomEnterResponse; // m_EChatRoomEnterResponse uint32 // // Easily convert from PackSmall to LobbyEnter_t @@ -6474,225 +6171,85 @@ public static implicit operator LobbyEnter_t ( LobbyEnter_t.PackSmall d ) } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyEnter_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyEnter_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyEnter_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyEnter_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -6715,31 +6272,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyDataUpdate_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 5; - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDMember; // m_ulSteamIDMember uint64 - public byte Success; // m_bSuccess uint8 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 5; + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDMember; // m_ulSteamIDMember uint64 + internal byte Success; // m_bSuccess uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyDataUpdate_t FromPointer( IntPtr p ) + internal static LobbyDataUpdate_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyDataUpdate_t) Marshal.PtrToStructure( p, typeof(LobbyDataUpdate_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyDataUpdate_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDMember; // m_ulSteamIDMember uint64 - public byte Success; // m_bSuccess uint8 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDMember; // m_ulSteamIDMember uint64 + internal byte Success; // m_bSuccess uint8 // // Easily convert from PackSmall to LobbyDataUpdate_t @@ -6755,95 +6350,80 @@ public static implicit operator LobbyDataUpdate_t ( LobbyDataUpdate_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyDataUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyDataUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -6866,33 +6446,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyChatUpdate_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 6; - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDUserChanged; // m_ulSteamIDUserChanged uint64 - public ulong SteamIDMakingChange; // m_ulSteamIDMakingChange uint64 - public uint GfChatMemberStateChange; // m_rgfChatMemberStateChange uint32 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 6; + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDUserChanged; // m_ulSteamIDUserChanged uint64 + internal ulong SteamIDMakingChange; // m_ulSteamIDMakingChange uint64 + internal uint GfChatMemberStateChange; // m_rgfChatMemberStateChange uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyChatUpdate_t FromPointer( IntPtr p ) + internal static LobbyChatUpdate_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyChatUpdate_t) Marshal.PtrToStructure( p, typeof(LobbyChatUpdate_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyChatUpdate_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDUserChanged; // m_ulSteamIDUserChanged uint64 - public ulong SteamIDMakingChange; // m_ulSteamIDMakingChange uint64 - public uint GfChatMemberStateChange; // m_rgfChatMemberStateChange uint32 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDUserChanged; // m_ulSteamIDUserChanged uint64 + internal ulong SteamIDMakingChange; // m_ulSteamIDMakingChange uint64 + internal uint GfChatMemberStateChange; // m_rgfChatMemberStateChange uint32 // // Easily convert from PackSmall to LobbyChatUpdate_t @@ -6909,95 +6527,80 @@ public static implicit operator LobbyChatUpdate_t ( LobbyChatUpdate_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyChatUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyChatUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -7020,33 +6623,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyChatMsg_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 7; - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDUser; // m_ulSteamIDUser uint64 - public byte ChatEntryType; // m_eChatEntryType uint8 - public uint ChatID; // m_iChatID uint32 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 7; + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDUser; // m_ulSteamIDUser uint64 + internal byte ChatEntryType; // m_eChatEntryType uint8 + internal uint ChatID; // m_iChatID uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyChatMsg_t FromPointer( IntPtr p ) + internal static LobbyChatMsg_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyChatMsg_t) Marshal.PtrToStructure( p, typeof(LobbyChatMsg_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyChatMsg_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDUser; // m_ulSteamIDUser uint64 - public byte ChatEntryType; // m_eChatEntryType uint8 - public uint ChatID; // m_iChatID uint32 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDUser; // m_ulSteamIDUser uint64 + internal byte ChatEntryType; // m_eChatEntryType uint8 + internal uint ChatID; // m_iChatID uint32 // // Easily convert from PackSmall to LobbyChatMsg_t @@ -7063,95 +6704,80 @@ public static implicit operator LobbyChatMsg_t ( LobbyChatMsg_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyChatMsg_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyChatMsg_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -7174,33 +6800,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyGameCreated_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 9; - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDGameServer; // m_ulSteamIDGameServer uint64 - public uint IP; // m_unIP uint32 - public ushort Port; // m_usPort uint16 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 9; + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDGameServer; // m_ulSteamIDGameServer uint64 + internal uint IP; // m_unIP uint32 + internal ushort Port; // m_usPort uint16 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyGameCreated_t FromPointer( IntPtr p ) + internal static LobbyGameCreated_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyGameCreated_t) Marshal.PtrToStructure( p, typeof(LobbyGameCreated_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyGameCreated_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDGameServer; // m_ulSteamIDGameServer uint64 - public uint IP; // m_unIP uint32 - public ushort Port; // m_usPort uint16 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDGameServer; // m_ulSteamIDGameServer uint64 + internal uint IP; // m_unIP uint32 + internal ushort Port; // m_usPort uint16 // // Easily convert from PackSmall to LobbyGameCreated_t @@ -7217,95 +6881,80 @@ public static implicit operator LobbyGameCreated_t ( LobbyGameCreated_t.PackSma } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyGameCreated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyGameCreated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -7328,27 +6977,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyMatchList_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 10; - public uint LobbiesMatching; // m_nLobbiesMatching uint32 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 10; + internal uint LobbiesMatching; // m_nLobbiesMatching uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyMatchList_t FromPointer( IntPtr p ) + internal static LobbyMatchList_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyMatchList_t) Marshal.PtrToStructure( p, typeof(LobbyMatchList_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyMatchList_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint LobbiesMatching; // m_nLobbiesMatching uint32 + internal uint LobbiesMatching; // m_nLobbiesMatching uint32 // // Easily convert from PackSmall to LobbyMatchList_t @@ -7362,225 +7049,85 @@ public static implicit operator LobbyMatchList_t ( LobbyMatchList_t.PackSmall d } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyMatchList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyMatchList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyMatchList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyMatchList_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -7603,31 +7150,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyKicked_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 12; - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDAdmin; // m_ulSteamIDAdmin uint64 - public byte KickedDueToDisconnect; // m_bKickedDueToDisconnect uint8 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 12; + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDAdmin; // m_ulSteamIDAdmin uint64 + internal byte KickedDueToDisconnect; // m_bKickedDueToDisconnect uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyKicked_t FromPointer( IntPtr p ) + internal static LobbyKicked_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyKicked_t) Marshal.PtrToStructure( p, typeof(LobbyKicked_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyKicked_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 - public ulong SteamIDAdmin; // m_ulSteamIDAdmin uint64 - public byte KickedDueToDisconnect; // m_bKickedDueToDisconnect uint8 + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal ulong SteamIDAdmin; // m_ulSteamIDAdmin uint64 + internal byte KickedDueToDisconnect; // m_bKickedDueToDisconnect uint8 // // Easily convert from PackSmall to LobbyKicked_t @@ -7643,95 +7228,80 @@ public static implicit operator LobbyKicked_t ( LobbyKicked_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyKicked_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyKicked_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -7754,29 +7324,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LobbyCreated_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 13; - public Result Result; // m_eResult enum EResult - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 13; + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LobbyCreated_t FromPointer( IntPtr p ) + internal static LobbyCreated_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LobbyCreated_t) Marshal.PtrToStructure( p, typeof(LobbyCreated_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LobbyCreated_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong SteamIDLobby; // m_ulSteamIDLobby uint64 + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64 // // Easily convert from PackSmall to LobbyCreated_t @@ -7791,225 +7399,85 @@ public static implicit operator LobbyCreated_t ( LobbyCreated_t.PackSmall d ) } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyCreated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyCreated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LobbyCreated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LobbyCreated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8032,31 +7500,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PSNGameBootInviteResult_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 15; + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 15; [MarshalAs(UnmanagedType.I1)] - public bool GameBootInviteExists; // m_bGameBootInviteExists _Bool - public ulong SteamIDLobby; // m_steamIDLobby class CSteamID + internal bool GameBootInviteExists; // m_bGameBootInviteExists _Bool + internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static PSNGameBootInviteResult_t FromPointer( IntPtr p ) + internal static PSNGameBootInviteResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (PSNGameBootInviteResult_t) Marshal.PtrToStructure( p, typeof(PSNGameBootInviteResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PSNGameBootInviteResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool GameBootInviteExists; // m_bGameBootInviteExists _Bool - public ulong SteamIDLobby; // m_steamIDLobby class CSteamID + internal bool GameBootInviteExists; // m_bGameBootInviteExists _Bool + internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID // // Easily convert from PackSmall to PSNGameBootInviteResult_t @@ -8071,95 +7577,80 @@ public static implicit operator PSNGameBootInviteResult_t ( PSNGameBootInviteRe } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( PSNGameBootInviteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( PSNGameBootInviteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8182,27 +7673,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct FavoritesListAccountsUpdated_t { - public const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 16; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamMatchmaking + 16; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FavoritesListAccountsUpdated_t FromPointer( IntPtr p ) + internal static FavoritesListAccountsUpdated_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FavoritesListAccountsUpdated_t) Marshal.PtrToStructure( p, typeof(FavoritesListAccountsUpdated_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FavoritesListAccountsUpdated_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to FavoritesListAccountsUpdated_t @@ -8216,95 +7745,80 @@ public static implicit operator FavoritesListAccountsUpdated_t ( FavoritesListA } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FavoritesListAccountsUpdated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FavoritesListAccountsUpdated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8327,28 +7841,66 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamParamStringArray_t { - public IntPtr Strings; // m_ppStrings const char ** - public int NumStrings; // m_nNumStrings int32 + internal IntPtr Strings; // m_ppStrings const char ** + internal int NumStrings; // m_nNumStrings int32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamParamStringArray_t FromPointer( IntPtr p ) + internal static SteamParamStringArray_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamParamStringArray_t) Marshal.PtrToStructure( p, typeof(SteamParamStringArray_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamParamStringArray_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public IntPtr Strings; // m_ppStrings const char ** - public int NumStrings; // m_nNumStrings int32 + internal IntPtr Strings; // m_ppStrings const char ** + internal int NumStrings; // m_nNumStrings int32 // // Easily convert from PackSmall to SteamParamStringArray_t @@ -8367,26 +7919,35 @@ public static implicit operator SteamParamStringArray_t ( SteamParamStringArray [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageAppSyncedClient_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 1; - public uint AppID; // m_nAppID AppId_t - public Result Result; // m_eResult enum EResult - public int NumDownloads; // m_unNumDownloads int + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 1; + internal uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal int NumDownloads; // m_unNumDownloads int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageAppSyncedClient_t FromPointer( IntPtr p ) + internal static RemoteStorageAppSyncedClient_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageAppSyncedClient_t) Marshal.PtrToStructure( p, typeof(RemoteStorageAppSyncedClient_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncedClient_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_nAppID AppId_t - public Result Result; // m_eResult enum EResult - public int NumDownloads; // m_unNumDownloads int + internal uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal int NumDownloads; // m_unNumDownloads int // // Easily convert from PackSmall to RemoteStorageAppSyncedClient_t @@ -8402,95 +7963,80 @@ public static implicit operator RemoteStorageAppSyncedClient_t ( RemoteStorageA } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncedClient_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncedClient_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8513,31 +8059,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageAppSyncedServer_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 2; - public uint AppID; // m_nAppID AppId_t - public Result Result; // m_eResult enum EResult - public int NumUploads; // m_unNumUploads int + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 2; + internal uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal int NumUploads; // m_unNumUploads int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageAppSyncedServer_t FromPointer( IntPtr p ) + internal static RemoteStorageAppSyncedServer_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageAppSyncedServer_t) Marshal.PtrToStructure( p, typeof(RemoteStorageAppSyncedServer_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncedServer_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_nAppID AppId_t - public Result Result; // m_eResult enum EResult - public int NumUploads; // m_unNumUploads int + internal uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal int NumUploads; // m_unNumUploads int // // Easily convert from PackSmall to RemoteStorageAppSyncedServer_t @@ -8553,95 +8137,80 @@ public static implicit operator RemoteStorageAppSyncedServer_t ( RemoteStorageA } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncedServer_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncedServer_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8664,39 +8233,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageAppSyncProgress_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 3; + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 3; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string CurrentFile; // m_rgchCurrentFile char [260] - public uint AppID; // m_nAppID AppId_t - public uint BytesTransferredThisChunk; // m_uBytesTransferredThisChunk uint32 - public double DAppPercentComplete; // m_dAppPercentComplete double + internal string CurrentFile; // m_rgchCurrentFile char [260] + internal uint AppID; // m_nAppID AppId_t + internal uint BytesTransferredThisChunk; // m_uBytesTransferredThisChunk uint32 + internal double DAppPercentComplete; // m_dAppPercentComplete double [MarshalAs(UnmanagedType.I1)] - public bool Uploading; // m_bUploading _Bool + internal bool Uploading; // m_bUploading _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageAppSyncProgress_t FromPointer( IntPtr p ) + internal static RemoteStorageAppSyncProgress_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageAppSyncProgress_t) Marshal.PtrToStructure( p, typeof(RemoteStorageAppSyncProgress_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncProgress_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string CurrentFile; // m_rgchCurrentFile char [260] - public uint AppID; // m_nAppID AppId_t - public uint BytesTransferredThisChunk; // m_uBytesTransferredThisChunk uint32 - public double DAppPercentComplete; // m_dAppPercentComplete double + internal string CurrentFile; // m_rgchCurrentFile char [260] + internal uint AppID; // m_nAppID AppId_t + internal uint BytesTransferredThisChunk; // m_uBytesTransferredThisChunk uint32 + internal double DAppPercentComplete; // m_dAppPercentComplete double [MarshalAs(UnmanagedType.I1)] - public bool Uploading; // m_bUploading _Bool + internal bool Uploading; // m_bUploading _Bool // // Easily convert from PackSmall to RemoteStorageAppSyncProgress_t @@ -8714,95 +8321,80 @@ public static implicit operator RemoteStorageAppSyncProgress_t ( RemoteStorageA } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncProgress_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncProgress_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8825,29 +8417,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageAppSyncStatusCheck_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 5; - public uint AppID; // m_nAppID AppId_t - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 5; + internal uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageAppSyncStatusCheck_t FromPointer( IntPtr p ) + internal static RemoteStorageAppSyncStatusCheck_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageAppSyncStatusCheck_t) Marshal.PtrToStructure( p, typeof(RemoteStorageAppSyncStatusCheck_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncStatusCheck_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_nAppID AppId_t - public Result Result; // m_eResult enum EResult + internal uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to RemoteStorageAppSyncStatusCheck_t @@ -8862,95 +8492,80 @@ public static implicit operator RemoteStorageAppSyncStatusCheck_t ( RemoteStora } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncStatusCheck_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageAppSyncStatusCheck_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -8973,33 +8588,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageFileShareResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 7; - public Result Result; // m_eResult enum EResult - public ulong File; // m_hFile UGCHandle_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 7; + internal Result Result; // m_eResult enum EResult + internal ulong File; // m_hFile UGCHandle_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string Filename; // m_rgchFilename char [260] + internal string Filename; // m_rgchFilename char [260] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageFileShareResult_t FromPointer( IntPtr p ) + internal static RemoteStorageFileShareResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageFileShareResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageFileShareResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageFileShareResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong File; // m_hFile UGCHandle_t + internal Result Result; // m_eResult enum EResult + internal ulong File; // m_hFile UGCHandle_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string Filename; // m_rgchFilename char [260] + internal string Filename; // m_rgchFilename char [260] // // Easily convert from PackSmall to RemoteStorageFileShareResult_t @@ -9015,225 +8668,85 @@ public static implicit operator RemoteStorageFileShareResult_t ( RemoteStorageF } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageFileShareResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageFileShareResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageFileShareResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageFileShareResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -9256,33 +8769,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStoragePublishFileResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 9; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 9; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStoragePublishFileResult_t FromPointer( IntPtr p ) + internal static RemoteStoragePublishFileResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStoragePublishFileResult_t) Marshal.PtrToStructure( p, typeof(RemoteStoragePublishFileResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStoragePublishFileResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool // // Easily convert from PackSmall to RemoteStoragePublishFileResult_t @@ -9298,95 +8849,80 @@ public static implicit operator RemoteStoragePublishFileResult_t ( RemoteStorag } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -9409,29 +8945,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageDeletePublishedFileResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 11; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 11; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageDeletePublishedFileResult_t FromPointer( IntPtr p ) + internal static RemoteStorageDeletePublishedFileResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageDeletePublishedFileResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageDeletePublishedFileResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageDeletePublishedFileResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to RemoteStorageDeletePublishedFileResult_t @@ -9446,225 +9020,85 @@ public static implicit operator RemoteStorageDeletePublishedFileResult_t ( Remo } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageDeletePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageDeletePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageDeletePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageDeletePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -9687,35 +9121,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageEnumerateUserPublishedFilesResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 12; - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 12; + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageEnumerateUserPublishedFilesResult_t FromPointer( IntPtr p ) + internal static RemoteStorageEnumerateUserPublishedFilesResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageEnumerateUserPublishedFilesResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageEnumerateUserPublishedFilesResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageEnumerateUserPublishedFilesResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] // // Easily convert from PackSmall to RemoteStorageEnumerateUserPublishedFilesResult_t @@ -9732,225 +9204,85 @@ public static implicit operator RemoteStorageEnumerateUserPublishedFilesResult_t } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserPublishedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserPublishedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserPublishedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserPublishedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -9973,29 +9305,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageSubscribePublishedFileResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 13; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 13; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageSubscribePublishedFileResult_t FromPointer( IntPtr p ) + internal static RemoteStorageSubscribePublishedFileResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageSubscribePublishedFileResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageSubscribePublishedFileResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageSubscribePublishedFileResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to RemoteStorageSubscribePublishedFileResult_t @@ -10010,225 +9380,85 @@ public static implicit operator RemoteStorageSubscribePublishedFileResult_t ( R } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageSubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageSubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageSubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageSubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -10251,39 +9481,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageEnumerateUserSubscribedFilesResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 14; - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 14; + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U4)] - public uint[] GRTimeSubscribed; // m_rgRTimeSubscribed uint32 [50] + internal uint[] GRTimeSubscribed; // m_rgRTimeSubscribed uint32 [50] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageEnumerateUserSubscribedFilesResult_t FromPointer( IntPtr p ) + internal static RemoteStorageEnumerateUserSubscribedFilesResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageEnumerateUserSubscribedFilesResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageEnumerateUserSubscribedFilesResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageEnumerateUserSubscribedFilesResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U4)] - public uint[] GRTimeSubscribed; // m_rgRTimeSubscribed uint32 [50] + internal uint[] GRTimeSubscribed; // m_rgRTimeSubscribed uint32 [50] // // Easily convert from PackSmall to RemoteStorageEnumerateUserSubscribedFilesResult_t @@ -10301,225 +9569,85 @@ public static implicit operator RemoteStorageEnumerateUserSubscribedFilesResult_ } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -10542,29 +9670,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageUnsubscribePublishedFileResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 15; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 15; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageUnsubscribePublishedFileResult_t FromPointer( IntPtr p ) + internal static RemoteStorageUnsubscribePublishedFileResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageUnsubscribePublishedFileResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageUnsubscribePublishedFileResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageUnsubscribePublishedFileResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to RemoteStorageUnsubscribePublishedFileResult_t @@ -10579,225 +9745,85 @@ public static implicit operator RemoteStorageUnsubscribePublishedFileResult_t ( } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUnsubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUnsubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUnsubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUnsubscribePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -10820,33 +9846,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageUpdatePublishedFileResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 16; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 16; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageUpdatePublishedFileResult_t FromPointer( IntPtr p ) + internal static RemoteStorageUpdatePublishedFileResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageUpdatePublishedFileResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageUpdatePublishedFileResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageUpdatePublishedFileResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool // // Easily convert from PackSmall to RemoteStorageUpdatePublishedFileResult_t @@ -10862,225 +9926,85 @@ public static implicit operator RemoteStorageUpdatePublishedFileResult_t ( Remo } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUpdatePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUpdatePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUpdatePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUpdatePublishedFileResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -11103,39 +10027,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageDownloadUGCResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 17; - public Result Result; // m_eResult enum EResult - public ulong File; // m_hFile UGCHandle_t - public uint AppID; // m_nAppID AppId_t - public int SizeInBytes; // m_nSizeInBytes int32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 17; + internal Result Result; // m_eResult enum EResult + internal ulong File; // m_hFile UGCHandle_t + internal uint AppID; // m_nAppID AppId_t + internal int SizeInBytes; // m_nSizeInBytes int32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string PchFileName; // m_pchFileName char [260] - public ulong SteamIDOwner; // m_ulSteamIDOwner uint64 + internal string PchFileName; // m_pchFileName char [260] + internal ulong SteamIDOwner; // m_ulSteamIDOwner uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageDownloadUGCResult_t FromPointer( IntPtr p ) + internal static RemoteStorageDownloadUGCResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageDownloadUGCResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageDownloadUGCResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageDownloadUGCResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong File; // m_hFile UGCHandle_t - public uint AppID; // m_nAppID AppId_t - public int SizeInBytes; // m_nSizeInBytes int32 + internal Result Result; // m_eResult enum EResult + internal ulong File; // m_hFile UGCHandle_t + internal uint AppID; // m_nAppID AppId_t + internal int SizeInBytes; // m_nSizeInBytes int32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string PchFileName; // m_pchFileName char [260] - public ulong SteamIDOwner; // m_ulSteamIDOwner uint64 + internal string PchFileName; // m_pchFileName char [260] + internal ulong SteamIDOwner; // m_ulSteamIDOwner uint64 // // Easily convert from PackSmall to RemoteStorageDownloadUGCResult_t @@ -11154,225 +10116,85 @@ public static implicit operator RemoteStorageDownloadUGCResult_t ( RemoteStorag } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageDownloadUGCResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageDownloadUGCResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageDownloadUGCResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageDownloadUGCResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -11395,83 +10217,121 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageGetPublishedFileDetailsResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 18; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint CreatorAppID; // m_nCreatorAppID AppId_t - public uint ConsumerAppID; // m_nConsumerAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 18; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint CreatorAppID; // m_nCreatorAppID AppId_t + internal uint ConsumerAppID; // m_nConsumerAppID AppId_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] - public string Title; // m_rgchTitle char [129] + internal string Title; // m_rgchTitle char [129] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8000)] - public string Description; // m_rgchDescription char [8000] - public ulong File; // m_hFile UGCHandle_t - public ulong PreviewFile; // m_hPreviewFile UGCHandle_t - public ulong SteamIDOwner; // m_ulSteamIDOwner uint64 - public uint TimeCreated; // m_rtimeCreated uint32 - public uint TimeUpdated; // m_rtimeUpdated uint32 - public RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility + internal string Description; // m_rgchDescription char [8000] + internal ulong File; // m_hFile UGCHandle_t + internal ulong PreviewFile; // m_hPreviewFile UGCHandle_t + internal ulong SteamIDOwner; // m_ulSteamIDOwner uint64 + internal uint TimeCreated; // m_rtimeCreated uint32 + internal uint TimeUpdated; // m_rtimeUpdated uint32 + internal RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility [MarshalAs(UnmanagedType.I1)] - public bool Banned; // m_bBanned _Bool + internal bool Banned; // m_bBanned _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1025)] - public string Tags; // m_rgchTags char [1025] + internal string Tags; // m_rgchTags char [1025] [MarshalAs(UnmanagedType.I1)] - public bool TagsTruncated; // m_bTagsTruncated _Bool + internal bool TagsTruncated; // m_bTagsTruncated _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string PchFileName; // m_pchFileName char [260] - public int FileSize; // m_nFileSize int32 - public int PreviewFileSize; // m_nPreviewFileSize int32 + internal string PchFileName; // m_pchFileName char [260] + internal int FileSize; // m_nFileSize int32 + internal int PreviewFileSize; // m_nPreviewFileSize int32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_rgchURL char [256] - public WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType + internal string URL; // m_rgchURL char [256] + internal WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType [MarshalAs(UnmanagedType.I1)] - public bool AcceptedForUse; // m_bAcceptedForUse _Bool + internal bool AcceptedForUse; // m_bAcceptedForUse _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageGetPublishedFileDetailsResult_t FromPointer( IntPtr p ) + internal static RemoteStorageGetPublishedFileDetailsResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageGetPublishedFileDetailsResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageGetPublishedFileDetailsResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageGetPublishedFileDetailsResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint CreatorAppID; // m_nCreatorAppID AppId_t - public uint ConsumerAppID; // m_nConsumerAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint CreatorAppID; // m_nCreatorAppID AppId_t + internal uint ConsumerAppID; // m_nConsumerAppID AppId_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] - public string Title; // m_rgchTitle char [129] + internal string Title; // m_rgchTitle char [129] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8000)] - public string Description; // m_rgchDescription char [8000] - public ulong File; // m_hFile UGCHandle_t - public ulong PreviewFile; // m_hPreviewFile UGCHandle_t - public ulong SteamIDOwner; // m_ulSteamIDOwner uint64 - public uint TimeCreated; // m_rtimeCreated uint32 - public uint TimeUpdated; // m_rtimeUpdated uint32 - public RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility + internal string Description; // m_rgchDescription char [8000] + internal ulong File; // m_hFile UGCHandle_t + internal ulong PreviewFile; // m_hPreviewFile UGCHandle_t + internal ulong SteamIDOwner; // m_ulSteamIDOwner uint64 + internal uint TimeCreated; // m_rtimeCreated uint32 + internal uint TimeUpdated; // m_rtimeUpdated uint32 + internal RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility [MarshalAs(UnmanagedType.I1)] - public bool Banned; // m_bBanned _Bool + internal bool Banned; // m_bBanned _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1025)] - public string Tags; // m_rgchTags char [1025] + internal string Tags; // m_rgchTags char [1025] [MarshalAs(UnmanagedType.I1)] - public bool TagsTruncated; // m_bTagsTruncated _Bool + internal bool TagsTruncated; // m_bTagsTruncated _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string PchFileName; // m_pchFileName char [260] - public int FileSize; // m_nFileSize int32 - public int PreviewFileSize; // m_nPreviewFileSize int32 + internal string PchFileName; // m_pchFileName char [260] + internal int FileSize; // m_nFileSize int32 + internal int PreviewFileSize; // m_nPreviewFileSize int32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_rgchURL char [256] - public WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType + internal string URL; // m_rgchURL char [256] + internal WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType [MarshalAs(UnmanagedType.I1)] - public bool AcceptedForUse; // m_bAcceptedForUse _Bool + internal bool AcceptedForUse; // m_bAcceptedForUse _Bool // // Easily convert from PackSmall to RemoteStorageGetPublishedFileDetailsResult_t @@ -11505,225 +10365,85 @@ public static implicit operator RemoteStorageGetPublishedFileDetailsResult_t ( } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedFileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedFileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedFileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedFileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -11746,43 +10466,81 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageEnumerateWorkshopFilesResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 19; - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 19; + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.R4)] - public float[] GScore; // m_rgScore float [50] - public uint AppId; // m_nAppId AppId_t - public uint StartIndex; // m_unStartIndex uint32 + internal float[] GScore; // m_rgScore float [50] + internal uint AppId; // m_nAppId AppId_t + internal uint StartIndex; // m_unStartIndex uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageEnumerateWorkshopFilesResult_t FromPointer( IntPtr p ) + internal static RemoteStorageEnumerateWorkshopFilesResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageEnumerateWorkshopFilesResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageEnumerateWorkshopFilesResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageEnumerateWorkshopFilesResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.R4)] - public float[] GScore; // m_rgScore float [50] - public uint AppId; // m_nAppId AppId_t - public uint StartIndex; // m_unStartIndex uint32 + internal float[] GScore; // m_rgScore float [50] + internal uint AppId; // m_nAppId AppId_t + internal uint StartIndex; // m_unStartIndex uint32 // // Easily convert from PackSmall to RemoteStorageEnumerateWorkshopFilesResult_t @@ -11802,225 +10560,85 @@ public static implicit operator RemoteStorageEnumerateWorkshopFilesResult_t ( R } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateWorkshopFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateWorkshopFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateWorkshopFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateWorkshopFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -12043,37 +10661,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageGetPublishedItemVoteDetailsResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 20; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_unPublishedFileId PublishedFileId_t - public int VotesFor; // m_nVotesFor int32 - public int VotesAgainst; // m_nVotesAgainst int32 - public int Reports; // m_nReports int32 - public float FScore; // m_fScore float + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 20; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_unPublishedFileId PublishedFileId_t + internal int VotesFor; // m_nVotesFor int32 + internal int VotesAgainst; // m_nVotesAgainst int32 + internal int Reports; // m_nReports int32 + internal float FScore; // m_fScore float // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageGetPublishedItemVoteDetailsResult_t FromPointer( IntPtr p ) + internal static RemoteStorageGetPublishedItemVoteDetailsResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageGetPublishedItemVoteDetailsResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageGetPublishedItemVoteDetailsResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageGetPublishedItemVoteDetailsResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_unPublishedFileId PublishedFileId_t - public int VotesFor; // m_nVotesFor int32 - public int VotesAgainst; // m_nVotesAgainst int32 - public int Reports; // m_nReports int32 - public float FScore; // m_fScore float + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_unPublishedFileId PublishedFileId_t + internal int VotesFor; // m_nVotesFor int32 + internal int VotesAgainst; // m_nVotesAgainst int32 + internal int Reports; // m_nReports int32 + internal float FScore; // m_fScore float // // Easily convert from PackSmall to RemoteStorageGetPublishedItemVoteDetailsResult_t @@ -12092,225 +10748,85 @@ public static implicit operator RemoteStorageGetPublishedItemVoteDetailsResult_t } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedItemVoteDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedItemVoteDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedItemVoteDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageGetPublishedItemVoteDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -12333,29 +10849,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStoragePublishedFileSubscribed_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 21; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 21; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStoragePublishedFileSubscribed_t FromPointer( IntPtr p ) + internal static RemoteStoragePublishedFileSubscribed_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStoragePublishedFileSubscribed_t) Marshal.PtrToStructure( p, typeof(RemoteStoragePublishedFileSubscribed_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStoragePublishedFileSubscribed_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to RemoteStoragePublishedFileSubscribed_t @@ -12370,95 +10924,80 @@ public static implicit operator RemoteStoragePublishedFileSubscribed_t ( Remote } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileSubscribed_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileSubscribed_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -12481,29 +11020,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStoragePublishedFileUnsubscribed_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 22; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 22; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStoragePublishedFileUnsubscribed_t FromPointer( IntPtr p ) + internal static RemoteStoragePublishedFileUnsubscribed_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStoragePublishedFileUnsubscribed_t) Marshal.PtrToStructure( p, typeof(RemoteStoragePublishedFileUnsubscribed_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStoragePublishedFileUnsubscribed_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to RemoteStoragePublishedFileUnsubscribed_t @@ -12518,95 +11095,80 @@ public static implicit operator RemoteStoragePublishedFileUnsubscribed_t ( Remo } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileUnsubscribed_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileUnsubscribed_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -12629,29 +11191,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStoragePublishedFileDeleted_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 23; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 23; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStoragePublishedFileDeleted_t FromPointer( IntPtr p ) + internal static RemoteStoragePublishedFileDeleted_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStoragePublishedFileDeleted_t) Marshal.PtrToStructure( p, typeof(RemoteStoragePublishedFileDeleted_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStoragePublishedFileDeleted_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to RemoteStoragePublishedFileDeleted_t @@ -12666,95 +11266,80 @@ public static implicit operator RemoteStoragePublishedFileDeleted_t ( RemoteSto } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileDeleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileDeleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -12777,29 +11362,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageUpdateUserPublishedItemVoteResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 24; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 24; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageUpdateUserPublishedItemVoteResult_t FromPointer( IntPtr p ) + internal static RemoteStorageUpdateUserPublishedItemVoteResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageUpdateUserPublishedItemVoteResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageUpdateUserPublishedItemVoteResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageUpdateUserPublishedItemVoteResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to RemoteStorageUpdateUserPublishedItemVoteResult_t @@ -12814,225 +11437,85 @@ public static implicit operator RemoteStorageUpdateUserPublishedItemVoteResult_t } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUpdateUserPublishedItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUpdateUserPublishedItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUpdateUserPublishedItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUpdateUserPublishedItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -13055,31 +11538,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageUserVoteDetails_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 25; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public WorkshopVote Vote; // m_eVote enum EWorkshopVote + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 25; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal WorkshopVote Vote; // m_eVote enum EWorkshopVote // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageUserVoteDetails_t FromPointer( IntPtr p ) + internal static RemoteStorageUserVoteDetails_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageUserVoteDetails_t) Marshal.PtrToStructure( p, typeof(RemoteStorageUserVoteDetails_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageUserVoteDetails_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public WorkshopVote Vote; // m_eVote enum EWorkshopVote + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal WorkshopVote Vote; // m_eVote enum EWorkshopVote // // Easily convert from PackSmall to RemoteStorageUserVoteDetails_t @@ -13095,95 +11616,80 @@ public static implicit operator RemoteStorageUserVoteDetails_t ( RemoteStorageU } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageUserVoteDetails_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageUserVoteDetails_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -13206,35 +11712,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 26; - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 26; + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageEnumerateUserSharedWorkshopFilesResult_t FromPointer( IntPtr p ) + internal static RemoteStorageEnumerateUserSharedWorkshopFilesResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageEnumerateUserSharedWorkshopFilesResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageEnumerateUserSharedWorkshopFilesResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageEnumerateUserSharedWorkshopFilesResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal Result Result; // m_eResult enum EResult + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] // // Easily convert from PackSmall to RemoteStorageEnumerateUserSharedWorkshopFilesResult_t @@ -13251,95 +11795,80 @@ public static implicit operator RemoteStorageEnumerateUserSharedWorkshopFilesRes } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserSharedWorkshopFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumerateUserSharedWorkshopFilesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -13362,31 +11891,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageSetUserPublishedFileActionResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 27; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 27; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageSetUserPublishedFileActionResult_t FromPointer( IntPtr p ) + internal static RemoteStorageSetUserPublishedFileActionResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageSetUserPublishedFileActionResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageSetUserPublishedFileActionResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageSetUserPublishedFileActionResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction // // Easily convert from PackSmall to RemoteStorageSetUserPublishedFileActionResult_t @@ -13402,225 +11969,85 @@ public static implicit operator RemoteStorageSetUserPublishedFileActionResult_t } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageSetUserPublishedFileActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageSetUserPublishedFileActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageSetUserPublishedFileActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageSetUserPublishedFileActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -13643,41 +12070,79 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 28; - public Result Result; // m_eResult enum EResult - public WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 28; + internal Result Result; // m_eResult enum EResult + internal WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U4)] - public uint[] GRTimeUpdated; // m_rgRTimeUpdated uint32 [50] + internal uint[] GRTimeUpdated; // m_rgRTimeUpdated uint32 [50] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageEnumeratePublishedFilesByUserActionResult_t FromPointer( IntPtr p ) + internal static RemoteStorageEnumeratePublishedFilesByUserActionResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageEnumeratePublishedFilesByUserActionResult_t) Marshal.PtrToStructure( p, typeof(RemoteStorageEnumeratePublishedFilesByUserActionResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageEnumeratePublishedFilesByUserActionResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction - public int ResultsReturned; // m_nResultsReturned int32 - public int TotalResultCount; // m_nTotalResultCount int32 + internal Result Result; // m_eResult enum EResult + internal WorkshopFileAction Action; // m_eAction enum EWorkshopFileAction + internal int ResultsReturned; // m_nResultsReturned int32 + internal int TotalResultCount; // m_nTotalResultCount int32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)] - public ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] + internal ulong[] GPublishedFileId; // m_rgPublishedFileId PublishedFileId_t [50] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U4)] - public uint[] GRTimeUpdated; // m_rgRTimeUpdated uint32 [50] + internal uint[] GRTimeUpdated; // m_rgRTimeUpdated uint32 [50] // // Easily convert from PackSmall to RemoteStorageEnumeratePublishedFilesByUserActionResult_t @@ -13696,225 +12161,85 @@ public static implicit operator RemoteStorageEnumeratePublishedFilesByUserAction } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumeratePublishedFilesByUserActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumeratePublishedFilesByUserActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageEnumeratePublishedFilesByUserActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageEnumeratePublishedFilesByUserActionResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -13937,31 +12262,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStoragePublishFileProgress_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 29; - public double DPercentFile; // m_dPercentFile double + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 29; + internal double DPercentFile; // m_dPercentFile double [MarshalAs(UnmanagedType.I1)] - public bool Preview; // m_bPreview _Bool + internal bool Preview; // m_bPreview _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStoragePublishFileProgress_t FromPointer( IntPtr p ) + internal static RemoteStoragePublishFileProgress_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStoragePublishFileProgress_t) Marshal.PtrToStructure( p, typeof(RemoteStoragePublishFileProgress_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStoragePublishFileProgress_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public double DPercentFile; // m_dPercentFile double + internal double DPercentFile; // m_dPercentFile double [MarshalAs(UnmanagedType.I1)] - public bool Preview; // m_bPreview _Bool + internal bool Preview; // m_bPreview _Bool // // Easily convert from PackSmall to RemoteStoragePublishFileProgress_t @@ -13976,225 +12339,85 @@ public static implicit operator RemoteStoragePublishFileProgress_t ( RemoteStor } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishFileProgress_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishFileProgress_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishFileProgress_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishFileProgress_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -14217,31 +12440,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStoragePublishedFileUpdated_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 30; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t - public ulong Unused; // m_ulUnused uint64 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 30; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t + internal ulong Unused; // m_ulUnused uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStoragePublishedFileUpdated_t FromPointer( IntPtr p ) + internal static RemoteStoragePublishedFileUpdated_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStoragePublishedFileUpdated_t) Marshal.PtrToStructure( p, typeof(RemoteStoragePublishedFileUpdated_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStoragePublishedFileUpdated_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t - public ulong Unused; // m_ulUnused uint64 + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t + internal ulong Unused; // m_ulUnused uint64 // // Easily convert from PackSmall to RemoteStoragePublishedFileUpdated_t @@ -14257,95 +12518,80 @@ public static implicit operator RemoteStoragePublishedFileUpdated_t ( RemoteSto } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileUpdated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStoragePublishedFileUpdated_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -14368,27 +12614,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageFileWriteAsyncComplete_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 31; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 31; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageFileWriteAsyncComplete_t FromPointer( IntPtr p ) + internal static RemoteStorageFileWriteAsyncComplete_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageFileWriteAsyncComplete_t) Marshal.PtrToStructure( p, typeof(RemoteStorageFileWriteAsyncComplete_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageFileWriteAsyncComplete_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to RemoteStorageFileWriteAsyncComplete_t @@ -14402,225 +12686,85 @@ public static implicit operator RemoteStorageFileWriteAsyncComplete_t ( RemoteS } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageFileWriteAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageFileWriteAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageFileWriteAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageFileWriteAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -14643,33 +12787,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoteStorageFileReadAsyncComplete_t { - public const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 32; - public ulong FileReadAsync; // m_hFileReadAsync SteamAPICall_t - public Result Result; // m_eResult enum EResult - public uint Offset; // m_nOffset uint32 - public uint Read; // m_cubRead uint32 + internal const int CallbackId = CallbackIdentifiers.ClientRemoteStorage + 32; + internal ulong FileReadAsync; // m_hFileReadAsync SteamAPICall_t + internal Result Result; // m_eResult enum EResult + internal uint Offset; // m_nOffset uint32 + internal uint Read; // m_cubRead uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoteStorageFileReadAsyncComplete_t FromPointer( IntPtr p ) + internal static RemoteStorageFileReadAsyncComplete_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoteStorageFileReadAsyncComplete_t) Marshal.PtrToStructure( p, typeof(RemoteStorageFileReadAsyncComplete_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageFileReadAsyncComplete_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong FileReadAsync; // m_hFileReadAsync SteamAPICall_t - public Result Result; // m_eResult enum EResult - public uint Offset; // m_nOffset uint32 - public uint Read; // m_cubRead uint32 + internal ulong FileReadAsync; // m_hFileReadAsync SteamAPICall_t + internal Result Result; // m_eResult enum EResult + internal uint Offset; // m_nOffset uint32 + internal uint Read; // m_cubRead uint32 // // Easily convert from PackSmall to RemoteStorageFileReadAsyncComplete_t @@ -14686,225 +12868,85 @@ public static implicit operator RemoteStorageFileReadAsyncComplete_t ( RemoteSt } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageFileReadAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageFileReadAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoteStorageFileReadAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoteStorageFileReadAsyncComplete_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -14927,34 +12969,72 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LeaderboardEntry_t { - public ulong SteamIDUser; // m_steamIDUser class CSteamID - public int GlobalRank; // m_nGlobalRank int32 - public int Score; // m_nScore int32 - public int CDetails; // m_cDetails int32 - public ulong UGC; // m_hUGC UGCHandle_t + internal ulong SteamIDUser; // m_steamIDUser class CSteamID + internal int GlobalRank; // m_nGlobalRank int32 + internal int Score; // m_nScore int32 + internal int CDetails; // m_cDetails int32 + internal ulong UGC; // m_hUGC UGCHandle_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LeaderboardEntry_t FromPointer( IntPtr p ) + internal static LeaderboardEntry_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LeaderboardEntry_t) Marshal.PtrToStructure( p, typeof(LeaderboardEntry_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LeaderboardEntry_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDUser; // m_steamIDUser class CSteamID - public int GlobalRank; // m_nGlobalRank int32 - public int Score; // m_nScore int32 - public int CDetails; // m_cDetails int32 - public ulong UGC; // m_hUGC UGCHandle_t + internal ulong SteamIDUser; // m_steamIDUser class CSteamID + internal int GlobalRank; // m_nGlobalRank int32 + internal int Score; // m_nScore int32 + internal int CDetails; // m_cDetails int32 + internal ulong UGC; // m_hUGC UGCHandle_t // // Easily convert from PackSmall to LeaderboardEntry_t @@ -14976,26 +13056,35 @@ public static implicit operator LeaderboardEntry_t ( LeaderboardEntry_t.PackSma [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct UserStatsReceived_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 1; - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 1; + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static UserStatsReceived_t FromPointer( IntPtr p ) + internal static UserStatsReceived_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (UserStatsReceived_t) Marshal.PtrToStructure( p, typeof(UserStatsReceived_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserStatsReceived_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Easily convert from PackSmall to UserStatsReceived_t @@ -15011,225 +13100,85 @@ public static implicit operator UserStatsReceived_t ( UserStatsReceived_t.PackS } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -15252,29 +13201,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct UserStatsStored_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 2; - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 2; + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static UserStatsStored_t FromPointer( IntPtr p ) + internal static UserStatsStored_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (UserStatsStored_t) Marshal.PtrToStructure( p, typeof(UserStatsStored_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserStatsStored_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to UserStatsStored_t @@ -15289,95 +13276,80 @@ public static implicit operator UserStatsStored_t ( UserStatsStored_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserStatsStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserStatsStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -15400,39 +13372,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct UserAchievementStored_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 3; - public ulong GameID; // m_nGameID uint64 + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 3; + internal ulong GameID; // m_nGameID uint64 [MarshalAs(UnmanagedType.I1)] - public bool GroupAchievement; // m_bGroupAchievement _Bool + internal bool GroupAchievement; // m_bGroupAchievement _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string AchievementName; // m_rgchAchievementName char [128] - public uint CurProgress; // m_nCurProgress uint32 - public uint MaxProgress; // m_nMaxProgress uint32 + internal string AchievementName; // m_rgchAchievementName char [128] + internal uint CurProgress; // m_nCurProgress uint32 + internal uint MaxProgress; // m_nMaxProgress uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static UserAchievementStored_t FromPointer( IntPtr p ) + internal static UserAchievementStored_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (UserAchievementStored_t) Marshal.PtrToStructure( p, typeof(UserAchievementStored_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserAchievementStored_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID uint64 + internal ulong GameID; // m_nGameID uint64 [MarshalAs(UnmanagedType.I1)] - public bool GroupAchievement; // m_bGroupAchievement _Bool + internal bool GroupAchievement; // m_bGroupAchievement _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string AchievementName; // m_rgchAchievementName char [128] - public uint CurProgress; // m_nCurProgress uint32 - public uint MaxProgress; // m_nMaxProgress uint32 + internal string AchievementName; // m_rgchAchievementName char [128] + internal uint CurProgress; // m_nCurProgress uint32 + internal uint MaxProgress; // m_nMaxProgress uint32 // // Easily convert from PackSmall to UserAchievementStored_t @@ -15450,95 +13460,80 @@ public static implicit operator UserAchievementStored_t ( UserAchievementStored } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserAchievementStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserAchievementStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -15561,29 +13556,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LeaderboardFindResult_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 4; - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t - public byte LeaderboardFound; // m_bLeaderboardFound uint8 + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 4; + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal byte LeaderboardFound; // m_bLeaderboardFound uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LeaderboardFindResult_t FromPointer( IntPtr p ) + internal static LeaderboardFindResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LeaderboardFindResult_t) Marshal.PtrToStructure( p, typeof(LeaderboardFindResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LeaderboardFindResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t - public byte LeaderboardFound; // m_bLeaderboardFound uint8 + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal byte LeaderboardFound; // m_bLeaderboardFound uint8 // // Easily convert from PackSmall to LeaderboardFindResult_t @@ -15598,225 +13631,85 @@ public static implicit operator LeaderboardFindResult_t ( LeaderboardFindResult } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardFindResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardFindResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardFindResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardFindResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -15839,31 +13732,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LeaderboardScoresDownloaded_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 5; - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t - public ulong SteamLeaderboardEntries; // m_hSteamLeaderboardEntries SteamLeaderboardEntries_t - public int CEntryCount; // m_cEntryCount int + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 5; + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal ulong SteamLeaderboardEntries; // m_hSteamLeaderboardEntries SteamLeaderboardEntries_t + internal int CEntryCount; // m_cEntryCount int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LeaderboardScoresDownloaded_t FromPointer( IntPtr p ) + internal static LeaderboardScoresDownloaded_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LeaderboardScoresDownloaded_t) Marshal.PtrToStructure( p, typeof(LeaderboardScoresDownloaded_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LeaderboardScoresDownloaded_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t - public ulong SteamLeaderboardEntries; // m_hSteamLeaderboardEntries SteamLeaderboardEntries_t - public int CEntryCount; // m_cEntryCount int + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal ulong SteamLeaderboardEntries; // m_hSteamLeaderboardEntries SteamLeaderboardEntries_t + internal int CEntryCount; // m_cEntryCount int // // Easily convert from PackSmall to LeaderboardScoresDownloaded_t @@ -15879,225 +13810,85 @@ public static implicit operator LeaderboardScoresDownloaded_t ( LeaderboardScor } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardScoresDownloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardScoresDownloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardScoresDownloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardScoresDownloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -16120,37 +13911,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LeaderboardScoreUploaded_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 6; - public byte Success; // m_bSuccess uint8 - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t - public int Score; // m_nScore int32 - public byte ScoreChanged; // m_bScoreChanged uint8 - public int GlobalRankNew; // m_nGlobalRankNew int - public int GlobalRankPrevious; // m_nGlobalRankPrevious int + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 6; + internal byte Success; // m_bSuccess uint8 + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal int Score; // m_nScore int32 + internal byte ScoreChanged; // m_bScoreChanged uint8 + internal int GlobalRankNew; // m_nGlobalRankNew int + internal int GlobalRankPrevious; // m_nGlobalRankPrevious int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LeaderboardScoreUploaded_t FromPointer( IntPtr p ) + internal static LeaderboardScoreUploaded_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LeaderboardScoreUploaded_t) Marshal.PtrToStructure( p, typeof(LeaderboardScoreUploaded_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LeaderboardScoreUploaded_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public byte Success; // m_bSuccess uint8 - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t - public int Score; // m_nScore int32 - public byte ScoreChanged; // m_bScoreChanged uint8 - public int GlobalRankNew; // m_nGlobalRankNew int - public int GlobalRankPrevious; // m_nGlobalRankPrevious int + internal byte Success; // m_bSuccess uint8 + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal int Score; // m_nScore int32 + internal byte ScoreChanged; // m_bScoreChanged uint8 + internal int GlobalRankNew; // m_nGlobalRankNew int + internal int GlobalRankPrevious; // m_nGlobalRankPrevious int // // Easily convert from PackSmall to LeaderboardScoreUploaded_t @@ -16169,225 +13998,85 @@ public static implicit operator LeaderboardScoreUploaded_t ( LeaderboardScoreUp } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardScoreUploaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardScoreUploaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardScoreUploaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardScoreUploaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -16410,29 +14099,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct NumberOfCurrentPlayers_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 7; - public byte Success; // m_bSuccess uint8 - public int CPlayers; // m_cPlayers int32 + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 7; + internal byte Success; // m_bSuccess uint8 + internal int CPlayers; // m_cPlayers int32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static NumberOfCurrentPlayers_t FromPointer( IntPtr p ) + internal static NumberOfCurrentPlayers_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (NumberOfCurrentPlayers_t) Marshal.PtrToStructure( p, typeof(NumberOfCurrentPlayers_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(NumberOfCurrentPlayers_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public byte Success; // m_bSuccess uint8 - public int CPlayers; // m_cPlayers int32 + internal byte Success; // m_bSuccess uint8 + internal int CPlayers; // m_cPlayers int32 // // Easily convert from PackSmall to NumberOfCurrentPlayers_t @@ -16447,225 +14174,85 @@ public static implicit operator NumberOfCurrentPlayers_t ( NumberOfCurrentPlaye } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( NumberOfCurrentPlayers_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( NumberOfCurrentPlayers_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( NumberOfCurrentPlayers_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( NumberOfCurrentPlayers_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -16688,27 +14275,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct UserStatsUnloaded_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 8; - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 8; + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static UserStatsUnloaded_t FromPointer( IntPtr p ) + internal static UserStatsUnloaded_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (UserStatsUnloaded_t) Marshal.PtrToStructure( p, typeof(UserStatsUnloaded_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserStatsUnloaded_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Easily convert from PackSmall to UserStatsUnloaded_t @@ -16722,95 +14347,80 @@ public static implicit operator UserStatsUnloaded_t ( UserStatsUnloaded_t.PackS } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserStatsUnloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserStatsUnloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -16833,37 +14443,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct UserAchievementIconFetched_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 9; - public ulong GameID; // m_nGameID class CGameID + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 9; + internal ulong GameID; // m_nGameID class CGameID [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string AchievementName; // m_rgchAchievementName char [128] + internal string AchievementName; // m_rgchAchievementName char [128] [MarshalAs(UnmanagedType.I1)] - public bool Achieved; // m_bAchieved _Bool - public int IconHandle; // m_nIconHandle int + internal bool Achieved; // m_bAchieved _Bool + internal int IconHandle; // m_nIconHandle int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static UserAchievementIconFetched_t FromPointer( IntPtr p ) + internal static UserAchievementIconFetched_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (UserAchievementIconFetched_t) Marshal.PtrToStructure( p, typeof(UserAchievementIconFetched_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserAchievementIconFetched_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID class CGameID + internal ulong GameID; // m_nGameID class CGameID [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string AchievementName; // m_rgchAchievementName char [128] + internal string AchievementName; // m_rgchAchievementName char [128] [MarshalAs(UnmanagedType.I1)] - public bool Achieved; // m_bAchieved _Bool - public int IconHandle; // m_nIconHandle int + internal bool Achieved; // m_bAchieved _Bool + internal int IconHandle; // m_nIconHandle int // // Easily convert from PackSmall to UserAchievementIconFetched_t @@ -16880,95 +14528,80 @@ public static implicit operator UserAchievementIconFetched_t ( UserAchievementI } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserAchievementIconFetched_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserAchievementIconFetched_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -16991,29 +14624,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GlobalAchievementPercentagesReady_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 10; - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 10; + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GlobalAchievementPercentagesReady_t FromPointer( IntPtr p ) + internal static GlobalAchievementPercentagesReady_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GlobalAchievementPercentagesReady_t) Marshal.PtrToStructure( p, typeof(GlobalAchievementPercentagesReady_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GlobalAchievementPercentagesReady_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to GlobalAchievementPercentagesReady_t @@ -17028,225 +14699,85 @@ public static implicit operator GlobalAchievementPercentagesReady_t ( GlobalAch } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GlobalAchievementPercentagesReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GlobalAchievementPercentagesReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GlobalAchievementPercentagesReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GlobalAchievementPercentagesReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -17269,29 +14800,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct LeaderboardUGCSet_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 11; - public Result Result; // m_eResult enum EResult - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 11; + internal Result Result; // m_eResult enum EResult + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static LeaderboardUGCSet_t FromPointer( IntPtr p ) + internal static LeaderboardUGCSet_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (LeaderboardUGCSet_t) Marshal.PtrToStructure( p, typeof(LeaderboardUGCSet_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LeaderboardUGCSet_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t + internal Result Result; // m_eResult enum EResult + internal ulong SteamLeaderboard; // m_hSteamLeaderboard SteamLeaderboard_t // // Easily convert from PackSmall to LeaderboardUGCSet_t @@ -17306,225 +14875,85 @@ public static implicit operator LeaderboardUGCSet_t ( LeaderboardUGCSet_t.PackS } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardUGCSet_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardUGCSet_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( LeaderboardUGCSet_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( LeaderboardUGCSet_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -17547,31 +14976,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct PS3TrophiesInstalled_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 12; - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult - public ulong RequiredDiskSpace; // m_ulRequiredDiskSpace uint64 + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 12; + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult + internal ulong RequiredDiskSpace; // m_ulRequiredDiskSpace uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static PS3TrophiesInstalled_t FromPointer( IntPtr p ) + internal static PS3TrophiesInstalled_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (PS3TrophiesInstalled_t) Marshal.PtrToStructure( p, typeof(PS3TrophiesInstalled_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PS3TrophiesInstalled_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult - public ulong RequiredDiskSpace; // m_ulRequiredDiskSpace uint64 + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult + internal ulong RequiredDiskSpace; // m_ulRequiredDiskSpace uint64 // // Easily convert from PackSmall to PS3TrophiesInstalled_t @@ -17587,95 +15054,80 @@ public static implicit operator PS3TrophiesInstalled_t ( PS3TrophiesInstalled_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( PS3TrophiesInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( PS3TrophiesInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -17698,29 +15150,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GlobalStatsReceived_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 12; - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 12; + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GlobalStatsReceived_t FromPointer( IntPtr p ) + internal static GlobalStatsReceived_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GlobalStatsReceived_t) Marshal.PtrToStructure( p, typeof(GlobalStatsReceived_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GlobalStatsReceived_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong GameID; // m_nGameID uint64 - public Result Result; // m_eResult enum EResult + internal ulong GameID; // m_nGameID uint64 + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to GlobalStatsReceived_t @@ -17735,225 +15225,85 @@ public static implicit operator GlobalStatsReceived_t ( GlobalStatsReceived_t.P } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GlobalStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GlobalStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GlobalStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GlobalStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -17976,27 +15326,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct DlcInstalled_t { - public const int CallbackId = CallbackIdentifiers.SteamApps + 5; - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.SteamApps + 5; + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static DlcInstalled_t FromPointer( IntPtr p ) + internal static DlcInstalled_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (DlcInstalled_t) Marshal.PtrToStructure( p, typeof(DlcInstalled_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(DlcInstalled_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_nAppID AppId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to DlcInstalled_t @@ -18010,95 +15398,80 @@ public static implicit operator DlcInstalled_t ( DlcInstalled_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( DlcInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( DlcInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -18121,29 +15494,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RegisterActivationCodeResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamApps + 8; - public RegisterActivationCodeResult Result; // m_eResult enum ERegisterActivationCodeResult - public uint PackageRegistered; // m_unPackageRegistered uint32 + internal const int CallbackId = CallbackIdentifiers.SteamApps + 8; + internal RegisterActivationCodeResult Result; // m_eResult enum ERegisterActivationCodeResult + internal uint PackageRegistered; // m_unPackageRegistered uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RegisterActivationCodeResponse_t FromPointer( IntPtr p ) + internal static RegisterActivationCodeResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RegisterActivationCodeResponse_t) Marshal.PtrToStructure( p, typeof(RegisterActivationCodeResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RegisterActivationCodeResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public RegisterActivationCodeResult Result; // m_eResult enum ERegisterActivationCodeResult - public uint PackageRegistered; // m_unPackageRegistered uint32 + internal RegisterActivationCodeResult Result; // m_eResult enum ERegisterActivationCodeResult + internal uint PackageRegistered; // m_unPackageRegistered uint32 // // Easily convert from PackSmall to RegisterActivationCodeResponse_t @@ -18158,95 +15569,80 @@ public static implicit operator RegisterActivationCodeResponse_t ( RegisterActi } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RegisterActivationCodeResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RegisterActivationCodeResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -18269,35 +15665,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct AppProofOfPurchaseKeyResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamApps + 21; - public Result Result; // m_eResult enum EResult - public uint AppID; // m_nAppID uint32 - public uint CchKeyLength; // m_cchKeyLength uint32 + internal const int CallbackId = CallbackIdentifiers.SteamApps + 21; + internal Result Result; // m_eResult enum EResult + internal uint AppID; // m_nAppID uint32 + internal uint CchKeyLength; // m_cchKeyLength uint32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 240)] - public string Key; // m_rgchKey char [240] + internal string Key; // m_rgchKey char [240] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static AppProofOfPurchaseKeyResponse_t FromPointer( IntPtr p ) + internal static AppProofOfPurchaseKeyResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (AppProofOfPurchaseKeyResponse_t) Marshal.PtrToStructure( p, typeof(AppProofOfPurchaseKeyResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(AppProofOfPurchaseKeyResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public uint AppID; // m_nAppID uint32 - public uint CchKeyLength; // m_cchKeyLength uint32 + internal Result Result; // m_eResult enum EResult + internal uint AppID; // m_nAppID uint32 + internal uint CchKeyLength; // m_cchKeyLength uint32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 240)] - public string Key; // m_rgchKey char [240] + internal string Key; // m_rgchKey char [240] // // Easily convert from PackSmall to AppProofOfPurchaseKeyResponse_t @@ -18314,95 +15748,80 @@ public static implicit operator AppProofOfPurchaseKeyResponse_t ( AppProofOfPur } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AppProofOfPurchaseKeyResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AppProofOfPurchaseKeyResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -18425,35 +15844,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct FileDetailsResult_t { - public const int CallbackId = CallbackIdentifiers.SteamApps + 23; - public Result Result; // m_eResult enum EResult - public ulong FileSize; // m_ulFileSize uint64 + internal const int CallbackId = CallbackIdentifiers.SteamApps + 23; + internal Result Result; // m_eResult enum EResult + internal ulong FileSize; // m_ulFileSize uint64 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public char FileSHA; // m_FileSHA uint8 [20] - public uint Flags; // m_unFlags uint32 + internal char FileSHA; // m_FileSHA uint8 [20] + internal uint Flags; // m_unFlags uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static FileDetailsResult_t FromPointer( IntPtr p ) + internal static FileDetailsResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (FileDetailsResult_t) Marshal.PtrToStructure( p, typeof(FileDetailsResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(FileDetailsResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong FileSize; // m_ulFileSize uint64 + internal Result Result; // m_eResult enum EResult + internal ulong FileSize; // m_ulFileSize uint64 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public char FileSHA; // m_FileSHA uint8 [20] - public uint Flags; // m_unFlags uint32 + internal char FileSHA; // m_FileSHA uint8 [20] + internal uint Flags; // m_unFlags uint32 // // Easily convert from PackSmall to FileDetailsResult_t @@ -18470,225 +15927,85 @@ public static implicit operator FileDetailsResult_t ( FileDetailsResult_t.PackS } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( FileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( FileDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -18711,40 +16028,78 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct P2PSessionState_t { - public byte ConnectionActive; // m_bConnectionActive uint8 - public byte Connecting; // m_bConnecting uint8 - public byte P2PSessionError; // m_eP2PSessionError uint8 - public byte UsingRelay; // m_bUsingRelay uint8 - public int BytesQueuedForSend; // m_nBytesQueuedForSend int32 - public int PacketsQueuedForSend; // m_nPacketsQueuedForSend int32 - public uint RemoteIP; // m_nRemoteIP uint32 - public ushort RemotePort; // m_nRemotePort uint16 + internal byte ConnectionActive; // m_bConnectionActive uint8 + internal byte Connecting; // m_bConnecting uint8 + internal byte P2PSessionError; // m_eP2PSessionError uint8 + internal byte UsingRelay; // m_bUsingRelay uint8 + internal int BytesQueuedForSend; // m_nBytesQueuedForSend int32 + internal int PacketsQueuedForSend; // m_nPacketsQueuedForSend int32 + internal uint RemoteIP; // m_nRemoteIP uint32 + internal ushort RemotePort; // m_nRemotePort uint16 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static P2PSessionState_t FromPointer( IntPtr p ) + internal static P2PSessionState_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (P2PSessionState_t) Marshal.PtrToStructure( p, typeof(P2PSessionState_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(P2PSessionState_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public byte ConnectionActive; // m_bConnectionActive uint8 - public byte Connecting; // m_bConnecting uint8 - public byte P2PSessionError; // m_eP2PSessionError uint8 - public byte UsingRelay; // m_bUsingRelay uint8 - public int BytesQueuedForSend; // m_nBytesQueuedForSend int32 - public int PacketsQueuedForSend; // m_nPacketsQueuedForSend int32 - public uint RemoteIP; // m_nRemoteIP uint32 - public ushort RemotePort; // m_nRemotePort uint16 + internal byte ConnectionActive; // m_bConnectionActive uint8 + internal byte Connecting; // m_bConnecting uint8 + internal byte P2PSessionError; // m_eP2PSessionError uint8 + internal byte UsingRelay; // m_bUsingRelay uint8 + internal int BytesQueuedForSend; // m_nBytesQueuedForSend int32 + internal int PacketsQueuedForSend; // m_nPacketsQueuedForSend int32 + internal uint RemoteIP; // m_nRemoteIP uint32 + internal ushort RemotePort; // m_nRemotePort uint16 // // Easily convert from PackSmall to P2PSessionState_t @@ -18769,22 +16124,31 @@ public static implicit operator P2PSessionState_t ( P2PSessionState_t.PackSmall [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct P2PSessionRequest_t { - public const int CallbackId = CallbackIdentifiers.SteamNetworking + 2; - public ulong SteamIDRemote; // m_steamIDRemote class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamNetworking + 2; + internal ulong SteamIDRemote; // m_steamIDRemote class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static P2PSessionRequest_t FromPointer( IntPtr p ) + internal static P2PSessionRequest_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (P2PSessionRequest_t) Marshal.PtrToStructure( p, typeof(P2PSessionRequest_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(P2PSessionRequest_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDRemote; // m_steamIDRemote class CSteamID + internal ulong SteamIDRemote; // m_steamIDRemote class CSteamID // // Easily convert from PackSmall to P2PSessionRequest_t @@ -18798,95 +16162,80 @@ public static implicit operator P2PSessionRequest_t ( P2PSessionRequest_t.PackS } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( P2PSessionRequest_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( P2PSessionRequest_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -18909,29 +16258,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct P2PSessionConnectFail_t { - public const int CallbackId = CallbackIdentifiers.SteamNetworking + 3; - public ulong SteamIDRemote; // m_steamIDRemote class CSteamID - public byte P2PSessionError; // m_eP2PSessionError uint8 + internal const int CallbackId = CallbackIdentifiers.SteamNetworking + 3; + internal ulong SteamIDRemote; // m_steamIDRemote class CSteamID + internal byte P2PSessionError; // m_eP2PSessionError uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static P2PSessionConnectFail_t FromPointer( IntPtr p ) + internal static P2PSessionConnectFail_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (P2PSessionConnectFail_t) Marshal.PtrToStructure( p, typeof(P2PSessionConnectFail_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(P2PSessionConnectFail_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDRemote; // m_steamIDRemote class CSteamID - public byte P2PSessionError; // m_eP2PSessionError uint8 + internal ulong SteamIDRemote; // m_steamIDRemote class CSteamID + internal byte P2PSessionError; // m_eP2PSessionError uint8 // // Easily convert from PackSmall to P2PSessionConnectFail_t @@ -18946,95 +16333,80 @@ public static implicit operator P2PSessionConnectFail_t ( P2PSessionConnectFail } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( P2PSessionConnectFail_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( P2PSessionConnectFail_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19057,33 +16429,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct SocketStatusCallback_t { - public const int CallbackId = CallbackIdentifiers.SteamNetworking + 1; - public uint Socket; // m_hSocket SNetSocket_t - public uint ListenSocket; // m_hListenSocket SNetListenSocket_t - public ulong SteamIDRemote; // m_steamIDRemote class CSteamID - public int SNetSocketState; // m_eSNetSocketState int + internal const int CallbackId = CallbackIdentifiers.SteamNetworking + 1; + internal uint Socket; // m_hSocket SNetSocket_t + internal uint ListenSocket; // m_hListenSocket SNetListenSocket_t + internal ulong SteamIDRemote; // m_steamIDRemote class CSteamID + internal int SNetSocketState; // m_eSNetSocketState int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SocketStatusCallback_t FromPointer( IntPtr p ) + internal static SocketStatusCallback_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SocketStatusCallback_t) Marshal.PtrToStructure( p, typeof(SocketStatusCallback_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SocketStatusCallback_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint Socket; // m_hSocket SNetSocket_t - public uint ListenSocket; // m_hListenSocket SNetListenSocket_t - public ulong SteamIDRemote; // m_steamIDRemote class CSteamID - public int SNetSocketState; // m_eSNetSocketState int + internal uint Socket; // m_hSocket SNetSocket_t + internal uint ListenSocket; // m_hListenSocket SNetListenSocket_t + internal ulong SteamIDRemote; // m_steamIDRemote class CSteamID + internal int SNetSocketState; // m_eSNetSocketState int // // Easily convert from PackSmall to SocketStatusCallback_t @@ -19100,95 +16510,80 @@ public static implicit operator SocketStatusCallback_t ( SocketStatusCallback_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SocketStatusCallback_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SocketStatusCallback_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19211,29 +16606,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct ScreenshotReady_t { - public const int CallbackId = CallbackIdentifiers.SteamScreenshots + 1; - public uint Local; // m_hLocal ScreenshotHandle - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamScreenshots + 1; + internal uint Local; // m_hLocal ScreenshotHandle + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ScreenshotReady_t FromPointer( IntPtr p ) + internal static ScreenshotReady_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ScreenshotReady_t) Marshal.PtrToStructure( p, typeof(ScreenshotReady_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ScreenshotReady_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint Local; // m_hLocal ScreenshotHandle - public Result Result; // m_eResult enum EResult + internal uint Local; // m_hLocal ScreenshotHandle + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to ScreenshotReady_t @@ -19248,95 +16681,80 @@ public static implicit operator ScreenshotReady_t ( ScreenshotReady_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ScreenshotReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ScreenshotReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19359,27 +16777,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct VolumeHasChanged_t { - public const int CallbackId = CallbackIdentifiers.SteamMusic + 2; - public float NewVolume; // m_flNewVolume float + internal const int CallbackId = CallbackIdentifiers.SteamMusic + 2; + internal float NewVolume; // m_flNewVolume float // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static VolumeHasChanged_t FromPointer( IntPtr p ) + internal static VolumeHasChanged_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (VolumeHasChanged_t) Marshal.PtrToStructure( p, typeof(VolumeHasChanged_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(VolumeHasChanged_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public float NewVolume; // m_flNewVolume float + internal float NewVolume; // m_flNewVolume float // // Easily convert from PackSmall to VolumeHasChanged_t @@ -19393,95 +16849,80 @@ public static implicit operator VolumeHasChanged_t ( VolumeHasChanged_t.PackSma } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( VolumeHasChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( VolumeHasChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19504,29 +16945,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MusicPlayerWantsShuffled_t { - public const int CallbackId = CallbackIdentifiers.SteamMusicRemote + 9; + internal const int CallbackId = CallbackIdentifiers.SteamMusicRemote + 9; [MarshalAs(UnmanagedType.I1)] - public bool Shuffled; // m_bShuffled _Bool + internal bool Shuffled; // m_bShuffled _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MusicPlayerWantsShuffled_t FromPointer( IntPtr p ) + internal static MusicPlayerWantsShuffled_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MusicPlayerWantsShuffled_t) Marshal.PtrToStructure( p, typeof(MusicPlayerWantsShuffled_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MusicPlayerWantsShuffled_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool Shuffled; // m_bShuffled _Bool + internal bool Shuffled; // m_bShuffled _Bool // // Easily convert from PackSmall to MusicPlayerWantsShuffled_t @@ -19540,95 +17019,80 @@ public static implicit operator MusicPlayerWantsShuffled_t ( MusicPlayerWantsSh } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MusicPlayerWantsShuffled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MusicPlayerWantsShuffled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19651,29 +17115,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MusicPlayerWantsLooped_t { - public const int CallbackId = CallbackIdentifiers.SteamMusicRemote + 10; + internal const int CallbackId = CallbackIdentifiers.SteamMusicRemote + 10; [MarshalAs(UnmanagedType.I1)] - public bool Looped; // m_bLooped _Bool + internal bool Looped; // m_bLooped _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MusicPlayerWantsLooped_t FromPointer( IntPtr p ) + internal static MusicPlayerWantsLooped_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MusicPlayerWantsLooped_t) Marshal.PtrToStructure( p, typeof(MusicPlayerWantsLooped_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MusicPlayerWantsLooped_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool Looped; // m_bLooped _Bool + internal bool Looped; // m_bLooped _Bool // // Easily convert from PackSmall to MusicPlayerWantsLooped_t @@ -19687,95 +17189,80 @@ public static implicit operator MusicPlayerWantsLooped_t ( MusicPlayerWantsLoop } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MusicPlayerWantsLooped_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MusicPlayerWantsLooped_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19798,27 +17285,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MusicPlayerWantsVolume_t { - public const int CallbackId = CallbackIdentifiers.SteamMusic + 11; - public float NewVolume; // m_flNewVolume float + internal const int CallbackId = CallbackIdentifiers.SteamMusic + 11; + internal float NewVolume; // m_flNewVolume float // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MusicPlayerWantsVolume_t FromPointer( IntPtr p ) + internal static MusicPlayerWantsVolume_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MusicPlayerWantsVolume_t) Marshal.PtrToStructure( p, typeof(MusicPlayerWantsVolume_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MusicPlayerWantsVolume_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public float NewVolume; // m_flNewVolume float + internal float NewVolume; // m_flNewVolume float // // Easily convert from PackSmall to MusicPlayerWantsVolume_t @@ -19832,95 +17357,80 @@ public static implicit operator MusicPlayerWantsVolume_t ( MusicPlayerWantsVolu } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MusicPlayerWantsVolume_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MusicPlayerWantsVolume_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -19943,27 +17453,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MusicPlayerSelectsQueueEntry_t { - public const int CallbackId = CallbackIdentifiers.SteamMusic + 12; - public int NID; // nID int + internal const int CallbackId = CallbackIdentifiers.SteamMusic + 12; + internal int NID; // nID int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MusicPlayerSelectsQueueEntry_t FromPointer( IntPtr p ) + internal static MusicPlayerSelectsQueueEntry_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MusicPlayerSelectsQueueEntry_t) Marshal.PtrToStructure( p, typeof(MusicPlayerSelectsQueueEntry_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MusicPlayerSelectsQueueEntry_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public int NID; // nID int + internal int NID; // nID int // // Easily convert from PackSmall to MusicPlayerSelectsQueueEntry_t @@ -19977,95 +17525,80 @@ public static implicit operator MusicPlayerSelectsQueueEntry_t ( MusicPlayerSel } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MusicPlayerSelectsQueueEntry_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MusicPlayerSelectsQueueEntry_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -20088,27 +17621,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MusicPlayerSelectsPlaylistEntry_t { - public const int CallbackId = CallbackIdentifiers.SteamMusic + 13; - public int NID; // nID int + internal const int CallbackId = CallbackIdentifiers.SteamMusic + 13; + internal int NID; // nID int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MusicPlayerSelectsPlaylistEntry_t FromPointer( IntPtr p ) + internal static MusicPlayerSelectsPlaylistEntry_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MusicPlayerSelectsPlaylistEntry_t) Marshal.PtrToStructure( p, typeof(MusicPlayerSelectsPlaylistEntry_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MusicPlayerSelectsPlaylistEntry_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public int NID; // nID int + internal int NID; // nID int // // Easily convert from PackSmall to MusicPlayerSelectsPlaylistEntry_t @@ -20122,95 +17693,80 @@ public static implicit operator MusicPlayerSelectsPlaylistEntry_t ( MusicPlayer } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MusicPlayerSelectsPlaylistEntry_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MusicPlayerSelectsPlaylistEntry_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -20233,27 +17789,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct MusicPlayerWantsPlayingRepeatStatus_t { - public const int CallbackId = CallbackIdentifiers.SteamMusicRemote + 14; - public int PlayingRepeatStatus; // m_nPlayingRepeatStatus int + internal const int CallbackId = CallbackIdentifiers.SteamMusicRemote + 14; + internal int PlayingRepeatStatus; // m_nPlayingRepeatStatus int // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static MusicPlayerWantsPlayingRepeatStatus_t FromPointer( IntPtr p ) + internal static MusicPlayerWantsPlayingRepeatStatus_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (MusicPlayerWantsPlayingRepeatStatus_t) Marshal.PtrToStructure( p, typeof(MusicPlayerWantsPlayingRepeatStatus_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(MusicPlayerWantsPlayingRepeatStatus_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public int PlayingRepeatStatus; // m_nPlayingRepeatStatus int + internal int PlayingRepeatStatus; // m_nPlayingRepeatStatus int // // Easily convert from PackSmall to MusicPlayerWantsPlayingRepeatStatus_t @@ -20267,95 +17861,80 @@ public static implicit operator MusicPlayerWantsPlayingRepeatStatus_t ( MusicPl } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( MusicPlayerWantsPlayingRepeatStatus_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( MusicPlayerWantsPlayingRepeatStatus_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -20378,37 +17957,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTTPRequestCompleted_t { - public const int CallbackId = CallbackIdentifiers.ClientHTTP + 1; - public uint Request; // m_hRequest HTTPRequestHandle - public ulong ContextValue; // m_ulContextValue uint64 + internal const int CallbackId = CallbackIdentifiers.ClientHTTP + 1; + internal uint Request; // m_hRequest HTTPRequestHandle + internal ulong ContextValue; // m_ulContextValue uint64 [MarshalAs(UnmanagedType.I1)] - public bool RequestSuccessful; // m_bRequestSuccessful _Bool - public HTTPStatusCode StatusCode; // m_eStatusCode enum EHTTPStatusCode - public uint BodySize; // m_unBodySize uint32 + internal bool RequestSuccessful; // m_bRequestSuccessful _Bool + internal HTTPStatusCode StatusCode; // m_eStatusCode enum EHTTPStatusCode + internal uint BodySize; // m_unBodySize uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTTPRequestCompleted_t FromPointer( IntPtr p ) + internal static HTTPRequestCompleted_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTTPRequestCompleted_t) Marshal.PtrToStructure( p, typeof(HTTPRequestCompleted_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTTPRequestCompleted_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint Request; // m_hRequest HTTPRequestHandle - public ulong ContextValue; // m_ulContextValue uint64 + internal uint Request; // m_hRequest HTTPRequestHandle + internal ulong ContextValue; // m_ulContextValue uint64 [MarshalAs(UnmanagedType.I1)] - public bool RequestSuccessful; // m_bRequestSuccessful _Bool - public HTTPStatusCode StatusCode; // m_eStatusCode enum EHTTPStatusCode - public uint BodySize; // m_unBodySize uint32 + internal bool RequestSuccessful; // m_bRequestSuccessful _Bool + internal HTTPStatusCode StatusCode; // m_eStatusCode enum EHTTPStatusCode + internal uint BodySize; // m_unBodySize uint32 // // Easily convert from PackSmall to HTTPRequestCompleted_t @@ -20426,95 +18043,80 @@ public static implicit operator HTTPRequestCompleted_t ( HTTPRequestCompleted_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTTPRequestCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTTPRequestCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -20537,29 +18139,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTTPRequestHeadersReceived_t { - public const int CallbackId = CallbackIdentifiers.ClientHTTP + 2; - public uint Request; // m_hRequest HTTPRequestHandle - public ulong ContextValue; // m_ulContextValue uint64 + internal const int CallbackId = CallbackIdentifiers.ClientHTTP + 2; + internal uint Request; // m_hRequest HTTPRequestHandle + internal ulong ContextValue; // m_ulContextValue uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTTPRequestHeadersReceived_t FromPointer( IntPtr p ) + internal static HTTPRequestHeadersReceived_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTTPRequestHeadersReceived_t) Marshal.PtrToStructure( p, typeof(HTTPRequestHeadersReceived_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTTPRequestHeadersReceived_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint Request; // m_hRequest HTTPRequestHandle - public ulong ContextValue; // m_ulContextValue uint64 + internal uint Request; // m_hRequest HTTPRequestHandle + internal ulong ContextValue; // m_ulContextValue uint64 // // Easily convert from PackSmall to HTTPRequestHeadersReceived_t @@ -20574,95 +18214,80 @@ public static implicit operator HTTPRequestHeadersReceived_t ( HTTPRequestHeade } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTTPRequestHeadersReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTTPRequestHeadersReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -20685,33 +18310,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTTPRequestDataReceived_t { - public const int CallbackId = CallbackIdentifiers.ClientHTTP + 3; - public uint Request; // m_hRequest HTTPRequestHandle - public ulong ContextValue; // m_ulContextValue uint64 - public uint COffset; // m_cOffset uint32 - public uint CBytesReceived; // m_cBytesReceived uint32 + internal const int CallbackId = CallbackIdentifiers.ClientHTTP + 3; + internal uint Request; // m_hRequest HTTPRequestHandle + internal ulong ContextValue; // m_ulContextValue uint64 + internal uint COffset; // m_cOffset uint32 + internal uint CBytesReceived; // m_cBytesReceived uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTTPRequestDataReceived_t FromPointer( IntPtr p ) + internal static HTTPRequestDataReceived_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTTPRequestDataReceived_t) Marshal.PtrToStructure( p, typeof(HTTPRequestDataReceived_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTTPRequestDataReceived_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint Request; // m_hRequest HTTPRequestHandle - public ulong ContextValue; // m_ulContextValue uint64 - public uint COffset; // m_cOffset uint32 - public uint CBytesReceived; // m_cBytesReceived uint32 + internal uint Request; // m_hRequest HTTPRequestHandle + internal ulong ContextValue; // m_ulContextValue uint64 + internal uint COffset; // m_cOffset uint32 + internal uint CBytesReceived; // m_cBytesReceived uint32 // // Easily convert from PackSmall to HTTPRequestDataReceived_t @@ -20728,95 +18391,80 @@ public static implicit operator HTTPRequestDataReceived_t ( HTTPRequestDataRece } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTTPRequestDataReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTTPRequestDataReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -20839,34 +18487,72 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct ControllerAnalogActionData_t { - public ControllerSourceMode EMode; // eMode enum EControllerSourceMode - public float X; // x float - public float Y; // y float + internal ControllerSourceMode EMode; // eMode enum EControllerSourceMode + internal float X; // x float + internal float Y; // y float [MarshalAs(UnmanagedType.I1)] - public bool BActive; // bActive _Bool + internal bool BActive; // bActive _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ControllerAnalogActionData_t FromPointer( IntPtr p ) + internal static ControllerAnalogActionData_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ControllerAnalogActionData_t) Marshal.PtrToStructure( p, typeof(ControllerAnalogActionData_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ControllerAnalogActionData_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ControllerSourceMode EMode; // eMode enum EControllerSourceMode - public float X; // x float - public float Y; // y float + internal ControllerSourceMode EMode; // eMode enum EControllerSourceMode + internal float X; // x float + internal float Y; // y float [MarshalAs(UnmanagedType.I1)] - public bool BActive; // bActive _Bool + internal bool BActive; // bActive _Bool // // Easily convert from PackSmall to ControllerAnalogActionData_t @@ -20888,26 +18574,35 @@ public static implicit operator ControllerAnalogActionData_t ( ControllerAnalog internal struct ControllerDigitalActionData_t { [MarshalAs(UnmanagedType.I1)] - public bool BState; // bState _Bool + internal bool BState; // bState _Bool [MarshalAs(UnmanagedType.I1)] - public bool BActive; // bActive _Bool + internal bool BActive; // bActive _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ControllerDigitalActionData_t FromPointer( IntPtr p ) + internal static ControllerDigitalActionData_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ControllerDigitalActionData_t) Marshal.PtrToStructure( p, typeof(ControllerDigitalActionData_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ControllerDigitalActionData_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { [MarshalAs(UnmanagedType.I1)] - public bool BState; // bState _Bool + internal bool BState; // bState _Bool [MarshalAs(UnmanagedType.I1)] - public bool BActive; // bActive _Bool + internal bool BActive; // bActive _Bool // // Easily convert from PackSmall to ControllerDigitalActionData_t @@ -20926,39 +18621,48 @@ public static implicit operator ControllerDigitalActionData_t ( ControllerDigit [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct ControllerMotionData_t { - public float RotQuatX; // rotQuatX float - public float RotQuatY; // rotQuatY float - public float RotQuatZ; // rotQuatZ float - public float RotQuatW; // rotQuatW float - public float PosAccelX; // posAccelX float - public float PosAccelY; // posAccelY float - public float PosAccelZ; // posAccelZ float - public float RotVelX; // rotVelX float - public float RotVelY; // rotVelY float - public float RotVelZ; // rotVelZ float + internal float RotQuatX; // rotQuatX float + internal float RotQuatY; // rotQuatY float + internal float RotQuatZ; // rotQuatZ float + internal float RotQuatW; // rotQuatW float + internal float PosAccelX; // posAccelX float + internal float PosAccelY; // posAccelY float + internal float PosAccelZ; // posAccelZ float + internal float RotVelX; // rotVelX float + internal float RotVelY; // rotVelY float + internal float RotVelZ; // rotVelZ float // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ControllerMotionData_t FromPointer( IntPtr p ) + internal static ControllerMotionData_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ControllerMotionData_t) Marshal.PtrToStructure( p, typeof(ControllerMotionData_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ControllerMotionData_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public float RotQuatX; // rotQuatX float - public float RotQuatY; // rotQuatY float - public float RotQuatZ; // rotQuatZ float - public float RotQuatW; // rotQuatW float - public float PosAccelX; // posAccelX float - public float PosAccelY; // posAccelY float - public float PosAccelZ; // posAccelZ float - public float RotVelX; // rotVelX float - public float RotVelY; // rotVelY float - public float RotVelZ; // rotVelZ float + internal float RotQuatX; // rotQuatX float + internal float RotQuatY; // rotQuatY float + internal float RotQuatZ; // rotQuatZ float + internal float RotQuatW; // rotQuatW float + internal float PosAccelX; // posAccelX float + internal float PosAccelY; // posAccelY float + internal float PosAccelZ; // posAccelZ float + internal float RotVelX; // rotVelX float + internal float RotVelY; // rotVelY float + internal float RotVelZ; // rotVelZ float // // Easily convert from PackSmall to ControllerMotionData_t @@ -20985,87 +18689,96 @@ public static implicit operator ControllerMotionData_t ( ControllerMotionData_t [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamUGCDetails_t { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult - public WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType - public uint CreatorAppID; // m_nCreatorAppID AppId_t - public uint ConsumerAppID; // m_nConsumerAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType + internal uint CreatorAppID; // m_nCreatorAppID AppId_t + internal uint ConsumerAppID; // m_nConsumerAppID AppId_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] - public string Title; // m_rgchTitle char [129] + internal string Title; // m_rgchTitle char [129] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8000)] - public string Description; // m_rgchDescription char [8000] - public ulong SteamIDOwner; // m_ulSteamIDOwner uint64 - public uint TimeCreated; // m_rtimeCreated uint32 - public uint TimeUpdated; // m_rtimeUpdated uint32 - public uint TimeAddedToUserList; // m_rtimeAddedToUserList uint32 - public RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility + internal string Description; // m_rgchDescription char [8000] + internal ulong SteamIDOwner; // m_ulSteamIDOwner uint64 + internal uint TimeCreated; // m_rtimeCreated uint32 + internal uint TimeUpdated; // m_rtimeUpdated uint32 + internal uint TimeAddedToUserList; // m_rtimeAddedToUserList uint32 + internal RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility [MarshalAs(UnmanagedType.I1)] - public bool Banned; // m_bBanned _Bool + internal bool Banned; // m_bBanned _Bool [MarshalAs(UnmanagedType.I1)] - public bool AcceptedForUse; // m_bAcceptedForUse _Bool + internal bool AcceptedForUse; // m_bAcceptedForUse _Bool [MarshalAs(UnmanagedType.I1)] - public bool TagsTruncated; // m_bTagsTruncated _Bool + internal bool TagsTruncated; // m_bTagsTruncated _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1025)] - public string Tags; // m_rgchTags char [1025] - public ulong File; // m_hFile UGCHandle_t - public ulong PreviewFile; // m_hPreviewFile UGCHandle_t + internal string Tags; // m_rgchTags char [1025] + internal ulong File; // m_hFile UGCHandle_t + internal ulong PreviewFile; // m_hPreviewFile UGCHandle_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string PchFileName; // m_pchFileName char [260] - public int FileSize; // m_nFileSize int32 - public int PreviewFileSize; // m_nPreviewFileSize int32 + internal string PchFileName; // m_pchFileName char [260] + internal int FileSize; // m_nFileSize int32 + internal int PreviewFileSize; // m_nPreviewFileSize int32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_rgchURL char [256] - public uint VotesUp; // m_unVotesUp uint32 - public uint VotesDown; // m_unVotesDown uint32 - public float Score; // m_flScore float - public uint NumChildren; // m_unNumChildren uint32 + internal string URL; // m_rgchURL char [256] + internal uint VotesUp; // m_unVotesUp uint32 + internal uint VotesDown; // m_unVotesDown uint32 + internal float Score; // m_flScore float + internal uint NumChildren; // m_unNumChildren uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamUGCDetails_t FromPointer( IntPtr p ) + internal static SteamUGCDetails_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamUGCDetails_t) Marshal.PtrToStructure( p, typeof(SteamUGCDetails_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamUGCDetails_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult - public WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType - public uint CreatorAppID; // m_nCreatorAppID AppId_t - public uint ConsumerAppID; // m_nConsumerAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal WorkshopFileType FileType; // m_eFileType enum EWorkshopFileType + internal uint CreatorAppID; // m_nCreatorAppID AppId_t + internal uint ConsumerAppID; // m_nConsumerAppID AppId_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] - public string Title; // m_rgchTitle char [129] + internal string Title; // m_rgchTitle char [129] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8000)] - public string Description; // m_rgchDescription char [8000] - public ulong SteamIDOwner; // m_ulSteamIDOwner uint64 - public uint TimeCreated; // m_rtimeCreated uint32 - public uint TimeUpdated; // m_rtimeUpdated uint32 - public uint TimeAddedToUserList; // m_rtimeAddedToUserList uint32 - public RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility + internal string Description; // m_rgchDescription char [8000] + internal ulong SteamIDOwner; // m_ulSteamIDOwner uint64 + internal uint TimeCreated; // m_rtimeCreated uint32 + internal uint TimeUpdated; // m_rtimeUpdated uint32 + internal uint TimeAddedToUserList; // m_rtimeAddedToUserList uint32 + internal RemoteStoragePublishedFileVisibility Visibility; // m_eVisibility enum ERemoteStoragePublishedFileVisibility [MarshalAs(UnmanagedType.I1)] - public bool Banned; // m_bBanned _Bool + internal bool Banned; // m_bBanned _Bool [MarshalAs(UnmanagedType.I1)] - public bool AcceptedForUse; // m_bAcceptedForUse _Bool + internal bool AcceptedForUse; // m_bAcceptedForUse _Bool [MarshalAs(UnmanagedType.I1)] - public bool TagsTruncated; // m_bTagsTruncated _Bool + internal bool TagsTruncated; // m_bTagsTruncated _Bool [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1025)] - public string Tags; // m_rgchTags char [1025] - public ulong File; // m_hFile UGCHandle_t - public ulong PreviewFile; // m_hPreviewFile UGCHandle_t + internal string Tags; // m_rgchTags char [1025] + internal ulong File; // m_hFile UGCHandle_t + internal ulong PreviewFile; // m_hPreviewFile UGCHandle_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - public string PchFileName; // m_pchFileName char [260] - public int FileSize; // m_nFileSize int32 - public int PreviewFileSize; // m_nPreviewFileSize int32 + internal string PchFileName; // m_pchFileName char [260] + internal int FileSize; // m_nFileSize int32 + internal int PreviewFileSize; // m_nPreviewFileSize int32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_rgchURL char [256] - public uint VotesUp; // m_unVotesUp uint32 - public uint VotesDown; // m_unVotesDown uint32 - public float Score; // m_flScore float - public uint NumChildren; // m_unNumChildren uint32 + internal string URL; // m_rgchURL char [256] + internal uint VotesUp; // m_unVotesUp uint32 + internal uint VotesDown; // m_unVotesDown uint32 + internal float Score; // m_flScore float + internal uint NumChildren; // m_unNumChildren uint32 // // Easily convert from PackSmall to SteamUGCDetails_t @@ -21108,32 +18821,41 @@ public static implicit operator SteamUGCDetails_t ( SteamUGCDetails_t.PackSmall [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamUGCQueryCompleted_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 1; - public ulong Handle; // m_handle UGCQueryHandle_t - public Result Result; // m_eResult enum EResult - public uint NumResultsReturned; // m_unNumResultsReturned uint32 - public uint TotalMatchingResults; // m_unTotalMatchingResults uint32 + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 1; + internal ulong Handle; // m_handle UGCQueryHandle_t + internal Result Result; // m_eResult enum EResult + internal uint NumResultsReturned; // m_unNumResultsReturned uint32 + internal uint TotalMatchingResults; // m_unTotalMatchingResults uint32 [MarshalAs(UnmanagedType.I1)] - public bool CachedData; // m_bCachedData _Bool + internal bool CachedData; // m_bCachedData _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamUGCQueryCompleted_t FromPointer( IntPtr p ) + internal static SteamUGCQueryCompleted_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamUGCQueryCompleted_t) Marshal.PtrToStructure( p, typeof(SteamUGCQueryCompleted_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamUGCQueryCompleted_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong Handle; // m_handle UGCQueryHandle_t - public Result Result; // m_eResult enum EResult - public uint NumResultsReturned; // m_unNumResultsReturned uint32 - public uint TotalMatchingResults; // m_unTotalMatchingResults uint32 + internal ulong Handle; // m_handle UGCQueryHandle_t + internal Result Result; // m_eResult enum EResult + internal uint NumResultsReturned; // m_unNumResultsReturned uint32 + internal uint TotalMatchingResults; // m_unTotalMatchingResults uint32 [MarshalAs(UnmanagedType.I1)] - public bool CachedData; // m_bCachedData _Bool + internal bool CachedData; // m_bCachedData _Bool // // Easily convert from PackSmall to SteamUGCQueryCompleted_t @@ -21151,225 +18873,85 @@ public static implicit operator SteamUGCQueryCompleted_t ( SteamUGCQueryComplet } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamUGCQueryCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamUGCQueryCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamUGCQueryCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamUGCQueryCompleted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -21392,31 +18974,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamUGCRequestUGCDetailsResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 2; - public SteamUGCDetails_t Details; // m_details struct SteamUGCDetails_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 2; + internal SteamUGCDetails_t Details; // m_details struct SteamUGCDetails_t [MarshalAs(UnmanagedType.I1)] - public bool CachedData; // m_bCachedData _Bool + internal bool CachedData; // m_bCachedData _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamUGCRequestUGCDetailsResult_t FromPointer( IntPtr p ) + internal static SteamUGCRequestUGCDetailsResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamUGCRequestUGCDetailsResult_t) Marshal.PtrToStructure( p, typeof(SteamUGCRequestUGCDetailsResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamUGCRequestUGCDetailsResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public SteamUGCDetails_t Details; // m_details struct SteamUGCDetails_t + internal SteamUGCDetails_t Details; // m_details struct SteamUGCDetails_t [MarshalAs(UnmanagedType.I1)] - public bool CachedData; // m_bCachedData _Bool + internal bool CachedData; // m_bCachedData _Bool // // Easily convert from PackSmall to SteamUGCRequestUGCDetailsResult_t @@ -21431,95 +19051,80 @@ public static implicit operator SteamUGCRequestUGCDetailsResult_t ( SteamUGCReq } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamUGCRequestUGCDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamUGCRequestUGCDetailsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -21542,33 +19147,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct CreateItemResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 3; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 3; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static CreateItemResult_t FromPointer( IntPtr p ) + internal static CreateItemResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (CreateItemResult_t) Marshal.PtrToStructure( p, typeof(CreateItemResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(CreateItemResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool // // Easily convert from PackSmall to CreateItemResult_t @@ -21584,225 +19227,85 @@ public static implicit operator CreateItemResult_t ( CreateItemResult_t.PackSma } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( CreateItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( CreateItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( CreateItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( CreateItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -21825,33 +19328,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SubmitItemUpdateResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 4; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 4; + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SubmitItemUpdateResult_t FromPointer( IntPtr p ) + internal static SubmitItemUpdateResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SubmitItemUpdateResult_t) Marshal.PtrToStructure( p, typeof(SubmitItemUpdateResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SubmitItemUpdateResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal bool UserNeedsToAcceptWorkshopLegalAgreement; // m_bUserNeedsToAcceptWorkshopLegalAgreement _Bool + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to SubmitItemUpdateResult_t @@ -21867,225 +19408,85 @@ public static implicit operator SubmitItemUpdateResult_t ( SubmitItemUpdateResu } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SubmitItemUpdateResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SubmitItemUpdateResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SubmitItemUpdateResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SubmitItemUpdateResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -22108,31 +19509,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct DownloadItemResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 6; - public uint AppID; // m_unAppID AppId_t - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 6; + internal uint AppID; // m_unAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static DownloadItemResult_t FromPointer( IntPtr p ) + internal static DownloadItemResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (DownloadItemResult_t) Marshal.PtrToStructure( p, typeof(DownloadItemResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(DownloadItemResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_unAppID AppId_t - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal uint AppID; // m_unAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to DownloadItemResult_t @@ -22148,95 +19587,80 @@ public static implicit operator DownloadItemResult_t ( DownloadItemResult_t.Pac } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( DownloadItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( DownloadItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -22259,33 +19683,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct UserFavoriteItemsListChanged_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 7; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 7; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool WasAddRequest; // m_bWasAddRequest _Bool + internal bool WasAddRequest; // m_bWasAddRequest _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static UserFavoriteItemsListChanged_t FromPointer( IntPtr p ) + internal static UserFavoriteItemsListChanged_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (UserFavoriteItemsListChanged_t) Marshal.PtrToStructure( p, typeof(UserFavoriteItemsListChanged_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserFavoriteItemsListChanged_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool WasAddRequest; // m_bWasAddRequest _Bool + internal bool WasAddRequest; // m_bWasAddRequest _Bool // // Easily convert from PackSmall to UserFavoriteItemsListChanged_t @@ -22301,225 +19763,85 @@ public static implicit operator UserFavoriteItemsListChanged_t ( UserFavoriteIt } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserFavoriteItemsListChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserFavoriteItemsListChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( UserFavoriteItemsListChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( UserFavoriteItemsListChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -22542,33 +19864,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SetUserItemVoteResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 8; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 8; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool VoteUp; // m_bVoteUp _Bool + internal bool VoteUp; // m_bVoteUp _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SetUserItemVoteResult_t FromPointer( IntPtr p ) + internal static SetUserItemVoteResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SetUserItemVoteResult_t) Marshal.PtrToStructure( p, typeof(SetUserItemVoteResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SetUserItemVoteResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool VoteUp; // m_bVoteUp _Bool + internal bool VoteUp; // m_bVoteUp _Bool // // Easily convert from PackSmall to SetUserItemVoteResult_t @@ -22584,225 +19944,85 @@ public static implicit operator SetUserItemVoteResult_t ( SetUserItemVoteResult } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -22825,41 +20045,79 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GetUserItemVoteResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 9; - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 9; + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool VotedUp; // m_bVotedUp _Bool + internal bool VotedUp; // m_bVotedUp _Bool [MarshalAs(UnmanagedType.I1)] - public bool VotedDown; // m_bVotedDown _Bool + internal bool VotedDown; // m_bVotedDown _Bool [MarshalAs(UnmanagedType.I1)] - public bool VoteSkipped; // m_bVoteSkipped _Bool + internal bool VoteSkipped; // m_bVoteSkipped _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GetUserItemVoteResult_t FromPointer( IntPtr p ) + internal static GetUserItemVoteResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GetUserItemVoteResult_t) Marshal.PtrToStructure( p, typeof(GetUserItemVoteResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GetUserItemVoteResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult [MarshalAs(UnmanagedType.I1)] - public bool VotedUp; // m_bVotedUp _Bool + internal bool VotedUp; // m_bVotedUp _Bool [MarshalAs(UnmanagedType.I1)] - public bool VotedDown; // m_bVotedDown _Bool + internal bool VotedDown; // m_bVotedDown _Bool [MarshalAs(UnmanagedType.I1)] - public bool VoteSkipped; // m_bVoteSkipped _Bool + internal bool VoteSkipped; // m_bVoteSkipped _Bool // // Easily convert from PackSmall to GetUserItemVoteResult_t @@ -22877,225 +20135,85 @@ public static implicit operator GetUserItemVoteResult_t ( GetUserItemVoteResult } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetUserItemVoteResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -23118,27 +20236,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct StartPlaytimeTrackingResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 10; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 10; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static StartPlaytimeTrackingResult_t FromPointer( IntPtr p ) + internal static StartPlaytimeTrackingResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (StartPlaytimeTrackingResult_t) Marshal.PtrToStructure( p, typeof(StartPlaytimeTrackingResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(StartPlaytimeTrackingResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to StartPlaytimeTrackingResult_t @@ -23152,225 +20308,85 @@ public static implicit operator StartPlaytimeTrackingResult_t ( StartPlaytimeTr } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( StartPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( StartPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( StartPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( StartPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -23393,27 +20409,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct StopPlaytimeTrackingResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 11; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 11; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static StopPlaytimeTrackingResult_t FromPointer( IntPtr p ) + internal static StopPlaytimeTrackingResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (StopPlaytimeTrackingResult_t) Marshal.PtrToStructure( p, typeof(StopPlaytimeTrackingResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(StopPlaytimeTrackingResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to StopPlaytimeTrackingResult_t @@ -23427,225 +20481,85 @@ public static implicit operator StopPlaytimeTrackingResult_t ( StopPlaytimeTrac } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( StopPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( StopPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( StopPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( StopPlaytimeTrackingResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -23668,31 +20582,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct AddUGCDependencyResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 12; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 12; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static AddUGCDependencyResult_t FromPointer( IntPtr p ) + internal static AddUGCDependencyResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (AddUGCDependencyResult_t) Marshal.PtrToStructure( p, typeof(AddUGCDependencyResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(AddUGCDependencyResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to AddUGCDependencyResult_t @@ -23708,225 +20660,85 @@ public static implicit operator AddUGCDependencyResult_t ( AddUGCDependencyResu } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AddUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AddUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AddUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AddUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -23949,31 +20761,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoveUGCDependencyResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 13; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 13; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoveUGCDependencyResult_t FromPointer( IntPtr p ) + internal static RemoveUGCDependencyResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoveUGCDependencyResult_t) Marshal.PtrToStructure( p, typeof(RemoveUGCDependencyResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoveUGCDependencyResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal ulong ChildPublishedFileId; // m_nChildPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to RemoveUGCDependencyResult_t @@ -23989,225 +20839,85 @@ public static implicit operator RemoveUGCDependencyResult_t ( RemoveUGCDependen } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoveUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoveUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoveUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoveUGCDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -24230,31 +20940,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct AddAppDependencyResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 14; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 14; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static AddAppDependencyResult_t FromPointer( IntPtr p ) + internal static AddAppDependencyResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (AddAppDependencyResult_t) Marshal.PtrToStructure( p, typeof(AddAppDependencyResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(AddAppDependencyResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to AddAppDependencyResult_t @@ -24270,225 +21018,85 @@ public static implicit operator AddAppDependencyResult_t ( AddAppDependencyResu } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AddAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AddAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AddAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AddAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -24511,31 +21119,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct RemoveAppDependencyResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 15; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 15; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static RemoveAppDependencyResult_t FromPointer( IntPtr p ) + internal static RemoveAppDependencyResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (RemoveAppDependencyResult_t) Marshal.PtrToStructure( p, typeof(RemoveAppDependencyResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoveAppDependencyResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t - public uint AppID; // m_nAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to RemoveAppDependencyResult_t @@ -24551,225 +21197,85 @@ public static implicit operator RemoveAppDependencyResult_t ( RemoveAppDependen } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoveAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoveAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( RemoveAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( RemoveAppDependencyResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -24792,37 +21298,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GetAppDependenciesResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 16; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 16; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.U4)] - public AppId_t[] GAppIDs; // m_rgAppIDs AppId_t [32] - public uint NumAppDependencies; // m_nNumAppDependencies uint32 - public uint TotalNumAppDependencies; // m_nTotalNumAppDependencies uint32 + internal AppId_t[] GAppIDs; // m_rgAppIDs AppId_t [32] + internal uint NumAppDependencies; // m_nNumAppDependencies uint32 + internal uint TotalNumAppDependencies; // m_nTotalNumAppDependencies uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GetAppDependenciesResult_t FromPointer( IntPtr p ) + internal static GetAppDependenciesResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GetAppDependenciesResult_t) Marshal.PtrToStructure( p, typeof(GetAppDependenciesResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GetAppDependenciesResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.U4)] - public AppId_t[] GAppIDs; // m_rgAppIDs AppId_t [32] - public uint NumAppDependencies; // m_nNumAppDependencies uint32 - public uint TotalNumAppDependencies; // m_nTotalNumAppDependencies uint32 + internal AppId_t[] GAppIDs; // m_rgAppIDs AppId_t [32] + internal uint NumAppDependencies; // m_nNumAppDependencies uint32 + internal uint TotalNumAppDependencies; // m_nTotalNumAppDependencies uint32 // // Easily convert from PackSmall to GetAppDependenciesResult_t @@ -24840,225 +21384,85 @@ public static implicit operator GetAppDependenciesResult_t ( GetAppDependencies } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetAppDependenciesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetAppDependenciesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetAppDependenciesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetAppDependenciesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -25081,29 +21485,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct DeleteItemResult_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 17; - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 17; + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static DeleteItemResult_t FromPointer( IntPtr p ) + internal static DeleteItemResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (DeleteItemResult_t) Marshal.PtrToStructure( p, typeof(DeleteItemResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(DeleteItemResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal Result Result; // m_eResult enum EResult + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to DeleteItemResult_t @@ -25118,225 +21560,85 @@ public static implicit operator DeleteItemResult_t ( DeleteItemResult_t.PackSma } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( DeleteItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( DeleteItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( DeleteItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( DeleteItemResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -25359,27 +21661,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamAppInstalled_t { - public const int CallbackId = CallbackIdentifiers.SteamAppList + 1; - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.SteamAppList + 1; + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamAppInstalled_t FromPointer( IntPtr p ) + internal static SteamAppInstalled_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamAppInstalled_t) Marshal.PtrToStructure( p, typeof(SteamAppInstalled_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamAppInstalled_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_nAppID AppId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to SteamAppInstalled_t @@ -25393,95 +21733,80 @@ public static implicit operator SteamAppInstalled_t ( SteamAppInstalled_t.PackS } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamAppInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamAppInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -25504,27 +21829,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamAppUninstalled_t { - public const int CallbackId = CallbackIdentifiers.SteamAppList + 2; - public uint AppID; // m_nAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.SteamAppList + 2; + internal uint AppID; // m_nAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamAppUninstalled_t FromPointer( IntPtr p ) + internal static SteamAppUninstalled_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamAppUninstalled_t) Marshal.PtrToStructure( p, typeof(SteamAppUninstalled_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamAppUninstalled_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_nAppID AppId_t + internal uint AppID; // m_nAppID AppId_t // // Easily convert from PackSmall to SteamAppUninstalled_t @@ -25538,95 +21901,80 @@ public static implicit operator SteamAppUninstalled_t ( SteamAppUninstalled_t.P } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamAppUninstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamAppUninstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -25649,27 +21997,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_BrowserReady_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 1; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 1; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_BrowserReady_t FromPointer( IntPtr p ) + internal static HTML_BrowserReady_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_BrowserReady_t) Marshal.PtrToStructure( p, typeof(HTML_BrowserReady_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_BrowserReady_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser // // Easily convert from PackSmall to HTML_BrowserReady_t @@ -25683,225 +22069,85 @@ public static implicit operator HTML_BrowserReady_t ( HTML_BrowserReady_t.PackS } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_BrowserReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_BrowserReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_BrowserReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_BrowserReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -25924,48 +22170,86 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_NeedsPaint_t { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PBGRA; // pBGRA const char * - public uint UnWide; // unWide uint32 - public uint UnTall; // unTall uint32 - public uint UnUpdateX; // unUpdateX uint32 - public uint UnUpdateY; // unUpdateY uint32 - public uint UnUpdateWide; // unUpdateWide uint32 - public uint UnUpdateTall; // unUpdateTall uint32 - public uint UnScrollX; // unScrollX uint32 - public uint UnScrollY; // unScrollY uint32 - public float FlPageScale; // flPageScale float - public uint UnPageSerial; // unPageSerial uint32 + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PBGRA; // pBGRA const char * + internal uint UnWide; // unWide uint32 + internal uint UnTall; // unTall uint32 + internal uint UnUpdateX; // unUpdateX uint32 + internal uint UnUpdateY; // unUpdateY uint32 + internal uint UnUpdateWide; // unUpdateWide uint32 + internal uint UnUpdateTall; // unUpdateTall uint32 + internal uint UnScrollX; // unScrollX uint32 + internal uint UnScrollY; // unScrollY uint32 + internal float FlPageScale; // flPageScale float + internal uint UnPageSerial; // unPageSerial uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_NeedsPaint_t FromPointer( IntPtr p ) + internal static HTML_NeedsPaint_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_NeedsPaint_t) Marshal.PtrToStructure( p, typeof(HTML_NeedsPaint_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_NeedsPaint_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PBGRA; // pBGRA const char * - public uint UnWide; // unWide uint32 - public uint UnTall; // unTall uint32 - public uint UnUpdateX; // unUpdateX uint32 - public uint UnUpdateY; // unUpdateY uint32 - public uint UnUpdateWide; // unUpdateWide uint32 - public uint UnUpdateTall; // unUpdateTall uint32 - public uint UnScrollX; // unScrollX uint32 - public uint UnScrollY; // unScrollY uint32 - public float FlPageScale; // flPageScale float - public uint UnPageSerial; // unPageSerial uint32 + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PBGRA; // pBGRA const char * + internal uint UnWide; // unWide uint32 + internal uint UnTall; // unTall uint32 + internal uint UnUpdateX; // unUpdateX uint32 + internal uint UnUpdateY; // unUpdateY uint32 + internal uint UnUpdateWide; // unUpdateWide uint32 + internal uint UnUpdateTall; // unUpdateTall uint32 + internal uint UnScrollX; // unScrollX uint32 + internal uint UnScrollY; // unScrollY uint32 + internal float FlPageScale; // flPageScale float + internal uint UnPageSerial; // unPageSerial uint32 // // Easily convert from PackSmall to HTML_NeedsPaint_t @@ -25994,31 +22278,40 @@ public static implicit operator HTML_NeedsPaint_t ( HTML_NeedsPaint_t.PackSmall [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_StartRequest_t { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public string PchTarget; // pchTarget const char * - public string PchPostData; // pchPostData const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal string PchTarget; // pchTarget const char * + internal string PchPostData; // pchPostData const char * [MarshalAs(UnmanagedType.I1)] - public bool BIsRedirect; // bIsRedirect _Bool + internal bool BIsRedirect; // bIsRedirect _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_StartRequest_t FromPointer( IntPtr p ) + internal static HTML_StartRequest_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_StartRequest_t) Marshal.PtrToStructure( p, typeof(HTML_StartRequest_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_StartRequest_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public string PchTarget; // pchTarget const char * - public string PchPostData; // pchPostData const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal string PchTarget; // pchTarget const char * + internal string PchPostData; // pchPostData const char * [MarshalAs(UnmanagedType.I1)] - public bool BIsRedirect; // bIsRedirect _Bool + internal bool BIsRedirect; // bIsRedirect _Bool // // Easily convert from PackSmall to HTML_StartRequest_t @@ -26040,21 +22333,30 @@ public static implicit operator HTML_StartRequest_t ( HTML_StartRequest_t.PackS [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_CloseBrowser_t { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_CloseBrowser_t FromPointer( IntPtr p ) + internal static HTML_CloseBrowser_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_CloseBrowser_t) Marshal.PtrToStructure( p, typeof(HTML_CloseBrowser_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_CloseBrowser_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser // // Easily convert from PackSmall to HTML_CloseBrowser_t @@ -26072,36 +22374,45 @@ public static implicit operator HTML_CloseBrowser_t ( HTML_CloseBrowser_t.PackS [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_URLChanged_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 5; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public string PchPostData; // pchPostData const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 5; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal string PchPostData; // pchPostData const char * [MarshalAs(UnmanagedType.I1)] - public bool BIsRedirect; // bIsRedirect _Bool - public string PchPageTitle; // pchPageTitle const char * + internal bool BIsRedirect; // bIsRedirect _Bool + internal string PchPageTitle; // pchPageTitle const char * [MarshalAs(UnmanagedType.I1)] - public bool BNewNavigation; // bNewNavigation _Bool + internal bool BNewNavigation; // bNewNavigation _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_URLChanged_t FromPointer( IntPtr p ) + internal static HTML_URLChanged_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_URLChanged_t) Marshal.PtrToStructure( p, typeof(HTML_URLChanged_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_URLChanged_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public string PchPostData; // pchPostData const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal string PchPostData; // pchPostData const char * [MarshalAs(UnmanagedType.I1)] - public bool BIsRedirect; // bIsRedirect _Bool - public string PchPageTitle; // pchPageTitle const char * + internal bool BIsRedirect; // bIsRedirect _Bool + internal string PchPageTitle; // pchPageTitle const char * [MarshalAs(UnmanagedType.I1)] - public bool BNewNavigation; // bNewNavigation _Bool + internal bool BNewNavigation; // bNewNavigation _Bool // // Easily convert from PackSmall to HTML_URLChanged_t @@ -26120,95 +22431,80 @@ public static implicit operator HTML_URLChanged_t ( HTML_URLChanged_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_URLChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_URLChanged_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -26231,31 +22527,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_FinishedRequest_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 6; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public string PchPageTitle; // pchPageTitle const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 6; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal string PchPageTitle; // pchPageTitle const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_FinishedRequest_t FromPointer( IntPtr p ) + internal static HTML_FinishedRequest_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_FinishedRequest_t) Marshal.PtrToStructure( p, typeof(HTML_FinishedRequest_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_FinishedRequest_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public string PchPageTitle; // pchPageTitle const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal string PchPageTitle; // pchPageTitle const char * // // Easily convert from PackSmall to HTML_FinishedRequest_t @@ -26271,95 +22605,80 @@ public static implicit operator HTML_FinishedRequest_t ( HTML_FinishedRequest_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_FinishedRequest_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_FinishedRequest_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -26382,29 +22701,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_OpenLinkInNewTab_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 7; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 7; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_OpenLinkInNewTab_t FromPointer( IntPtr p ) + internal static HTML_OpenLinkInNewTab_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_OpenLinkInNewTab_t) Marshal.PtrToStructure( p, typeof(HTML_OpenLinkInNewTab_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_OpenLinkInNewTab_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * // // Easily convert from PackSmall to HTML_OpenLinkInNewTab_t @@ -26419,95 +22776,80 @@ public static implicit operator HTML_OpenLinkInNewTab_t ( HTML_OpenLinkInNewTab } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_OpenLinkInNewTab_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_OpenLinkInNewTab_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -26530,29 +22872,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_ChangedTitle_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 8; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchTitle; // pchTitle const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 8; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchTitle; // pchTitle const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_ChangedTitle_t FromPointer( IntPtr p ) + internal static HTML_ChangedTitle_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_ChangedTitle_t) Marshal.PtrToStructure( p, typeof(HTML_ChangedTitle_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_ChangedTitle_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchTitle; // pchTitle const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchTitle; // pchTitle const char * // // Easily convert from PackSmall to HTML_ChangedTitle_t @@ -26567,95 +22947,80 @@ public static implicit operator HTML_ChangedTitle_t ( HTML_ChangedTitle_t.PackS } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_ChangedTitle_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_ChangedTitle_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -26678,31 +23043,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_SearchResults_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 9; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnResults; // unResults uint32 - public uint UnCurrentMatch; // unCurrentMatch uint32 + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 9; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnResults; // unResults uint32 + internal uint UnCurrentMatch; // unCurrentMatch uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_SearchResults_t FromPointer( IntPtr p ) + internal static HTML_SearchResults_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_SearchResults_t) Marshal.PtrToStructure( p, typeof(HTML_SearchResults_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_SearchResults_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnResults; // unResults uint32 - public uint UnCurrentMatch; // unCurrentMatch uint32 + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnResults; // unResults uint32 + internal uint UnCurrentMatch; // unCurrentMatch uint32 // // Easily convert from PackSmall to HTML_SearchResults_t @@ -26718,95 +23121,80 @@ public static implicit operator HTML_SearchResults_t ( HTML_SearchResults_t.Pac } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_SearchResults_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_SearchResults_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -26829,35 +23217,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_CanGoBackAndForward_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 10; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 10; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser [MarshalAs(UnmanagedType.I1)] - public bool BCanGoBack; // bCanGoBack _Bool + internal bool BCanGoBack; // bCanGoBack _Bool [MarshalAs(UnmanagedType.I1)] - public bool BCanGoForward; // bCanGoForward _Bool + internal bool BCanGoForward; // bCanGoForward _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_CanGoBackAndForward_t FromPointer( IntPtr p ) + internal static HTML_CanGoBackAndForward_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_CanGoBackAndForward_t) Marshal.PtrToStructure( p, typeof(HTML_CanGoBackAndForward_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_CanGoBackAndForward_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser [MarshalAs(UnmanagedType.I1)] - public bool BCanGoBack; // bCanGoBack _Bool + internal bool BCanGoBack; // bCanGoBack _Bool [MarshalAs(UnmanagedType.I1)] - public bool BCanGoForward; // bCanGoForward _Bool + internal bool BCanGoForward; // bCanGoForward _Bool // // Easily convert from PackSmall to HTML_CanGoBackAndForward_t @@ -26873,95 +23299,80 @@ public static implicit operator HTML_CanGoBackAndForward_t ( HTML_CanGoBackAndF } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_CanGoBackAndForward_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_CanGoBackAndForward_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -26984,39 +23395,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_HorizontalScroll_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 11; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnScrollMax; // unScrollMax uint32 - public uint UnScrollCurrent; // unScrollCurrent uint32 - public float FlPageScale; // flPageScale float + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 11; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnScrollMax; // unScrollMax uint32 + internal uint UnScrollCurrent; // unScrollCurrent uint32 + internal float FlPageScale; // flPageScale float [MarshalAs(UnmanagedType.I1)] - public bool BVisible; // bVisible _Bool - public uint UnPageSize; // unPageSize uint32 + internal bool BVisible; // bVisible _Bool + internal uint UnPageSize; // unPageSize uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_HorizontalScroll_t FromPointer( IntPtr p ) + internal static HTML_HorizontalScroll_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_HorizontalScroll_t) Marshal.PtrToStructure( p, typeof(HTML_HorizontalScroll_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_HorizontalScroll_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnScrollMax; // unScrollMax uint32 - public uint UnScrollCurrent; // unScrollCurrent uint32 - public float FlPageScale; // flPageScale float + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnScrollMax; // unScrollMax uint32 + internal uint UnScrollCurrent; // unScrollCurrent uint32 + internal float FlPageScale; // flPageScale float [MarshalAs(UnmanagedType.I1)] - public bool BVisible; // bVisible _Bool - public uint UnPageSize; // unPageSize uint32 + internal bool BVisible; // bVisible _Bool + internal uint UnPageSize; // unPageSize uint32 // // Easily convert from PackSmall to HTML_HorizontalScroll_t @@ -27035,95 +23484,80 @@ public static implicit operator HTML_HorizontalScroll_t ( HTML_HorizontalScroll } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_HorizontalScroll_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_HorizontalScroll_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -27146,39 +23580,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_VerticalScroll_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 12; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnScrollMax; // unScrollMax uint32 - public uint UnScrollCurrent; // unScrollCurrent uint32 - public float FlPageScale; // flPageScale float + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 12; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnScrollMax; // unScrollMax uint32 + internal uint UnScrollCurrent; // unScrollCurrent uint32 + internal float FlPageScale; // flPageScale float [MarshalAs(UnmanagedType.I1)] - public bool BVisible; // bVisible _Bool - public uint UnPageSize; // unPageSize uint32 + internal bool BVisible; // bVisible _Bool + internal uint UnPageSize; // unPageSize uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_VerticalScroll_t FromPointer( IntPtr p ) + internal static HTML_VerticalScroll_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_VerticalScroll_t) Marshal.PtrToStructure( p, typeof(HTML_VerticalScroll_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_VerticalScroll_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnScrollMax; // unScrollMax uint32 - public uint UnScrollCurrent; // unScrollCurrent uint32 - public float FlPageScale; // flPageScale float + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnScrollMax; // unScrollMax uint32 + internal uint UnScrollCurrent; // unScrollCurrent uint32 + internal float FlPageScale; // flPageScale float [MarshalAs(UnmanagedType.I1)] - public bool BVisible; // bVisible _Bool - public uint UnPageSize; // unPageSize uint32 + internal bool BVisible; // bVisible _Bool + internal uint UnPageSize; // unPageSize uint32 // // Easily convert from PackSmall to HTML_VerticalScroll_t @@ -27197,95 +23669,80 @@ public static implicit operator HTML_VerticalScroll_t ( HTML_VerticalScroll_t.P } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_VerticalScroll_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_VerticalScroll_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -27308,41 +23765,79 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_LinkAtPosition_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 13; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint X; // x uint32 - public uint Y; // y uint32 - public string PchURL; // pchURL const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 13; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint X; // x uint32 + internal uint Y; // y uint32 + internal string PchURL; // pchURL const char * [MarshalAs(UnmanagedType.I1)] - public bool BInput; // bInput _Bool + internal bool BInput; // bInput _Bool [MarshalAs(UnmanagedType.I1)] - public bool BLiveLink; // bLiveLink _Bool + internal bool BLiveLink; // bLiveLink _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_LinkAtPosition_t FromPointer( IntPtr p ) + internal static HTML_LinkAtPosition_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_LinkAtPosition_t) Marshal.PtrToStructure( p, typeof(HTML_LinkAtPosition_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_LinkAtPosition_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint X; // x uint32 - public uint Y; // y uint32 - public string PchURL; // pchURL const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint X; // x uint32 + internal uint Y; // y uint32 + internal string PchURL; // pchURL const char * [MarshalAs(UnmanagedType.I1)] - public bool BInput; // bInput _Bool + internal bool BInput; // bInput _Bool [MarshalAs(UnmanagedType.I1)] - public bool BLiveLink; // bLiveLink _Bool + internal bool BLiveLink; // bLiveLink _Bool // // Easily convert from PackSmall to HTML_LinkAtPosition_t @@ -27361,95 +23856,80 @@ public static implicit operator HTML_LinkAtPosition_t ( HTML_LinkAtPosition_t.P } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_LinkAtPosition_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_LinkAtPosition_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -27472,29 +23952,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_JSAlert_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 14; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMessage; // pchMessage const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 14; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMessage; // pchMessage const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_JSAlert_t FromPointer( IntPtr p ) + internal static HTML_JSAlert_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_JSAlert_t) Marshal.PtrToStructure( p, typeof(HTML_JSAlert_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_JSAlert_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMessage; // pchMessage const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMessage; // pchMessage const char * // // Easily convert from PackSmall to HTML_JSAlert_t @@ -27509,95 +24027,80 @@ public static implicit operator HTML_JSAlert_t ( HTML_JSAlert_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_JSAlert_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_JSAlert_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -27620,29 +24123,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_JSConfirm_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 15; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMessage; // pchMessage const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 15; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMessage; // pchMessage const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_JSConfirm_t FromPointer( IntPtr p ) + internal static HTML_JSConfirm_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_JSConfirm_t) Marshal.PtrToStructure( p, typeof(HTML_JSConfirm_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_JSConfirm_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMessage; // pchMessage const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMessage; // pchMessage const char * // // Easily convert from PackSmall to HTML_JSConfirm_t @@ -27657,95 +24198,80 @@ public static implicit operator HTML_JSConfirm_t ( HTML_JSConfirm_t.PackSmall d } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_JSConfirm_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_JSConfirm_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -27768,31 +24294,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_FileOpenDialog_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 16; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchTitle; // pchTitle const char * - public string PchInitialFile; // pchInitialFile const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 16; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchTitle; // pchTitle const char * + internal string PchInitialFile; // pchInitialFile const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_FileOpenDialog_t FromPointer( IntPtr p ) + internal static HTML_FileOpenDialog_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_FileOpenDialog_t) Marshal.PtrToStructure( p, typeof(HTML_FileOpenDialog_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_FileOpenDialog_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchTitle; // pchTitle const char * - public string PchInitialFile; // pchInitialFile const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchTitle; // pchTitle const char * + internal string PchInitialFile; // pchInitialFile const char * // // Easily convert from PackSmall to HTML_FileOpenDialog_t @@ -27808,95 +24372,80 @@ public static implicit operator HTML_FileOpenDialog_t ( HTML_FileOpenDialog_t.P } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_FileOpenDialog_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_FileOpenDialog_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -27919,39 +24468,77 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_NewWindow_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 21; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public uint UnX; // unX uint32 - public uint UnY; // unY uint32 - public uint UnWide; // unWide uint32 - public uint UnTall; // unTall uint32 - public uint UnNewWindow_BrowserHandle; // unNewWindow_BrowserHandle HHTMLBrowser + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 21; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal uint UnX; // unX uint32 + internal uint UnY; // unY uint32 + internal uint UnWide; // unWide uint32 + internal uint UnTall; // unTall uint32 + internal uint UnNewWindow_BrowserHandle; // unNewWindow_BrowserHandle HHTMLBrowser // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_NewWindow_t FromPointer( IntPtr p ) + internal static HTML_NewWindow_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_NewWindow_t) Marshal.PtrToStructure( p, typeof(HTML_NewWindow_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_NewWindow_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchURL; // pchURL const char * - public uint UnX; // unX uint32 - public uint UnY; // unY uint32 - public uint UnWide; // unWide uint32 - public uint UnTall; // unTall uint32 - public uint UnNewWindow_BrowserHandle; // unNewWindow_BrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchURL; // pchURL const char * + internal uint UnX; // unX uint32 + internal uint UnY; // unY uint32 + internal uint UnWide; // unWide uint32 + internal uint UnTall; // unTall uint32 + internal uint UnNewWindow_BrowserHandle; // unNewWindow_BrowserHandle HHTMLBrowser // // Easily convert from PackSmall to HTML_NewWindow_t @@ -27971,95 +24558,80 @@ public static implicit operator HTML_NewWindow_t ( HTML_NewWindow_t.PackSmall d } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_NewWindow_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_NewWindow_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28082,29 +24654,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_SetCursor_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 22; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint EMouseCursor; // eMouseCursor uint32 + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 22; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint EMouseCursor; // eMouseCursor uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_SetCursor_t FromPointer( IntPtr p ) + internal static HTML_SetCursor_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_SetCursor_t) Marshal.PtrToStructure( p, typeof(HTML_SetCursor_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_SetCursor_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint EMouseCursor; // eMouseCursor uint32 + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint EMouseCursor; // eMouseCursor uint32 // // Easily convert from PackSmall to HTML_SetCursor_t @@ -28119,95 +24729,80 @@ public static implicit operator HTML_SetCursor_t ( HTML_SetCursor_t.PackSmall d } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_SetCursor_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_SetCursor_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28230,29 +24825,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_StatusText_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 23; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMsg; // pchMsg const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 23; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMsg; // pchMsg const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_StatusText_t FromPointer( IntPtr p ) + internal static HTML_StatusText_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_StatusText_t) Marshal.PtrToStructure( p, typeof(HTML_StatusText_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_StatusText_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMsg; // pchMsg const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMsg; // pchMsg const char * // // Easily convert from PackSmall to HTML_StatusText_t @@ -28267,95 +24900,80 @@ public static implicit operator HTML_StatusText_t ( HTML_StatusText_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_StatusText_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_StatusText_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28378,29 +24996,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_ShowToolTip_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 24; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMsg; // pchMsg const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 24; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMsg; // pchMsg const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_ShowToolTip_t FromPointer( IntPtr p ) + internal static HTML_ShowToolTip_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_ShowToolTip_t) Marshal.PtrToStructure( p, typeof(HTML_ShowToolTip_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_ShowToolTip_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMsg; // pchMsg const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMsg; // pchMsg const char * // // Easily convert from PackSmall to HTML_ShowToolTip_t @@ -28415,95 +25071,80 @@ public static implicit operator HTML_ShowToolTip_t ( HTML_ShowToolTip_t.PackSma } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_ShowToolTip_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_ShowToolTip_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28526,29 +25167,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_UpdateToolTip_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 25; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMsg; // pchMsg const char * + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 25; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMsg; // pchMsg const char * // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_UpdateToolTip_t FromPointer( IntPtr p ) + internal static HTML_UpdateToolTip_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_UpdateToolTip_t) Marshal.PtrToStructure( p, typeof(HTML_UpdateToolTip_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_UpdateToolTip_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public string PchMsg; // pchMsg const char * + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal string PchMsg; // pchMsg const char * // // Easily convert from PackSmall to HTML_UpdateToolTip_t @@ -28563,95 +25242,80 @@ public static implicit operator HTML_UpdateToolTip_t ( HTML_UpdateToolTip_t.Pac } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_UpdateToolTip_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_UpdateToolTip_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28674,27 +25338,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_HideToolTip_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 26; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 26; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_HideToolTip_t FromPointer( IntPtr p ) + internal static HTML_HideToolTip_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_HideToolTip_t) Marshal.PtrToStructure( p, typeof(HTML_HideToolTip_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_HideToolTip_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser // // Easily convert from PackSmall to HTML_HideToolTip_t @@ -28708,95 +25410,80 @@ public static implicit operator HTML_HideToolTip_t ( HTML_HideToolTip_t.PackSma } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_HideToolTip_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_HideToolTip_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28819,29 +25506,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct HTML_BrowserRestarted_t { - public const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 27; - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnOldBrowserHandle; // unOldBrowserHandle HHTMLBrowser + internal const int CallbackId = CallbackIdentifiers.SteamHTMLSurface + 27; + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnOldBrowserHandle; // unOldBrowserHandle HHTMLBrowser // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static HTML_BrowserRestarted_t FromPointer( IntPtr p ) + internal static HTML_BrowserRestarted_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (HTML_BrowserRestarted_t) Marshal.PtrToStructure( p, typeof(HTML_BrowserRestarted_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(HTML_BrowserRestarted_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser - public uint UnOldBrowserHandle; // unOldBrowserHandle HHTMLBrowser + internal uint UnBrowserHandle; // unBrowserHandle HHTMLBrowser + internal uint UnOldBrowserHandle; // unOldBrowserHandle HHTMLBrowser // // Easily convert from PackSmall to HTML_BrowserRestarted_t @@ -28856,95 +25581,80 @@ public static implicit operator HTML_BrowserRestarted_t ( HTML_BrowserRestarted } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( HTML_BrowserRestarted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( HTML_BrowserRestarted_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -28967,32 +25677,70 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamItemDetails_t { - public ulong ItemId; // m_itemId SteamItemInstanceID_t - public int Definition; // m_iDefinition SteamItemDef_t - public ushort Quantity; // m_unQuantity uint16 - public ushort Flags; // m_unFlags uint16 + internal ulong ItemId; // m_itemId SteamItemInstanceID_t + internal int Definition; // m_iDefinition SteamItemDef_t + internal ushort Quantity; // m_unQuantity uint16 + internal ushort Flags; // m_unFlags uint16 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamItemDetails_t FromPointer( IntPtr p ) + internal static SteamItemDetails_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamItemDetails_t) Marshal.PtrToStructure( p, typeof(SteamItemDetails_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamItemDetails_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong ItemId; // m_itemId SteamItemInstanceID_t - public int Definition; // m_iDefinition SteamItemDef_t - public ushort Quantity; // m_unQuantity uint16 - public ushort Flags; // m_unFlags uint16 + internal ulong ItemId; // m_itemId SteamItemInstanceID_t + internal int Definition; // m_iDefinition SteamItemDef_t + internal ushort Quantity; // m_unQuantity uint16 + internal ushort Flags; // m_unFlags uint16 // // Easily convert from PackSmall to SteamItemDetails_t @@ -29013,24 +25761,33 @@ public static implicit operator SteamItemDetails_t ( SteamItemDetails_t.PackSma [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamInventoryResultReady_t { - public const int CallbackId = CallbackIdentifiers.ClientInventory + 0; - public int Handle; // m_handle SteamInventoryResult_t - public Result Result; // m_result enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientInventory + 0; + internal int Handle; // m_handle SteamInventoryResult_t + internal Result Result; // m_result enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamInventoryResultReady_t FromPointer( IntPtr p ) + internal static SteamInventoryResultReady_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamInventoryResultReady_t) Marshal.PtrToStructure( p, typeof(SteamInventoryResultReady_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInventoryResultReady_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public int Handle; // m_handle SteamInventoryResult_t - public Result Result; // m_result enum EResult + internal int Handle; // m_handle SteamInventoryResult_t + internal Result Result; // m_result enum EResult // // Easily convert from PackSmall to SteamInventoryResultReady_t @@ -29045,95 +25802,80 @@ public static implicit operator SteamInventoryResultReady_t ( SteamInventoryRes } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryResultReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryResultReady_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -29156,27 +25898,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamInventoryFullUpdate_t { - public const int CallbackId = CallbackIdentifiers.ClientInventory + 1; - public int Handle; // m_handle SteamInventoryResult_t + internal const int CallbackId = CallbackIdentifiers.ClientInventory + 1; + internal int Handle; // m_handle SteamInventoryResult_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamInventoryFullUpdate_t FromPointer( IntPtr p ) + internal static SteamInventoryFullUpdate_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamInventoryFullUpdate_t) Marshal.PtrToStructure( p, typeof(SteamInventoryFullUpdate_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInventoryFullUpdate_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public int Handle; // m_handle SteamInventoryResult_t + internal int Handle; // m_handle SteamInventoryResult_t // // Easily convert from PackSmall to SteamInventoryFullUpdate_t @@ -29190,95 +25970,80 @@ public static implicit operator SteamInventoryFullUpdate_t ( SteamInventoryFull } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryFullUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryFullUpdate_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -29301,35 +26066,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct SteamInventoryEligiblePromoItemDefIDs_t { - public const int CallbackId = CallbackIdentifiers.ClientInventory + 3; - public Result Result; // m_result enum EResult - public ulong SteamID; // m_steamID class CSteamID - public int UmEligiblePromoItemDefs; // m_numEligiblePromoItemDefs int + internal const int CallbackId = CallbackIdentifiers.ClientInventory + 3; + internal Result Result; // m_result enum EResult + internal ulong SteamID; // m_steamID class CSteamID + internal int UmEligiblePromoItemDefs; // m_numEligiblePromoItemDefs int [MarshalAs(UnmanagedType.I1)] - public bool CachedData; // m_bCachedData _Bool + internal bool CachedData; // m_bCachedData _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamInventoryEligiblePromoItemDefIDs_t FromPointer( IntPtr p ) + internal static SteamInventoryEligiblePromoItemDefIDs_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamInventoryEligiblePromoItemDefIDs_t) Marshal.PtrToStructure( p, typeof(SteamInventoryEligiblePromoItemDefIDs_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInventoryEligiblePromoItemDefIDs_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_result enum EResult - public ulong SteamID; // m_steamID class CSteamID - public int UmEligiblePromoItemDefs; // m_numEligiblePromoItemDefs int + internal Result Result; // m_result enum EResult + internal ulong SteamID; // m_steamID class CSteamID + internal int UmEligiblePromoItemDefs; // m_numEligiblePromoItemDefs int [MarshalAs(UnmanagedType.I1)] - public bool CachedData; // m_bCachedData _Bool + internal bool CachedData; // m_bCachedData _Bool // // Easily convert from PackSmall to SteamInventoryEligiblePromoItemDefIDs_t @@ -29346,225 +26149,85 @@ public static implicit operator SteamInventoryEligiblePromoItemDefIDs_t ( Steam } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryEligiblePromoItemDefIDs_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryEligiblePromoItemDefIDs_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryEligiblePromoItemDefIDs_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryEligiblePromoItemDefIDs_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -29587,31 +26250,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamInventoryStartPurchaseResult_t { - public const int CallbackId = CallbackIdentifiers.ClientInventory + 4; - public Result Result; // m_result enum EResult - public ulong OrderID; // m_ulOrderID uint64 - public ulong TransID; // m_ulTransID uint64 + internal const int CallbackId = CallbackIdentifiers.ClientInventory + 4; + internal Result Result; // m_result enum EResult + internal ulong OrderID; // m_ulOrderID uint64 + internal ulong TransID; // m_ulTransID uint64 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamInventoryStartPurchaseResult_t FromPointer( IntPtr p ) + internal static SteamInventoryStartPurchaseResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamInventoryStartPurchaseResult_t) Marshal.PtrToStructure( p, typeof(SteamInventoryStartPurchaseResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInventoryStartPurchaseResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_result enum EResult - public ulong OrderID; // m_ulOrderID uint64 - public ulong TransID; // m_ulTransID uint64 + internal Result Result; // m_result enum EResult + internal ulong OrderID; // m_ulOrderID uint64 + internal ulong TransID; // m_ulTransID uint64 // // Easily convert from PackSmall to SteamInventoryStartPurchaseResult_t @@ -29627,225 +26328,85 @@ public static implicit operator SteamInventoryStartPurchaseResult_t ( SteamInve } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryStartPurchaseResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryStartPurchaseResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryStartPurchaseResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryStartPurchaseResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -29868,31 +26429,69 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct SteamInventoryRequestPricesResult_t { - public const int CallbackId = CallbackIdentifiers.ClientInventory + 5; - public Result Result; // m_result enum EResult + internal const int CallbackId = CallbackIdentifiers.ClientInventory + 5; + internal Result Result; // m_result enum EResult [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Currency; // m_rgchCurrency char [4] + internal string Currency; // m_rgchCurrency char [4] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static SteamInventoryRequestPricesResult_t FromPointer( IntPtr p ) + internal static SteamInventoryRequestPricesResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (SteamInventoryRequestPricesResult_t) Marshal.PtrToStructure( p, typeof(SteamInventoryRequestPricesResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInventoryRequestPricesResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_result enum EResult + internal Result Result; // m_result enum EResult [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Currency; // m_rgchCurrency char [4] + internal string Currency; // m_rgchCurrency char [4] // // Easily convert from PackSmall to SteamInventoryRequestPricesResult_t @@ -29907,225 +26506,85 @@ public static implicit operator SteamInventoryRequestPricesResult_t ( SteamInve } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryRequestPricesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryRequestPricesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( SteamInventoryRequestPricesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( SteamInventoryRequestPricesResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -30148,27 +26607,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct BroadcastUploadStop_t { - public const int CallbackId = CallbackIdentifiers.ClientVideo + 5; - public BroadcastUploadResult Result; // m_eResult enum EBroadcastUploadResult + internal const int CallbackId = CallbackIdentifiers.ClientVideo + 5; + internal BroadcastUploadResult Result; // m_eResult enum EBroadcastUploadResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static BroadcastUploadStop_t FromPointer( IntPtr p ) + internal static BroadcastUploadStop_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (BroadcastUploadStop_t) Marshal.PtrToStructure( p, typeof(BroadcastUploadStop_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(BroadcastUploadStop_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public BroadcastUploadResult Result; // m_eResult enum EBroadcastUploadResult + internal BroadcastUploadResult Result; // m_eResult enum EBroadcastUploadResult // // Easily convert from PackSmall to BroadcastUploadStop_t @@ -30182,95 +26679,80 @@ public static implicit operator BroadcastUploadStop_t ( BroadcastUploadStop_t.P } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( BroadcastUploadStop_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( BroadcastUploadStop_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -30293,33 +26775,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GetVideoURLResult_t { - public const int CallbackId = CallbackIdentifiers.ClientVideo + 11; - public Result Result; // m_eResult enum EResult - public uint VideoAppID; // m_unVideoAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientVideo + 11; + internal Result Result; // m_eResult enum EResult + internal uint VideoAppID; // m_unVideoAppID AppId_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_rgchURL char [256] + internal string URL; // m_rgchURL char [256] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GetVideoURLResult_t FromPointer( IntPtr p ) + internal static GetVideoURLResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GetVideoURLResult_t) Marshal.PtrToStructure( p, typeof(GetVideoURLResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GetVideoURLResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public uint VideoAppID; // m_unVideoAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal uint VideoAppID; // m_unVideoAppID AppId_t [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string URL; // m_rgchURL char [256] + internal string URL; // m_rgchURL char [256] // // Easily convert from PackSmall to GetVideoURLResult_t @@ -30335,95 +26855,80 @@ public static implicit operator GetVideoURLResult_t ( GetVideoURLResult_t.PackS } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetVideoURLResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetVideoURLResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -30446,29 +26951,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GetOPFSettingsResult_t { - public const int CallbackId = CallbackIdentifiers.ClientVideo + 24; - public Result Result; // m_eResult enum EResult - public uint VideoAppID; // m_unVideoAppID AppId_t + internal const int CallbackId = CallbackIdentifiers.ClientVideo + 24; + internal Result Result; // m_eResult enum EResult + internal uint VideoAppID; // m_unVideoAppID AppId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GetOPFSettingsResult_t FromPointer( IntPtr p ) + internal static GetOPFSettingsResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GetOPFSettingsResult_t) Marshal.PtrToStructure( p, typeof(GetOPFSettingsResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GetOPFSettingsResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public uint VideoAppID; // m_unVideoAppID AppId_t + internal Result Result; // m_eResult enum EResult + internal uint VideoAppID; // m_unVideoAppID AppId_t // // Easily convert from PackSmall to GetOPFSettingsResult_t @@ -30483,95 +27026,80 @@ public static implicit operator GetOPFSettingsResult_t ( GetOPFSettingsResult_t } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GetOPFSettingsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GetOPFSettingsResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -30594,29 +27122,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSClientApprove_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 1; - public ulong SteamID; // m_SteamID class CSteamID - public ulong OwnerSteamID; // m_OwnerSteamID class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 1; + internal ulong SteamID; // m_SteamID class CSteamID + internal ulong OwnerSteamID; // m_OwnerSteamID class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSClientApprove_t FromPointer( IntPtr p ) + internal static GSClientApprove_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSClientApprove_t) Marshal.PtrToStructure( p, typeof(GSClientApprove_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSClientApprove_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_SteamID class CSteamID - public ulong OwnerSteamID; // m_OwnerSteamID class CSteamID + internal ulong SteamID; // m_SteamID class CSteamID + internal ulong OwnerSteamID; // m_OwnerSteamID class CSteamID // // Easily convert from PackSmall to GSClientApprove_t @@ -30631,95 +27197,80 @@ public static implicit operator GSClientApprove_t ( GSClientApprove_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSClientApprove_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSClientApprove_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -30742,33 +27293,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSClientDeny_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 2; - public ulong SteamID; // m_SteamID class CSteamID - public DenyReason DenyReason; // m_eDenyReason enum EDenyReason + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 2; + internal ulong SteamID; // m_SteamID class CSteamID + internal DenyReason DenyReason; // m_eDenyReason enum EDenyReason [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string OptionalText; // m_rgchOptionalText char [128] + internal string OptionalText; // m_rgchOptionalText char [128] // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSClientDeny_t FromPointer( IntPtr p ) + internal static GSClientDeny_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSClientDeny_t) Marshal.PtrToStructure( p, typeof(GSClientDeny_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSClientDeny_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_SteamID class CSteamID - public DenyReason DenyReason; // m_eDenyReason enum EDenyReason + internal ulong SteamID; // m_SteamID class CSteamID + internal DenyReason DenyReason; // m_eDenyReason enum EDenyReason [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string OptionalText; // m_rgchOptionalText char [128] + internal string OptionalText; // m_rgchOptionalText char [128] // // Easily convert from PackSmall to GSClientDeny_t @@ -30784,95 +27373,80 @@ public static implicit operator GSClientDeny_t ( GSClientDeny_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSClientDeny_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSClientDeny_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -30895,29 +27469,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSClientKick_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 3; - public ulong SteamID; // m_SteamID class CSteamID - public DenyReason DenyReason; // m_eDenyReason enum EDenyReason + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 3; + internal ulong SteamID; // m_SteamID class CSteamID + internal DenyReason DenyReason; // m_eDenyReason enum EDenyReason // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSClientKick_t FromPointer( IntPtr p ) + internal static GSClientKick_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSClientKick_t) Marshal.PtrToStructure( p, typeof(GSClientKick_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSClientKick_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_SteamID class CSteamID - public DenyReason DenyReason; // m_eDenyReason enum EDenyReason + internal ulong SteamID; // m_SteamID class CSteamID + internal DenyReason DenyReason; // m_eDenyReason enum EDenyReason // // Easily convert from PackSmall to GSClientKick_t @@ -30932,95 +27544,80 @@ public static implicit operator GSClientKick_t ( GSClientKick_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSClientKick_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSClientKick_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -31043,35 +27640,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GSClientAchievementStatus_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 6; - public ulong SteamID; // m_SteamID uint64 + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 6; + internal ulong SteamID; // m_SteamID uint64 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string PchAchievement; // m_pchAchievement char [128] + internal string PchAchievement; // m_pchAchievement char [128] [MarshalAs(UnmanagedType.I1)] - public bool Unlocked; // m_bUnlocked _Bool + internal bool Unlocked; // m_bUnlocked _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSClientAchievementStatus_t FromPointer( IntPtr p ) + internal static GSClientAchievementStatus_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSClientAchievementStatus_t) Marshal.PtrToStructure( p, typeof(GSClientAchievementStatus_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSClientAchievementStatus_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamID; // m_SteamID uint64 + internal ulong SteamID; // m_SteamID uint64 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string PchAchievement; // m_pchAchievement char [128] + internal string PchAchievement; // m_pchAchievement char [128] [MarshalAs(UnmanagedType.I1)] - public bool Unlocked; // m_bUnlocked _Bool + internal bool Unlocked; // m_bUnlocked _Bool // // Easily convert from PackSmall to GSClientAchievementStatus_t @@ -31087,95 +27722,80 @@ public static implicit operator GSClientAchievementStatus_t ( GSClientAchieveme } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSClientAchievementStatus_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSClientAchievementStatus_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -31198,27 +27818,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GSPolicyResponse_t { - public const int CallbackId = CallbackIdentifiers.SteamUser + 15; - public byte Secure; // m_bSecure uint8 + internal const int CallbackId = CallbackIdentifiers.SteamUser + 15; + internal byte Secure; // m_bSecure uint8 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSPolicyResponse_t FromPointer( IntPtr p ) + internal static GSPolicyResponse_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSPolicyResponse_t) Marshal.PtrToStructure( p, typeof(GSPolicyResponse_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSPolicyResponse_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public byte Secure; // m_bSecure uint8 + internal byte Secure; // m_bSecure uint8 // // Easily convert from PackSmall to GSPolicyResponse_t @@ -31232,95 +27890,80 @@ public static implicit operator GSPolicyResponse_t ( GSPolicyResponse_t.PackSma } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSPolicyResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSPolicyResponse_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -31343,33 +27986,71 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GSGameplayStats_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 7; - public Result Result; // m_eResult enum EResult - public int Rank; // m_nRank int32 - public uint TotalConnects; // m_unTotalConnects uint32 - public uint TotalMinutesPlayed; // m_unTotalMinutesPlayed uint32 + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 7; + internal Result Result; // m_eResult enum EResult + internal int Rank; // m_nRank int32 + internal uint TotalConnects; // m_unTotalConnects uint32 + internal uint TotalMinutesPlayed; // m_unTotalMinutesPlayed uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSGameplayStats_t FromPointer( IntPtr p ) + internal static GSGameplayStats_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSGameplayStats_t) Marshal.PtrToStructure( p, typeof(GSGameplayStats_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSGameplayStats_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public int Rank; // m_nRank int32 - public uint TotalConnects; // m_unTotalConnects uint32 - public uint TotalMinutesPlayed; // m_unTotalMinutesPlayed uint32 + internal Result Result; // m_eResult enum EResult + internal int Rank; // m_nRank int32 + internal uint TotalConnects; // m_unTotalConnects uint32 + internal uint TotalMinutesPlayed; // m_unTotalMinutesPlayed uint32 // // Easily convert from PackSmall to GSGameplayStats_t @@ -31386,95 +28067,80 @@ public static implicit operator GSGameplayStats_t ( GSGameplayStats_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSGameplayStats_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSGameplayStats_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -31497,37 +28163,75 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSClientGroupStatus_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 8; - public ulong SteamIDUser; // m_SteamIDUser class CSteamID - public ulong SteamIDGroup; // m_SteamIDGroup class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 8; + internal ulong SteamIDUser; // m_SteamIDUser class CSteamID + internal ulong SteamIDGroup; // m_SteamIDGroup class CSteamID [MarshalAs(UnmanagedType.I1)] - public bool Member; // m_bMember _Bool + internal bool Member; // m_bMember _Bool [MarshalAs(UnmanagedType.I1)] - public bool Officer; // m_bOfficer _Bool + internal bool Officer; // m_bOfficer _Bool // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSClientGroupStatus_t FromPointer( IntPtr p ) + internal static GSClientGroupStatus_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSClientGroupStatus_t) Marshal.PtrToStructure( p, typeof(GSClientGroupStatus_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSClientGroupStatus_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDUser; // m_SteamIDUser class CSteamID - public ulong SteamIDGroup; // m_SteamIDGroup class CSteamID + internal ulong SteamIDUser; // m_SteamIDUser class CSteamID + internal ulong SteamIDGroup; // m_SteamIDGroup class CSteamID [MarshalAs(UnmanagedType.I1)] - public bool Member; // m_bMember _Bool + internal bool Member; // m_bMember _Bool [MarshalAs(UnmanagedType.I1)] - public bool Officer; // m_bOfficer _Bool + internal bool Officer; // m_bOfficer _Bool // // Easily convert from PackSmall to GSClientGroupStatus_t @@ -31544,95 +28248,80 @@ public static implicit operator GSClientGroupStatus_t ( GSClientGroupStatus_t.P } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSClientGroupStatus_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSClientGroupStatus_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -31655,41 +28344,79 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct GSReputation_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 9; - public Result Result; // m_eResult enum EResult - public uint ReputationScore; // m_unReputationScore uint32 + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 9; + internal Result Result; // m_eResult enum EResult + internal uint ReputationScore; // m_unReputationScore uint32 [MarshalAs(UnmanagedType.I1)] - public bool Banned; // m_bBanned _Bool - public uint BannedIP; // m_unBannedIP uint32 - public ushort BannedPort; // m_usBannedPort uint16 - public ulong BannedGameID; // m_ulBannedGameID uint64 - public uint BanExpires; // m_unBanExpires uint32 + internal bool Banned; // m_bBanned _Bool + internal uint BannedIP; // m_unBannedIP uint32 + internal ushort BannedPort; // m_usBannedPort uint16 + internal ulong BannedGameID; // m_ulBannedGameID uint64 + internal uint BanExpires; // m_unBanExpires uint32 // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSReputation_t FromPointer( IntPtr p ) + internal static GSReputation_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSReputation_t) Marshal.PtrToStructure( p, typeof(GSReputation_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSReputation_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public uint ReputationScore; // m_unReputationScore uint32 + internal Result Result; // m_eResult enum EResult + internal uint ReputationScore; // m_unReputationScore uint32 [MarshalAs(UnmanagedType.I1)] - public bool Banned; // m_bBanned _Bool - public uint BannedIP; // m_unBannedIP uint32 - public ushort BannedPort; // m_usBannedPort uint16 - public ulong BannedGameID; // m_ulBannedGameID uint64 - public uint BanExpires; // m_unBanExpires uint32 + internal bool Banned; // m_bBanned _Bool + internal uint BannedIP; // m_unBannedIP uint32 + internal ushort BannedPort; // m_usBannedPort uint16 + internal ulong BannedGameID; // m_ulBannedGameID uint64 + internal uint BanExpires; // m_unBanExpires uint32 // // Easily convert from PackSmall to GSReputation_t @@ -31709,225 +28436,85 @@ public static implicit operator GSReputation_t ( GSReputation_t.PackSmall d ) } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSReputation_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSReputation_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSReputation_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSReputation_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -31950,27 +28537,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct AssociateWithClanResult_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 10; - public Result Result; // m_eResult enum EResult + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 10; + internal Result Result; // m_eResult enum EResult // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static AssociateWithClanResult_t FromPointer( IntPtr p ) + internal static AssociateWithClanResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (AssociateWithClanResult_t) Marshal.PtrToStructure( p, typeof(AssociateWithClanResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(AssociateWithClanResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult + internal Result Result; // m_eResult enum EResult // // Easily convert from PackSmall to AssociateWithClanResult_t @@ -31984,225 +28609,85 @@ public static implicit operator AssociateWithClanResult_t ( AssociateWithClanRe } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AssociateWithClanResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AssociateWithClanResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( AssociateWithClanResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( AssociateWithClanResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -32225,35 +28710,73 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct ComputeNewPlayerCompatibilityResult_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServer + 11; - public Result Result; // m_eResult enum EResult - public int CPlayersThatDontLikeCandidate; // m_cPlayersThatDontLikeCandidate int - public int CPlayersThatCandidateDoesntLike; // m_cPlayersThatCandidateDoesntLike int - public int CClanPlayersThatDontLikeCandidate; // m_cClanPlayersThatDontLikeCandidate int - public ulong SteamIDCandidate; // m_SteamIDCandidate class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamGameServer + 11; + internal Result Result; // m_eResult enum EResult + internal int CPlayersThatDontLikeCandidate; // m_cPlayersThatDontLikeCandidate int + internal int CPlayersThatCandidateDoesntLike; // m_cPlayersThatCandidateDoesntLike int + internal int CClanPlayersThatDontLikeCandidate; // m_cClanPlayersThatDontLikeCandidate int + internal ulong SteamIDCandidate; // m_SteamIDCandidate class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ComputeNewPlayerCompatibilityResult_t FromPointer( IntPtr p ) + internal static ComputeNewPlayerCompatibilityResult_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ComputeNewPlayerCompatibilityResult_t) Marshal.PtrToStructure( p, typeof(ComputeNewPlayerCompatibilityResult_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ComputeNewPlayerCompatibilityResult_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public int CPlayersThatDontLikeCandidate; // m_cPlayersThatDontLikeCandidate int - public int CPlayersThatCandidateDoesntLike; // m_cPlayersThatCandidateDoesntLike int - public int CClanPlayersThatDontLikeCandidate; // m_cClanPlayersThatDontLikeCandidate int - public ulong SteamIDCandidate; // m_SteamIDCandidate class CSteamID + internal Result Result; // m_eResult enum EResult + internal int CPlayersThatDontLikeCandidate; // m_cPlayersThatDontLikeCandidate int + internal int CPlayersThatCandidateDoesntLike; // m_cPlayersThatCandidateDoesntLike int + internal int CClanPlayersThatDontLikeCandidate; // m_cClanPlayersThatDontLikeCandidate int + internal ulong SteamIDCandidate; // m_SteamIDCandidate class CSteamID // // Easily convert from PackSmall to ComputeNewPlayerCompatibilityResult_t @@ -32271,225 +28794,85 @@ public static implicit operator ComputeNewPlayerCompatibilityResult_t ( Compute } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ComputeNewPlayerCompatibilityResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ComputeNewPlayerCompatibilityResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ComputeNewPlayerCompatibilityResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ComputeNewPlayerCompatibilityResult_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -32512,29 +28895,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSStatsReceived_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServerStats + 0; - public Result Result; // m_eResult enum EResult - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamGameServerStats + 0; + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSStatsReceived_t FromPointer( IntPtr p ) + internal static GSStatsReceived_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSStatsReceived_t) Marshal.PtrToStructure( p, typeof(GSStatsReceived_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSStatsReceived_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Easily convert from PackSmall to GSStatsReceived_t @@ -32549,225 +28970,85 @@ public static implicit operator GSStatsReceived_t ( GSStatsReceived_t.PackSmall } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSStatsReceived_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -32790,29 +29071,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSStatsStored_t { - public const int CallbackId = CallbackIdentifiers.SteamGameServerStats + 1; - public Result Result; // m_eResult enum EResult - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamGameServerStats + 1; + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSStatsStored_t FromPointer( IntPtr p ) + internal static GSStatsStored_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSStatsStored_t) Marshal.PtrToStructure( p, typeof(GSStatsStored_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSStatsStored_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public Result Result; // m_eResult enum EResult - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal Result Result; // m_eResult enum EResult + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Easily convert from PackSmall to GSStatsStored_t @@ -32827,225 +29146,85 @@ public static implicit operator GSStatsStored_t ( GSStatsStored_t.PackSmall d ) } } - public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + internal static CallResult CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; - handle.CallResultHandle = call; - handle.CallResult = true; - - // - // Create the functions we need for the vtable - // - if ( Facepunch.Steamworks.Config.UseThisCall ) - { - Callback.ThisCall.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSStatsStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - else - { - Callback.StdCall.Result funcA = ( p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => - { - if ( hSteamAPICall != call ) return; - - handle.CallResultHandle = 0; - handle.Dispose(); - - CallbackFunction( FromPointer( p ), bIOFailure ); - }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSStatsStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - - // - // Create the VTable by manually allocating the memory and copying across - // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // - if ( Platform.IsWindows ) - { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); - } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); - } - - // - // Create the callback object - // - var cb = new Callback(); - cb.vTablePtr = handle.vTablePtr; - cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; - cb.CallbackId = CallbackId; - - // - // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native - // - handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); - - // - // Register the callback with Steam - // - steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); - - return handle; + return new CallResult( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId ); } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSStatsStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSStatsStored_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -33068,27 +29247,65 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct GSStatsUnloaded_t { - public const int CallbackId = CallbackIdentifiers.SteamUserStats + 8; - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal const int CallbackId = CallbackIdentifiers.SteamUserStats + 8; + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static GSStatsUnloaded_t FromPointer( IntPtr p ) + internal static GSStatsUnloaded_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (GSStatsUnloaded_t) Marshal.PtrToStructure( p, typeof(GSStatsUnloaded_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GSStatsUnloaded_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public ulong SteamIDUser; // m_steamIDUser class CSteamID + internal ulong SteamIDUser; // m_steamIDUser class CSteamID // // Easily convert from PackSmall to GSStatsUnloaded_t @@ -33102,95 +29319,80 @@ public static implicit operator GSStatsUnloaded_t ( GSStatsUnloaded_t.PackSmall } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( GSStatsUnloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( GSStatsUnloaded_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -33213,29 +29415,67 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct ItemInstalled_t { - public const int CallbackId = CallbackIdentifiers.ClientUGC + 5; - public uint AppID; // m_unAppID AppId_t - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal const int CallbackId = CallbackIdentifiers.ClientUGC + 5; + internal uint AppID; // m_unAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. // - public static ItemInstalled_t FromPointer( IntPtr p ) + internal static ItemInstalled_t FromPointer( IntPtr p ) { if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); return (ItemInstalled_t) Marshal.PtrToStructure( p, typeof(ItemInstalled_t) ); } + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ItemInstalled_t) ); + } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] internal struct PackSmall { - public uint AppID; // m_unAppID AppId_t - public ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t + internal uint AppID; // m_unAppID AppId_t + internal ulong PublishedFileId; // m_nPublishedFileId PublishedFileId_t // // Easily convert from PackSmall to ItemInstalled_t @@ -33250,95 +29490,80 @@ public static implicit operator ItemInstalled_t ( ItemInstalled_t.PackSmall d ) } } - public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action CallbackFunction ) + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) { - var handle = new CallbackHandle(); - handle.steamworks = steamworks; + var handle = new CallbackHandle( steamworks ); // // Create the functions we need for the vtable // if ( Facepunch.Steamworks.Config.UseThisCall ) { - Callback.ThisCall.Result funcA = ( _, p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.ThisCall.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.ThisCall.GetSize funcC = ( _ ) => Marshal.SizeOf( typeof( ItemInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( _ ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } else { - Callback.StdCall.Result funcA = ( p ) => { CallbackFunction( FromPointer( p ), false ); }; - Callback.StdCall.ResultWithInfo funcB = ( p, bIOFailure, hSteamAPICall ) => { CallbackFunction( FromPointer( p ), bIOFailure ); }; - Callback.StdCall.GetSize funcC = ( ) => Marshal.SizeOf( typeof( ItemInstalled_t ) ); - - // - // If this platform is PackSmall, use PackSmall versions of everything instead - // - if ( Platform.PackSmall ) - { - funcC = ( ) => Marshal.SizeOf( typeof( PackSmall ) ); - } - - // - // Allocate a handle to each function, so they don't get disposed - // - handle.FuncA = GCHandle.Alloc( funcA ); - handle.FuncB = GCHandle.Alloc( funcB ); - handle.FuncC = GCHandle.Alloc( funcC ); - // // Create the VTable by manually allocating the memory and copying across // - handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); - var vTable = new Callback.VTable() - { - ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), - ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), - GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), - }; - // - // The order of these functions are swapped on Windows - // if ( Platform.IsWindows ) { - vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); - vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } - Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); } // @@ -33361,6 +29586,2035 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo steamworks.RegisterCallbackHandle( handle ); } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } } + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct SteamInventoryDefinitionUpdate_t + { + internal const int CallbackId = CallbackIdentifiers.ClientInventory + 2; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static SteamInventoryDefinitionUpdate_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (SteamInventoryDefinitionUpdate_t) Marshal.PtrToStructure( p, typeof(SteamInventoryDefinitionUpdate_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInventoryDefinitionUpdate_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to SteamInventoryDefinitionUpdate_t + // + public static implicit operator SteamInventoryDefinitionUpdate_t ( SteamInventoryDefinitionUpdate_t.PackSmall d ) + { + return new SteamInventoryDefinitionUpdate_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct SteamParentalSettingsChanged_t + { + internal const int CallbackId = CallbackIdentifiers.SteamParentalSettings + 1; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static SteamParentalSettingsChanged_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (SteamParentalSettingsChanged_t) Marshal.PtrToStructure( p, typeof(SteamParentalSettingsChanged_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamParentalSettingsChanged_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to SteamParentalSettingsChanged_t + // + public static implicit operator SteamParentalSettingsChanged_t ( SteamParentalSettingsChanged_t.PackSmall d ) + { + return new SteamParentalSettingsChanged_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct SteamServersConnected_t + { + internal const int CallbackId = CallbackIdentifiers.SteamUser + 1; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static SteamServersConnected_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (SteamServersConnected_t) Marshal.PtrToStructure( p, typeof(SteamServersConnected_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamServersConnected_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to SteamServersConnected_t + // + public static implicit operator SteamServersConnected_t ( SteamServersConnected_t.PackSmall d ) + { + return new SteamServersConnected_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct NewLaunchQueryParameters_t + { + internal const int CallbackId = CallbackIdentifiers.SteamApps + 14; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static NewLaunchQueryParameters_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (NewLaunchQueryParameters_t) Marshal.PtrToStructure( p, typeof(NewLaunchQueryParameters_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(NewLaunchQueryParameters_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to NewLaunchQueryParameters_t + // + public static implicit operator NewLaunchQueryParameters_t ( NewLaunchQueryParameters_t.PackSmall d ) + { + return new NewLaunchQueryParameters_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct GCMessageAvailable_t + { + internal const int CallbackId = CallbackIdentifiers.SteamGameCoordinator + 1; + internal uint MessageSize; // m_nMessageSize uint32 + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static GCMessageAvailable_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (GCMessageAvailable_t) Marshal.PtrToStructure( p, typeof(GCMessageAvailable_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GCMessageAvailable_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + internal uint MessageSize; // m_nMessageSize uint32 + + // + // Easily convert from PackSmall to GCMessageAvailable_t + // + public static implicit operator GCMessageAvailable_t ( GCMessageAvailable_t.PackSmall d ) + { + return new GCMessageAvailable_t() + { + MessageSize = d.MessageSize, + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct GCMessageFailed_t + { + internal const int CallbackId = CallbackIdentifiers.SteamGameCoordinator + 2; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static GCMessageFailed_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (GCMessageFailed_t) Marshal.PtrToStructure( p, typeof(GCMessageFailed_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(GCMessageFailed_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to GCMessageFailed_t + // + public static implicit operator GCMessageFailed_t ( GCMessageFailed_t.PackSmall d ) + { + return new GCMessageFailed_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct ScreenshotRequested_t + { + internal const int CallbackId = CallbackIdentifiers.SteamScreenshots + 2; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static ScreenshotRequested_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (ScreenshotRequested_t) Marshal.PtrToStructure( p, typeof(ScreenshotRequested_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(ScreenshotRequested_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to ScreenshotRequested_t + // + public static implicit operator ScreenshotRequested_t ( ScreenshotRequested_t.PackSmall d ) + { + return new ScreenshotRequested_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct LicensesUpdated_t + { + internal const int CallbackId = CallbackIdentifiers.SteamUser + 25; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static LicensesUpdated_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (LicensesUpdated_t) Marshal.PtrToStructure( p, typeof(LicensesUpdated_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(LicensesUpdated_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to LicensesUpdated_t + // + public static implicit operator LicensesUpdated_t ( LicensesUpdated_t.PackSmall d ) + { + return new LicensesUpdated_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct SteamShutdown_t + { + internal const int CallbackId = CallbackIdentifiers.SteamUtils + 4; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static SteamShutdown_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (SteamShutdown_t) Marshal.PtrToStructure( p, typeof(SteamShutdown_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamShutdown_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to SteamShutdown_t + // + public static implicit operator SteamShutdown_t ( SteamShutdown_t.PackSmall d ) + { + return new SteamShutdown_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct IPCountry_t + { + internal const int CallbackId = CallbackIdentifiers.SteamUtils + 1; + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static IPCountry_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (IPCountry_t) Marshal.PtrToStructure( p, typeof(IPCountry_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(IPCountry_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + + // + // Easily convert from PackSmall to IPCountry_t + // + public static implicit operator IPCountry_t ( IPCountry_t.PackSmall d ) + { + return new IPCountry_t() + { + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + [StructLayout( LayoutKind.Sequential, Pack = 8 )] + internal struct IPCFailure_t + { + internal const int CallbackId = CallbackIdentifiers.SteamUser + 17; + internal byte FailureType; // m_eFailureType uint8 + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + internal static IPCFailure_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (IPCFailure_t) Marshal.PtrToStructure( p, typeof(IPCFailure_t) ); + } + + // + // Get the size of the structure we're going to be using. + // + internal static int StructSize() + { + if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) ); + return System.Runtime.InteropServices.Marshal.SizeOf( typeof(IPCFailure_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + internal byte FailureType; // m_eFailureType uint8 + + // + // Easily convert from PackSmall to IPCFailure_t + // + public static implicit operator IPCFailure_t ( IPCFailure_t.PackSmall d ) + { + return new IPCFailure_t() + { + FailureType = d.FailureType, + }; + } + } + + internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + var handle = new CallbackHandle( steamworks ); + + // + // Create the functions we need for the vtable + // + if ( Facepunch.Steamworks.Config.UseThisCall ) + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) ); + var vTable = new Callback.VTableWinThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) ); + var vTable = new Callback.VTableThis + { + ResultA = OnResultThis, + ResultB = OnResultWithInfoThis, + GetSize = OnGetSizeThis, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + else + { + // + // Create the VTable by manually allocating the memory and copying across + // + if ( Platform.IsWindows ) + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) ); + var vTable = new Callback.VTableWin + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + else + { + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable + { + ResultA = OnResult, + ResultB = OnResultWithInfo, + GetSize = OnGetSize, + }; + handle.FuncA = GCHandle.Alloc( vTable.ResultA ); + handle.FuncB = GCHandle.Alloc( vTable.ResultB ); + handle.FuncC = GCHandle.Alloc( vTable.GetSize ); + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + } + } + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallback( handle.PinnedCallback.AddrOfPinnedObject(), CallbackId ); + + steamworks.RegisterCallbackHandle( handle ); + } + + [MonoPInvokeCallback] + internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); } + [MonoPInvokeCallback] + internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); } + [MonoPInvokeCallback] + internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); } + [MonoPInvokeCallback] + internal static int OnGetSize(){ return StructSize(); } + + [MonoPInvokeCallback] + internal static void OnResult( IntPtr param ) + { + OnResultWithInfo( param, false, 0 ); + } + + [MonoPInvokeCallback] + internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) + { + if ( failure ) return; + + var value = FromPointer( param ); + + if ( Facepunch.Steamworks.Client.Instance != null ) + Facepunch.Steamworks.Client.Instance.OnCallback( value ); + + if ( Facepunch.Steamworks.Server.Instance != null ) + Facepunch.Steamworks.Server.Instance.OnCallback( value ); + } + } + + internal static class Callbacks + { + internal static void RegisterCallbacks( Facepunch.Steamworks.BaseSteamworks steamworks ) + { + SteamServerConnectFailure_t.Register( steamworks ); + SteamServersDisconnected_t.Register( steamworks ); + ClientGameServerDeny_t.Register( steamworks ); + ValidateAuthTicketResponse_t.Register( steamworks ); + MicroTxnAuthorizationResponse_t.Register( steamworks ); + EncryptedAppTicketResponse_t.Register( steamworks ); + GetAuthSessionTicketResponse_t.Register( steamworks ); + GameWebCallback_t.Register( steamworks ); + StoreAuthURLResponse_t.Register( steamworks ); + PersonaStateChange_t.Register( steamworks ); + GameOverlayActivated_t.Register( steamworks ); + GameServerChangeRequested_t.Register( steamworks ); + GameLobbyJoinRequested_t.Register( steamworks ); + AvatarImageLoaded_t.Register( steamworks ); + ClanOfficerListResponse_t.Register( steamworks ); + FriendRichPresenceUpdate_t.Register( steamworks ); + GameRichPresenceJoinRequested_t.Register( steamworks ); + GameConnectedClanChatMsg_t.Register( steamworks ); + GameConnectedChatJoin_t.Register( steamworks ); + GameConnectedChatLeave_t.Register( steamworks ); + DownloadClanActivityCountsResult_t.Register( steamworks ); + JoinClanChatRoomCompletionResult_t.Register( steamworks ); + GameConnectedFriendChatMsg_t.Register( steamworks ); + FriendsGetFollowerCount_t.Register( steamworks ); + FriendsIsFollowing_t.Register( steamworks ); + FriendsEnumerateFollowingList_t.Register( steamworks ); + SetPersonaNameResponse_t.Register( steamworks ); + LowBatteryPower_t.Register( steamworks ); + SteamAPICallCompleted_t.Register( steamworks ); + CheckFileSignature_t.Register( steamworks ); + GamepadTextInputDismissed_t.Register( steamworks ); + FavoritesListChanged_t.Register( steamworks ); + LobbyInvite_t.Register( steamworks ); + LobbyEnter_t.Register( steamworks ); + LobbyDataUpdate_t.Register( steamworks ); + LobbyChatUpdate_t.Register( steamworks ); + LobbyChatMsg_t.Register( steamworks ); + LobbyGameCreated_t.Register( steamworks ); + LobbyMatchList_t.Register( steamworks ); + LobbyKicked_t.Register( steamworks ); + LobbyCreated_t.Register( steamworks ); + PSNGameBootInviteResult_t.Register( steamworks ); + FavoritesListAccountsUpdated_t.Register( steamworks ); + RemoteStorageAppSyncedClient_t.Register( steamworks ); + RemoteStorageAppSyncedServer_t.Register( steamworks ); + RemoteStorageAppSyncProgress_t.Register( steamworks ); + RemoteStorageAppSyncStatusCheck_t.Register( steamworks ); + RemoteStorageFileShareResult_t.Register( steamworks ); + RemoteStoragePublishFileResult_t.Register( steamworks ); + RemoteStorageDeletePublishedFileResult_t.Register( steamworks ); + RemoteStorageEnumerateUserPublishedFilesResult_t.Register( steamworks ); + RemoteStorageSubscribePublishedFileResult_t.Register( steamworks ); + RemoteStorageEnumerateUserSubscribedFilesResult_t.Register( steamworks ); + RemoteStorageUnsubscribePublishedFileResult_t.Register( steamworks ); + RemoteStorageUpdatePublishedFileResult_t.Register( steamworks ); + RemoteStorageDownloadUGCResult_t.Register( steamworks ); + RemoteStorageGetPublishedFileDetailsResult_t.Register( steamworks ); + RemoteStorageEnumerateWorkshopFilesResult_t.Register( steamworks ); + RemoteStorageGetPublishedItemVoteDetailsResult_t.Register( steamworks ); + RemoteStoragePublishedFileSubscribed_t.Register( steamworks ); + RemoteStoragePublishedFileUnsubscribed_t.Register( steamworks ); + RemoteStoragePublishedFileDeleted_t.Register( steamworks ); + RemoteStorageUpdateUserPublishedItemVoteResult_t.Register( steamworks ); + RemoteStorageUserVoteDetails_t.Register( steamworks ); + RemoteStorageEnumerateUserSharedWorkshopFilesResult_t.Register( steamworks ); + RemoteStorageSetUserPublishedFileActionResult_t.Register( steamworks ); + RemoteStorageEnumeratePublishedFilesByUserActionResult_t.Register( steamworks ); + RemoteStoragePublishFileProgress_t.Register( steamworks ); + RemoteStoragePublishedFileUpdated_t.Register( steamworks ); + RemoteStorageFileWriteAsyncComplete_t.Register( steamworks ); + RemoteStorageFileReadAsyncComplete_t.Register( steamworks ); + UserStatsReceived_t.Register( steamworks ); + UserStatsStored_t.Register( steamworks ); + UserAchievementStored_t.Register( steamworks ); + LeaderboardFindResult_t.Register( steamworks ); + LeaderboardScoresDownloaded_t.Register( steamworks ); + LeaderboardScoreUploaded_t.Register( steamworks ); + NumberOfCurrentPlayers_t.Register( steamworks ); + UserStatsUnloaded_t.Register( steamworks ); + UserAchievementIconFetched_t.Register( steamworks ); + GlobalAchievementPercentagesReady_t.Register( steamworks ); + LeaderboardUGCSet_t.Register( steamworks ); + PS3TrophiesInstalled_t.Register( steamworks ); + GlobalStatsReceived_t.Register( steamworks ); + DlcInstalled_t.Register( steamworks ); + RegisterActivationCodeResponse_t.Register( steamworks ); + AppProofOfPurchaseKeyResponse_t.Register( steamworks ); + FileDetailsResult_t.Register( steamworks ); + P2PSessionRequest_t.Register( steamworks ); + P2PSessionConnectFail_t.Register( steamworks ); + SocketStatusCallback_t.Register( steamworks ); + ScreenshotReady_t.Register( steamworks ); + VolumeHasChanged_t.Register( steamworks ); + MusicPlayerWantsShuffled_t.Register( steamworks ); + MusicPlayerWantsLooped_t.Register( steamworks ); + MusicPlayerWantsVolume_t.Register( steamworks ); + MusicPlayerSelectsQueueEntry_t.Register( steamworks ); + MusicPlayerSelectsPlaylistEntry_t.Register( steamworks ); + MusicPlayerWantsPlayingRepeatStatus_t.Register( steamworks ); + HTTPRequestCompleted_t.Register( steamworks ); + HTTPRequestHeadersReceived_t.Register( steamworks ); + HTTPRequestDataReceived_t.Register( steamworks ); + SteamUGCQueryCompleted_t.Register( steamworks ); + SteamUGCRequestUGCDetailsResult_t.Register( steamworks ); + CreateItemResult_t.Register( steamworks ); + SubmitItemUpdateResult_t.Register( steamworks ); + DownloadItemResult_t.Register( steamworks ); + UserFavoriteItemsListChanged_t.Register( steamworks ); + SetUserItemVoteResult_t.Register( steamworks ); + GetUserItemVoteResult_t.Register( steamworks ); + StartPlaytimeTrackingResult_t.Register( steamworks ); + StopPlaytimeTrackingResult_t.Register( steamworks ); + AddUGCDependencyResult_t.Register( steamworks ); + RemoveUGCDependencyResult_t.Register( steamworks ); + AddAppDependencyResult_t.Register( steamworks ); + RemoveAppDependencyResult_t.Register( steamworks ); + GetAppDependenciesResult_t.Register( steamworks ); + DeleteItemResult_t.Register( steamworks ); + SteamAppInstalled_t.Register( steamworks ); + SteamAppUninstalled_t.Register( steamworks ); + HTML_BrowserReady_t.Register( steamworks ); + HTML_URLChanged_t.Register( steamworks ); + HTML_FinishedRequest_t.Register( steamworks ); + HTML_OpenLinkInNewTab_t.Register( steamworks ); + HTML_ChangedTitle_t.Register( steamworks ); + HTML_SearchResults_t.Register( steamworks ); + HTML_CanGoBackAndForward_t.Register( steamworks ); + HTML_HorizontalScroll_t.Register( steamworks ); + HTML_VerticalScroll_t.Register( steamworks ); + HTML_LinkAtPosition_t.Register( steamworks ); + HTML_JSAlert_t.Register( steamworks ); + HTML_JSConfirm_t.Register( steamworks ); + HTML_FileOpenDialog_t.Register( steamworks ); + HTML_NewWindow_t.Register( steamworks ); + HTML_SetCursor_t.Register( steamworks ); + HTML_StatusText_t.Register( steamworks ); + HTML_ShowToolTip_t.Register( steamworks ); + HTML_UpdateToolTip_t.Register( steamworks ); + HTML_HideToolTip_t.Register( steamworks ); + HTML_BrowserRestarted_t.Register( steamworks ); + SteamInventoryResultReady_t.Register( steamworks ); + SteamInventoryFullUpdate_t.Register( steamworks ); + SteamInventoryEligiblePromoItemDefIDs_t.Register( steamworks ); + SteamInventoryStartPurchaseResult_t.Register( steamworks ); + SteamInventoryRequestPricesResult_t.Register( steamworks ); + BroadcastUploadStop_t.Register( steamworks ); + GetVideoURLResult_t.Register( steamworks ); + GetOPFSettingsResult_t.Register( steamworks ); + GSClientApprove_t.Register( steamworks ); + GSClientDeny_t.Register( steamworks ); + GSClientKick_t.Register( steamworks ); + GSClientAchievementStatus_t.Register( steamworks ); + GSPolicyResponse_t.Register( steamworks ); + GSGameplayStats_t.Register( steamworks ); + GSClientGroupStatus_t.Register( steamworks ); + GSReputation_t.Register( steamworks ); + AssociateWithClanResult_t.Register( steamworks ); + ComputeNewPlayerCompatibilityResult_t.Register( steamworks ); + GSStatsReceived_t.Register( steamworks ); + GSStatsStored_t.Register( steamworks ); + GSStatsUnloaded_t.Register( steamworks ); + ItemInstalled_t.Register( steamworks ); + SteamInventoryDefinitionUpdate_t.Register( steamworks ); + SteamParentalSettingsChanged_t.Register( steamworks ); + SteamServersConnected_t.Register( steamworks ); + NewLaunchQueryParameters_t.Register( steamworks ); + GCMessageAvailable_t.Register( steamworks ); + GCMessageFailed_t.Register( steamworks ); + ScreenshotRequested_t.Register( steamworks ); + LicensesUpdated_t.Register( steamworks ); + SteamShutdown_t.Register( steamworks ); + IPCountry_t.Register( steamworks ); + IPCFailure_t.Register( steamworks ); + } + } } diff --git a/Facepunch.Steamworks/Utility.cs b/Facepunch.Steamworks/Utility.cs index 7b048cc..1bb7e43 100644 --- a/Facepunch.Steamworks/Utility.cs +++ b/Facepunch.Steamworks/Utility.cs @@ -1,30 +1,30 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Text; namespace Facepunch.Steamworks { - internal static class Utility + public static partial class Utility { - static internal uint SwapBytes( uint x ) + static internal uint Swap( uint x ) { - return ( ( x & 0x000000ff ) << 24 ) + - ( ( x & 0x0000ff00 ) << 8 ) + - ( ( x & 0x00ff0000 ) >> 8 ) + - ( ( x & 0xff000000 ) >> 24 ); + return ((x & 0x000000ff) << 24) + + ((x & 0x0000ff00) << 8) + + ((x & 0x00ff0000) >> 8) + + ((x & 0xff000000) >> 24); } - - static internal uint IpToInt32( this IPAddress ipAddress ) + static public uint IpToInt32( this IPAddress ipAddress ) { - return BitConverter.ToUInt32( ipAddress.GetAddressBytes().Reverse().ToArray(), 0 ); + return Swap( (uint) ipAddress.Address ); } - static internal IPAddress Int32ToIp( uint ipAddress ) + static public IPAddress Int32ToIp( uint ipAddress ) { - return new IPAddress( BitConverter.GetBytes( ipAddress ).Reverse().ToArray() ); + return new IPAddress( Swap( ipAddress ) ); } static internal class Epoch @@ -77,8 +77,23 @@ internal static string FormatPrice(string currency, ulong price) default: return $"{decimaled}{currency}"; } - - } + + public static string ReadNullTerminatedUTF8String( this BinaryReader br, byte[] buffer = null ) + { + if ( buffer == null ) + buffer = new byte[1024]; + + byte chr; + int i = 0; + while ( (chr = br.ReadByte()) != 0 && i < buffer.Length ) + { + buffer[i] = chr; + i++; + } + + return Encoding.UTF8.GetString( buffer, 0, i ); + } + } } diff --git a/Facepunch.Steamworks/Utility/SourceServerQuery.cs b/Facepunch.Steamworks/Utility/SourceServerQuery.cs new file mode 100644 index 0000000..fa8c3a5 --- /dev/null +++ b/Facepunch.Steamworks/Utility/SourceServerQuery.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Sockets; + +namespace Facepunch.Steamworks +{ + + internal class SourceServerQuery : IDisposable + { + public static List Current = new List(); + + public static void Cycle() + { + if ( Current.Count == 0 ) + return; + + for( int i = Current.Count; i>0; i-- ) + { + Current[i-1].Update(); + } + } + + private static readonly byte[] A2S_SERVERQUERY_GETCHALLENGE = { 0x55, 0xFF, 0xFF, 0xFF, 0xFF }; + private static readonly byte A2S_PLAYER = 0x55; + private static readonly byte A2S_RULES = 0x56; + + public volatile bool IsRunning; + public volatile bool IsSuccessful; + + private ServerList.Server Server; + private UdpClient udpClient; + private IPEndPoint endPoint; + private System.Threading.Thread thread; + private byte[] _challengeBytes; + + private Dictionary rules = new Dictionary(); + + public SourceServerQuery( ServerList.Server server, IPAddress address, int queryPort ) + { + Server = server; + endPoint = new IPEndPoint( address, queryPort ); + + Current.Add( this ); + + IsRunning = true; + IsSuccessful = false; + thread = new System.Threading.Thread( ThreadedStart ); + thread.Start(); + } + + void Update() + { + if ( !IsRunning ) + { + Current.Remove( this ); + Server.OnServerRulesReceiveFinished( rules, IsSuccessful ); + } + } + + private void ThreadedStart( object obj ) + { + try + { + using ( udpClient = new UdpClient() ) + { + udpClient.Client.SendTimeout = 3000; + udpClient.Client.ReceiveTimeout = 3000; + udpClient.Connect( endPoint ); + + GetRules(); + + IsSuccessful = true; + } + } + catch ( System.Exception ) + { + IsSuccessful = false; + } + + udpClient = null; + IsRunning = false; + } + + void GetRules() + { + GetChallengeData(); + + _challengeBytes[0] = A2S_RULES; + Send( _challengeBytes ); + var ruleData = Receive(); + + using ( var br = new BinaryReader( new MemoryStream( ruleData ) ) ) + { + if ( br.ReadByte() != 0x45 ) + throw new Exception( "Invalid data received in response to A2S_RULES request" ); + + var numRules = br.ReadUInt16(); + for ( int index = 0; index < numRules; index++ ) + { + rules.Add( br.ReadNullTerminatedUTF8String( readBuffer ), br.ReadNullTerminatedUTF8String( readBuffer ) ); + } + } + + } + + byte[] readBuffer = new byte[1024 * 4]; + + private byte[] Receive() + { + byte[][] packets = null; + byte packetNumber = 0, packetCount = 1; + + do + { + var result = udpClient.Receive( ref endPoint ); + + using ( var br = new BinaryReader( new MemoryStream( result ) ) ) + { + var header = br.ReadInt32(); + + if ( header == -1 ) + { + var unsplitdata = new byte[result.Length - br.BaseStream.Position]; + Buffer.BlockCopy( result, (int)br.BaseStream.Position, unsplitdata, 0, unsplitdata.Length ); + return unsplitdata; + } + else if ( header == -2 ) + { + int requestId = br.ReadInt32(); + packetNumber = br.ReadByte(); + packetCount = br.ReadByte(); + int splitSize = br.ReadInt32(); + } + else + { + throw new System.Exception( "Invalid Header" ); + } + + if ( packets == null ) packets = new byte[packetCount][]; + + var data = new byte[result.Length - br.BaseStream.Position]; + Buffer.BlockCopy( result, (int)br.BaseStream.Position, data, 0, data.Length ); + packets[packetNumber] = data; + } + } + while ( packets.Any( p => p == null ) ); + + var combinedData = Combine( packets ); + return combinedData; + } + + private void GetChallengeData() + { + if ( _challengeBytes != null ) return; + + Send( A2S_SERVERQUERY_GETCHALLENGE ); + + var challengeData = Receive(); + + if ( challengeData[0] != 0x41 ) + throw new Exception( "Invalid Challenge" ); + + _challengeBytes = challengeData; + } + + byte[] sendBuffer = new byte[1024]; + + private void Send( byte[] message ) + { + sendBuffer[0] = 0xFF; + sendBuffer[1] = 0xFF; + sendBuffer[2] = 0xFF; + sendBuffer[3] = 0xFF; + + Buffer.BlockCopy( message, 0, sendBuffer, 4, message.Length ); + + udpClient.Send( sendBuffer, message.Length + 4 ); + } + + private byte[] Combine( byte[][] arrays ) + { + var rv = new byte[arrays.Sum( a => a.Length )]; + int offset = 0; + foreach ( byte[] array in arrays ) + { + Buffer.BlockCopy( array, 0, rv, offset, array.Length ); + offset += array.Length; + } + return rv; + } + + public void Dispose() + { + if ( thread != null && thread.IsAlive ) + { + thread.Abort(); + } + + thread = null; + } + }; + +} diff --git a/Generator/CodeParser/CodeParser.cs b/Generator/CodeParser/CodeParser.cs index 99505b7..caefe23 100644 --- a/Generator/CodeParser/CodeParser.cs +++ b/Generator/CodeParser/CodeParser.cs @@ -29,12 +29,12 @@ internal void ExtendDefinition( SteamApiDefinition def ) // def.CallbackIds = new Dictionary(); { - var r = new Regex( @"enum { (k_i(?:.+)) = ([0-9]+) };" ); + var r = new Regex( @"enum { (k_[i|I](?:.+)) = ([0-9]+) };" ); var ma = r.Matches( Content ); foreach ( Match m in ma ) { - def.CallbackIds.Add( m.Groups[1].Value.Replace( "k_i", "" ).Replace( "Callbacks", "" ), int.Parse( m.Groups[2].Value ) ); + def.CallbackIds.Add( m.Groups[1].Value.Substring( 3 ).Replace( "Callbacks", "" ), int.Parse( m.Groups[2].Value ) ); } } @@ -62,7 +62,7 @@ internal void ExtendDefinition( SteamApiDefinition def ) num = "0"; } - kName = kName.Replace( "k_i", "CallbackIdentifiers." ).Replace( "Callbacks", "" ); + kName = "CallbackIdentifiers." + kName.Substring( 3 ).Replace( "Callbacks", "" ); t.CallbackId = $"{kName} + {num}"; } @@ -77,7 +77,8 @@ internal void ExtendDefinition( SteamApiDefinition def ) var kName = m.Groups[1].Value; var num = m.Groups[2].Value; - kName = kName.Replace( "k_i", "CallbackIdentifiers." ).Replace( "Callbacks", "" ); + //kName = kName.Replace( "k_i", "CallbackIdentifiers." ).Replace( "Callbacks", "" ); + kName = "CallbackIdentifiers." + kName.Substring( 3 ).Replace( "Callbacks", "" ); t.CallbackId = $"{kName} + {num}"; } @@ -119,6 +120,25 @@ internal void ExtendDefinition( SteamApiDefinition def ) } } + // + // Find missing structs + // + { + var r = new Regex( @"struct ([a-zA-Z]+_t)" ); + var ma = r.Matches( Content ); + + foreach ( Match m in ma ) + { + var s = def.structs.SingleOrDefault( x => x.Name == m.Groups[1].Value ); + if ( s == null ) + { + Console.WriteLine( "Missing Struct: " + m.Groups[1].Value ); + } + } + + //Console.ReadKey(); + } + } } } diff --git a/Generator/CodeWriter/PlatformClass.cs b/Generator/CodeWriter/PlatformClass.cs index 2409263..68837b8 100644 --- a/Generator/CodeWriter/PlatformClass.cs +++ b/Generator/CodeWriter/PlatformClass.cs @@ -9,10 +9,12 @@ namespace Generator public partial class CodeWriter { bool LargePack; + bool X86; private void PlatformClass( string type, string libraryName, bool LargePack ) { this.LargePack = LargePack; + X86 = type.EndsWith( "32" ); StartBlock( $"internal static partial class Platform" ); { @@ -187,7 +189,10 @@ private void InteropClassMethod( string library, string classname, SteamApiDefin if ( argstring != "" ) argstring = $" {argstring} "; - Write( $"[DllImportAttribute( \"{library}\" )] " ); + if ( X86 ) + Write( $"[DllImport( \"{library}\", CallingConvention = CallingConvention.Cdecl )] " ); + else + Write( $"[DllImport( \"{library}\" )] " ); if ( ret.Return() == "bool" ) WriteLine( "[return: MarshalAs(UnmanagedType.U1)]" ); diff --git a/Generator/CodeWriter/Struct.cs b/Generator/CodeWriter/Struct.cs index 21e5908..a79ecad 100644 --- a/Generator/CodeWriter/Struct.cs +++ b/Generator/CodeWriter/Struct.cs @@ -37,6 +37,8 @@ public class TypeDef void Structs() { + var callbackList = new List(); + foreach ( var c in def.structs ) { if ( SkipStructs.Contains( c.Name ) ) @@ -47,7 +49,7 @@ void Structs() int defaultPack = 8; - if ( c.Fields.Any( x => x.Type.Contains( "class CSteamID" ) ) && !ForceLargePackStructs.Contains( c.Name ) ) + if ( c.Fields.Any( x => x.Type.Contains( "class CSteamID" ) ) && !ForceLargePackStructs.Contains( c.Name ) ) defaultPack = 4; // @@ -58,7 +60,7 @@ void Structs() { if ( !string.IsNullOrEmpty( c.CallbackId ) ) { - WriteLine( "public const int CallbackId = " + c.CallbackId + ";" ); + WriteLine( "internal const int CallbackId = " + c.CallbackId + ";" ); } // @@ -70,7 +72,7 @@ void Structs() WriteLine( "//" ); WriteLine( "// Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff." ); WriteLine( "//" ); - StartBlock( $"public static {c.Name} FromPointer( IntPtr p )" ); + StartBlock( $"internal static {c.Name} FromPointer( IntPtr p )" ); { WriteLine( $"if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) );" ); @@ -78,6 +80,18 @@ void Structs() } EndBlock(); + WriteLine(); + WriteLine( "//" ); + WriteLine( "// Get the size of the structure we're going to be using." ); + WriteLine( "//" ); + StartBlock( $"internal static int StructSize()" ); + { + WriteLine( $"if ( Platform.PackSmall ) return System.Runtime.InteropServices.Marshal.SizeOf( typeof(PackSmall) );" ); + + WriteLine( $"return System.Runtime.InteropServices.Marshal.SizeOf( typeof({c.Name}) );" ); + } + EndBlock(); + if ( defaultPack == 8 ) defaultPack = 4; @@ -121,12 +135,24 @@ void Structs() if ( !string.IsNullOrEmpty( c.CallbackId ) ) { Callback( c ); + callbackList.Add( c ); } } EndBlock(); WriteLine(); } + + StartBlock( $"internal static class Callbacks" ); + StartBlock( $"internal static void RegisterCallbacks( Facepunch.Steamworks.BaseSteamworks steamworks )" ); + { + foreach ( var c in callbackList ) + { + WriteLine( $"{c.Name}.Register( steamworks );" ); + } + } + EndBlock(); + EndBlock(); } private void StructFields( SteamApiDefinition.StructDef.StructFields[] fields ) @@ -199,20 +225,19 @@ private void StructFields( SteamApiDefinition.StructDef.StructFields[] fields ) WriteLine($"[MarshalAs(UnmanagedType.ByValArray, SizeConst = {num}, ArraySubType = UnmanagedType.U4)]"); } - WriteLine( $"public {t} {CleanMemberName( m.Name )}; // {m.Name} {m.Type}" ); + WriteLine( $"internal {t} {CleanMemberName( m.Name )}; // {m.Name} {m.Type}" ); } } private void Callback( SteamApiDefinition.StructDef c ) - { + { WriteLine(); - StartBlock( $"public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamworks, Action<{c.Name}, bool> CallbackFunction )" ); + StartBlock( $"internal static void Register( Facepunch.Steamworks.BaseSteamworks steamworks )" ); { - WriteLine( $"var handle = new CallbackHandle();" ); - WriteLine( $"handle.steamworks = steamworks;" ); + WriteLine( $"var handle = new CallbackHandle( steamworks );" ); WriteLine( $"" ); - CallbackCallresultShared( c, false ); + CallbackCall( c ); WriteLine( "" ); WriteLine( "//" ); @@ -224,36 +249,57 @@ private void Callback( SteamApiDefinition.StructDef c ) WriteLine( "steamworks.RegisterCallbackHandle( handle );" ); } EndBlock(); + + WriteLine(); + WriteLine( "[MonoPInvokeCallback]" ); + WriteLine( "internal static void OnResultThis( IntPtr self, IntPtr param ){ OnResult( param ); }" ); + WriteLine( "[MonoPInvokeCallback]" ); + WriteLine( "internal static void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ){ OnResultWithInfo( param, failure, call ); }" ); + WriteLine( "[MonoPInvokeCallback]" ); + WriteLine( "internal static int OnGetSizeThis( IntPtr self ){ return OnGetSize(); }" ); + WriteLine( "[MonoPInvokeCallback]" ); + WriteLine( "internal static int OnGetSize(){ return StructSize(); }" ); + + WriteLine(); + WriteLine( "[MonoPInvokeCallback]" ); + StartBlock( "internal static void OnResult( IntPtr param )" ); + { + WriteLine( $"OnResultWithInfo( param, false, 0 );" ); + } + EndBlock(); + + WriteLine(); + WriteLine( "[MonoPInvokeCallback]" ); + StartBlock( "internal static void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call )" ); + { + WriteLine( $"if ( failure ) return;" ); + WriteLine(); + WriteLine( "var value = FromPointer( param );" ); + + WriteLine(); + WriteLine( "if ( Facepunch.Steamworks.Client.Instance != null )" ); + WriteLine( $" Facepunch.Steamworks.Client.Instance.OnCallback<{c.Name}>( value );" ); + + WriteLine(); + WriteLine( "if ( Facepunch.Steamworks.Server.Instance != null )" ); + WriteLine( $" Facepunch.Steamworks.Server.Instance.OnCallback<{c.Name}>( value );" ); + } + EndBlock(); } private void CallResult( SteamApiDefinition.StructDef c ) { WriteLine(); - StartBlock( $"public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action<{c.Name}, bool> CallbackFunction )" ); + StartBlock( $"internal static CallResult<{c.Name}> CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action<{c.Name}, bool> CallbackFunction )" ); { - WriteLine( $"var handle = new CallbackHandle();" ); - WriteLine( $"handle.steamworks = steamworks;" ); - WriteLine( $"handle.CallResultHandle = call;" ); - WriteLine( $"handle.CallResult = true;" ); - WriteLine( $"" ); - - CallbackCallresultShared( c, true ); - - WriteLine( "" ); - WriteLine( "//" ); - WriteLine( "// Register the callback with Steam" ); - WriteLine( "//" ); - WriteLine( $"steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call );" ); - - WriteLine(); - WriteLine( "return handle;" ); + WriteLine( $"return new CallResult<{c.Name}>( steamworks, call, CallbackFunction, FromPointer, StructSize(), CallbackId );" ); } EndBlock(); } - private void CallbackCallresultShared( SteamApiDefinition.StructDef c, bool Result ) + private void CallbackCall( SteamApiDefinition.StructDef c ) { WriteLine( "//" ); WriteLine( "// Create the functions we need for the vtable" ); @@ -261,11 +307,11 @@ private void CallbackCallresultShared( SteamApiDefinition.StructDef c, bool Resu StartBlock( "if ( Facepunch.Steamworks.Config.UseThisCall )" ); { - CallresultFunctions( c, Result, "ThisCall", "_" ); + CallFunctions( c, "ThisCall", "_" ); } Else(); { - CallresultFunctions( c, Result, "StdCall", "" ); + CallFunctions( c, "StdCall", "" ); } EndBlock(); @@ -285,73 +331,51 @@ private void CallbackCallresultShared( SteamApiDefinition.StructDef c, bool Resu WriteLine( $"handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned );" ); } - private void CallresultFunctions( SteamApiDefinition.StructDef c, bool Result, string ThisCall, string ThisArg ) + private void CallFunctions( SteamApiDefinition.StructDef c, string ThisCall, string ThisArg ) { var ThisArgC = ThisArg.Length > 0 ? $"{ThisArg}, " : ""; - - if ( Result ) - { - WriteLine( $"Callback.{ThisCall}.Result funcA = ( {ThisArgC}p ) => {{ handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }};" ); - StartBlock( $"Callback.{ThisCall}.ResultWithInfo funcB = ( {ThisArgC}p, bIOFailure, hSteamAPICall ) => " ); - { - WriteLine( "if ( hSteamAPICall != call ) return;" ); - WriteLine(); - WriteLine( "handle.CallResultHandle = 0;" ); - WriteLine( "handle.Dispose();" ); - WriteLine(); - WriteLine( "CallbackFunction( FromPointer( p ), bIOFailure );" ); - } - EndBlock( ";" ); - } - else - { - WriteLine( $"Callback.{ThisCall}.Result funcA = ( {ThisArgC}p ) => {{ CallbackFunction( FromPointer( p ), false ); }};" ); - WriteLine( $"Callback.{ThisCall}.ResultWithInfo funcB = ( {ThisArgC}p, bIOFailure, hSteamAPICall ) => {{ CallbackFunction( FromPointer( p ), bIOFailure ); }};" ); - } - - WriteLine( $"Callback.{ThisCall}.GetSize funcC = ( {ThisArg} ) => Marshal.SizeOf( typeof( {c.Name} ) );" ); - WriteLine(); - WriteLine( "//" ); - WriteLine( "// If this platform is PackSmall, use PackSmall versions of everything instead" ); - WriteLine( "//" ); - StartBlock( "if ( Platform.PackSmall )" ); - { - WriteLine( $"funcC = ( {ThisArg} ) => Marshal.SizeOf( typeof( PackSmall ) );" ); - } - EndBlock(); - - WriteLine( "" ); - WriteLine( "//" ); - WriteLine( "// Allocate a handle to each function, so they don't get disposed" ); - WriteLine( "//" ); - WriteLine( "handle.FuncA = GCHandle.Alloc( funcA );" ); - WriteLine( "handle.FuncB = GCHandle.Alloc( funcB );" ); - WriteLine( "handle.FuncC = GCHandle.Alloc( funcC );" ); - WriteLine(); + var This = ThisArg.Length > 0 ? "This" : ""; WriteLine( "//" ); WriteLine( "// Create the VTable by manually allocating the memory and copying across" ); WriteLine( "//" ); - WriteLine( "handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) );" ); - StartBlock( "var vTable = new Callback.VTable()" ); - { - WriteLine( "ResultA = Marshal.GetFunctionPointerForDelegate( funcA )," ); - WriteLine( "ResultB = Marshal.GetFunctionPointerForDelegate( funcB )," ); - WriteLine( "GetSize = Marshal.GetFunctionPointerForDelegate( funcC )," ); - } - EndBlock( ";" ); - - WriteLine( "//" ); - WriteLine( "// The order of these functions are swapped on Windows" ); - WriteLine( "//" ); StartBlock( "if ( Platform.IsWindows )" ); { - WriteLine( "vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB );" ); - WriteLine( "vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA );" ); + WriteLine( $"handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin{This} ) ) );" ); + StartBlock( $"var vTable = new Callback.VTableWin{This}" ); + { + WriteLine( $"ResultA = OnResult{This}," ); + WriteLine( $"ResultB = OnResultWithInfo{This}," ); + WriteLine( $"GetSize = OnGetSize{This}," ); + } + EndBlock( ";" ); + + WriteLine( "handle.FuncA = GCHandle.Alloc( vTable.ResultA );" ); + WriteLine( "handle.FuncB = GCHandle.Alloc( vTable.ResultB );" ); + WriteLine( "handle.FuncC = GCHandle.Alloc( vTable.GetSize );" ); + + WriteLine( "Marshal.StructureToPtr( vTable, handle.vTablePtr, false );" ); + } + Else(); + { + WriteLine( $"handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable{This} ) ) );" ); + StartBlock( $"var vTable = new Callback.VTable{This}" ); + { + WriteLine( $"ResultA = OnResult{This}," ); + WriteLine( $"ResultB = OnResultWithInfo{This}," ); + WriteLine( $"GetSize = OnGetSize{This}," ); + } + EndBlock( ";" ); + + WriteLine( "handle.FuncA = GCHandle.Alloc( vTable.ResultA );" ); + WriteLine( "handle.FuncB = GCHandle.Alloc( vTable.ResultB );" ); + WriteLine( "handle.FuncC = GCHandle.Alloc( vTable.GetSize );" ); + + WriteLine( "Marshal.StructureToPtr( vTable, handle.vTablePtr, false );" ); } EndBlock(); - WriteLine( "Marshal.StructureToPtr( vTable, handle.vTablePtr, false );" ); + } } } diff --git a/Generator/Program.cs b/Generator/Program.cs index 06e5d19..47512fb 100644 --- a/Generator/Program.cs +++ b/Generator/Program.cs @@ -32,6 +32,11 @@ private static void AddMissing( SteamApiDefinition output ) output.structs.AddRange( missing.structs ); output.methods.AddRange( missing.methods ); + + foreach ( var s in output.structs ) + { + if ( s.Fields == null ) s.Fields = new SteamApiDefinition.StructDef.StructFields[0]; + } } } } diff --git a/Generator/steam_api_missing.json b/Generator/steam_api_missing.json index 3a6a43e..642d738 100644 --- a/Generator/steam_api_missing.json +++ b/Generator/steam_api_missing.json @@ -1,229 +1,281 @@ { - structs: - [ - { - struct: "ItemInstalled_t", - fields: - [ - { - fieldname: "m_unAppID", - fieldtype: "AppId_t" - }, - { - fieldname: "m_nPublishedFileId", - fieldtype: "PublishedFileId_t" - } - ] - } - ], - - methods: - [ - { - classname: "SteamApi", - methodname: "SteamAPI_Init", - returntype: "bool", - NeedsSelfPointer: false - }, - - { - classname: "SteamApi", - methodname: "SteamAPI_RunCallbacks", - returntype: "void", - NeedsSelfPointer: false - }, - - - { - classname: "SteamApi", - methodname: "SteamGameServer_RunCallbacks", - returntype: "void", - NeedsSelfPointer: false - }, - - - { - classname: "SteamApi", - methodname: "SteamAPI_RegisterCallback", - returntype: "void", - NeedsSelfPointer: false, - params: - [ - { - paramname: "pCallback", - paramtype: "void *" - }, - - { - paramname: "callback", - paramtype: "int" - }, - ] - }, - - - { - classname: "SteamApi", - methodname: "SteamAPI_UnregisterCallback", - returntype: "void", - NeedsSelfPointer: false, - params: - [ - { - paramname: "pCallback", - paramtype: "void *" - } - ] - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamAPI_RegisterCallResult", - returntype: "void", - params: - [ - { - paramname: "pCallback", - paramtype: "void *" - }, - { - paramname: "callback", - paramtype: "SteamAPICall_t" - } - ], - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamAPI_UnregisterCallResult", - returntype: "void", - params: - [ - { - paramname: "pCallback", - paramtype: "void *" - }, - { - paramname: "callback", - paramtype: "SteamAPICall_t" - } - ] - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamInternal_GameServer_Init", - returntype: "bool", - params: - [ - { - paramname: "unIP", - paramtype: "uint32" - }, - { - paramname: "usPort", - paramtype: "uint16" - }, - { - paramname: "usGamePort", - paramtype: "uint16" - }, - { - paramname: "usQueryPort", - paramtype: "uint16" - }, - { - paramname: "eServerMode", - paramtype: "int" - }, - { - paramname: "pchVersionString", - paramtype: "const char *" - } - ], - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamAPI_Shutdown", - returntype: "void", - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamGameServer_Shutdown", - returntype: "void", - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamAPI_GetHSteamUser", - returntype: "HSteamUser", - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamAPI_GetHSteamPipe", - returntype: "HSteamPipe", - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamGameServer_GetHSteamUser", - returntype: "HSteamUser", - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamGameServer_GetHSteamPipe", - returntype: "HSteamPipe", - }, - - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamInternal_CreateInterface", - returntype: "void *", - params: - [ - { - paramname: "version", - paramtype: "const char *" - } - ], - }, - - { - NeedsSelfPointer: false, - classname: "SteamApi", - methodname: "SteamAPI_RestartAppIfNecessary", - returntype: "bool", - params: - [ - { - paramname: "unOwnAppID", - paramtype: "uint32" - } - ], - }, - ] + "structs": + [ + { + "struct": "ItemInstalled_t", + "fields": + [ + { + "fieldname": "m_unAppID", + "fieldtype": "AppId_t" + }, + { + "fieldname": "m_nPublishedFileId", + "fieldtype": "PublishedFileId_t" + } + ] + }, + + + { + "struct": "SteamInventoryDefinitionUpdate_t" + }, + + { + "struct": "SteamParentalSettingsChanged_t" + }, + + { + "struct": "SteamServersConnected_t" + }, + { + "struct": "NewLaunchQueryParameters_t" + }, + + { + "struct": "GCMessageAvailable_t", + "fields": + [ + { + "fieldname": "m_nMessageSize", + "fieldtype": "uint32" + } + ] + }, + { + "struct": "GCMessageFailed_t" + }, + { + "struct": "ScreenshotRequested_t" + }, + { + "struct": "LicensesUpdated_t" + }, + { + "struct": "SteamShutdown_t" + }, + { + "struct": "IPCountry_t" + }, + { + "struct": "IPCFailure_t", + "fields": + [ + { + "fieldname": "m_eFailureType", + "fieldtype": "uint8" + } + ] + } + ], + + "methods": + [ + { + "classname": "SteamApi", + "methodname": "SteamAPI_Init", + "returntype": "bool", + "NeedsSelfPointer": false + }, + + { + "classname": "SteamApi", + "methodname": "SteamAPI_RunCallbacks", + "returntype": "void", + "NeedsSelfPointer": false + }, + + + { + "classname": "SteamApi", + "methodname": "SteamGameServer_RunCallbacks", + "returntype": "void", + "NeedsSelfPointer": false + }, + + + { + "classname": "SteamApi", + "methodname": "SteamAPI_RegisterCallback", + "returntype": "void", + "NeedsSelfPointer": false, + "params": + [ + { + "paramname": "pCallback", + "paramtype": "void *" + }, + + { + "paramname": "callback", + "paramtype": "int" + } + ] + }, + + + { + "classname": "SteamApi", + "methodname": "SteamAPI_UnregisterCallback", + "returntype": "void", + "NeedsSelfPointer": false, + "params": + [ + { + "paramname": "pCallback", + "paramtype": "void *" + } + ] + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamAPI_RegisterCallResult", + "returntype": "void", + "params": + [ + { + "paramname": "pCallback", + "paramtype": "void *" + }, + { + "paramname": "callback", + "paramtype": "SteamAPICall_t" + } + ] + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamAPI_UnregisterCallResult", + "returntype": "void", + "params": + [ + { + "paramname": "pCallback", + "paramtype": "void *" + }, + { + "paramname": "callback", + "paramtype": "SteamAPICall_t" + } + ] + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamInternal_GameServer_Init", + "returntype": "bool", + "params": + [ + { + "paramname": "unIP", + "paramtype": "uint32" + }, + { + "paramname": "usPort", + "paramtype": "uint16" + }, + { + "paramname": "usGamePort", + "paramtype": "uint16" + }, + { + "paramname": "usQueryPort", + "paramtype": "uint16" + }, + { + "paramname": "eServerMode", + "paramtype": "int" + }, + { + "paramname": "pchVersionString", + "paramtype": "const char *" + } + ] + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamAPI_Shutdown", + "returntype": "void" + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamGameServer_Shutdown", + "returntype": "void" + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamAPI_GetHSteamUser", + "returntype": "HSteamUser" + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamAPI_GetHSteamPipe", + "returntype": "HSteamPipe" + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamGameServer_GetHSteamUser", + "returntype": "HSteamUser" + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamGameServer_GetHSteamPipe", + "returntype": "HSteamPipe" + }, + + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamInternal_CreateInterface", + "returntype": "void *", + "params": + [ + { + "paramname": "version", + "paramtype": "const char *" + } + ] + }, + + { + "NeedsSelfPointer": false, + "classname": "SteamApi", + "methodname": "SteamAPI_RestartAppIfNecessary", + "returntype": "bool", + "params": + [ + { + "paramname": "unOwnAppID", + "paramtype": "uint32" + } + ] + } + ] } \ No newline at end of file