diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs index 5843a20..1de4aaa 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs @@ -152,11 +152,11 @@ namespace Steamworks #region FunctionMeta [UnmanagedFunctionPointer( CallingConvention.ThisCall )] [return: MarshalAs( UnmanagedType.I1 )] - private delegate bool FSerializeResult( IntPtr self, SteamInventoryResult_t resultHandle, [In,Out] IntPtr[] pOutBuffer, ref uint punOutBufferSize ); + private delegate bool FSerializeResult( IntPtr self, SteamInventoryResult_t resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize ); private FSerializeResult _SerializeResult; #endregion - internal bool SerializeResult( SteamInventoryResult_t resultHandle, [In,Out] IntPtr[] pOutBuffer, ref uint punOutBufferSize ) + internal bool SerializeResult( SteamInventoryResult_t resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize ) { return _SerializeResult( Self, resultHandle, pOutBuffer, ref punOutBufferSize ); } diff --git a/Facepunch.Steamworks/Structs/InventoryResult.cs b/Facepunch.Steamworks/Structs/InventoryResult.cs index 94a90cd..9b804af 100644 --- a/Facepunch.Steamworks/Structs/InventoryResult.cs +++ b/Facepunch.Steamworks/Structs/InventoryResult.cs @@ -70,5 +70,33 @@ namespace Steamworks { SteamInventory.Internal.DestroyResult( _id ); } + + /// + /// Serialized result sets contain a short signature which can't be forged or replayed across different game sessions. + /// A result set can be serialized on the local client, transmitted to other players via your game networking, and + /// deserialized by the remote players.This is a secure way of preventing hackers from lying about posessing + /// rare/high-value items. Serializes a result set with signature bytes to an output buffer.The size of a serialized + /// result depends on the number items which are being serialized.When securely transmitting items to other players, + /// it is recommended to use GetItemsByID first to create a minimal result set. + /// Results have a built-in timestamp which will be considered "expired" after an hour has elapsed.See DeserializeResult + /// for expiration handling. + /// + public unsafe byte[] Serialize() + { + uint size = 0; + + if ( !SteamInventory.Internal.SerializeResult( _id, IntPtr.Zero, ref size ) ) + return null; + + var data = new byte[size]; + + fixed ( byte* ptr = data ) + { + if ( !SteamInventory.Internal.SerializeResult( _id, (IntPtr)ptr, ref size ) ) + return null; + } + + return data; + } } } \ No newline at end of file diff --git a/Generator/CodeWriter/Types/BaseType.cs b/Generator/CodeWriter/Types/BaseType.cs index eda7cfc..805981a 100644 --- a/Generator/CodeWriter/Types/BaseType.cs +++ b/Generator/CodeWriter/Types/BaseType.cs @@ -61,6 +61,7 @@ internal class BaseType get { if ( VarName == "pOut" ) return false; + if ( VarName == "pOutBuffer" ) return false; if ( VarName == "pubRGB" ) return false; if ( VarName == "psteamIDClans" ) return true;