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.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks namespace Steamworks
@ -59,6 +60,12 @@ namespace Steamworks
Console.WriteLine( $"{depot.Value}" ); 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"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -17,6 +18,8 @@
<IsCodedUITest>False</IsCodedUITest> <IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType> <TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -72,26 +75,18 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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"> <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> <HintPath>..\packages\Newtonsoft.Json.9.0.2-beta1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
</ItemGroup> </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> <ItemGroup>
<Compile Include="Client\AchievementsTest.cs" /> <Compile Include="Client\AchievementsTest.cs" />
<Compile Include="Client\ClientTest.cs" /> <Compile Include="Client\ClientTest.cs" />
@ -122,26 +117,16 @@
<Name>Facepunch.Steamworks</Name> <Name>Facepunch.Steamworks</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </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="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

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

View File

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

View File

@ -93,6 +93,7 @@ namespace Generator
{ {
GenerateVTableClass( "ISteamApps", $"{folder}../Generated/Interfaces/ISteamApps.cs" ); GenerateVTableClass( "ISteamApps", $"{folder}../Generated/Interfaces/ISteamApps.cs" );
GenerateVTableClass( "ISteamUtils", $"{folder}../Generated/Interfaces/ISteamUtils.cs" );
} }
} }

View File

@ -25,7 +25,7 @@ namespace Generator
if ( name[0] == 'E' ) if ( name[0] == 'E' )
name = name.Substring( 1 ); name = name.Substring( 1 );
StartBlock( $"internal enum {name} : int" ); StartBlock( $"public enum {name} : int" );
{ {
// //
// If all the enum values start with the same // 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 ) 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 == "void" ) return new VoidType { NativeType = type, VarName = varname };
if ( type.Replace( " ", "" ) == "constchar*" ) return new ConstCharType { 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 }; if ( type == "char *" ) return new StringBuilderType { NativeType = type, VarName = varname };
var basicType = type.Trim( ' ', '*' ); 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 == "int32" || basicType == "int" ) return new IntType { NativeType = type, VarName = varname };
if ( basicType == "uint32" ) return new UIntType { 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 == "CSteamID" ) return new CSteamIdType { NativeType = type, VarName = varname };
if ( basicType == "uint64" ) return new ULongType { 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 == "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.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 }; return new BaseType { NativeType = type, VarName = varname };
} }
@ -38,7 +43,7 @@ internal class BaseType
public virtual string ReturnAttribute => null; public virtual string ReturnAttribute => null;
public virtual string Ref => !IsVector && NativeType.EndsWith( "*" ) ? "ref " : ""; 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 IsVoid => false;
public virtual bool IsReturnedWeird => false; public virtual bool IsReturnedWeird => false;
@ -74,6 +79,23 @@ internal class UIntType : BaseType
{ {
public override string TypeName => $"uint"; 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 internal class ULongType : BaseType
{ {
@ -101,4 +123,9 @@ internal class VoidType : BaseType
public override string TypeNameFrom => $"void"; public override string TypeNameFrom => $"void";
public override string Return( string varname ) => $""; public override string Return( string varname ) => $"";
public override bool IsVoid => true; public override bool IsVoid => true;
}
internal class EnumType : BaseType
{
} }