diff --git a/Facepunch.Steamworks.Test/Client/RemoteStorage.cs b/Facepunch.Steamworks.Test/Client/RemoteStorage.cs index 67bdb15..4876a8c 100644 --- a/Facepunch.Steamworks.Test/Client/RemoteStorage.cs +++ b/Facepunch.Steamworks.Test/Client/RemoteStorage.cs @@ -14,8 +14,8 @@ public void GetQuota() { using ( var client = new Steamworks.Client( 252490 ) ) { - ulong total, available; - client.RemoteStorage.GetQuota( out total, out available ); + ulong total = client.RemoteStorage.QuotaTotal; + var available = client.RemoteStorage.QuotaRemaining; Console.WriteLine( $"Total quota: {total} bytes" ); Console.WriteLine( $"Available: {available} bytes" ); diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index c541c3c..e0f323a 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -60,6 +60,7 @@ public partial class Client : BaseSteamworks public Stats Stats { get; private set; } public MicroTransactions MicroTransactions { get; private set; } public User User { get; private set; } + public RemoteStorage RemoteStorage { get; private set; } public Client( uint appId ) { @@ -91,6 +92,7 @@ public Client( uint appId ) Achievements = new Achievements( this ); MicroTransactions = new MicroTransactions( this ); User = new User( this ); + RemoteStorage = new RemoteStorage( this ); Workshop.friends = Friends; @@ -186,6 +188,12 @@ public override void Dispose() User = null; } + if ( RemoteStorage != null ) + { + RemoteStorage.Dispose(); + RemoteStorage = null; + } + if ( Instance == this ) { Instance = null; diff --git a/Facepunch.Steamworks/Client/RemoteStorage.File.cs b/Facepunch.Steamworks/Client/RemoteStorage.File.cs new file mode 100644 index 0000000..b88695b --- /dev/null +++ b/Facepunch.Steamworks/Client/RemoteStorage.File.cs @@ -0,0 +1,287 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using SteamNative; + +namespace Facepunch.Steamworks +{ + /// + /// Represents a file stored in a user's Steam Cloud. + /// + public class RemoteFile + { + internal readonly RemoteStorage remoteStorage; + + private readonly bool _isUgc; + private string _fileName; + private int _sizeInBytes = -1; + private UGCHandle_t _handle; + private ulong _ownerId; + + private bool _isDownloading; + private byte[] _downloadedData; + + /// + /// Check if the file exists. + /// + public bool Exists { get; internal set; } + + public bool IsDownloading { get { return _isUgc && _isDownloading && _downloadedData == null; } } + + public bool IsDownloaded { get { return !_isUgc || _downloadedData != null; } } + + /// + /// If true, the file is available for other users to download. + /// + public bool IsShared { get { return _handle.Value != 0; } } + + internal UGCHandle_t UGCHandle { get { return _handle; } } + + public ulong SharingId { get { return UGCHandle.Value; } } + + /// + /// Name and path of the file. + /// + public string FileName + { + get + { + if ( _fileName != null ) return _fileName; + GetUGCDetails(); + return _fileName; + } + } + + /// + /// Steam ID of the file's owner. + /// + public ulong OwnerId + { + get + { + if ( _ownerId != 0 ) return _ownerId; + GetUGCDetails(); + return _ownerId; + } + } + + /// + /// Total size of the file in bytes. + /// + public int SizeInBytes + { + get + { + if ( _sizeInBytes != -1 ) return _sizeInBytes; + if ( _isUgc ) throw new NotImplementedException(); + _sizeInBytes = remoteStorage.native.GetFileSize( FileName ); + return _sizeInBytes; + } + internal set { _sizeInBytes = value; } + } + + internal RemoteFile( RemoteStorage r, UGCHandle_t handle ) + { + Exists = true; + + remoteStorage = r; + + _isUgc = true; + _handle = handle; + } + + internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInBytes = -1 ) + { + remoteStorage = r; + + _isUgc = false; + _fileName = name; + _ownerId = ownerId; + _sizeInBytes = sizeInBytes; + } + + /// + /// Creates a used to write to this file. + /// + public RemoteFileWriteStream OpenWrite() + { + return new RemoteFileWriteStream( remoteStorage, this ); + } + + /// + /// Write a byte array to this file, replacing any existing contents. + /// + public void WriteAllBytes( byte[] buffer ) + { + using ( var stream = OpenWrite() ) + { + stream.Write( buffer, 0, buffer.Length ); + } + } + + /// + /// Write a string to this file, replacing any existing contents. + /// + public void WriteAllText( string text, Encoding encoding = null ) + { + if ( encoding == null ) encoding = Encoding.UTF8; + WriteAllBytes( encoding.GetBytes( text ) ); + } + + /// + /// Callback invoked by when a file download is complete. + /// + public delegate void DownloadCallback( bool success ); + + /// + /// Gets the number of bytes downloaded and the total number of bytes expected while + /// this file is downloading. + /// + /// True if the file is downloading + public bool GetDownloadProgress( out int bytesDownloaded, out int bytesExpected ) + { + return remoteStorage.native.GetUGCDownloadProgress( _handle, out bytesDownloaded, out bytesExpected ); + } + + /// + /// Attempts to start downloading a shared file. + /// + /// True if the download has successfully started + public bool Download( DownloadCallback callback = null ) + { + if ( !_isUgc ) return false; + if ( _isDownloading ) return false; + if ( IsDownloaded ) return false; + + _isDownloading = true; + + remoteStorage.native.UGCDownload( _handle, 1000, ( result, error ) => + { + _isDownloading = false; + + if ( error || result.Result != Result.OK ) + { + callback?.Invoke( false ); + return; + } + + _ownerId = result.SteamIDOwner; + _sizeInBytes = result.SizeInBytes; + _fileName = result.PchFileName; + + unsafe + { + _downloadedData = new byte[_sizeInBytes]; + fixed ( byte* bufferPtr = _downloadedData ) + { + remoteStorage.native.UGCRead( _handle, (IntPtr) bufferPtr, _sizeInBytes, 0, UGCReadAction.ontinueReading ); + } + } + + callback?.Invoke( true ); + } ); + + return true; + } + + /// + /// Opens a stream used to read from this file. + /// + /// + public Stream OpenRead() + { + return new MemoryStream( ReadAllBytes(), false ); + } + + /// + /// Reads the entire contents of the file as a byte array. + /// + public unsafe byte[] ReadAllBytes() + { + if ( _isUgc ) + { + if ( !IsDownloaded ) throw new Exception( "Cannot read a file that hasn't been downloaded." ); + return _downloadedData; + } + + var size = SizeInBytes; + var buffer = new byte[size]; + + fixed ( byte* bufferPtr = buffer ) + { + remoteStorage.native.FileRead( FileName, (IntPtr) bufferPtr, size ); + } + + return buffer; + } + + /// + /// Reads the entire contents of the file as a string. + /// + public string ReadAllText( Encoding encoding = null ) + { + if ( encoding == null ) encoding = Encoding.UTF8; + return encoding.GetString( ReadAllBytes() ); + } + + /// + /// Callback invoked by when file sharing is complete. + /// + public delegate void ShareCallback( bool success ); + + /// + /// Attempt to publish this file for other users to download. + /// + /// True if we have started attempting to share + public bool Share( ShareCallback callback = null ) + { + if ( _isUgc ) return false; + + // Already shared + if ( _handle.Value != 0 ) return false; + + remoteStorage.native.FileShare( FileName, ( result, error ) => + { + var success = !error && result.Result == Result.OK; + if ( success ) + { + _handle.Value = result.File; + } + + callback?.Invoke( success ); + } ); + + return true; + } + + /// + /// Delete this file from remote storage. + /// + /// True if the file could be deleted + public bool Delete() + { + if ( !Exists ) return false; + if ( _isUgc ) return false; + if ( !remoteStorage.native.FileDelete( FileName ) ) return false; + + Exists = false; + remoteStorage.InvalidateFiles(); + + return true; + } + + private void GetUGCDetails() + { + if ( !_isUgc ) throw new InvalidOperationException(); + + var appId = new AppId_t { Value = remoteStorage.native.steamworks.AppId }; + + CSteamID ownerId; + remoteStorage.native.GetUGCDetails( _handle, ref appId, out _fileName, out ownerId ); + + _ownerId = ownerId.Value; + } + } +} diff --git a/Facepunch.Steamworks/Client/RemoteStorage.FileStream.cs b/Facepunch.Steamworks/Client/RemoteStorage.FileStream.cs new file mode 100644 index 0000000..ea98e87 --- /dev/null +++ b/Facepunch.Steamworks/Client/RemoteStorage.FileStream.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using SteamNative; + +namespace Facepunch.Steamworks +{ + /// + /// Stream used to write to a . + /// + public class RemoteFileWriteStream : Stream + { + internal readonly RemoteStorage remoteStorage; + + private readonly UGCFileWriteStreamHandle_t _handle; + private readonly RemoteFile _file; + + private int _written; + private bool _closed; + + internal RemoteFileWriteStream( RemoteStorage r, RemoteFile file ) + { + remoteStorage = r; + + _handle = remoteStorage.native.FileWriteStreamOpen( file.FileName ); + _file = file; + } + + public override void Flush() { } + + public override int Read( byte[] buffer, int offset, int count ) + { + throw new NotImplementedException(); + } + + public override long Seek( long offset, SeekOrigin origin ) + { + throw new NotImplementedException(); + } + + public override void SetLength( long value ) + { + throw new NotImplementedException(); + } + + public override unsafe void Write( byte[] buffer, int offset, int count ) + { + if ( _closed ) throw new ObjectDisposedException( ToString() ); + + fixed ( byte* bufferPtr = buffer ) + { + if ( remoteStorage.native.FileWriteStreamWriteChunk( _handle, (IntPtr)(bufferPtr + offset), count ) ) + { + _written += count; + } + } + } + + public override bool CanRead => false; + public override bool CanSeek => false; + public override bool CanWrite => true; + public override long Length => _written; + public override long Position { get { return _written; } set { throw new NotImplementedException(); } } + + /// + /// Close the stream without saving the file to remote storage. + /// + public void Cancel() + { + if ( _closed ) return; + + _closed = true; + remoteStorage.native.FileWriteStreamCancel( _handle ); + } + +#if NETCORE + public void Close() +#else + public override void Close() +#endif + { + if ( _closed ) return; + + _closed = true; + remoteStorage.native.FileWriteStreamClose( _handle ); + + _file.remoteStorage.OnWrittenNewFile( _file ); + } + + protected override void Dispose( bool disposing ) + { + if ( disposing ) Close(); + base.Dispose( disposing ); + } + } +} diff --git a/Facepunch.Steamworks/Client/RemoteStorage.cs b/Facepunch.Steamworks/Client/RemoteStorage.cs index 25168ce..f7fe95f 100644 --- a/Facepunch.Steamworks/Client/RemoteStorage.cs +++ b/Facepunch.Steamworks/Client/RemoteStorage.cs @@ -7,401 +7,18 @@ namespace Facepunch.Steamworks { - partial class Client - { - RemoteStorage _remoteStorage; - - public RemoteStorage RemoteStorage - { - get - { - if ( _remoteStorage == null ) - _remoteStorage = new RemoteStorage( this ); - - return _remoteStorage; - } - } - } - - /// - /// Stream used to write to a . - /// - public class RemoteFileWriteStream : Stream - { - internal readonly RemoteStorage remoteStorage; - - private readonly UGCFileWriteStreamHandle_t _handle; - private readonly RemoteFile _file; - - private int _written; - private bool _closed; - - internal RemoteFileWriteStream( RemoteStorage r, RemoteFile file ) - { - remoteStorage = r; - - _handle = remoteStorage.native.FileWriteStreamOpen( file.FileName ); - _file = file; - } - - public override void Flush() { } - - public override int Read( byte[] buffer, int offset, int count ) - { - throw new NotImplementedException(); - } - - public override long Seek( long offset, SeekOrigin origin ) - { - throw new NotImplementedException(); - } - - public override void SetLength( long value ) - { - throw new NotImplementedException(); - } - - public override unsafe void Write( byte[] buffer, int offset, int count ) - { - if ( _closed ) throw new ObjectDisposedException( ToString() ); - - fixed ( byte* bufferPtr = buffer ) - { - if ( remoteStorage.native.FileWriteStreamWriteChunk( _handle, (IntPtr) (bufferPtr + offset), count ) ) - { - _written += count; - } - } - } - - public override bool CanRead => false; - public override bool CanSeek => false; - public override bool CanWrite => true; - public override long Length => _written; - public override long Position { get { return _written; } set { throw new NotImplementedException(); } } - - /// - /// Close the stream without saving the file to remote storage. - /// - public void Cancel() - { - if ( _closed ) return; - - _closed = true; - remoteStorage.native.FileWriteStreamCancel( _handle ); - } - -#if NETCORE - public void Close() -#else - public override void Close() -#endif - { - if ( _closed ) return; - - _closed = true; - remoteStorage.native.FileWriteStreamClose( _handle ); - - _file.remoteStorage.OnWrittenNewFile( _file ); - } - - protected override void Dispose( bool disposing ) - { - if ( disposing ) Close(); - base.Dispose( disposing ); - } - } - - /// - /// Represents a file stored in a user's Steam Cloud. - /// - public class RemoteFile - { - internal readonly RemoteStorage remoteStorage; - - private readonly bool _isUgc; - private string _fileName; - private int _sizeInBytes = -1; - private UGCHandle_t _handle; - private ulong _ownerId; - - private bool _isDownloading; - private byte[] _downloadedData; - - /// - /// Check if the file exists. - /// - public bool Exists { get; internal set; } - - public bool IsDownloading { get { return _isUgc && _isDownloading && _downloadedData == null; } } - - public bool IsDownloaded { get { return !_isUgc || _downloadedData != null; } } - - /// - /// If true, the file is available for other users to download. - /// - public bool IsShared { get { return _handle.Value != 0; } } - - internal UGCHandle_t UGCHandle { get { return _handle; } } - - public ulong SharingId { get { return UGCHandle.Value; } } - - /// - /// Name and path of the file. - /// - public string FileName - { - get - { - if ( _fileName != null ) return _fileName; - GetUGCDetails(); - return _fileName; - } - } - - /// - /// Steam ID of the file's owner. - /// - public ulong OwnerId - { - get - { - if ( _ownerId != 0 ) return _ownerId; - GetUGCDetails(); - return _ownerId; - } - } - - /// - /// Total size of the file in bytes. - /// - public int SizeInBytes - { - get - { - if ( _sizeInBytes != -1 ) return _sizeInBytes; - if ( _isUgc ) throw new NotImplementedException(); - _sizeInBytes = remoteStorage.native.GetFileSize( FileName ); - return _sizeInBytes; - } - internal set { _sizeInBytes = value; } - } - - internal RemoteFile( RemoteStorage r, UGCHandle_t handle ) - { - Exists = true; - - remoteStorage = r; - - _isUgc = true; - _handle = handle; - } - - internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInBytes = -1 ) - { - remoteStorage = r; - - _isUgc = false; - _fileName = name; - _ownerId = ownerId; - _sizeInBytes = sizeInBytes; - } - - /// - /// Creates a used to write to this file. - /// - public RemoteFileWriteStream OpenWrite() - { - return new RemoteFileWriteStream( remoteStorage, this ); - } - - /// - /// Write a byte array to this file, replacing any existing contents. - /// - public void WriteAllBytes( byte[] buffer ) - { - using ( var stream = OpenWrite() ) - { - stream.Write( buffer, 0, buffer.Length ); - } - } - - /// - /// Write a string to this file, replacing any existing contents. - /// - public void WriteAllText( string text, Encoding encoding = null ) - { - if ( encoding == null ) encoding = Encoding.UTF8; - WriteAllBytes( encoding.GetBytes( text ) ); - } - - /// - /// Callback invoked by when a file download is complete. - /// - public delegate void DownloadCallback( bool success ); - - /// - /// Gets the number of bytes downloaded and the total number of bytes expected while - /// this file is downloading. - /// - /// True if the file is downloading - public bool GetDownloadProgress( out int bytesDownloaded, out int bytesExpected ) - { - return remoteStorage.native.GetUGCDownloadProgress( _handle, out bytesDownloaded, out bytesExpected ); - } - - /// - /// Attempts to start downloading a shared file. - /// - /// True if the download has successfully started - public bool Download( DownloadCallback callback = null ) - { - if ( !_isUgc ) return false; - if ( _isDownloading ) return false; - if ( IsDownloaded ) return false; - - _isDownloading = true; - - remoteStorage.native.UGCDownload( _handle, 1000, ( result, error ) => - { - _isDownloading = false; - - if ( error || result.Result != Result.OK ) - { - callback?.Invoke( false ); - return; - } - - _ownerId = result.SteamIDOwner; - _sizeInBytes = result.SizeInBytes; - _fileName = result.PchFileName; - - unsafe - { - _downloadedData = new byte[_sizeInBytes]; - fixed ( byte* bufferPtr = _downloadedData ) - { - remoteStorage.native.UGCRead( _handle, (IntPtr) bufferPtr, _sizeInBytes, 0, UGCReadAction.ontinueReading ); - } - } - - callback?.Invoke( true ); - } ); - - return true; - } - - /// - /// Opens a stream used to read from this file. - /// - /// - public Stream OpenRead() - { - return new MemoryStream( ReadAllBytes(), false ); - } - - /// - /// Reads the entire contents of the file as a byte array. - /// - public unsafe byte[] ReadAllBytes() - { - if ( _isUgc ) - { - if ( !IsDownloaded ) throw new Exception( "Cannot read a file that hasn't been downloaded." ); - return _downloadedData; - } - - var size = SizeInBytes; - var buffer = new byte[size]; - - fixed ( byte* bufferPtr = buffer ) - { - remoteStorage.native.FileRead( FileName, (IntPtr) bufferPtr, size ); - } - - return buffer; - } - - /// - /// Reads the entire contents of the file as a string. - /// - public string ReadAllText( Encoding encoding = null ) - { - if ( encoding == null ) encoding = Encoding.UTF8; - return encoding.GetString( ReadAllBytes() ); - } - - /// - /// Callback invoked by when file sharing is complete. - /// - public delegate void ShareCallback( bool success ); - - /// - /// Attempt to publish this file for other users to download. - /// - /// True if we have started attempting to share - public bool Share( ShareCallback callback = null ) - { - if ( _isUgc ) return false; - - // Already shared - if ( _handle.Value != 0 ) return false; - - remoteStorage.native.FileShare( FileName, ( result, error ) => - { - var success = !error && result.Result == Result.OK; - if ( success ) - { - _handle.Value = result.File; - } - - callback?.Invoke( success ); - } ); - - return true; - } - - /// - /// Delete this file from remote storage. - /// - /// True if the file could be deleted - public bool Delete() - { - if ( !Exists ) return false; - if ( _isUgc ) return false; - if ( !remoteStorage.native.FileDelete( FileName ) ) return false; - - Exists = false; - remoteStorage.InvalidateFiles(); - - return true; - } - - private void GetUGCDetails() - { - if ( !_isUgc ) throw new InvalidOperationException(); - - var appId = new AppId_t { Value = remoteStorage.native.steamworks.AppId }; - - CSteamID ownerId; - remoteStorage.native.GetUGCDetails( _handle, ref appId, out _fileName, out ownerId ); - - _ownerId = ownerId.Value; - } - } - /// /// Handles Steam Cloud related actions. /// - public class RemoteStorage + public class RemoteStorage : IDisposable { private static string NormalizePath( string path ) { return new FileInfo( $"x:/{path}" ).FullName.Substring( 3 ); } - internal readonly Client client; - internal readonly SteamNative.SteamRemoteStorage native; + internal Client client; + internal SteamNative.SteamRemoteStorage native; private bool _filesInvalid = true; private readonly List _files = new List(); @@ -490,7 +107,7 @@ private void UpdateFiles() for ( var i = 0; i < count; ++i ) { int size; - var name = NormalizePath( GetFileNameAndSize( i, out size ) ); + var name = NormalizePath( native.GetFileNameAndSize( i, out size ) ); var existing = _files.FirstOrDefault( x => x.FileName == name ); if ( existing == null ) @@ -520,24 +137,61 @@ public bool FileExists( string path ) return native.FileExists( path ); } - /// - /// Gets both the total and available remote storage in bytes for this user and app. - /// - /// True if successful - public unsafe bool GetQuota( out ulong totalBytes, out ulong availableBytes ) + public void Dispose() { - fixed ( ulong* totalPtr = &totalBytes) - fixed ( ulong* availablePtr = &availableBytes ) + client = null; + native = null; + } + + /// + /// Number of bytes used out of the user's total quota + /// + public ulong QuotaUsed + { + get { - return native.GetQuota( (IntPtr) totalPtr, (IntPtr) availablePtr ); + ulong totalBytes = 0; + ulong availableBytes = 0; + + if ( !native.GetQuota( out totalBytes, out availableBytes ) ) + return 0; + + return totalBytes - availableBytes; } } - private unsafe string GetFileNameAndSize( int file, out int size ) + /// + /// Total quota size in bytes + /// + public ulong QuotaTotal { - fixed ( int* sizePtr = &size ) + get { - return native.GetFileNameAndSize( file, (IntPtr) sizePtr ); + ulong totalBytes = 0; + ulong availableBytes = 0; + + if ( !native.GetQuota( out totalBytes, out availableBytes ) ) + return 0; + + return totalBytes; + } + } + + + /// + /// Number of bytes remaining out of the user's total quota + /// + public ulong QuotaRemaining + { + get + { + ulong totalBytes = 0; + ulong availableBytes = 0; + + if ( !native.GetQuota( out totalBytes, out availableBytes ) ) + return 0; + + return availableBytes; } } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs index 9fede1d..c08b33b 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs @@ -446,14 +446,14 @@ internal interface Interface : IDisposable long /*int64*/ ISteamRemoteStorage_GetFileTimestamp( string /*const char **/ pchFile ); RemoteStoragePlatform /*ERemoteStoragePlatform*/ ISteamRemoteStorage_GetSyncPlatforms( string /*const char **/ pchFile ); int /*int32*/ ISteamRemoteStorage_GetFileCount(); - IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, IntPtr /*int32 **/ pnFileSizeInBytes ); - bool /*bool*/ ISteamRemoteStorage_GetQuota( IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ); + IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ); + bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ); bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount(); bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForApp(); void /*void*/ ISteamRemoteStorage_SetCloudEnabledForApp( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled ); SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_UGCDownload( ulong hContent, uint /*uint32*/ unPriority ); bool /*bool*/ ISteamRemoteStorage_GetUGCDownloadProgress( ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected ); - bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ); int /*int32*/ ISteamRemoteStorage_GetCachedUGCCount(); UGCHandle_t /*(UGCHandle_t)*/ ISteamRemoteStorage_GetCachedUGCHandle( int /*int32*/ iCachedContent ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs index ea6d279..58d96a6 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs @@ -1439,17 +1439,17 @@ public virtual IntPtr ISteamMatchmaking_GetLobbyMemberData( ulong steamIDLobby, return Native.SteamAPI_ISteamRemoteStorage_GetFileCount(_ptr); } - public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, IntPtr /*int32 **/ pnFileSizeInBytes ) + public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, pnFileSizeInBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, out pnFileSizeInBytes); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, pnTotalBytes, puAvailableBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, out pnTotalBytes, out puAvailableBytes); } public virtual bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount() { @@ -1481,11 +1481,11 @@ public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, return Native.SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(_ptr, hContent, out pnBytesDownloaded, out pnBytesExpected); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, pnFileSizeInBytes, out pSteamIDOwner); + return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, out pnFileSizeInBytes, out pSteamIDOwner); } public virtual int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ) { @@ -4367,14 +4367,14 @@ internal static unsafe class Native [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, IntPtr /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ); + [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, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [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 ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs index 29b65ab..035991a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs @@ -1439,17 +1439,17 @@ public virtual IntPtr ISteamMatchmaking_GetLobbyMemberData( ulong steamIDLobby, return Native.SteamAPI_ISteamRemoteStorage_GetFileCount(_ptr); } - public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, IntPtr /*int32 **/ pnFileSizeInBytes ) + public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, pnFileSizeInBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, out pnFileSizeInBytes); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, pnTotalBytes, puAvailableBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, out pnTotalBytes, out puAvailableBytes); } public virtual bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount() { @@ -1481,11 +1481,11 @@ public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, return Native.SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(_ptr, hContent, out pnBytesDownloaded, out pnBytesExpected); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, pnFileSizeInBytes, out pSteamIDOwner); + return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, out pnFileSizeInBytes, out pSteamIDOwner); } public virtual int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ) { @@ -4367,14 +4367,14 @@ internal static unsafe class Native [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, IntPtr /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ); + [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, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [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 ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs index 378a6d0..79219fc 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs @@ -1439,17 +1439,17 @@ public virtual IntPtr ISteamMatchmaking_GetLobbyMemberData( ulong steamIDLobby, return Native.SteamAPI_ISteamRemoteStorage_GetFileCount(_ptr); } - public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, IntPtr /*int32 **/ pnFileSizeInBytes ) + public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, pnFileSizeInBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, out pnFileSizeInBytes); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, pnTotalBytes, puAvailableBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, out pnTotalBytes, out puAvailableBytes); } public virtual bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount() { @@ -1481,11 +1481,11 @@ public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, return Native.SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(_ptr, hContent, out pnBytesDownloaded, out pnBytesExpected); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, pnFileSizeInBytes, out pSteamIDOwner); + return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, out pnFileSizeInBytes, out pSteamIDOwner); } public virtual int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ) { @@ -4367,14 +4367,14 @@ internal static unsafe class Native [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, IntPtr /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ); + [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, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [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 ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs index 62561b7..019023a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs @@ -1436,17 +1436,17 @@ public virtual IntPtr ISteamMatchmaking_GetLobbyMemberData( ulong steamIDLobby, return Native.SteamAPI_ISteamRemoteStorage_GetFileCount(_ptr); } - public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, IntPtr /*int32 **/ pnFileSizeInBytes ) + public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, pnFileSizeInBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, out pnFileSizeInBytes); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, pnTotalBytes, puAvailableBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, out pnTotalBytes, out puAvailableBytes); } public virtual bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount() { @@ -1478,11 +1478,11 @@ public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, return Native.SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(_ptr, hContent, out pnBytesDownloaded, out pnBytesExpected); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, pnFileSizeInBytes, out pSteamIDOwner); + return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, out pnFileSizeInBytes, out pSteamIDOwner); } public virtual int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ) { @@ -4333,14 +4333,14 @@ internal static unsafe class Native [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, IntPtr /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ); + [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, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [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 ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs index daba970..1f3662b 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs @@ -1436,17 +1436,17 @@ public virtual IntPtr ISteamMatchmaking_GetLobbyMemberData( ulong steamIDLobby, return Native.SteamAPI_ISteamRemoteStorage_GetFileCount(_ptr); } - public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, IntPtr /*int32 **/ pnFileSizeInBytes ) + public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, pnFileSizeInBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(_ptr, iFile, out pnFileSizeInBytes); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, pnTotalBytes, puAvailableBytes); + return Native.SteamAPI_ISteamRemoteStorage_GetQuota(_ptr, out pnTotalBytes, out puAvailableBytes); } public virtual bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount() { @@ -1478,11 +1478,11 @@ public virtual IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, return Native.SteamAPI_ISteamRemoteStorage_GetUGCDownloadProgress(_ptr, hContent, out pnBytesDownloaded, out pnBytesExpected); } - public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) + public virtual bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamRemoteStorage _ptr is null!" ); - return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, pnFileSizeInBytes, out pSteamIDOwner); + return Native.SteamAPI_ISteamRemoteStorage_GetUGCDetails(_ptr, hContent, ref pnAppID, ppchName, out pnFileSizeInBytes, out pSteamIDOwner); } public virtual int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction ) { @@ -4333,14 +4333,14 @@ internal static unsafe class Native [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, IntPtr /*int32 **/ pnFileSizeInBytes ); - [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamRemoteStorage_GetQuota( IntPtr ISteamRemoteStorage, IntPtr /*uint64 **/ pnTotalBytes, IntPtr /*uint64 **/ puAvailableBytes ); + [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, IntPtr /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner ); + [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 ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.SteamRemoteStorage.cs b/Facepunch.Steamworks/SteamNative/SteamNative.SteamRemoteStorage.cs index d919bcc..8493623 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.SteamRemoteStorage.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.SteamRemoteStorage.cs @@ -297,10 +297,10 @@ public int GetFileCount() // string // with: Detect_StringReturn - public string GetFileNameAndSize( int iFile /*int*/, IntPtr pnFileSizeInBytes /*int32 **/ ) + public string GetFileNameAndSize( int iFile /*int*/, out int pnFileSizeInBytes /*int32 **/ ) { IntPtr string_pointer; - string_pointer = platform.ISteamRemoteStorage_GetFileNameAndSize( iFile, (IntPtr) pnFileSizeInBytes ); + string_pointer = platform.ISteamRemoteStorage_GetFileNameAndSize( iFile, out pnFileSizeInBytes ); return Marshal.PtrToStringAnsi( string_pointer ); } @@ -339,9 +339,9 @@ public CallbackHandle GetPublishedItemVoteDetails( PublishedFileId_t unPublished } // bool - public bool GetQuota( IntPtr pnTotalBytes /*uint64 **/, IntPtr puAvailableBytes /*uint64 **/ ) + public bool GetQuota( out ulong pnTotalBytes /*uint64 **/, out ulong puAvailableBytes /*uint64 **/ ) { - return platform.ISteamRemoteStorage_GetQuota( (IntPtr) pnTotalBytes, (IntPtr) puAvailableBytes ); + return platform.ISteamRemoteStorage_GetQuota( out pnTotalBytes, out puAvailableBytes ); } // RemoteStoragePlatform @@ -358,7 +358,7 @@ public bool GetUGCDetails( UGCHandle_t hContent /*UGCHandle_t*/, ref AppId_t pnA ppchName = string.Empty; System.Text.StringBuilder ppchName_sb = Helpers.TakeStringBuilder(); int pnFileSizeInBytes = 4096; - bSuccess = platform.ISteamRemoteStorage_GetUGCDetails( hContent.Value, ref pnAppID.Value, ppchName_sb, (IntPtr) pnFileSizeInBytes, out pSteamIDOwner.Value ); + bSuccess = platform.ISteamRemoteStorage_GetUGCDetails( hContent.Value, ref pnAppID.Value, ppchName_sb, out pnFileSizeInBytes, out pSteamIDOwner.Value ); if ( !bSuccess ) return bSuccess; ppchName = ppchName_sb.ToString(); return bSuccess; diff --git a/Generator/Argument.cs b/Generator/Argument.cs index f73694f..ba69fd0 100644 --- a/Generator/Argument.cs +++ b/Generator/Argument.cs @@ -101,8 +101,10 @@ bool ShouldBeIntPtr if ( Name.Contains( "Dest" ) && ManagedType.EndsWith( "*" ) ) return true; - if ( Name.EndsWith( "s" ) && ManagedType.EndsWith( "*" ) ) - return true; + if ( ManagedType.EndsWith( "*" ) ) + { + if ( Name.EndsWith( "s" ) && !Name.EndsWith( "Bytes" ) ) return true; + } return false; }