From e8dd99f6ed662472a5204484b4709217b2e0ad4b Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 12 Feb 2020 16:25:25 +0000 Subject: [PATCH] Manual create SteamNetworkingErrMsg --- Facepunch.Steamworks/Structs/SteamNetworkingErrMsg.cs | 11 +++++++++++ Generator/Cleanup.cs | 2 +- Generator/CodeWriter/Types.cs | 10 +++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Facepunch.Steamworks/Structs/SteamNetworkingErrMsg.cs diff --git a/Facepunch.Steamworks/Structs/SteamNetworkingErrMsg.cs b/Facepunch.Steamworks/Structs/SteamNetworkingErrMsg.cs new file mode 100644 index 0000000..692528d --- /dev/null +++ b/Facepunch.Steamworks/Structs/SteamNetworkingErrMsg.cs @@ -0,0 +1,11 @@ + +using Steamworks.Data; + +namespace Steamworks.Data +{ + + internal unsafe struct SteamNetworkingErrMsg + { + public fixed char Value[1024]; + } +} \ No newline at end of file diff --git a/Generator/Cleanup.cs b/Generator/Cleanup.cs index affc61e..ac90e57 100644 --- a/Generator/Cleanup.cs +++ b/Generator/Cleanup.cs @@ -69,7 +69,6 @@ public static class Cleanup if ( type == "MatchMakingKeyValuePair" ) return false; if ( type == "Connection" ) return false; if ( type == "Socket" ) return false; - if ( type == "SteamNetworkingErrMsg" ) return false; if ( type == "SteamNetworkingMicroseconds" ) return false; if ( type == "FSteamNetworkingSocketsDebugOutput" ) return false; if ( type == "NetMsg" ) return false; @@ -79,6 +78,7 @@ public static class Cleanup if ( type == "NetAddress" ) return false; if ( type == "NetIdentity" ) return false; if ( type == "SteamNetworkingQuickConnectionStatus" ) return false; + if ( type == "SteamNetworkingErrMsg" ) return false; return true; } diff --git a/Generator/CodeWriter/Types.cs b/Generator/CodeWriter/Types.cs index f9319d5..9b8123f 100644 --- a/Generator/CodeWriter/Types.cs +++ b/Generator/CodeWriter/Types.cs @@ -54,7 +54,15 @@ namespace Generator StartBlock( $"{Cleanup.Expose( typeName )} struct {typeName} : IEquatable<{typeName}>, IComparable<{typeName}>" ); { WriteLine( $"// Name: {o.Name}, Type: {o.Type}" ); - WriteLine( $"public {ToManagedType( o.Type )} Value;" ); + + if ( o.Type == "char [1024]" ) + { + WriteLine( $"public fixed char[1024] Value;" ); + } + else + { + WriteLine( $"public {ToManagedType( o.Type )} Value;" ); + } WriteLine(); WriteLine( $"public static implicit operator {typeName}( {ToManagedType( o.Type )} value ) => new {typeName}(){{ Value = value }};" ); WriteLine( $"public static implicit operator {ToManagedType( o.Type )}( {typeName} value ) => value.Value;" );