diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs index f459303..5268aee 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs @@ -190,7 +190,7 @@ namespace SteamNative GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SearchForGameSolo( int /*int*/ nPlayerMin, int /*int*/ nPlayerMax ); GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_AcceptGame(); GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_DeclineGame(); - GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); + GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_EndGameSearch(); GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SetGameHostParams( string /*const char **/ pchKey, string /*const char **/ pchValue ); GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SetConnectionDetails( string /*const char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs index c34cd87..42afc5a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs @@ -1397,7 +1397,7 @@ namespace SteamNative return Native.SteamAPI_ISteamGameSearch_DeclineGame(_ptr); } - public virtual GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ) + public virtual GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamGameSearch _ptr is null!" ); @@ -4952,7 +4952,7 @@ namespace SteamNative [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SearchForGameSolo( IntPtr ISteamGameSearch, int /*int*/ nPlayerMin, int /*int*/ nPlayerMax ); [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_AcceptGame( IntPtr ISteamGameSearch ); [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_DeclineGame( IntPtr ISteamGameSearch ); - [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_RetrieveConnectionDetails( IntPtr ISteamGameSearch, ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); + [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_RetrieveConnectionDetails( IntPtr ISteamGameSearch, ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_EndGameSearch( IntPtr ISteamGameSearch ); [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SetGameHostParams( IntPtr ISteamGameSearch, string /*const char **/ pchKey, string /*const char **/ pchValue ); [DllImport( "libsteam_api64.so" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SetConnectionDetails( IntPtr ISteamGameSearch, string /*const char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs index 3223797..2eb7a4a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs @@ -1397,7 +1397,7 @@ namespace SteamNative return Native.SteamAPI_ISteamGameSearch_DeclineGame(_ptr); } - public virtual GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ) + public virtual GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamGameSearch _ptr is null!" ); @@ -4952,7 +4952,7 @@ namespace SteamNative [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SearchForGameSolo( IntPtr ISteamGameSearch, int /*int*/ nPlayerMin, int /*int*/ nPlayerMax ); [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_AcceptGame( IntPtr ISteamGameSearch ); [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_DeclineGame( IntPtr ISteamGameSearch ); - [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_RetrieveConnectionDetails( IntPtr ISteamGameSearch, ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); + [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_RetrieveConnectionDetails( IntPtr ISteamGameSearch, ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_EndGameSearch( IntPtr ISteamGameSearch ); [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SetGameHostParams( IntPtr ISteamGameSearch, string /*const char **/ pchKey, string /*const char **/ pchValue ); [DllImport( "libsteam_api.dylib" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SetConnectionDetails( IntPtr ISteamGameSearch, string /*const char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs index f35cbd5..a93659a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs @@ -1394,7 +1394,7 @@ namespace SteamNative return Native.SteamAPI_ISteamGameSearch_DeclineGame(_ptr); } - public virtual GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ) + public virtual GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamGameSearch _ptr is null!" ); @@ -4909,7 +4909,7 @@ namespace SteamNative [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SearchForGameSolo( IntPtr ISteamGameSearch, int /*int*/ nPlayerMin, int /*int*/ nPlayerMax ); [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_AcceptGame( IntPtr ISteamGameSearch ); [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_DeclineGame( IntPtr ISteamGameSearch ); - [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_RetrieveConnectionDetails( IntPtr ISteamGameSearch, ulong steamIDHost, IntPtr /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); + [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_RetrieveConnectionDetails( IntPtr ISteamGameSearch, ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_EndGameSearch( IntPtr ISteamGameSearch ); [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SetGameHostParams( IntPtr ISteamGameSearch, string /*const char **/ pchKey, string /*const char **/ pchValue ); [DllImport( "steam_api64.dll" )] internal static extern GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ SteamAPI_ISteamGameSearch_SetConnectionDetails( IntPtr ISteamGameSearch, string /*const char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails ); diff --git a/Generator/Argument.cs b/Generator/Argument.cs index ba69fd0..db672d3 100644 --- a/Generator/Argument.cs +++ b/Generator/Argument.cs @@ -233,7 +233,12 @@ namespace Generator } } - if ( ShouldBeIntPtr ) + if ( NativeType == "char *" || NativeType == "char **" ) + { + return $"System.Text.StringBuilder /*{NativeType}*/ {Name}".Trim(); + } + + if ( ShouldBeIntPtr ) return $"IntPtr /*{NativeType}*/ {Name}".Trim(); if ( IsStructShouldBePassedAsRef ) @@ -245,10 +250,7 @@ namespace Generator if ( ShouldBePassedAsOut ) return $"{marshalling} out {ManagedType.Trim( '*', ' ' )} /*{NativeType}*/ {Name}".Trim(); - if ( NativeType == "char *" || NativeType == "char **" ) - { - return $"System.Text.StringBuilder /*{NativeType}*/ {Name}".Trim(); - } + if ( TypeDef != null ) { diff --git a/Generator/CodeWriter/Class.cs b/Generator/CodeWriter/Class.cs index 6616268..1077a63 100644 --- a/Generator/CodeWriter/Class.cs +++ b/Generator/CodeWriter/Class.cs @@ -348,8 +348,8 @@ namespace Generator var chr = argList[i]; var num = argList[i+1]; - var IntReturn = ReturnType.Contains( "int" ); var intReturn = ReturnType.Contains( "int" ); + var enumReturn = ReturnType.EndsWith( "_t" ); if ( num.ManagedType.Trim( '*' ) != "int" && num.ManagedType.Trim( '*' ) != "uint" ) continue;