ISteamUtils generation

This commit is contained in:
Garry Newman 2019-04-12 22:53:46 +01:00
parent afb2e286f4
commit 06446a8bc0
12 changed files with 606 additions and 124 deletions

View File

@ -2,6 +2,7 @@
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
@ -59,6 +60,12 @@ public void InstalledDepots()
Console.WriteLine( $"{depot.Value}" );
}
}
[TestMethod]
public async Task GetFileDetails()
{
var fileinfo = await Apps.GetFileDetails( "hl2.exe" );
}
}
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -17,6 +18,8 @@
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -72,26 +75,18 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.2-beta1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="Client\AchievementsTest.cs" />
<Compile Include="Client\ClientTest.cs" />
@ -122,26 +117,16 @@
<Name>Facepunch.Steamworks</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.4.0" targetFramework="net46" />
<package id="MSTest.TestFramework" version="1.4.0" targetFramework="net46" />
<package id="Newtonsoft.Json" version="9.0.2-beta1" targetFramework="net452" />
</packages>

View File

@ -0,0 +1,390 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using SteamNative;
namespace Steamworks.Internal
{
public class ISteamUtils : BaseSteamInterface
{
public override string InterfaceName => "SteamUtils009";
public override void InitInternals()
{
GetSecondsSinceAppActiveDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetSecondsSinceAppActiveDelegate>( Marshal.ReadIntPtr( VTable, 0) );
GetSecondsSinceComputerActiveDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetSecondsSinceComputerActiveDelegate>( Marshal.ReadIntPtr( VTable, 8) );
GetConnectedUniverseDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetConnectedUniverseDelegate>( Marshal.ReadIntPtr( VTable, 16) );
GetServerRealTimeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetServerRealTimeDelegate>( Marshal.ReadIntPtr( VTable, 24) );
GetIPCountryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetIPCountryDelegate>( Marshal.ReadIntPtr( VTable, 32) );
GetImageSizeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetImageSizeDelegate>( Marshal.ReadIntPtr( VTable, 40) );
GetImageRGBADelegatePointer = Marshal.GetDelegateForFunctionPointer<GetImageRGBADelegate>( Marshal.ReadIntPtr( VTable, 48) );
GetCSERIPPortDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetCSERIPPortDelegate>( Marshal.ReadIntPtr( VTable, 56) );
GetCurrentBatteryPowerDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetCurrentBatteryPowerDelegate>( Marshal.ReadIntPtr( VTable, 64) );
GetAppIDDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAppIDDelegate>( Marshal.ReadIntPtr( VTable, 72) );
SetOverlayNotificationPositionDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetOverlayNotificationPositionDelegate>( Marshal.ReadIntPtr( VTable, 80) );
IsAPICallCompletedDelegatePointer = Marshal.GetDelegateForFunctionPointer<IsAPICallCompletedDelegate>( Marshal.ReadIntPtr( VTable, 88) );
GetAPICallFailureReasonDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAPICallFailureReasonDelegate>( Marshal.ReadIntPtr( VTable, 96) );
GetAPICallResultDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAPICallResultDelegate>( Marshal.ReadIntPtr( VTable, 104) );
RunFrameDelegatePointer = Marshal.GetDelegateForFunctionPointer<RunFrameDelegate>( Marshal.ReadIntPtr( VTable, 112) );
GetIPCCallCountDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetIPCCallCountDelegate>( Marshal.ReadIntPtr( VTable, 120) );
SetWarningMessageHookDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetWarningMessageHookDelegate>( Marshal.ReadIntPtr( VTable, 128) );
IsOverlayEnabledDelegatePointer = Marshal.GetDelegateForFunctionPointer<IsOverlayEnabledDelegate>( Marshal.ReadIntPtr( VTable, 136) );
BOverlayNeedsPresentDelegatePointer = Marshal.GetDelegateForFunctionPointer<BOverlayNeedsPresentDelegate>( Marshal.ReadIntPtr( VTable, 144) );
CheckFileSignatureDelegatePointer = Marshal.GetDelegateForFunctionPointer<CheckFileSignatureDelegate>( Marshal.ReadIntPtr( VTable, 152) );
ShowGamepadTextInputDelegatePointer = Marshal.GetDelegateForFunctionPointer<ShowGamepadTextInputDelegate>( Marshal.ReadIntPtr( VTable, 160) );
GetEnteredGamepadTextLengthDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetEnteredGamepadTextLengthDelegate>( Marshal.ReadIntPtr( VTable, 168) );
GetEnteredGamepadTextInputDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetEnteredGamepadTextInputDelegate>( Marshal.ReadIntPtr( VTable, 176) );
GetSteamUILanguageDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetSteamUILanguageDelegate>( Marshal.ReadIntPtr( VTable, 184) );
IsSteamRunningInVRDelegatePointer = Marshal.GetDelegateForFunctionPointer<IsSteamRunningInVRDelegate>( Marshal.ReadIntPtr( VTable, 192) );
SetOverlayNotificationInsetDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetOverlayNotificationInsetDelegate>( Marshal.ReadIntPtr( VTable, 200) );
IsSteamInBigPictureModeDelegatePointer = Marshal.GetDelegateForFunctionPointer<IsSteamInBigPictureModeDelegate>( Marshal.ReadIntPtr( VTable, 208) );
StartVRDashboardDelegatePointer = Marshal.GetDelegateForFunctionPointer<StartVRDashboardDelegate>( Marshal.ReadIntPtr( VTable, 216) );
IsVRHeadsetStreamingEnabledDelegatePointer = Marshal.GetDelegateForFunctionPointer<IsVRHeadsetStreamingEnabledDelegate>( Marshal.ReadIntPtr( VTable, 224) );
SetVRHeadsetStreamingEnabledDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetVRHeadsetStreamingEnabledDelegate>( Marshal.ReadIntPtr( VTable, 232) );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate uint GetSecondsSinceAppActiveDelegate( IntPtr self );
private GetSecondsSinceAppActiveDelegate GetSecondsSinceAppActiveDelegatePointer;
#endregion
public uint GetSecondsSinceAppActive()
{
return GetSecondsSinceAppActiveDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate uint GetSecondsSinceComputerActiveDelegate( IntPtr self );
private GetSecondsSinceComputerActiveDelegate GetSecondsSinceComputerActiveDelegatePointer;
#endregion
public uint GetSecondsSinceComputerActive()
{
return GetSecondsSinceComputerActiveDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate Universe GetConnectedUniverseDelegate( IntPtr self );
private GetConnectedUniverseDelegate GetConnectedUniverseDelegatePointer;
#endregion
public Universe GetConnectedUniverse()
{
return GetConnectedUniverseDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate uint GetServerRealTimeDelegate( IntPtr self );
private GetServerRealTimeDelegate GetServerRealTimeDelegatePointer;
#endregion
public uint GetServerRealTime()
{
return GetServerRealTimeDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate IntPtr GetIPCountryDelegate( IntPtr self );
private GetIPCountryDelegate GetIPCountryDelegatePointer;
#endregion
public string GetIPCountry()
{
return GetString( GetIPCountryDelegatePointer( Self ) );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool GetImageSizeDelegate( IntPtr self, int iImage, ref uint pnWidth, ref uint pnHeight );
private GetImageSizeDelegate GetImageSizeDelegatePointer;
#endregion
public bool GetImageSize( int iImage, ref uint pnWidth, ref uint pnHeight )
{
return GetImageSizeDelegatePointer( Self, iImage, ref pnWidth, ref pnHeight );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool GetImageRGBADelegate( IntPtr self, int iImage, [In,Out] byte[] pubDest, int nDestBufferSize );
private GetImageRGBADelegate GetImageRGBADelegatePointer;
#endregion
public bool GetImageRGBA( int iImage, [In,Out] byte[] pubDest, int nDestBufferSize )
{
return GetImageRGBADelegatePointer( Self, iImage, pubDest, nDestBufferSize );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool GetCSERIPPortDelegate( IntPtr self, ref uint unIP, ref ushort usPort );
private GetCSERIPPortDelegate GetCSERIPPortDelegatePointer;
#endregion
public bool GetCSERIPPort( ref uint unIP, ref ushort usPort )
{
return GetCSERIPPortDelegatePointer( Self, ref unIP, ref usPort );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate byte GetCurrentBatteryPowerDelegate( IntPtr self );
private GetCurrentBatteryPowerDelegate GetCurrentBatteryPowerDelegatePointer;
#endregion
public byte GetCurrentBatteryPower()
{
return GetCurrentBatteryPowerDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate uint GetAppIDDelegate( IntPtr self );
private GetAppIDDelegate GetAppIDDelegatePointer;
#endregion
public uint GetAppID()
{
return GetAppIDDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void SetOverlayNotificationPositionDelegate( IntPtr self, NotificationPosition eNotificationPosition );
private SetOverlayNotificationPositionDelegate SetOverlayNotificationPositionDelegatePointer;
#endregion
public void SetOverlayNotificationPosition( NotificationPosition eNotificationPosition )
{
SetOverlayNotificationPositionDelegatePointer( Self, eNotificationPosition );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool IsAPICallCompletedDelegate( IntPtr self, SteamAPICall_t hSteamAPICall, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed );
private IsAPICallCompletedDelegate IsAPICallCompletedDelegatePointer;
#endregion
public bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed )
{
return IsAPICallCompletedDelegatePointer( Self, hSteamAPICall, ref pbFailed );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate SteamAPICallFailure GetAPICallFailureReasonDelegate( IntPtr self, SteamAPICall_t hSteamAPICall );
private GetAPICallFailureReasonDelegate GetAPICallFailureReasonDelegatePointer;
#endregion
public SteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall )
{
return GetAPICallFailureReasonDelegatePointer( Self, hSteamAPICall );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool GetAPICallResultDelegate( IntPtr self, SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed );
private GetAPICallResultDelegate GetAPICallResultDelegatePointer;
#endregion
public bool GetAPICallResult( SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, [MarshalAs( UnmanagedType.U1 )] ref bool pbFailed )
{
return GetAPICallResultDelegatePointer( Self, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, ref pbFailed );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void RunFrameDelegate( IntPtr self );
private RunFrameDelegate RunFrameDelegatePointer;
#endregion
public void RunFrame()
{
RunFrameDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate uint GetIPCCallCountDelegate( IntPtr self );
private GetIPCCallCountDelegate GetIPCCallCountDelegatePointer;
#endregion
public uint GetIPCCallCount()
{
return GetIPCCallCountDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void SetWarningMessageHookDelegate( IntPtr self, IntPtr pFunction );
private SetWarningMessageHookDelegate SetWarningMessageHookDelegatePointer;
#endregion
public void SetWarningMessageHook( IntPtr pFunction )
{
SetWarningMessageHookDelegatePointer( Self, pFunction );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool IsOverlayEnabledDelegate( IntPtr self );
private IsOverlayEnabledDelegate IsOverlayEnabledDelegatePointer;
#endregion
public bool IsOverlayEnabled()
{
return IsOverlayEnabledDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool BOverlayNeedsPresentDelegate( IntPtr self );
private BOverlayNeedsPresentDelegate BOverlayNeedsPresentDelegatePointer;
#endregion
public bool BOverlayNeedsPresent()
{
return BOverlayNeedsPresentDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate SteamAPICall_t CheckFileSignatureDelegate( IntPtr self, string szFileName );
private CheckFileSignatureDelegate CheckFileSignatureDelegatePointer;
#endregion
public SteamAPICall_t CheckFileSignature( string szFileName )
{
return CheckFileSignatureDelegatePointer( Self, szFileName );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool ShowGamepadTextInputDelegate( IntPtr self, GamepadTextInputMode eInputMode, GamepadTextInputLineMode eLineInputMode, string pchDescription, uint unCharMax, string pchExistingText );
private ShowGamepadTextInputDelegate ShowGamepadTextInputDelegatePointer;
#endregion
public bool ShowGamepadTextInput( GamepadTextInputMode eInputMode, GamepadTextInputLineMode eLineInputMode, string pchDescription, uint unCharMax, string pchExistingText )
{
return ShowGamepadTextInputDelegatePointer( Self, eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate uint GetEnteredGamepadTextLengthDelegate( IntPtr self );
private GetEnteredGamepadTextLengthDelegate GetEnteredGamepadTextLengthDelegatePointer;
#endregion
public uint GetEnteredGamepadTextLength()
{
return GetEnteredGamepadTextLengthDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool GetEnteredGamepadTextInputDelegate( IntPtr self, StringBuilder pchText, uint cchText );
private GetEnteredGamepadTextInputDelegate GetEnteredGamepadTextInputDelegatePointer;
#endregion
public bool GetEnteredGamepadTextInput( StringBuilder pchText, uint cchText )
{
return GetEnteredGamepadTextInputDelegatePointer( Self, pchText, cchText );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate IntPtr GetSteamUILanguageDelegate( IntPtr self );
private GetSteamUILanguageDelegate GetSteamUILanguageDelegatePointer;
#endregion
public string GetSteamUILanguage()
{
return GetString( GetSteamUILanguageDelegatePointer( Self ) );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool IsSteamRunningInVRDelegate( IntPtr self );
private IsSteamRunningInVRDelegate IsSteamRunningInVRDelegatePointer;
#endregion
public bool IsSteamRunningInVR()
{
return IsSteamRunningInVRDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void SetOverlayNotificationInsetDelegate( IntPtr self, int nHorizontalInset, int nVerticalInset );
private SetOverlayNotificationInsetDelegate SetOverlayNotificationInsetDelegatePointer;
#endregion
public void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset )
{
SetOverlayNotificationInsetDelegatePointer( Self, nHorizontalInset, nVerticalInset );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool IsSteamInBigPictureModeDelegate( IntPtr self );
private IsSteamInBigPictureModeDelegate IsSteamInBigPictureModeDelegatePointer;
#endregion
public bool IsSteamInBigPictureMode()
{
return IsSteamInBigPictureModeDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void StartVRDashboardDelegate( IntPtr self );
private StartVRDashboardDelegate StartVRDashboardDelegatePointer;
#endregion
public void StartVRDashboard()
{
StartVRDashboardDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
public delegate bool IsVRHeadsetStreamingEnabledDelegate( IntPtr self );
private IsVRHeadsetStreamingEnabledDelegate IsVRHeadsetStreamingEnabledDelegatePointer;
#endregion
public bool IsVRHeadsetStreamingEnabled()
{
return IsVRHeadsetStreamingEnabledDelegatePointer( Self );
}
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
public delegate void SetVRHeadsetStreamingEnabledDelegate( IntPtr self, [MarshalAs( UnmanagedType.U1 )] bool bEnabled );
private SetVRHeadsetStreamingEnabledDelegate SetVRHeadsetStreamingEnabledDelegatePointer;
#endregion
public void SetVRHeadsetStreamingEnabled( [MarshalAs( UnmanagedType.U1 )] bool bEnabled )
{
SetVRHeadsetStreamingEnabledDelegatePointer( Self, bEnabled );
}
}
}

View File

@ -204,5 +204,23 @@ public static DownloadProgress DlcDownloadProgress( AppId appid )
/// </summary>
public static int BuildId => steamapps.GetAppBuildId();
/// <summary>
/// Asynchronously retrieves metadata details about a specific file in the depot manifest.
/// Currently provides:
/// </summary>
public static async Task<FileDetails> GetFileDetails( string filename )
{
var call = steamapps.GetFileDetails( filename );
while ( !Utils.IsCallComplete( call, out bool failed ) )
{
await Task.Delay( 1 );
}
return new FileDetails();
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace Steamworks
{
public struct FileDetails
{
public ulong SizeInBytes;
public string Sha1;
public ulong BytesTotal;
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using SteamNative;
namespace Steamworks
{
/// <summary>
/// Interface which provides access to a range of miscellaneous utility functions
/// </summary>
public static class Utils
{
static Internal.ISteamUtils _steamutils;
internal static Internal.ISteamUtils steamutils
{
get
{
if ( _steamutils == null )
_steamutils = new Internal.ISteamUtils();
return _steamutils;
}
}
internal static bool IsCallComplete( SteamAPICall_t call, out bool failed )
{
failed = false;
return steamutils.IsAPICallCompleted( call, ref failed );
}
}
}

View File

@ -7,7 +7,7 @@ namespace SteamNative
//
// EUniverse
//
internal enum Universe : int
public enum Universe : int
{
Invalid = 0,
Public = 1,
@ -20,7 +20,7 @@ internal enum Universe : int
//
// EResult
//
internal enum Result : int
public enum Result : int
{
OK = 1,
Fail = 2,
@ -139,7 +139,7 @@ internal enum Result : int
//
// EVoiceResult
//
internal enum VoiceResult : int
public enum VoiceResult : int
{
OK = 0,
NotInitialized = 1,
@ -156,7 +156,7 @@ internal enum VoiceResult : int
//
// EDenyReason
//
internal enum DenyReason : int
public enum DenyReason : int
{
Invalid = 0,
InvalidVersion = 1,
@ -179,7 +179,7 @@ internal enum DenyReason : int
//
// EBeginAuthSessionResult
//
internal enum BeginAuthSessionResult : int
public enum BeginAuthSessionResult : int
{
OK = 0,
InvalidTicket = 1,
@ -192,7 +192,7 @@ internal enum BeginAuthSessionResult : int
//
// EAuthSessionResponse
//
internal enum AuthSessionResponse : int
public enum AuthSessionResponse : int
{
OK = 0,
UserNotConnectedToSteam = 1,
@ -209,7 +209,7 @@ internal enum AuthSessionResponse : int
//
// EUserHasLicenseForAppResult
//
internal enum UserHasLicenseForAppResult : int
public enum UserHasLicenseForAppResult : int
{
HasLicense = 0,
DoesNotHaveLicense = 1,
@ -219,7 +219,7 @@ internal enum UserHasLicenseForAppResult : int
//
// EAccountType
//
internal enum AccountType : int
public enum AccountType : int
{
Invalid = 0,
Individual = 1,
@ -238,7 +238,7 @@ internal enum AccountType : int
//
// EAppReleaseState
//
internal enum AppReleaseState : int
public enum AppReleaseState : int
{
Unknown = 0,
Unavailable = 1,
@ -250,7 +250,7 @@ internal enum AppReleaseState : int
//
// EAppOwnershipFlags
//
internal enum AppOwnershipFlags : int
public enum AppOwnershipFlags : int
{
None = 0,
OwnsLicense = 1,
@ -277,7 +277,7 @@ internal enum AppOwnershipFlags : int
//
// EAppType
//
internal enum AppType : int
public enum AppType : int
{
Invalid = 0,
Game = 1,
@ -303,7 +303,7 @@ internal enum AppType : int
//
// ESteamUserStatType
//
internal enum SteamUserStatType : int
public enum SteamUserStatType : int
{
INVALID = 0,
INT = 1,
@ -317,7 +317,7 @@ internal enum SteamUserStatType : int
//
// EChatEntryType
//
internal enum ChatEntryType : int
public enum ChatEntryType : int
{
Invalid = 0,
ChatMsg = 1,
@ -336,7 +336,7 @@ internal enum ChatEntryType : int
//
// EChatRoomEnterResponse
//
internal enum ChatRoomEnterResponse : int
public enum ChatRoomEnterResponse : int
{
Success = 1,
DoesntExist = 2,
@ -355,7 +355,7 @@ internal enum ChatRoomEnterResponse : int
//
// EChatSteamIDInstanceFlags
//
internal enum ChatSteamIDInstanceFlags : int
public enum ChatSteamIDInstanceFlags : int
{
AccountInstanceMask = 4095,
InstanceFlagClan = 524288,
@ -366,7 +366,7 @@ internal enum ChatSteamIDInstanceFlags : int
//
// EMarketingMessageFlags
//
internal enum MarketingMessageFlags : int
public enum MarketingMessageFlags : int
{
None = 0,
HighPriority = 1,
@ -379,7 +379,7 @@ internal enum MarketingMessageFlags : int
//
// ENotificationPosition
//
internal enum NotificationPosition : int
public enum NotificationPosition : int
{
TopLeft = 0,
TopRight = 1,
@ -390,7 +390,7 @@ internal enum NotificationPosition : int
//
// EBroadcastUploadResult
//
internal enum BroadcastUploadResult : int
public enum BroadcastUploadResult : int
{
None = 0,
OK = 1,
@ -421,7 +421,7 @@ internal enum BroadcastUploadResult : int
//
// ELaunchOptionType
//
internal enum LaunchOptionType : int
public enum LaunchOptionType : int
{
None = 0,
Default = 1,
@ -445,7 +445,7 @@ internal enum LaunchOptionType : int
//
// EVRHMDType
//
internal enum VRHMDType : int
public enum VRHMDType : int
{
None = -1,
Unknown = 0,
@ -479,7 +479,7 @@ internal enum VRHMDType : int
//
// EMarketNotAllowedReasonFlags
//
internal enum MarketNotAllowedReasonFlags : int
public enum MarketNotAllowedReasonFlags : int
{
None = 0,
TemporaryFailure = 1,
@ -503,7 +503,7 @@ internal enum MarketNotAllowedReasonFlags : int
//
// CGameID::EGameIDType
//
internal enum GameIDType : int
public enum GameIDType : int
{
App = 0,
GameMod = 1,
@ -514,7 +514,7 @@ internal enum GameIDType : int
//
// EGameSearchErrorCode_t
//
internal enum GameSearchErrorCode_t : int
public enum GameSearchErrorCode_t : int
{
OK = 1,
Failed_Search_Already_In_Progress = 2,
@ -530,7 +530,7 @@ internal enum GameSearchErrorCode_t : int
//
// EPlayerResult_t
//
internal enum PlayerResult_t : int
public enum PlayerResult_t : int
{
FailedToConnect = 1,
Abandoned = 2,
@ -542,7 +542,7 @@ internal enum PlayerResult_t : int
//
// IPCFailure_t::EFailureType
//
internal enum FailureType : int
public enum FailureType : int
{
FlushedCallbackQueue = 0,
PipeFail = 1,
@ -551,7 +551,7 @@ internal enum FailureType : int
//
// EFriendRelationship
//
internal enum FriendRelationship : int
public enum FriendRelationship : int
{
None = 0,
Blocked = 1,
@ -567,7 +567,7 @@ internal enum FriendRelationship : int
//
// EPersonaState
//
internal enum PersonaState : int
public enum PersonaState : int
{
Offline = 0,
Online = 1,
@ -583,7 +583,7 @@ internal enum PersonaState : int
//
// EFriendFlags
//
internal enum FriendFlags : int
public enum FriendFlags : int
{
None = 0,
Blocked = 1,
@ -602,7 +602,7 @@ internal enum FriendFlags : int
//
// EUserRestriction
//
internal enum UserRestriction : int
public enum UserRestriction : int
{
None = 0,
Unknown = 1,
@ -617,7 +617,7 @@ internal enum UserRestriction : int
//
// EOverlayToStoreFlag
//
internal enum OverlayToStoreFlag : int
public enum OverlayToStoreFlag : int
{
None = 0,
AddToCart = 1,
@ -627,7 +627,7 @@ internal enum OverlayToStoreFlag : int
//
// EActivateGameOverlayToWebPageMode
//
internal enum ActivateGameOverlayToWebPageMode : int
public enum ActivateGameOverlayToWebPageMode : int
{
Default = 0,
Modal = 1,
@ -636,7 +636,7 @@ internal enum ActivateGameOverlayToWebPageMode : int
//
// EPersonaChange
//
internal enum PersonaChange : int
public enum PersonaChange : int
{
Name = 1,
Status = 2,
@ -658,7 +658,7 @@ internal enum PersonaChange : int
//
// ESteamAPICallFailure
//
internal enum SteamAPICallFailure : int
public enum SteamAPICallFailure : int
{
None = -1,
SteamGone = 0,
@ -670,7 +670,7 @@ internal enum SteamAPICallFailure : int
//
// EGamepadTextInputMode
//
internal enum GamepadTextInputMode : int
public enum GamepadTextInputMode : int
{
Normal = 0,
Password = 1,
@ -679,7 +679,7 @@ internal enum GamepadTextInputMode : int
//
// EGamepadTextInputLineMode
//
internal enum GamepadTextInputLineMode : int
public enum GamepadTextInputLineMode : int
{
SingleLine = 0,
MultipleLines = 1,
@ -688,7 +688,7 @@ internal enum GamepadTextInputLineMode : int
//
// ECheckFileSignature
//
internal enum CheckFileSignature : int
public enum CheckFileSignature : int
{
InvalidSignature = 0,
ValidSignature = 1,
@ -700,7 +700,7 @@ internal enum CheckFileSignature : int
//
// EMatchMakingServerResponse
//
internal enum MatchMakingServerResponse : int
public enum MatchMakingServerResponse : int
{
ServerResponded = 0,
ServerFailedToRespond = 1,
@ -710,7 +710,7 @@ internal enum MatchMakingServerResponse : int
//
// ELobbyType
//
internal enum LobbyType : int
public enum LobbyType : int
{
Private = 0,
FriendsOnly = 1,
@ -721,7 +721,7 @@ internal enum LobbyType : int
//
// ELobbyComparison
//
internal enum LobbyComparison : int
public enum LobbyComparison : int
{
EqualToOrLessThan = -2,
LessThan = -1,
@ -734,7 +734,7 @@ internal enum LobbyComparison : int
//
// ELobbyDistanceFilter
//
internal enum LobbyDistanceFilter : int
public enum LobbyDistanceFilter : int
{
Close = 0,
Default = 1,
@ -745,7 +745,7 @@ internal enum LobbyDistanceFilter : int
//
// EChatMemberStateChange
//
internal enum ChatMemberStateChange : int
public enum ChatMemberStateChange : int
{
Entered = 1,
Left = 2,
@ -757,7 +757,7 @@ internal enum ChatMemberStateChange : int
//
// ESteamPartyBeaconLocationType
//
internal enum SteamPartyBeaconLocationType : int
public enum SteamPartyBeaconLocationType : int
{
Invalid = 0,
ChatGroup = 1,
@ -767,7 +767,7 @@ internal enum SteamPartyBeaconLocationType : int
//
// ESteamPartyBeaconLocationData
//
internal enum SteamPartyBeaconLocationData : int
public enum SteamPartyBeaconLocationData : int
{
Invalid = 0,
Name = 1,
@ -779,7 +779,7 @@ internal enum SteamPartyBeaconLocationData : int
//
// RequestPlayersForGameResultCallback_t::PlayerAcceptState_t
//
internal enum PlayerAcceptState_t : int
public enum PlayerAcceptState_t : int
{
Unknown = 0,
PlayerAccepted = 1,
@ -789,7 +789,7 @@ internal enum PlayerAcceptState_t : int
//
// ERemoteStoragePlatform
//
internal enum RemoteStoragePlatform : int
public enum RemoteStoragePlatform : int
{
None = 0,
Windows = 1,
@ -804,7 +804,7 @@ internal enum RemoteStoragePlatform : int
//
// ERemoteStoragePublishedFileVisibility
//
internal enum RemoteStoragePublishedFileVisibility : int
public enum RemoteStoragePublishedFileVisibility : int
{
Public = 0,
FriendsOnly = 1,
@ -814,7 +814,7 @@ internal enum RemoteStoragePublishedFileVisibility : int
//
// EWorkshopFileType
//
internal enum WorkshopFileType : int
public enum WorkshopFileType : int
{
First = 0,
Community = 0,
@ -839,7 +839,7 @@ internal enum WorkshopFileType : int
//
// EWorkshopVote
//
internal enum WorkshopVote : int
public enum WorkshopVote : int
{
Unvoted = 0,
For = 1,
@ -850,7 +850,7 @@ internal enum WorkshopVote : int
//
// EWorkshopFileAction
//
internal enum WorkshopFileAction : int
public enum WorkshopFileAction : int
{
Played = 0,
Completed = 1,
@ -859,7 +859,7 @@ internal enum WorkshopFileAction : int
//
// EWorkshopEnumerationType
//
internal enum WorkshopEnumerationType : int
public enum WorkshopEnumerationType : int
{
RankedByVote = 0,
Recent = 1,
@ -873,7 +873,7 @@ internal enum WorkshopEnumerationType : int
//
// EWorkshopVideoProvider
//
internal enum WorkshopVideoProvider : int
public enum WorkshopVideoProvider : int
{
None = 0,
Youtube = 1,
@ -882,7 +882,7 @@ internal enum WorkshopVideoProvider : int
//
// EUGCReadAction
//
internal enum UGCReadAction : int
public enum UGCReadAction : int
{
ontinueReadingUntilFinished = 0,
ontinueReading = 1,
@ -892,7 +892,7 @@ internal enum UGCReadAction : int
//
// ELeaderboardDataRequest
//
internal enum LeaderboardDataRequest : int
public enum LeaderboardDataRequest : int
{
Global = 0,
GlobalAroundUser = 1,
@ -903,7 +903,7 @@ internal enum LeaderboardDataRequest : int
//
// ELeaderboardSortMethod
//
internal enum LeaderboardSortMethod : int
public enum LeaderboardSortMethod : int
{
None = 0,
Ascending = 1,
@ -913,7 +913,7 @@ internal enum LeaderboardSortMethod : int
//
// ELeaderboardDisplayType
//
internal enum LeaderboardDisplayType : int
public enum LeaderboardDisplayType : int
{
None = 0,
Numeric = 1,
@ -924,7 +924,7 @@ internal enum LeaderboardDisplayType : int
//
// ELeaderboardUploadScoreMethod
//
internal enum LeaderboardUploadScoreMethod : int
public enum LeaderboardUploadScoreMethod : int
{
None = 0,
KeepBest = 1,
@ -934,7 +934,7 @@ internal enum LeaderboardUploadScoreMethod : int
//
// ERegisterActivationCodeResult
//
internal enum RegisterActivationCodeResult : int
public enum RegisterActivationCodeResult : int
{
ResultOK = 0,
ResultFail = 1,
@ -946,7 +946,7 @@ internal enum RegisterActivationCodeResult : int
//
// EP2PSessionError
//
internal enum P2PSessionError : int
public enum P2PSessionError : int
{
None = 0,
NotRunningApp = 1,
@ -959,7 +959,7 @@ internal enum P2PSessionError : int
//
// EP2PSend
//
internal enum P2PSend : int
public enum P2PSend : int
{
Unreliable = 0,
UnreliableNoDelay = 1,
@ -970,7 +970,7 @@ internal enum P2PSend : int
//
// ESNetSocketState
//
internal enum SNetSocketState : int
public enum SNetSocketState : int
{
Invalid = 0,
Connected = 1,
@ -988,7 +988,7 @@ internal enum SNetSocketState : int
//
// ESNetSocketConnectionType
//
internal enum SNetSocketConnectionType : int
public enum SNetSocketConnectionType : int
{
NotConnected = 0,
UDP = 1,
@ -998,7 +998,7 @@ internal enum SNetSocketConnectionType : int
//
// EVRScreenshotType
//
internal enum VRScreenshotType : int
public enum VRScreenshotType : int
{
None = 0,
Mono = 1,
@ -1011,7 +1011,7 @@ internal enum VRScreenshotType : int
//
// AudioPlayback_Status
//
internal enum AudioPlayback_Status : int
public enum AudioPlayback_Status : int
{
Undefined = 0,
Playing = 1,
@ -1022,7 +1022,7 @@ internal enum AudioPlayback_Status : int
//
// EHTTPMethod
//
internal enum HTTPMethod : int
public enum HTTPMethod : int
{
Invalid = 0,
GET = 1,
@ -1037,7 +1037,7 @@ internal enum HTTPMethod : int
//
// EHTTPStatusCode
//
internal enum HTTPStatusCode : int
public enum HTTPStatusCode : int
{
Invalid = 0,
HTTPStatusCode100Continue = 100,
@ -1088,7 +1088,7 @@ internal enum HTTPStatusCode : int
//
// EInputSource
//
internal enum InputSource : int
public enum InputSource : int
{
None = 0,
LeftTrackpad = 1,
@ -1113,7 +1113,7 @@ internal enum InputSource : int
//
// EInputSourceMode
//
internal enum InputSourceMode : int
public enum InputSourceMode : int
{
None = 0,
Dpad = 1,
@ -1137,7 +1137,7 @@ internal enum InputSourceMode : int
//
// EInputActionOrigin
//
internal enum InputActionOrigin : int
public enum InputActionOrigin : int
{
None = 0,
SteamController_A = 1,
@ -1404,7 +1404,7 @@ internal enum InputActionOrigin : int
//
// EXboxOrigin
//
internal enum XboxOrigin : int
public enum XboxOrigin : int
{
A = 0,
B = 1,
@ -1440,7 +1440,7 @@ internal enum XboxOrigin : int
//
// ESteamControllerPad
//
internal enum SteamControllerPad : int
public enum SteamControllerPad : int
{
Left = 0,
Right = 1,
@ -1449,7 +1449,7 @@ internal enum SteamControllerPad : int
//
// ESteamInputType
//
internal enum SteamInputType : int
public enum SteamInputType : int
{
Unknown = 0,
SteamController = 1,
@ -1471,7 +1471,7 @@ internal enum SteamInputType : int
//
// ESteamInputLEDFlag
//
internal enum SteamInputLEDFlag : int
public enum SteamInputLEDFlag : int
{
SetColor = 0,
RestoreUserDefault = 1,
@ -1480,7 +1480,7 @@ internal enum SteamInputLEDFlag : int
//
// EControllerSource
//
internal enum ControllerSource : int
public enum ControllerSource : int
{
None = 0,
LeftTrackpad = 1,
@ -1505,7 +1505,7 @@ internal enum ControllerSource : int
//
// EControllerSourceMode
//
internal enum ControllerSourceMode : int
public enum ControllerSourceMode : int
{
None = 0,
Dpad = 1,
@ -1529,7 +1529,7 @@ internal enum ControllerSourceMode : int
//
// EControllerActionOrigin
//
internal enum ControllerActionOrigin : int
public enum ControllerActionOrigin : int
{
None = 0,
A = 1,
@ -1779,7 +1779,7 @@ internal enum ControllerActionOrigin : int
//
// ESteamControllerLEDFlag
//
internal enum SteamControllerLEDFlag : int
public enum SteamControllerLEDFlag : int
{
SetColor = 0,
RestoreUserDefault = 1,
@ -1788,7 +1788,7 @@ internal enum SteamControllerLEDFlag : int
//
// EUGCMatchingUGCType
//
internal enum UGCMatchingUGCType : int
public enum UGCMatchingUGCType : int
{
Items = 0,
Items_Mtx = 1,
@ -1809,7 +1809,7 @@ internal enum UGCMatchingUGCType : int
//
// EUserUGCList
//
internal enum UserUGCList : int
public enum UserUGCList : int
{
Published = 0,
VotedOn = 1,
@ -1825,7 +1825,7 @@ internal enum UserUGCList : int
//
// EUserUGCListSortOrder
//
internal enum UserUGCListSortOrder : int
public enum UserUGCListSortOrder : int
{
CreationOrderDesc = 0,
CreationOrderAsc = 1,
@ -1839,7 +1839,7 @@ internal enum UserUGCListSortOrder : int
//
// EUGCQuery
//
internal enum UGCQuery : int
public enum UGCQuery : int
{
RankedByVote = 0,
RankedByPublicationDate = 1,
@ -1865,7 +1865,7 @@ internal enum UGCQuery : int
//
// EItemUpdateStatus
//
internal enum ItemUpdateStatus : int
public enum ItemUpdateStatus : int
{
Invalid = 0,
PreparingConfig = 1,
@ -1878,7 +1878,7 @@ internal enum ItemUpdateStatus : int
//
// EItemState
//
internal enum ItemState : int
public enum ItemState : int
{
None = 0,
Subscribed = 1,
@ -1892,7 +1892,7 @@ internal enum ItemState : int
//
// EItemStatistic
//
internal enum ItemStatistic : int
public enum ItemStatistic : int
{
NumSubscriptions = 0,
NumFavorites = 1,
@ -1912,7 +1912,7 @@ internal enum ItemStatistic : int
//
// EItemPreviewType
//
internal enum ItemPreviewType : int
public enum ItemPreviewType : int
{
Image = 0,
YouTubeVideo = 1,
@ -1925,7 +1925,7 @@ internal enum ItemPreviewType : int
//
// ISteamHTMLSurface::EHTMLMouseButton
//
internal enum HTMLMouseButton : int
public enum HTMLMouseButton : int
{
Left = 0,
Right = 1,
@ -1935,7 +1935,7 @@ internal enum HTMLMouseButton : int
//
// ISteamHTMLSurface::EMouseCursor
//
internal enum MouseCursor : int
public enum MouseCursor : int
{
user = 0,
none = 1,
@ -1984,7 +1984,7 @@ internal enum MouseCursor : int
//
// ISteamHTMLSurface::EHTMLKeyModifiers
//
internal enum HTMLKeyModifiers : int
public enum HTMLKeyModifiers : int
{
None = 0,
AltDown = 1,
@ -1995,7 +1995,7 @@ internal enum HTMLKeyModifiers : int
//
// ESteamItemFlags
//
internal enum SteamItemFlags : int
public enum SteamItemFlags : int
{
NoTrade = 1,
Removed = 256,
@ -2005,7 +2005,7 @@ internal enum SteamItemFlags : int
//
// EParentalFeature
//
internal enum ParentalFeature : int
public enum ParentalFeature : int
{
Invalid = 0,
Store = 1,

View File

@ -26,6 +26,10 @@ public void GenerateVTableClass( string className, string filename )
{
StartBlock( $"public class {clss.Name} : BaseSteamInterface" );
{
WriteLine( $"public override string InterfaceName => \"{clss.InterfaceString}\";" );
WriteLine();
WriteFunctionPointerReader( clss );
WriteLine();

View File

@ -93,6 +93,7 @@ public void ToFolder( string folder )
{
GenerateVTableClass( "ISteamApps", $"{folder}../Generated/Interfaces/ISteamApps.cs" );
GenerateVTableClass( "ISteamUtils", $"{folder}../Generated/Interfaces/ISteamUtils.cs" );
}
}

View File

@ -25,7 +25,7 @@ private void Enums()
if ( name[0] == 'E' )
name = name.Substring( 1 );
StartBlock( $"internal enum {name} : int" );
StartBlock( $"public enum {name} : int" );
{
//
// If all the enum values start with the same

View File

@ -13,20 +13,25 @@ internal class BaseType
public static BaseType Parse( string type, string varname = null )
{
if ( type == "SteamAPIWarningMessageHook_t" ) return new PointerType { NativeType = type, VarName = varname };
if ( type == "void" ) return new VoidType { NativeType = type, VarName = varname };
if ( type.Replace( " ", "" ) == "constchar*" ) return new ConstCharType { NativeType = type, VarName = varname };
if ( type == "char *" ) return new StringBuilderType { NativeType = type, VarName = varname };
var basicType = type.Trim( ' ', '*' );
if ( basicType == "void" ) return new PointerType { NativeType = type, VarName = varname };
if ( basicType == "int32" || basicType == "int" ) return new IntType { NativeType = type, VarName = varname };
if ( basicType == "uint32" ) return new UIntType { NativeType = type, VarName = varname };
if ( basicType == "uint8" ) return new UInt8Type { NativeType = type, VarName = varname };
if ( basicType == "uint16" ) return new UInt16Type { NativeType = type, VarName = varname };
if ( basicType == "CSteamID" ) return new CSteamIdType { NativeType = type, VarName = varname };
if ( basicType == "uint64" ) return new ULongType { NativeType = type, VarName = varname };
if ( basicType == "bool" ) return new BoolType { NativeType = type, VarName = varname };
if ( basicType.EndsWith( "_t" ) || basicType == "CSteamID" ) return new StructType { NativeType = type, VarName = varname, StructName = basicType };
if ( basicType.StartsWith( "E" ) && char.IsUpper( basicType[1] ) ) return new EnumType { NativeType = type.Substring( 1 ), VarName = varname };
return new BaseType { NativeType = type, VarName = varname };
}
@ -38,7 +43,7 @@ public static BaseType Parse( string type, string varname = null )
public virtual string ReturnAttribute => null;
public virtual string Ref => !IsVector && NativeType.EndsWith( "*" ) ? "ref " : "";
public virtual bool IsVector => NativeType.EndsWith( "*" ) && VarName.Contains( "pvec" );
public virtual bool IsVector => NativeType.EndsWith( "*" ) && (VarName.StartsWith( "pvec" ) || VarName.StartsWith( "pub" ));
public virtual bool IsVoid => false;
public virtual bool IsReturnedWeird => false;
@ -74,6 +79,23 @@ internal class UIntType : BaseType
{
public override string TypeName => $"uint";
}
internal class UInt8Type : BaseType
{
public override string TypeName => $"byte";
}
internal class UInt16Type : BaseType
{
public override string TypeName => $"ushort";
}
internal class PointerType : BaseType
{
public override string TypeName => $"IntPtr";
public override string Ref => "";
}
internal class ULongType : BaseType
{
@ -102,3 +124,8 @@ internal class VoidType : BaseType
public override string Return( string varname ) => $"";
public override bool IsVoid => true;
}
internal class EnumType : BaseType
{
}