Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop

This commit is contained in:
EvilFactory
2023-10-19 12:18:30 -03:00
613 changed files with 22122 additions and 11481 deletions

View File

@@ -35,7 +35,10 @@ namespace Steamworks
/// </summary>
public void OnCompleted( Action continuation )
{
Dispatch.OnCallComplete<T>( call, continuation, server );
if (IsCompleted)
continuation();
else
Dispatch.OnCallComplete<T>(call, continuation, server);
}
/// <summary>

View File

@@ -0,0 +1,38 @@
using System;
namespace Steamworks;
public class AuthTicketForWebApi : IDisposable
{
public byte[]? Data { get; private set; }
public uint Handle { get; private set; }
public bool Canceled { get; private set; }
public AuthTicketForWebApi( byte[] data, uint handle )
{
Data = data;
Handle = handle;
}
/// <summary>
/// Cancels a ticket.
/// You should cancel your ticket when you close the game or leave a server.
/// </summary>
public void Cancel()
{
if (Handle != 0)
{
SteamUser.Internal?.CancelAuthTicket(Handle);
}
Handle = 0;
Data = null;
Canceled = true;
}
public void Dispose()
{
Cancel();
}
}

View File

@@ -5,7 +5,7 @@
<DefineConstants>$(DefineConstants);PLATFORM_POSIX64;PLATFORM_POSIX;PLATFORM_64</DefineConstants>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Steamworks</RootNamespace>
@@ -16,6 +16,15 @@
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Update="libsteam_api64.dylib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="libsteam_api64.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="Facepunch.Steamworks.targets" />
</Project>

View File

@@ -5,7 +5,7 @@
<DefineConstants>$(DefineConstants);PLATFORM_WIN64;PLATFORM_WIN;PLATFORM_64</DefineConstants>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>8.0</LangVersion>
<LangVersion>8.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<RootNamespace>Steamworks</RootNamespace>
@@ -20,17 +20,23 @@
<PackageProjectUrl>https://github.com/Facepunch/Facepunch.Steamworks</PackageProjectUrl>
<PackageIcon>Facepunch.Steamworks.jpg</PackageIcon>
<PackageTags>facepunch;steam;unity;steamworks;valve</PackageTags>
<LangVersion>latest</LangVersion>
<LangVersion>10</LangVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Facepunch/Facepunch.Steamworks.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<Content Include="steam_api64.dll" PackagePath="\content\" Pack="true" PackageCopyToOutput="true">
<None Include="Facepunch.Steamworks.jpg">
<Pack>true</Pack>
<PackagePath>/</PackagePath>
</None>
<None Include="steam_api64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Facepunch.Steamworks.jpg" Pack="true" PackagePath="\" />
<Pack>true</Pack>
<PackagePath>content</PackagePath>
</None>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.1|x64'">

View File

@@ -23,6 +23,7 @@ namespace Steamworks
StoreAuthURLResponse = 165,
MarketEligibilityResponse = 166,
DurationControl = 167,
GetTicketForWebApiResponse = 168,
GSClientApprove = 201,
GSClientDeny = 202,
GSClientKick = 203,
@@ -51,6 +52,9 @@ namespace Steamworks
FriendsEnumerateFollowingList = 346,
SetPersonaNameResponse = 347,
UnreadChatMessagesChanged = 348,
OverlayBrowserProtocolNavigation = 349,
EquippedProfileItemsChanged = 350,
EquippedProfileItems = 351,
FavoritesListChanged = 502,
LobbyInvite = 503,
LobbyEnter = 504,
@@ -69,11 +73,14 @@ namespace Steamworks
SteamShutdown = 704,
CheckFileSignature = 705,
GamepadTextInputDismissed = 714,
AppResumingFromSuspend = 736,
FloatingGamepadTextInputDismissed = 738,
FilterTextDictionaryChanged = 739,
DlcInstalled = 1005,
RegisterActivationCodeResponse = 1008,
NewUrlLaunchParameters = 1014,
AppProofOfPurchaseKeyResponse = 1021,
FileDetailsResult = 1023,
TimedTrialStatus = 1030,
UserStatsReceived = 1101,
UserStatsStored = 1102,
UserAchievementStored = 1103,
@@ -93,11 +100,10 @@ namespace Steamworks
P2PSessionConnectFail = 1203,
SteamNetConnectionStatusChangedCallback = 1221,
SteamNetAuthenticationStatus = 1222,
SteamNetworkingFakeIPResult = 1223,
SteamNetworkingMessagesSessionRequest = 1251,
SteamNetworkingMessagesSessionFailed = 1252,
SteamRelayNetworkStatus = 1281,
RemoteStorageAppSyncedClient = 1301,
RemoteStorageAppSyncedServer = 1302,
RemoteStorageAppSyncProgress = 1303,
RemoteStorageAppSyncStatusCheck = 1305,
RemoteStorageFileShareResult = 1307,
RemoteStoragePublishFileResult = 1309,
RemoteStorageDeletePublishedFileResult = 1311,
@@ -122,6 +128,7 @@ namespace Steamworks
RemoteStoragePublishedFileUpdated = 1330,
RemoteStorageFileWriteAsyncComplete = 1331,
RemoteStorageFileReadAsyncComplete = 1332,
RemoteStorageLocalFileChange = 1333,
GSStatsReceived = 1800,
GSStatsStored = 1801,
HTTPRequestCompleted = 2101,
@@ -129,6 +136,10 @@ namespace Steamworks
HTTPRequestDataReceived = 2103,
ScreenshotReady = 2301,
ScreenshotRequested = 2302,
SteamInputDeviceConnected = 2801,
SteamInputDeviceDisconnected = 2802,
SteamInputConfigurationLoaded = 2803,
SteamInputGamepadSlotChange = 2804,
SteamUGCQueryCompleted = 3401,
SteamUGCRequestUGCDetailsResult = 3402,
CreateItemResult = 3403,
@@ -146,6 +157,8 @@ namespace Steamworks
RemoveAppDependencyResult = 3415,
GetAppDependenciesResult = 3416,
DeleteItemResult = 3417,
UserSubscribedItemsListChanged = 3418,
WorkshopEULAStatus = 3420,
SteamAppInstalled = 3901,
SteamAppUninstalled = 3902,
PlaybackStatusHasChanged = 4001,
@@ -187,8 +200,6 @@ namespace Steamworks
HTML_UpdateToolTip = 4525,
HTML_HideToolTip = 4526,
HTML_BrowserRestarted = 4527,
BroadcastUploadStart = 4604,
BroadcastUploadStop = 4605,
GetVideoURLResult = 4611,
GetOPFSettingsResult = 4624,
SteamInventoryResultReady = 4700,
@@ -213,6 +224,7 @@ namespace Steamworks
ActiveBeaconsUpdated = 5306,
SteamRemotePlaySessionConnected = 5701,
SteamRemotePlaySessionDisconnected = 5702,
SteamRemotePlayTogetherGuestInvite = 5703,
}
internal static partial class CallbackTypeFactory
{
@@ -233,6 +245,7 @@ namespace Steamworks
{ CallbackType.StoreAuthURLResponse, typeof( StoreAuthURLResponse_t )},
{ CallbackType.MarketEligibilityResponse, typeof( MarketEligibilityResponse_t )},
{ CallbackType.DurationControl, typeof( DurationControl_t )},
{ CallbackType.GetTicketForWebApiResponse, typeof( GetTicketForWebApiResponse_t )},
{ CallbackType.GSClientApprove, typeof( GSClientApprove_t )},
{ CallbackType.GSClientDeny, typeof( GSClientDeny_t )},
{ CallbackType.GSClientKick, typeof( GSClientKick_t )},
@@ -261,6 +274,9 @@ namespace Steamworks
{ CallbackType.FriendsEnumerateFollowingList, typeof( FriendsEnumerateFollowingList_t )},
{ CallbackType.SetPersonaNameResponse, typeof( SetPersonaNameResponse_t )},
{ CallbackType.UnreadChatMessagesChanged, typeof( UnreadChatMessagesChanged_t )},
{ CallbackType.OverlayBrowserProtocolNavigation, typeof( OverlayBrowserProtocolNavigation_t )},
{ CallbackType.EquippedProfileItemsChanged, typeof( EquippedProfileItemsChanged_t )},
{ CallbackType.EquippedProfileItems, typeof( EquippedProfileItems_t )},
{ CallbackType.FavoritesListChanged, typeof( FavoritesListChanged_t )},
{ CallbackType.LobbyInvite, typeof( LobbyInvite_t )},
{ CallbackType.LobbyEnter, typeof( LobbyEnter_t )},
@@ -279,11 +295,14 @@ namespace Steamworks
{ CallbackType.SteamShutdown, typeof( SteamShutdown_t )},
{ CallbackType.CheckFileSignature, typeof( CheckFileSignature_t )},
{ CallbackType.GamepadTextInputDismissed, typeof( GamepadTextInputDismissed_t )},
{ CallbackType.AppResumingFromSuspend, typeof( AppResumingFromSuspend_t )},
{ CallbackType.FloatingGamepadTextInputDismissed, typeof( FloatingGamepadTextInputDismissed_t )},
{ CallbackType.FilterTextDictionaryChanged, typeof( FilterTextDictionaryChanged_t )},
{ CallbackType.DlcInstalled, typeof( DlcInstalled_t )},
{ CallbackType.RegisterActivationCodeResponse, typeof( RegisterActivationCodeResponse_t )},
{ CallbackType.NewUrlLaunchParameters, typeof( NewUrlLaunchParameters_t )},
{ CallbackType.AppProofOfPurchaseKeyResponse, typeof( AppProofOfPurchaseKeyResponse_t )},
{ CallbackType.FileDetailsResult, typeof( FileDetailsResult_t )},
{ CallbackType.TimedTrialStatus, typeof( TimedTrialStatus_t )},
{ CallbackType.UserStatsReceived, typeof( UserStatsReceived_t )},
{ CallbackType.UserStatsStored, typeof( UserStatsStored_t )},
{ CallbackType.UserAchievementStored, typeof( UserAchievementStored_t )},
@@ -301,11 +320,10 @@ namespace Steamworks
{ CallbackType.P2PSessionConnectFail, typeof( P2PSessionConnectFail_t )},
{ CallbackType.SteamNetConnectionStatusChangedCallback, typeof( SteamNetConnectionStatusChangedCallback_t )},
{ CallbackType.SteamNetAuthenticationStatus, typeof( SteamNetAuthenticationStatus_t )},
{ CallbackType.SteamNetworkingFakeIPResult, typeof( SteamNetworkingFakeIPResult_t )},
{ CallbackType.SteamNetworkingMessagesSessionRequest, typeof( SteamNetworkingMessagesSessionRequest_t )},
{ CallbackType.SteamNetworkingMessagesSessionFailed, typeof( SteamNetworkingMessagesSessionFailed_t )},
{ CallbackType.SteamRelayNetworkStatus, typeof( SteamRelayNetworkStatus_t )},
{ CallbackType.RemoteStorageAppSyncedClient, typeof( RemoteStorageAppSyncedClient_t )},
{ CallbackType.RemoteStorageAppSyncedServer, typeof( RemoteStorageAppSyncedServer_t )},
{ CallbackType.RemoteStorageAppSyncProgress, typeof( RemoteStorageAppSyncProgress_t )},
{ CallbackType.RemoteStorageAppSyncStatusCheck, typeof( RemoteStorageAppSyncStatusCheck_t )},
{ CallbackType.RemoteStorageFileShareResult, typeof( RemoteStorageFileShareResult_t )},
{ CallbackType.RemoteStoragePublishFileResult, typeof( RemoteStoragePublishFileResult_t )},
{ CallbackType.RemoteStorageDeletePublishedFileResult, typeof( RemoteStorageDeletePublishedFileResult_t )},
@@ -330,6 +348,7 @@ namespace Steamworks
{ CallbackType.RemoteStoragePublishedFileUpdated, typeof( RemoteStoragePublishedFileUpdated_t )},
{ CallbackType.RemoteStorageFileWriteAsyncComplete, typeof( RemoteStorageFileWriteAsyncComplete_t )},
{ CallbackType.RemoteStorageFileReadAsyncComplete, typeof( RemoteStorageFileReadAsyncComplete_t )},
{ CallbackType.RemoteStorageLocalFileChange, typeof( RemoteStorageLocalFileChange_t )},
{ CallbackType.GSStatsReceived, typeof( GSStatsReceived_t )},
{ CallbackType.GSStatsStored, typeof( GSStatsStored_t )},
{ CallbackType.HTTPRequestCompleted, typeof( HTTPRequestCompleted_t )},
@@ -337,6 +356,10 @@ namespace Steamworks
{ CallbackType.HTTPRequestDataReceived, typeof( HTTPRequestDataReceived_t )},
{ CallbackType.ScreenshotReady, typeof( ScreenshotReady_t )},
{ CallbackType.ScreenshotRequested, typeof( ScreenshotRequested_t )},
{ CallbackType.SteamInputDeviceConnected, typeof( SteamInputDeviceConnected_t )},
{ CallbackType.SteamInputDeviceDisconnected, typeof( SteamInputDeviceDisconnected_t )},
{ CallbackType.SteamInputConfigurationLoaded, typeof( SteamInputConfigurationLoaded_t )},
{ CallbackType.SteamInputGamepadSlotChange, typeof( SteamInputGamepadSlotChange_t )},
{ CallbackType.SteamUGCQueryCompleted, typeof( SteamUGCQueryCompleted_t )},
{ CallbackType.SteamUGCRequestUGCDetailsResult, typeof( SteamUGCRequestUGCDetailsResult_t )},
{ CallbackType.CreateItemResult, typeof( CreateItemResult_t )},
@@ -354,6 +377,8 @@ namespace Steamworks
{ CallbackType.RemoveAppDependencyResult, typeof( RemoveAppDependencyResult_t )},
{ CallbackType.GetAppDependenciesResult, typeof( GetAppDependenciesResult_t )},
{ CallbackType.DeleteItemResult, typeof( DeleteItemResult_t )},
{ CallbackType.UserSubscribedItemsListChanged, typeof( UserSubscribedItemsListChanged_t )},
{ CallbackType.WorkshopEULAStatus, typeof( WorkshopEULAStatus_t )},
{ CallbackType.SteamAppInstalled, typeof( SteamAppInstalled_t )},
{ CallbackType.SteamAppUninstalled, typeof( SteamAppUninstalled_t )},
{ CallbackType.PlaybackStatusHasChanged, typeof( PlaybackStatusHasChanged_t )},
@@ -395,8 +420,6 @@ namespace Steamworks
{ CallbackType.HTML_UpdateToolTip, typeof( HTML_UpdateToolTip_t )},
{ CallbackType.HTML_HideToolTip, typeof( HTML_HideToolTip_t )},
{ CallbackType.HTML_BrowserRestarted, typeof( HTML_BrowserRestarted_t )},
{ CallbackType.BroadcastUploadStart, typeof( BroadcastUploadStart_t )},
{ CallbackType.BroadcastUploadStop, typeof( BroadcastUploadStop_t )},
{ CallbackType.GetVideoURLResult, typeof( GetVideoURLResult_t )},
{ CallbackType.GetOPFSettingsResult, typeof( GetOPFSettingsResult_t )},
{ CallbackType.SteamInventoryResultReady, typeof( SteamInventoryResultReady_t )},
@@ -421,6 +444,7 @@ namespace Steamworks
{ CallbackType.ActiveBeaconsUpdated, typeof( ActiveBeaconsUpdated_t )},
{ CallbackType.SteamRemotePlaySessionConnected, typeof( SteamRemotePlaySessionConnected_t )},
{ CallbackType.SteamRemotePlaySessionDisconnected, typeof( SteamRemotePlaySessionDisconnected_t )},
{ CallbackType.SteamRemotePlayTogetherGuestInvite, typeof( SteamRemotePlayTogetherGuestInvite_t )},
};
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamAppList : SteamInterface
internal unsafe class ISteamAppList : SteamInterface
{
internal ISteamAppList( bool IsGameServer )
@@ -49,8 +49,7 @@ namespace Steamworks
#endregion
internal int GetAppName( AppId nAppID, out string pchName )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchName = memory;
using var mempchName = Helpers.TakeMemory();
var returnValue = _GetAppName( Self, nAppID, mempchName, (1024 * 32) );
pchName = Helpers.MemoryToString( mempchName );
return returnValue;
@@ -63,8 +62,7 @@ namespace Steamworks
#endregion
internal int GetAppInstallDir( AppId nAppID, out string pchDirectory )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchDirectory = memory;
using var mempchDirectory = Helpers.TakeMemory();
var returnValue = _GetAppInstallDir( Self, nAppID, mempchDirectory, (1024 * 32) );
pchDirectory = Helpers.MemoryToString( mempchDirectory );
return returnValue;

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamApps : SteamInterface
internal unsafe class ISteamApps : SteamInterface
{
internal ISteamApps( bool IsGameServer )
@@ -18,9 +18,6 @@ namespace Steamworks
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamApps_v008", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamApps_v008();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamApps_v008();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerApps_v008", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerApps_v008();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerApps_v008();
#region FunctionMeta
@@ -159,8 +156,7 @@ namespace Steamworks
#endregion
internal bool BGetDLCDataByIndex( int iDLC, ref AppId pAppID, [MarshalAs( UnmanagedType.U1 )] ref bool pbAvailable, out string pchName )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchName = memory;
using var mempchName = Helpers.TakeMemory();
var returnValue = _BGetDLCDataByIndex( Self, iDLC, ref pAppID, ref pbAvailable, mempchName, (1024 * 32) );
pchName = Helpers.MemoryToString( mempchName );
return returnValue;
@@ -204,8 +200,7 @@ namespace Steamworks
#endregion
internal bool GetCurrentBetaName( out string pchName )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchName = memory;
using var mempchName = Helpers.TakeMemory();
var returnValue = _GetCurrentBetaName( Self, mempchName, (1024 * 32) );
pchName = Helpers.MemoryToString( mempchName );
return returnValue;
@@ -241,8 +236,7 @@ namespace Steamworks
#endregion
internal uint GetAppInstallDir( AppId appID, out string pchFolder )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchFolder = memory;
using var mempchFolder = Helpers.TakeMemory();
var returnValue = _GetAppInstallDir( Self, appID, mempchFolder, (1024 * 32) );
pchFolder = Helpers.MemoryToString( mempchFolder );
return returnValue;
@@ -333,8 +327,7 @@ namespace Steamworks
#endregion
internal int GetLaunchCommandLine( out string pszCommandLine )
{
using var memory = Helpers.TakeMemory();
IntPtr mempszCommandLine = memory;
using var mempszCommandLine = Helpers.TakeMemory();
var returnValue = _GetLaunchCommandLine( Self, mempszCommandLine, (1024 * 32) );
pszCommandLine = Helpers.MemoryToString( mempszCommandLine );
return returnValue;
@@ -352,5 +345,29 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamApps_BIsTimedTrial", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BIsTimedTrial( IntPtr self, ref uint punSecondsAllowed, ref uint punSecondsPlayed );
#endregion
internal bool BIsTimedTrial( ref uint punSecondsAllowed, ref uint punSecondsPlayed )
{
var returnValue = _BIsTimedTrial( Self, ref punSecondsAllowed, ref punSecondsPlayed );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamApps_SetDlcContext", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetDlcContext( IntPtr self, AppId nAppID );
#endregion
internal bool SetDlcContext( AppId nAppID )
{
var returnValue = _SetDlcContext( Self, nAppID );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamClient : SteamInterface
internal unsafe class ISteamClient : SteamInterface
{
internal ISteamClient( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamController : SteamInterface
internal unsafe class ISteamController : SteamInterface
{
internal ISteamController( bool IsGameServer )
@@ -15,9 +15,9 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamController_v007", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamController_v007();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamController_v007();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamController_v008", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamController_v008();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamController_v008();
#region FunctionMeta

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamFriends : SteamInterface
internal unsafe class ISteamFriends : SteamInterface
{
internal ISteamFriends( bool IsGameServer )
@@ -840,5 +840,72 @@ namespace Steamworks
_ActivateGameOverlayRemotePlayTogetherInviteDialog( Self, steamIDLobby );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamFriends_RegisterProtocolInOverlayBrowser", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _RegisterProtocolInOverlayBrowser( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchProtocol );
#endregion
internal bool RegisterProtocolInOverlayBrowser( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchProtocol )
{
var returnValue = _RegisterProtocolInOverlayBrowser( Self, pchProtocol );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialogConnectString", CallingConvention = Platform.CC)]
private static extern void _ActivateGameOverlayInviteDialogConnectString( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString );
#endregion
internal void ActivateGameOverlayInviteDialogConnectString( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString )
{
_ActivateGameOverlayInviteDialogConnectString( Self, pchConnectString );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamFriends_RequestEquippedProfileItems", CallingConvention = Platform.CC)]
private static extern SteamAPICall_t _RequestEquippedProfileItems( IntPtr self, SteamId steamID );
#endregion
internal CallResult<EquippedProfileItems_t> RequestEquippedProfileItems( SteamId steamID )
{
var returnValue = _RequestEquippedProfileItems( Self, steamID );
return new CallResult<EquippedProfileItems_t>( returnValue, IsServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamFriends_BHasEquippedProfileItem", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BHasEquippedProfileItem( IntPtr self, SteamId steamID, CommunityProfileItemType itemType );
#endregion
internal bool BHasEquippedProfileItem( SteamId steamID, CommunityProfileItemType itemType )
{
var returnValue = _BHasEquippedProfileItem( Self, steamID, itemType );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamFriends_GetProfileItemPropertyString", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetProfileItemPropertyString( IntPtr self, SteamId steamID, CommunityProfileItemType itemType, CommunityProfileItemProperty prop );
#endregion
internal string GetProfileItemPropertyString( SteamId steamID, CommunityProfileItemType itemType, CommunityProfileItemProperty prop )
{
var returnValue = _GetProfileItemPropertyString( Self, steamID, itemType, prop );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamFriends_GetProfileItemPropertyUint", CallingConvention = Platform.CC)]
private static extern uint _GetProfileItemPropertyUint( IntPtr self, SteamId steamID, CommunityProfileItemType itemType, CommunityProfileItemProperty prop );
#endregion
internal uint GetProfileItemPropertyUint( SteamId steamID, CommunityProfileItemType itemType, CommunityProfileItemProperty prop )
{
var returnValue = _GetProfileItemPropertyUint( Self, steamID, itemType, prop );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamGameSearch : SteamInterface
internal unsafe class ISteamGameSearch : SteamInterface
{
internal ISteamGameSearch( bool IsGameServer )
@@ -82,8 +82,7 @@ namespace Steamworks
#endregion
internal GameSearchErrorCode_t RetrieveConnectionDetails( SteamId steamIDHost, out string pchConnectionDetails )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchConnectionDetails = memory;
using var mempchConnectionDetails = Helpers.TakeMemory();
var returnValue = _RetrieveConnectionDetails( Self, steamIDHost, mempchConnectionDetails, (1024 * 32) );
pchConnectionDetails = Helpers.MemoryToString( mempchConnectionDetails );
return returnValue;

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamGameServer : SteamInterface
internal unsafe class ISteamGameServer : SteamInterface
{
internal ISteamGameServer( bool IsGameServer )
@@ -15,9 +15,9 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServer_v013", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServer_v013();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServer_v013();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServer_v015", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServer_v015();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServer_v015();
#region FunctionMeta
@@ -258,58 +258,23 @@ namespace Steamworks
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SendUserConnectAndAuthenticate( IntPtr self, uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_SetAdvertiseServerActive", CallingConvention = Platform.CC)]
private static extern void _SetAdvertiseServerActive( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bActive );
#endregion
internal bool SendUserConnectAndAuthenticate( uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser )
internal void SetAdvertiseServerActive( [MarshalAs( UnmanagedType.U1 )] bool bActive )
{
var returnValue = _SendUserConnectAndAuthenticate( Self, unIPClient, pvAuthBlob, cubAuthBlobSize, ref pSteamIDUser );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection", CallingConvention = Platform.CC)]
private static extern SteamId _CreateUnauthenticatedUserConnection( IntPtr self );
#endregion
internal SteamId CreateUnauthenticatedUserConnection()
{
var returnValue = _CreateUnauthenticatedUserConnection( Self );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_SendUserDisconnect", CallingConvention = Platform.CC)]
private static extern void _SendUserDisconnect( IntPtr self, SteamId steamIDUser );
#endregion
internal void SendUserDisconnect( SteamId steamIDUser )
{
_SendUserDisconnect( Self, steamIDUser );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_BUpdateUserData", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BUpdateUserData( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPlayerName, uint uScore );
#endregion
internal bool BUpdateUserData( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPlayerName, uint uScore )
{
var returnValue = _BUpdateUserData( Self, steamIDUser, pchPlayerName, uScore );
return returnValue;
_SetAdvertiseServerActive( Self, bActive );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_GetAuthSessionTicket", CallingConvention = Platform.CC)]
private static extern HAuthTicket _GetAuthSessionTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket );
private static extern HAuthTicket _GetAuthSessionTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket, ref NetIdentity pSnid );
#endregion
internal HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket )
internal HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket, ref NetIdentity pSnid )
{
var returnValue = _GetAuthSessionTicket( Self, pTicket, cbMaxTicket, ref pcbTicket );
var returnValue = _GetAuthSessionTicket( Self, pTicket, cbMaxTicket, ref pcbTicket, ref pSnid );
return returnValue;
}
@@ -422,36 +387,6 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_EnableHeartbeats", CallingConvention = Platform.CC)]
private static extern void _EnableHeartbeats( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bActive );
#endregion
internal void EnableHeartbeats( [MarshalAs( UnmanagedType.U1 )] bool bActive )
{
_EnableHeartbeats( Self, bActive );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_SetHeartbeatInterval", CallingConvention = Platform.CC)]
private static extern void _SetHeartbeatInterval( IntPtr self, int iHeartbeatInterval );
#endregion
internal void SetHeartbeatInterval( int iHeartbeatInterval )
{
_SetHeartbeatInterval( Self, iHeartbeatInterval );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_ForceHeartbeat", CallingConvention = Platform.CC)]
private static extern void _ForceHeartbeat( IntPtr self );
#endregion
internal void ForceHeartbeat()
{
_ForceHeartbeat( Self );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_AssociateWithClan", CallingConvention = Platform.CC)]
private static extern SteamAPICall_t _AssociateWithClan( IntPtr self, SteamId steamIDClan );
@@ -474,5 +409,50 @@ namespace Steamworks
return new CallResult<ComputeNewPlayerCompatibilityResult_t>( returnValue, IsServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_SendUserConnectAndAuthenticate_DEPRECATED", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SendUserConnectAndAuthenticate_DEPRECATED( IntPtr self, uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser );
#endregion
internal bool SendUserConnectAndAuthenticate_DEPRECATED( uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser )
{
var returnValue = _SendUserConnectAndAuthenticate_DEPRECATED( Self, unIPClient, pvAuthBlob, cubAuthBlobSize, ref pSteamIDUser );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_CreateUnauthenticatedUserConnection", CallingConvention = Platform.CC)]
private static extern SteamId _CreateUnauthenticatedUserConnection( IntPtr self );
#endregion
internal SteamId CreateUnauthenticatedUserConnection()
{
var returnValue = _CreateUnauthenticatedUserConnection( Self );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_SendUserDisconnect_DEPRECATED", CallingConvention = Platform.CC)]
private static extern void _SendUserDisconnect_DEPRECATED( IntPtr self, SteamId steamIDUser );
#endregion
internal void SendUserDisconnect_DEPRECATED( SteamId steamIDUser )
{
_SendUserDisconnect_DEPRECATED( Self, steamIDUser );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamGameServer_BUpdateUserData", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BUpdateUserData( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPlayerName, uint uScore );
#endregion
internal bool BUpdateUserData( SteamId steamIDUser, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPlayerName, uint uScore )
{
var returnValue = _BUpdateUserData( Self, steamIDUser, pchPlayerName, uScore );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamGameServerStats : SteamInterface
internal unsafe class ISteamGameServerStats : SteamInterface
{
internal ISteamGameServerStats( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamHTMLSurface : SteamInterface
internal unsafe class ISteamHTMLSurface : SteamInterface
{
internal ISteamHTMLSurface( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamHTTP : SteamInterface
internal unsafe class ISteamHTTP : SteamInterface
{
internal ISteamHTTP( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamInput : SteamInterface
internal unsafe class ISteamInput : SteamInterface
{
internal ISteamInput( bool IsGameServer )
@@ -15,20 +15,20 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamInput_v001", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamInput_v001();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamInput_v001();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamInput_v006", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamInput_v006();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamInput_v006();
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_Init", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _Init( IntPtr self );
private static extern bool _Init( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bExplicitlyCallRunFrame );
#endregion
internal bool Init()
internal bool Init( [MarshalAs( UnmanagedType.U1 )] bool bExplicitlyCallRunFrame )
{
var returnValue = _Init( Self );
var returnValue = _Init( Self, bExplicitlyCallRunFrame );
return returnValue;
}
@@ -45,13 +45,49 @@ namespace Steamworks
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_RunFrame", CallingConvention = Platform.CC)]
private static extern void _RunFrame( IntPtr self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_SetInputActionManifestFilePath", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetInputActionManifestFilePath( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchInputActionManifestAbsolutePath );
#endregion
internal void RunFrame()
internal bool SetInputActionManifestFilePath( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchInputActionManifestAbsolutePath )
{
_RunFrame( Self );
var returnValue = _SetInputActionManifestFilePath( Self, pchInputActionManifestAbsolutePath );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_RunFrame", CallingConvention = Platform.CC)]
private static extern void _RunFrame( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bReservedValue );
#endregion
internal void RunFrame( [MarshalAs( UnmanagedType.U1 )] bool bReservedValue )
{
_RunFrame( Self, bReservedValue );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_BWaitForData", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BWaitForData( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bWaitForever, uint unTimeout );
#endregion
internal bool BWaitForData( [MarshalAs( UnmanagedType.U1 )] bool bWaitForever, uint unTimeout )
{
var returnValue = _BWaitForData( Self, bWaitForever, unTimeout );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_BNewDataAvailable", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BNewDataAvailable( IntPtr self );
#endregion
internal bool BNewDataAvailable()
{
var returnValue = _BNewDataAvailable( Self );
return returnValue;
}
#region FunctionMeta
@@ -65,6 +101,16 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_EnableDeviceCallbacks", CallingConvention = Platform.CC)]
private static extern void _EnableDeviceCallbacks( IntPtr self );
#endregion
internal void EnableDeviceCallbacks()
{
_EnableDeviceCallbacks( Self );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetActionSetHandle", CallingConvention = Platform.CC)]
private static extern InputActionSetHandle_t _GetActionSetHandle( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionSetName );
@@ -171,6 +217,17 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetStringForDigitalActionName", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetStringForDigitalActionName( IntPtr self, InputDigitalActionHandle_t eActionHandle );
#endregion
internal string GetStringForDigitalActionName( InputDigitalActionHandle_t eActionHandle )
{
var returnValue = _GetStringForDigitalActionName( Self, eActionHandle );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetAnalogActionHandle", CallingConvention = Platform.CC)]
private static extern InputAnalogActionHandle_t _GetAnalogActionHandle( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszActionName );
@@ -205,13 +262,35 @@ namespace Steamworks
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetGlyphForActionOrigin", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetGlyphForActionOrigin( IntPtr self, InputActionOrigin eOrigin );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetGlyphPNGForActionOrigin", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetGlyphPNGForActionOrigin( IntPtr self, InputActionOrigin eOrigin, GlyphSize eSize, uint unFlags );
#endregion
internal string GetGlyphForActionOrigin( InputActionOrigin eOrigin )
internal string GetGlyphPNGForActionOrigin( InputActionOrigin eOrigin, GlyphSize eSize, uint unFlags )
{
var returnValue = _GetGlyphForActionOrigin( Self, eOrigin );
var returnValue = _GetGlyphPNGForActionOrigin( Self, eOrigin, eSize, unFlags );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetGlyphSVGForActionOrigin", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetGlyphSVGForActionOrigin( IntPtr self, InputActionOrigin eOrigin, uint unFlags );
#endregion
internal string GetGlyphSVGForActionOrigin( InputActionOrigin eOrigin, uint unFlags )
{
var returnValue = _GetGlyphSVGForActionOrigin( Self, eOrigin, unFlags );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetGlyphForActionOrigin_Legacy", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetGlyphForActionOrigin_Legacy( IntPtr self, InputActionOrigin eOrigin );
#endregion
internal string GetGlyphForActionOrigin_Legacy( InputActionOrigin eOrigin )
{
var returnValue = _GetGlyphForActionOrigin_Legacy( Self, eOrigin );
return returnValue;
}
@@ -226,6 +305,17 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetStringForAnalogActionName", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetStringForAnalogActionName( IntPtr self, InputAnalogActionHandle_t eActionHandle );
#endregion
internal string GetStringForAnalogActionName( InputAnalogActionHandle_t eActionHandle )
{
var returnValue = _GetStringForAnalogActionName( Self, eActionHandle );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_StopAnalogActionMomentum", CallingConvention = Platform.CC)]
private static extern void _StopAnalogActionMomentum( IntPtr self, InputHandle_t inputHandle, InputAnalogActionHandle_t eAction );
@@ -257,6 +347,26 @@ namespace Steamworks
_TriggerVibration( Self, inputHandle, usLeftSpeed, usRightSpeed );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_TriggerVibrationExtended", CallingConvention = Platform.CC)]
private static extern void _TriggerVibrationExtended( IntPtr self, InputHandle_t inputHandle, ushort usLeftSpeed, ushort usRightSpeed, ushort usLeftTriggerSpeed, ushort usRightTriggerSpeed );
#endregion
internal void TriggerVibrationExtended( InputHandle_t inputHandle, ushort usLeftSpeed, ushort usRightSpeed, ushort usLeftTriggerSpeed, ushort usRightTriggerSpeed )
{
_TriggerVibrationExtended( Self, inputHandle, usLeftSpeed, usRightSpeed, usLeftTriggerSpeed, usRightTriggerSpeed );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_TriggerSimpleHapticEvent", CallingConvention = Platform.CC)]
private static extern void _TriggerSimpleHapticEvent( IntPtr self, InputHandle_t inputHandle, ControllerHapticLocation eHapticLocation, byte nIntensity, char nGainDB, byte nOtherIntensity, char nOtherGainDB );
#endregion
internal void TriggerSimpleHapticEvent( InputHandle_t inputHandle, ControllerHapticLocation eHapticLocation, byte nIntensity, char nGainDB, byte nOtherIntensity, char nOtherGainDB )
{
_TriggerSimpleHapticEvent( Self, inputHandle, eHapticLocation, nIntensity, nGainDB, nOtherIntensity, nOtherGainDB );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_SetLEDColor", CallingConvention = Platform.CC)]
private static extern void _SetLEDColor( IntPtr self, InputHandle_t inputHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags );
@@ -268,23 +378,23 @@ namespace Steamworks
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_TriggerHapticPulse", CallingConvention = Platform.CC)]
private static extern void _TriggerHapticPulse( IntPtr self, InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_Legacy_TriggerHapticPulse", CallingConvention = Platform.CC)]
private static extern void _Legacy_TriggerHapticPulse( IntPtr self, InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec );
#endregion
internal void TriggerHapticPulse( InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec )
internal void Legacy_TriggerHapticPulse( InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec )
{
_TriggerHapticPulse( Self, inputHandle, eTargetPad, usDurationMicroSec );
_Legacy_TriggerHapticPulse( Self, inputHandle, eTargetPad, usDurationMicroSec );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_TriggerRepeatedHapticPulse", CallingConvention = Platform.CC)]
private static extern void _TriggerRepeatedHapticPulse( IntPtr self, InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_Legacy_TriggerRepeatedHapticPulse", CallingConvention = Platform.CC)]
private static extern void _Legacy_TriggerRepeatedHapticPulse( IntPtr self, InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags );
#endregion
internal void TriggerRepeatedHapticPulse( InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags )
internal void Legacy_TriggerRepeatedHapticPulse( InputHandle_t inputHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags )
{
_TriggerRepeatedHapticPulse( Self, inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags );
_Legacy_TriggerRepeatedHapticPulse( Self, inputHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags );
}
#region FunctionMeta
@@ -399,5 +509,16 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInput_GetSessionInputConfigurationSettings", CallingConvention = Platform.CC)]
private static extern ushort _GetSessionInputConfigurationSettings( IntPtr self );
#endregion
internal ushort GetSessionInputConfigurationSettings()
{
var returnValue = _GetSessionInputConfigurationSettings( Self );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamInventory : SteamInterface
internal unsafe class ISteamInventory : SteamInterface
{
internal ISteamInventory( bool IsGameServer )
@@ -28,9 +28,6 @@ namespace Steamworks
private static extern Result _GetResultStatus( IntPtr self, SteamInventoryResult_t resultHandle );
#endregion
/// <summary>
/// Find out the status of an asynchronous inventory result handle.
/// </summary>
internal Result GetResultStatus( SteamInventoryResult_t resultHandle )
{
var returnValue = _GetResultStatus( Self, resultHandle );
@@ -43,9 +40,6 @@ namespace Steamworks
private static extern bool _GetResultItems( IntPtr self, SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t[]? pOutItemsArray, ref uint punOutItemsArraySize );
#endregion
/// <summary>
/// Copies the contents of a result set into a flat array. The specific contents of the result set depend on which query which was used.
/// </summary>
internal bool GetResultItems( SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t[]? pOutItemsArray, ref uint punOutItemsArraySize )
{
var returnValue = _GetResultItems( Self, resultHandle, pOutItemsArray, ref punOutItemsArraySize );
@@ -60,8 +54,7 @@ namespace Steamworks
#endregion
internal bool GetResultItemProperty( SteamInventoryResult_t resultHandle, uint unItemIndex, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string? pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchValueBuffer = memory;
using var mempchValueBuffer = Helpers.TakeMemory();
var returnValue = _GetResultItemProperty( Self, resultHandle, unItemIndex, pchPropertyName, mempchValueBuffer, ref punValueBufferSizeOut );
pchValueBuffer = Helpers.MemoryToString( mempchValueBuffer );
return returnValue;
@@ -72,9 +65,6 @@ namespace Steamworks
private static extern uint _GetResultTimestamp( IntPtr self, SteamInventoryResult_t resultHandle );
#endregion
/// <summary>
/// Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.
/// </summary>
internal uint GetResultTimestamp( SteamInventoryResult_t resultHandle )
{
var returnValue = _GetResultTimestamp( Self, resultHandle );
@@ -87,9 +77,6 @@ namespace Steamworks
private static extern bool _CheckResultSteamID( IntPtr self, SteamInventoryResult_t resultHandle, SteamId steamIDExpected );
#endregion
/// <summary>
/// Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.
/// </summary>
internal bool CheckResultSteamID( SteamInventoryResult_t resultHandle, SteamId steamIDExpected )
{
var returnValue = _CheckResultSteamID( Self, resultHandle, steamIDExpected );
@@ -101,9 +88,6 @@ namespace Steamworks
private static extern void _DestroyResult( IntPtr self, SteamInventoryResult_t resultHandle );
#endregion
/// <summary>
/// Destroys a result handle and frees all associated memory.
/// </summary>
internal void DestroyResult( SteamInventoryResult_t resultHandle )
{
_DestroyResult( Self, resultHandle );
@@ -115,9 +99,6 @@ namespace Steamworks
private static extern bool _GetAllItems( IntPtr self, ref SteamInventoryResult_t pResultHandle );
#endregion
/// <summary>
/// Captures the entire state of the current users Steam inventory.
/// </summary>
internal bool GetAllItems( ref SteamInventoryResult_t pResultHandle )
{
var returnValue = _GetAllItems( Self, ref pResultHandle );
@@ -130,9 +111,6 @@ namespace Steamworks
private static extern bool _GetItemsByID( IntPtr self, ref SteamInventoryResult_t pResultHandle, ref InventoryItemId pInstanceIDs, uint unCountInstanceIDs );
#endregion
/// <summary>
/// Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.
/// </summary>
internal bool GetItemsByID( ref SteamInventoryResult_t pResultHandle, ref InventoryItemId pInstanceIDs, uint unCountInstanceIDs )
{
var returnValue = _GetItemsByID( Self, ref pResultHandle, ref pInstanceIDs, unCountInstanceIDs );
@@ -181,9 +159,6 @@ namespace Steamworks
private static extern bool _GrantPromoItems( IntPtr self, ref SteamInventoryResult_t pResultHandle );
#endregion
/// <summary>
/// GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).
/// </summary>
internal bool GrantPromoItems( ref SteamInventoryResult_t pResultHandle )
{
var returnValue = _GrantPromoItems( Self, ref pResultHandle );
@@ -220,9 +195,6 @@ namespace Steamworks
private static extern bool _ConsumeItem( IntPtr self, ref SteamInventoryResult_t pResultHandle, InventoryItemId itemConsume, uint unQuantity );
#endregion
/// <summary>
/// ConsumeItem() removes items from the inventory permanently.
/// </summary>
internal bool ConsumeItem( ref SteamInventoryResult_t pResultHandle, InventoryItemId itemConsume, uint unQuantity )
{
var returnValue = _ConsumeItem( Self, ref pResultHandle, itemConsume, unQuantity );
@@ -258,9 +230,6 @@ namespace Steamworks
private static extern void _SendItemDropHeartbeat( IntPtr self );
#endregion
/// <summary>
/// Deprecated method. Playtime accounting is performed on the Steam servers.
/// </summary>
internal void SendItemDropHeartbeat()
{
_SendItemDropHeartbeat( Self );
@@ -272,9 +241,6 @@ namespace Steamworks
private static extern bool _TriggerItemDrop( IntPtr self, ref SteamInventoryResult_t pResultHandle, InventoryDefId dropListDefinition );
#endregion
/// <summary>
/// Playtime credit must be consumed and turned into item drops by your game.
/// </summary>
internal bool TriggerItemDrop( ref SteamInventoryResult_t pResultHandle, InventoryDefId dropListDefinition )
{
var returnValue = _TriggerItemDrop( Self, ref pResultHandle, dropListDefinition );
@@ -299,9 +265,6 @@ namespace Steamworks
private static extern bool _LoadItemDefinitions( IntPtr self );
#endregion
/// <summary>
/// LoadItemDefinitions triggers the automatic load and refresh of item definitions.
/// </summary>
internal bool LoadItemDefinitions()
{
var returnValue = _LoadItemDefinitions( Self );
@@ -328,8 +291,7 @@ namespace Steamworks
#endregion
internal bool GetItemDefinitionProperty( InventoryDefId iDefinition, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string? pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchValueBuffer = memory;
using var mempchValueBuffer = Helpers.TakeMemory();
var returnValue = _GetItemDefinitionProperty( Self, iDefinition, pchPropertyName, mempchValueBuffer, ref punValueBufferSizeOut );
pchValueBuffer = Helpers.MemoryToString( mempchValueBuffer );
return returnValue;
@@ -498,5 +460,17 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamInventory_InspectItem", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _InspectItem( IntPtr self, ref SteamInventoryResult_t pResultHandle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchItemToken );
#endregion
internal bool InspectItem( ref SteamInventoryResult_t pResultHandle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchItemToken )
{
var returnValue = _InspectItem( Self, ref pResultHandle, pchItemToken );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMatchmaking : SteamInterface
internal unsafe class ISteamMatchmaking : SteamInterface
{
internal ISteamMatchmaking( bool IsGameServer )
@@ -266,10 +266,8 @@ namespace Steamworks
#endregion
internal bool GetLobbyDataByIndex( SteamId steamIDLobby, int iLobbyData, out string pchKey, out string pchValue )
{
using var memoryKey = Helpers.TakeMemory();
using var memoryValue = Helpers.TakeMemory();
IntPtr mempchKey = memoryKey;
IntPtr mempchValue = memoryValue;
using var mempchKey = Helpers.TakeMemory();
using var mempchValue = Helpers.TakeMemory();
var returnValue = _GetLobbyDataByIndex( Self, steamIDLobby, iLobbyData, mempchKey, (1024 * 32), mempchValue, (1024 * 32) );
pchKey = Helpers.MemoryToString( mempchKey );
pchValue = Helpers.MemoryToString( mempchValue );

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMatchmakingPingResponse : SteamInterface
internal unsafe class ISteamMatchmakingPingResponse : SteamInterface
{
internal ISteamMatchmakingPingResponse( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMatchmakingPlayersResponse : SteamInterface
internal unsafe class ISteamMatchmakingPlayersResponse : SteamInterface
{
internal ISteamMatchmakingPlayersResponse( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMatchmakingRulesResponse : SteamInterface
internal unsafe class ISteamMatchmakingRulesResponse : SteamInterface
{
internal ISteamMatchmakingRulesResponse( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMatchmakingServerListResponse : SteamInterface
internal unsafe class ISteamMatchmakingServerListResponse : SteamInterface
{
internal ISteamMatchmakingServerListResponse( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMatchmakingServers : SteamInterface
internal unsafe class ISteamMatchmakingServers : SteamInterface
{
internal ISteamMatchmakingServers( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMusic : SteamInterface
internal unsafe class ISteamMusic : SteamInterface
{
internal ISteamMusic( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamMusicRemote : SteamInterface
internal unsafe class ISteamMusicRemote : SteamInterface
{
internal ISteamMusicRemote( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamNetworking : SteamInterface
internal unsafe class ISteamNetworking : SteamInterface
{
internal ISteamNetworking( bool IsGameServer )

View File

@@ -1,41 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal class ISteamNetworkingConnectionCustomSignaling : SteamInterface
{
internal ISteamNetworkingConnectionCustomSignaling( bool IsGameServer )
{
SetupInterface( IsGameServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingConnectionCustomSignaling_SendSignal", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SendSignal( IntPtr self, Connection hConn, ref ConnectionInfo info, IntPtr pMsg, int cbMsg );
#endregion
internal bool SendSignal( Connection hConn, ref ConnectionInfo info, IntPtr pMsg, int cbMsg )
{
var returnValue = _SendSignal( Self, hConn, ref info, pMsg, cbMsg );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingConnectionCustomSignaling_Release", CallingConvention = Platform.CC)]
private static extern void _Release( IntPtr self );
#endregion
internal void Release()
{
_Release( Self );
}
}
}

View File

@@ -1,40 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal class ISteamNetworkingCustomSignalingRecvContext : SteamInterface
{
internal ISteamNetworkingCustomSignalingRecvContext( bool IsGameServer )
{
SetupInterface( IsGameServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingCustomSignalingRecvContext_OnConnectRequest", CallingConvention = Platform.CC)]
private static extern IntPtr _OnConnectRequest( IntPtr self, Connection hConn, ref NetIdentity identityPeer );
#endregion
internal IntPtr OnConnectRequest( Connection hConn, ref NetIdentity identityPeer )
{
var returnValue = _OnConnectRequest( Self, hConn, ref identityPeer );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingCustomSignalingRecvContext_SendRejectionSignal", CallingConvention = Platform.CC)]
private static extern void _SendRejectionSignal( IntPtr self, ref NetIdentity identityPeer, IntPtr pMsg, int cbMsg );
#endregion
internal void SendRejectionSignal( ref NetIdentity identityPeer, IntPtr pMsg, int cbMsg )
{
_SendRejectionSignal( Self, ref identityPeer, pMsg, cbMsg );
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal unsafe class ISteamNetworkingFakeUDPPort : SteamInterface
{
internal ISteamNetworkingFakeUDPPort( bool IsGameServer )
{
SetupInterface( IsGameServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_DestroyFakeUDPPort", CallingConvention = Platform.CC)]
private static extern void _DestroyFakeUDPPort( IntPtr self );
#endregion
internal void DestroyFakeUDPPort()
{
_DestroyFakeUDPPort( Self );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_SendMessageToFakeIP", CallingConvention = Platform.CC)]
private static extern Result _SendMessageToFakeIP( IntPtr self, ref NetAddress remoteAddress, IntPtr pData, uint cbData, int nSendFlags );
#endregion
internal Result SendMessageToFakeIP( ref NetAddress remoteAddress, IntPtr pData, uint cbData, int nSendFlags )
{
var returnValue = _SendMessageToFakeIP( Self, ref remoteAddress, pData, cbData, nSendFlags );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_ReceiveMessages", CallingConvention = Platform.CC)]
private static extern int _ReceiveMessages( IntPtr self, IntPtr ppOutMessages, int nMaxMessages );
#endregion
internal int ReceiveMessages( IntPtr ppOutMessages, int nMaxMessages )
{
var returnValue = _ReceiveMessages( Self, ppOutMessages, nMaxMessages );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_ScheduleCleanup", CallingConvention = Platform.CC)]
private static extern void _ScheduleCleanup( IntPtr self, ref NetAddress remoteAddress );
#endregion
internal void ScheduleCleanup( ref NetAddress remoteAddress )
{
_ScheduleCleanup( Self, ref remoteAddress );
}
}
}

View File

@@ -0,0 +1,96 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal unsafe class ISteamNetworkingMessages : SteamInterface
{
internal ISteamNetworkingMessages( bool IsGameServer )
{
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingMessages_SteamAPI_v002", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamNetworkingMessages_SteamAPI_v002();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamNetworkingMessages_SteamAPI_v002();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerNetworkingMessages_SteamAPI_v002", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerNetworkingMessages_SteamAPI_v002();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerNetworkingMessages_SteamAPI_v002();
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingMessages_SendMessageToUser", CallingConvention = Platform.CC)]
private static extern Result _SendMessageToUser( IntPtr self, ref NetIdentity identityRemote, [In,Out] IntPtr[] pubData, uint cubData, int nSendFlags, int nRemoteChannel );
#endregion
internal Result SendMessageToUser( ref NetIdentity identityRemote, [In,Out] IntPtr[] pubData, uint cubData, int nSendFlags, int nRemoteChannel )
{
var returnValue = _SendMessageToUser( Self, ref identityRemote, pubData, cubData, nSendFlags, nRemoteChannel );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingMessages_ReceiveMessagesOnChannel", CallingConvention = Platform.CC)]
private static extern int _ReceiveMessagesOnChannel( IntPtr self, int nLocalChannel, IntPtr ppOutMessages, int nMaxMessages );
#endregion
internal int ReceiveMessagesOnChannel( int nLocalChannel, IntPtr ppOutMessages, int nMaxMessages )
{
var returnValue = _ReceiveMessagesOnChannel( Self, nLocalChannel, ppOutMessages, nMaxMessages );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingMessages_AcceptSessionWithUser", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _AcceptSessionWithUser( IntPtr self, ref NetIdentity identityRemote );
#endregion
internal bool AcceptSessionWithUser( ref NetIdentity identityRemote )
{
var returnValue = _AcceptSessionWithUser( Self, ref identityRemote );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingMessages_CloseSessionWithUser", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _CloseSessionWithUser( IntPtr self, ref NetIdentity identityRemote );
#endregion
internal bool CloseSessionWithUser( ref NetIdentity identityRemote )
{
var returnValue = _CloseSessionWithUser( Self, ref identityRemote );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingMessages_CloseChannelWithUser", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _CloseChannelWithUser( IntPtr self, ref NetIdentity identityRemote, int nLocalChannel );
#endregion
internal bool CloseChannelWithUser( ref NetIdentity identityRemote, int nLocalChannel )
{
var returnValue = _CloseChannelWithUser( Self, ref identityRemote, nLocalChannel );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingMessages_GetSessionConnectionInfo", CallingConvention = Platform.CC)]
private static extern ConnectionState _GetSessionConnectionInfo( IntPtr self, ref NetIdentity identityRemote, ref ConnectionInfo pConnectionInfo, ref ConnectionStatus pQuickStatus );
#endregion
internal ConnectionState GetSessionConnectionInfo( ref NetIdentity identityRemote, ref ConnectionInfo pConnectionInfo, ref ConnectionStatus pQuickStatus )
{
var returnValue = _GetSessionConnectionInfo( Self, ref identityRemote, ref pConnectionInfo, ref pQuickStatus );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamNetworkingSockets : SteamInterface
internal unsafe class ISteamNetworkingSockets : SteamInterface
{
internal ISteamNetworkingSockets( bool IsGameServer )
@@ -15,12 +15,12 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingSockets_v008", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamNetworkingSockets_v008();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamNetworkingSockets_v008();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerNetworkingSockets_v008", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerNetworkingSockets_v008();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerNetworkingSockets_v008();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingSockets_SteamAPI_v012", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012();
#region FunctionMeta
@@ -47,23 +47,23 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2P", CallingConvention = Platform.CC)]
private static extern Socket _CreateListenSocketP2P( IntPtr self, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
private static extern Socket _CreateListenSocketP2P( IntPtr self, int nLocalVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion
internal Socket CreateListenSocketP2P( int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
internal Socket CreateListenSocketP2P( int nLocalVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{
var returnValue = _CreateListenSocketP2P( Self, nVirtualPort, nOptions, pOptions );
var returnValue = _CreateListenSocketP2P( Self, nLocalVirtualPort, nOptions, pOptions );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectP2P", CallingConvention = Platform.CC)]
private static extern Connection _ConnectP2P( IntPtr self, ref NetIdentity identityRemote, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
private static extern Connection _ConnectP2P( IntPtr self, ref NetIdentity identityRemote, int nRemoteVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion
internal Connection ConnectP2P( ref NetIdentity identityRemote, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
internal Connection ConnectP2P( ref NetIdentity identityRemote, int nRemoteVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{
var returnValue = _ConnectP2P( Self, ref identityRemote, nVirtualPort, nOptions, pOptions );
var returnValue = _ConnectP2P( Self, ref identityRemote, nRemoteVirtualPort, nOptions, pOptions );
return returnValue;
}
@@ -143,8 +143,7 @@ namespace Steamworks
#endregion
internal bool GetConnectionName( Connection hPeer, out string pszName )
{
using var memory = Helpers.TakeMemory();
IntPtr mempszName = memory;
using var mempszName = Helpers.TakeMemory();
var returnValue = _GetConnectionName( Self, hPeer, mempszName, (1024 * 32) );
pszName = Helpers.MemoryToString( mempszName );
return returnValue;
@@ -163,12 +162,12 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_SendMessages", CallingConvention = Platform.CC)]
private static extern void _SendMessages( IntPtr self, int nMessages, ref NetMsg pMessages, [In,Out] long[] pOutMessageNumberOrResult );
private static extern void _SendMessages( IntPtr self, int nMessages, NetMsg** pMessages, long* pOutMessageNumberOrResult );
#endregion
internal void SendMessages( int nMessages, ref NetMsg pMessages, [In,Out] long[] pOutMessageNumberOrResult )
internal void SendMessages( int nMessages, NetMsg** pMessages, long* pOutMessageNumberOrResult )
{
_SendMessages( Self, nMessages, ref pMessages, pOutMessageNumberOrResult );
_SendMessages( Self, nMessages, pMessages, pOutMessageNumberOrResult );
}
#region FunctionMeta
@@ -206,14 +205,13 @@ namespace Steamworks
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetQuickConnectionStatus", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetQuickConnectionStatus( IntPtr self, Connection hConn, ref SteamNetworkingQuickConnectionStatus pStats );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetConnectionRealTimeStatus", CallingConvention = Platform.CC)]
private static extern Result _GetConnectionRealTimeStatus( IntPtr self, Connection hConn, ref ConnectionStatus pStatus, int nLanes, [In,Out] ConnectionLaneStatus[]? pLanes );
#endregion
internal bool GetQuickConnectionStatus( Connection hConn, ref SteamNetworkingQuickConnectionStatus pStats )
internal Result GetConnectionRealTimeStatus( Connection hConn, ref ConnectionStatus pStatus, int nLanes, [In,Out] ConnectionLaneStatus[]? pLanes )
{
var returnValue = _GetQuickConnectionStatus( Self, hConn, ref pStats );
var returnValue = _GetConnectionRealTimeStatus( Self, hConn, ref pStatus, nLanes, pLanes );
return returnValue;
}
@@ -224,8 +222,7 @@ namespace Steamworks
#endregion
internal int GetDetailedConnectionStatus( Connection hConn, out string pszBuf )
{
using var memory = Helpers.TakeMemory();
IntPtr mempszBuf = memory;
using var mempszBuf = Helpers.TakeMemory();
var returnValue = _GetDetailedConnectionStatus( Self, hConn, mempszBuf, (1024 * 32) );
pszBuf = Helpers.MemoryToString( mempszBuf );
return returnValue;
@@ -255,6 +252,17 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConfigureConnectionLanes", CallingConvention = Platform.CC)]
private static extern Result _ConfigureConnectionLanes( IntPtr self, Connection hConn, int nNumLanes, [In,Out] int[] pLanePriorities, [In,Out] ushort[] pLaneWeights );
#endregion
internal Result ConfigureConnectionLanes( Connection hConn, int nNumLanes, [In,Out] int[] pLanePriorities, [In,Out] ushort[] pLaneWeights )
{
var returnValue = _ConfigureConnectionLanes( Self, hConn, nNumLanes, pLanePriorities, pLaneWeights );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetIdentity", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -349,23 +357,23 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_FindRelayAuthTicketForServer", CallingConvention = Platform.CC)]
private static extern int _FindRelayAuthTicketForServer( IntPtr self, ref NetIdentity identityGameServer, int nVirtualPort, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket );
private static extern int _FindRelayAuthTicketForServer( IntPtr self, ref NetIdentity identityGameServer, int nRemoteVirtualPort, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket );
#endregion
internal int FindRelayAuthTicketForServer( ref NetIdentity identityGameServer, int nVirtualPort, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket )
internal int FindRelayAuthTicketForServer( ref NetIdentity identityGameServer, int nRemoteVirtualPort, [In,Out] SteamDatagramRelayAuthTicket[] pOutParsedTicket )
{
var returnValue = _FindRelayAuthTicketForServer( Self, ref identityGameServer, nVirtualPort, pOutParsedTicket );
var returnValue = _FindRelayAuthTicketForServer( Self, ref identityGameServer, nRemoteVirtualPort, pOutParsedTicket );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectToHostedDedicatedServer", CallingConvention = Platform.CC)]
private static extern Connection _ConnectToHostedDedicatedServer( IntPtr self, ref NetIdentity identityTarget, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
private static extern Connection _ConnectToHostedDedicatedServer( IntPtr self, ref NetIdentity identityTarget, int nRemoteVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion
internal Connection ConnectToHostedDedicatedServer( ref NetIdentity identityTarget, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
internal Connection ConnectToHostedDedicatedServer( ref NetIdentity identityTarget, int nRemoteVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{
var returnValue = _ConnectToHostedDedicatedServer( Self, ref identityTarget, nVirtualPort, nOptions, pOptions );
var returnValue = _ConnectToHostedDedicatedServer( Self, ref identityTarget, nRemoteVirtualPort, nOptions, pOptions );
return returnValue;
}
@@ -404,12 +412,12 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateHostedDedicatedServerListenSocket", CallingConvention = Platform.CC)]
private static extern Socket _CreateHostedDedicatedServerListenSocket( IntPtr self, int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
private static extern Socket _CreateHostedDedicatedServerListenSocket( IntPtr self, int nLocalVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion
internal Socket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
internal Socket CreateHostedDedicatedServerListenSocket( int nLocalVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{
var returnValue = _CreateHostedDedicatedServerListenSocket( Self, nVirtualPort, nOptions, pOptions );
var returnValue = _CreateHostedDedicatedServerListenSocket( Self, nLocalVirtualPort, nOptions, pOptions );
return returnValue;
}
@@ -426,12 +434,12 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ConnectP2PCustomSignaling", CallingConvention = Platform.CC)]
private static extern Connection _ConnectP2PCustomSignaling( IntPtr self, IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nOptions, [In,Out] NetKeyValue[] pOptions );
private static extern Connection _ConnectP2PCustomSignaling( IntPtr self, IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nRemoteVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion
internal Connection ConnectP2PCustomSignaling( IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nOptions, [In,Out] NetKeyValue[] pOptions )
internal Connection ConnectP2PCustomSignaling( IntPtr pSignaling, ref NetIdentity pPeerIdentity, int nRemoteVirtualPort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{
var returnValue = _ConnectP2PCustomSignaling( Self, pSignaling, ref pPeerIdentity, nOptions, pOptions );
var returnValue = _ConnectP2PCustomSignaling( Self, pSignaling, ref pPeerIdentity, nRemoteVirtualPort, nOptions, pOptions );
return returnValue;
}
@@ -471,5 +479,80 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_ResetIdentity", CallingConvention = Platform.CC)]
private static extern void _ResetIdentity( IntPtr self, ref NetIdentity pIdentity );
#endregion
internal void ResetIdentity( ref NetIdentity pIdentity )
{
_ResetIdentity( Self, ref pIdentity );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_RunCallbacks", CallingConvention = Platform.CC)]
private static extern void _RunCallbacks( IntPtr self );
#endregion
internal void RunCallbacks()
{
_RunCallbacks( Self );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_BeginAsyncRequestFakeIP", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BeginAsyncRequestFakeIP( IntPtr self, int nNumPorts );
#endregion
internal bool BeginAsyncRequestFakeIP( int nNumPorts )
{
var returnValue = _BeginAsyncRequestFakeIP( Self, nNumPorts );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetFakeIP", CallingConvention = Platform.CC)]
private static extern void _GetFakeIP( IntPtr self, int idxFirstPort, ref SteamNetworkingFakeIPResult_t pInfo );
#endregion
internal void GetFakeIP( int idxFirstPort, ref SteamNetworkingFakeIPResult_t pInfo )
{
_GetFakeIP( Self, idxFirstPort, ref pInfo );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2PFakeIP", CallingConvention = Platform.CC)]
private static extern Socket _CreateListenSocketP2PFakeIP( IntPtr self, int idxFakePort, int nOptions, [In,Out] NetKeyValue[] pOptions );
#endregion
internal Socket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, [In,Out] NetKeyValue[] pOptions )
{
var returnValue = _CreateListenSocketP2PFakeIP( Self, idxFakePort, nOptions, pOptions );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetRemoteFakeIPForConnection", CallingConvention = Platform.CC)]
private static extern Result _GetRemoteFakeIPForConnection( IntPtr self, Connection hConn, [In,Out] NetAddress[] pOutAddr );
#endregion
internal Result GetRemoteFakeIPForConnection( Connection hConn, [In,Out] NetAddress[] pOutAddr )
{
var returnValue = _GetRemoteFakeIPForConnection( Self, hConn, pOutAddr );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_CreateFakeUDPPort", CallingConvention = Platform.CC)]
private static extern IntPtr _CreateFakeUDPPort( IntPtr self, int idxFakeServerPort );
#endregion
internal IntPtr CreateFakeUDPPort( int idxFakeServerPort )
{
var returnValue = _CreateFakeUDPPort( Self, idxFakeServerPort );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamNetworkingUtils : SteamInterface
internal unsafe class ISteamNetworkingUtils : SteamInterface
{
internal ISteamNetworkingUtils( bool IsGameServer )
@@ -15,20 +15,20 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingUtils_v003", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamNetworkingUtils_v003();
public override IntPtr GetGlobalInterfacePointer() => SteamAPI_SteamNetworkingUtils_v003();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingUtils_SteamAPI_v004", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamNetworkingUtils_SteamAPI_v004();
public override IntPtr GetGlobalInterfacePointer() => SteamAPI_SteamNetworkingUtils_SteamAPI_v004();
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_AllocateMessage", CallingConvention = Platform.CC)]
private static extern IntPtr _AllocateMessage( IntPtr self, int cbAllocateBuffer );
private static extern NetMsg* _AllocateMessage( IntPtr self, int cbAllocateBuffer );
#endregion
internal NetMsg AllocateMessage( int cbAllocateBuffer )
internal NetMsg* AllocateMessage( int cbAllocateBuffer )
{
var returnValue = _AllocateMessage( Self, cbAllocateBuffer );
return returnValue.ToType<NetMsg>();
return returnValue;
}
#region FunctionMeta
@@ -92,8 +92,7 @@ namespace Steamworks
#endregion
internal void ConvertPingLocationToString( ref NetPingLocation location, out string pszBuf )
{
using var memory = Helpers.TakeMemory();
IntPtr mempszBuf = memory;
using var mempszBuf = Helpers.TakeMemory();
_ConvertPingLocationToString( Self, ref location, mempszBuf, (1024 * 32) );
pszBuf = Helpers.MemoryToString( mempszBuf );
}
@@ -187,6 +186,40 @@ namespace Steamworks
_SetDebugOutputFunction( Self, eDetailLevel, pfnFunc );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_IsFakeIPv4", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _IsFakeIPv4( IntPtr self, uint nIPv4 );
#endregion
internal bool IsFakeIPv4( uint nIPv4 )
{
var returnValue = _IsFakeIPv4( Self, nIPv4 );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetIPv4FakeIPType", CallingConvention = Platform.CC)]
private static extern SteamNetworkingFakeIPType _GetIPv4FakeIPType( IntPtr self, uint nIPv4 );
#endregion
internal SteamNetworkingFakeIPType GetIPv4FakeIPType( uint nIPv4 )
{
var returnValue = _GetIPv4FakeIPType( Self, nIPv4 );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetRealIdentityForFakeIP", CallingConvention = Platform.CC)]
private static extern Result _GetRealIdentityForFakeIP( IntPtr self, ref NetAddress fakeIP, [In,Out] NetIdentity[] pOutRealIdentity );
#endregion
internal Result GetRealIdentityForFakeIP( ref NetAddress fakeIP, [In,Out] NetIdentity[] pOutRealIdentity )
{
var returnValue = _GetRealIdentityForFakeIP( Self, ref fakeIP, pOutRealIdentity );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValueInt32", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -223,6 +256,18 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValuePtr", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalConfigValuePtr( IntPtr self, NetConfig eValue, IntPtr val );
#endregion
internal bool SetGlobalConfigValuePtr( NetConfig eValue, IntPtr val )
{
var returnValue = _SetGlobalConfigValuePtr( Self, eValue, val );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetConnectionConfigValueInt32", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -259,6 +304,78 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalCallback_SteamNetConnectionStatusChanged( IntPtr self, FnSteamNetConnectionStatusChanged fnCallback );
#endregion
internal bool SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback )
{
var returnValue = _SetGlobalCallback_SteamNetConnectionStatusChanged( Self, fnCallback );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetAuthenticationStatusChanged", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalCallback_SteamNetAuthenticationStatusChanged( IntPtr self, FnSteamNetAuthenticationStatusChanged fnCallback );
#endregion
internal bool SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback )
{
var returnValue = _SetGlobalCallback_SteamNetAuthenticationStatusChanged( Self, fnCallback );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamRelayNetworkStatusChanged", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalCallback_SteamRelayNetworkStatusChanged( IntPtr self, FnSteamRelayNetworkStatusChanged fnCallback );
#endregion
internal bool SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback )
{
var returnValue = _SetGlobalCallback_SteamRelayNetworkStatusChanged( Self, fnCallback );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_FakeIPResult", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalCallback_FakeIPResult( IntPtr self, FnSteamNetworkingFakeIPResult fnCallback );
#endregion
internal bool SetGlobalCallback_FakeIPResult( FnSteamNetworkingFakeIPResult fnCallback )
{
var returnValue = _SetGlobalCallback_FakeIPResult( Self, fnCallback );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_MessagesSessionRequest", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalCallback_MessagesSessionRequest( IntPtr self, FnSteamNetworkingMessagesSessionRequest fnCallback );
#endregion
internal bool SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback )
{
var returnValue = _SetGlobalCallback_MessagesSessionRequest( Self, fnCallback );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_MessagesSessionFailed", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetGlobalCallback_MessagesSessionFailed( IntPtr self, FnSteamNetworkingMessagesSessionFailed fnCallback );
#endregion
internal bool SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback )
{
var returnValue = _SetGlobalCallback_MessagesSessionFailed( Self, fnCallback );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetConfigValue", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -296,24 +413,23 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetConfigValueInfo", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetConfigValueInfo( IntPtr self, NetConfig eValue, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pOutName, ref NetConfigType pOutDataType, [In,Out] NetConfigScope[] pOutScope, [In,Out] NetConfig[] pOutNextValue );
private static extern Utf8StringPointer _GetConfigValueInfo( IntPtr self, NetConfig eValue, ref NetConfigType pOutDataType, [In,Out] NetConfigScope[] pOutScope );
#endregion
internal bool GetConfigValueInfo( NetConfig eValue, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pOutName, ref NetConfigType pOutDataType, [In,Out] NetConfigScope[] pOutScope, [In,Out] NetConfig[] pOutNextValue )
internal string GetConfigValueInfo( NetConfig eValue, ref NetConfigType pOutDataType, [In,Out] NetConfigScope[] pOutScope )
{
var returnValue = _GetConfigValueInfo( Self, eValue, pOutName, ref pOutDataType, pOutScope, pOutNextValue );
var returnValue = _GetConfigValueInfo( Self, eValue, ref pOutDataType, pOutScope );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetFirstConfigValue", CallingConvention = Platform.CC)]
private static extern NetConfig _GetFirstConfigValue( IntPtr self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_IterateGenericEditableConfigValues", CallingConvention = Platform.CC)]
private static extern NetConfig _IterateGenericEditableConfigValues( IntPtr self, NetConfig eCurrent, [MarshalAs( UnmanagedType.U1 )] bool bEnumerateDevVars );
#endregion
internal NetConfig GetFirstConfigValue()
internal NetConfig IterateGenericEditableConfigValues( NetConfig eCurrent, [MarshalAs( UnmanagedType.U1 )] bool bEnumerateDevVars )
{
var returnValue = _GetFirstConfigValue( Self );
var returnValue = _IterateGenericEditableConfigValues( Self, eCurrent, bEnumerateDevVars );
return returnValue;
}
@@ -324,8 +440,7 @@ namespace Steamworks
#endregion
internal void SteamNetworkingIPAddr_ToString( ref NetAddress addr, out string buf, [MarshalAs( UnmanagedType.U1 )] bool bWithPort )
{
using var memory = Helpers.TakeMemory();
IntPtr membuf = memory;
using var membuf = Helpers.TakeMemory();
_SteamNetworkingIPAddr_ToString( Self, ref addr, membuf, (1024 * 32), bWithPort );
buf = Helpers.MemoryToString( membuf );
}
@@ -342,6 +457,17 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SteamNetworkingIPAddr_GetFakeIPType", CallingConvention = Platform.CC)]
private static extern SteamNetworkingFakeIPType _SteamNetworkingIPAddr_GetFakeIPType( IntPtr self, ref NetAddress addr );
#endregion
internal SteamNetworkingFakeIPType SteamNetworkingIPAddr_GetFakeIPType( ref NetAddress addr )
{
var returnValue = _SteamNetworkingIPAddr_GetFakeIPType( Self, ref addr );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SteamNetworkingIdentity_ToString", CallingConvention = Platform.CC)]
private static extern void _SteamNetworkingIdentity_ToString( IntPtr self, ref NetIdentity identity, IntPtr buf, uint cbBuf );
@@ -349,8 +475,7 @@ namespace Steamworks
#endregion
internal void SteamNetworkingIdentity_ToString( ref NetIdentity identity, out string buf )
{
using var memory = Helpers.TakeMemory();
IntPtr membuf = memory;
using var membuf = Helpers.TakeMemory();
_SteamNetworkingIdentity_ToString( Self, ref identity, membuf, (1024 * 32) );
buf = Helpers.MemoryToString( membuf );
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamParentalSettings : SteamInterface
internal unsafe class ISteamParentalSettings : SteamInterface
{
internal ISteamParentalSettings( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamParties : SteamInterface
internal unsafe class ISteamParties : SteamInterface
{
internal ISteamParties( bool IsGameServer )
@@ -50,8 +50,7 @@ namespace Steamworks
#endregion
internal bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, ref SteamId pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t pLocation, out string pchMetadata )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchMetadata = memory;
using var mempchMetadata = Helpers.TakeMemory();
var returnValue = _GetBeaconDetails( Self, ulBeaconID, ref pSteamIDBeaconOwner, ref pLocation, mempchMetadata, (1024 * 32) );
pchMetadata = Helpers.MemoryToString( mempchMetadata );
return returnValue;
@@ -154,8 +153,7 @@ namespace Steamworks
#endregion
internal bool GetBeaconLocationData( SteamPartyBeaconLocation_t BeaconLocation, SteamPartyBeaconLocationData eData, out string pchDataStringOut )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchDataStringOut = memory;
using var mempchDataStringOut = Helpers.TakeMemory();
var returnValue = _GetBeaconLocationData( Self, BeaconLocation, eData, mempchDataStringOut, (1024 * 32) );
pchDataStringOut = Helpers.MemoryToString( mempchDataStringOut );
return returnValue;

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamRemotePlay : SteamInterface
internal unsafe class ISteamRemotePlay : SteamInterface
{
internal ISteamRemotePlay( bool IsGameServer )

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamRemoteStorage : SteamInterface
internal unsafe class ISteamRemoteStorage : SteamInterface
{
internal ISteamRemoteStorage( bool IsGameServer )
@@ -15,9 +15,9 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamRemoteStorage_v014", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamRemoteStorage_v014();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamRemoteStorage_v014();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamRemoteStorage_v016", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamRemoteStorage_v016();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamRemoteStorage_v016();
#region FunctionMeta
@@ -375,5 +375,51 @@ namespace Steamworks
return new CallResult<RemoteStorageDownloadUGCResult_t>( returnValue, IsServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamRemoteStorage_GetLocalFileChangeCount", CallingConvention = Platform.CC)]
private static extern int _GetLocalFileChangeCount( IntPtr self );
#endregion
internal int GetLocalFileChangeCount()
{
var returnValue = _GetLocalFileChangeCount( Self );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamRemoteStorage_GetLocalFileChange", CallingConvention = Platform.CC)]
private static extern Utf8StringPointer _GetLocalFileChange( IntPtr self, int iFile, ref RemoteStorageLocalFileChange pEChangeType, ref RemoteStorageFilePathType pEFilePathType );
#endregion
internal string GetLocalFileChange( int iFile, ref RemoteStorageLocalFileChange pEChangeType, ref RemoteStorageFilePathType pEFilePathType )
{
var returnValue = _GetLocalFileChange( Self, iFile, ref pEChangeType, ref pEFilePathType );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamRemoteStorage_BeginFileWriteBatch", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BeginFileWriteBatch( IntPtr self );
#endregion
internal bool BeginFileWriteBatch()
{
var returnValue = _BeginFileWriteBatch( Self );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamRemoteStorage_EndFileWriteBatch", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _EndFileWriteBatch( IntPtr self );
#endregion
internal bool EndFileWriteBatch()
{
var returnValue = _EndFileWriteBatch( Self );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamScreenshots : SteamInterface
internal unsafe class ISteamScreenshots : SteamInterface
{
internal ISteamScreenshots( bool IsGameServer )

View File

@@ -1,97 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal class ISteamTV : SteamInterface
{
internal ISteamTV( bool IsGameServer )
{
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamTV_v001", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamTV_v001();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamTV_v001();
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_IsBroadcasting", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _IsBroadcasting( IntPtr self, ref int pnNumViewers );
#endregion
internal bool IsBroadcasting( ref int pnNumViewers )
{
var returnValue = _IsBroadcasting( Self, ref pnNumViewers );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_AddBroadcastGameData", CallingConvention = Platform.CC)]
private static extern void _AddBroadcastGameData( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValue );
#endregion
internal void AddBroadcastGameData( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchValue )
{
_AddBroadcastGameData( Self, pchKey, pchValue );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_RemoveBroadcastGameData", CallingConvention = Platform.CC)]
private static extern void _RemoveBroadcastGameData( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey );
#endregion
internal void RemoveBroadcastGameData( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey )
{
_RemoveBroadcastGameData( Self, pchKey );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_AddTimelineMarker", CallingConvention = Platform.CC)]
private static extern void _AddTimelineMarker( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchTemplateName, [MarshalAs( UnmanagedType.U1 )] bool bPersistent, byte nColorR, byte nColorG, byte nColorB );
#endregion
internal void AddTimelineMarker( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchTemplateName, [MarshalAs( UnmanagedType.U1 )] bool bPersistent, byte nColorR, byte nColorG, byte nColorB )
{
_AddTimelineMarker( Self, pchTemplateName, bPersistent, nColorR, nColorG, nColorB );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_RemoveTimelineMarker", CallingConvention = Platform.CC)]
private static extern void _RemoveTimelineMarker( IntPtr self );
#endregion
internal void RemoveTimelineMarker()
{
_RemoveTimelineMarker( Self );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_AddRegion", CallingConvention = Platform.CC)]
private static extern uint _AddRegion( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchElementName, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchTimelineDataSection, ref SteamTVRegion_t pSteamTVRegion, SteamTVRegionBehavior eSteamTVRegionBehavior );
#endregion
internal uint AddRegion( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchElementName, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchTimelineDataSection, ref SteamTVRegion_t pSteamTVRegion, SteamTVRegionBehavior eSteamTVRegionBehavior )
{
var returnValue = _AddRegion( Self, pchElementName, pchTimelineDataSection, ref pSteamTVRegion, eSteamTVRegionBehavior );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamTV_RemoveRegion", CallingConvention = Platform.CC)]
private static extern void _RemoveRegion( IntPtr self, uint unRegionHandle );
#endregion
internal void RemoveRegion( uint unRegionHandle )
{
_RemoveRegion( Self, unRegionHandle );
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamUGC : SteamInterface
internal unsafe class ISteamUGC : SteamInterface
{
internal ISteamUGC( bool IsGameServer )
@@ -15,12 +15,12 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUGC_v014", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUGC_v014();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUGC_v014();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerUGC_v014", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerUGC_v014();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerUGC_v014();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUGC_v017", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUGC_v017();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUGC_v017();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerUGC_v017", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerUGC_v017();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerUGC_v017();
#region FunctionMeta
@@ -90,6 +90,45 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCNumTags", CallingConvention = Platform.CC)]
private static extern uint _GetQueryUGCNumTags( IntPtr self, UGCQueryHandle_t handle, uint index );
#endregion
internal uint GetQueryUGCNumTags( UGCQueryHandle_t handle, uint index )
{
var returnValue = _GetQueryUGCNumTags( Self, handle, index );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCTag", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetQueryUGCTag( IntPtr self, UGCQueryHandle_t handle, uint index, uint indexTag, IntPtr pchValue, uint cchValueSize );
#endregion
internal bool GetQueryUGCTag( UGCQueryHandle_t handle, uint index, uint indexTag, out string pchValue )
{
using var mempchValue = Helpers.TakeMemory();
var returnValue = _GetQueryUGCTag( Self, handle, index, indexTag, mempchValue, (1024 * 32) );
pchValue = Helpers.MemoryToString( mempchValue );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCTagDisplayName", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetQueryUGCTagDisplayName( IntPtr self, UGCQueryHandle_t handle, uint index, uint indexTag, IntPtr pchValue, uint cchValueSize );
#endregion
internal bool GetQueryUGCTagDisplayName( UGCQueryHandle_t handle, uint index, uint indexTag, out string pchValue )
{
using var mempchValue = Helpers.TakeMemory();
var returnValue = _GetQueryUGCTagDisplayName( Self, handle, index, indexTag, mempchValue, (1024 * 32) );
pchValue = Helpers.MemoryToString( mempchValue );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCPreviewURL", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -98,8 +137,7 @@ namespace Steamworks
#endregion
internal bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint index, out string pchURL )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchURL = memory;
using var mempchURL = Helpers.TakeMemory();
var returnValue = _GetQueryUGCPreviewURL( Self, handle, index, mempchURL, (1024 * 32) );
pchURL = Helpers.MemoryToString( mempchURL );
return returnValue;
@@ -113,8 +151,7 @@ namespace Steamworks
#endregion
internal bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint index, out string pchMetadata )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchMetadata = memory;
using var mempchMetadata = Helpers.TakeMemory();
var returnValue = _GetQueryUGCMetadata( Self, handle, index, mempchMetadata, (1024 * 32) );
pchMetadata = Helpers.MemoryToString( mempchMetadata );
return returnValue;
@@ -163,10 +200,8 @@ namespace Steamworks
#endregion
internal bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint index, uint previewIndex, out string pchURLOrVideoID, out string pchOriginalFileName, ref ItemPreviewType pPreviewType )
{
using var memoryUrlOrId = Helpers.TakeMemory();
using var memoryFileName = Helpers.TakeMemory();
IntPtr mempchURLOrVideoID = memoryUrlOrId;
IntPtr mempchOriginalFileName = memoryFileName;
using var mempchURLOrVideoID = Helpers.TakeMemory();
using var mempchOriginalFileName = Helpers.TakeMemory();
var returnValue = _GetQueryUGCAdditionalPreview( Self, handle, index, previewIndex, mempchURLOrVideoID, (1024 * 32), mempchOriginalFileName, (1024 * 32), ref pPreviewType );
pchURLOrVideoID = Helpers.MemoryToString( mempchURLOrVideoID );
pchOriginalFileName = Helpers.MemoryToString( mempchOriginalFileName );
@@ -192,10 +227,8 @@ namespace Steamworks
#endregion
internal bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint index, uint keyValueTagIndex, out string pchKey, out string pchValue )
{
using var memoryKey = Helpers.TakeMemory();
using var memoryValue = Helpers.TakeMemory();
IntPtr mempchKey = memoryKey;
IntPtr mempchValue = memoryValue;
using var mempchKey = Helpers.TakeMemory();
using var mempchValue = Helpers.TakeMemory();
var returnValue = _GetQueryUGCKeyValueTag( Self, handle, index, keyValueTagIndex, mempchKey, (1024 * 32), mempchValue, (1024 * 32) );
pchKey = Helpers.MemoryToString( mempchKey );
pchValue = Helpers.MemoryToString( mempchValue );
@@ -210,13 +243,23 @@ namespace Steamworks
#endregion
internal bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint index, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchKey, out string pchValue )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchValue = memory;
using var mempchValue = Helpers.TakeMemory();
var returnValue = _GetQueryUGCKeyValueTag( Self, handle, index, pchKey, mempchValue, (1024 * 32) );
pchValue = Helpers.MemoryToString( mempchValue );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_GetQueryUGCContentDescriptors", CallingConvention = Platform.CC)]
private static extern uint _GetQueryUGCContentDescriptors( IntPtr self, UGCQueryHandle_t handle, uint index, [In,Out] UGCContentDescriptorID[] pvecDescriptors, uint cMaxEntries );
#endregion
internal uint GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint index, [In,Out] UGCContentDescriptorID[] pvecDescriptors, uint cMaxEntries )
{
var returnValue = _GetQueryUGCContentDescriptors( Self, handle, index, pvecDescriptors, cMaxEntries );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_ReleaseQueryUGCRequest", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -433,6 +476,30 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_SetTimeCreatedDateRange", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetTimeCreatedDateRange( IntPtr self, UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd );
#endregion
internal bool SetTimeCreatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd )
{
var returnValue = _SetTimeCreatedDateRange( Self, handle, rtStart, rtEnd );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_SetTimeUpdatedDateRange", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetTimeUpdatedDateRange( IntPtr self, UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd );
#endregion
internal bool SetTimeUpdatedDateRange( UGCQueryHandle_t handle, RTime32 rtStart, RTime32 rtEnd )
{
var returnValue = _SetTimeUpdatedDateRange( Self, handle, rtStart, rtEnd );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_AddRequiredKeyValueTag", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
@@ -671,6 +738,30 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_AddContentDescriptor", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _AddContentDescriptor( IntPtr self, UGCUpdateHandle_t handle, UGCContentDescriptorID descid );
#endregion
internal bool AddContentDescriptor( UGCUpdateHandle_t handle, UGCContentDescriptorID descid )
{
var returnValue = _AddContentDescriptor( Self, handle, descid );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_RemoveContentDescriptor", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _RemoveContentDescriptor( IntPtr self, UGCUpdateHandle_t handle, UGCContentDescriptorID descid );
#endregion
internal bool RemoveContentDescriptor( UGCUpdateHandle_t handle, UGCContentDescriptorID descid )
{
var returnValue = _RemoveContentDescriptor( Self, handle, descid );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_SubmitItemUpdate", CallingConvention = Platform.CC)]
private static extern SteamAPICall_t _SubmitItemUpdate( IntPtr self, UGCUpdateHandle_t handle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchChangeNote );
@@ -800,8 +891,7 @@ namespace Steamworks
#endregion
internal bool GetItemInstallInfo( PublishedFileId nPublishedFileID, ref ulong punSizeOnDisk, out string pchFolder, ref uint punTimeStamp )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchFolder = memory;
using var mempchFolder = Helpers.TakeMemory();
var returnValue = _GetItemInstallInfo( Self, nPublishedFileID, ref punSizeOnDisk, mempchFolder, (1024 * 32), ref punTimeStamp );
pchFolder = Helpers.MemoryToString( mempchFolder );
return returnValue;
@@ -952,5 +1042,28 @@ namespace Steamworks
return new CallResult<DeleteItemResult_t>( returnValue, IsServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_ShowWorkshopEULA", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _ShowWorkshopEULA( IntPtr self );
#endregion
internal bool ShowWorkshopEULA()
{
var returnValue = _ShowWorkshopEULA( Self );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUGC_GetWorkshopEULAStatus", CallingConvention = Platform.CC)]
private static extern SteamAPICall_t _GetWorkshopEULAStatus( IntPtr self );
#endregion
internal CallResult<WorkshopEULAStatus_t> GetWorkshopEULAStatus()
{
var returnValue = _GetWorkshopEULAStatus( Self );
return new CallResult<WorkshopEULAStatus_t>( returnValue, IsServer );
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamUser : SteamInterface
internal unsafe class ISteamUser : SteamInterface
{
internal ISteamUser( bool IsGameServer )
@@ -15,9 +15,9 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUser_v020", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUser_v020();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUser_v020();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUser_v023", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUser_v023();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUser_v023();
#region FunctionMeta
@@ -55,24 +55,24 @@ namespace Steamworks
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_InitiateGameConnection", CallingConvention = Platform.CC)]
private static extern int _InitiateGameConnection( IntPtr self, IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_InitiateGameConnection_DEPRECATED", CallingConvention = Platform.CC)]
private static extern int _InitiateGameConnection_DEPRECATED( IntPtr self, IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure );
#endregion
internal int InitiateGameConnection( IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure )
internal int InitiateGameConnection_DEPRECATED( IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure )
{
var returnValue = _InitiateGameConnection( Self, pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure );
var returnValue = _InitiateGameConnection_DEPRECATED( Self, pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_TerminateGameConnection", CallingConvention = Platform.CC)]
private static extern void _TerminateGameConnection( IntPtr self, uint unIPServer, ushort usPortServer );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_TerminateGameConnection_DEPRECATED", CallingConvention = Platform.CC)]
private static extern void _TerminateGameConnection_DEPRECATED( IntPtr self, uint unIPServer, ushort usPortServer );
#endregion
internal void TerminateGameConnection( uint unIPServer, ushort usPortServer )
internal void TerminateGameConnection_DEPRECATED( uint unIPServer, ushort usPortServer )
{
_TerminateGameConnection( Self, unIPServer, usPortServer );
_TerminateGameConnection_DEPRECATED( Self, unIPServer, usPortServer );
}
#region FunctionMeta
@@ -93,8 +93,7 @@ namespace Steamworks
#endregion
internal bool GetUserDataFolder( out string pchBuffer )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchBuffer = memory;
using var mempchBuffer = Helpers.TakeMemory();
var returnValue = _GetUserDataFolder( Self, mempchBuffer, (1024 * 32) );
pchBuffer = Helpers.MemoryToString( mempchBuffer );
return returnValue;
@@ -166,12 +165,23 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_GetAuthSessionTicket", CallingConvention = Platform.CC)]
private static extern HAuthTicket _GetAuthSessionTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket );
private static extern HAuthTicket _GetAuthSessionTicket( IntPtr self, IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket, ref NetIdentity pSteamNetworkingIdentity );
#endregion
internal HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket )
internal HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref uint pcbTicket, ref NetIdentity pSteamNetworkingIdentity )
{
var returnValue = _GetAuthSessionTicket( Self, pTicket, cbMaxTicket, ref pcbTicket );
var returnValue = _GetAuthSessionTicket( Self, pTicket, cbMaxTicket, ref pcbTicket, ref pSteamNetworkingIdentity );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_GetAuthTicketForWebApi", CallingConvention = Platform.CC)]
private static extern HAuthTicket _GetAuthTicketForWebApi( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchIdentity );
#endregion
internal HAuthTicket GetAuthTicketForWebApi( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchIdentity )
{
var returnValue = _GetAuthTicketForWebApi( Self, pchIdentity );
return returnValue;
}
@@ -365,5 +375,17 @@ namespace Steamworks
return new CallResult<DurationControl_t>( returnValue, IsServer );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUser_BSetDurationControlOnlineState", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _BSetDurationControlOnlineState( IntPtr self, DurationControlOnlineState eNewState );
#endregion
internal bool BSetDurationControlOnlineState( DurationControlOnlineState eNewState )
{
var returnValue = _BSetDurationControlOnlineState( Self, eNewState );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamUserStats : SteamInterface
internal unsafe class ISteamUserStats : SteamInterface
{
internal ISteamUserStats( bool IsGameServer )
@@ -15,9 +15,9 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUserStats_v011", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUserStats_v011();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUserStats_v011();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUserStats_v012", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUserStats_v012();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUserStats_v012();
#region FunctionMeta
@@ -361,9 +361,6 @@ namespace Steamworks
private static extern SteamAPICall_t _DownloadLeaderboardEntriesForUsers( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers );
#endregion
/// <summary>
/// Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers
/// </summary>
internal CallResult<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers )
{
var returnValue = _DownloadLeaderboardEntriesForUsers( Self, hSteamLeaderboard, prgUsers, cUsers );
@@ -433,8 +430,7 @@ namespace Steamworks
#endregion
internal int GetMostAchievedAchievementInfo( out string pchName, ref float pflPercent, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchName = memory;
using var mempchName = Helpers.TakeMemory();
var returnValue = _GetMostAchievedAchievementInfo( Self, mempchName, (1024 * 32), ref pflPercent, ref pbAchieved );
pchName = Helpers.MemoryToString( mempchName );
return returnValue;
@@ -447,8 +443,7 @@ namespace Steamworks
#endregion
internal int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, out string pchName, ref float pflPercent, [MarshalAs( UnmanagedType.U1 )] ref bool pbAchieved )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchName = memory;
using var mempchName = Helpers.TakeMemory();
var returnValue = _GetNextMostAchievedAchievementInfo( Self, iIteratorPrevious, mempchName, (1024 * 32), ref pflPercent, ref pbAchieved );
pchName = Helpers.MemoryToString( mempchName );
return returnValue;
@@ -523,5 +518,29 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementProgressLimitsInt32", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetAchievementProgressLimits( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pnMinProgress, ref int pnMaxProgress );
#endregion
internal bool GetAchievementProgressLimits( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref int pnMinProgress, ref int pnMaxProgress )
{
var returnValue = _GetAchievementProgressLimits( Self, pchName, ref pnMinProgress, ref pnMaxProgress );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUserStats_GetAchievementProgressLimitsFloat", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetAchievementProgressLimits( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pfMinProgress, ref float pfMaxProgress );
#endregion
internal bool GetAchievementProgressLimits( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, ref float pfMinProgress, ref float pfMaxProgress )
{
var returnValue = _GetAchievementProgressLimits( Self, pchName, ref pfMinProgress, ref pfMaxProgress );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamUtils : SteamInterface
internal unsafe class ISteamUtils : SteamInterface
{
internal ISteamUtils( bool IsGameServer )
@@ -15,12 +15,12 @@ namespace Steamworks
SetupInterface( IsGameServer );
}
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUtils_v009", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUtils_v009();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUtils_v009();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerUtils_v009", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerUtils_v009();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerUtils_v009();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamUtils_v010", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamUtils_v010();
public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamUtils_v010();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamGameServerUtils_v010", CallingConvention = Platform.CC)]
internal static extern IntPtr SteamAPI_SteamGameServerUtils_v010();
public override IntPtr GetServerInterfacePointer() => SteamAPI_SteamGameServerUtils_v010();
#region FunctionMeta
@@ -102,18 +102,6 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_GetCSERIPPort", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetCSERIPPort( IntPtr self, ref uint unIP, ref ushort usPort );
#endregion
internal bool GetCSERIPPort( ref uint unIP, ref ushort usPort )
{
var returnValue = _GetCSERIPPort( Self, ref unIP, ref usPort );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_GetCurrentBatteryPower", CallingConvention = Platform.CC)]
private static extern byte _GetCurrentBatteryPower( IntPtr self );
@@ -268,8 +256,7 @@ namespace Steamworks
#endregion
internal bool GetEnteredGamepadTextInput( out string pchText )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchText = memory;
using var mempchText = Helpers.TakeMemory();
var returnValue = _GetEnteredGamepadTextInput( Self, mempchText, (1024 * 32) );
pchText = Helpers.MemoryToString( mempchText );
return returnValue;
@@ -367,25 +354,24 @@ namespace Steamworks
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_InitFilterText", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _InitFilterText( IntPtr self );
private static extern bool _InitFilterText( IntPtr self, uint unFilterOptions );
#endregion
internal bool InitFilterText()
internal bool InitFilterText( uint unFilterOptions )
{
var returnValue = _InitFilterText( Self );
var returnValue = _InitFilterText( Self, unFilterOptions );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_FilterText", CallingConvention = Platform.CC)]
private static extern int _FilterText( IntPtr self, IntPtr pchOutFilteredText, uint nByteSizeOutFilteredText, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchInputMessage, [MarshalAs( UnmanagedType.U1 )] bool bLegalOnly );
private static extern int _FilterText( IntPtr self, TextFilteringContext eContext, SteamId sourceSteamID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchInputMessage, IntPtr pchOutFilteredText, uint nByteSizeOutFilteredText );
#endregion
internal int FilterText( out string pchOutFilteredText, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchInputMessage, [MarshalAs( UnmanagedType.U1 )] bool bLegalOnly )
internal int FilterText( TextFilteringContext eContext, SteamId sourceSteamID, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchInputMessage, out string pchOutFilteredText )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchOutFilteredText = memory;
var returnValue = _FilterText( Self, mempchOutFilteredText, (1024 * 32), pchInputMessage, bLegalOnly );
using var mempchOutFilteredText = Helpers.TakeMemory();
var returnValue = _FilterText( Self, eContext, sourceSteamID, pchInputMessage, mempchOutFilteredText, (1024 * 32) );
pchOutFilteredText = Helpers.MemoryToString( mempchOutFilteredText );
return returnValue;
}
@@ -401,5 +387,51 @@ namespace Steamworks
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_IsSteamRunningOnSteamDeck", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _IsSteamRunningOnSteamDeck( IntPtr self );
#endregion
internal bool IsSteamRunningOnSteamDeck()
{
var returnValue = _IsSteamRunningOnSteamDeck( Self );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_ShowFloatingGamepadTextInput", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _ShowFloatingGamepadTextInput( IntPtr self, TextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight );
#endregion
internal bool ShowFloatingGamepadTextInput( TextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight )
{
var returnValue = _ShowFloatingGamepadTextInput( Self, eKeyboardMode, nTextFieldXPosition, nTextFieldYPosition, nTextFieldWidth, nTextFieldHeight );
return returnValue;
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_SetGameLauncherMode", CallingConvention = Platform.CC)]
private static extern void _SetGameLauncherMode( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bLauncherMode );
#endregion
internal void SetGameLauncherMode( [MarshalAs( UnmanagedType.U1 )] bool bLauncherMode )
{
_SetGameLauncherMode( Self, bLauncherMode );
}
#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUtils_DismissFloatingGamepadTextInput", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _DismissFloatingGamepadTextInput( IntPtr self );
#endregion
internal bool DismissFloatingGamepadTextInput()
{
var returnValue = _DismissFloatingGamepadTextInput( Self );
return returnValue;
}
}
}

View File

@@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks
{
internal class ISteamVideo : SteamInterface
internal unsafe class ISteamVideo : SteamInterface
{
internal ISteamVideo( bool IsGameServer )
@@ -60,8 +60,7 @@ namespace Steamworks
#endregion
internal bool GetOPFStringForApp( AppId unVideoAppID, out string pchBuffer, ref int pnBufferSize )
{
using var memory = Helpers.TakeMemory();
IntPtr mempchBuffer = memory;
using var mempchBuffer = Helpers.TakeMemory();
var returnValue = _GetOPFStringForApp( Self, unVideoAppID, mempchBuffer, ref pnBufferSize );
pchBuffer = Helpers.MemoryToString( mempchBuffer );
return returnValue;

View File

@@ -206,6 +206,22 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct GetTicketForWebApiResponse_t : ICallbackData
{
internal uint AuthTicket; // m_hAuthTicket HAuthTicket
internal Result Result; // m_eResult EResult
internal int Ticket; // m_cubTicket int
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2560)] // m_rgubTicket
internal byte[] GubTicket; // m_rgubTicket uint8 [2560]
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GetTicketForWebApiResponse_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.GetTicketForWebApiResponse;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct PersonaStateChange_t : ICallbackData
{
@@ -223,6 +239,9 @@ namespace Steamworks.Data
internal struct GameOverlayActivated_t : ICallbackData
{
internal byte Active; // m_bActive uint8
[MarshalAs(UnmanagedType.I1)]
internal bool UserInitiated; // m_bUserInitiated bool
internal AppId AppID; // m_nAppID AppId_t
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameOverlayActivated_t) );
@@ -473,6 +492,55 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct OverlayBrowserProtocolNavigation_t : ICallbackData
{
internal string RgchURIUTF8() => System.Text.Encoding.UTF8.GetString( RgchURI, 0, System.Array.IndexOf<byte>( RgchURI, 0 ) );
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] // byte[] rgchURI
internal byte[] RgchURI; // rgchURI char [1024]
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(OverlayBrowserProtocolNavigation_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.OverlayBrowserProtocolNavigation;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct EquippedProfileItemsChanged_t : ICallbackData
{
internal ulong SteamID; // m_steamID CSteamID
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(EquippedProfileItemsChanged_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.EquippedProfileItemsChanged;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )]
internal struct EquippedProfileItems_t : ICallbackData
{
internal Result Result; // m_eResult EResult
internal ulong SteamID; // m_steamID CSteamID
[MarshalAs(UnmanagedType.I1)]
internal bool HasAnimatedAvatar; // m_bHasAnimatedAvatar bool
[MarshalAs(UnmanagedType.I1)]
internal bool HasAvatarFrame; // m_bHasAvatarFrame bool
[MarshalAs(UnmanagedType.I1)]
internal bool HasProfileModifier; // m_bHasProfileModifier bool
[MarshalAs(UnmanagedType.I1)]
internal bool HasProfileBackground; // m_bHasProfileBackground bool
[MarshalAs(UnmanagedType.I1)]
internal bool HasMiniProfileBackground; // m_bHasMiniProfileBackground bool
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(EquippedProfileItems_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.EquippedProfileItems;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct IPCountry_t : ICallbackData
{
@@ -539,6 +607,7 @@ namespace Steamworks.Data
[MarshalAs(UnmanagedType.I1)]
internal bool Submitted; // m_bSubmitted bool
internal uint SubmittedText; // m_unSubmittedText uint32
internal AppId AppID; // m_unAppID AppId_t
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GamepadTextInputDismissed_t) );
@@ -547,6 +616,40 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct AppResumingFromSuspend_t : ICallbackData
{
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(AppResumingFromSuspend_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.AppResumingFromSuspend;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct FloatingGamepadTextInputDismissed_t : ICallbackData
{
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(FloatingGamepadTextInputDismissed_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.FloatingGamepadTextInputDismissed;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct FilterTextDictionaryChanged_t : ICallbackData
{
internal int Language; // m_eLanguage int
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(FilterTextDictionaryChanged_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.FilterTextDictionaryChanged;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct FavoritesListChanged_t : ICallbackData
{
@@ -914,66 +1017,6 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RemoteStorageAppSyncedClient_t : ICallbackData
{
internal AppId AppID; // m_nAppID AppId_t
internal Result Result; // m_eResult EResult
internal int NumDownloads; // m_unNumDownloads int
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncedClient_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.RemoteStorageAppSyncedClient;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RemoteStorageAppSyncedServer_t : ICallbackData
{
internal AppId AppID; // m_nAppID AppId_t
internal Result Result; // m_eResult EResult
internal int NumUploads; // m_unNumUploads int
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncedServer_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.RemoteStorageAppSyncedServer;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RemoteStorageAppSyncProgress_t : ICallbackData
{
internal string CurrentFileUTF8() => System.Text.Encoding.UTF8.GetString( CurrentFile, 0, System.Array.IndexOf<byte>( CurrentFile, 0 ) );
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] // byte[] m_rgchCurrentFile
internal byte[] CurrentFile; // m_rgchCurrentFile char [260]
internal AppId AppID; // m_nAppID AppId_t
internal uint BytesTransferredThisChunk; // m_uBytesTransferredThisChunk uint32
internal double DAppPercentComplete; // m_dAppPercentComplete double
[MarshalAs(UnmanagedType.I1)]
internal bool Uploading; // m_bUploading bool
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncProgress_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.RemoteStorageAppSyncProgress;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RemoteStorageAppSyncStatusCheck_t : ICallbackData
{
internal AppId AppID; // m_nAppID AppId_t
internal Result Result; // m_eResult EResult
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageAppSyncStatusCheck_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.RemoteStorageAppSyncStatusCheck;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RemoteStorageFileShareResult_t : ICallbackData
{
@@ -1364,6 +1407,17 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RemoteStorageLocalFileChange_t : ICallbackData
{
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(RemoteStorageLocalFileChange_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.RemoteStorageLocalFileChange;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )]
internal struct UserStatsReceived_t : ICallbackData
{
@@ -1548,19 +1602,6 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct RegisterActivationCodeResponse_t : ICallbackData
{
internal RegisterActivationCodeResult Result; // m_eResult ERegisterActivationCodeResult
internal uint PackageRegistered; // m_unPackageRegistered uint32
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(RegisterActivationCodeResponse_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.RegisterActivationCodeResponse;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct NewUrlLaunchParameters_t : ICallbackData
{
@@ -1605,6 +1646,22 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct TimedTrialStatus_t : ICallbackData
{
internal AppId AppID; // m_unAppID AppId_t
[MarshalAs(UnmanagedType.I1)]
internal bool IsOffline; // m_bIsOffline bool
internal uint SecondsAllowed; // m_unSecondsAllowed uint32
internal uint SecondsPlayed; // m_unSecondsPlayed uint32
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(TimedTrialStatus_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.TimedTrialStatus;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct P2PSessionRequest_t : ICallbackData
{
@@ -1884,6 +1941,66 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamInputDeviceConnected_t : ICallbackData
{
internal ulong ConnectedDeviceHandle; // m_ulConnectedDeviceHandle InputHandle_t
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInputDeviceConnected_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamInputDeviceConnected;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamInputDeviceDisconnected_t : ICallbackData
{
internal ulong DisconnectedDeviceHandle; // m_ulDisconnectedDeviceHandle InputHandle_t
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInputDeviceDisconnected_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamInputDeviceDisconnected;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )]
internal struct SteamInputConfigurationLoaded_t : ICallbackData
{
internal AppId AppID; // m_unAppID AppId_t
internal ulong DeviceHandle; // m_ulDeviceHandle InputHandle_t
internal ulong MappingCreator; // m_ulMappingCreator CSteamID
internal uint MajorRevision; // m_unMajorRevision uint32
internal uint MinorRevision; // m_unMinorRevision uint32
[MarshalAs(UnmanagedType.I1)]
internal bool UsesSteamInputAPI; // m_bUsesSteamInputAPI bool
[MarshalAs(UnmanagedType.I1)]
internal bool UsesGamepadAPI; // m_bUsesGamepadAPI bool
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInputConfigurationLoaded_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamInputConfigurationLoaded;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamInputGamepadSlotChange_t : ICallbackData
{
internal AppId AppID; // m_unAppID AppId_t
internal ulong DeviceHandle; // m_ulDeviceHandle InputHandle_t
internal InputType DeviceType; // m_eDeviceType ESteamInputType
internal int OldGamepadSlot; // m_nOldGamepadSlot int
internal int NewGamepadSlot; // m_nNewGamepadSlot int
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamInputGamepadSlotChange_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamInputGamepadSlotChange;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamUGCQueryCompleted_t : ICallbackData
{
@@ -2134,10 +2251,42 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct UserSubscribedItemsListChanged_t : ICallbackData
{
internal AppId AppID; // m_nAppID AppId_t
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(UserSubscribedItemsListChanged_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.UserSubscribedItemsListChanged;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct WorkshopEULAStatus_t : ICallbackData
{
internal Result Result; // m_eResult EResult
internal AppId AppID; // m_nAppID AppId_t
internal uint Version; // m_unVersion uint32
internal uint TAction; // m_rtAction RTime32
[MarshalAs(UnmanagedType.I1)]
internal bool Accepted; // m_bAccepted bool
[MarshalAs(UnmanagedType.I1)]
internal bool NeedsAction; // m_bNeedsAction bool
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(WorkshopEULAStatus_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.WorkshopEULAStatus;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamAppInstalled_t : ICallbackData
{
internal AppId AppID; // m_nAppID AppId_t
internal int InstallFolderIndex; // m_iInstallFolderIndex int
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamAppInstalled_t) );
@@ -2150,6 +2299,7 @@ namespace Steamworks.Data
internal struct SteamAppUninstalled_t : ICallbackData
{
internal AppId AppID; // m_nAppID AppId_t
internal int InstallFolderIndex; // m_iInstallFolderIndex int
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamAppUninstalled_t) );
@@ -2611,31 +2761,6 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct BroadcastUploadStart_t : ICallbackData
{
[MarshalAs(UnmanagedType.I1)]
internal bool IsRTMP; // m_bIsRTMP bool
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(BroadcastUploadStart_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.BroadcastUploadStart;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct BroadcastUploadStop_t : ICallbackData
{
internal BroadcastUploadResult Result; // m_eResult EBroadcastUploadResult
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(BroadcastUploadStop_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.BroadcastUploadStop;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamParentalSettingsChanged_t : ICallbackData
{
@@ -2671,6 +2796,44 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamRemotePlayTogetherGuestInvite_t : ICallbackData
{
internal string ConnectURLUTF8() => System.Text.Encoding.UTF8.GetString( ConnectURL, 0, System.Array.IndexOf<byte>( ConnectURL, 0 ) );
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] // byte[] m_szConnectURL
internal byte[] ConnectURL; // m_szConnectURL char [1024]
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamRemotePlayTogetherGuestInvite_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamRemotePlayTogetherGuestInvite;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamNetworkingMessagesSessionRequest_t : ICallbackData
{
internal NetIdentity DentityRemote; // m_identityRemote SteamNetworkingIdentity
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamNetworkingMessagesSessionRequest_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamNetworkingMessagesSessionRequest;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamNetworkingMessagesSessionFailed_t : ICallbackData
{
internal ConnectionInfo Nfo; // m_info SteamNetConnectionInfo_t
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamNetworkingMessagesSessionFailed_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamNetworkingMessagesSessionFailed;
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamNetConnectionStatusChangedCallback_t : ICallbackData
{
@@ -2906,4 +3069,20 @@ namespace Steamworks.Data
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamNetworkingFakeIPResult_t : ICallbackData
{
internal Result Result; // m_eResult EResult
internal NetIdentity Dentity; // m_identity SteamNetworkingIdentity
internal uint IP; // m_unIP uint32
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.U2)]
internal ushort[] Ports; // m_unPorts uint16 [8]
#region SteamCallback
public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(SteamNetworkingFakeIPResult_t) );
public int DataSize => _datasize;
public CallbackType CallbackType => CallbackType.SteamNetworkingFakeIPResult;
#endregion
}
}

View File

@@ -8,22 +8,9 @@ namespace Steamworks.Data
{
internal static class Defines
{
internal static readonly int k_cubSaltSize = 8;
internal static readonly GID_t k_GIDNil = 0xffffffffffffffff;
internal static readonly GID_t k_TxnIDNil = k_GIDNil;
internal static readonly GID_t k_TxnIDUnknown = 0;
internal static readonly JobID_t k_JobIDNil = 0xffffffffffffffff;
internal static readonly PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
internal static readonly BundleId_t k_uBundleIdInvalid = 0;
internal static readonly AppId k_uAppIdInvalid = 0x0;
internal static readonly AssetClassId_t k_ulAssetClassIdInvalid = 0x0;
internal static readonly PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0;
internal static readonly DepotId_t k_uDepotIdInvalid = 0x0;
internal static readonly CellID_t k_uCellIDInvalid = 0xFFFFFFFF;
internal static readonly SteamAPICall_t k_uAPICallInvalid = 0x0;
internal static readonly PartnerId_t k_uPartnerIdInvalid = 0;
internal static readonly ManifestId_t k_uManifestIdInvalid = 0;
internal static readonly SiteId_t k_ulSiteIdInvalid = 0;
internal static readonly PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0;
internal static readonly HAuthTicket k_HAuthTicketInvalid = 0;
internal static readonly uint k_unSteamAccountIDMask = 0xFFFFFFFF;
@@ -77,6 +64,13 @@ namespace Steamworks.Data
internal static readonly int k_cchMaxSteamNetworkingErrMsg = 1024;
internal static readonly int k_cchSteamNetworkingMaxConnectionCloseReason = 128;
internal static readonly int k_cchSteamNetworkingMaxConnectionDescription = 128;
internal static readonly int k_cchSteamNetworkingMaxConnectionAppName = 32;
internal static readonly int k_nSteamNetworkConnectionInfoFlags_Unauthenticated = 1;
internal static readonly int k_nSteamNetworkConnectionInfoFlags_Unencrypted = 2;
internal static readonly int k_nSteamNetworkConnectionInfoFlags_LoopbackBuffers = 4;
internal static readonly int k_nSteamNetworkConnectionInfoFlags_Fast = 8;
internal static readonly int k_nSteamNetworkConnectionInfoFlags_Relayed = 16;
internal static readonly int k_nSteamNetworkConnectionInfoFlags_DualWifi = 32;
internal static readonly int k_cbMaxSteamNetworkingSocketsMessageSizeSend = 512 * 1024;
internal static readonly int k_nSteamNetworkingSend_Unreliable = 0;
internal static readonly int k_nSteamNetworkingSend_NoNagle = 1;
@@ -86,19 +80,23 @@ namespace Steamworks.Data
internal static readonly int k_nSteamNetworkingSend_Reliable = 8;
internal static readonly int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable | k_nSteamNetworkingSend_NoNagle;
internal static readonly int k_nSteamNetworkingSend_UseCurrentThread = 16;
internal static readonly int k_nSteamNetworkingSend_AutoRestartBrokenSession = 32;
internal static readonly int k_cchMaxSteamNetworkingPingLocationString = 1024;
internal static readonly int k_nSteamNetworkingPing_Failed = - 1;
internal static readonly int k_nSteamNetworkingPing_Unknown = - 2;
internal static readonly int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Default = - 1;
internal static readonly int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Disable = 0;
internal static readonly int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Relay = 1;
internal static readonly int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Private = 2;
internal static readonly int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Public = 4;
internal static readonly int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All = 0x7fffffff;
internal static readonly SteamNetworkingPOPID k_SteamDatagramPOPID_dev = ( ( uint ) 'd' << 16 ) | ( ( uint ) 'e' << 8 ) | ( uint ) 'v';
internal static readonly uint k_unServerFlagNone = 0x00;
internal static readonly uint k_unServerFlagActive = 0x01;
internal static readonly uint k_unServerFlagSecure = 0x02;
internal static readonly uint k_unServerFlagDedicated = 0x04;
internal static readonly uint k_unServerFlagLinux = 0x08;
internal static readonly uint k_unServerFlagPassworded = 0x10;
internal static readonly uint k_unServerFlagPrivate = 0x20;
internal static readonly ushort STEAMGAMESERVER_QUERY_PORT_SHARED = 0xffff;
internal static readonly ushort MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE = STEAMGAMESERVER_QUERY_PORT_SHARED;
internal static readonly uint k_cbSteamDatagramMaxSerializedTicket = 512;
internal static readonly uint k_cbMaxSteamDatagramGameCoordinatorServerLoginAppData = 2048;
internal static readonly uint k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized = 4096;
internal static readonly int k_cbSteamNetworkingSocketsFakeUDPPortRecommendedMTU = 1200;
internal static readonly int k_cbSteamNetworkingSocketsFakeUDPPortMaxMessageSize = 4096;
}
}

View File

@@ -148,6 +148,18 @@ namespace Steamworks
CantRemoveItem = 113,
AccountDeleted = 114,
ExistingUserCancelledLicense = 115,
CommunityCooldown = 116,
NoLauncherSpecified = 117,
MustAgreeToSSA = 118,
LauncherMigrated = 119,
SteamRealmMismatch = 120,
InvalidSignature = 121,
ParseFailure = 122,
NoVerifiedPhone = 123,
InsufficientBattery = 124,
ChargerRequired = 125,
CachedCredentialInvalid = 126,
K_EResultPhoneNumberIsVOIP = 127,
}
//
@@ -222,6 +234,7 @@ namespace Steamworks
AuthTicketInvalidAlreadyUsed = 7,
AuthTicketInvalid = 8,
PublisherIssuedBan = 9,
AuthTicketNetworkIdentityFailure = 10,
}
//
@@ -253,88 +266,6 @@ namespace Steamworks
Max = 11,
}
//
// EAppReleaseState
//
internal enum AppReleaseState : int
{
Unknown = 0,
Unavailable = 1,
Prerelease = 2,
PreloadOnly = 3,
Released = 4,
}
//
// EAppOwnershipFlags
//
internal enum AppOwnershipFlags : int
{
None = 0,
OwnsLicense = 1,
FreeLicense = 2,
RegionRestricted = 4,
LowViolence = 8,
InvalidPlatform = 16,
SharedLicense = 32,
FreeWeekend = 64,
RetailLicense = 128,
LicenseLocked = 256,
LicensePending = 512,
LicenseExpired = 1024,
LicensePermanent = 2048,
LicenseRecurring = 4096,
LicenseCanceled = 8192,
AutoGrant = 16384,
PendingGift = 32768,
RentalNotActivated = 65536,
Rental = 131072,
SiteLicense = 262144,
LegacyFreeSub = 524288,
InvalidOSType = 1048576,
}
//
// EAppType
//
internal enum AppType : int
{
Invalid = 0,
Game = 1,
Application = 2,
Tool = 4,
Demo = 8,
Media_DEPRECATED = 16,
DLC = 32,
Guide = 64,
Driver = 128,
Config = 256,
Hardware = 512,
Franchise = 1024,
Video = 2048,
Plugin = 4096,
MusicAlbum = 8192,
Series = 16384,
Comic_UNUSED = 32768,
Beta = 65536,
Shortcut = 1073741824,
DepotOnly = -2147483648,
}
//
// ESteamUserStatType
//
internal enum SteamUserStatType : int
{
INVALID = 0,
INT = 1,
FLOAT = 2,
AVGRATE = 3,
ACHIEVEMENTS = 4,
GROUPACHIEVEMENTS = 5,
MAX = 6,
}
//
// EChatEntryType
//
@@ -384,24 +315,12 @@ namespace Steamworks
InstanceFlagMMSLobby = 131072,
}
//
// EMarketingMessageFlags
//
internal enum MarketingMessageFlags : int
{
None = 0,
HighPriority = 1,
PlatformWindows = 2,
PlatformMac = 4,
PlatformLinux = 8,
PlatformRestrictions = 14,
}
//
// ENotificationPosition
//
public enum NotificationPosition : int
{
Invalid = -1,
TopLeft = 0,
TopRight = 1,
BottomLeft = 2,
@@ -439,70 +358,6 @@ namespace Steamworks
AudioInitFailed = 23,
}
//
// ELaunchOptionType
//
internal enum LaunchOptionType : int
{
None = 0,
Default = 1,
SafeMode = 2,
Multiplayer = 3,
Config = 4,
OpenVR = 5,
Server = 6,
Editor = 7,
Manual = 8,
Benchmark = 9,
Option1 = 10,
Option2 = 11,
Option3 = 12,
OculusVR = 13,
OpenVROverlay = 14,
OSVR = 15,
Dialog = 1000,
}
//
// EVRHMDType
//
internal enum VRHMDType : int
{
MDType_None = -1,
MDType_Unknown = 0,
MDType_HTC_Dev = 1,
MDType_HTC_VivePre = 2,
MDType_HTC_Vive = 3,
MDType_HTC_VivePro = 4,
MDType_HTC_ViveCosmos = 5,
MDType_HTC_Unknown = 20,
MDType_Oculus_DK1 = 21,
MDType_Oculus_DK2 = 22,
MDType_Oculus_Rift = 23,
MDType_Oculus_RiftS = 24,
MDType_Oculus_Quest = 25,
MDType_Oculus_Unknown = 40,
MDType_Acer_Unknown = 50,
MDType_Acer_WindowsMR = 51,
MDType_Dell_Unknown = 60,
MDType_Dell_Visor = 61,
MDType_Lenovo_Unknown = 70,
MDType_Lenovo_Explorer = 71,
MDType_HP_Unknown = 80,
MDType_HP_WindowsMR = 81,
MDType_HP_Reverb = 82,
MDType_Samsung_Unknown = 90,
MDType_Samsung_Odyssey = 91,
MDType_Unannounced_Unknown = 100,
MDType_Unannounced_WindowsMR = 101,
MDType_vridge = 110,
MDType_Huawei_Unknown = 120,
MDType_Huawei_VR2 = 121,
MDType_Huawei_EndOfRange = 129,
mdType_Valve_Unknown = 130,
mdType_Valve_Index = 131,
}
//
// EMarketNotAllowedReasonFlags
//
@@ -555,6 +410,17 @@ namespace Steamworks
ExitSoon_Night = 7,
}
//
// EDurationControlOnlineState
//
internal enum DurationControlOnlineState : int
{
Invalid = 0,
Offline = 1,
Online = 2,
OnlineHighPri = 3,
}
//
// EGameSearchErrorCode_t
//
@@ -672,7 +538,7 @@ namespace Steamworks
//
// EOverlayToStoreFlag
//
internal enum OverlayToStoreFlag : int
public enum OverlayToStoreFlag : int
{
None = 0,
AddToCart = 1,
@@ -688,6 +554,37 @@ namespace Steamworks
Modal = 1,
}
//
// ECommunityProfileItemType
//
internal enum CommunityProfileItemType : int
{
AnimatedAvatar = 0,
AvatarFrame = 1,
ProfileModifier = 2,
ProfileBackground = 3,
MiniProfileBackground = 4,
}
//
// ECommunityProfileItemProperty
//
internal enum CommunityProfileItemProperty : int
{
ImageSmall = 0,
ImageLarge = 1,
InternalName = 2,
Title = 3,
Description = 4,
AppID = 5,
TypeID = 6,
Class = 7,
MovieWebM = 8,
MovieMP4 = 9,
MovieWebMSmall = 10,
MovieMP4Small = 11,
}
//
// EPersonaChange
//
@@ -740,6 +637,28 @@ namespace Steamworks
MultipleLines = 1,
}
//
// EFloatingGamepadTextInputMode
//
public enum TextInputMode : int
{
SingleLine = 0,
MultipleLines = 1,
Email = 2,
Numeric = 3,
}
//
// ETextFilteringContext
//
public enum TextFilteringContext : int
{
Unknown = 0,
GameContent = 1,
Chat = 2,
Name = 3,
}
//
// ECheckFileSignature
//
@@ -937,6 +856,26 @@ namespace Steamworks
lose = 2,
}
//
// ERemoteStorageLocalFileChange
//
internal enum RemoteStorageLocalFileChange : int
{
Invalid = 0,
FileUpdated = 1,
FileDeleted = 2,
}
//
// ERemoteStorageFilePathType
//
internal enum RemoteStorageFilePathType : int
{
Invalid = 0,
Absolute = 1,
APIFilename = 2,
}
//
// ELeaderboardDataRequest
//
@@ -964,28 +903,16 @@ namespace Steamworks
ForceUpdate = 2,
}
//
// ERegisterActivationCodeResult
//
internal enum RegisterActivationCodeResult : int
{
ResultOK = 0,
ResultFail = 1,
ResultAlreadyRegistered = 2,
ResultTimeout = 3,
AlreadyOwned = 4,
}
//
// EP2PSessionError
//
public enum P2PSessionError : int
{
None = 0,
NotRunningApp = 1,
NoRightsToApp = 2,
DestinationNotLoggedIn = 3,
Timeout = 4,
NotRunningApp_DELETED = 1,
DestinationNotLoggedIn_DELETED = 3,
Max = 5,
}
@@ -1067,6 +994,7 @@ namespace Steamworks
Code304NotModified = 304,
Code305UseProxy = 305,
Code307TemporaryRedirect = 307,
Code308PermanentRedirect = 308,
Code400BadRequest = 400,
Code401Unauthorized = 401,
Code402PaymentRequired = 402,
@@ -1087,6 +1015,7 @@ namespace Steamworks
Code417ExpectationFailed = 417,
Code4xxUnknown = 418,
Code429TooManyRequests = 429,
Code444ConnectionClosed = 444,
Code500InternalServerError = 500,
Code501NotImplemented = 501,
Code502BadGateway = 502,
@@ -1268,11 +1197,11 @@ namespace Steamworks
XBoxOne_DPad_West = 140,
XBoxOne_DPad_East = 141,
XBoxOne_DPad_Move = 142,
XBoxOne_Reserved1 = 143,
XBoxOne_Reserved2 = 144,
XBoxOne_Reserved3 = 145,
XBoxOne_Reserved4 = 146,
XBoxOne_Reserved5 = 147,
XBoxOne_LeftGrip_Lower = 143,
XBoxOne_LeftGrip_Upper = 144,
XBoxOne_RightGrip_Lower = 145,
XBoxOne_RightGrip_Upper = 146,
XBoxOne_Share = 147,
XBoxOne_Reserved6 = 148,
XBoxOne_Reserved7 = 149,
XBoxOne_Reserved8 = 150,
@@ -1373,17 +1302,165 @@ namespace Steamworks
Switch_LeftGrip_Upper = 245,
Switch_RightGrip_Lower = 246,
Switch_RightGrip_Upper = 247,
Switch_Reserved11 = 248,
Switch_Reserved12 = 249,
Switch_Reserved13 = 250,
Switch_Reserved14 = 251,
Switch_JoyConButton_N = 248,
Switch_JoyConButton_E = 249,
Switch_JoyConButton_S = 250,
Switch_JoyConButton_W = 251,
Switch_Reserved15 = 252,
Switch_Reserved16 = 253,
Switch_Reserved17 = 254,
Switch_Reserved18 = 255,
Switch_Reserved19 = 256,
Switch_Reserved20 = 257,
Count = 258,
PS5_X = 258,
PS5_Circle = 259,
PS5_Triangle = 260,
PS5_Square = 261,
PS5_LeftBumper = 262,
PS5_RightBumper = 263,
PS5_Option = 264,
PS5_Create = 265,
PS5_Mute = 266,
PS5_LeftPad_Touch = 267,
PS5_LeftPad_Swipe = 268,
PS5_LeftPad_Click = 269,
PS5_LeftPad_DPadNorth = 270,
PS5_LeftPad_DPadSouth = 271,
PS5_LeftPad_DPadWest = 272,
PS5_LeftPad_DPadEast = 273,
PS5_RightPad_Touch = 274,
PS5_RightPad_Swipe = 275,
PS5_RightPad_Click = 276,
PS5_RightPad_DPadNorth = 277,
PS5_RightPad_DPadSouth = 278,
PS5_RightPad_DPadWest = 279,
PS5_RightPad_DPadEast = 280,
PS5_CenterPad_Touch = 281,
PS5_CenterPad_Swipe = 282,
PS5_CenterPad_Click = 283,
PS5_CenterPad_DPadNorth = 284,
PS5_CenterPad_DPadSouth = 285,
PS5_CenterPad_DPadWest = 286,
PS5_CenterPad_DPadEast = 287,
PS5_LeftTrigger_Pull = 288,
PS5_LeftTrigger_Click = 289,
PS5_RightTrigger_Pull = 290,
PS5_RightTrigger_Click = 291,
PS5_LeftStick_Move = 292,
PS5_LeftStick_Click = 293,
PS5_LeftStick_DPadNorth = 294,
PS5_LeftStick_DPadSouth = 295,
PS5_LeftStick_DPadWest = 296,
PS5_LeftStick_DPadEast = 297,
PS5_RightStick_Move = 298,
PS5_RightStick_Click = 299,
PS5_RightStick_DPadNorth = 300,
PS5_RightStick_DPadSouth = 301,
PS5_RightStick_DPadWest = 302,
PS5_RightStick_DPadEast = 303,
PS5_DPad_North = 304,
PS5_DPad_South = 305,
PS5_DPad_West = 306,
PS5_DPad_East = 307,
PS5_Gyro_Move = 308,
PS5_Gyro_Pitch = 309,
PS5_Gyro_Yaw = 310,
PS5_Gyro_Roll = 311,
PS5_DPad_Move = 312,
PS5_LeftGrip = 313,
PS5_RightGrip = 314,
PS5_LeftFn = 315,
PS5_RightFn = 316,
PS5_Reserved5 = 317,
PS5_Reserved6 = 318,
PS5_Reserved7 = 319,
PS5_Reserved8 = 320,
PS5_Reserved9 = 321,
PS5_Reserved10 = 322,
PS5_Reserved11 = 323,
PS5_Reserved12 = 324,
PS5_Reserved13 = 325,
PS5_Reserved14 = 326,
PS5_Reserved15 = 327,
PS5_Reserved16 = 328,
PS5_Reserved17 = 329,
PS5_Reserved18 = 330,
PS5_Reserved19 = 331,
PS5_Reserved20 = 332,
SteamDeck_A = 333,
SteamDeck_B = 334,
SteamDeck_X = 335,
SteamDeck_Y = 336,
SteamDeck_L1 = 337,
SteamDeck_R1 = 338,
SteamDeck_Menu = 339,
SteamDeck_View = 340,
SteamDeck_LeftPad_Touch = 341,
SteamDeck_LeftPad_Swipe = 342,
SteamDeck_LeftPad_Click = 343,
SteamDeck_LeftPad_DPadNorth = 344,
SteamDeck_LeftPad_DPadSouth = 345,
SteamDeck_LeftPad_DPadWest = 346,
SteamDeck_LeftPad_DPadEast = 347,
SteamDeck_RightPad_Touch = 348,
SteamDeck_RightPad_Swipe = 349,
SteamDeck_RightPad_Click = 350,
SteamDeck_RightPad_DPadNorth = 351,
SteamDeck_RightPad_DPadSouth = 352,
SteamDeck_RightPad_DPadWest = 353,
SteamDeck_RightPad_DPadEast = 354,
SteamDeck_L2_SoftPull = 355,
SteamDeck_L2 = 356,
SteamDeck_R2_SoftPull = 357,
SteamDeck_R2 = 358,
SteamDeck_LeftStick_Move = 359,
SteamDeck_L3 = 360,
SteamDeck_LeftStick_DPadNorth = 361,
SteamDeck_LeftStick_DPadSouth = 362,
SteamDeck_LeftStick_DPadWest = 363,
SteamDeck_LeftStick_DPadEast = 364,
SteamDeck_LeftStick_Touch = 365,
SteamDeck_RightStick_Move = 366,
SteamDeck_R3 = 367,
SteamDeck_RightStick_DPadNorth = 368,
SteamDeck_RightStick_DPadSouth = 369,
SteamDeck_RightStick_DPadWest = 370,
SteamDeck_RightStick_DPadEast = 371,
SteamDeck_RightStick_Touch = 372,
SteamDeck_L4 = 373,
SteamDeck_R4 = 374,
SteamDeck_L5 = 375,
SteamDeck_R5 = 376,
SteamDeck_DPad_Move = 377,
SteamDeck_DPad_North = 378,
SteamDeck_DPad_South = 379,
SteamDeck_DPad_West = 380,
SteamDeck_DPad_East = 381,
SteamDeck_Gyro_Move = 382,
SteamDeck_Gyro_Pitch = 383,
SteamDeck_Gyro_Yaw = 384,
SteamDeck_Gyro_Roll = 385,
SteamDeck_Reserved1 = 386,
SteamDeck_Reserved2 = 387,
SteamDeck_Reserved3 = 388,
SteamDeck_Reserved4 = 389,
SteamDeck_Reserved5 = 390,
SteamDeck_Reserved6 = 391,
SteamDeck_Reserved7 = 392,
SteamDeck_Reserved8 = 393,
SteamDeck_Reserved9 = 394,
SteamDeck_Reserved10 = 395,
SteamDeck_Reserved11 = 396,
SteamDeck_Reserved12 = 397,
SteamDeck_Reserved13 = 398,
SteamDeck_Reserved14 = 399,
SteamDeck_Reserved15 = 400,
SteamDeck_Reserved16 = 401,
SteamDeck_Reserved17 = 402,
SteamDeck_Reserved18 = 403,
SteamDeck_Reserved19 = 404,
SteamDeck_Reserved20 = 405,
Count = 406,
MaximumPossibleValue = 32767,
}
@@ -1432,6 +1509,26 @@ namespace Steamworks
Right = 1,
}
//
// EControllerHapticLocation
//
internal enum ControllerHapticLocation : int
{
Left = 1,
Right = 2,
Both = 3,
}
//
// EControllerHapticType
//
internal enum ControllerHapticType : int
{
Off = 0,
Tick = 1,
Click = 2,
}
//
// ESteamInputType
//
@@ -1450,10 +1547,24 @@ namespace Steamworks
SwitchProController = 10,
MobileTouch = 11,
PS3Controller = 12,
Count = 13,
PS5Controller = 13,
SteamDeckController = 14,
Count = 15,
MaximumPossibleValue = 255,
}
//
// ESteamInputConfigurationEnableType
//
internal enum SteamInputConfigurationEnableType : int
{
None = 0,
Playstation = 1,
Xbox = 2,
Generic = 4,
Switch = 8,
}
//
// ESteamInputLEDFlag
//
@@ -1463,6 +1574,38 @@ namespace Steamworks
RestoreUserDefault = 1,
}
//
// ESteamInputGlyphSize
//
public enum GlyphSize : int
{
Small = 0,
Medium = 1,
Large = 2,
Count = 3,
}
//
// ESteamInputGlyphStyle
//
internal enum SteamInputGlyphStyle : int
{
Knockout = 0,
Light = 1,
Dark = 2,
NeutralColorABXY = 16,
SolidABXY = 32,
}
//
// ESteamInputActionEventType
//
internal enum SteamInputActionEventType : int
{
DigitalAction = 0,
AnalogAction = 1,
}
//
// EControllerActionOrigin
//
@@ -1713,7 +1856,148 @@ namespace Steamworks
XBoxOne_DPad_Move = 242,
XBox360_DPad_Move = 243,
Switch_DPad_Move = 244,
Count = 245,
PS5_X = 245,
PS5_Circle = 246,
PS5_Triangle = 247,
PS5_Square = 248,
PS5_LeftBumper = 249,
PS5_RightBumper = 250,
PS5_Option = 251,
PS5_Create = 252,
PS5_Mute = 253,
PS5_LeftPad_Touch = 254,
PS5_LeftPad_Swipe = 255,
PS5_LeftPad_Click = 256,
PS5_LeftPad_DPadNorth = 257,
PS5_LeftPad_DPadSouth = 258,
PS5_LeftPad_DPadWest = 259,
PS5_LeftPad_DPadEast = 260,
PS5_RightPad_Touch = 261,
PS5_RightPad_Swipe = 262,
PS5_RightPad_Click = 263,
PS5_RightPad_DPadNorth = 264,
PS5_RightPad_DPadSouth = 265,
PS5_RightPad_DPadWest = 266,
PS5_RightPad_DPadEast = 267,
PS5_CenterPad_Touch = 268,
PS5_CenterPad_Swipe = 269,
PS5_CenterPad_Click = 270,
PS5_CenterPad_DPadNorth = 271,
PS5_CenterPad_DPadSouth = 272,
PS5_CenterPad_DPadWest = 273,
PS5_CenterPad_DPadEast = 274,
PS5_LeftTrigger_Pull = 275,
PS5_LeftTrigger_Click = 276,
PS5_RightTrigger_Pull = 277,
PS5_RightTrigger_Click = 278,
PS5_LeftStick_Move = 279,
PS5_LeftStick_Click = 280,
PS5_LeftStick_DPadNorth = 281,
PS5_LeftStick_DPadSouth = 282,
PS5_LeftStick_DPadWest = 283,
PS5_LeftStick_DPadEast = 284,
PS5_RightStick_Move = 285,
PS5_RightStick_Click = 286,
PS5_RightStick_DPadNorth = 287,
PS5_RightStick_DPadSouth = 288,
PS5_RightStick_DPadWest = 289,
PS5_RightStick_DPadEast = 290,
PS5_DPad_Move = 291,
PS5_DPad_North = 292,
PS5_DPad_South = 293,
PS5_DPad_West = 294,
PS5_DPad_East = 295,
PS5_Gyro_Move = 296,
PS5_Gyro_Pitch = 297,
PS5_Gyro_Yaw = 298,
PS5_Gyro_Roll = 299,
XBoxOne_LeftGrip_Lower = 300,
XBoxOne_LeftGrip_Upper = 301,
XBoxOne_RightGrip_Lower = 302,
XBoxOne_RightGrip_Upper = 303,
XBoxOne_Share = 304,
SteamDeck_A = 305,
SteamDeck_B = 306,
SteamDeck_X = 307,
SteamDeck_Y = 308,
SteamDeck_L1 = 309,
SteamDeck_R1 = 310,
SteamDeck_Menu = 311,
SteamDeck_View = 312,
SteamDeck_LeftPad_Touch = 313,
SteamDeck_LeftPad_Swipe = 314,
SteamDeck_LeftPad_Click = 315,
SteamDeck_LeftPad_DPadNorth = 316,
SteamDeck_LeftPad_DPadSouth = 317,
SteamDeck_LeftPad_DPadWest = 318,
SteamDeck_LeftPad_DPadEast = 319,
SteamDeck_RightPad_Touch = 320,
SteamDeck_RightPad_Swipe = 321,
SteamDeck_RightPad_Click = 322,
SteamDeck_RightPad_DPadNorth = 323,
SteamDeck_RightPad_DPadSouth = 324,
SteamDeck_RightPad_DPadWest = 325,
SteamDeck_RightPad_DPadEast = 326,
SteamDeck_L2_SoftPull = 327,
SteamDeck_L2 = 328,
SteamDeck_R2_SoftPull = 329,
SteamDeck_R2 = 330,
SteamDeck_LeftStick_Move = 331,
SteamDeck_L3 = 332,
SteamDeck_LeftStick_DPadNorth = 333,
SteamDeck_LeftStick_DPadSouth = 334,
SteamDeck_LeftStick_DPadWest = 335,
SteamDeck_LeftStick_DPadEast = 336,
SteamDeck_LeftStick_Touch = 337,
SteamDeck_RightStick_Move = 338,
SteamDeck_R3 = 339,
SteamDeck_RightStick_DPadNorth = 340,
SteamDeck_RightStick_DPadSouth = 341,
SteamDeck_RightStick_DPadWest = 342,
SteamDeck_RightStick_DPadEast = 343,
SteamDeck_RightStick_Touch = 344,
SteamDeck_L4 = 345,
SteamDeck_R4 = 346,
SteamDeck_L5 = 347,
SteamDeck_R5 = 348,
SteamDeck_DPad_Move = 349,
SteamDeck_DPad_North = 350,
SteamDeck_DPad_South = 351,
SteamDeck_DPad_West = 352,
SteamDeck_DPad_East = 353,
SteamDeck_Gyro_Move = 354,
SteamDeck_Gyro_Pitch = 355,
SteamDeck_Gyro_Yaw = 356,
SteamDeck_Gyro_Roll = 357,
SteamDeck_Reserved1 = 358,
SteamDeck_Reserved2 = 359,
SteamDeck_Reserved3 = 360,
SteamDeck_Reserved4 = 361,
SteamDeck_Reserved5 = 362,
SteamDeck_Reserved6 = 363,
SteamDeck_Reserved7 = 364,
SteamDeck_Reserved8 = 365,
SteamDeck_Reserved9 = 366,
SteamDeck_Reserved10 = 367,
SteamDeck_Reserved11 = 368,
SteamDeck_Reserved12 = 369,
SteamDeck_Reserved13 = 370,
SteamDeck_Reserved14 = 371,
SteamDeck_Reserved15 = 372,
SteamDeck_Reserved16 = 373,
SteamDeck_Reserved17 = 374,
SteamDeck_Reserved18 = 375,
SteamDeck_Reserved19 = 376,
SteamDeck_Reserved20 = 377,
Switch_JoyConButton_N = 378,
Switch_JoyConButton_E = 379,
Switch_JoyConButton_S = 380,
Switch_JoyConButton_W = 381,
PS5_LeftGrip = 382,
PS5_RightGrip = 383,
PS5_LeftFn = 384,
PS5_RightFn = 385,
Count = 386,
MaximumPossibleValue = 32767,
}
@@ -1801,6 +2085,7 @@ namespace Steamworks
RankedByLifetimeAveragePlaytime = 16,
RankedByPlaytimeSessionsTrend = 17,
RankedByLifetimePlaytimeSessions = 18,
RankedByLastUpdatedDate = 19,
}
//
@@ -1853,7 +2138,7 @@ namespace Steamworks
//
// EItemPreviewType
//
internal enum ItemPreviewType : int
public enum ItemPreviewType : int
{
Image = 0,
YouTubeVideo = 1,
@@ -1863,6 +2148,18 @@ namespace Steamworks
ReservedMax = 255,
}
//
// EUGCContentDescriptorID
//
internal enum UGCContentDescriptorID : int
{
NudityOrSexualContent = 1,
FrequentViolenceOrGore = 2,
AdultOnlySexualContent = 3,
GratuitousSexualContent = 4,
AnyMatureContent = 5,
}
//
// ESteamItemFlags
//
@@ -1873,17 +2170,6 @@ namespace Steamworks
Consumed = 512,
}
//
// ESteamTVRegionBehavior
//
internal enum SteamTVRegionBehavior : int
{
Invalid = -1,
Hover = 0,
ClickPopup = 1,
ClickSurroundingRegion = 2,
}
//
// EParentalFeature
//
@@ -1903,7 +2189,8 @@ namespace Steamworks
Library = 11,
Test = 12,
SiteLicense = 13,
Max = 14,
KioskMode = 14,
Max = 15,
}
//
@@ -1943,6 +2230,8 @@ namespace Steamworks
Invalid = 0,
SteamID = 16,
XboxPairwiseID = 17,
SonyPSN = 18,
GoogleStadia = 19,
IPAddress = 1,
GenericString = 2,
GenericBytes = 3,
@@ -1950,6 +2239,17 @@ namespace Steamworks
Force32bit = 2147483647,
}
//
// ESteamNetworkingFakeIPType
//
internal enum SteamNetworkingFakeIPType : int
{
Invalid = 0,
NotFake = 1,
GlobalIPv4 = 2,
LocalIPv4 = 3,
}
//
// ESteamNetworkingConnectionState
//
@@ -1984,22 +2284,24 @@ namespace Steamworks
Local_HostedServerPrimaryRelay = 3003,
Local_NetworkConfig = 3004,
Local_Rights = 3005,
Local_P2P_ICE_NoPublicAddresses = 3006,
Local_Max = 3999,
Remote_Min = 4000,
Remote_Timeout = 4001,
Remote_BadCrypt = 4002,
Remote_BadCert = 4003,
Remote_NotLoggedIn = 4004,
Remote_NotRunningApp = 4005,
Remote_BadProtocolVersion = 4006,
Remote_P2P_ICE_NoPublicAddresses = 4007,
Remote_Max = 4999,
Misc_Min = 5000,
Misc_Generic = 5001,
Misc_InternalError = 5002,
Misc_Timeout = 5003,
Misc_RelayConnectivity = 5004,
Misc_SteamConnectivity = 5005,
Misc_NoRelaySessionsToClient = 5006,
Misc_P2P_Rendezvous = 5008,
Misc_P2P_NAT_Firewall = 5009,
Misc_PeerSentNoConnection = 5010,
Misc_Max = 5999,
}
@@ -2023,7 +2325,7 @@ namespace Steamworks
Int64 = 2,
Float = 3,
String = 4,
FunctionPtr = 5,
Ptr = 5,
}
//
@@ -2032,6 +2334,21 @@ namespace Steamworks
internal enum NetConfig : int
{
Invalid = 0,
TimeoutInitial = 24,
TimeoutConnected = 25,
SendBufferSize = 9,
ConnectionUserData = 40,
SendRateMin = 10,
SendRateMax = 11,
NagleTime = 12,
IP_AllowWithoutAuth = 23,
MTU_PacketSize = 32,
MTU_DataSize = 33,
Unencrypted = 34,
SymmetricConnect = 37,
LocalVirtualPort = 38,
DualWifi_Enable = 39,
EnableDiagnosticsUI = 46,
FakePacketLoss_Send = 2,
FakePacketLoss_Recv = 3,
FakePacketLag_Send = 4,
@@ -2042,17 +2359,26 @@ namespace Steamworks
FakePacketDup_Send = 26,
FakePacketDup_Recv = 27,
FakePacketDup_TimeMax = 28,
TimeoutInitial = 24,
TimeoutConnected = 25,
SendBufferSize = 9,
SendRateMin = 10,
SendRateMax = 11,
NagleTime = 12,
IP_AllowWithoutAuth = 23,
MTU_PacketSize = 32,
MTU_DataSize = 33,
Unencrypted = 34,
EnumerateDevVars = 35,
PacketTraceMaxBytes = 41,
FakeRateLimit_Send_Rate = 42,
FakeRateLimit_Send_Burst = 43,
FakeRateLimit_Recv_Rate = 44,
FakeRateLimit_Recv_Burst = 45,
Callback_ConnectionStatusChanged = 201,
Callback_AuthStatusChanged = 202,
Callback_RelayNetworkStatusChanged = 203,
Callback_MessagesSessionRequest = 204,
Callback_MessagesSessionFailed = 205,
Callback_CreateConnectionSignaling = 206,
Callback_FakeIPResult = 207,
P2P_STUN_ServerList = 103,
P2P_Transport_ICE_Enable = 104,
P2P_Transport_ICE_Penalty = 105,
P2P_Transport_SDR_Penalty = 106,
P2P_TURN_ServerList = 107,
P2P_TURN_UserList = 108,
P2P_TURN_PassList = 109,
P2P_Transport_ICE_Implementation = 110,
SDRClient_ConsecutitivePingTimeoutsFailInitial = 19,
SDRClient_ConsecutitivePingTimeoutsFail = 20,
SDRClient_MinPingsBeforePingAccurate = 21,
@@ -2067,6 +2393,7 @@ namespace Steamworks
LogLevel_PacketGaps = 16,
LogLevel_P2PRendezvous = 17,
LogLevel_SDRRelayPings = 18,
DELETED_EnumerateDevVars = 35,
}
//

View File

@@ -88,6 +88,25 @@ namespace Steamworks.Data
}
internal partial struct NetKeyValue
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingConfigValue_t_SetInt32", CallingConvention = Platform.CC)]
internal static extern void InternalSetInt32( ref NetKeyValue self, NetConfig eVal, int data );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingConfigValue_t_SetInt64", CallingConvention = Platform.CC)]
internal static extern void InternalSetInt64( ref NetKeyValue self, NetConfig eVal, long data );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingConfigValue_t_SetFloat", CallingConvention = Platform.CC)]
internal static extern void InternalSetFloat( ref NetKeyValue self, NetConfig eVal, float data );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingConfigValue_t_SetPtr", CallingConvention = Platform.CC)]
internal static extern void InternalSetPtr( ref NetKeyValue self, NetConfig eVal, IntPtr data );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingConfigValue_t_SetString", CallingConvention = Platform.CC)]
internal static extern void InternalSetString( ref NetKeyValue self, NetConfig eVal, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string data );
}
public partial struct NetIdentity
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_Clear", CallingConvention = Platform.CC)]
@@ -116,12 +135,37 @@ namespace Steamworks.Data
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_GetXboxPairwiseID", CallingConvention = Platform.CC)]
internal static extern Utf8StringPointer InternalGetXboxPairwiseID( ref NetIdentity self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_SetPSNID", CallingConvention = Platform.CC)]
internal static extern void InternalSetPSNID( ref NetIdentity self, ulong id );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_GetPSNID", CallingConvention = Platform.CC)]
internal static extern ulong InternalGetPSNID( ref NetIdentity self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_SetStadiaID", CallingConvention = Platform.CC)]
internal static extern void InternalSetStadiaID( ref NetIdentity self, ulong id );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_GetStadiaID", CallingConvention = Platform.CC)]
internal static extern ulong InternalGetStadiaID( ref NetIdentity self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_SetIPAddr", CallingConvention = Platform.CC)]
internal static extern void InternalSetIPAddr( ref NetIdentity self, ref NetAddress addr );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_GetIPAddr", CallingConvention = Platform.CC)]
internal static extern IntPtr InternalGetIPAddr( ref NetIdentity self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_SetIPv4Addr", CallingConvention = Platform.CC)]
internal static extern void InternalSetIPv4Addr( ref NetIdentity self, uint nIPv4, ushort nPort );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_GetIPv4", CallingConvention = Platform.CC)]
internal static extern uint InternalGetIPv4( ref NetIdentity self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_GetFakeIPType", CallingConvention = Platform.CC)]
internal static extern SteamNetworkingFakeIPType InternalGetFakeIPType( ref NetIdentity self );
[return: MarshalAs( UnmanagedType.I1 )]
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_IsFakeIP", CallingConvention = Platform.CC)]
internal static extern bool InternalIsFakeIP( ref NetIdentity self );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIdentity_SetLocalHost", CallingConvention = Platform.CC)]
internal static extern void InternalSetLocalHost( ref NetIdentity self );
@@ -196,6 +240,13 @@ namespace Steamworks.Data
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIPAddr_IsEqualTo", CallingConvention = Platform.CC)]
internal static extern bool InternalIsEqualTo( ref NetAddress self, ref NetAddress x );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIPAddr_GetFakeIPType", CallingConvention = Platform.CC)]
internal static extern SteamNetworkingFakeIPType InternalGetFakeIPType( ref NetAddress self );
[return: MarshalAs( UnmanagedType.I1 )]
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamNetworkingIPAddr_IsFakeIP", CallingConvention = Platform.CC)]
internal static extern bool InternalIsFakeIP( ref NetAddress self );
}
internal partial struct NetMsg

View File

@@ -17,14 +17,6 @@ namespace Steamworks.Data
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct FriendSessionStateInfo_t
{
internal uint IOnlineSessionInstances; // m_uiOnlineSessionInstances uint32
internal byte IPublishedToFriendsSessionInstance; // m_uiPublishedToFriendsSessionInstance uint8
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal partial struct servernetadr_t
{
@@ -113,6 +105,39 @@ namespace Steamworks.Data
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct InputMotionDataV2_t
{
internal float DriftCorrectedQuatX; // driftCorrectedQuatX float
internal float DriftCorrectedQuatY; // driftCorrectedQuatY float
internal float DriftCorrectedQuatZ; // driftCorrectedQuatZ float
internal float DriftCorrectedQuatW; // driftCorrectedQuatW float
internal float SensorFusionQuatX; // sensorFusionQuatX float
internal float SensorFusionQuatY; // sensorFusionQuatY float
internal float SensorFusionQuatZ; // sensorFusionQuatZ float
internal float SensorFusionQuatW; // sensorFusionQuatW float
internal float DeferredSensorFusionQuatX; // deferredSensorFusionQuatX float
internal float DeferredSensorFusionQuatY; // deferredSensorFusionQuatY float
internal float DeferredSensorFusionQuatZ; // deferredSensorFusionQuatZ float
internal float DeferredSensorFusionQuatW; // deferredSensorFusionQuatW float
internal float GravityX; // gravityX float
internal float GravityY; // gravityY float
internal float GravityZ; // gravityZ float
internal float DegreesPerSecondX; // degreesPerSecondX float
internal float DegreesPerSecondY; // degreesPerSecondY float
internal float DegreesPerSecondZ; // degreesPerSecondZ float
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamInputActionEvent_t
{
internal ulong ControllerHandle; // controllerHandle InputHandle_t
internal SteamInputActionEventType EEventType; // eEventType ESteamInputActionEventType
// internal SteamInputActionEvent_t.AnalogAction_t AnalogAction; // analogAction SteamInputActionEvent_t::AnalogAction_t
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamUGCDetails_t
{
@@ -168,37 +193,6 @@ namespace Steamworks.Data
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamTVRegion_t
{
internal uint UnMinX; // unMinX uint32
internal uint UnMinY; // unMinY uint32
internal uint UnMaxX; // unMaxX uint32
internal uint UnMaxY; // unMaxY uint32
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct SteamNetworkingQuickConnectionStatus
{
internal ConnectionState State; // m_eState ESteamNetworkingConnectionState
internal int Ping; // m_nPing int
internal float ConnectionQualityLocal; // m_flConnectionQualityLocal float
internal float ConnectionQualityRemote; // m_flConnectionQualityRemote float
internal float OutPacketsPerSec; // m_flOutPacketsPerSec float
internal float OutBytesPerSec; // m_flOutBytesPerSec float
internal float InPacketsPerSec; // m_flInPacketsPerSec float
internal float InBytesPerSec; // m_flInBytesPerSec float
internal int SendRateBytesPerSecond; // m_nSendRateBytesPerSecond int
internal int CbPendingUnreliable; // m_cbPendingUnreliable int
internal int CbPendingReliable; // m_cbPendingReliable int
internal int CbSentUnackedReliable; // m_cbSentUnackedReliable int
internal long EcQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)]
internal uint[] Reserved; // reserved uint32 [16]
}
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal partial struct SteamDatagramHostedAddress
{

View File

@@ -6,118 +6,6 @@ using System.Threading.Tasks;
namespace Steamworks.Data
{
internal struct GID_t : IEquatable<GID_t>, IComparable<GID_t>
{
// Name: GID_t, Type: unsigned long long
public ulong Value;
public static implicit operator GID_t( ulong value ) => new GID_t(){ Value = value };
public static implicit operator ulong( GID_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (GID_t) p );
public bool Equals( GID_t p ) => p.Value == Value;
public static bool operator ==( GID_t a, GID_t b ) => a.Equals( b );
public static bool operator !=( GID_t a, GID_t b ) => !a.Equals( b );
public int CompareTo( GID_t other ) => Value.CompareTo( other.Value );
}
internal struct JobID_t : IEquatable<JobID_t>, IComparable<JobID_t>
{
// Name: JobID_t, Type: unsigned long long
public ulong Value;
public static implicit operator JobID_t( ulong value ) => new JobID_t(){ Value = value };
public static implicit operator ulong( JobID_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (JobID_t) p );
public bool Equals( JobID_t p ) => p.Value == Value;
public static bool operator ==( JobID_t a, JobID_t b ) => a.Equals( b );
public static bool operator !=( JobID_t a, JobID_t b ) => !a.Equals( b );
public int CompareTo( JobID_t other ) => Value.CompareTo( other.Value );
}
internal struct TxnID_t : IEquatable<TxnID_t>, IComparable<TxnID_t>
{
// Name: TxnID_t, Type: unsigned long long
public ulong Value;
public static implicit operator TxnID_t( ulong value ) => new TxnID_t(){ Value = value };
public static implicit operator ulong( TxnID_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (TxnID_t) p );
public bool Equals( TxnID_t p ) => p.Value == Value;
public static bool operator ==( TxnID_t a, TxnID_t b ) => a.Equals( b );
public static bool operator !=( TxnID_t a, TxnID_t b ) => !a.Equals( b );
public int CompareTo( TxnID_t other ) => Value.CompareTo( other.Value );
}
internal struct PackageId_t : IEquatable<PackageId_t>, IComparable<PackageId_t>
{
// Name: PackageId_t, Type: unsigned int
public uint Value;
public static implicit operator PackageId_t( uint value ) => new PackageId_t(){ Value = value };
public static implicit operator uint( PackageId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (PackageId_t) p );
public bool Equals( PackageId_t p ) => p.Value == Value;
public static bool operator ==( PackageId_t a, PackageId_t b ) => a.Equals( b );
public static bool operator !=( PackageId_t a, PackageId_t b ) => !a.Equals( b );
public int CompareTo( PackageId_t other ) => Value.CompareTo( other.Value );
}
internal struct BundleId_t : IEquatable<BundleId_t>, IComparable<BundleId_t>
{
// Name: BundleId_t, Type: unsigned int
public uint Value;
public static implicit operator BundleId_t( uint value ) => new BundleId_t(){ Value = value };
public static implicit operator uint( BundleId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (BundleId_t) p );
public bool Equals( BundleId_t p ) => p.Value == Value;
public static bool operator ==( BundleId_t a, BundleId_t b ) => a.Equals( b );
public static bool operator !=( BundleId_t a, BundleId_t b ) => !a.Equals( b );
public int CompareTo( BundleId_t other ) => Value.CompareTo( other.Value );
}
internal struct AssetClassId_t : IEquatable<AssetClassId_t>, IComparable<AssetClassId_t>
{
// Name: AssetClassId_t, Type: unsigned long long
public ulong Value;
public static implicit operator AssetClassId_t( ulong value ) => new AssetClassId_t(){ Value = value };
public static implicit operator ulong( AssetClassId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (AssetClassId_t) p );
public bool Equals( AssetClassId_t p ) => p.Value == Value;
public static bool operator ==( AssetClassId_t a, AssetClassId_t b ) => a.Equals( b );
public static bool operator !=( AssetClassId_t a, AssetClassId_t b ) => !a.Equals( b );
public int CompareTo( AssetClassId_t other ) => Value.CompareTo( other.Value );
}
internal struct PhysicalItemId_t : IEquatable<PhysicalItemId_t>, IComparable<PhysicalItemId_t>
{
// Name: PhysicalItemId_t, Type: unsigned int
public uint Value;
public static implicit operator PhysicalItemId_t( uint value ) => new PhysicalItemId_t(){ Value = value };
public static implicit operator uint( PhysicalItemId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (PhysicalItemId_t) p );
public bool Equals( PhysicalItemId_t p ) => p.Value == Value;
public static bool operator ==( PhysicalItemId_t a, PhysicalItemId_t b ) => a.Equals( b );
public static bool operator !=( PhysicalItemId_t a, PhysicalItemId_t b ) => !a.Equals( b );
public int CompareTo( PhysicalItemId_t other ) => Value.CompareTo( other.Value );
}
internal struct DepotId_t : IEquatable<DepotId_t>, IComparable<DepotId_t>
{
// Name: DepotId_t, Type: unsigned int
@@ -150,22 +38,6 @@ namespace Steamworks.Data
public int CompareTo( RTime32 other ) => Value.CompareTo( other.Value );
}
internal struct CellID_t : IEquatable<CellID_t>, IComparable<CellID_t>
{
// Name: CellID_t, Type: unsigned int
public uint Value;
public static implicit operator CellID_t( uint value ) => new CellID_t(){ Value = value };
public static implicit operator uint( CellID_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (CellID_t) p );
public bool Equals( CellID_t p ) => p.Value == Value;
public static bool operator ==( CellID_t a, CellID_t b ) => a.Equals( b );
public static bool operator !=( CellID_t a, CellID_t b ) => !a.Equals( b );
public int CompareTo( CellID_t other ) => Value.CompareTo( other.Value );
}
internal struct SteamAPICall_t : IEquatable<SteamAPICall_t>, IComparable<SteamAPICall_t>
{
// Name: SteamAPICall_t, Type: unsigned long long
@@ -198,54 +70,6 @@ namespace Steamworks.Data
public int CompareTo( AccountID_t other ) => Value.CompareTo( other.Value );
}
internal struct PartnerId_t : IEquatable<PartnerId_t>, IComparable<PartnerId_t>
{
// Name: PartnerId_t, Type: unsigned int
public uint Value;
public static implicit operator PartnerId_t( uint value ) => new PartnerId_t(){ Value = value };
public static implicit operator uint( PartnerId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (PartnerId_t) p );
public bool Equals( PartnerId_t p ) => p.Value == Value;
public static bool operator ==( PartnerId_t a, PartnerId_t b ) => a.Equals( b );
public static bool operator !=( PartnerId_t a, PartnerId_t b ) => !a.Equals( b );
public int CompareTo( PartnerId_t other ) => Value.CompareTo( other.Value );
}
internal struct ManifestId_t : IEquatable<ManifestId_t>, IComparable<ManifestId_t>
{
// Name: ManifestId_t, Type: unsigned long long
public ulong Value;
public static implicit operator ManifestId_t( ulong value ) => new ManifestId_t(){ Value = value };
public static implicit operator ulong( ManifestId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (ManifestId_t) p );
public bool Equals( ManifestId_t p ) => p.Value == Value;
public static bool operator ==( ManifestId_t a, ManifestId_t b ) => a.Equals( b );
public static bool operator !=( ManifestId_t a, ManifestId_t b ) => !a.Equals( b );
public int CompareTo( ManifestId_t other ) => Value.CompareTo( other.Value );
}
internal struct SiteId_t : IEquatable<SiteId_t>, IComparable<SiteId_t>
{
// Name: SiteId_t, Type: unsigned long long
public ulong Value;
public static implicit operator SiteId_t( ulong value ) => new SiteId_t(){ Value = value };
public static implicit operator ulong( SiteId_t value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (SiteId_t) p );
public bool Equals( SiteId_t p ) => p.Value == Value;
public static bool operator ==( SiteId_t a, SiteId_t b ) => a.Equals( b );
public static bool operator !=( SiteId_t a, SiteId_t b ) => !a.Equals( b );
public int CompareTo( SiteId_t other ) => Value.CompareTo( other.Value );
}
internal struct PartyBeaconID_t : IEquatable<PartyBeaconID_t>, IComparable<PartyBeaconID_t>
{
// Name: PartyBeaconID_t, Type: unsigned long long
@@ -278,22 +102,6 @@ namespace Steamworks.Data
public int CompareTo( HAuthTicket other ) => Value.CompareTo( other.Value );
}
internal struct BREAKPAD_HANDLE : IEquatable<BREAKPAD_HANDLE>, IComparable<BREAKPAD_HANDLE>
{
// Name: BREAKPAD_HANDLE, Type: void *
public IntPtr Value;
public static implicit operator BREAKPAD_HANDLE( IntPtr value ) => new BREAKPAD_HANDLE(){ Value = value };
public static implicit operator IntPtr( BREAKPAD_HANDLE value ) => value.Value;
public override string ToString() => Value.ToString();
public override int GetHashCode() => Value.GetHashCode();
public override bool Equals( object p ) => this.Equals( (BREAKPAD_HANDLE) p );
public bool Equals( BREAKPAD_HANDLE p ) => p.Value == Value;
public static bool operator ==( BREAKPAD_HANDLE a, BREAKPAD_HANDLE b ) => a.Equals( b );
public static bool operator !=( BREAKPAD_HANDLE a, BREAKPAD_HANDLE b ) => !a.Equals( b );
public int CompareTo( BREAKPAD_HANDLE other ) => Value.ToInt64().CompareTo( other.Value.ToInt64() );
}
internal struct HSteamPipe : IEquatable<HSteamPipe>, IComparable<HSteamPipe>
{
// Name: HSteamPipe, Type: int

View File

@@ -0,0 +1,282 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using Steamworks.Data;
namespace Steamworks
{
internal static unsafe class BufferManager
{
private sealed class ReferenceCounter
{
public IntPtr Pointer { get; private set; }
public int Size { get; private set; }
private int _count;
public void Set( IntPtr ptr, int size, int referenceCount )
{
if ( ptr == IntPtr.Zero )
throw new ArgumentNullException( nameof( ptr ) );
if ( size <= 0 )
throw new ArgumentOutOfRangeException( nameof( size ) );
if ( referenceCount <= 0 )
throw new ArgumentOutOfRangeException( nameof( referenceCount ) );
Pointer = ptr;
Size = size;
var prevCount = Interlocked.Exchange(ref _count, referenceCount);
if (prevCount != 0)
{
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Warning, $"{nameof( BufferManager )} set reference count when current count was not 0" );
#endif
}
}
public bool Decrement()
{
var newCount = Interlocked.Decrement( ref _count );
if ( newCount < 0 )
{
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Bug, $"Prevented double free of {nameof(BufferManager)} pointer" );
return false;
}
return newCount == 0;
}
}
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
private delegate void FreeFn( NetMsg* msg );
private static readonly Stack<ReferenceCounter> ReferenceCounterPool =
new Stack<ReferenceCounter>( 1024 );
private static readonly Dictionary<int, Stack<IntPtr>> BufferPools =
new Dictionary<int, Stack<IntPtr>>();
private static readonly Dictionary<IntPtr, ReferenceCounter> ReferenceCounters =
new Dictionary<IntPtr, ReferenceCounter>( 1024 );
private static readonly FreeFn FreeFunctionPin = new FreeFn( Free );
public static readonly IntPtr FreeFunctionPointer = Marshal.GetFunctionPointerForDelegate( FreeFunctionPin );
public static IntPtr Get( int size, int referenceCount )
{
const int maxSize = 16 * 1024 * 1024;
if ( size < 0 || size > maxSize )
throw new ArgumentOutOfRangeException( nameof( size ) );
if ( referenceCount <= 0 )
throw new ArgumentOutOfRangeException( nameof( referenceCount ) );
AllocateBuffer( size, out var ptr, out var actualSize );
var counter = AllocateReferenceCounter( ptr, actualSize, referenceCount );
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} allocated {ptr.ToInt64():X8} (size={size}, actualSize={actualSize}) with {referenceCount} references" );
#endif
lock ( ReferenceCounters )
{
ReferenceCounters.Add( ptr, counter );
}
return ptr;
}
[MonoPInvokeCallback]
private static void Free( NetMsg* msg )
{
var ptr = msg->DataPtr;
lock ( ReferenceCounters )
{
if ( !ReferenceCounters.TryGetValue( ptr, out var counter ) )
{
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Bug, $"Attempt to free pointer not tracked by {nameof(BufferManager)}: {ptr.ToInt64():X8}" );
return;
}
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose, $"{nameof( BufferManager )} decrementing reference count of {ptr.ToInt64():X8}" );
#endif
if ( counter.Decrement() )
{
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose, $"{nameof( BufferManager )} freeing {ptr.ToInt64():X8} as it is now unreferenced" );
if ( ptr != counter.Pointer )
{
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Bug,
$"{nameof( BufferManager )} freed pointer ({ptr.ToInt64():X8}) does not match counter pointer ({counter.Pointer.ToInt64():X8})" );
}
var bucketSize = GetBucketSize( counter.Size );
if ( counter.Size != bucketSize )
{
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Bug,
$"{nameof( BufferManager )} freed pointer size ({counter.Size}) does not match bucket size ({bucketSize})" );
}
#endif
ReferenceCounters.Remove( ptr );
FreeBuffer( ptr, counter.Size );
FreeReferenceCounter( counter );
}
}
}
private static ReferenceCounter AllocateReferenceCounter( IntPtr ptr, int size, int referenceCount )
{
lock ( ReferenceCounterPool )
{
var counter = ReferenceCounterPool.Count > 0
? ReferenceCounterPool.Pop()
: new ReferenceCounter();
counter.Set( ptr, size, referenceCount );
return counter;
}
}
private static void FreeReferenceCounter( ReferenceCounter counter )
{
if ( counter == null )
throw new ArgumentNullException( nameof( counter ) );
lock ( ReferenceCounterPool )
{
if ( ReferenceCounterPool.Count >= 1024 )
{
// we don't want to keep a ton of these lying around - let it GC if we have too many
return;
}
ReferenceCounterPool.Push( counter );
}
}
private static void AllocateBuffer( int minimumSize, out IntPtr ptr, out int size )
{
var bucketSize = GetBucketSize( minimumSize );
if ( bucketSize <= 0 )
{
// not bucketed, no pooling for this size
ptr = Marshal.AllocHGlobal( minimumSize );
size = minimumSize;
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} allocated unpooled pointer {ptr.ToInt64():X8} (size={size})" );
#endif
return;
}
lock ( BufferPools )
{
if ( !BufferPools.TryGetValue( bucketSize, out var bucketPool ) || bucketPool.Count == 0 )
{
// nothing pooled yet, but we can pool this size
ptr = Marshal.AllocHGlobal( bucketSize );
size = bucketSize;
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} allocated new poolable pointer {ptr.ToInt64():X8} (size={size})" );
#endif
return;
}
ptr = bucketPool.Pop();
size = bucketSize;
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} allocated pointer from pool {ptr.ToInt64():X8} (size={size})" );
#endif
}
}
private static void FreeBuffer( IntPtr ptr, int size )
{
var bucketSize = GetBucketSize( size );
var bucketLimit = GetBucketLimit( size );
if ( bucketSize <= 0 || bucketLimit <= 0 )
{
// not bucketed, no pooling for this size
Marshal.FreeHGlobal( ptr );
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} freed unpooled pointer {ptr.ToInt64():X8} (size={size})" );
#endif
return;
}
lock ( BufferPools )
{
if ( !BufferPools.TryGetValue( bucketSize, out var bucketPool ) )
{
bucketPool = new Stack<IntPtr>( bucketLimit );
BufferPools.Add( bucketSize, bucketPool );
}
if ( bucketPool.Count >= bucketLimit )
{
// pool overflow, get rid
Marshal.FreeHGlobal( ptr );
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} pool overflow, freed pooled pointer {ptr.ToInt64():X8} (size={size})" );
#endif
return;
}
bucketPool.Push( ptr );
#if DEBUG
SteamNetworkingUtils.LogDebugMessage( NetDebugOutput.Verbose,
$"{nameof( BufferManager )} returned pointer to pool {ptr.ToInt64():X8} (size={size})" );
#endif
}
}
private const int Bucket512 = 512;
private const int Bucket1Kb = 1 * 1024;
private const int Bucket4Kb = 4 * 1024;
private const int Bucket16Kb = 16 * 1024;
private const int Bucket64Kb = 64 * 1024;
private const int Bucket256Kb = 256 * 1024;
private static int GetBucketSize( int size )
{
if ( size <= Bucket512 ) return Bucket512;
if ( size <= Bucket1Kb ) return Bucket1Kb;
if ( size <= Bucket4Kb ) return Bucket4Kb;
if ( size <= Bucket16Kb ) return Bucket16Kb;
if ( size <= Bucket64Kb ) return Bucket64Kb;
if ( size <= Bucket256Kb ) return Bucket256Kb;
return -1;
}
private static int GetBucketLimit( int size )
{
if ( size <= Bucket512 ) return 1024;
if ( size <= Bucket1Kb ) return 512;
if ( size <= Bucket4Kb ) return 128;
if ( size <= Bucket16Kb ) return 32;
if ( size <= Bucket64Kb ) return 16;
if ( size <= Bucket256Kb ) return 8;
return -1;
}
}
}

View File

@@ -11,13 +11,18 @@ namespace Steamworks.Data
/// You can override all the virtual functions to turn it into what you
/// want it to do.
/// </summary>
public struct Connection
public struct Connection : IEquatable<Connection>
{
public uint Id { get; set; }
public bool Equals( Connection other ) => Id == other.Id;
public override bool Equals( object obj ) => obj is Connection other && Id == other.Id;
public override int GetHashCode() => Id.GetHashCode();
public override string ToString() => Id.ToString();
public static implicit operator Connection( uint value ) => new Connection() { Id = value };
public static implicit operator uint( Connection value ) => value.Id;
public static bool operator ==( Connection value1, Connection value2 ) => value1.Equals( value2 );
public static bool operator !=( Connection value1, Connection value2 ) => !value1.Equals( value2 );
/// <summary>
/// Accept an incoming connection that has been received on a listen socket.
@@ -64,21 +69,41 @@ namespace Steamworks.Data
/// <summary>
/// This is the best version to use.
/// </summary>
public Result SendMessage( IntPtr ptr, int size, SendType sendType = SendType.Reliable )
public unsafe Result SendMessage( IntPtr ptr, int size, SendType sendType = SendType.Reliable, ushort laneIndex = 0 )
{
if ( ptr == IntPtr.Zero )
throw new ArgumentNullException( nameof( ptr ) );
if ( size == 0 )
throw new ArgumentException( "`size` cannot be zero", nameof( size ) );
var copyPtr = BufferManager.Get( size, 1 );
Buffer.MemoryCopy( (void*)ptr, (void*)copyPtr, size, size );
var message = SteamNetworkingUtils.AllocateMessage();
message->Connection = this;
message->Flags = sendType;
message->DataPtr = copyPtr;
message->DataSize = size;
message->FreeDataPtr = BufferManager.FreeFunctionPointer;
message->IdxLane = laneIndex;
long messageNumber = 0;
return SteamNetworkingSockets.Internal?.SendMessageToConnection( this, ptr, (uint) size, (int)sendType, ref messageNumber ) ?? Result.Fail;
SteamNetworkingSockets.Internal?.SendMessages( 1, &message, &messageNumber );
return messageNumber >= 0
? Result.OK
: (Result)(-messageNumber);
}
/// <summary>
/// Ideally should be using an IntPtr version unless you're being really careful with the byte[] array and
/// you're not creating a new one every frame (like using .ToArray())
/// </summary>
public unsafe Result SendMessage( byte[] data, SendType sendType = SendType.Reliable )
public unsafe Result SendMessage( byte[] data, SendType sendType = SendType.Reliable, ushort laneIndex = 0 )
{
fixed ( byte* ptr = data )
{
return SendMessage( (IntPtr)ptr, data.Length, sendType );
return SendMessage( (IntPtr)ptr, data.Length, sendType, laneIndex );
}
}
@@ -86,21 +111,21 @@ namespace Steamworks.Data
/// Ideally should be using an IntPtr version unless you're being really careful with the byte[] array and
/// you're not creating a new one every frame (like using .ToArray())
/// </summary>
public unsafe Result SendMessage( byte[] data, int offset, int length, SendType sendType = SendType.Reliable )
public unsafe Result SendMessage( byte[] data, int offset, int length, SendType sendType = SendType.Reliable, ushort laneIndex = 0 )
{
fixed ( byte* ptr = data )
{
return SendMessage( (IntPtr)ptr + offset, length, sendType );
return SendMessage( (IntPtr)ptr + offset, length, sendType, laneIndex );
}
}
/// <summary>
/// This creates a ton of garbage - so don't do anything with this beyond testing!
/// </summary>
public unsafe Result SendMessage( string str, SendType sendType = SendType.Reliable )
public unsafe Result SendMessage( string str, SendType sendType = SendType.Reliable, ushort laneIndex = 0 )
{
var bytes = System.Text.Encoding.UTF8.GetBytes( str );
return SendMessage( bytes, sendType );
return SendMessage( bytes, sendType, laneIndex );
}
/// <summary>
@@ -121,5 +146,27 @@ namespace Steamworks.Data
return strVal;
}
/// <summary>
/// Returns a small set of information about the real-time state of the connection.
/// </summary>
public ConnectionStatus QuickStatus()
{
ConnectionStatus connectionStatus = default( ConnectionStatus );
SteamNetworkingSockets.Internal?.GetConnectionRealTimeStatus( this, ref connectionStatus, 0, null );
return connectionStatus;
}
/// <summary>
/// Configure multiple outbound messages streams ("lanes") on a connection, and
/// control head-of-line blocking between them.
/// </summary>
public Result ConfigureConnectionLanes( int[] lanePriorities, ushort[] laneWeights )
{
return SteamNetworkingSockets.Internal?.ConfigureConnectionLanes( this, lanePriorities.Length, lanePriorities, laneWeights )
?? Result.Fail;
}
}
}

View File

@@ -0,0 +1,34 @@
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
/// <summary>
/// Describe the status of a connection
/// </summary>
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
public struct ConnectionLaneStatus
{
internal int cbPendingUnreliable; // m_cbPendingUnreliable int
internal int cbPendingReliable; // m_cbPendingReliable int
internal int cbSentUnackedReliable; // m_cbSentUnackedReliable int
internal int _reservePad1; // _reservePad1 int
internal long ecQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.U4 )]
internal uint[] reserved; // reserved uint32 [10]
/// <summary>
/// Number of bytes unreliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire.
/// </summary>
public int PendingUnreliable => cbPendingUnreliable;
/// <summary>
/// Number of bytes reliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire.
/// </summary>
public int PendingReliable => cbPendingReliable;
/// <summary>
/// Number of bytes of reliable data that has been placed the wire, but for which we have not yet received an acknowledgment, and thus we may have to re-transmit.
/// </summary>
public int SentUnackedReliable => cbSentUnackedReliable;
}
}

View File

@@ -1,6 +1,5 @@
using Steamworks.Data;
using System;
using System.Runtime.InteropServices;
namespace Steamworks
{
@@ -36,7 +35,10 @@ namespace Steamworks
set => Connection.UserData = value;
}
public void Close() => Connection.Close();
public void Close( bool linger = false, int reasonCode = 0, string debugString = "Closing Connection" )
{
Connection.Close( linger, reasonCode, debugString );
}
public override string ToString() => Connection.ToString();
@@ -44,18 +46,40 @@ namespace Steamworks
{
ConnectionInfo = info;
//
// Some notes:
// - Update state before the callbacks, in case an exception is thrown
// - ConnectionState.None happens when a connection is destroyed, even if it was already disconnected (ClosedByPeer / ProblemDetectedLocally)
//
switch ( info.State )
{
case ConnectionState.Connecting:
OnConnecting( info );
if ( !Connecting && !Connected )
{
Connecting = true;
OnConnecting( info );
}
break;
case ConnectionState.Connected:
OnConnected( info );
if ( Connecting && !Connected )
{
Connecting = false;
Connected = true;
OnConnected( info );
}
break;
case ConnectionState.ClosedByPeer:
case ConnectionState.ProblemDetectedLocally:
case ConnectionState.None:
OnDisconnected( info );
if ( Connecting || Connected )
{
Connecting = false;
Connected = false;
OnDisconnected( info );
}
break;
}
}
@@ -66,8 +90,6 @@ namespace Steamworks
public virtual void OnConnecting( ConnectionInfo info )
{
Interface?.OnConnecting( info );
Connecting = true;
}
/// <summary>
@@ -76,9 +98,6 @@ namespace Steamworks
public virtual void OnConnected( ConnectionInfo info )
{
Interface?.OnConnected( info );
Connected = true;
Connecting = false;
}
/// <summary>
@@ -87,52 +106,166 @@ namespace Steamworks
public virtual void OnDisconnected( ConnectionInfo info )
{
Interface?.OnDisconnected( info );
Connected = false;
Connecting = false;
}
public void Receive( int bufferSize = 32 )
public unsafe int Receive( int bufferSize = 32, bool receiveToEnd = true )
{
if (SteamNetworkingSockets.Internal is null) { return; }
if (SteamNetworkingSockets.Internal is null) { return 0; }
if ( bufferSize < 1 || bufferSize > 256 ) throw new ArgumentOutOfRangeException( nameof( bufferSize ) );
int totalProcessed = 0;
NetMsg** messageBuffer = stackalloc NetMsg*[bufferSize];
int processed = 0;
IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
try
while ( true )
{
processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnConnection( Connection, messageBuffer, bufferSize );
int processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnConnection( Connection, new IntPtr( &messageBuffer[0] ), bufferSize );
totalProcessed += processed;
for ( int i = 0; i < processed; i++ )
try
{
ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) );
for ( int i = 0; i < processed; i++ )
{
ReceiveMessage( ref messageBuffer[i] );
}
}
catch
{
for ( int i = 0; i < processed; i++ )
{
if ( messageBuffer[i] != null )
{
NetMsg.InternalRelease( messageBuffer[i] );
}
}
throw;
}
//
// Keep going if receiveToEnd and we filled the buffer
//
if ( !receiveToEnd || processed < bufferSize )
break;
}
return totalProcessed;
}
/// <summary>
/// Sends a message to multiple connections.
/// </summary>
/// <param name="connections">The connections to send the message to.</param>
/// <param name="connectionCount">The number of connections to send the message to, to allow reusing the connections array.</param>
/// <param name="ptr">Pointer to the message data.</param>
/// <param name="size">Size of the message data.</param>
/// <param name="sendType">Flags to control delivery of the message.</param>
/// <param name="results">An optional array to hold the results of sending the messages for each connection.</param>
public unsafe void SendMessages( Connection[] connections, int connectionCount, IntPtr ptr, int size, SendType sendType = SendType.Reliable, Result[]? results = null )
{
if ( connections == null )
throw new ArgumentNullException( nameof( connections ) );
if ( connectionCount < 0 || connectionCount > connections.Length )
throw new ArgumentException( "`connectionCount` must be between 0 and `connections.Length`", nameof( connectionCount ) );
if ( results != null && connectionCount > results.Length )
throw new ArgumentException( "`results` must have at least `connectionCount` entries", nameof( results ) );
if ( connectionCount > 1024 ) // restricting this because we stack allocate based on this value
throw new ArgumentOutOfRangeException( nameof( connectionCount ) );
if ( ptr == IntPtr.Zero )
throw new ArgumentNullException( nameof( ptr ) );
if ( size == 0 )
throw new ArgumentException( "`size` cannot be zero", nameof( size ) );
if ( SteamNetworkingSockets.Internal is null )
return;
if ( connectionCount == 0 )
return;
// SendMessages does not make a copy of the data. We will need to copy because we don't want to force the caller to keep the pointer valid.
// 1. We don't want a copy per message. They all refer to the same data. This is the benefit of using Broadcast vs. many sends.
// 2. We need to use unmanaged memory. Managed memory may move around and invalidate pointers so it's not an option.
// 3. We'll use a reference counter and custom free() function to release this unmanaged memory.
var copyPtr = BufferManager.Get( size, connectionCount );
Buffer.MemoryCopy( (void*)ptr, (void*)copyPtr, size, size );
var messages = stackalloc NetMsg*[connectionCount];
var messageNumberOrResults = stackalloc long[results != null ? connectionCount : 0];
for ( var i = 0; i < connectionCount; i++ )
{
messages[i] = SteamNetworkingUtils.AllocateMessage();
messages[i]->Connection = connections[i];
messages[i]->Flags = sendType;
messages[i]->DataPtr = copyPtr;
messages[i]->DataSize = size;
messages[i]->FreeDataPtr = BufferManager.FreeFunctionPointer;
}
SteamNetworkingSockets.Internal.SendMessages( connectionCount, messages, messageNumberOrResults );
if (results == null)
return;
for ( var i = 0; i < connectionCount; i++ )
{
if ( messageNumberOrResults[i] < 0 )
{
results[i] = (Result)( -messageNumberOrResults[i] );
}
else
{
results[i] = Result.OK;
}
}
finally
{
Marshal.FreeHGlobal( messageBuffer );
}
//
// Overwhelmed our buffer, keep going
//
if ( processed == bufferSize )
Receive( bufferSize );
}
internal unsafe void ReceiveMessage( IntPtr msgPtr )
/// <summary>
/// Ideally should be using an IntPtr version unless you're being really careful with the byte[] array and
/// you're not creating a new one every frame (like using .ToArray())
/// </summary>
public unsafe void SendMessages( Connection[] connections, int connectionCount, byte[] data, SendType sendType = SendType.Reliable, Result[]? results = null )
{
fixed ( byte* ptr = data )
{
SendMessages( connections, connectionCount, (IntPtr)ptr, data.Length, sendType, results );
}
}
/// <summary>
/// Ideally should be using an IntPtr version unless you're being really careful with the byte[] array and
/// you're not creating a new one every frame (like using .ToArray())
/// </summary>
public unsafe void SendMessages( Connection[] connections, int connectionCount, byte[] data, int offset, int length, SendType sendType = SendType.Reliable, Result[]? results = null )
{
fixed ( byte* ptr = data )
{
SendMessages( connections, connectionCount, (IntPtr)ptr + offset, length, sendType, results );
}
}
/// <summary>
/// This creates a ton of garbage - so don't do anything with this beyond testing!
/// </summary>
public void SendMessages( Connection[] connections, int connectionCount, string str, SendType sendType = SendType.Reliable, Result[]? results = null )
{
var bytes = System.Text.Encoding.UTF8.GetBytes( str );
SendMessages( connections, connectionCount, bytes, sendType, results );
}
internal unsafe void ReceiveMessage( ref NetMsg* msg )
{
var msg = Marshal.PtrToStructure<NetMsg>( msgPtr );
try
{
OnMessage( msg.DataPtr, msg.DataSize, msg.RecvTime, msg.MessageNumber, msg.Channel );
OnMessage( msg->DataPtr, msg->DataSize, msg->RecvTime, msg->MessageNumber, msg->Channel );
}
finally
{
//
// Releases the message
//
NetMsg.InternalRelease( (NetMsg*) msgPtr );
NetMsg.InternalRelease( msg );
msg = null;
}
}
@@ -141,4 +274,4 @@ namespace Steamworks
Interface?.OnMessage( data, size, messageNum, recvTime, channel );
}
}
}
}

View File

@@ -0,0 +1,77 @@
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
/// <summary>
/// Describe the status of a connection
/// </summary>
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
public struct ConnectionStatus
{
internal ConnectionState state; // m_eState ESteamNetworkingConnectionState
internal int ping; // m_nPing int
internal float connectionQualityLocal; // m_flConnectionQualityLocal float
internal float connectionQualityRemote; // m_flConnectionQualityRemote float
internal float outPacketsPerSec; // m_flOutPacketsPerSec float
internal float outBytesPerSec; // m_flOutBytesPerSec float
internal float inPacketsPerSec; // m_flInPacketsPerSec float
internal float inBytesPerSec; // m_flInBytesPerSec float
internal int sendRateBytesPerSecond; // m_nSendRateBytesPerSecond int
internal int cbPendingUnreliable; // m_cbPendingUnreliable int
internal int cbPendingReliable; // m_cbPendingReliable int
internal int cbSentUnackedReliable; // m_cbSentUnackedReliable int
internal long ecQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4 )]
internal uint[] reserved; // reserved uint32 [16]
/// <summary>
/// Current ping (ms)
/// </summary>
public int Ping => ping;
/// <summary>
/// Outgoing packets per second
/// </summary>
public float OutPacketsPerSec => outPacketsPerSec;
/// <summary>
/// Outgoing bytes per second
/// </summary>
public float OutBytesPerSec => outBytesPerSec;
/// <summary>
/// Incoming packets per second
/// </summary>
public float InPacketsPerSec => inPacketsPerSec;
/// <summary>
/// Incoming bytes per second
/// </summary>
public float InBytesPerSec => inBytesPerSec;
/// <summary>
/// Connection quality measured locally, 0...1 (percentage of packets delivered end-to-end in order).
/// </summary>
public float ConnectionQualityLocal => connectionQualityLocal;
/// <summary>
/// Packet delivery success rate as observed from remote host, 0...1 (percentage of packets delivered end-to-end in order).
/// </summary>
public float ConnectionQualityRemote => connectionQualityRemote;
/// <summary>
/// Number of bytes unreliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire.
/// </summary>
public int PendingUnreliable => cbPendingUnreliable;
/// <summary>
/// Number of bytes reliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire.
/// </summary>
public int PendingReliable => cbPendingReliable;
/// <summary>
/// Number of bytes of reliable data that has been placed the wire, but for which we have not yet received an acknowledgment, and thus we may have to re-transmit.
/// </summary>
public int SentUnackedReliable => cbSentUnackedReliable;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Steamworks.Data;
namespace Steamworks
{
[UnmanagedFunctionPointer( Platform.CC )]
internal delegate void NetDebugFunc( [In] NetDebugOutput nType, [In] IntPtr pszMsg );
[UnmanagedFunctionPointer( Platform.CC )]
internal unsafe delegate void FnSteamNetConnectionStatusChanged( ref SteamNetConnectionStatusChangedCallback_t arg );
[UnmanagedFunctionPointer( Platform.CC )]
internal delegate void FnSteamNetAuthenticationStatusChanged( ref SteamNetAuthenticationStatus_t arg );
[UnmanagedFunctionPointer( Platform.CC )]
internal delegate void FnSteamRelayNetworkStatusChanged( ref SteamRelayNetworkStatus_t arg );
[UnmanagedFunctionPointer( Platform.CC )]
internal delegate void FnSteamNetworkingMessagesSessionRequest( ref SteamNetworkingMessagesSessionRequest_t arg );
[UnmanagedFunctionPointer( Platform.CC )]
internal delegate void FnSteamNetworkingMessagesSessionFailed( ref SteamNetworkingMessagesSessionFailed_t arg );
[UnmanagedFunctionPointer( Platform.CC )]
internal delegate void FnSteamNetworkingFakeIPResult( ref SteamNetworkingFakeIPResult_t arg );
}

View File

@@ -16,7 +16,7 @@ namespace Steamworks
void OnConnected( Connection connection, ConnectionInfo info );
/// <summary>
/// Called when the connection leaves
/// Called when the connection leaves. Must call Close on the connection
/// </summary>
void OnDisconnected( Connection connection, ConnectionInfo info );

View File

@@ -110,6 +110,18 @@ namespace Steamworks.Data
}
}
/// <summary>
/// Return true if IP is a fake IPv4 for Steam Datagram Relay
/// </summary>
public bool IsFakeIPv4
{
get
{
NetAddress self = this;
return SteamNetworkingUtils.Internal != null && SteamNetworkingUtils.Internal.IsFakeIPv4( InternalGetIPv4( ref self ) );
}
}
/// <summary>
/// Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1)
/// </summary>

View File

@@ -1,9 +0,0 @@
using Steamworks.Data;
using System;
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
[UnmanagedFunctionPointer( Platform.CC )]
delegate void NetDebugFunc( [In] NetDebugOutput nType, [In] IntPtr pszMsg );
}

View File

@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
namespace Steamworks.Data
{
[StructLayout( LayoutKind.Explicit, Pack = Platform.StructPlatformPackSize )]
internal struct NetKeyValue
internal partial struct NetKeyValue
{
[FieldOffset(0)]
internal NetConfig Value; // m_eValue ESteamNetworkingConfigValue

View File

@@ -1,5 +1,4 @@
using Steamworks.Data;
using System;
using System;
using System.Runtime.InteropServices;
namespace Steamworks.Data
@@ -17,5 +16,9 @@ namespace Steamworks.Data
internal IntPtr FreeDataPtr;
internal IntPtr ReleasePtr;
internal int Channel;
internal SendType Flags;
internal long UserData;
internal ushort IdxLane;
internal ushort _pad1__;
}
}
}

View File

@@ -16,8 +16,9 @@ namespace Steamworks
{
public ISocketManager? Interface { get; set; }
public List<Connection> Connecting = new List<Connection>();
public List<Connection> Connected = new List<Connection>();
public HashSet<Connection> Connecting = new HashSet<Connection>();
public HashSet<Connection> Connected = new HashSet<Connection>();
public Socket Socket { get; internal set; }
public override string ToString() => Socket.ToString();
@@ -44,17 +45,23 @@ namespace Steamworks
public virtual void OnConnectionChanged( Connection connection, ConnectionInfo info )
{
//
// Some notes:
// - Update state before the callbacks, in case an exception is thrown
// - ConnectionState.None happens when a connection is destroyed, even if it was already disconnected (ClosedByPeer / ProblemDetectedLocally)
//
switch ( info.State )
{
case ConnectionState.Connecting:
if ( !Connecting.Contains( connection ) )
if ( !Connecting.Contains( connection ) && !Connected.Contains( connection ) )
{
Connecting.Add( connection );
OnConnecting( connection, info );
}
break;
case ConnectionState.Connected:
if ( !Connected.Contains( connection ) )
if ( Connecting.Contains( connection ) && !Connected.Contains( connection ) )
{
Connecting.Remove( connection );
Connected.Add( connection );
@@ -67,6 +74,9 @@ namespace Steamworks
case ConnectionState.None:
if ( Connecting.Contains( connection ) || Connected.Contains( connection ) )
{
Connecting.Remove( connection );
Connected.Remove( connection );
OnDisconnected( connection, info );
}
break;
@@ -81,7 +91,6 @@ namespace Steamworks
if ( Interface != null )
{
Interface.OnConnecting( connection, info );
return;
}
else
{
@@ -104,17 +113,17 @@ namespace Steamworks
/// </summary>
public virtual void OnDisconnected( Connection connection, ConnectionInfo info )
{
SteamNetworkingSockets.Internal?.SetConnectionPollGroup( connection, 0 );
connection.Close();
Connecting.Remove( connection );
Connected.Remove( connection );
Interface?.OnDisconnected( connection, info );
if ( Interface != null )
{
Interface.OnDisconnected( connection, info );
}
else
{
connection.Close();
}
}
public void Receive( int bufferSize = 32 )
public int Receive( int bufferSize = 32, bool receiveToEnd = true )
{
int processed = 0;
IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
@@ -137,8 +146,10 @@ namespace Steamworks
//
// Overwhelmed our buffer, keep going
//
if ( processed == bufferSize )
Receive( bufferSize );
if ( receiveToEnd && processed == bufferSize )
processed += Receive( bufferSize );
return processed;
}
internal unsafe void ReceiveMessage( IntPtr msgPtr )
@@ -162,4 +173,4 @@ namespace Steamworks
Interface?.OnMessage( connection, identity, data, size, messageNum, recvTime, channel );
}
}
}
}

View File

@@ -15,9 +15,12 @@ namespace Steamworks
{
internal static ISteamApps? Internal => Interface as ISteamApps;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamApps( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
return true;
}
internal static void InstallEvents()
@@ -27,41 +30,41 @@ namespace Steamworks
}
/// <summary>
/// posted after the user gains ownership of DLC and that DLC is installed
/// Posted after the user gains ownership of DLC and that DLC is installed.
/// </summary>
public static event Action<AppId>? OnDlcInstalled;
/// <summary>
/// posted after the user gains executes a Steam URL with command line or query parameters
/// Posted after the user gains executes a Steam URL with command line or query parameters
/// such as steam://run/appid//-commandline/?param1=value1(and)param2=value2(and)param3=value3 etc
/// while the game is already running. The new params can be queried
/// with GetLaunchQueryParam and GetLaunchCommandLine
/// with GetLaunchQueryParam and GetLaunchCommandLine.
/// </summary>
public static event Action? OnNewLaunchParameters;
/// <summary>
/// Checks if the active user is subscribed to the current App ID
/// Gets whether or not the active user is subscribed to the current App ID.
/// </summary>
public static bool IsSubscribed => Internal != null && Internal.BIsSubscribed();
/// <summary>
/// Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID
/// Gets whether or not the user borrowed this game via Family Sharing. If true, call GetAppOwner() to get the lender SteamID.
/// </summary>
public static bool IsSubscribedFromFamilySharing => Internal != null && Internal.BIsSubscribedFromFamilySharing();
/// <summary>
/// Checks if the license owned by the user provides low violence depots.
/// Gets whether or not the license owned by the user provides low violence depots.
/// Low violence depots are useful for copies sold in countries that have content restrictions
/// </summary>
public static bool IsLowViolence => Internal != null && Internal.BIsLowViolence();
/// <summary>
/// Checks whether the current App ID license is for Cyber Cafes.
/// Gets whether or not the current App ID license is for Cyber Cafes.
/// </summary>
public static bool IsCybercafe => Internal != null && Internal.BIsCybercafe();
/// <summary>
/// CChecks if the user has a VAC ban on their account
/// Gets whether or not the user has a VAC ban on their account.
/// </summary>
public static bool IsVACBanned => Internal != null && Internal.BIsVACBanned();
@@ -77,19 +80,22 @@ namespace Steamworks
public static string[]? AvailableLanguages => Internal?.GetAvailableGameLanguages().Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries );
/// <summary>
/// Checks if the active user is subscribed to a specified AppId.
/// Gets whether or not the active user is subscribed to a specified App ID.
/// Only use this if you need to check ownership of another game related to yours, a demo for example.
/// </summary>
/// <param name="appid">The App ID of the DLC to check.</param>
public static bool IsSubscribedToApp( AppId appid ) => Internal != null && Internal.BIsSubscribedApp( appid.Value );
/// <summary>
/// Checks if the user owns a specific DLC and if the DLC is installed
/// Gets whether or not the user owns a specific DLC and if the DLC is installed.
/// </summary>
/// <param name="appid">The App ID of the DLC to check.</param>
public static bool IsDlcInstalled( AppId appid ) => Internal != null && Internal.BIsDlcInstalled( appid.Value );
/// <summary>
/// Returns the time of the purchase of the app
/// Returns the time of the purchase of the app.
/// </summary>
/// <param>The App ID to check the purchase time for.</param>
public static DateTime PurchaseTime( AppId appid = default )
{
if (Internal is null) { return default; }
@@ -101,14 +107,14 @@ namespace Steamworks
}
/// <summary>
/// Checks if the user is subscribed to the current app through a free weekend
/// This function will return false for users who have a retail or other type of license
/// Before using, please ask your Valve technical contact how to package and secure your free weekened
/// Checks if the user is subscribed to the current app through a free weekend.
/// This function will return false for users who have a retail or other type of license.
/// Before using, please ask your Valve technical contact how to package and secure your free weekened.
/// </summary>
public static bool IsSubscribedFromFreeWeekend => Internal != null && Internal.BIsSubscribedFromFreeWeekend();
/// <summary>
/// Returns metadata for all available DLC
/// Returns metadata for all available DLC.
/// </summary>
public static IEnumerable<DlcInformation> DlcInformation()
{
@@ -134,17 +140,19 @@ namespace Steamworks
}
/// <summary>
/// Install/Uninstall control for optional DLC
/// Install control for optional DLC.
/// </summary>
/// <param name="appid">The App ID of the DLC to install.</param>
public static void InstallDlc( AppId appid ) => Internal?.InstallDLC( appid.Value );
/// <summary>
/// Install/Uninstall control for optional DLC
/// Uninstall control for optional DLC.
/// </summary>
/// <param name="appid">The App ID of the DLC to uninstall.</param>
public static void UninstallDlc( AppId appid ) => Internal?.UninstallDLC( appid.Value );
/// <summary>
/// Returns null if we're not on a beta branch, else the name of the branch
/// Gets the name of the beta branch that is launched, or <see langword="null"/> if the application is not running on a beta branch.
/// </summary>
public static string? CurrentBetaName
{
@@ -158,16 +166,19 @@ namespace Steamworks
}
/// <summary>
/// Allows you to force verify game content on next launch.
///
/// If you detect the game is out-of-date(for example, by having the client detect a version mismatch with a server),
/// you can call use MarkContentCorrupt to force a verify, show a message to the user, and then quit.
/// Force verify game content on next launch.
/// <para>
/// If you detect the game is out-of-date (for example, by having the client detect a version mismatch with a server),
/// you can call MarkContentCorrupt to force a verify, show a message to the user, and then quit.
/// </para>
/// </summary>
/// <param name="missingFilesOnly">Whether or not to only verify missing files.</param>
public static void MarkContentCorrupt( bool missingFilesOnly ) => Internal?.MarkContentCorrupt( missingFilesOnly );
/// <summary>
/// Gets a list of all installed depots for a given App ID in mount order
/// Gets a list of all installed depots for a given App ID in mount order.
/// </summary>
/// <param name="appid">The App ID.</param>
public static IEnumerable<DepotId> InstalledDepots( AppId appid = default )
{
if (Internal is null) { yield break; }
@@ -185,9 +196,10 @@ namespace Steamworks
}
/// <summary>
/// Gets the install folder for a specific AppID.
/// Gets the install folder for a specific App ID.
/// This works even if the application is not installed, based on where the game would be installed with the default Steam library location.
/// </summary>
/// <param name="appid">The App ID.</param>
public static string? AppInstallDir( AppId appid = default )
{
if ( appid == 0 )
@@ -200,26 +212,32 @@ namespace Steamworks
}
/// <summary>
/// The app may not actually be owned by the current user, they may have it left over from a free weekend, etc.
/// Gets whether or not the app is owned by the current user. The app may not actually be owned by the current user; they may have it left over from a free weekend, etc.
/// </summary>
/// <param name="appid">The App ID.</param>
public static bool IsAppInstalled( AppId appid ) => Internal != null && Internal.BIsAppInstalled( appid.Value );
/// <summary>
/// Gets the Steam ID of the original owner of the current app. If it's different from the current user then it is borrowed..
/// Gets the Steam ID of the original owner of the current app. If it's different from the current user then it is borrowed.
/// </summary>
public static SteamId AppOwner => Internal?.GetAppOwner().Value ?? default;
/// <summary>
/// Gets the associated launch parameter if the game is run via steam://run/appid/?param1=value1;param2=value2;param3=value3 etc.
/// Parameter names starting with the character '@' are reserved for internal use and will always return an empty string.
/// Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,
/// <para>
/// Parameter names starting with the character '<c>@</c>' are reserved for internal use and will always return an empty string.
/// Parameter names starting with an underscore '<c>_</c>' are reserved for steam features -- they can be queried by the game,
/// but it is advised that you not param names beginning with an underscore for your own features.
/// </para>
/// </summary>
/// <param name="param">The name of the parameter.</param>
/// <returns>The launch parameter value.</returns>
public static string? GetLaunchParam( string param ) => Internal?.GetLaunchQueryParam( param );
/// <summary>
/// Gets the download progress for optional DLC.
/// </summary>
/// <param name="appid">The App ID to check the progress for.</param>
public static DownloadProgress DlcDownloadProgress( AppId appid )
{
ulong punBytesDownloaded = 0;
@@ -232,16 +250,16 @@ namespace Steamworks
}
/// <summary>
/// Gets the buildid of this app, may change at any time based on backend updates to the game.
/// Defaults to 0 if you're not running a build downloaded from steam.
/// Gets the Build ID of this app, which can change at any time based on backend updates to the game.
/// Defaults to <c>0</c> if you're not running a build downloaded from steam.
/// </summary>
public static int BuildId => Internal?.GetAppBuildId() ?? 0;
/// <summary>
/// Asynchronously retrieves metadata details about a specific file in the depot manifest.
/// Currently provides:
/// </summary>
/// <param name="filename">The name of the file.</param>
public static async Task<FileDetails?> GetFileDetailsAsync( string filename )
{
if (Internal is null) { return null; }
@@ -262,9 +280,9 @@ namespace Steamworks
/// Get command line if game was launched via Steam URL, e.g. steam://run/appid//command line/.
/// This method of passing a connect string (used when joining via rich presence, accepting an
/// invite, etc) is preferable to passing the connect string on the operating system command
/// line, which is a security risk. In order for rich presence joins to go through this
/// line, which is a security risk. In order for rich presence joins to go through this
/// path and not be placed on the OS command line, you must set a value in your app's
/// configuration on Steam. Ask Valve for help with this.
/// configuration on Steam. Ask Valve for help with this.
/// </summary>
public static string? CommandLine
{
@@ -276,5 +294,26 @@ namespace Steamworks
}
}
/// <summary>
/// Check if game is a timed trial with limited playtime.
/// </summary>
/// <param name="secondsAllowed">The amount of seconds left on the timed trial.</param>
/// <param name="secondsPlayed">The amount of seconds played on the timed trial.</param>
public static bool IsTimedTrial( out int secondsAllowed, out int secondsPlayed )
{
uint a = 0;
uint b = 0;
secondsAllowed = 0;
secondsPlayed = 0;
if ( Internal == null || !Internal.BIsTimedTrial( ref a, ref b ) )
return false;
secondsAllowed = (int) a;
secondsPlayed = (int) b;
return true;
}
}
}
}

View File

@@ -13,7 +13,7 @@ namespace Steamworks
/// <summary>
/// Initialize the steam client.
/// If asyncCallbacks is false you need to call RunCallbacks manually every frame.
/// If <paramref name="asyncCallbacks"/> is false you need to call <see cref="RunCallbacks"/> manually every frame.
/// </summary>
public static void Init( uint appid, bool asyncCallbacks = true )
{
@@ -25,7 +25,7 @@ namespace Steamworks
if ( !SteamAPI.Init() )
{
throw new System.Exception( "SteamApi_Init returned false. Steam isn't running, couldn't find Steam, AppId is ureleased, Don't own AppId." );
throw new System.Exception( "SteamApi_Init returned false. Steam isn't running, couldn't find Steam, App ID is ureleased, Don't own App ID." );
}
AppId = appid;
@@ -60,7 +60,9 @@ namespace Steamworks
AddInterface<SteamVideo>();
AddInterface<SteamRemotePlay>();
if ( asyncCallbacks )
initialized = openInterfaces.Count > 0;
if ( asyncCallbacks )
{
//
// This will keep looping in the background every 16 ms
@@ -73,8 +75,15 @@ namespace Steamworks
internal static void AddInterface<T>() where T : SteamClass, new()
{
var t = new T();
t.InitializeInterface( false );
openInterfaces.Add( t );
bool valid = t.InitializeInterface( false );
if ( valid )
{
openInterfaces.Add( t );
}
else
{
t.DestroyInterface( false );
}
}
static readonly List<SteamClass> openInterfaces = new List<SteamClass>();
@@ -91,6 +100,9 @@ namespace Steamworks
public static bool IsValid => initialized;
/// <summary>
/// Shuts down the steam client.
/// </summary>
public static void Shutdown()
{
if ( !IsValid ) return;
@@ -116,13 +128,15 @@ namespace Steamworks
/// <summary>
/// Checks if the current user's Steam client is connected to the Steam servers.
/// If it's not then no real-time services provided by the Steamworks API will be enabled. The Steam
/// <para>
/// If it's not, no real-time services provided by the Steamworks API will be enabled. The Steam
/// client will automatically be trying to recreate the connection as often as possible. When the
/// connection is restored a SteamServersConnected_t callback will be posted.
/// You usually don't need to check for this yourself. All of the API calls that rely on this will
/// check internally. Forcefully disabling stuff when the player loses access is usually not a
/// very good experience for the player and you could be preventing them from accessing APIs that do not
/// need a live connection to Steam.
/// </para>
/// </summary>
public static bool IsLoggedOn => SteamUser.Internal != null && SteamUser.Internal.BLoggedOn();
@@ -135,28 +149,30 @@ namespace Steamworks
public static SteamId SteamId => SteamUser.Internal?.GetSteamID() ?? default;
/// <summary>
/// returns the local players name - guaranteed to not be NULL.
/// this is the same name as on the users community profile page
/// returns the local players name - guaranteed to not be <see langword="null"/>.
/// This is the same name as on the user's community profile page.
/// </summary>
public static string? Name => SteamFriends.Internal?.GetPersonaName();
/// <summary>
/// gets the status of the current user
/// Gets the status of the current user.
/// </summary>
public static FriendState State => SteamFriends.Internal?.GetPersonaState() ?? FriendState.Offline;
/// <summary>
/// returns the appID of the current process
/// Returns the App ID of the current process.
/// </summary>
public static AppId AppId { get; internal set; }
/// <summary>
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't
/// this returns true then it starts the Steam client if required and launches your game again through it,
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.
/// <para>
/// This returns true then it starts the Steam client if required and launches your game again through it,
/// and you should quit your process as soon as possible. This effectively runs steam://run/AppId so it
/// may not relaunch the exact executable that called it, as it will always relaunch from the version
/// installed in your Steam library folder/
/// Note that during development, when not launching via Steam, this might always return true.
/// </para>
/// </summary>
public static bool RestartAppIfNecessary( uint appid )
{
@@ -178,4 +194,4 @@ namespace Steamworks
}
}
}
}

View File

@@ -8,19 +8,22 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Undocumented Parental Settings
/// Class for utilizing the Steam Friends API.
/// </summary>
public class SteamFriends : SteamClientClass<SteamFriends>
{
internal static ISteamFriends? Internal => Interface as ISteamFriends;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamFriends( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
richPresence = new Dictionary<string, string>();
InstallEvents();
return true;
}
static Dictionary<string, string>? richPresence;
@@ -30,53 +33,67 @@ namespace Steamworks
Dispatch.Install<PersonaStateChange_t>( x => OnPersonaStateChange?.Invoke( new Friend( x.SteamID ) ) );
Dispatch.Install<GameRichPresenceJoinRequested_t>( x => OnGameRichPresenceJoinRequested?.Invoke( new Friend( x.SteamIDFriend), x.ConnectUTF8() ) );
Dispatch.Install<GameConnectedFriendChatMsg_t>( OnFriendChatMessage );
Dispatch.Install<GameConnectedClanChatMsg_t>( OnGameConnectedClanChatMessage );
Dispatch.Install<GameOverlayActivated_t>( x => OnGameOverlayActivated?.Invoke( x.Active != 0 ) );
Dispatch.Install<GameServerChangeRequested_t>( x => OnGameServerChangeRequested?.Invoke( x.ServerUTF8(), x.PasswordUTF8() ) );
Dispatch.Install<GameLobbyJoinRequested_t>( x => OnGameLobbyJoinRequested?.Invoke( new Lobby( x.SteamIDLobby ), x.SteamIDFriend ) );
Dispatch.Install<FriendRichPresenceUpdate_t>( x => OnFriendRichPresenceUpdate?.Invoke( new Friend( x.SteamIDFriend ) ) );
Dispatch.Install<OverlayBrowserProtocolNavigation_t>( x => OnOverlayBrowserProtocol?.Invoke( x.RgchURIUTF8() ) );
}
/// <summary>
/// Called when chat message has been received from a friend. You'll need to turn on
/// ListenForFriendsMessages to recieve this. (friend, msgtype, message)
/// Invoked when a chat message has been received from a friend. You'll need to enable
/// <see cref="ListenForFriendsMessages"/> to recieve this. (friend, msgtype, message)
/// </summary>
public static event Action<Friend, string, string>? OnChatMessage;
/// <summary>
/// called when a friends' status changes
/// Invoked when a chat message has been received in a Steam group chat that we are in. Associated Functions: JoinClanChatRoom. (friend, msgtype, message)
/// </summary>
public static event Action<Friend, string, string>? OnClanChatMessage;
/// <summary>
/// Invoked when a friends' status changes.
/// </summary>
public static event Action<Friend>? OnPersonaStateChange;
/// <summary>
/// Called when the user tries to join a game from their friends list
/// rich presence will have been set with the "connect" key which is set here
/// Invoked when the user tries to join a game from their friends list.
/// Rich presence will have been set with the "connect" key which is set here.
/// </summary>
public static event Action<Friend, string>? OnGameRichPresenceJoinRequested;
/// <summary>
/// Posted when game overlay activates or deactivates
/// the game can use this to be pause or resume single player games
/// Invoked when game overlay activates or deactivates.
/// The game can use this to be pause or resume single player games.
/// </summary>
public static event Action<bool>? OnGameOverlayActivated;
/// <summary>
/// Called when the user tries to join a different game server from their friends list
/// game client should attempt to connect to specified server when this is received
/// Invoked when the user tries to join a different game server from their friends list.
/// Game client should attempt to connect to specified server when this is received.
/// </summary>
public static event Action<string, string>? OnGameServerChangeRequested;
/// <summary>
/// Called when the user tries to join a lobby from their friends list
/// game client should attempt to connect to specified lobby when this is received
/// Invoked when the user tries to join a lobby from their friends list.
/// Game client should attempt to connect to specified lobby when this is received.
/// </summary>
public static event Action<Lobby, SteamId>? OnGameLobbyJoinRequested;
/// <summary>
/// Callback indicating updated data about friends rich presence information
/// Invoked when a friend's rich presence data is updated.
/// </summary>
public static event Action<Friend>? OnFriendRichPresenceUpdate;
/// <summary>
/// Invoked when an overlay browser instance is navigated to a
/// protocol/scheme registered by <see cref="RegisterProtocolInOverlayBrowser(string)"/>.
/// </summary>
public static event Action<string>? OnOverlayBrowserProtocol;
static unsafe void OnFriendChatMessage( GameConnectedFriendChatMsg_t data )
{
if ( OnChatMessage == null ) return;
@@ -96,7 +113,29 @@ namespace Steamworks
OnChatMessage( friend, typeName, message );
}
static unsafe void OnGameConnectedClanChatMessage( GameConnectedClanChatMsg_t data )
{
if ( OnClanChatMessage == null ) return;
if ( Internal is null ) return;
var friend = new Friend( data.SteamIDUser );
using var buffer = Helpers.TakeMemory();
var type = ChatEntryType.ChatMsg;
SteamId chatter = data.SteamIDUser;
var len = Internal.GetClanChatMessage( data.SteamIDClanChat, data.MessageID, buffer, Helpers.MemoryBufferSize, ref type, ref chatter );
if ( len == 0 && type == ChatEntryType.Invalid )
return;
var typeName = type.ToString();
var message = Helpers.MemoryToString( buffer );
OnClanChatMessage( friend, typeName, message );
}
private static IEnumerable<Friend> GetFriendsWithFlag(FriendFlags flag)
{
if (Internal is null) { yield break; }
@@ -108,21 +147,28 @@ namespace Steamworks
}
}
public static string? GetFriendPersonaName( SteamId steamId )
{
return Internal?.GetFriendPersonaName(steamId);
}
/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> of friends that the current user has.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of friends.</returns>
public static IEnumerable<Friend> GetFriends()
{
return GetFriendsWithFlag(FriendFlags.Immediate);
}
/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> of blocked users that the current user has.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of blocked users.</returns>
public static IEnumerable<Friend> GetBlocked()
{
return GetFriendsWithFlag(FriendFlags.Blocked);
}
/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> of friend requests that the current user has.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> of friend requests.</returns>
public static IEnumerable<Friend> GetFriendsRequested()
{
return GetFriendsWithFlag( FriendFlags.FriendshipRequested );
@@ -177,7 +223,7 @@ namespace Steamworks
}
/// <summary>
/// The dialog to open. Valid options are:
/// Opens a specific overlay window. Valid options are:
/// "friends",
/// "community",
/// "players",
@@ -204,7 +250,7 @@ namespace Steamworks
/// <summary>
/// Activates the Steam Overlay to the Steam store page for the provided app.
/// </summary>
public static void OpenStoreOverlay( AppId id ) => Internal?.ActivateGameOverlayToStore( id.Value, OverlayToStoreFlag.None );
public static void OpenStoreOverlay( AppId id, OverlayToStoreFlag overlayToStoreFlag = OverlayToStoreFlag.None ) => Internal?.ActivateGameOverlayToStore( id.Value, overlayToStoreFlag );
/// <summary>
/// Activates Steam Overlay web browser directly to the specified URL.
@@ -249,6 +295,11 @@ namespace Steamworks
await Task.Delay( 500 );
}
/// <summary>
/// Returns a small avatar of the user with the given <paramref name="steamid"/>.
/// </summary>
/// <param name="steamid">The <see cref="SteamId"/> of the user to get.</param>
/// <returns>A <see cref="Data.Image"/> with a value if the image was successfully retrieved.</returns>
public static async Task<Data.Image?> GetSmallAvatarAsync( SteamId steamid )
{
if (Internal is null) { return null; }
@@ -256,6 +307,11 @@ namespace Steamworks
return SteamUtils.GetImage( Internal.GetSmallFriendAvatar( steamid ) );
}
/// <summary>
/// Returns a medium avatar of the user with the given <paramref name="steamid"/>.
/// </summary>
/// <param name="steamid">The <see cref="SteamId"/> of the user to get.</param>
/// <returns>A <see cref="Data.Image"/> with a value if the image was successfully retrieved.</returns>
public static async Task<Data.Image?> GetMediumAvatarAsync( SteamId steamid )
{
if (Internal is null) { return null; }
@@ -263,6 +319,11 @@ namespace Steamworks
return SteamUtils.GetImage( Internal.GetMediumFriendAvatar( steamid ) );
}
/// <summary>
/// Returns a large avatar of the user with the given <paramref name="steamid"/>.
/// </summary>
/// <param name="steamid">The <see cref="SteamId"/> of the user to get.</param>
/// <returns>A <see cref="Data.Image"/> with a value if the image was successfully retrieved.</returns>
public static async Task<Data.Image?> GetLargeAvatarAsync( SteamId steamid )
{
if (Internal is null) { return null; }
@@ -335,6 +396,11 @@ namespace Steamworks
}
}
/// <summary>
/// Gets whether or not the current user is following the user with the given <paramref name="steamID"/>.
/// </summary>
/// <param name="steamID">The <see cref="SteamId"/> to check.</param>
/// <returns>Boolean.</returns>
public static async Task<bool> IsFollowing(SteamId steamID)
{
if (Internal is null) { return false; }
@@ -369,5 +435,29 @@ namespace Steamworks
return steamIds.ToArray();
}
}
/// <summary>
/// Call this before calling ActivateGameOverlayToWebPage() to have the Steam Overlay Browser block navigations
/// to your specified protocol (scheme) uris and instead dispatch a OverlayBrowserProtocolNavigation callback to your game.
/// </summary>
public static bool RegisterProtocolInOverlayBrowser( string protocol )
{
return Internal != null && Internal.RegisterProtocolInOverlayBrowser( protocol );
}
public static async Task<bool> JoinClanChatRoom( SteamId chatId )
{
if ( Internal is null ) return false;
var result = await Internal.JoinClanChatRoom( chatId );
if ( !result.HasValue )
return false;
return result.Value.ChatRoomEnterResponse == RoomEnter.Success ;
}
public static bool SendClanChatRoomMessage( SteamId chatId, string message )
{
return Internal != null && Internal.SendClanChatMessage( chatId, message );
}
}
}

View File

@@ -1,34 +1,41 @@
using Steamworks.Data;
using System;
using Steamworks.Data;
using System.Collections.Generic;
namespace Steamworks
{
/// <summary>
/// Class for utilizing Steam Input.
/// </summary>
public class SteamInput : SteamClientClass<SteamInput>
{
internal static ISteamInput? Internal => Interface as ISteamInput;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamInput( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
return true;
}
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
/// <summary>
/// You shouldn't really need to call this because it get called by RunCallbacks on SteamClient
/// You shouldn't really need to call this because it gets called by <see cref="SteamClient.RunCallbacks"/>
/// but Valve think it might be a nice idea if you call it right before you get input info -
/// just to make sure the info you're getting is 100% up to date.
/// </summary>
public static void RunFrame()
{
Internal?.RunFrame();
Internal?.RunFrame( false );
}
static readonly InputHandle_t[] queryArray = new InputHandle_t[STEAM_CONTROLLER_MAX_COUNT];
/// <summary>
/// Return a list of connected controllers.
/// Gets a list of connected controllers.
/// </summary>
public static IEnumerable<Controller> Controllers
{
@@ -65,10 +72,43 @@ namespace Steamworks
ref origin
);
return Internal.GetGlyphForActionOrigin(origin);
return Internal.GetGlyphForActionOrigin_Legacy(origin);
}
internal static Dictionary<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
/// <summary>
/// Return an absolute path to the PNG image glyph for the provided digital action name. The current
/// action set in use for the controller will be used for the lookup. You should cache the result and
/// maintain your own list of loaded PNG assets.
/// </summary>
public static string? GetPngActionGlyph( Controller controller, string action, GlyphSize size )
{
if ( Internal is null ) { return null; }
InputActionOrigin origin = InputActionOrigin.None;
Internal.GetDigitalActionOrigins( controller.Handle, Internal.GetCurrentActionSet( controller.Handle ), GetDigitalActionHandle( action ), ref origin );
return Internal.GetGlyphPNGForActionOrigin( origin, size, 0 );
}
/// <summary>
/// Return an absolute path to the SVF image glyph for the provided digital action name. The current
/// action set in use for the controller will be used for the lookup. You should cache the result and
/// maintain your own list of loaded PNG assets.
/// </summary>
public static string? GetSvgActionGlyph( Controller controller, string action )
{
if ( Internal is null ) { return null; }
InputActionOrigin origin = InputActionOrigin.None;
Internal.GetDigitalActionOrigins( controller.Handle, Internal.GetCurrentActionSet( controller.Handle ), GetDigitalActionHandle( action ), ref origin );
return Internal.GetGlyphSVGForActionOrigin( origin, 0 );
}
internal static Dictionary<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
internal static InputDigitalActionHandle_t GetDigitalActionHandle( string name )
{
if (Internal is null) { return default; }
@@ -107,4 +147,4 @@ namespace Steamworks
return val;
}
}
}
}

View File

@@ -10,17 +10,20 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Undocumented Parental Settings
/// Class for utilizing the Steam Inventory API.
/// </summary>
public class SteamInventory : SteamSharedClass<SteamInventory>
{
internal static ISteamInventory? Internal => Interface as ISteamInventory;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamInventory( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal static void InstallEvents( bool server )
@@ -65,7 +68,7 @@ namespace Steamworks
/// <summary>
/// Call this if you're going to want to access definition information. You should be able to get
/// away with calling this once at the start if your game, assuming your items don't change all the time.
/// This will trigger OnDefinitionsUpdated at which point Definitions should be set.
/// This will trigger <see cref="OnDefinitionsUpdated"/> at which point Definitions should be set.
/// </summary>
public static void LoadItemDefinitions()
{
@@ -83,7 +86,7 @@ namespace Steamworks
}
/// <summary>
/// Will call LoadItemDefinitions and wait until Definitions is not null
/// Will call <see cref="LoadItemDefinitions"/> and wait until Definitions is not null
/// </summary>
public static async Task<bool> WaitForDefinitions( float timeoutSeconds = 30 )
{
@@ -302,7 +305,7 @@ namespace Steamworks
/// <summary>
/// Grant all promotional items the user is eligible for
/// Grant all promotional items the user is eligible for.
/// </summary>
public static async Task<InventoryResult?> GrantPromoItemsAsync()
{
@@ -351,8 +354,9 @@ namespace Steamworks
{
if (Internal is null) { return null; }
var item_i = items.Select( x => x._id ).ToArray();
var item_q = items.Select( x => (uint)1 ).ToArray();
var d = items.GroupBy( x => x._id ).ToDictionary( x => x.Key, x => (uint) x.Count() );
var item_i = d.Keys.ToArray();
var item_q = d.Values.ToArray();
var r = await Internal.StartPurchase( item_i, item_q, (uint)item_i.Length );
if ( !r.HasValue ) return null;
@@ -366,4 +370,4 @@ namespace Steamworks
}
}
}
}

View File

@@ -8,17 +8,20 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Functions for clients to access matchmaking services, favorites, and to operate on game lobbies
/// Methods for clients to access matchmaking services, favorites, and to operate on game lobbies
/// </summary>
public class SteamMatchmaking : SteamClientClass<SteamMatchmaking>
{
internal static ISteamMatchmaking? Internal => Interface as ISteamMatchmaking;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamMatchmaking( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
return true;
}
/// <summary>
@@ -101,69 +104,69 @@ namespace Steamworks
}
/// <summary>
/// Someone invited you to a lobby
/// Invoked when the current user is invited to a lobby.
/// </summary>
public static event Action<Friend, Lobby>? OnLobbyInvite;
/// <summary>
/// You joined a lobby
/// Invoked when the current user joins a lobby.
/// </summary>
public static event Action<Lobby>? OnLobbyEntered;
/// <summary>
/// You created a lobby
/// Invoked when the current user creates a lobby.
/// </summary>
public static event Action<Result, Lobby>? OnLobbyCreated;
/// <summary>
/// A game server has been associated with the lobby
/// Invoked when a game server has been associated with a lobby.
/// </summary>
public static event Action<Lobby, uint, ushort, SteamId>? OnLobbyGameCreated;
/// <summary>
/// The lobby metadata has changed
/// Invoked when a lobby's metadata is modified.
/// </summary>
public static event Action<Lobby>? OnLobbyDataChanged;
/// <summary>
/// The lobby member metadata has changed
/// Invoked when a member in a lobby's metadata is modified.
/// </summary>
public static event Action<Lobby, Friend>? OnLobbyMemberDataChanged;
/// <summary>
/// The lobby member joined
/// Invoked when a member joins a lobby.
/// </summary>
public static event Action<Lobby, Friend>? OnLobbyMemberJoined;
/// <summary>
/// The lobby member left the room
/// Invoked when a lobby member leaves the lobby.
/// </summary>
public static event Action<Lobby, Friend>? OnLobbyMemberLeave;
/// <summary>
/// The lobby member left the room
/// Invoked when a lobby member leaves the lobby.
/// </summary>
public static event Action<Lobby, Friend>? OnLobbyMemberDisconnected;
/// <summary>
/// The lobby member was kicked. The 3rd param is the user that kicked them.
/// Invoked when a lobby member is kicked from a lobby. The 3rd param is the user that kicked them.
/// </summary>
public static event Action<Lobby, Friend, Friend>? OnLobbyMemberKicked;
/// <summary>
/// The lobby member was banned. The 3rd param is the user that banned them.
/// Invoked when a lobby member is kicked from a lobby. The 3rd param is the user that kicked them.
/// </summary>
public static event Action<Lobby, Friend, Friend>? OnLobbyMemberBanned;
/// <summary>
/// A chat message was recieved from a member of a lobby
/// Invoked when a chat message is received from a member of the lobby.
/// </summary>
public static event Action<Lobby, Friend, string>? OnChatMessage;
public static LobbyQuery CreateLobbyQuery() { return new LobbyQuery(); }
/// <summary>
/// Creates a new invisible lobby. Call lobby.SetPublic to take it online.
/// Creates a new invisible lobby. Call <see cref="Lobby.SetPublic"/> to take it online.
/// </summary>
public static async Task<Lobby?> CreateLobbyAsync( int maxMembers = 100 )
{
@@ -176,7 +179,7 @@ namespace Steamworks
}
/// <summary>
/// Attempts to directly join the specified lobby
/// Attempts to directly join the specified lobby.
/// </summary>
public static async Task<Lobby?> JoinLobbyAsync( SteamId lobbyId )
{
@@ -189,7 +192,7 @@ namespace Steamworks
}
/// <summary>
/// Get a list of servers that are on your favorites list
/// Get a list of servers that are on the current user's favorites list.
/// </summary>
public static IEnumerable<ServerInfo> GetFavoriteServers()
{
@@ -215,7 +218,7 @@ namespace Steamworks
}
/// <summary>
/// Get a list of servers that you have added to your play history
/// Get a list of servers that the current user has added to their history.
/// </summary>
public static IEnumerable<ServerInfo> GetHistoryServers()
{
@@ -241,4 +244,4 @@ namespace Steamworks
}
}
}
}

View File

@@ -8,15 +8,18 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Functions for clients to access matchmaking services, favorites, and to operate on game lobbies
/// Methods for clients to access matchmaking services, favorites, and to operate on game lobbies
/// </summary>
internal class SteamMatchmakingServers : SteamClientClass<SteamMatchmakingServers>
{
internal static ISteamMatchmakingServers? Internal => Interface as ISteamMatchmakingServers;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamMatchmakingServers( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
return true;
}
}
}
}

View File

@@ -17,11 +17,13 @@ namespace Steamworks
{
internal static ISteamMusic? Internal => Interface as ISteamMusic;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamMusic( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
return true;
}
internal static void InstallEvents()
@@ -31,22 +33,22 @@ namespace Steamworks
}
/// <summary>
/// Playback status changed
/// Invoked when playback status is changed.
/// </summary>
public static event Action? OnPlaybackChanged;
/// <summary>
/// Volume changed, parameter is new volume
/// Invoked when the volume of the music player is changed.
/// </summary>
public static event Action<float>? OnVolumeChanged;
/// <summary>
/// Checks if Steam Music is enabled
/// Checks if Steam Music is enabled.
/// </summary>
public static bool IsEnabled => Internal != null && Internal.BIsEnabled();
/// <summary>
/// true if a song is currently playing, paused, or queued up to play; otherwise false.
/// <see langword="true"/> if a song is currently playing, paused, or queued up to play; otherwise <see langword="false"/>.
/// </summary>
public static bool IsPlaying => Internal != null && Internal.BIsPlaying();
@@ -55,23 +57,28 @@ namespace Steamworks
/// </summary>
public static MusicStatus Status => Internal?.GetPlaybackStatus() ?? MusicStatus.Undefined;
/// <summary>
/// Plays the music player.
/// </summary>
public static void Play() => Internal?.Play();
/// <summary>
/// Pauses the music player.
/// </summary>
public static void Pause() => Internal?.Pause();
/// <summary>
/// Have the Steam Music player play the previous song.
/// Forces the music player to play the previous song.
/// </summary>
public static void PlayPrevious() => Internal?.PlayPrevious();
/// <summary>
/// Have the Steam Music player skip to the next song
/// Forces the music player to skip to the next song.
/// </summary>
public static void PlayNext() => Internal?.PlayNext();
/// <summary>
/// Gets/Sets the current volume of the Steam Music player
/// Gets and sets the current volume of the Steam Music player
/// </summary>
public static float Volume
{
@@ -79,4 +86,4 @@ namespace Steamworks
set => Internal?.SetVolume( value );
}
}
}
}

View File

@@ -8,15 +8,21 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Class for utilizing the Steam Network API.
/// </summary>
public class SteamNetworking : SteamSharedClass<SteamNetworking>
{
internal static ISteamNetworking? Internal => Interface as ISteamNetworking;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamNetworking( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal static void InstallEvents( bool server )
@@ -32,20 +38,20 @@ namespace Steamworks
}
/// <summary>
/// This SteamId wants to send you a message. You should respond by calling AcceptP2PSessionWithUser
/// if you want to recieve their messages
/// Invoked when a <see cref="SteamId"/> wants to send the current user a message. You should respond by calling <see cref="AcceptP2PSessionWithUser(SteamId)"/>
/// if you want to recieve their messages.
/// </summary>
public static Action<SteamId>? OnP2PSessionRequest;
/// <summary>
/// Called when packets can't get through to the specified user.
/// Invoked when packets can't get through to the specified user.
/// All queued packets unsent at this point will be dropped, further attempts
/// to send will retry making the connection (but will be dropped if we fail again).
/// </summary>
public static Action<SteamId, P2PSessionError>? OnP2PConnectionFailed;
/// <summary>
/// This should be called in response to a OnP2PSessionRequest
/// This should be called in response to a <see cref="OnP2PSessionRequest"/>.
/// </summary>
public static bool AcceptP2PSessionWithUser( SteamId user ) => Internal != null && Internal.AcceptP2PSessionWithUser( user );
@@ -59,22 +65,31 @@ namespace Steamworks
/// <summary>
/// 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 OnP2PSessionRequest
/// If the remote user tries to send data to you again, a new <see cref="OnP2PSessionRequest"/>
/// callback will be posted
/// </summary>
public static bool CloseP2PSessionWithUser( SteamId user ) => Internal != null && Internal.CloseP2PSessionWithUser( user );
/// <summary>
/// Checks if a P2P packet is available to read, and gets the size of the message if there is one.
/// Checks if a P2P packet is available to read.
/// </summary>
public static bool IsP2PPacketAvailable( int channel = 0 )
{
uint _ = 0;
return Internal != null && Internal.IsP2PPacketAvailable( ref _, channel );
}
/// <summary>
/// Checks if a P2P packet is available to read, and gets the size of the message if there is one.
/// </summary>
public static bool IsP2PPacketAvailable( out uint msgSize, int channel = 0 )
{
msgSize = 0;
return Internal != null && Internal.IsP2PPacketAvailable( ref msgSize, channel );
}
/// <summary>
/// Reads in a packet that has been sent from another user via SendP2PPacket..
/// Reads in a packet that has been sent from another user via <c>SendP2PPacket</c>.
/// </summary>
public unsafe static P2Packet? ReadP2PPacket( int channel = 0 )
{
@@ -103,7 +118,7 @@ namespace Steamworks
}
/// <summary>
/// Reads in a packet that has been sent from another user via SendP2PPacket..
/// Reads in a packet that has been sent from another user via <c>SendP2PPacket</c>.
/// </summary>
public unsafe static bool ReadP2PPacket( byte[] buffer, ref uint size, ref SteamId steamid, int channel = 0 )
{
@@ -113,7 +128,7 @@ namespace Steamworks
}
/// <summary>
/// Reads in a packet that has been sent from another user via SendP2PPacket..
/// Reads in a packet that has been sent from another user via <c>SendP2PPacket</c>.
/// </summary>
public unsafe static bool ReadP2PPacket( byte* buffer, uint cbuf, ref uint size, ref SteamId steamid, int channel = 0 )
{

View File

@@ -12,10 +12,32 @@ namespace Steamworks
{
internal static ISteamNetworkingSockets? Internal => Interface as ISteamNetworkingSockets;
internal override void InitializeInterface( bool server )
/// <summary>
/// Get the identity assigned to this interface.
/// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned
/// to the gameserver. Returns false and sets the result to an invalid identity if we don't know
/// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID
/// even if they are not signed into Steam.)
/// </summary>
public static NetIdentity Identity
{
get
{
NetIdentity identity = default;
Internal?.GetIdentity( ref identity );
return identity;
}
}
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamNetworkingSockets( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
#region SocketInterface
@@ -66,6 +88,7 @@ namespace Steamworks
internal void InstallEvents( bool server )
{
Dispatch.Install<SteamNetConnectionStatusChangedCallback_t>( ConnectionStatusChanged, server );
Dispatch.Install<SteamNetworkingFakeIPResult_t>( FakeIPResult, server );
}
@@ -90,12 +113,25 @@ namespace Steamworks
public static event Action<Connection, ConnectionInfo>? OnConnectionStatusChanged;
private static void FakeIPResult( SteamNetworkingFakeIPResult_t data )
{
foreach ( var port in data.Ports )
{
if ( port == 0 ) continue;
var address = NetAddress.From( Utility.Int32ToIp( data.IP ), port );
OnFakeIPResult?.Invoke( address );
}
}
public static event Action<NetAddress>? OnFakeIPResult;
/// <summary>
/// Creates a "server" socket that listens for clients to connect to by calling
/// Connect, over ordinary UDP (IPv4 or IPv6)
///
/// To use this derive a class from SocketManager and override as much as you want.
/// To use this derive a class from <see cref="SocketManager"/> and override as much as you want.
///
/// </summary>
public static T? CreateNormalSocket<T>( NetAddress address ) where T : SocketManager, new()
@@ -115,7 +151,7 @@ namespace Steamworks
/// Creates a "server" socket that listens for clients to connect to by calling
/// Connect, over ordinary UDP (IPv4 or IPv6).
///
/// To use this you should pass a class that inherits ISocketManager. You can use
/// To use this you should pass a class that inherits <see cref="ISocketManager"/>. You can use
/// SocketManager to get connections and send messages, but the ISocketManager class
/// will received all the appropriate callbacks.
///
@@ -140,7 +176,7 @@ namespace Steamworks
}
/// <summary>
/// Connect to a socket created via <method>CreateListenSocketIP</method>
/// Connect to a socket created via <c>CreateListenSocketIP</c>.
/// </summary>
public static T? ConnectNormal<T>( NetAddress address ) where T : ConnectionManager, new()
{
@@ -154,7 +190,7 @@ namespace Steamworks
}
/// <summary>
/// Connect to a socket created via <method>CreateListenSocketIP</method>
/// Connect to a socket created via <c>CreateListenSocketIP</c>.
/// </summary>
public static ConnectionManager? ConnectNormal( NetAddress address, IConnectionManager iface )
{
@@ -174,9 +210,9 @@ namespace Steamworks
}
/// <summary>
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping)
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping).
///
/// To use this derive a class from SocketManager and override as much as you want.
/// To use this derive a class from <see cref="SocketManager"/> and override as much as you want.
///
/// </summary>
public static T? CreateRelaySocket<T>( int virtualport = 0 ) where T : SocketManager, new()
@@ -192,10 +228,10 @@ namespace Steamworks
}
/// <summary>
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping)
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping).
///
/// To use this you should pass a class that inherits ISocketManager. You can use
/// SocketManager to get connections and send messages, but the ISocketManager class
/// To use this you should pass a class that inherits <see cref="ISocketManager"/>. You can use
/// <see cref="SocketManager"/> to get connections and send messages, but the <see cref="ISocketManager"/> class
/// will received all the appropriate callbacks.
///
/// </summary>
@@ -219,7 +255,7 @@ namespace Steamworks
}
/// <summary>
/// Connect to a relay server
/// Connect to a relay server.
/// </summary>
public static T? ConnectRelay<T>( SteamId serverId, int virtualport = 0 ) where T : ConnectionManager, new()
{
@@ -232,5 +268,103 @@ namespace Steamworks
SetConnectionManager( t.Connection.Id, t );
return t;
}
/// <summary>
/// Connect to a relay server.
/// </summary>
public static ConnectionManager? ConnectRelay( SteamId serverId, int virtualport, IConnectionManager iface )
{
if ( Internal is null ) return null;
NetIdentity identity = serverId;
var options = Array.Empty<NetKeyValue>();
var connection = Internal.ConnectP2P( ref identity, virtualport, options.Length, options );
var t = new ConnectionManager
{
Connection = connection,
Interface = iface
};
SetConnectionManager( t.Connection.Id, t );
return t;
}
/// <summary>
/// Begin asynchronous process of allocating a fake IPv4 address that other
/// peers can use to contact us via P2P. IP addresses returned by this
/// function are globally unique for a given appid.
///
/// For gameservers, you *must* call this after initializing the SDK but before
/// beginning login. Steam needs to know in advance that FakeIP will be used.
/// </summary>
public static bool RequestFakeIP( int numFakePorts = 1 )
{
return Internal != null && Internal.BeginAsyncRequestFakeIP( numFakePorts );
}
/// <summary>
/// Return info about the FakeIP and port that we have been assigned, if any.
///
/// </summary>
public static Result GetFakeIP( int fakePortIndex, out NetAddress address )
{
if ( Internal is null )
{
address = default;
return Result.Fail;
}
var pInfo = default( SteamNetworkingFakeIPResult_t );
Internal.GetFakeIP( 0, ref pInfo );
address = NetAddress.From( Utility.Int32ToIp( pInfo.IP ), pInfo.Ports[fakePortIndex] );
return pInfo.Result;
}
/// <summary>
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping).
///
/// To use this derive a class from <see cref="SocketManager"/> and override as much as you want.
///
/// </summary>
public static T? CreateRelaySocketFakeIP<T>( int fakePortIndex = 0 ) where T : SocketManager, new()
{
if ( Internal is null ) { return null; }
var t = new T();
var options = Array.Empty<NetKeyValue>();
t.Socket = Internal.CreateListenSocketP2PFakeIP( 0, options.Length, options );
t.Initialize();
SetSocketManager( t.Socket.Id, t );
return t;
}
/// <summary>
/// Creates a server that will be relayed via Valve's network (hiding the IP and improving ping).
///
/// To use this you should pass a class that inherits <see cref="ISocketManager"/>. You can use
/// <see cref="SocketManager"/> to get connections and send messages, but the <see cref="ISocketManager"/> class
/// will received all the appropriate callbacks.
///
/// </summary>
public static SocketManager? CreateRelaySocketFakeIP( int fakePortIndex, ISocketManager intrface )
{
if ( Internal is null ) { return null; }
var options = Array.Empty<NetKeyValue>();
var socket = Internal.CreateListenSocketP2PFakeIP( 0, options.Length, options );
var t = new SocketManager
{
Socket = socket,
Interface = intrface
};
t.Initialize();
SetSocketManager( t.Socket.Id, t );
return t;
}
}
}
}

View File

@@ -8,16 +8,20 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Undocumented Parental Settings
/// Provides Steam Networking utilities.
/// </summary>
public class SteamNetworkingUtils : SteamSharedClass<SteamNetworkingUtils>
{
internal static ISteamNetworkingUtils? Internal => Interface as ISteamNetworkingUtils;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamNetworkingUtils( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallCallbacks( server );
return true;
}
static void InstallCallbacks( bool server )
@@ -36,7 +40,7 @@ namespace Steamworks
/// <summary>
/// A function to receive debug network information on. This will do nothing
/// unless you set DebugLevel to something other than None.
/// unless you set <see cref="DebugLevel"/> to something other than <see cref="NetDebugOutput.None"/>.
///
/// You should set this to an appropriate level instead of setting it to the highest
/// and then filtering it by hand because a lot of energy is used by creating the strings
@@ -64,21 +68,24 @@ namespace Steamworks
/// relay network. If you do not call this, the initialization will
/// be delayed until the first time you use a feature that requires access
/// to the relay network, which will delay that first access.
///
/// <para>
/// You can also call this to force a retry if the previous attempt has failed.
/// Performing any action that requires access to the relay network will also
/// trigger a retry, and so calling this function is never strictly necessary,
/// but it can be useful to call it a program launch time, if access to the
/// relay network is anticipated.
///
/// </para>
/// <para>
/// Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
/// callbacks to know when initialization has completed.
/// Typically initialization completes in a few seconds.
///
/// </para>
/// <para>
/// Note: dedicated servers hosted in known data centers do *not* need
/// to call this, since they do not make routing decisions. However, if
/// the dedicated server will be using P2P functionality, it will act as
/// a "client" and this should be called.
/// </para>
/// </summary>
public static void InitRelayNetworkAccess()
{
@@ -121,7 +128,7 @@ namespace Steamworks
/// <summary>
/// If you need ping information straight away, wait on this. It will return
/// immediately if you already have up to date ping data
/// immediately if you already have up to date ping data.
/// </summary>
public static async Task WaitForPingDataAsync( float maxAgeInSeconds = 60 * 5 )
{
@@ -141,7 +148,7 @@ namespace Steamworks
/// <summary>
/// [0 - 100] - Randomly discard N pct of packets
/// [0 - 100] - Randomly discard N pct of packets.
/// </summary>
public static float FakeSendPacketLoss
{
@@ -150,7 +157,7 @@ namespace Steamworks
}
/// <summary>
/// [0 - 100] - Randomly discard N pct of packets
/// [0 - 100] - Randomly discard N pct of packets.
/// </summary>
public static float FakeRecvPacketLoss
{
@@ -159,7 +166,7 @@ namespace Steamworks
}
/// <summary>
/// Delay all packets by N ms
/// Delay all packets by N ms.
/// </summary>
public static float FakeSendPacketLag
{
@@ -168,7 +175,7 @@ namespace Steamworks
}
/// <summary>
/// Delay all packets by N ms
/// Delay all packets by N ms.
/// </summary>
public static float FakeRecvPacketLag
{
@@ -177,7 +184,7 @@ namespace Steamworks
}
/// <summary>
/// Timeout value (in ms) to use when first connecting
/// Timeout value (in ms) to use when first connecting.
/// </summary>
public static int ConnectionTimeout
{
@@ -186,7 +193,7 @@ namespace Steamworks
}
/// <summary>
/// Timeout value (in ms) to use after connection is established
/// Timeout value (in ms) to use after connection is established.
/// </summary>
public static int Timeout
{
@@ -197,7 +204,7 @@ namespace Steamworks
/// <summary>
/// Upper limit of buffered pending bytes to be sent.
/// If this is reached SendMessage will return LimitExceeded.
/// Default is 524288 bytes (512k)
/// Default is 524288 bytes (512k).
/// </summary>
public static int SendBufferSize
{
@@ -205,17 +212,144 @@ namespace Steamworks
set => SetConfigInt( NetConfig.SendBufferSize, value );
}
/// <summary>
/// Minimum send rate clamp, 0 is no limit.
/// This value will control the min allowed sending rate that
/// bandwidth estimation is allowed to reach. Default is 0 (no-limit)
/// </summary>
public static int SendRateMin
{
get => GetConfigInt( NetConfig.SendRateMin );
set => SetConfigInt( NetConfig.SendRateMin, value );
}
/// <summary>
/// Get Debug Information via OnDebugOutput event
///
/// Except when debugging, you should only use NetDebugOutput.Msg
/// or NetDebugOutput.Warning. For best performance, do NOT
/// Maximum send rate clamp, 0 is no limit.
/// This value will control the max allowed sending rate that
/// bandwidth estimation is allowed to reach. Default is 0 (no-limit)
/// </summary>
public static int SendRateMax
{
get => GetConfigInt( NetConfig.SendRateMax );
set => SetConfigInt( NetConfig.SendRateMax, value );
}
/// <summary>
/// Nagle time, in microseconds. When SendMessage is called, if
/// the outgoing message is less than the size of the MTU, it will be
/// queued for a delay equal to the Nagle timer value. This is to ensure
/// that if the application sends several small messages rapidly, they are
/// coalesced into a single packet.
/// See historical RFC 896. Value is in microseconds.
/// Default is 5000us (5ms).
/// </summary>
public static int NagleTime
{
get => GetConfigInt( NetConfig.NagleTime );
set => SetConfigInt( NetConfig.NagleTime, value );
}
/// <summary>
/// Don't automatically fail IP connections that don't have
/// strong auth. On clients, this means we will attempt the connection even if
/// we don't know our identity or can't get a cert. On the server, it means that
/// we won't automatically reject a connection due to a failure to authenticate.
/// (You can examine the incoming connection and decide whether to accept it.)
/// <para>
/// This is a dev configuration value, and you should not let users modify it in
/// production.
/// </para>
/// </summary>
public static int AllowWithoutAuth
{
get => GetConfigInt( NetConfig.IP_AllowWithoutAuth );
set => SetConfigInt( NetConfig.IP_AllowWithoutAuth, value );
}
/// <summary>
/// Allow unencrypted (and unauthenticated) communication.
/// 0: Not allowed (the default)
/// 1: Allowed, but prefer encrypted
/// 2: Allowed, and preferred
/// 3: Required. (Fail the connection if the peer requires encryption.)
/// <para>
/// This is a dev configuration value, since its purpose is to disable encryption.
/// You should not let users modify it in production. (But note that it requires
/// the peer to also modify their value in order for encryption to be disabled.)
/// </para>
/// </summary>
public static int Unencrypted
{
get => GetConfigInt( NetConfig.Unencrypted );
set => SetConfigInt( NetConfig.Unencrypted, value );
}
/// <summary>
/// Log RTT calculations for inline pings and replies.
/// </summary>
public static int DebugLevelAckRTT
{
get => GetConfigInt( NetConfig.LogLevel_AckRTT );
set => SetConfigInt( NetConfig.LogLevel_AckRTT, value );
}
/// <summary>
/// Log SNP packets send.
/// </summary>
public static int DebugLevelPacketDecode
{
get => GetConfigInt( NetConfig.LogLevel_PacketDecode );
set => SetConfigInt( NetConfig.LogLevel_PacketDecode, value );
}
/// <summary>
/// Log each message send/recv.
/// </summary>
public static int DebugLevelMessage
{
get => GetConfigInt( NetConfig.LogLevel_Message );
set => SetConfigInt( NetConfig.LogLevel_Message, value );
}
/// <summary>
/// Log dropped packets.
/// </summary>
public static int DebugLevelPacketGaps
{
get => GetConfigInt( NetConfig.LogLevel_PacketGaps );
set => SetConfigInt( NetConfig.LogLevel_PacketGaps, value );
}
/// <summary>
/// Log P2P rendezvous messages.
/// </summary>
public static int DebugLevelP2PRendezvous
{
get => GetConfigInt( NetConfig.LogLevel_P2PRendezvous );
set => SetConfigInt( NetConfig.LogLevel_P2PRendezvous, value );
}
/// <summary>
/// Log ping relays.
/// </summary>
public static int DebugLevelSDRRelayPings
{
get => GetConfigInt( NetConfig.LogLevel_SDRRelayPings );
set => SetConfigInt( NetConfig.LogLevel_SDRRelayPings, value );
}
/// <summary>
/// Get Debug Information via <see cref="OnDebugOutput"/> event.
/// <para>
/// Except when debugging, you should only use <see cref="NetDebugOutput.Msg"/>
/// or <see cref="NetDebugOutput.Warning"/>. For best performance, do NOT
/// request a high detail level and then filter out messages in the callback.
///
/// </para>
/// <para>
/// This incurs all of the expense of formatting the messages, which are then discarded.
/// Setting a high priority value (low numeric value) here allows the library to avoid
/// doing this work.
/// </para>
/// </summary>
public static NetDebugOutput DebugLevel
{
@@ -230,12 +364,12 @@ namespace Steamworks
}
/// <summary>
/// So we can remember and provide a Get for DebugLEvel
/// So we can remember and provide a Get for DebugLevel.
/// </summary>
private static NetDebugOutput _debugLevel;
/// <summary>
/// We need to keep the delegate around until it's not used anymore
/// We need to keep the delegate around until it's not used anymore.
/// </summary>
static NetDebugFunc? _debugFunc;
@@ -256,6 +390,11 @@ namespace Steamworks
debugMessages.Enqueue( new DebugMessage { Type = nType, Msg = Helpers.MemoryToString( str ) } );
}
internal static void LogDebugMessage( NetDebugOutput type, string message )
{
debugMessages.Enqueue( new DebugMessage { Type = type, Msg = message } );
}
/// <summary>
/// Called regularly from the Dispatch loop so we can provide a timely
/// stream of messages.
@@ -271,6 +410,11 @@ namespace Steamworks
}
}
internal static unsafe NetMsg* AllocateMessage()
{
return Internal != null ? Internal.AllocateMessage(0) : null;
}
#region Config Internals
internal unsafe static bool SetConfigInt( NetConfig type, int value )

View File

@@ -14,10 +14,14 @@ namespace Steamworks
{
internal static ISteamParentalSettings? Internal => Interface as ISteamParentalSettings;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamParentalSettings( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal static void InstallEvents( bool server )
@@ -61,4 +65,4 @@ namespace Steamworks
/// </summary>
public static bool BIsFeatureInBlockList( ParentalFeature feature ) => Internal != null && Internal.BIsFeatureInBlockList( feature );
}
}
}

View File

@@ -17,10 +17,14 @@ namespace Steamworks
{
internal static ISteamParties? Internal => Interface as ISteamParties;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamParties( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal void InstallEvents( bool server )
@@ -30,18 +34,23 @@ namespace Steamworks
}
/// <summary>
/// The list of possible Party beacon locations has changed
/// Invoked when the list of possible Party beacon locations has changed
/// </summary>
public static event Action? OnBeaconLocationsUpdated;
/// <summary>
/// The list of active beacons may have changed
/// Invoked when the list of active beacons may have changed
/// </summary>
public static event Action? OnActiveBeaconsUpdated;
/// <summary>
/// Gets the amount of beacons that are active.
/// </summary>
public static int ActiveBeaconCount => (int)(Internal?.GetNumActiveBeacons() ?? 0);
/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> of active beacons.
/// </summary>
public static IEnumerable<PartyBeacon> ActiveBeacons
{
get
@@ -56,4 +65,4 @@ namespace Steamworks
}
}
}
}
}

View File

@@ -14,11 +14,14 @@ namespace Steamworks
{
internal static ISteamRemotePlay? Internal => Interface as ISteamRemotePlay;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamRemotePlay( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal void InstallEvents( bool server )
@@ -28,30 +31,30 @@ namespace Steamworks
}
/// <summary>
/// Called when a session is connected
/// Invoked when a session is connected.
/// </summary>
public static event Action<RemotePlaySession>? OnSessionConnected;
/// <summary>
/// Called when a session becomes disconnected
/// Invoked when a session becomes disconnected.
/// </summary>
public static event Action<RemotePlaySession>? OnSessionDisconnected;
/// <summary>
/// Get the number of currently connected Steam Remote Play sessions
/// Gets the number of currently connected Steam Remote Play sessions
/// </summary>
public static int SessionCount => (int)(Internal?.GetSessionCount() ?? 0);
/// <summary>
/// Get the currently connected Steam Remote Play session ID at the specified index.
/// IsValid will return false if it's out of bounds
/// IsValid will return <see langword="false"/> if it's out of bounds
/// </summary>
public static RemotePlaySession GetSession( int index ) => Internal?.GetSessionID( index ).Value ?? default;
/// <summary>
/// Invite a friend to Remote Play Together
/// This returns false if the invite can't be sent
/// Invite a friend to Remote Play Together.
/// This returns <see langword="false"/> if the invite can't be sent
/// </summary>
public static bool SendInvite( SteamId steamid ) => Internal != null && Internal.BSendRemotePlayTogetherInvite( steamid );
}

View File

@@ -8,22 +8,28 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Undocumented Parental Settings
/// Class for utilizing the Steam Remote Storage API.
/// </summary>
public class SteamRemoteStorage : SteamClientClass<SteamRemoteStorage>
{
internal static ISteamRemoteStorage? Internal => Interface as ISteamRemoteStorage;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamRemoteStorage( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
return true;
}
/// <summary>
/// Creates a new file, writes the bytes to the file, and then closes the file.
/// If the target file already exists, it is overwritten
/// </summary>
/// <param name="filename">The path of the file.</param>
/// <param name="data">The bytes of data.</param>
/// <returns>A boolean, detailing whether or not the operation was successful.</returns>
public unsafe static bool FileWrite( string filename, byte[] data )
{
fixed ( byte* ptr = data )
@@ -35,6 +41,7 @@ namespace Steamworks
/// <summary>
/// Opens a binary file, reads the contents of the file into a byte array, and then closes the file.
/// </summary>
/// <param name="filename">The path of the file.</param>
public unsafe static byte[]? FileRead( string filename )
{
if (Internal is null) { return null; }
@@ -46,6 +53,10 @@ namespace Steamworks
fixed ( byte* ptr = buffer )
{
var readsize = Internal.FileRead( filename, (IntPtr)ptr, size );
if ( readsize != size )
{
return null;
}
return buffer;
}
}
@@ -53,26 +64,35 @@ namespace Steamworks
/// <summary>
/// Checks whether the specified file exists.
/// </summary>
/// <param name="filename">The path of the file.</param>
/// <returns>Whether or not the file exists.</returns>
public static bool FileExists( string filename ) => Internal != null && Internal.FileExists( filename );
/// <summary>
/// Checks if a specific file is persisted in the steam cloud.
/// </summary>
/// <param name="filename">The path of the file.</param>
/// <returns>Boolean.</returns>
public static bool FilePersisted( string filename ) => Internal != null && Internal.FilePersisted( filename );
/// <summary>
/// Gets the specified file's last modified date/time.
/// </summary>
/// <param name="filename">The path of the file.</param>
/// <returns>A <see cref="DateTime"/> describing when the file was modified last.</returns>
public static DateTime FileTime( string filename ) => Internal != null ? Epoch.ToDateTime( Internal.GetFileTimestamp( filename ) ) : default;
/// <summary>
/// Gets the specified files size in bytes. 0 if not exists.
/// Returns the specified files size in bytes, or <c>0</c> if the file does not exist.
/// </summary>
/// <param name="filename">The path of the file.</param>
/// <returns>The size of the file in bytes, or <c>0</c> if the file doesn't exist.</returns>
public static int FileSize( string filename ) => Internal?.GetFileSize( filename ) ?? 0;
/// <summary>
/// Deletes the file from remote storage, but leaves it on the local disk and remains accessible from the API.
/// </summary>
/// <returns>A boolean, detailing whether or not the operation was successful.</returns>
public static bool FileForget( string filename ) => Internal != null && Internal.FileForget( filename );
/// <summary>
@@ -82,7 +102,7 @@ namespace Steamworks
/// <summary>
/// Number of bytes total
/// Gets the total number of quota bytes.
/// </summary>
public static ulong QuotaBytes
{
@@ -95,7 +115,7 @@ namespace Steamworks
}
/// <summary>
/// Number of bytes used
/// Gets the total number of quota bytes that have been used.
/// </summary>
public static ulong QuotaUsedBytes
{
@@ -108,7 +128,7 @@ namespace Steamworks
}
/// <summary>
/// Number of bytes remaining until your quota is used
/// Number of bytes remaining until the quota is used.
/// </summary>
public static ulong QuotaRemainingBytes
{
@@ -121,7 +141,7 @@ namespace Steamworks
}
/// <summary>
/// returns true if IsCloudEnabledForAccount AND IsCloudEnabledForApp
/// returns <see langword="true"/> if <see cref="IsCloudEnabledForAccount"/> AND <see cref="IsCloudEnabledForApp"/> are <see langword="true"/>.
/// </summary>
public static bool IsCloudEnabled => IsCloudEnabledForAccount && IsCloudEnabledForApp;
@@ -162,7 +182,7 @@ namespace Steamworks
}
/// <summary>
/// Get a list of filenames synchronized by Steam Cloud
/// Gets a list of filenames synchronized by Steam Cloud.
/// </summary>
public static List<RemoteFile> Files
{
@@ -182,4 +202,4 @@ namespace Steamworks
}
}
}
}
}

View File

@@ -8,16 +8,20 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Undocumented Parental Settings
/// Class for utilizing the Steam Screenshots API.
/// </summary>
public class SteamScreenshots : SteamClientClass<SteamScreenshots>
{
internal static ISteamScreenshots? Internal => Interface as ISteamScreenshots;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamScreenshots( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
return true;
}
internal static void InstallEvents()
@@ -33,19 +37,19 @@ namespace Steamworks
}
/// <summary>
/// A screenshot has been requested by the user from the Steam screenshot hotkey.
/// This will only be called if Hooked is true, in which case Steam
/// Invoked when a screenshot has been requested by the user from the Steam screenshot hotkey.
/// This will only be called if <see cref="Hooked"/> is true, in which case Steam
/// will not take the screenshot itself.
/// </summary>
public static event Action? OnScreenshotRequested;
/// <summary>
/// A screenshot successfully written or otherwise added to the library and can now be tagged.
/// Invoked when a screenshot has been successfully written or otherwise added to the library and can now be tagged.
/// </summary>
public static event Action<Screenshot>? OnScreenshotReady;
/// <summary>
/// A screenshot attempt failed
/// Invoked when a screenshot attempt failed.
/// </summary>
public static event Action<Result>? OnScreenshotFailed;
@@ -85,15 +89,17 @@ namespace Steamworks
/// <summary>
/// Causes the Steam overlay to take a screenshot.
/// If screenshots are being hooked by the game then a
/// ScreenshotRequested callback is sent back to the game instead.
/// <see cref="OnScreenshotRequested"/> callback is sent back to the game instead.
/// </summary>
public static void TriggerScreenshot() => Internal?.TriggerScreenshot();
/// <summary>
/// Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or if the game handles them.
/// <para>
/// Hooking is disabled by default, and only ever enabled if you do so with this function.
/// If the hooking is enabled, then the ScreenshotRequested_t callback will be sent if the user presses the hotkey or
/// when TriggerScreenshot is called, and then the game is expected to call WriteScreenshot or AddScreenshotToLibrary in response.
/// If the hooking is enabled, then the <see cref="OnScreenshotRequested"/> callback will be sent if the user presses the hotkey or
/// when TriggerScreenshot is called, and then the game is expected to call <see cref="WriteScreenshot(byte[], int, int)"/> or <see cref="AddScreenshot(string, string, int, int)"/> in response.
/// </para>
/// </summary>
public static bool Hooked
{
@@ -101,4 +107,4 @@ namespace Steamworks
set => Internal?.HookScreenshots( value );
}
}
}
}

View File

@@ -15,10 +15,14 @@ namespace Steamworks
{
internal static ISteamGameServer? Internal => Interface as ISteamGameServer;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamGameServer( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
return true;
}
public static bool IsValid => Internal != null && Internal.IsValid;
@@ -33,35 +37,35 @@ namespace Steamworks
}
/// <summary>
/// User has been authed or rejected
/// Invoked when aser has been authed or rejected
/// </summary>
public static event Action<SteamId, SteamId, AuthResponse>? OnValidateAuthTicketResponse;
/// <summary>
/// Called when a connections to the Steam back-end has been established.
/// Invoked when a connection to the Steam back-end has been established.
/// This means the server now is logged on and has a working connection to the Steam master server.
/// </summary>
public static event Action? OnSteamServersConnected;
/// <summary>
/// This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection (result, stilltrying)
/// This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection (result, stilltrying).
/// </summary>
public static event Action<Result, bool>? OnSteamServerConnectFailure;
/// <summary>
/// Disconnected from Steam
/// Invoked when the server is disconnected from Steam
/// </summary>
public static event Action<Result>? OnSteamServersDisconnected;
/// <summary>
/// Called when authentication status changes, useful for grabbing SteamId once aavailability is current
/// Invoked when authentication status changes, useful for grabbing <see cref="SteamId"/> once availability is current.
/// </summary>
public static event Action<SteamNetworkingAvailability>? OnSteamNetAuthenticationStatus;
/// <summary>
/// Initialize the steam server.
/// If asyncCallbacks is false you need to call RunCallbacks manually every frame.
/// If <paramref name="asyncCallbacks"/> is <see langword="false"/> you need to call <see cref="RunCallbacks"/> manually every frame.
/// </summary>
public static void Init( AppId appid, SteamServerInit init, bool asyncCallbacks = true )
{
@@ -70,9 +74,6 @@ namespace Steamworks
uint ipaddress = 0; // Any Port
if ( init.SteamPort == 0 )
init = init.WithRandomSteamPort();
if ( init.IpAddress != null )
ipaddress = Utility.IpToInt32( init.IpAddress );
@@ -82,9 +83,9 @@ namespace Steamworks
//
// Get other interfaces
//
if ( !SteamInternal.GameServer_Init( ipaddress, init.SteamPort, init.GamePort, init.QueryPort, (int)init.Mode, init.VersionString ) )
if ( !SteamInternal.GameServer_Init( ipaddress, 0, init.GamePort, init.QueryPort, (int)init.Mode, init.VersionString ) )
{
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{init.Mode},\"{init.VersionString}\")" );
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{0},{init.GamePort},{init.QueryPort},{init.Mode},\"{init.VersionString}\")" );
}
//
@@ -109,7 +110,7 @@ namespace Steamworks
//
// Initial settings
//
AutomaticHeartbeats = true;
AdvertiseServer = true;
MaxPlayers = 32;
BotCount = 0;
Product = $"{appid.Value}";
@@ -210,7 +211,7 @@ namespace Steamworks
private static string _mapname = "";
/// <summary>
/// Gets or sets the current ModDir
/// Gets or sets the current ModDir.
/// </summary>
public static string ModDir
{
@@ -220,7 +221,7 @@ namespace Steamworks
private static string _modDir = "";
/// <summary>
/// Gets the current product
/// Gets the current product.
/// </summary>
public static string Product
{
@@ -230,7 +231,7 @@ namespace Steamworks
private static string _product = "";
/// <summary>
/// Gets or sets the current Product
/// Gets or sets the current Product.
/// </summary>
public static string GameDescription
{
@@ -240,7 +241,7 @@ namespace Steamworks
private static string _gameDescription = "";
/// <summary>
/// Gets or sets the current ServerName
/// Gets or sets the current ServerName.
/// </summary>
public static string ServerName
{
@@ -250,7 +251,7 @@ namespace Steamworks
private static string _serverName = "";
/// <summary>
/// Set whether the server should report itself as passworded
/// Set whether the server should report itself as passworded.
/// </summary>
public static bool Passworded
{
@@ -275,6 +276,9 @@ namespace Steamworks
}
private static string _gametags = "";
/// <summary>
/// Gets the SteamId of the server.
/// </summary>
public static SteamId SteamId => Internal?.GetSteamID() ?? default;
/// <summary>
@@ -287,7 +291,7 @@ namespace Steamworks
}
/// <summary>
/// Log onto Steam anonymously.
/// Log off of Steam.
/// </summary>
public static void LogOff()
{
@@ -296,14 +300,14 @@ namespace Steamworks
/// <summary>
/// Returns true if the server is connected and registered with the Steam master server
/// You should have called LogOnAnonymous etc on startup.
/// You should have called <see cref="LogOnAnonymous"/> etc on startup.
/// </summary>
public static bool LoggedOn => Internal != null && Internal.BLoggedOn();
/// <summary>
/// To the best of its ability this tries to get the server's
/// current public ip address. Be aware that this is likely to return
/// null for the first few seconds after initialization.
/// current public IP address. Be aware that this is likely to return
/// <see langword="null"/> for the first few seconds after initialization.
/// </summary>
public static System.Net.IPAddress? PublicIp => Internal?.GetPublicIP();
@@ -311,27 +315,29 @@ namespace Steamworks
/// Enable or disable heartbeats, which are sent regularly to the master server.
/// Enabled by default.
/// </summary>
[Obsolete( "Renamed to AdvertiseServer in 1.52" )]
public static bool AutomaticHeartbeats
{
set { Internal?.EnableHeartbeats( value ); }
}
set { Internal?.SetAdvertiseServerActive( value ); }
}
/// <summary>
/// Set heartbeat interval, if automatic heartbeats are enabled.
/// You can leave this at the default.
/// Enable or disable heartbeats, which are sent regularly to the master server.
/// Enabled by default.
/// </summary>
public static int AutomaticHeartbeatRate
public static bool AdvertiseServer
{
set { Internal?.SetHeartbeatInterval( value ); }
set { Internal?.SetAdvertiseServerActive( value ); }
}
/// <summary>
/// Force send a heartbeat to the master server instead of waiting
/// for the next automatic update (if you've left them enabled)
/// </summary>
[Obsolete( "No longer used" )]
public static void ForceHeartbeat()
{
Internal?.ForceHeartbeat();
}
/// <summary>
@@ -372,7 +378,7 @@ namespace Steamworks
}
/// <summary>
/// Remove all key values
/// Remove all key values.
/// </summary>
public static void ClearKeys()
{
@@ -456,11 +462,11 @@ namespace Steamworks
}
/// <summary>
/// Does the user own this app (which could be DLC)
/// Does the user own this app (which could be DLC).
/// </summary>
public static UserHasLicenseForAppResult UserHasLicenseForApp( SteamId steamid, AppId appid )
{
return Internal?.UserHasLicenseForApp( steamid, appid ) ?? UserHasLicenseForAppResult.NoAuth;
}
}
}
}

View File

@@ -11,17 +11,22 @@ namespace Steamworks
{
internal static ISteamGameServerStats? Internal => Interface as ISteamGameServerStats;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamGameServerStats( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
return true;
}
/// <summary>
/// Downloads stats for the user
/// If the user has no stats will return fail
/// these stats will only be auto-updated for clients playing on the server
/// Downloads stats for the user.
/// If the user has no stats, this will return <see cref="Result.Fail"/>.
/// These stats will only be auto-updated for clients playing on the server.
/// </summary>
/// <param name="steamid">The SteamId of the user to get stats for.</param>
/// <returns>A task describing the progress and result of the download.</returns>
public static async Task<Result> RequestUserStatsAsync( SteamId steamid )
{
if (Internal is null) { return Result.Fail; }
@@ -34,6 +39,9 @@ namespace Steamworks
/// Set the named stat for this user. Setting stats should follow the rules
/// you defined in Steamworks.
/// </summary>
/// <param name="steamid">The SteamId of the user to set stats for.</param>
/// <param name="name">The name of the stat.</param>
/// <param name="stat">The value of the stat.</param>
public static bool SetInt( SteamId steamid, string name, int stat )
{
return Internal != null && Internal.SetUserStat( steamid, name, stat );
@@ -43,6 +51,9 @@ namespace Steamworks
/// Set the named stat for this user. Setting stats should follow the rules
/// you defined in Steamworks.
/// </summary>
/// <param name="steamid">The SteamId of the user to set stats for.</param>
/// <param name="name">The name of the stat.</param>
/// <param name="stat">The value of the stat.</param>
public static bool SetFloat( SteamId steamid, string name, float stat )
{
return Internal != null && Internal.SetUserStat( steamid, name, stat );
@@ -50,9 +61,12 @@ namespace Steamworks
/// <summary>
/// Get the named stat for this user. If getting the stat failed, will return
/// defaultValue. 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 defaultValue.
/// <paramref name="defaultValue"/>. You should have called <see cref="RequestUserStatsAsync(SteamId)"/> for this SteamID - which downloads
/// the stats from the backend. If you didn't call it this will always return <paramref name="defaultValue"/>.
/// </summary>
/// <param name="steamid">The SteamId of the user to get stats for.</param>
/// <param name="name">The name of the stat.</param>
/// <param name="defaultValue">The value to return if the stats cannot be received.</param>
public static int GetInt( SteamId steamid, string name, int defaultValue = 0 )
{
int data = defaultValue;
@@ -68,6 +82,9 @@ namespace Steamworks
/// defaultValue. 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 defaultValue.
/// </summary>
/// <param name="steamid">The SteamId of the user to get stats for.</param>
/// <param name="name">The name of the stat.</param>
/// <param name="defaultValue">The value to return if the stats cannot be received.</param>
public static float GetFloat( SteamId steamid, string name, float defaultValue = 0 )
{
float data = defaultValue;
@@ -79,25 +96,29 @@ namespace Steamworks
}
/// <summary>
/// Unlocks the specified achievement for the specified user. Must have called Refresh on a steamid first.
/// Remember to use Commit after use.
/// Unlocks the specified achievement for the specified user. Must have called <see cref="RequestUserStatsAsync(SteamId)"/> on a SteamID first.
/// Remember to use <see cref="StoreUserStats(SteamId)"/> after use.
/// </summary>
/// <param name="steamid">The SteamId of the user to unlock the achievement for.</param>
/// <param name="name">The ID of the achievement.</param>
public static bool SetAchievement( SteamId steamid, string name )
{
return Internal != null && Internal.SetUserAchievement( steamid, name );
}
/// <summary>
/// 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.
/// Resets the unlock status of an achievement for the specified user. Must have called <see cref="RequestUserStatsAsync(SteamId)"/> on a SteamID first.
/// Remember to use <see cref="StoreUserStats(SteamId)"/> after use.
/// </summary>
/// <param name="steamid">The SteamId of the user to clear the achievement for.</param>
/// <param name="name">The ID of the achievement.</param>
public static bool ClearAchievement( SteamId steamid, string name )
{
return Internal != null && Internal.ClearUserAchievement( steamid, name );
}
/// <summary>
/// Return true if available, exists and unlocked
/// Return <see langword="true"/> if available, exists and unlocked
/// </summary>
public static bool GetAchievement( SteamId steamid, string name )
{
@@ -111,9 +132,11 @@ namespace Steamworks
/// <summary>
/// Once you've set a stat change on a user you need to commit your changes.
/// You can do that using this function. The callback will let you know if
/// You can do that using this method. The callback will let you know if
/// your action succeeded, but most of the time you can fire and forget.
/// </summary>
/// <param name="steamid">The SteamId of the user to store stats for.</param>
/// <returns>A task describing the progress and result of the commit.</returns>
public static async Task<Result> StoreUserStats( SteamId steamid )
{
if (Internal is null) { return Result.Fail; }
@@ -122,4 +145,4 @@ namespace Steamworks
return r.Value.Result;
}
}
}
}

View File

@@ -17,34 +17,59 @@ namespace Steamworks
{
internal static ISteamUGC? Internal => Interface as ISteamUGC;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamUGC( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal static void InstallEvents( bool server )
{
Dispatch.Install<DownloadItemResult_t>( x =>
{
if (x.AppID == SteamClient.AppId)
if ( x.AppID == SteamClient.AppId )
{
OnDownloadItemResult?.Invoke(x.Result, x.PublishedFileId);
}
}, server );
Dispatch.Install<ItemInstalled_t>(x =>
{
if (x.AppID == SteamClient.AppId)
{
GlobalOnItemInstalled?.Invoke(x.PublishedFileId);
OnDownloadItemResult?.Invoke( x.Result, x.PublishedFileId );
}
}, server);
Dispatch.Install<RemoteStoragePublishedFileSubscribed_t>( x =>
{
if ( x.AppID == SteamClient.AppId )
{
OnItemSubscribed?.Invoke( x.AppID.Value, x.PublishedFileId );
}
}, server );
Dispatch.Install<RemoteStoragePublishedFileUnsubscribed_t>( x =>
{
if ( x.AppID == SteamClient.AppId )
{
OnItemUnsubscribed?.Invoke( x.AppID.Value, x.PublishedFileId );
}
}, server );
Dispatch.Install<ItemInstalled_t>( x =>
{
if ( x.AppID == SteamClient.AppId )
{
OnItemInstalled?.Invoke( x.AppID.Value, x.PublishedFileId );
}
}, server );
}
/// <summary>
/// Posted after Download call
/// Invoked after an item is downloaded.
/// </summary>
public static event Action<Result, ulong>? OnDownloadItemResult;
public static event Action<Result, PublishedFileId>? OnDownloadItemResult;
/// <summary>
/// Invoked when a new item is subscribed.
/// </summary>
public static event Action<AppId, PublishedFileId>? OnItemSubscribed;
public static event Action<AppId, PublishedFileId>? OnItemUnsubscribed;
public static event Action<AppId, PublishedFileId>? OnItemInstalled;
public static async Task<bool> DeleteFileAsync( PublishedFileId fileId )
{
@@ -54,29 +79,29 @@ namespace Steamworks
}
/// <summary>
/// Start downloading this item. You'll get notified of completion via OnDownloadItemResult.
/// Start downloading this item. You'll get notified of completion via <see cref="OnDownloadItemResult"/>.
/// </summary>
/// <param name="fileId">The ID of the file you want to download</param>
/// <param name="highPriority">If true this should go straight to the top of the download list</param>
/// <returns>true if nothing went wrong and the download is started</returns>
/// <param name="fileId">The ID of the file to download.</param>
/// <param name="highPriority">If <see langword="true"/> this should go straight to the top of the download list.</param>
/// <returns><see langword="true"/> if nothing went wrong and the download is started.</returns>
public static bool Download( PublishedFileId fileId, bool highPriority = false )
{
return Internal != null && Internal.DownloadItem( fileId, highPriority );
}
/// <summary>
/// Will attempt to download this item asyncronously - allowing you to instantly react to its installation
/// Will attempt to download this item asyncronously - allowing you to instantly react to its installation.
/// </summary>
/// <param name="fileId">The ID of the file you want to download</param>
/// <param name="fileId">The ID of the file you download.</param>
/// <param name="progress">An optional callback</param>
/// <param name="ct">Allows you to send a message to cancel the download anywhere during the process</param>
/// <param name="millisecondsUpdateDelay">How often to call the progress function</param>
/// <returns>true if downloaded and installed correctly</returns>
/// <param name="ct">Allows to send a message to cancel the download anywhere during the process.</param>
/// <param name="milisecondsUpdateDelay">How often to call the progress function.</param>
/// <returns><see langword="true"/> if downloaded and installed properly.</returns>
public static async Task<bool> DownloadAsync(
PublishedFileId fileId,
Action<float>? progress = null,
int millisecondsUpdateDelay = 60,
CancellationToken? ct = null)
PublishedFileId fileId,
Action<float>? progress = null,
int millisecondsUpdateDelay = 60,
CancellationToken? ct = default )
{
var item = new Steamworks.Ugc.Item( fileId );
@@ -92,7 +117,7 @@ namespace Steamworks
Result downloadStartResult = Result.None;
void onDownloadFinished(Result r, ulong id)
void onDownloadFinished(Result r, PublishedFileId id)
{
if (id != item.Id) { return; }
downloadStartResult = r;
@@ -143,7 +168,7 @@ namespace Steamworks
}
/// <summary>
/// Utility function to fetch a single item. Internally this uses Ugc.FileQuery -
/// Utility function to fetch a single item. Internally this uses <c>Ugc.FileQuery</c> -
/// which you can use to query multiple items if you need to.
/// </summary>
public static async Task<Ugc.Item?> QueryFileAsync( PublishedFileId fileId )
@@ -183,8 +208,6 @@ namespace Steamworks
return result?.Result == Result.OK;
}
public static Action<ulong>? GlobalOnItemInstalled;
public static uint NumSubscribedItems { get { return Internal?.GetNumSubscribedItems() ?? 0; } }
public static PublishedFileId[] GetSubscribedItems()
@@ -195,6 +218,36 @@ namespace Steamworks
Internal.GetSubscribedItems(ids, numSubscribed);
return ids;
}
/// <summary>
/// Suspends all workshop downloads.
/// Downloads will be suspended until you resume them by calling <see cref="ResumeDownloads"/> or when the game ends.
/// </summary>
public static void SuspendDownloads() => Internal?.SuspendDownloads(true);
/// <summary>
/// Resumes all workshop downloads.
/// </summary>
public static void ResumeDownloads() => Internal?.SuspendDownloads(false);
/// <summary>
/// Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not.
/// </summary>
public static bool ShowWorkshopEula()
{
return Internal != null && Internal.ShowWorkshopEULA();
}
/// <summary>
/// Retrieve information related to the user's acceptance or not of the app's specific Workshop EULA.
/// </summary>
public static async Task<bool?> GetWorkshopEulaStatus()
{
if ( Internal is null ) { return null; }
var status = await Internal.GetWorkshopEULAStatus();
return status?.Accepted;
}
}
}

View File

@@ -17,13 +17,17 @@ namespace Steamworks
{
internal static ISteamUser? Internal => Interface as ISteamUser;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamUser( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
richPresence = new Dictionary<string, string>();
SampleRate = OptimalSampleRate;
return true;
}
static Dictionary<string, string>? richPresence;
@@ -39,11 +43,12 @@ namespace Steamworks
Dispatch.Install<MicroTxnAuthorizationResponse_t>( x => OnMicroTxnAuthorizationResponse?.Invoke( x.AppID, x.OrderID, x.Authorized != 0 ) );
Dispatch.Install<GameWebCallback_t>( x => OnGameWebCallback?.Invoke( x.URLUTF8() ) );
Dispatch.Install<GetAuthSessionTicketResponse_t>( x => OnGetAuthSessionTicketResponse?.Invoke( x ) );
Dispatch.Install<GetTicketForWebApiResponse_t>( x => OnGetAuthTicketForWebApiResponse?.Invoke( x ) );
Dispatch.Install<DurationControl_t>( x => OnDurationControl?.Invoke( new DurationControl { _inner = x } ) );
}
/// <summary>
/// Called when a connections to the Steam back-end has been established.
/// Invoked when a connections to the Steam back-end has been established.
/// This means the Steam client now has a working connection to the Steam servers.
/// Usually this will have occurred before the game has launched, and should only be seen if the
/// user has dropped connection due to a networking issue or a Steam server update.
@@ -51,14 +56,14 @@ namespace Steamworks
public static event Action? OnSteamServersConnected;
/// <summary>
/// Called when a connection attempt has failed.
/// Invoked when a connection attempt has failed.
/// This will occur periodically if the Steam client is not connected,
/// and has failed when retrying to establish a connection.
/// </summary>
public static event Action? OnSteamServerConnectFailure;
/// <summary>
/// Called if the client has lost connection to the Steam servers.
/// Invoked when the client has lost connection to the Steam servers.
/// Real-time services will be disabled until a matching OnSteamServersConnected has been posted.
/// </summary>
public static event Action? OnSteamServersDisconnected;
@@ -72,25 +77,30 @@ namespace Steamworks
public static event Action? OnClientGameServerDeny;
/// <summary>
/// Called whenever the users licenses (owned packages) changes.
/// Invoked whenever the users licenses (owned packages) changes.
/// </summary>
public static event Action? OnLicensesUpdated;
/// <summary>
/// Called when an auth ticket has been validated.
/// The first parameter is the steamid of this user
/// The second is the Steam ID that owns the game, this will be different from the first
/// if the game is being borrowed via Steam Family Sharing
/// Invoked when an auth ticket has been validated.
/// The first parameter is the <see cref="SteamId"/> of this user
/// The second is the <see cref="SteamId"/> that owns the game, which will be different from the first
/// if the game is being borrowed via Steam Family Sharing.
/// </summary>
public static event Action<SteamId, SteamId, AuthResponse>? OnValidateAuthTicketResponse;
/// <summary>
/// Used internally for GetAuthSessionTicketAsync
/// Used internally for <see cref="GetAuthSessionTicketAsync(double)"/>.
/// </summary>
internal static event Action<GetAuthSessionTicketResponse_t>? OnGetAuthSessionTicketResponse;
/// <summary>
/// Used internally for <see cref="GetAuthTicketForWebApi(string)"/>.
/// </summary>
internal static event Action<GetTicketForWebApiResponse_t>? OnGetAuthTicketForWebApiResponse;
/// <summary>
/// Called when a user has responded to a microtransaction authorization request.
/// Invoked when a user has responded to a microtransaction authorization request.
/// ( appid, orderid, user authorized )
/// </summary>
public static event Action<AppId, ulong, bool>? OnMicroTxnAuthorizationResponse;
@@ -110,9 +120,6 @@ namespace Steamworks
/// </summary>
public static event Action<DurationControl>? OnDurationControl;
static bool _recordingVoice;
/// <summary>
@@ -120,7 +127,6 @@ namespace Steamworks
/// Once started, use GetAvailableVoice and GetVoice to get the data, and then call StopVoiceRecording
/// when the user has released their push-to-talk hotkey or the game session has completed.
/// </summary>
public static bool VoiceRecord
{
get => _recordingVoice;
@@ -134,7 +140,7 @@ namespace Steamworks
/// <summary>
/// Returns true if we have voice data waiting to be read
/// Returns true if we have voice data waiting to be read.
/// </summary>
public static bool HasVoiceData
{
@@ -304,16 +310,16 @@ namespace Steamworks
}
/// <summary>
/// Retrieve a authentication ticket to be sent to the entity who wishes to authenticate you.
/// Retrieve an authentication ticket to be sent to the entity who wishes to authenticate you.
/// </summary>
public static unsafe AuthTicket? GetAuthSessionTicket()
public static unsafe AuthTicket? GetAuthSessionTicket( NetIdentity identity )
{
var data = Helpers.TakeBuffer( 1024 );
fixed ( byte* b = data )
{
uint ticketLength = 0;
uint ticket = Internal?.GetAuthSessionTicket( (IntPtr)b, data.Length, ref ticketLength ) ?? 0;
uint ticket = Internal?.GetAuthSessionTicket( (IntPtr)b, data.Length, ref ticketLength, ref identity ) ?? 0;
if ( ticket == 0 )
return null;
@@ -326,13 +332,56 @@ namespace Steamworks
}
}
public static async Task<AuthTicketForWebApi?> GetAuthTicketForWebApi( string identity )
{
if ( Internal is null ) { return null; }
HAuthTicket handle = default;
AuthTicketForWebApi? ticket = null;
Result result = Result.Pending;
Action<GetTicketForWebApiResponse_t> responseHandler = response =>
{
if ( response.Ticket == handle ) { return; }
result = response.Result == Result.Pending
? Result.Fail
: response.Result;
ticket = result == Result.OK
? new AuthTicketForWebApi(
response.GubTicket.Take( response.Ticket ).ToArray(),
response.AuthTicket )
: null;
};
OnGetAuthTicketForWebApiResponse += responseHandler;
try
{
handle = Internal.GetAuthTicketForWebApi( identity );
if ( handle == 0 ) { return null; }
var timeout = DateTime.Now + TimeSpan.FromSeconds( 60f );
while ( result == Result.Pending && DateTime.Now < timeout )
{
await Task.Delay( 10 );
}
}
finally
{
OnGetAuthTicketForWebApiResponse -= responseHandler;
}
return ticket;
}
/// <summary>
/// Retrieve a authentication ticket to be sent to the entity who wishes to authenticate you.
/// This waits for a positive response from the backend before returning the ticket. This means
/// the ticket is definitely ready to go as soon as it returns. Will return null if the callback
/// the ticket is definitely ready to go as soon as it returns. Will return <see langword="null"/> if the callback
/// times out or returns negatively.
/// </summary>
public static async Task<AuthTicket?> GetAuthSessionTicketAsync( double timeoutSeconds = 10.0f )
public static async Task<AuthTicket?> GetAuthSessionTicketAsync( NetIdentity identity, double timeoutSeconds = 10.0f )
{
var result = Result.Pending;
AuthTicket? ticket = null;
@@ -348,7 +397,7 @@ namespace Steamworks
try
{
ticket = GetAuthSessionTicket();
ticket = GetAuthSessionTicket( identity );
if ( ticket == null )
return null;
@@ -518,4 +567,4 @@ namespace Steamworks
return new DurationControl { _inner = response.Value };
}
}
}
}

View File

@@ -11,11 +11,15 @@ namespace Steamworks
{
internal static ISteamUserStats? Internal => Interface as ISteamUserStats;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamUserStats( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
RequestCurrentStats();
return true;
}
public static bool StatsRecieved { get; internal set; }
@@ -38,25 +42,25 @@ namespace Steamworks
/// <summary>
/// called when the achivement icon is loaded
/// Invoked when an achivement icon is loaded.
/// </summary>
internal static event Action<string, int>? OnAchievementIconFetched;
/// <summary>
/// called when the latests stats and achievements have been received
/// from the server
/// Invoked when the latests stats and achievements have been received
/// from the server.
/// </summary>
public static event Action<SteamId, Result>? OnUserStatsReceived;
/// <summary>
/// result of a request to store the user stats for a game
/// Result of a request to store the user stats for a game.
/// </summary>
public static event Action<Result>? OnUserStatsStored;
/// <summary>
/// result of a request to store the achievements for a game, or an
/// Result of a request to store the achievements for a game, or an
/// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress
/// are zero, that means the achievement has been fully unlocked
/// are zero, that means the achievement has been fully unlocked.
/// </summary>
public static event Action<Achievement, int, int>? OnAchievementProgress;
@@ -67,7 +71,7 @@ namespace Steamworks
public static event Action<SteamId>? OnUserStatsUnloaded;
/// <summary>
/// Get the available achievements
/// Get all available achievements.
/// </summary>
public static IEnumerable<Achievement> Achievements
{
@@ -104,7 +108,7 @@ namespace Steamworks
/// <summary>
/// Tries to get the number of players currently playing this game.
/// Or -1 if failed.
/// Or <c>-1</c> if failed.
/// </summary>
public static async Task<int> PlayerCountAsync()
{
@@ -146,11 +150,11 @@ namespace Steamworks
/// <summary>
/// Asynchronously fetches global stats data, which is available for stats marked as
/// "aggregated" in the App Admin panel of the Steamworks website.
/// You must have called RequestCurrentStats and it needs to return successfully via
/// You must have called <see cref="RequestCurrentStats"/> and it needs to return successfully via
/// its callback prior to calling this.
/// </summary>
/// <param name="days">How many days of day-by-day history to retrieve in addition to the overall totals. The limit is 60.</param>
/// <returns>OK indicates success, InvalidState means you need to call RequestCurrentStats first, Fail means the remote call failed</returns>
/// <param name="days">How many days of day-by-day history to retrieve in addition to the overall totals. The limit is <c>60</c>.</param>
/// <returns><see cref="Result.OK"/> indicates success, <see cref="Result.InvalidState"/> means you need to call <see cref="RequestCurrentStats"/> first, <see cref="Result.Fail"/> means the remote call failed</returns>
public static async Task<Result> RequestGlobalStatsAsync( int days )
{
if (Internal is null) { return Result.Fail; }
@@ -216,8 +220,7 @@ namespace Steamworks
}
/// <summary>
/// Set a stat value. This will automatically call StoreStats() after a successful call
/// unless you pass false as the last argument.
/// Set a stat value. This will automatically call <see cref="StoreStats"/> after a successful call.
/// </summary>
public static bool SetStat( string name, int value )
{
@@ -225,8 +228,7 @@ namespace Steamworks
}
/// <summary>
/// Set a stat value. This will automatically call StoreStats() after a successful call
/// unless you pass false as the last argument.
/// Set a stat value. This will automatically call <see cref="StoreStats"/> after a successful call.
/// </summary>
public static bool SetStat( string name, float value )
{
@@ -234,7 +236,7 @@ namespace Steamworks
}
/// <summary>
/// Get a Int stat value
/// Get an <see langword="int"/> stat value.
/// </summary>
public static int GetStatInt( string name )
{
@@ -244,7 +246,7 @@ namespace Steamworks
}
/// <summary>
/// Get a float stat value
/// Get a <see langword="float"/> stat value.
/// </summary>
public static float GetStatFloat( string name )
{
@@ -254,7 +256,7 @@ namespace Steamworks
}
/// <summary>
/// Practically wipes the slate clean for this user. If includeAchievements is true, will wipe
/// Practically wipes the slate clean for this user. If <paramref name="includeAchievements"/> is <see langword="true"/>, will also wipe
/// any achievements too.
/// </summary>
/// <returns></returns>
@@ -263,4 +265,4 @@ namespace Steamworks
return Internal != null && Internal.ResetAllStats( includeAchievements );
}
}
}
}

View File

@@ -14,10 +14,14 @@ namespace Steamworks
{
internal static ISteamUtils? Internal => Interface as ISteamUtils;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamUtils( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents( server );
return true;
}
internal static void InstallEvents( bool server )
@@ -36,33 +40,33 @@ namespace Steamworks
}
/// <summary>
/// The country of the user changed
/// Invoked when the country of the user changed.
/// </summary>
public static event Action? OnIpCountryChanged;
/// <summary>
/// Fired when running on a laptop and less than 10 minutes of battery is left, fires then every minute
/// The parameter is the number of minutes left
/// Invoked when running on a laptop and less than 10 minutes of battery is left, fires then every minute.
/// The parameter is the number of minutes left.
/// </summary>
public static event Action<int>? OnLowBatteryPower;
/// <summary>
/// Called when Steam wants to shutdown
/// Invoked when Steam wants to shutdown.
/// </summary>
public static event Action? OnSteamShutdown;
/// <summary>
/// Big Picture gamepad text input has been closed. Parameter is true if text was submitted, false if cancelled etc.
/// Invoked when Big Picture gamepad text input has been closed. Parameter is <see langword="true"/> if text was submitted, <see langword="false"/> if cancelled etc.
/// </summary>
public static event Action<bool>? OnGamepadTextInputDismissed;
/// <summary>
/// Returns the number of seconds since the application was active
/// Returns the number of seconds since the application was active.
/// </summary>
public static uint SecondsSinceAppActive => Internal?.GetSecondsSinceAppActive() ?? 0;
/// <summary>
/// Returns the number of seconds since the user last moved the mouse etc
/// Returns the number of seconds since the user last moved the mouse and/or provided other input.
/// </summary>
public static uint SecondsSinceComputerActive => Internal?.GetSecondsSinceComputerActive() ?? 0;
@@ -70,7 +74,7 @@ namespace Steamworks
public static Universe ConnectedUniverse => Internal?.GetConnectedUniverse() ?? Universe.Invalid;
/// <summary>
/// Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
/// Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
/// </summary>
public static DateTime SteamServerTime => Internal != null ? Epoch.ToDateTime( Internal.GetServerRealTime() ) : default;
@@ -81,9 +85,9 @@ namespace Steamworks
public static string? IpCountry => Internal?.GetIPCountry();
/// <summary>
/// returns true if the image exists, and the buffer was successfully filled out
/// results are returned in RGBA format
/// the destination buffer size should be 4 * height * width * sizeof(char)
/// Returns true if the image exists, and the buffer was successfully filled out.
/// Results are returned in RGBA format.
/// The destination buffer size should be 4 * height * width * sizeof(char).
/// </summary>
public static bool GetImageSize( int image, out uint width, out uint height )
{
@@ -93,7 +97,7 @@ namespace Steamworks
}
/// <summary>
/// returns the image in RGBA format
/// returns the image in RGBA format.
/// </summary>
public static Data.Image? GetImage( int image )
{
@@ -118,12 +122,12 @@ namespace Steamworks
}
/// <summary>
/// Returns true if we're using a battery (ie, a laptop not plugged in)
/// Returns true if we're using a battery (ie, a laptop not plugged in).
/// </summary>
public static bool UsingBatteryPower => Internal != null && Internal.GetCurrentBatteryPower() != 255;
/// <summary>
/// Returns battery power [0-1]
/// Returns battery power [0-1].
/// </summary>
public static float CurrentBatteryPower => Math.Min( (Internal?.GetCurrentBatteryPower() ?? 0f) / 100, 1.0f );
@@ -182,7 +186,7 @@ namespace Steamworks
}
/// <summary>
/// Activates the Big Picture text input dialog which only supports gamepad input
/// Activates the Big Picture text input dialog which only supports gamepad input.
/// </summary>
public static bool ShowGamepadTextInput( GamepadTextInputMode inputMode, GamepadTextInputLineMode lineInputMode, string description, int maxChars, string existingText = "" )
{
@@ -190,7 +194,7 @@ namespace Steamworks
}
/// <summary>
/// Returns previously entered text
/// Returns previously entered text.
/// </summary>
public static string GetEnteredGamepadText()
{
@@ -206,18 +210,18 @@ namespace Steamworks
}
/// <summary>
/// returns the language the steam client is running in, you probably want
/// Apps.CurrentGameLanguage instead, this is for very special usage cases
/// Returns the language the steam client is running in. You probably want
/// <see cref="SteamApps.GameLanguage"/> instead, this is for very special usage cases.
/// </summary>
public static string? SteamUILanguage => Internal?.GetSteamUILanguage();
/// <summary>
/// returns true if Steam itself is running in VR mode
/// Returns <see langword="true"/> if Steam itself is running in VR mode.
/// </summary>
public static bool IsSteamRunningInVR => Internal != null && Internal.IsSteamRunningInVR();
/// <summary>
/// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition
/// Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
/// </summary>
public static void SetOverlayNotificationInset( int x, int y )
{
@@ -225,24 +229,26 @@ namespace Steamworks
}
/// <summary>
/// returns true if Steam and the Steam Overlay are running in Big Picture mode
/// returns <see langword="true"/> if Steam and the Steam Overlay are running in Big Picture mode
/// Games much be launched through the Steam client to enable the Big Picture overlay. During development,
/// a game can be added as a non-steam game to the developers library to test this feature
/// a game can be added as a non-steam game to the developers library to test this feature.
/// </summary>
public static bool IsSteamInBigPictureMode => Internal != null && Internal.IsSteamInBigPictureMode();
/// <summary>
/// ask SteamUI to create and render its OpenVR dashboard
/// Ask Steam UI to create and render its OpenVR dashboard.
/// </summary>
public static void StartVRDashboard() => Internal?.StartVRDashboard();
/// <summary>
/// Set whether the HMD content will be streamed via Steam In-Home Streaming
/// If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed.
/// If this is set to false, then the application window will be streamed instead, and remote input will be allowed.
/// The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.
/// (this is useful for games that have asymmetric multiplayer gameplay)
/// Gets or sets whether the HMD content will be streamed via Steam In-Home Streaming.
/// <para>
/// If this is set to <see langword="true"/>, then the scene in the HMD headset will be streamed, and remote input will not be allowed.
/// If this is set to <see langword="false"/>, then the application window will be streamed instead, and remote input will be allowed.
/// The default is <see langword="true"/> unless "VRHeadsetStreaming" "0" is in the extended app info for a game
/// (this is useful for games that have asymmetric multiplayer gameplay).
/// </para>
/// </summary>
public static bool VrHeadsetStreaming
{
@@ -262,8 +268,42 @@ namespace Steamworks
/// <summary>
/// Returns whether this steam client is a Steam China specific client, vs the global client
/// Gets whether this steam client is a Steam China specific client (<see langword="true"/>), or the global client (<see langword="false"/>).
/// </summary>
public static bool IsSteamChinaLauncher => Internal != null && Internal.IsSteamChinaLauncher();
/// <summary>
/// Initializes text filtering, loading dictionaries for the language the game is running in.
/// Users can customize the text filter behavior in their Steam Account preferences.
/// </summary>
public static bool InitFilterText() => Internal != null && Internal.InitFilterText( 0 );
/// <summary>
/// Filters the provided input message and places the filtered result into pchOutFilteredText,
/// using legally required filtering and additional filtering based on the context and user settings.
/// </summary>
public static string FilterText( TextFilteringContext context, SteamId sourceSteamID, string inputMessage )
{
if ( Internal is null ) { return inputMessage; }
Internal.FilterText( context, sourceSteamID, inputMessage, out var filteredString );
return filteredString;
}
/// <summary>
/// Gets whether or not Steam itself is running on the Steam Deck.
/// </summary>
public static bool IsRunningOnSteamDeck => Internal != null && Internal.IsSteamRunningOnSteamDeck();
/// <summary>
/// In game launchers that don't have controller support: You can call this to have
/// Steam Input translate the controller input into mouse/kb to navigate the launcher
/// </summary>
public static void SetGameLauncherMode( bool mode ) => Internal?.SetGameLauncherMode( mode );
//public void ShowFloatingGamepadTextInput( TextInputMode mode, int left, int top, int width, int height )
//{
// Internal.ShowFloatingGamepadTextInput( mode, left, top, width, height );
//}
}
}
}

View File

@@ -8,29 +8,28 @@ using Steamworks.Data;
namespace Steamworks
{
/// <summary>
/// Undocumented Parental Settings
/// Class for utilizing the Steam Video API.
/// </summary>
public class SteamVideo : SteamClientClass<SteamVideo>
{
internal static ISteamVideo? Internal => Interface as ISteamVideo;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamVideo( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
InstallEvents();
return true;
}
internal static void InstallEvents()
{
Dispatch.Install<BroadcastUploadStart_t>( x => OnBroadcastStarted?.Invoke() );
Dispatch.Install<BroadcastUploadStop_t>( x => OnBroadcastStopped?.Invoke( x.Result ) );
}
public static event Action? OnBroadcastStarted;
public static event Action<BroadcastUploadResult>? OnBroadcastStopped;
/// <summary>
/// Return true if currently using Steam's live broadcasting
/// Return <see langword="true"/> if currently using Steam's live broadcasting
/// </summary>
public static bool IsBroadcasting
{
@@ -42,7 +41,7 @@ namespace Steamworks
}
/// <summary>
/// If we're broadcasting, will return the number of live viewers
/// Returns the number of viewers that are watching the stream, or <c>0</c> if <see cref="IsBroadcasting"/> is <see langword="false"/>.
/// </summary>
public static int NumViewers
{
@@ -57,4 +56,4 @@ namespace Steamworks
}
}
}
}
}

View File

@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace Steamworks.Data
{
/// <summary>
/// Represents a Steam Achievement.
/// </summary>
public struct Achievement
{
internal string Value;
@@ -18,7 +21,7 @@ namespace Steamworks.Data
public override string ToString() => Value;
/// <summary>
/// True if unlocked
/// Gets whether or not the achievement has been unlocked.
/// </summary>
public bool State
{
@@ -30,15 +33,24 @@ namespace Steamworks.Data
}
}
/// <summary>
/// Gets the identifier of the achievement. This is the "API Name" on Steamworks.
/// </summary>
public string Identifier => Value;
/// <summary>
/// Gets the display name of the achievement.
/// </summary>
public string? Name => SteamUserStats.Internal?.GetAchievementDisplayAttribute( Value, "name" );
/// <summary>
/// Gets the description of the achievement.
/// </summary>
public string? Description => SteamUserStats.Internal?.GetAchievementDisplayAttribute( Value, "desc" );
/// <summary>
/// Should hold the unlock time if State is true
/// If <see cref="State"/> is <see langword="true"/>, this value represents the time that the achievement was unlocked.
/// </summary>
public DateTime? UnlockTime
{
@@ -56,7 +68,7 @@ namespace Steamworks.Data
/// <summary>
/// Gets the icon of the achievement. This can return a null image even though the image exists if the image
/// hasn't been downloaded by Steam yet. You can use GetIconAsync if you want to wait for the image to be downloaded.
/// hasn't been downloaded by Steam yet. You should use <see cref="GetIconAsync(int)"/> if you want to wait for the image to be downloaded.
/// </summary>
public Image? GetIcon()
{
@@ -66,8 +78,9 @@ namespace Steamworks.Data
/// <summary>
/// Gets the icon of the achievement, waits for it to load if we have to
/// Gets the icon of the achievement, yielding until the icon is received or the <paramref name="timeout"/> is reached.
/// </summary>
/// <param name="timeout">The timeout in milliseconds before the request will be canceled. Defaults to <c>5000</c>.</param>
public async Task<Image?> GetIconAsync( int timeout = 5000 )
{
if (SteamUserStats.Internal is null) { return null; }
@@ -109,7 +122,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Returns the fraction (0-1) of users who have unlocked the specified achievement, or -1 if no data available.
/// Gets a decimal (0-1) representing the global amount of users who have unlocked the specified achievement, or -1 if no data available.
/// </summary>
public float GlobalUnlocked
{
@@ -125,7 +138,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Make this achievement earned
/// Unlock this achievement.
/// </summary>
public bool Trigger( bool apply = true )
{
@@ -142,7 +155,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Reset this achievement to not achieved
/// Reset this achievement to be locked.
/// </summary>
public bool Clear()
{
@@ -150,4 +163,4 @@ namespace Steamworks.Data
return SteamUserStats.Internal.ClearAchievement( Value );
}
}
}
}

View File

@@ -6,6 +6,9 @@ using System.Text;
namespace Steamworks
{
/// <summary>
/// Represents the ID of a Steam application.
/// </summary>
public struct AppId
{
public uint Value;
@@ -27,4 +30,4 @@ namespace Steamworks
return value.Value;
}
}
}
}

View File

@@ -6,10 +6,24 @@ using System.Text;
namespace Steamworks.Data
{
/// <summary>
/// Provides information about a DLC.
/// </summary>
public struct DlcInformation
{
/// <summary>
/// The <see cref="Steamworks.AppId"/> of the DLC.
/// </summary>
public AppId AppId { get; internal set; }
/// <summary>
/// The name of the DLC.
/// </summary>
public string Name { get; internal set; }
/// <summary>
/// Whether or not the DLC is available.
/// </summary>
public bool Available { get; internal set; }
}
}
}

View File

@@ -6,10 +6,29 @@ using System.Text;
namespace Steamworks.Data
{
/// <summary>
/// Represents download progress.
/// </summary>
public struct DownloadProgress
{
/// <summary>
/// Whether or not the download is currently active.
/// </summary>
public bool Active;
/// <summary>
/// How many bytes have been downloaded.
/// </summary>
public ulong BytesDownloaded;
/// <summary>
/// How many bytes in total the download is.
/// </summary>
public ulong BytesTotal;
/// <summary>
/// Gets the amount of bytes left that need to be downloaded.
/// </summary>
public ulong BytesRemaining => BytesTotal - BytesDownloaded;
}
}
}

View File

@@ -6,10 +6,16 @@ using System.Text;
namespace Steamworks.Data
{
/// <summary>
/// Represents details of a file.
/// </summary>
public struct FileDetails
{
/// <summary>
/// The size of the file in bytes.
/// </summary>
public ulong SizeInBytes;
public string Sha1;
public uint Flags;
}
}
}

View File

@@ -261,4 +261,4 @@ namespace Steamworks
}
}
}
}

View File

@@ -7,10 +7,17 @@ namespace Steamworks.Data
public uint Height;
public byte[] Data;
/// <summary>
/// Returns the color of the pixel at the specified position.
/// </summary>
/// <param name="x">X-coordinate</param>
/// <param name="y">Y-coordinate</param>
/// <returns>The color.</returns>
/// <exception cref="System.ArgumentException">If the X and Y or out of bounds.</exception>
public Color GetPixel( int x, int y )
{
if ( x < 0 || x >= Width ) throw new System.Exception( "x out of bounds" );
if ( y < 0 || y >= Height ) throw new System.Exception( "y out of bounds" );
if ( x < 0 || x >= Width ) throw new System.ArgumentException( "x out of bounds" );
if ( y < 0 || y >= Height ) throw new System.ArgumentException( "y out of bounds" );
Color c = new Color();
@@ -24,14 +31,21 @@ namespace Steamworks.Data
return c;
}
/// <summary>
/// Returns "{Width}x{Height} ({length of <see cref="Data"/>}bytes)"
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"{Width}x{Height} ({Data.Length}bytes)";
}
}
/// <summary>
/// Represents a color.
/// </summary>
public struct Color
{
public byte r, g, b, a;
}
}
}

View File

@@ -5,6 +5,9 @@ using System.Threading.Tasks;
namespace Steamworks.Data
{
/// <summary>
/// Represents a Steam lobby.
/// </summary>
public struct Lobby
{
public SteamId Id { get; internal set; }
@@ -18,8 +21,8 @@ namespace Steamworks.Data
}
/// <summary>
/// Try to join this room. Will return RoomEnter.Success on success,
/// and anything else is a failure
/// Try to join this room. Will return <see cref="RoomEnter.Success"/> on success,
/// and anything else is a failure.
/// </summary>
public async Task<RoomEnter> Join()
{
@@ -41,9 +44,9 @@ namespace Steamworks.Data
}
/// <summary>
/// Invite another user to the lobby
/// will return true if the invite is successfully sent, whether or not the target responds
/// returns false if the local user is not connected to the Steam servers
/// Invite another user to the lobby.
/// Will return <see langword="true"/> if the invite is successfully sent, whether or not the target responds
/// returns <see langword="false"/> if the local user is not connected to the Steam servers
/// </summary>
public bool InviteFriend( SteamId steamid )
{
@@ -51,12 +54,12 @@ namespace Steamworks.Data
}
/// <summary>
/// returns the number of users in the specified lobby
/// Gets the number of users in this lobby.
/// </summary>
public int MemberCount => SteamMatchmaking.Internal?.GetNumLobbyMembers( Id ) ?? 0;
/// <summary>
/// Returns current members. Need to be in the lobby to see the users.
/// Returns current members in the lobby. The current user must be in the lobby in order to see the users.
/// </summary>
public IEnumerable<Friend> Members
{
@@ -72,7 +75,7 @@ namespace Steamworks.Data
/// <summary>
/// Get data associated with this lobby
/// Get data associated with this lobby.
/// </summary>
public string? GetData( string key )
{
@@ -80,7 +83,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Get data associated with this lobby
/// Set data associated with this lobby.
/// </summary>
public bool SetData( string key, string value )
{
@@ -91,7 +94,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Removes a metadata key from the lobby
/// Removes a metadata key from the lobby.
/// </summary>
public bool DeleteData( string key )
{
@@ -99,7 +102,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Get all data for this lobby
/// Get all data for this lobby.
/// </summary>
public IEnumerable<KeyValuePair<string, string>> Data
{
@@ -119,7 +122,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Gets per-user metadata for someone in this lobby
/// Gets per-user metadata for someone in this lobby.
/// </summary>
public string? GetMemberData( Friend member, string key )
{
@@ -127,7 +130,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Sets per-user metadata (for the local user implicitly)
/// Sets per-user metadata (for the local user implicitly).
/// </summary>
public void SetMemberData( string key, string value )
{
@@ -135,35 +138,44 @@ namespace Steamworks.Data
}
/// <summary>
/// Sends a string to the chat room
/// Sends a string to the chat room.
/// </summary>
public bool SendChatString( string message )
{
var data = System.Text.Encoding.UTF8.GetBytes( message );
//adding null terminator as it's used in Helpers.MemoryToString
var data = System.Text.Encoding.UTF8.GetBytes( message + '\0' );
return SendChatBytes( data );
}
/// <summary>
/// Sends bytes the the chat room
/// this isn't exposed because there's no way to read raw bytes atm,
/// and I figure people can send json if they want something more advanced
/// Sends bytes to the chat room.
/// </summary>
internal unsafe bool SendChatBytes( byte[] data )
public unsafe bool SendChatBytes( byte[] data )
{
fixed ( byte* ptr = data )
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, data.Length );
return SendChatBytesUnsafe( ptr, data.Length );
}
}
/// <summary>
/// Sends bytes to the chat room from an unsafe buffer.
/// </summary>
public unsafe bool SendChatBytesUnsafe( byte* ptr, int length )
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, length );
}
/// <summary>
/// Refreshes metadata for a lobby you're not necessarily in right now.
/// <para>
/// You never do this for lobbies you're a member of, only if your
/// this will send down all the metadata associated with a lobby.
/// This is an asynchronous call.
/// Returns false if the local user is not connected to the Steam servers.
/// Returns <see langword="false"/> if the local user is not connected to the Steam servers.
/// Results will be returned by a LobbyDataUpdate_t callback.
/// If the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false.
/// If the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to <see langword="false"/>.
/// </para>
/// </summary>
public bool Refresh()
{
@@ -171,8 +183,8 @@ namespace Steamworks.Data
}
/// <summary>
/// Max members able to join this lobby. Cannot be over 250.
/// Can only be set by the owner
/// Max members able to join this lobby. Cannot be over <c>250</c>.
/// Can only be set by the owner of the lobby.
/// </summary>
public int MaxMembers
{
@@ -180,26 +192,42 @@ namespace Steamworks.Data
set => SteamMatchmaking.Internal?.SetLobbyMemberLimit( Id, value );
}
/// <summary>
/// Sets the lobby as public.
/// </summary>
public bool SetPublic()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Public );
}
/// <summary>
/// Sets the lobby as private.
/// </summary>
public bool SetPrivate()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Private );
}
/// <summary>
/// Sets the lobby as invisible.
/// </summary>
public bool SetInvisible()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Invisible );
}
/// <summary>
/// Sets the lobby as friends only.
/// </summary>
public bool SetFriendsOnly()
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.FriendsOnly );
}
/// <summary>
/// Set whether or not the lobby can be joined.
/// </summary>
/// <param name="b">Whether or not the lobby can be joined.</param>
public bool SetJoinable( bool b )
{
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyJoinable( Id, b );
@@ -207,7 +235,7 @@ namespace Steamworks.Data
/// <summary>
/// [SteamID variant]
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Steammatchmaking.OnLobbyGameCreated event.
/// </summary>
public void SetGameServer( SteamId steamServer )
@@ -220,7 +248,7 @@ namespace Steamworks.Data
/// <summary>
/// [IP/Port variant]
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Allows the owner to set the game server associated with the lobby. Triggers the
/// Steammatchmaking.OnLobbyGameCreated event.
/// </summary>
public void SetGameServer( string ip, ushort port )
@@ -232,7 +260,7 @@ namespace Steamworks.Data
}
/// <summary>
/// Gets the details of the lobby's game server, if set. Returns true if the lobby is
/// Gets the details of the lobby's game server, if set. Returns true if the lobby is
/// valid and has a server set, otherwise returns false.
/// </summary>
public bool GetGameServer( ref uint ip, ref ushort port, ref SteamId serverId )
@@ -241,7 +269,7 @@ namespace Steamworks.Data
}
/// <summary>
/// You must be the lobby owner to set the owner
/// Gets or sets the owner of the lobby. You must be the lobby owner to set the owner
/// </summary>
public Friend Owner
{
@@ -250,8 +278,8 @@ namespace Steamworks.Data
}
/// <summary>
/// Check if the specified SteamId owns the lobby
/// Check if the specified SteamId owns the lobby.
/// </summary>
public bool IsOwnedBy( SteamId k ) => Owner.Id == k;
}
}
}

View File

@@ -10,7 +10,7 @@ namespace Steamworks
internal PartyBeaconID_t Id;
/// <summary>
/// Creator of the beacon
/// Gets the owner of the beacon.
/// </summary>
public SteamId Owner
{
@@ -24,7 +24,7 @@ namespace Steamworks
}
/// <summary>
/// Creator of the beacon
/// Gets metadata related to the beacon.
/// </summary>
public string? MetaData
{
@@ -40,7 +40,7 @@ namespace Steamworks
/// <summary>
/// Will attempt to join the party. If successful will return a connection string.
/// If failed, will return null
/// If failed, will return <see langword="null"/>
/// </summary>
public async Task<string?> JoinAsync()
{
@@ -55,7 +55,7 @@ namespace Steamworks
/// <summary>
/// When a user follows your beacon, Steam will reserve one of the open party slots for them, and send your game a ReservationNotification callback.
/// When that user joins your party, call OnReservationCompleted to notify Steam that the user has joined successfully
/// When that user joins your party, call this method to notify Steam that the user has joined successfully.
/// </summary>
public void OnReservationCompleted( SteamId steamid )
{
@@ -73,11 +73,11 @@ namespace Steamworks
}
/// <summary>
/// Turn off the beacon
/// Turn off the beacon.
/// </summary>
public bool Destroy()
{
return Internal != null && Internal.DestroyBeacon( Id );
}
}
}
}

View File

@@ -6,6 +6,9 @@ using System.Text;
namespace Steamworks.Data
{
/// <summary>
/// Represents a screenshot that was taken by a user.
/// </summary>
public struct Screenshot
{
internal ScreenshotHandle Value;
@@ -19,19 +22,16 @@ namespace Steamworks.Data
}
/// <summary>
/// Tags a user as being visible in the screenshot
/// Sets the location of the screenshot.
/// </summary>
public bool SetLocation( string location )
{
return SteamScreenshots.Internal != null && SteamScreenshots.Internal.SetLocation( Value, location );
}
/// <summary>
/// Tags a user as being visible in the screenshot
/// </summary>
public bool TagPublishedFile( PublishedFileId file )
{
return SteamScreenshots.Internal != null && SteamScreenshots.Internal.TagPublishedFile( Value, file );
}
}
}
}

View File

@@ -142,4 +142,4 @@ namespace Steamworks.Data
return (Address?.GetHashCode() ?? 0) + SteamId.GetHashCode() + ConnectionPort.GetHashCode() + QueryPort.GetHashCode();
}
}
}
}

View File

@@ -21,8 +21,7 @@ namespace Steamworks
/// </summary>
public struct SteamServerInit
{
public IPAddress? IpAddress;
public ushort SteamPort;
public IPAddress? IpAddress;
public ushort GamePort;
public ushort QueryPort;
public InitServerMode Mode;
@@ -60,18 +59,8 @@ namespace Steamworks
Mode = InitServerMode.Authentication;
VersionString = "1.0.0.0";
IpAddress = null;
SteamPort = 0;
}
/// <summary>
/// Set the Steam quert port
/// </summary>
public SteamServerInit WithRandomSteamPort()
{
SteamPort = (ushort)new Random().Next( 10000, 60000 );
return this;
}
/// <summary>
/// If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE into usQueryPort, then it causes the game server API to use
/// "GameSocketShare" mode, which means that the game is responsible for sending and receiving UDP packets for the master

View File

@@ -151,4 +151,4 @@ namespace Steamworks.Data
return SteamUserStats.Internal != null && SteamUserStats.Internal.StoreStats();
}
}
}
}

View File

@@ -6,6 +6,9 @@ using System.Text;
namespace Steamworks
{
/// <summary>
/// Represents the ID of a user or steam lobby.
/// </summary>
public struct SteamId
{
public ulong Value;
@@ -26,4 +29,4 @@ namespace Steamworks
public bool IsValid => Value != default;
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Steamworks.Data
{
public struct UgcAdditionalPreview
{
internal UgcAdditionalPreview( string urlOrVideoID, string originalFileName, ItemPreviewType itemPreviewType )
{
this.UrlOrVideoID = urlOrVideoID;
this.OriginalFileName = originalFileName;
this.ItemPreviewType = itemPreviewType;
}
public string UrlOrVideoID { get; private set; }
public string OriginalFileName { get; private set; }
public ItemPreviewType ItemPreviewType { get; private set; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 48f086235d5dbeb44bccbb40802e30fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More