├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── something-else.md └── workflows │ └── dotnetcore.yml ├── .gitignore ├── CompileFix.bat ├── Facepunch.Steamworks.Test ├── AppTest.cs ├── ClanTest.cs ├── Client │ └── Server │ │ └── StatsTest.cs ├── Facepunch.Steamworks.TestWin32.csproj ├── Facepunch.Steamworks.TestWin64.csproj ├── FriendsTest.cs ├── GameServerStatsTest.cs ├── GameServerTest.cs ├── InputTest.cs ├── InventoryTest.cs ├── NetworkingSockets.cs ├── NetworkingSocketsTest.TestConnectionInterface.cs ├── NetworkingSocketsTest.TestSocketInterface.cs ├── NetworkingUtils.cs ├── Properties │ └── AssemblyInfo.cs ├── RemotePlayTest.cs ├── RemoteStorageTest.cs ├── ServerlistTest.cs ├── SteamMatchmakingTest.cs ├── SteamNetworkingTest.cs ├── UgcEditor.cs ├── UgcQuery.cs ├── UgcTest.cs ├── UserStatsTest.cs ├── UserTest.cs ├── UtilsTest.cs ├── bin │ ├── Debug │ │ ├── controller_config │ │ │ └── game_actions_252490.vdf │ │ ├── steamclient.dll │ │ ├── steamclient64.dll │ │ ├── tier0_s.dll │ │ ├── tier0_s64.dll │ │ ├── vstdlib_s.dll │ │ └── vstdlib_s64.dll │ └── Release │ │ ├── controller_config │ │ └── game_actions_252490.vdf │ │ ├── steamclient.dll │ │ ├── steamclient64.dll │ │ ├── tier0_s.dll │ │ ├── tier0_s64.dll │ │ ├── vstdlib_s.dll │ │ └── vstdlib_s64.dll ├── packages.config ├── steam_api.dll └── steam_api64.dll ├── Facepunch.Steamworks.sln ├── Facepunch.Steamworks ├── Callbacks │ ├── CallResult.cs │ └── ICallbackData.cs ├── Classes │ ├── AuthTicket.cs │ ├── Dispatch.cs │ ├── SteamApi.cs │ ├── SteamGameServer.cs │ └── SteamInternal.cs ├── Enum │ ├── LeaderboardDisplay.cs │ ├── LeaderboardSort.cs │ └── SendType.cs ├── Facepunch.Steamworks.Posix.csproj ├── Facepunch.Steamworks.Win32.csproj ├── Facepunch.Steamworks.Win64.csproj ├── Facepunch.Steamworks.jpg ├── Facepunch.Steamworks.targets ├── Generated │ ├── CustomEnums.cs │ ├── Interfaces │ │ ├── ISteamAppList.cs │ │ ├── ISteamApps.cs │ │ ├── ISteamClient.cs │ │ ├── ISteamController.cs │ │ ├── ISteamFriends.cs │ │ ├── ISteamGameSearch.cs │ │ ├── ISteamGameServer.cs │ │ ├── ISteamGameServerStats.cs │ │ ├── ISteamHTMLSurface.cs │ │ ├── ISteamHTTP.cs │ │ ├── ISteamInput.cs │ │ ├── ISteamInventory.cs │ │ ├── ISteamMatchmaking.cs │ │ ├── ISteamMatchmakingPingResponse.cs │ │ ├── ISteamMatchmakingPlayersResponse.cs │ │ ├── ISteamMatchmakingRulesResponse.cs │ │ ├── ISteamMatchmakingServerListResponse.cs │ │ ├── ISteamMatchmakingServers.cs │ │ ├── ISteamMusic.cs │ │ ├── ISteamMusicRemote.cs │ │ ├── ISteamNetworking.cs │ │ ├── ISteamNetworkingFakeUDPPort.cs │ │ ├── ISteamNetworkingMessages.cs │ │ ├── ISteamNetworkingSockets.cs │ │ ├── ISteamNetworkingUtils.cs │ │ ├── ISteamParentalSettings.cs │ │ ├── ISteamParties.cs │ │ ├── ISteamRemotePlay.cs │ │ ├── ISteamRemoteStorage.cs │ │ ├── ISteamScreenshots.cs │ │ ├── ISteamTimeline.cs │ │ ├── ISteamUGC.cs │ │ ├── ISteamUser.cs │ │ ├── ISteamUserStats.cs │ │ ├── ISteamUtils.cs │ │ └── ISteamVideo.cs │ ├── SteamCallbacks.cs │ ├── SteamConstants.cs │ ├── SteamEnums.cs │ ├── SteamStructFunctions.cs │ ├── SteamStructs.cs │ └── SteamTypes.cs ├── Interfaces │ └── ISteamMatchmakingServers.cs ├── Networking │ ├── BroadcastBufferManager.cs │ ├── Connection.cs │ ├── ConnectionInfo.cs │ ├── ConnectionLaneStatus.cs │ ├── ConnectionManager.cs │ ├── ConnectionStatus.cs │ ├── Delegates.cs │ ├── IConnectionManager.cs │ ├── ISocketManager.cs │ ├── NetAddress.cs │ ├── NetErrorMessage.cs │ ├── NetIdentity.cs │ ├── NetKeyValue.cs │ ├── NetMsg.cs │ ├── NetPingLocation.cs │ ├── Socket.cs │ ├── SocketManager.cs │ └── SteamDatagramRelayAuthTicket.cs ├── ServerList │ ├── Base.cs │ ├── Favourites.cs │ ├── Friends.cs │ ├── History.cs │ ├── Internet.cs │ ├── IpList.cs │ ├── LocalNetwork.cs │ └── ServerFilterMarshaler.cs ├── SteamApps.cs ├── SteamClient.cs ├── SteamFriends.cs ├── SteamInput.cs ├── SteamInventory.cs ├── SteamMatchmaking.cs ├── SteamMatchmakingServers.cs ├── SteamMusic.cs ├── SteamNetworking.cs ├── SteamNetworkingSockets.cs ├── SteamNetworkingUtils.cs ├── SteamParental.cs ├── SteamParties.cs ├── SteamRemotePlay.cs ├── SteamRemoteStorage.cs ├── SteamScreenshots.cs ├── SteamServer.cs ├── SteamServerStats.cs ├── SteamTimeline.cs ├── SteamUgc.cs ├── SteamUser.cs ├── SteamUserStats.cs ├── SteamUtils.cs ├── SteamVideo.cs ├── Structs │ ├── Achievement.cs │ ├── AppId.cs │ ├── Clan.cs │ ├── Controller.cs │ ├── DepotId.cs │ ├── DlcInformation.cs │ ├── DownloadProgress.cs │ ├── DurationControl.cs │ ├── FileDetails.cs │ ├── Friend.cs │ ├── GameId.cs │ ├── GamePhaseRecordingInfo.cs │ ├── Image.cs │ ├── InventoryDef.cs │ ├── InventoryItem.cs │ ├── InventoryPurchaseResult.cs │ ├── InventoryRecipe.cs │ ├── InventoryResult.cs │ ├── Leaderboard.cs │ ├── LeaderboardEntry.cs │ ├── LeaderboardUpdate.cs │ ├── Lobby.cs │ ├── LobbyQuery.cs │ ├── MatchMakingKeyValuePair.cs │ ├── NumericalFilter.cs │ ├── OutgoingPacket.cs │ ├── P2Packet.cs │ ├── PartyBeacon.cs │ ├── RemotePlaySession.cs │ ├── Screenshot.cs │ ├── Server.cs │ ├── ServerInit.cs │ ├── Stat.cs │ ├── SteamId.cs │ ├── SteamIpAddress.cs │ ├── SteamParamStringArray.cs │ ├── Ugc.cs │ ├── UgcAdditionalPreview.cs │ ├── UgcAdditionalPreview.cs.meta │ ├── UgcEditor.cs │ ├── UgcItem.cs │ ├── UgcQuery.cs │ ├── UgcResultPage.cs │ └── UserItemVote.cs ├── Utility │ ├── Epoch.cs │ ├── Helpers.cs │ ├── Platform.cs │ ├── SourceServerQuery.cs │ ├── SteamInterface.cs │ ├── Utf8String.cs │ └── Utility.cs ├── steam_api.dll └── steam_api64.dll ├── Generator ├── Cleanup.cs ├── CodeWriter │ ├── Callbacks.cs │ ├── CodeWriter.cs │ ├── Constants.cs │ ├── CustomEnums.cs │ ├── Enums.cs │ ├── Interface.cs │ ├── Struct.cs │ ├── StructFunctions.cs │ ├── Types.cs │ ├── Utility.cs │ └── Writing.cs ├── Generator.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SteamApiDefinition.cs ├── Types │ ├── BaseType.cs │ ├── BoolType.cs │ ├── ConstCharType.cs │ ├── FetchStringType.cs │ ├── LiteralType.cs │ ├── SteamApiCallType.cs │ ├── StructType.cs │ └── VoidType.cs ├── packages.config └── steam_sdk │ ├── isteamapps.h │ ├── isteamappticket.h │ ├── isteamclient.h │ ├── isteamcontroller.h │ ├── isteamdualsense.h │ ├── isteamfriends.h │ ├── isteamgamecoordinator.h │ ├── isteamgameserver.h │ ├── isteamgameserverstats.h │ ├── isteamhtmlsurface.h │ ├── isteamhttp.h │ ├── isteaminput.h │ ├── isteaminventory.h │ ├── isteammatchmaking.h │ ├── isteammusic.h │ ├── isteammusicremote.h │ ├── isteamnetworking.h │ ├── isteamnetworkingmessages.h │ ├── isteamnetworkingsockets.h │ ├── isteamnetworkingutils.h │ ├── isteamparentalsettings.h │ ├── isteamps3overlayrenderer.h │ ├── isteamremoteplay.h │ ├── isteamremotestorage.h │ ├── isteamscreenshots.h │ ├── isteamtimeline.h │ ├── isteamugc.h │ ├── isteamuser.h │ ├── isteamuserstats.h │ ├── isteamutils.h │ ├── isteamvideo.h │ ├── matchmakingtypes.h │ ├── steam_api.h │ ├── steam_api.json │ ├── steam_api_common.h │ ├── steam_api_flat.h │ ├── steam_api_internal.h │ ├── steam_gameserver.h │ ├── steamclientpublic.h │ ├── steamencryptedappticket.h │ ├── steamhttpenums.h │ ├── steamnetworkingfakeip.h │ ├── steamnetworkingtypes.h │ ├── steamps3params.h │ ├── steamtypes.h │ └── steamuniverse.h ├── LICENSE ├── README.md └── UnityPlugin ├── Facepunch.Steamworks.Posix.dll.meta ├── Facepunch.Steamworks.Posix.pdb.meta ├── Facepunch.Steamworks.Posix.xml.meta ├── Facepunch.Steamworks.Win32.dll.meta ├── Facepunch.Steamworks.Win32.pdb.meta ├── Facepunch.Steamworks.Win32.xml.meta ├── Facepunch.Steamworks.Win64.dll.meta ├── Facepunch.Steamworks.Win64.pdb.meta ├── Facepunch.Steamworks.Win64.xml.meta ├── redistributable_bin.meta └── redistributable_bin ├── linux32.meta ├── linux32 ├── libsteam_api.so └── libsteam_api.so.meta ├── linux64.meta ├── linux64 ├── libsteam_api.so └── libsteam_api.so.meta ├── osx.meta ├── osx ├── libsteam_api.dylib └── libsteam_api.dylib.meta ├── steam_api.dll ├── steam_api.dll.meta ├── steam_api.lib ├── steam_api.lib.meta ├── win64.meta └── win64 ├── steam_api64.dll ├── steam_api64.dll.meta ├── steam_api64.lib └── steam_api64.lib.meta /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: garrynewman 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Set x to y 16 | 2. Run for x minutes 17 | 3. Call x 18 | 4. See error 19 | 20 | **Calling Code** 21 | ``` 22 | // The code you're using to call into Steamworks 23 | Steamworks.DoBug(); 24 | ``` 25 | 26 | **Expected behavior** 27 | A clear and concise description of what you expected to happen. 28 | 29 | **Desktop (please complete the following information):** 30 | - OS: [e.g. iOS] 31 | - Unity: [e.g Unity 2019.3] 32 | 33 | **Additional context** 34 | Add any other context about the problem here. 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/something-else.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Something Else 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/workflows/dotnetcore.yml: -------------------------------------------------------------------------------- 1 | name: Build All 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: windows-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v4.2.2 12 | - name: Setup dotnet 6.0.x 13 | uses: actions/setup-dotnet@v4.1.0 14 | with: 15 | dotnet-version: '6.0.x' 16 | include-prerelease: true 17 | 18 | - name: Restore Win64 19 | run: dotnet restore Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj 20 | - name: Restore Win32 21 | run: dotnet restore Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj 22 | - name: Restore Posix 23 | run: dotnet restore Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj 24 | 25 | - name: Build Win64 26 | run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj 27 | - name: Build Win32 28 | run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj 29 | - name: Build Posix 30 | run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj 31 | 32 | - name: Build Win64 Release 33 | run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj --configuration Release 34 | - name: Build Win32 Release 35 | run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj --configuration Release 36 | - name: Build Posix Release 37 | run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj --configuration Release 38 | 39 | - uses: actions/upload-artifact@v4.4.3 40 | with: 41 | name: Compiled Files 42 | path: Facepunch.Steamworks/bin 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | Facepunch.Steamworks.Test/bin/Debug/Facepunch.Steamworks.dll 49 | *.pdb 50 | Facepunch.Steamworks.Test/bin/Debug/Facepunch.Steamworks.Test.dll 51 | *.suo 52 | Facepunch.Steamworks.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 53 | Facepunch.Steamworks.Test/bin/Release/Facepunch.Steamworks.dll 54 | Facepunch.Steamworks.Test/bin/Release/Facepunch.Steamworks.Test.dll 55 | Facepunch.Steamworks.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 56 | *.user 57 | *.cache 58 | *.idea 59 | *.vscode 60 | TestResults 61 | obj 62 | Facepunch.Steamworks/bin/Debug/Facepunch.Steamworks.Api.dll 63 | Facepunch.Steamworks/bin/Debug/Facepunch.Steamworks.dll 64 | Facepunch.Steamworks/bin/Release/Facepunch.Steamworks.dll 65 | Facepunch.Steamworks/bin 66 | *.opendb 67 | *.db 68 | Facepunch.Steamworks.dll 69 | Facepunch.Steamworks.Test.dll 70 | *UnitTestFramework.dll 71 | mscorlib.dll 72 | *.nlp 73 | packages 74 | Generator/bin 75 | *.XML 76 | .vs 77 | Facepunch.Steamworks.Test/bin/** 78 | -------------------------------------------------------------------------------- /CompileFix.bat: -------------------------------------------------------------------------------- 1 | dotnet restore .\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj 2 | dotnet restore .\Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj 3 | dotnet restore .\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj 4 | dotnet restore .\Facepunch.Steamworks.Test\Facepunch.Steamworks.TestWin32.csproj 5 | dotnet restore .\Facepunch.Steamworks.Test\Facepunch.Steamworks.TestWin64.csproj -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/AppTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | namespace Steamworks 9 | { 10 | [TestClass] 11 | [DeploymentItem( "steam_api64.dll" )] 12 | [DeploymentItem( "steam_api.dll" )] 13 | public class AppTest 14 | { 15 | [AssemblyInitialize] 16 | public static void AssemblyInit( TestContext context ) 17 | { 18 | Steamworks.Dispatch.OnDebugCallback = ( type, str, server ) => 19 | { 20 | Console.WriteLine( $"[Callback {type} {(server ? "server" : "client")}]" ); 21 | Console.WriteLine( str ); 22 | Console.WriteLine( $"" ); 23 | }; 24 | 25 | Steamworks.Dispatch.OnException = ( e ) => 26 | { 27 | Console.Error.WriteLine( e.Message ); 28 | Console.Error.WriteLine( e.StackTrace ); 29 | Assert.Fail( e.Message ); 30 | }; 31 | 32 | // 33 | // Init Client 34 | // 35 | Steamworks.SteamClient.Init( 252490 ); 36 | 37 | // 38 | // Init Server 39 | // 40 | var serverInit = new SteamServerInit( "rust", "Rusty Mode" ) 41 | { 42 | GamePort = 28015, 43 | Secure = true, 44 | QueryPort = 28016 45 | }; 46 | 47 | Steamworks.SteamServer.Init( 252490, serverInit ); 48 | 49 | // 50 | // Needs to happen before LogOnAnonymous 51 | // 52 | SteamNetworkingSockets.RequestFakeIP(); 53 | 54 | SteamServer.LogOnAnonymous(); 55 | 56 | } 57 | 58 | [TestMethod] 59 | public void GameLangauge() 60 | { 61 | var gl = SteamApps.GameLanguage; 62 | Assert.IsNotNull( gl ); 63 | Assert.IsTrue( gl.Length > 3 ); 64 | 65 | Console.WriteLine( $"{gl}" ); 66 | } 67 | 68 | [TestMethod] 69 | public void AppInstallDir() 70 | { 71 | var str = SteamApps.AppInstallDir(); 72 | Assert.IsNotNull( str ); 73 | Assert.IsTrue( str.Length > 3 ); 74 | 75 | Console.WriteLine( $"{str}" ); 76 | } 77 | 78 | [TestMethod] 79 | public void AppOwner() 80 | { 81 | var steamid = SteamApps.AppOwner; 82 | Assert.IsTrue( steamid.Value > 70561197960279927 ); 83 | Assert.IsTrue( steamid.Value < 80561197960279927 ); 84 | 85 | Console.WriteLine( $"{steamid.Value}" ); 86 | } 87 | 88 | [TestMethod] 89 | public void InstalledDepots() 90 | { 91 | var depots = SteamApps.InstalledDepots().ToArray(); 92 | 93 | Assert.IsNotNull( depots ); 94 | Assert.IsTrue( depots.Length > 0 ); 95 | 96 | foreach ( var depot in depots ) 97 | { 98 | Console.WriteLine( $"{depot.Value}" ); 99 | } 100 | } 101 | 102 | [TestMethod] 103 | public async Task GetFileDetails() 104 | { 105 | var fileinfo = await SteamApps.GetFileDetailsAsync( "RustClient.exe" ); 106 | 107 | Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo?.SizeInBytes}" ); 108 | Console.WriteLine( $"fileinfo.Sha1: {fileinfo?.Sha1}" ); 109 | Console.WriteLine( $"fileinfo.Flags: {fileinfo?.Flags}" ); 110 | } 111 | 112 | [TestMethod] 113 | public void CommandLine() 114 | { 115 | var cl = SteamApps.CommandLine; 116 | 117 | Console.WriteLine( $"CommandLine: {cl}" ); 118 | } 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/ClanTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Steamworks 9 | { 10 | [DeploymentItem("steam_api64.dll")] 11 | [DeploymentItem("steam_api.dll")] 12 | [TestClass] 13 | public class ClanTest 14 | { 15 | [TestMethod] 16 | public void GetName() 17 | { 18 | var clan = new Clan(103582791433666425); 19 | 20 | Assert.AreEqual("Steamworks Development", clan.Name); 21 | } 22 | 23 | [TestMethod] 24 | public void GetClanTag() 25 | { 26 | var clan = new Clan(103582791433666425); 27 | 28 | Assert.AreEqual("SteamworksDev", clan.Tag); 29 | } 30 | 31 | [TestMethod] 32 | public async Task GetOwner() 33 | { 34 | var clan = new Clan(103582791433666425); 35 | await clan.RequestOfficerList(); 36 | 37 | Assert.AreNotEqual(new SteamId(), clan.Owner.Id); 38 | } 39 | 40 | [TestMethod] 41 | public void GetOfficers() 42 | { 43 | var clan = new Clan(103582791433666425); 44 | foreach (var officer in clan.GetOfficers()) 45 | { 46 | Console.WriteLine($"{officer.Name} : {officer.Id}"); 47 | } 48 | } 49 | 50 | [TestMethod] 51 | public async Task RequestOfficerList() 52 | { 53 | var clan = new Clan(103582791433666425); 54 | bool res = await clan.RequestOfficerList(); 55 | 56 | Assert.AreEqual(true, res); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/Client/Server/StatsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Threading; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | /* 6 | namespace Facepunch.Steamworks.Test 7 | { 8 | public partial class Server 9 | { 10 | [TestMethod] 11 | public void StatsGet() 12 | { 13 | using ( var server = new Facepunch.Steamworks.Server( 252490, new ServerInit( "rust", "Rust" ) ) ) 14 | { 15 | Assert.IsTrue( server.IsValid ); 16 | server.LogOnAnonymous(); 17 | 18 | ulong MySteamId = 76561197960279927; 19 | 20 | bool GotStats = false; 21 | 22 | server.Stats.Refresh( MySteamId, (steamid, success) => 23 | { 24 | GotStats = true; 25 | Assert.IsTrue( success ); 26 | 27 | var deathsInCallback = server.Stats.GetInt( MySteamId, "deaths", -1 ); 28 | Console.WriteLine( "deathsInCallback: {0}", deathsInCallback ); 29 | Assert.IsTrue( deathsInCallback > 0 ); 30 | } ); 31 | 32 | 33 | server.UpdateWhile( () => !GotStats ); 34 | 35 | var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 ); 36 | Console.WriteLine( "deathsInCallback: {0}", deaths ); 37 | Assert.IsTrue( deaths > 0 ); 38 | } 39 | } 40 | 41 | } 42 | } 43 | */ -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/Facepunch.Steamworks.TestWin32.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | TRACE;DEBUG;TEST_WIN32 4 | x86 5 | true 6 | 7 | 8 | TRACE;TEST_WIN32 9 | x64 10 | true 11 | 12 | 13 | bin\x64\Debug\ 14 | MinimumRecommendedRules.ruleset 15 | true 16 | 17 | 18 | bin\x64\Release\ 19 | MinimumRecommendedRules.ruleset 20 | true 21 | 22 | 23 | bin\x86\Debug\ 24 | x64 25 | MinimumRecommendedRules.ruleset 26 | true 27 | 28 | 29 | bin\x86\Release\ 30 | x64 31 | MinimumRecommendedRules.ruleset 32 | true 33 | 34 | 35 | net6.0 36 | false 37 | 38 | 39 | 40 | 41 | 42 | 43 | Always 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/Facepunch.Steamworks.TestWin64.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | TRACE;DEBUG;TEST_WIN64 4 | x64 5 | true 6 | 7 | 8 | x64 9 | true 10 | 11 | 12 | bin\x64\Debug\ 13 | MinimumRecommendedRules.ruleset 14 | true 15 | 16 | 17 | bin\x64\Release\ 18 | MinimumRecommendedRules.ruleset 19 | true 20 | 21 | 22 | bin\x86\Debug\ 23 | x64 24 | MinimumRecommendedRules.ruleset 25 | true 26 | 27 | 28 | bin\x86\Release\ 29 | x64 30 | MinimumRecommendedRules.ruleset 31 | true 32 | 33 | 34 | net6.0 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | Always 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/GameServerStatsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Steamworks.Data; 8 | 9 | namespace Steamworks 10 | { 11 | [TestClass] 12 | [DeploymentItem( "steam_api64.dll" )] 13 | [DeploymentItem( "steam_api.dll" )] 14 | public class GameServerStatsTest 15 | { 16 | static SteamId Garry = 76561197960279927; 17 | 18 | [TestMethod] 19 | public async Task GetAchievement() 20 | { 21 | var result = await SteamServerStats.RequestUserStatsAsync( Garry ); 22 | Assert.AreEqual( result, Result.OK ); 23 | 24 | var value = SteamServerStats.GetAchievement( Garry, "COLLECT_100_WOOD" ); 25 | Assert.IsTrue( value ); 26 | 27 | value = SteamServerStats.GetAchievement( Garry, "ACHIVEMENT_THAT_DOESNT_EXIST" ); 28 | Assert.IsFalse( value ); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/InputTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using Steamworks.Data; 9 | 10 | namespace Steamworks 11 | { 12 | [TestClass] 13 | [DeploymentItem( "steam_api64.dll" )] 14 | [DeploymentItem( "steam_api.dll" )] 15 | [DeploymentItem( "controller_config/game_actions_252490.vdf" )] 16 | public class InputTest 17 | { 18 | [TestMethod] 19 | public void ControllerList() 20 | { 21 | foreach ( var controller in SteamInput.Controllers ) 22 | { 23 | Console.Write( $"Controller: {controller}" ); 24 | 25 | var dstate = controller.GetDigitalState( "fire" ); 26 | var astate = controller.GetAnalogState( "Move" ); 27 | } 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/NetworkingUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | namespace Steamworks 9 | { 10 | [TestClass] 11 | [DeploymentItem( "steam_api64.dll" )] 12 | [DeploymentItem( "steam_api.dll" )] 13 | public class NetworkUtilsTest 14 | { 15 | static string GarrysLocation = "lhr=4+0,ams=13+1/10+0,par=17+1/12+0,lux=17+1,fra=18+1/18+0,sto=25+2,sto2=26+2,mad=27+2,vie=31+3/30+0,iad=90+9/75+0,sgp=173+17/174+17,gru=200+20/219+0"; 16 | 17 | [TestMethod] 18 | public async Task LocalPingLocation() 19 | { 20 | await SteamNetworkingUtils.WaitForPingDataAsync(); 21 | 22 | for ( int i = 0; i < 10; i++ ) 23 | { 24 | var pl = SteamNetworkingUtils.LocalPingLocation; 25 | if ( !pl.HasValue ) 26 | { 27 | await Task.Delay( 1000 ); 28 | continue; 29 | } 30 | 31 | Console.WriteLine( $"{i} Seconds Until Result: {pl}" ); 32 | return; 33 | } 34 | 35 | Assert.Fail(); 36 | } 37 | 38 | [TestMethod] 39 | public void PingLocationParse() 40 | { 41 | var pl = Data.NetPingLocation.TryParseFromString( GarrysLocation ); 42 | 43 | Assert.IsTrue( pl.HasValue ); 44 | 45 | Console.WriteLine( $"Parsed OKAY! {pl}" ); 46 | } 47 | 48 | [TestMethod] 49 | public async Task GetEstimatedPing() 50 | { 51 | await SteamNetworkingUtils.WaitForPingDataAsync(); 52 | 53 | var garrysping = Data.NetPingLocation.TryParseFromString( GarrysLocation ); 54 | Assert.IsTrue( garrysping.HasValue ); 55 | 56 | var ping = SteamNetworkingUtils.EstimatePingTo( garrysping.Value ); 57 | Assert.IsTrue( ping > 0 ); 58 | 59 | Console.WriteLine( $"Ping returned: {ping}" ); 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle( "Facepunch.Steamworks.Test" )] 9 | [assembly: AssemblyDescription( "" )] 10 | [assembly: AssemblyConfiguration( "" )] 11 | [assembly: AssemblyCompany( "" )] 12 | [assembly: AssemblyProduct( "Facepunch.Steamworks.Test" )] 13 | [assembly: AssemblyCopyright( "Copyright © 2016" )] 14 | [assembly: AssemblyTrademark( "" )] 15 | [assembly: AssemblyCulture( "" )] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible( false )] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid( "3f6183ad-d966-44f2-a6eb-42e61e591b49" )] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion( "1.0.0.0" )] 36 | [assembly: AssemblyFileVersion( "1.0.0.0" )] 37 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/RemotePlayTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using Microsoft.VisualStudio.TestTools.UnitTesting; 9 | 10 | namespace Steamworks 11 | { 12 | [TestClass] 13 | [DeploymentItem( "steam_api64.dll" )] 14 | [DeploymentItem( "steam_api.dll" )] 15 | public class RemotePlayTest 16 | { 17 | [TestMethod] 18 | public void BasicUsability() 19 | { 20 | Console.WriteLine( $"Sessions: {SteamRemotePlay.SessionCount}" ); 21 | 22 | var session = SteamRemotePlay.GetSession( 4 ); 23 | 24 | Assert.IsFalse( session.IsValid ); 25 | Assert.IsFalse( session.SteamId.IsValid ); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/RemoteStorageTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Steamworks.Data; 8 | 9 | namespace Steamworks 10 | { 11 | [TestClass] 12 | [DeploymentItem( "steam_api64.dll" )] 13 | [DeploymentItem( "steam_api.dll" )] 14 | public class RemoteStorageTest 15 | { 16 | [TestMethod] 17 | public void Quotas() 18 | { 19 | Console.WriteLine( $"SteamRemoteStorage.QuotaBytes: {SteamRemoteStorage.QuotaBytes}" ); 20 | Console.WriteLine( $"SteamRemoteStorage.QuotaRemainingBytes: {SteamRemoteStorage.QuotaRemainingBytes}" ); 21 | Console.WriteLine( $"SteamRemoteStorage.QuotaUsedBytes: {SteamRemoteStorage.QuotaUsedBytes}" ); 22 | } 23 | 24 | [TestMethod] 25 | public void IsCloudEnabled() 26 | { 27 | Console.WriteLine( $"SteamRemoteStorage.IsCloudEnabled: {SteamRemoteStorage.IsCloudEnabled}" ); 28 | Console.WriteLine( $"SteamRemoteStorage.IsCloudEnabledForAccount: {SteamRemoteStorage.IsCloudEnabledForAccount}" ); 29 | Console.WriteLine( $"SteamRemoteStorage.IsCloudEnabledForApp: {SteamRemoteStorage.IsCloudEnabledForApp}" ); 30 | } 31 | 32 | [TestMethod] 33 | public void FileWrite() 34 | { 35 | var rand = new Random(); 36 | var testFile = new byte[1024 * 1024 * 100]; 37 | 38 | for( int i=0; i< testFile.Length; i++ ) 39 | { 40 | testFile[i] = (byte) i; 41 | } 42 | 43 | var written = SteamRemoteStorage.FileWrite( "testfile", testFile ); 44 | 45 | Assert.IsTrue( written ); 46 | Assert.IsTrue( SteamRemoteStorage.FileExists( "testfile" ) ); 47 | Assert.AreEqual( SteamRemoteStorage.FileSize( "testfile" ), testFile.Length ); 48 | } 49 | 50 | [TestMethod] 51 | public void FileRead() 52 | { 53 | FileWrite(); 54 | 55 | var data = SteamRemoteStorage.FileRead( "testfile" ); 56 | 57 | Assert.IsNotNull( data ); 58 | 59 | for ( int i = 0; i < data.Length; i++ ) 60 | { 61 | Assert.AreEqual( data[i], (byte)i ); 62 | } 63 | 64 | Assert.AreEqual( SteamRemoteStorage.FileSize( "testfile" ), data.Length ); 65 | Assert.AreEqual( SteamRemoteStorage.FileSize( "testfile" ), 1024 * 1024 * 100 ); 66 | } 67 | 68 | [TestMethod] 69 | public void Files() 70 | { 71 | foreach ( var file in SteamRemoteStorage.Files ) 72 | { 73 | Console.WriteLine( $"{file} ({SteamRemoteStorage.FileSize(file)} {SteamRemoteStorage.FileTime( file )})" ); 74 | } 75 | 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/SteamMatchmakingTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Steamworks.Data; 8 | 9 | namespace Steamworks 10 | { 11 | [TestClass] 12 | [DeploymentItem( "steam_api64.dll" )] 13 | [DeploymentItem( "steam_api.dll" )] 14 | public class SteamMatchmakingTest 15 | { 16 | [TestMethod] 17 | public async Task LobbyList() 18 | { 19 | await CreateLobby(); 20 | 21 | var list = await SteamMatchmaking.LobbyList 22 | .RequestAsync(); 23 | 24 | if ( list == null ) 25 | { 26 | Console.WriteLine( "No Lobbies Found!" ); 27 | return; 28 | } 29 | 30 | foreach ( var lobby in list ) 31 | { 32 | Console.WriteLine( $"[{lobby.Id}] owned by {lobby.Owner} ({lobby.MemberCount}/{lobby.MaxMembers})" ); 33 | } 34 | } 35 | 36 | [TestMethod] 37 | public async Task LobbyListWithAtLeastOne() 38 | { 39 | await CreateLobby(); 40 | await LobbyList(); 41 | } 42 | 43 | [TestMethod] 44 | public async Task CreateLobby() 45 | { 46 | var lobbyr = await SteamMatchmaking.CreateLobbyAsync( 32 ); 47 | if ( !lobbyr.HasValue ) 48 | { 49 | Assert.Fail(); 50 | } 51 | 52 | var lobby = lobbyr.Value; 53 | lobby.SetPublic(); 54 | lobby.SetData( "gametype", "sausage" ); 55 | lobby.SetData( "dicks", "unlicked" ); 56 | 57 | Console.WriteLine( $"lobby: {lobby.Id}" ); 58 | 59 | foreach ( var entry in lobby.Data ) 60 | { 61 | Console.WriteLine( $" - {entry.Key} {entry.Value}" ); 62 | } 63 | 64 | Console.WriteLine( $"members: {lobby.MemberCount}/{lobby.MaxMembers}" ); 65 | 66 | Console.WriteLine( $"Owner: {lobby.Owner}" ); 67 | Console.WriteLine( $"Owner Is Local Player: {lobby.Owner.IsMe}" ); 68 | 69 | lobby.SendChatString( "Hello I Love Lobbies" ); 70 | } 71 | 72 | [TestMethod] 73 | public async Task LobbyChat() 74 | { 75 | SteamMatchmaking.OnChatMessage += ( lbby, member, message ) => 76 | { 77 | Console.WriteLine( $"[{lbby}] {member}: {message}" ); 78 | }; 79 | 80 | var lobbyr = await SteamMatchmaking.CreateLobbyAsync( 10 ); 81 | if ( !lobbyr.HasValue ) 82 | Assert.Fail(); 83 | 84 | var lobby = lobbyr.Value; 85 | lobby.SetPublic(); 86 | lobby.SetData( "name", "Dave's Chat Room" ); 87 | Console.WriteLine( $"lobby: {lobby.Id}" ); 88 | 89 | lobby.SendChatString( "Hello Friends, It's me - your big fat daddy" ); 90 | 91 | await Task.Delay( 50 ); 92 | 93 | lobby.SendChatString( "What? No love for daddy?" ); 94 | 95 | await Task.Delay( 500 ); 96 | 97 | lobby.SendChatString( "Okay I will LEAVE" ); 98 | lobby.SendChatString( "BYE FOREVER" ); 99 | 100 | await Task.Delay( 1000 ); 101 | 102 | lobby.Leave(); 103 | } 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/SteamNetworkingTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Steamworks.Data; 8 | 9 | namespace Steamworks 10 | { 11 | [TestClass] 12 | [DeploymentItem( "steam_api64.dll" )] 13 | [DeploymentItem( "steam_api.dll" )] 14 | public class SteamNetworkingTest 15 | { 16 | [TestMethod] 17 | public async Task SendP2PPacket() 18 | { 19 | var sent = SteamNetworking.SendP2PPacket( SteamClient.SteamId, new byte[] { 1, 2, 3 } ); 20 | Assert.IsTrue( sent ); 21 | 22 | while ( !SteamNetworking.IsP2PPacketAvailable() ) 23 | { 24 | await Task.Delay( 10 ); 25 | } 26 | 27 | var packet = SteamNetworking.ReadP2PPacket(); 28 | 29 | Assert.IsTrue( packet.HasValue ); 30 | 31 | Assert.AreEqual( packet.Value.SteamId, SteamClient.SteamId ); 32 | Assert.AreEqual( packet.Value.Data[1], 2 ); 33 | Assert.AreEqual( packet.Value.Data.Length, 3 ); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/UgcTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Steamworks.Data; 8 | 9 | namespace Steamworks 10 | { 11 | [TestClass] 12 | [DeploymentItem( "steam_api64.dll" )] 13 | [DeploymentItem( "steam_api.dll" )] 14 | public class UgcTest 15 | { 16 | [TestMethod] 17 | public void Download() 18 | { 19 | SteamUGC.Download( 1717844711 ); 20 | } 21 | 22 | [TestMethod] 23 | public async Task GetInformation() 24 | { 25 | var itemInfo = await Ugc.Item.GetAsync( 1720164672 ); 26 | 27 | Assert.IsTrue( itemInfo.HasValue ); 28 | 29 | Console.WriteLine( $"Title: {itemInfo?.Title}" ); 30 | Console.WriteLine( $"IsInstalled: {itemInfo?.IsInstalled}" ); 31 | Console.WriteLine( $"IsDownloading: {itemInfo?.IsDownloading}" ); 32 | Console.WriteLine( $"IsDownloadPending: {itemInfo?.IsDownloadPending}" ); 33 | Console.WriteLine( $"IsSubscribed: {itemInfo?.IsSubscribed}" ); 34 | Console.WriteLine( $"NeedsUpdate: {itemInfo?.NeedsUpdate}" ); 35 | Console.WriteLine( $"Description: {itemInfo?.Description}" ); 36 | Console.WriteLine( $"Owner: {itemInfo?.Owner}" ); 37 | Console.WriteLine( $"Score: {itemInfo?.Score}" ); 38 | Console.WriteLine( $"PreviewImageUrl: {itemInfo?.PreviewImageUrl}" ); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/UtilsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | namespace Steamworks 9 | { 10 | [TestClass] 11 | [DeploymentItem( "steam_api64.dll" )] 12 | [DeploymentItem( "steam_api.dll" )] 13 | public class UtilsTest 14 | { 15 | [TestMethod] 16 | public void SecondsSinceAppActive() 17 | { 18 | var time = SteamUtils.SecondsSinceAppActive; 19 | Console.WriteLine( $"{time}" ); 20 | } 21 | 22 | [TestMethod] 23 | public void SecondsSinceComputerActive() 24 | { 25 | var time = SteamUtils.SecondsSinceComputerActive; 26 | Console.WriteLine( $"{time}" ); 27 | } 28 | 29 | [TestMethod] 30 | public void ConnectedUniverse() 31 | { 32 | var u = SteamUtils.ConnectedUniverse; 33 | Console.WriteLine( $"{u}" ); 34 | } 35 | 36 | [TestMethod] 37 | public void SteamServerTime() 38 | { 39 | var time = SteamUtils.SteamServerTime; 40 | Console.WriteLine( $"{time}" ); 41 | } 42 | 43 | [TestMethod] 44 | public void IpCountry() 45 | { 46 | var cnt = SteamUtils.IpCountry; 47 | Console.WriteLine( $"{cnt}" ); 48 | } 49 | 50 | [TestMethod] 51 | public void UsingBatteryPower() 52 | { 53 | var cnt = SteamUtils.UsingBatteryPower; 54 | Console.WriteLine( $"{cnt}" ); 55 | } 56 | 57 | [TestMethod] 58 | public void CurrentBatteryPower() 59 | { 60 | var cnt = SteamUtils.CurrentBatteryPower; 61 | Console.WriteLine( $"{cnt}" ); 62 | } 63 | 64 | [TestMethod] 65 | public void AppId() 66 | { 67 | var cnt = SteamClient.AppId; 68 | 69 | Assert.IsTrue( cnt.Value > 0 ); 70 | 71 | Console.WriteLine( $"{cnt.Value}" ); 72 | } 73 | 74 | [TestMethod] 75 | public void IsOverlayEnabled() 76 | { 77 | var cnt = SteamUtils.IsOverlayEnabled; 78 | Console.WriteLine( $"{cnt}" ); 79 | } 80 | 81 | [TestMethod] 82 | public async Task CheckFileSignature() 83 | { 84 | var sig = await SteamUtils.CheckFileSignatureAsync( "hl2.exe" ); 85 | Console.WriteLine( $"{sig}" ); 86 | } 87 | 88 | [TestMethod] 89 | public void SteamUILanguage() 90 | { 91 | var cnt = SteamUtils.SteamUILanguage; 92 | Console.WriteLine( $"{cnt}" ); 93 | } 94 | 95 | [TestMethod] 96 | public void IsSteamRunningInVR() 97 | { 98 | var cnt = SteamUtils.IsSteamRunningInVR; 99 | Console.WriteLine( $"{cnt}" ); 100 | } 101 | 102 | [TestMethod] 103 | public void IsSteamInBigPictureMode() 104 | { 105 | var cnt = SteamUtils.IsSteamInBigPictureMode; 106 | Console.WriteLine( $"{cnt}" ); 107 | } 108 | 109 | [TestMethod] 110 | public void VrHeadsetStreaming() 111 | { 112 | var cnt = SteamUtils.VrHeadsetStreaming; 113 | Console.WriteLine( $"{cnt}" ); 114 | } 115 | 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/controller_config/game_actions_252490.vdf: -------------------------------------------------------------------------------- 1 | "In Game Actions" 2 | { 3 | "actions" 4 | { 5 | "InGameControls" 6 | { 7 | "title" "#Set_Ingame" 8 | "StickPadGyro" 9 | { 10 | "Move" 11 | { 12 | "title" "#Action_Move" 13 | "input_mode" "joystick_move" 14 | } 15 | "Camera" 16 | { 17 | "title" "#Action_Camera" 18 | "input_mode" "absolute_mouse" 19 | } 20 | } 21 | "AnalogTrigger" 22 | { 23 | "Throttle" "#Action_Throttle" 24 | } 25 | "Button" 26 | { 27 | "fire" "#Action_Fire" 28 | "Jump" "#Action_Jump" 29 | "pause_menu" "#Action_Menu" 30 | } 31 | } 32 | "MenuControls" 33 | { 34 | "title" "#Set_Menu" 35 | "StickPadGyro" 36 | { 37 | } 38 | "AnalogTrigger" 39 | { 40 | } 41 | "Button" 42 | { 43 | "menu_up" "#Menu_Up" 44 | "menu_down" "#Menu_Down" 45 | "menu_left" "#Menu_Left" 46 | "menu_right" "#Menu_Right" 47 | "menu_select" "#Menu_Select" 48 | "menu_cancel" "#Menu_Cancel" 49 | "pause_menu" "#Action_ReturnToGame" 50 | } 51 | } 52 | } 53 | "localization" 54 | { 55 | "english" 56 | { 57 | "Set_Ingame" "In-Game Controls" 58 | "Set_Menu" "Menu Controls" 59 | "Action_Move" "Movement" 60 | "Action_Camera" "Camera" 61 | "Action_Throttle" "Throttle" 62 | "Action_Fire" "Fire Weapon" 63 | "Action_Jump" "Jump" 64 | "Action_Menu" "Pause Menu" 65 | "Action_ReturnToGame" "Return To Game" 66 | "Menu_Up" "Up" 67 | "Menu_Down" "Down" 68 | "Menu_Left" "Left" 69 | "Menu_Right" "Right" 70 | "Menu_Select" "Select" 71 | "Menu_Cancel" "Cancel" 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/steamclient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Debug/steamclient.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/steamclient64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Debug/steamclient64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/tier0_s.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Debug/tier0_s.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/tier0_s64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Debug/tier0_s64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/vstdlib_s.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Debug/vstdlib_s.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Debug/vstdlib_s64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Debug/vstdlib_s64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/controller_config/game_actions_252490.vdf: -------------------------------------------------------------------------------- 1 | "In Game Actions" 2 | { 3 | "actions" 4 | { 5 | "InGameControls" 6 | { 7 | "title" "#Set_Ingame" 8 | "StickPadGyro" 9 | { 10 | "Move" 11 | { 12 | "title" "#Action_Move" 13 | "input_mode" "joystick_move" 14 | } 15 | "Camera" 16 | { 17 | "title" "#Action_Camera" 18 | "input_mode" "absolute_mouse" 19 | } 20 | } 21 | "AnalogTrigger" 22 | { 23 | "Throttle" "#Action_Throttle" 24 | } 25 | "Button" 26 | { 27 | "fire" "#Action_Fire" 28 | "Jump" "#Action_Jump" 29 | "pause_menu" "#Action_Menu" 30 | } 31 | } 32 | "MenuControls" 33 | { 34 | "title" "#Set_Menu" 35 | "StickPadGyro" 36 | { 37 | } 38 | "AnalogTrigger" 39 | { 40 | } 41 | "Button" 42 | { 43 | "menu_up" "#Menu_Up" 44 | "menu_down" "#Menu_Down" 45 | "menu_left" "#Menu_Left" 46 | "menu_right" "#Menu_Right" 47 | "menu_select" "#Menu_Select" 48 | "menu_cancel" "#Menu_Cancel" 49 | "pause_menu" "#Action_ReturnToGame" 50 | } 51 | } 52 | } 53 | "localization" 54 | { 55 | "english" 56 | { 57 | "Set_Ingame" "In-Game Controls" 58 | "Set_Menu" "Menu Controls" 59 | "Action_Move" "Movement" 60 | "Action_Camera" "Camera" 61 | "Action_Throttle" "Throttle" 62 | "Action_Fire" "Fire Weapon" 63 | "Action_Jump" "Jump" 64 | "Action_Menu" "Pause Menu" 65 | "Action_ReturnToGame" "Return To Game" 66 | "Menu_Up" "Up" 67 | "Menu_Down" "Down" 68 | "Menu_Left" "Left" 69 | "Menu_Right" "Right" 70 | "Menu_Select" "Select" 71 | "Menu_Cancel" "Cancel" 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/steamclient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Release/steamclient.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/steamclient64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Release/steamclient64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/tier0_s.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Release/tier0_s.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/tier0_s64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Release/tier0_s64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/vstdlib_s.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Release/vstdlib_s.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/bin/Release/vstdlib_s64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/bin/Release/vstdlib_s64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/steam_api.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/steam_api.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks.Test/steam_api64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks.Test/steam_api64.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks/Callbacks/CallResult.cs: -------------------------------------------------------------------------------- 1 | using Steamworks.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace Steamworks 10 | { 11 | /// 12 | /// An awaitable version of a SteamAPICall_t 13 | /// 14 | internal struct CallResult : INotifyCompletion where T : struct, ICallbackData 15 | { 16 | SteamAPICall_t call; 17 | ISteamUtils utils; 18 | bool server; 19 | 20 | public CallResult( SteamAPICall_t call, bool server ) 21 | { 22 | this.call = call; 23 | this.server = server; 24 | 25 | utils = (server ? SteamUtils.InterfaceServer : SteamUtils.InterfaceClient) as ISteamUtils; 26 | 27 | if ( utils == null ) 28 | utils = SteamUtils.Interface as ISteamUtils; 29 | } 30 | 31 | /// 32 | /// This gets called if IsComplete returned false on the first call. 33 | /// The Action "continues" the async call. We pass it to the Dispatch 34 | /// to be called when the callback returns. 35 | /// 36 | public void OnCompleted( Action continuation ) 37 | { 38 | if (IsCompleted) 39 | continuation(); 40 | else 41 | Dispatch.OnCallComplete(call, continuation, server); 42 | } 43 | 44 | /// 45 | /// Gets the result. This is called internally by the async shit. 46 | /// 47 | public T? GetResult() 48 | { 49 | bool failed = false; 50 | if ( !utils.IsAPICallCompleted( call, ref failed ) || failed ) 51 | return null; 52 | 53 | var t = default( T ); 54 | var size = t.DataSize; 55 | var ptr = Marshal.AllocHGlobal( size ); 56 | 57 | try 58 | { 59 | if ( !utils.GetAPICallResult( call, ptr, size, (int)t.CallbackType, ref failed ) || failed ) 60 | { 61 | Dispatch.OnDebugCallback?.Invoke( t.CallbackType, "!GetAPICallResult or failed", server ); 62 | return null; 63 | } 64 | 65 | Dispatch.OnDebugCallback?.Invoke( t.CallbackType, Dispatch.CallbackToString( t.CallbackType, ptr, size ), server ); 66 | 67 | return ((T)Marshal.PtrToStructure( ptr, typeof( T ) )); 68 | } 69 | finally 70 | { 71 | Marshal.FreeHGlobal( ptr ); 72 | } 73 | } 74 | 75 | /// 76 | /// Return true if complete or failed 77 | /// 78 | public bool IsCompleted 79 | { 80 | get 81 | { 82 | bool failed = false; 83 | if ( utils.IsAPICallCompleted( call, ref failed ) || failed ) 84 | return true; 85 | 86 | return false; 87 | } 88 | } 89 | 90 | /// 91 | /// This is what makes this struct awaitable 92 | /// 93 | internal CallResult GetAwaiter() 94 | { 95 | return this; 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Callbacks/ICallbackData.cs: -------------------------------------------------------------------------------- 1 | using Steamworks.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.InteropServices; 5 | using System.Threading.Tasks; 6 | 7 | namespace Steamworks 8 | { 9 | /// 10 | /// Gives us a generic way to get the CallbackId of structs 11 | /// 12 | internal interface ICallbackData 13 | { 14 | CallbackType CallbackType { get; } 15 | int DataSize { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Classes/AuthTicket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks 4 | { 5 | public class AuthTicket : IDisposable 6 | { 7 | public byte[] Data; 8 | public uint Handle; 9 | 10 | /// 11 | /// Cancels a ticket. 12 | /// You should cancel your ticket when you close the game or leave a server. 13 | /// 14 | public void Cancel() 15 | { 16 | if ( Handle != 0 ) 17 | { 18 | SteamUser.Internal.CancelAuthTicket( Handle ); 19 | } 20 | 21 | Handle = 0; 22 | Data = null; 23 | } 24 | 25 | public void Dispose() 26 | { 27 | Cancel(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Classes/SteamApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal static class SteamAPI 11 | { 12 | internal static class Native 13 | { 14 | [DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_SteamAPI_Init", CallingConvention = CallingConvention.Cdecl )] 15 | public static extern SteamAPIInitResult SteamInternal_SteamAPI_Init( IntPtr pszInternalCheckInterfaceVersions, IntPtr pOutErrMsg ); 16 | 17 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_Shutdown", CallingConvention = CallingConvention.Cdecl )] 18 | public static extern void SteamAPI_Shutdown(); 19 | 20 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_GetHSteamPipe", CallingConvention = CallingConvention.Cdecl )] 21 | public static extern HSteamPipe SteamAPI_GetHSteamPipe(); 22 | 23 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_RestartAppIfNecessary", CallingConvention = CallingConvention.Cdecl )] 24 | [return: MarshalAs( UnmanagedType.I1 )] 25 | public static extern bool SteamAPI_RestartAppIfNecessary( uint unOwnAppID ); 26 | 27 | } 28 | 29 | static internal SteamAPIInitResult Init( string pszInternalCheckInterfaceVersions, out string pOutErrMsg ) 30 | { 31 | using var interfaceVersionsStr = new Utf8StringToNative( pszInternalCheckInterfaceVersions ); 32 | using var buffer = Helpers.Memory.Take(); 33 | var result = Native.SteamInternal_SteamAPI_Init( interfaceVersionsStr.Pointer, buffer.Ptr ); 34 | pOutErrMsg = Helpers.MemoryToString( buffer.Ptr ); 35 | return result; 36 | } 37 | 38 | static internal void Shutdown() 39 | { 40 | Native.SteamAPI_Shutdown(); 41 | } 42 | 43 | static internal HSteamPipe GetHSteamPipe() 44 | { 45 | return Native.SteamAPI_GetHSteamPipe(); 46 | } 47 | 48 | static internal bool RestartAppIfNecessary( uint unOwnAppID ) 49 | { 50 | return Native.SteamAPI_RestartAppIfNecessary( unOwnAppID ); 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Classes/SteamGameServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal static class SteamGameServer 11 | { 12 | internal static class Native 13 | { 14 | [DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_RunCallbacks", CallingConvention = CallingConvention.Cdecl )] 15 | public static extern void SteamGameServer_RunCallbacks(); 16 | 17 | [DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_Shutdown", CallingConvention = CallingConvention.Cdecl )] 18 | public static extern void SteamGameServer_Shutdown(); 19 | 20 | [DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_GetHSteamPipe", CallingConvention = CallingConvention.Cdecl )] 21 | public static extern HSteamPipe SteamGameServer_GetHSteamPipe(); 22 | 23 | } 24 | static internal void RunCallbacks() 25 | { 26 | Native.SteamGameServer_RunCallbacks(); 27 | } 28 | 29 | static internal void Shutdown() 30 | { 31 | Native.SteamGameServer_Shutdown(); 32 | } 33 | 34 | static internal HSteamPipe GetHSteamPipe() 35 | { 36 | return Native.SteamGameServer_GetHSteamPipe(); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Classes/SteamInternal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal static class SteamInternal 11 | { 12 | internal static class Native 13 | { 14 | [DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_GameServer_Init_V2", CallingConvention = CallingConvention.Cdecl )] 15 | public static extern SteamAPIInitResult SteamInternal_GameServer_Init_V2( uint unIP, ushort usGamePort, ushort usQueryPort, int eServerMode, IntPtr pchVersionString, IntPtr pszInternalCheckInterfaceVersions, IntPtr pOutErrMsg ); 16 | } 17 | 18 | static internal SteamAPIInitResult GameServer_Init( uint unIP, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString, string pszInternalCheckInterfaceVersions, out string pOutErrMsg ) 19 | { 20 | using var versionStr = new Utf8StringToNative( pchVersionString ); 21 | using var interfaceVersionsStr = new Utf8StringToNative( pszInternalCheckInterfaceVersions ); 22 | using var buffer = Helpers.Memory.Take(); 23 | var result = Native.SteamInternal_GameServer_Init_V2( unIP, usGamePort, usQueryPort, eServerMode, versionStr.Pointer, interfaceVersionsStr.Pointer, buffer.Ptr ); 24 | pOutErrMsg = Helpers.MemoryToString( buffer.Ptr ); 25 | return result; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Enum/LeaderboardDisplay.cs: -------------------------------------------------------------------------------- 1 | namespace Steamworks.Data 2 | { 3 | public enum LeaderboardDisplay : int 4 | { 5 | /// 6 | /// The score is just a simple numerical value 7 | /// 8 | Numeric = 1, 9 | 10 | /// 11 | /// The score represents a time, in seconds 12 | /// 13 | TimeSeconds = 2, 14 | 15 | /// 16 | /// The score represents a time, in milliseconds 17 | /// 18 | TimeMilliSeconds = 3, 19 | } 20 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Enum/LeaderboardSort.cs: -------------------------------------------------------------------------------- 1 | namespace Steamworks.Data 2 | { 3 | public enum LeaderboardSort : int 4 | { 5 | /// 6 | /// The top-score is the lowest number 7 | /// 8 | Ascending = 1, 9 | 10 | /// 11 | /// The top-score is the highest number 12 | /// 13 | Descending = 2, 14 | } 15 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Enum/SendType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.Data 4 | { 5 | [Flags] 6 | public enum SendType : int 7 | { 8 | /// 9 | /// Send the message unreliably. Can be lost. Messages *can* be larger than a 10 | /// single MTU (UDP packet), but there is no retransmission, so if any piece 11 | /// of the message is lost, the entire message will be dropped. 12 | /// 13 | /// The sending API does have some knowledge of the underlying connection, so 14 | /// if there is no NAT-traversal accomplished or there is a recognized adjustment 15 | /// happening on the connection, the packet will be batched until the connection 16 | /// is open again. 17 | /// 18 | Unreliable = 0, 19 | 20 | /// 21 | /// Disable Nagle's algorithm. 22 | /// By default, Nagle's algorithm is applied to all outbound messages. This means 23 | /// that the message will NOT be sent immediately, in case further messages are 24 | /// sent soon after you send this, which can be grouped together. Any time there 25 | /// is enough buffered data to fill a packet, the packets will be pushed out immediately, 26 | /// but partially-full packets not be sent until the Nagle timer expires. 27 | /// 28 | NoNagle = 1 << 0, 29 | 30 | /// 31 | /// If the message cannot be sent very soon (because the connection is still doing some initial 32 | /// handshaking, route negotiations, etc), then just drop it. This is only applicable for unreliable 33 | /// messages. Using this flag on reliable messages is invalid. 34 | /// 35 | NoDelay = 1 << 2, 36 | 37 | /// Reliable message send. Can send up to 0.5mb in a single message. 38 | /// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for 39 | /// efficient sends of large chunks of data. 40 | Reliable = 1 << 3 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Facepunch.Steamworks.Posix.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Facepunch.Steamworks.Posix 5 | $(DefineConstants);PLATFORM_POSIX 6 | netstandard2.1;net6.0;net46 7 | true 8 | 10 9 | true 10 | false 11 | Steamworks 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Facepunch.Steamworks.Win32.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Facepunch.Steamworks.Win32 5 | $(DefineConstants);PLATFORM_WIN32;PLATFORM_WIN 6 | netstandard2.1;net6.0;net46 7 | true 8 | true 9 | true 10 | Steamworks 11 | 12 | 13 | 14 | C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client 15 | Garry Newman 16 | Facepunch.Steamworks.win32 17 | Steamworks implementation with an emphasis on making things easy. For Windows x86. 18 | https://github.com/Facepunch/Facepunch.Steamworks 19 | Facepunch.Steamworks.jpg 20 | facepunch;steam;unity;steamworks;valve 21 | 10 22 | MIT 23 | https://github.com/Facepunch/Facepunch.Steamworks.git 24 | git 25 | true 26 | 27 | 28 | 29 | 30 | true 31 | / 32 | 33 | 34 | Always 35 | true 36 | content 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Facepunch.Steamworks.Win64.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Facepunch.Steamworks.Win64 5 | $(DefineConstants);PLATFORM_WIN64;PLATFORM_WIN;PLATFORM_64 6 | netstandard2.1;net6.0;net46 7 | true 8 | true 9 | true 10 | Steamworks 11 | 12 | 13 | 14 | C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client 15 | Garry Newman 16 | Facepunch.Steamworks 17 | Steamworks implementation with an emphasis on making things easy. For Windows x64. 18 | https://github.com/Facepunch/Facepunch.Steamworks 19 | Facepunch.Steamworks.jpg 20 | facepunch;steam;unity;steamworks;valve 21 | 10 22 | MIT 23 | https://github.com/Facepunch/Facepunch.Steamworks.git 24 | git 25 | true 26 | 27 | 28 | 29 | 30 | true 31 | / 32 | 33 | 34 | Always 35 | true 36 | content 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Facepunch.Steamworks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks/Facepunch.Steamworks.jpg -------------------------------------------------------------------------------- /Facepunch.Steamworks/Facepunch.Steamworks.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | PackageReference 5 | true 6 | 7 | 8 | 9 | 2.4.1 10 | 2.4.1 11 | 12 | 13 | 14 | $(DefineConstants);TRACE;DEBUG 15 | 1701;1702;1705;618;1591 16 | 17 | 18 | 19 | $(DefineConstants);TRACE;RELEASE 20 | 1701;1702;1705;618;1591 21 | 22 | 23 | 24 | $(DefineConstants);NET_CORE 25 | 26 | 27 | 28 | full 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamAppList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamAppList : SteamInterface 11 | { 12 | 13 | internal ISteamAppList( bool IsGameServer ) 14 | { 15 | SetupInterface( IsGameServer ); 16 | } 17 | 18 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamAppList_v001", CallingConvention = Platform.CC)] 19 | internal static extern IntPtr SteamAPI_SteamAppList_v001(); 20 | public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamAppList_v001(); 21 | 22 | 23 | #region FunctionMeta 24 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamAppList_GetNumInstalledApps", CallingConvention = Platform.CC)] 25 | private static extern uint _GetNumInstalledApps( IntPtr self ); 26 | 27 | #endregion 28 | internal uint GetNumInstalledApps() 29 | { 30 | var returnValue = _GetNumInstalledApps( Self ); 31 | return returnValue; 32 | } 33 | 34 | #region FunctionMeta 35 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamAppList_GetInstalledApps", CallingConvention = Platform.CC)] 36 | private static extern uint _GetInstalledApps( IntPtr self, [In,Out] AppId[] pvecAppID, uint unMaxAppIDs ); 37 | 38 | #endregion 39 | internal uint GetInstalledApps( [In,Out] AppId[] pvecAppID, uint unMaxAppIDs ) 40 | { 41 | var returnValue = _GetInstalledApps( Self, pvecAppID, unMaxAppIDs ); 42 | return returnValue; 43 | } 44 | 45 | #region FunctionMeta 46 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamAppList_GetAppName", CallingConvention = Platform.CC)] 47 | private static extern int _GetAppName( IntPtr self, AppId nAppID, IntPtr pchName, int cchNameMax ); 48 | 49 | #endregion 50 | internal int GetAppName( AppId nAppID, out string pchName ) 51 | { 52 | using var mempchName = Helpers.TakeMemory(); 53 | var returnValue = _GetAppName( Self, nAppID, mempchName, (1024 * 32) ); 54 | pchName = Helpers.MemoryToString( mempchName ); 55 | return returnValue; 56 | } 57 | 58 | #region FunctionMeta 59 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamAppList_GetAppInstallDir", CallingConvention = Platform.CC)] 60 | private static extern int _GetAppInstallDir( IntPtr self, AppId nAppID, IntPtr pchDirectory, int cchNameMax ); 61 | 62 | #endregion 63 | internal int GetAppInstallDir( AppId nAppID, out string pchDirectory ) 64 | { 65 | using var mempchDirectory = Helpers.TakeMemory(); 66 | var returnValue = _GetAppInstallDir( Self, nAppID, mempchDirectory, (1024 * 32) ); 67 | pchDirectory = Helpers.MemoryToString( mempchDirectory ); 68 | return returnValue; 69 | } 70 | 71 | #region FunctionMeta 72 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamAppList_GetAppBuildId", CallingConvention = Platform.CC)] 73 | private static extern int _GetAppBuildId( IntPtr self, AppId nAppID ); 74 | 75 | #endregion 76 | internal int GetAppBuildId( AppId nAppID ) 77 | { 78 | var returnValue = _GetAppBuildId( Self, nAppID ); 79 | return returnValue; 80 | } 81 | 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingPingResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamMatchmakingPingResponse : SteamInterface 11 | { 12 | internal ISteamMatchmakingPingResponse( bool IsGameServer ) 13 | { 14 | SetupInterface( IsGameServer ); 15 | } 16 | 17 | #region FunctionMeta 18 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingPingResponse_ServerResponded", CallingConvention = Platform.CC)] 19 | private static extern void _ServerResponded( IntPtr self, ref gameserveritem_t server ); 20 | 21 | #endregion 22 | internal void ServerResponded( ref gameserveritem_t server ) 23 | { 24 | _ServerResponded( Self, ref server ); 25 | } 26 | 27 | #region FunctionMeta 28 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingPingResponse_ServerFailedToRespond", CallingConvention = Platform.CC)] 29 | private static extern void _ServerFailedToRespond( IntPtr self ); 30 | 31 | #endregion 32 | internal void ServerFailedToRespond() 33 | { 34 | _ServerFailedToRespond( Self ); 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingPlayersResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamMatchmakingPlayersResponse : SteamInterface 11 | { 12 | internal ISteamMatchmakingPlayersResponse( bool IsGameServer ) 13 | { 14 | SetupInterface( IsGameServer ); 15 | } 16 | 17 | #region FunctionMeta 18 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingPlayersResponse_AddPlayerToList", CallingConvention = Platform.CC)] 19 | private static extern void _AddPlayerToList( IntPtr self, IntPtr pchName, int nScore, float flTimePlayed ); 20 | 21 | #endregion 22 | internal void AddPlayerToList( string pchName, int nScore, float flTimePlayed ) 23 | { 24 | using var str__pchName = new Utf8StringToNative( pchName ); 25 | _AddPlayerToList( Self, str__pchName.Pointer, nScore, flTimePlayed ); 26 | } 27 | 28 | #region FunctionMeta 29 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingPlayersResponse_PlayersFailedToRespond", CallingConvention = Platform.CC)] 30 | private static extern void _PlayersFailedToRespond( IntPtr self ); 31 | 32 | #endregion 33 | internal void PlayersFailedToRespond() 34 | { 35 | _PlayersFailedToRespond( Self ); 36 | } 37 | 38 | #region FunctionMeta 39 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingPlayersResponse_PlayersRefreshComplete", CallingConvention = Platform.CC)] 40 | private static extern void _PlayersRefreshComplete( IntPtr self ); 41 | 42 | #endregion 43 | internal void PlayersRefreshComplete() 44 | { 45 | _PlayersRefreshComplete( Self ); 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingRulesResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamMatchmakingRulesResponse : SteamInterface 11 | { 12 | internal ISteamMatchmakingRulesResponse( bool IsGameServer ) 13 | { 14 | SetupInterface( IsGameServer ); 15 | } 16 | 17 | #region FunctionMeta 18 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingRulesResponse_RulesResponded", CallingConvention = Platform.CC)] 19 | private static extern void _RulesResponded( IntPtr self, IntPtr pchRule, IntPtr pchValue ); 20 | 21 | #endregion 22 | internal void RulesResponded( string pchRule, string pchValue ) 23 | { 24 | using var str__pchRule = new Utf8StringToNative( pchRule ); 25 | using var str__pchValue = new Utf8StringToNative( pchValue ); 26 | _RulesResponded( Self, str__pchRule.Pointer, str__pchValue.Pointer ); 27 | } 28 | 29 | #region FunctionMeta 30 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingRulesResponse_RulesFailedToRespond", CallingConvention = Platform.CC)] 31 | private static extern void _RulesFailedToRespond( IntPtr self ); 32 | 33 | #endregion 34 | internal void RulesFailedToRespond() 35 | { 36 | _RulesFailedToRespond( Self ); 37 | } 38 | 39 | #region FunctionMeta 40 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingRulesResponse_RulesRefreshComplete", CallingConvention = Platform.CC)] 41 | private static extern void _RulesRefreshComplete( IntPtr self ); 42 | 43 | #endregion 44 | internal void RulesRefreshComplete() 45 | { 46 | _RulesRefreshComplete( Self ); 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingServerListResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamMatchmakingServerListResponse : SteamInterface 11 | { 12 | internal ISteamMatchmakingServerListResponse( bool IsGameServer ) 13 | { 14 | SetupInterface( IsGameServer ); 15 | } 16 | 17 | #region FunctionMeta 18 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingServerListResponse_ServerResponded", CallingConvention = Platform.CC)] 19 | private static extern void _ServerResponded( IntPtr self, HServerListRequest hRequest, int iServer ); 20 | 21 | #endregion 22 | internal void ServerResponded( HServerListRequest hRequest, int iServer ) 23 | { 24 | _ServerResponded( Self, hRequest, iServer ); 25 | } 26 | 27 | #region FunctionMeta 28 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingServerListResponse_ServerFailedToRespond", CallingConvention = Platform.CC)] 29 | private static extern void _ServerFailedToRespond( IntPtr self, HServerListRequest hRequest, int iServer ); 30 | 31 | #endregion 32 | internal void ServerFailedToRespond( HServerListRequest hRequest, int iServer ) 33 | { 34 | _ServerFailedToRespond( Self, hRequest, iServer ); 35 | } 36 | 37 | #region FunctionMeta 38 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingServerListResponse_RefreshComplete", CallingConvention = Platform.CC)] 39 | private static extern void _RefreshComplete( IntPtr self, HServerListRequest hRequest, MatchMakingServerResponse response ); 40 | 41 | #endregion 42 | internal void RefreshComplete( HServerListRequest hRequest, MatchMakingServerResponse response ) 43 | { 44 | _RefreshComplete( Self, hRequest, response ); 45 | } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamNetworkingFakeUDPPort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamNetworkingFakeUDPPort : SteamInterface 11 | { 12 | internal ISteamNetworkingFakeUDPPort( bool IsGameServer ) 13 | { 14 | SetupInterface( IsGameServer ); 15 | } 16 | 17 | #region FunctionMeta 18 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_DestroyFakeUDPPort", CallingConvention = Platform.CC)] 19 | private static extern void _DestroyFakeUDPPort( IntPtr self ); 20 | 21 | #endregion 22 | internal void DestroyFakeUDPPort() 23 | { 24 | _DestroyFakeUDPPort( Self ); 25 | } 26 | 27 | #region FunctionMeta 28 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_SendMessageToFakeIP", CallingConvention = Platform.CC)] 29 | private static extern Result _SendMessageToFakeIP( IntPtr self, ref NetAddress remoteAddress, IntPtr pData, uint cbData, int nSendFlags ); 30 | 31 | #endregion 32 | internal Result SendMessageToFakeIP( ref NetAddress remoteAddress, IntPtr pData, uint cbData, int nSendFlags ) 33 | { 34 | var returnValue = _SendMessageToFakeIP( Self, ref remoteAddress, pData, cbData, nSendFlags ); 35 | return returnValue; 36 | } 37 | 38 | #region FunctionMeta 39 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_ReceiveMessages", CallingConvention = Platform.CC)] 40 | private static extern int _ReceiveMessages( IntPtr self, IntPtr ppOutMessages, int nMaxMessages ); 41 | 42 | #endregion 43 | internal int ReceiveMessages( IntPtr ppOutMessages, int nMaxMessages ) 44 | { 45 | var returnValue = _ReceiveMessages( Self, ppOutMessages, nMaxMessages ); 46 | return returnValue; 47 | } 48 | 49 | #region FunctionMeta 50 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingFakeUDPPort_ScheduleCleanup", CallingConvention = Platform.CC)] 51 | private static extern void _ScheduleCleanup( IntPtr self, ref NetAddress remoteAddress ); 52 | 53 | #endregion 54 | internal void ScheduleCleanup( ref NetAddress remoteAddress ) 55 | { 56 | _ScheduleCleanup( Self, ref remoteAddress ); 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Generated/Interfaces/ISteamVideo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | 8 | namespace Steamworks 9 | { 10 | internal unsafe partial class ISteamVideo : SteamInterface 11 | { 12 | public const string Version = "STEAMVIDEO_INTERFACE_V007"; 13 | 14 | internal ISteamVideo( bool IsGameServer ) 15 | { 16 | SetupInterface( IsGameServer ); 17 | } 18 | 19 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_SteamVideo_v007", CallingConvention = Platform.CC)] 20 | internal static extern IntPtr SteamAPI_SteamVideo_v007(); 21 | public override IntPtr GetUserInterfacePointer() => SteamAPI_SteamVideo_v007(); 22 | 23 | 24 | #region FunctionMeta 25 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamVideo_GetVideoURL", CallingConvention = Platform.CC)] 26 | private static extern void _GetVideoURL( IntPtr self, AppId unVideoAppID ); 27 | 28 | #endregion 29 | internal void GetVideoURL( AppId unVideoAppID ) 30 | { 31 | _GetVideoURL( Self, unVideoAppID ); 32 | } 33 | 34 | #region FunctionMeta 35 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamVideo_IsBroadcasting", CallingConvention = Platform.CC)] 36 | [return: MarshalAs( UnmanagedType.I1 )] 37 | private static extern bool _IsBroadcasting( IntPtr self, ref int pnNumViewers ); 38 | 39 | #endregion 40 | internal bool IsBroadcasting( ref int pnNumViewers ) 41 | { 42 | var returnValue = _IsBroadcasting( Self, ref pnNumViewers ); 43 | return returnValue; 44 | } 45 | 46 | #region FunctionMeta 47 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamVideo_GetOPFSettings", CallingConvention = Platform.CC)] 48 | private static extern void _GetOPFSettings( IntPtr self, AppId unVideoAppID ); 49 | 50 | #endregion 51 | internal void GetOPFSettings( AppId unVideoAppID ) 52 | { 53 | _GetOPFSettings( Self, unVideoAppID ); 54 | } 55 | 56 | #region FunctionMeta 57 | [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamVideo_GetOPFStringForApp", CallingConvention = Platform.CC)] 58 | [return: MarshalAs( UnmanagedType.I1 )] 59 | private static extern bool _GetOPFStringForApp( IntPtr self, AppId unVideoAppID, IntPtr pchBuffer, ref int pnBufferSize ); 60 | 61 | #endregion 62 | internal bool GetOPFStringForApp( AppId unVideoAppID, out string pchBuffer ) 63 | { 64 | using var mem__pchBuffer = Helpers.TakeMemory(); 65 | int szpnBufferSize = (1024 * 32); 66 | var returnValue = _GetOPFStringForApp( Self, unVideoAppID, mem__pchBuffer, ref szpnBufferSize ); 67 | pchBuffer = Helpers.MemoryToString( mem__pchBuffer ); 68 | return returnValue; 69 | } 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs: -------------------------------------------------------------------------------- 1 | using Steamworks.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | namespace Steamworks 8 | { 9 | internal partial class ISteamMatchmakingServers 10 | { 11 | // Cached offset of gameserveritem_t.m_bHadSuccessfulResponse 12 | private static int hasSuccessfulResponseOffset; 13 | 14 | /// 15 | /// Read gameserveritem_t.m_bHadSuccessfulResponse without allocating the struct on the heap 16 | /// 17 | /// 18 | /// 19 | /// 20 | internal bool HasServerResponded( HServerListRequest hRequest, int iServer ) 21 | { 22 | IntPtr returnValue = _GetServerDetails( Self, hRequest, iServer ); 23 | 24 | // Return false if steam returned null 25 | if ( returnValue == IntPtr.Zero ) return false; 26 | 27 | // Cache the offset of m_bHadSuccessfulResponse 28 | if ( hasSuccessfulResponseOffset == 0 ) 29 | { 30 | hasSuccessfulResponseOffset = Marshal.OffsetOf( nameof( gameserveritem_t.HadSuccessfulResponse ) ).ToInt32(); 31 | 32 | if ( hasSuccessfulResponseOffset == 0 ) 33 | { 34 | throw new Exception( "Failed to get offset of gameserveritem_t.HadSuccessfulResponse" ); 35 | } 36 | } 37 | 38 | // Read byte m_bHadSuccessfulResponse 39 | return Marshal.ReadByte( IntPtr.Add( returnValue, hasSuccessfulResponseOffset ) ) == 1; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/ConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Steamworks.Data 4 | { 5 | /// 6 | /// Describe the state of a connection 7 | /// 8 | [StructLayout( LayoutKind.Sequential, Size = 696 )] 9 | public struct ConnectionInfo 10 | { 11 | internal NetIdentity identity; 12 | internal long userData; 13 | internal Socket listenSocket; 14 | internal NetAddress address; 15 | internal ushort pad; 16 | internal SteamNetworkingPOPID popRemote; 17 | internal SteamNetworkingPOPID popRelay; 18 | internal ConnectionState state; 19 | internal int endReason; 20 | [MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )] 21 | internal string endDebug; 22 | [MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )] 23 | internal string connectionDescription; 24 | 25 | /// 26 | /// High level state of the connection 27 | /// 28 | public ConnectionState State => state; 29 | 30 | /// 31 | /// Remote address. Might be all 0's if we don't know it, or if this is N/A. 32 | /// 33 | public NetAddress Address => address; 34 | 35 | /// 36 | /// Who is on the other end? Depending on the connection type and phase of the connection, we might not know 37 | /// 38 | public NetIdentity Identity => identity; 39 | 40 | /// 41 | /// Basic cause of the connection termination or problem. 42 | /// 43 | public NetConnectionEnd EndReason => (NetConnectionEnd)endReason; 44 | } 45 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/ConnectionLaneStatus.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Steamworks.Data 4 | { 5 | /// 6 | /// Describe the status of a connection 7 | /// 8 | [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )] 9 | public struct ConnectionLaneStatus 10 | { 11 | internal int cbPendingUnreliable; // m_cbPendingUnreliable int 12 | internal int cbPendingReliable; // m_cbPendingReliable int 13 | internal int cbSentUnackedReliable; // m_cbSentUnackedReliable int 14 | internal int _reservePad1; // _reservePad1 int 15 | internal long ecQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds 16 | [MarshalAs( UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.U4 )] 17 | internal uint[] reserved; // reserved uint32 [10] 18 | 19 | /// 20 | /// Number of bytes unreliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire. 21 | /// 22 | public int PendingUnreliable => cbPendingUnreliable; 23 | 24 | /// 25 | /// Number of bytes reliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire. 26 | /// 27 | public int PendingReliable => cbPendingReliable; 28 | 29 | /// 30 | /// Number of bytes of reliable data that has been placed the wire, but for which we have not yet received an acknowledgment, and thus we may have to re-transmit. 31 | /// 32 | public int SentUnackedReliable => cbSentUnackedReliable; 33 | } 34 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/ConnectionStatus.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Steamworks.Data 4 | { 5 | /// 6 | /// Describe the status of a connection 7 | /// 8 | [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )] 9 | public struct ConnectionStatus 10 | { 11 | internal ConnectionState state; // m_eState ESteamNetworkingConnectionState 12 | internal int ping; // m_nPing int 13 | internal float connectionQualityLocal; // m_flConnectionQualityLocal float 14 | internal float connectionQualityRemote; // m_flConnectionQualityRemote float 15 | internal float outPacketsPerSec; // m_flOutPacketsPerSec float 16 | internal float outBytesPerSec; // m_flOutBytesPerSec float 17 | internal float inPacketsPerSec; // m_flInPacketsPerSec float 18 | internal float inBytesPerSec; // m_flInBytesPerSec float 19 | internal int sendRateBytesPerSecond; // m_nSendRateBytesPerSecond int 20 | internal int cbPendingUnreliable; // m_cbPendingUnreliable int 21 | internal int cbPendingReliable; // m_cbPendingReliable int 22 | internal int cbSentUnackedReliable; // m_cbSentUnackedReliable int 23 | internal long ecQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds 24 | [MarshalAs( UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4 )] 25 | internal uint[] reserved; // reserved uint32 [16] 26 | 27 | /// 28 | /// Current ping (ms) 29 | /// 30 | public int Ping => ping; 31 | 32 | /// 33 | /// Outgoing packets per second 34 | /// 35 | public float OutPacketsPerSec => outPacketsPerSec; 36 | 37 | /// 38 | /// Outgoing bytes per second 39 | /// 40 | public float OutBytesPerSec => outBytesPerSec; 41 | 42 | /// 43 | /// Incoming packets per second 44 | /// 45 | public float InPacketsPerSec => inPacketsPerSec; 46 | 47 | /// 48 | /// Incoming bytes per second 49 | /// 50 | public float InBytesPerSec => inBytesPerSec; 51 | 52 | /// 53 | /// Connection quality measured locally, 0...1 (percentage of packets delivered end-to-end in order). 54 | /// 55 | public float ConnectionQualityLocal => connectionQualityLocal; 56 | 57 | /// 58 | /// Packet delivery success rate as observed from remote host, 0...1 (percentage of packets delivered end-to-end in order). 59 | /// 60 | public float ConnectionQualityRemote => connectionQualityRemote; 61 | 62 | /// 63 | /// Number of bytes unreliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire. 64 | /// 65 | public int PendingUnreliable => cbPendingUnreliable; 66 | 67 | /// 68 | /// Number of bytes reliable data pending to be sent. This is data that you have recently requested to be sent but has not yet actually been put on the wire. 69 | /// 70 | public int PendingReliable => cbPendingReliable; 71 | 72 | /// 73 | /// Number of bytes of reliable data that has been placed the wire, but for which we have not yet received an acknowledgment, and thus we may have to re-transmit. 74 | /// 75 | public int SentUnackedReliable => cbSentUnackedReliable; 76 | } 77 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/Delegates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using Steamworks.Data; 5 | 6 | namespace Steamworks 7 | { 8 | [UnmanagedFunctionPointer( Platform.CC )] 9 | internal delegate void NetDebugFunc( [In] NetDebugOutput nType, [In] IntPtr pszMsg ); 10 | 11 | [UnmanagedFunctionPointer( Platform.CC )] 12 | internal unsafe delegate void FnSteamNetConnectionStatusChanged( ref SteamNetConnectionStatusChangedCallback_t arg ); 13 | 14 | [UnmanagedFunctionPointer( Platform.CC )] 15 | internal delegate void FnSteamNetAuthenticationStatusChanged( ref SteamNetAuthenticationStatus_t arg ); 16 | 17 | [UnmanagedFunctionPointer( Platform.CC )] 18 | internal delegate void FnSteamRelayNetworkStatusChanged( ref SteamRelayNetworkStatus_t arg ); 19 | 20 | [UnmanagedFunctionPointer( Platform.CC )] 21 | internal delegate void FnSteamNetworkingMessagesSessionRequest( ref SteamNetworkingMessagesSessionRequest_t arg ); 22 | 23 | [UnmanagedFunctionPointer( Platform.CC )] 24 | internal delegate void FnSteamNetworkingMessagesSessionFailed( ref SteamNetworkingMessagesSessionFailed_t arg ); 25 | 26 | [UnmanagedFunctionPointer( Platform.CC )] 27 | internal delegate void FnSteamNetworkingFakeIPResult( ref SteamNetworkingFakeIPResult_t arg ); 28 | } 29 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/IConnectionManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Steamworks.Data; 3 | 4 | namespace Steamworks 5 | { 6 | public interface IConnectionManager 7 | { 8 | /// 9 | /// We started connecting to this guy 10 | /// 11 | void OnConnecting( ConnectionInfo info ); 12 | 13 | /// 14 | /// Called when the connection is fully connected and can start being communicated with 15 | /// 16 | void OnConnected( ConnectionInfo info ); 17 | 18 | /// 19 | /// We got disconnected 20 | /// 21 | void OnDisconnected( ConnectionInfo info ); 22 | 23 | /// 24 | /// Received a message 25 | /// 26 | void OnMessage( IntPtr data, int size, long messageNum, long recvTime, int channel ); 27 | } 28 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/ISocketManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Steamworks.Data; 3 | 4 | namespace Steamworks 5 | { 6 | public interface ISocketManager 7 | { 8 | /// 9 | /// Must call Accept or Close on the connection within a second or so 10 | /// 11 | void OnConnecting( Connection connection, ConnectionInfo info ); 12 | 13 | /// 14 | /// Called when the connection is fully connected and can start being communicated with 15 | /// 16 | void OnConnected( Connection connection, ConnectionInfo info ); 17 | 18 | /// 19 | /// Called when the connection leaves. Must call Close on the connection 20 | /// 21 | void OnDisconnected( Connection connection, ConnectionInfo info ); 22 | 23 | /// 24 | /// Received a message from a connection 25 | /// 26 | void OnMessage( Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel ); 27 | } 28 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/NetErrorMessage.cs: -------------------------------------------------------------------------------- 1 | 2 | using Steamworks.Data; 3 | 4 | namespace Steamworks.Data 5 | { 6 | internal unsafe struct NetErrorMessage 7 | { 8 | public fixed char Value[1024]; 9 | } 10 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/NetIdentity.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Steamworks.Data 4 | { 5 | [StructLayout( LayoutKind.Explicit, Size = 136, Pack = 1 )] 6 | public partial struct NetIdentity 7 | { 8 | [FieldOffset( 0 )] 9 | internal IdentityType type; 10 | 11 | [FieldOffset( 4 )] 12 | internal int size; 13 | 14 | [FieldOffset( 8 )] 15 | internal ulong steamid; 16 | 17 | [FieldOffset( 8 )] 18 | internal NetAddress netaddress; 19 | 20 | /// 21 | /// Return a NetIdentity that represents LocalHost 22 | /// 23 | public static NetIdentity LocalHost 24 | { 25 | get 26 | { 27 | NetIdentity id = default; 28 | InternalSetLocalHost( ref id ); 29 | return id; 30 | } 31 | } 32 | 33 | 34 | public bool IsSteamId => type == IdentityType.SteamID; 35 | public bool IsIpAddress => type == IdentityType.IPAddress; 36 | 37 | /// 38 | /// Return true if this identity is localhost 39 | /// 40 | public bool IsLocalHost 41 | { 42 | get 43 | { 44 | NetIdentity id = default; 45 | return InternalIsLocalHost( ref id ); 46 | } 47 | } 48 | 49 | /// 50 | /// Convert to a SteamId 51 | /// 52 | /// 53 | public static implicit operator NetIdentity( SteamId value ) 54 | { 55 | NetIdentity id = default; 56 | InternalSetSteamID( ref id, value ); 57 | return id; 58 | } 59 | 60 | /// 61 | /// Set the specified Address 62 | /// 63 | public static implicit operator NetIdentity( NetAddress address ) 64 | { 65 | NetIdentity id = default; 66 | InternalSetIPAddr( ref id, ref address ); 67 | return id; 68 | } 69 | 70 | /// 71 | /// Automatically convert to a SteamId 72 | /// 73 | /// 74 | public static implicit operator SteamId( NetIdentity value ) 75 | { 76 | return value.SteamId; 77 | } 78 | 79 | /// 80 | /// Returns NULL if we're not a SteamId 81 | /// 82 | public SteamId SteamId 83 | { 84 | get 85 | { 86 | if ( type != IdentityType.SteamID ) return default; 87 | var id = this; 88 | return InternalGetSteamID( ref id ); 89 | } 90 | } 91 | 92 | /// 93 | /// Returns NULL if we're not a NetAddress 94 | /// 95 | public NetAddress Address 96 | { 97 | get 98 | { 99 | if ( type != IdentityType.IPAddress ) return default; 100 | var id = this; 101 | 102 | var addrptr = InternalGetIPAddr( ref id ); 103 | return addrptr.ToType(); 104 | } 105 | } 106 | 107 | /// 108 | /// We override tostring to provide a sensible representation 109 | /// 110 | public override string ToString() 111 | { 112 | var id = this; 113 | SteamNetworkingUtils.Internal.SteamNetworkingIdentity_ToString( ref id, out var str ); 114 | return str; 115 | } 116 | 117 | internal enum IdentityType 118 | { 119 | Invalid = 0, 120 | IPAddress = 1, 121 | GenericString = 2, 122 | GenericBytes = 3, 123 | SteamID = 16 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/NetKeyValue.cs: -------------------------------------------------------------------------------- 1 | using Steamworks.Data; 2 | using System; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace Steamworks.Data 6 | { 7 | [StructLayout( LayoutKind.Explicit, Pack = Platform.StructPlatformPackSize )] 8 | internal partial struct NetKeyValue 9 | { 10 | [FieldOffset(0)] 11 | internal NetConfig Value; // m_eValue ESteamNetworkingConfigValue 12 | 13 | [FieldOffset( 4 )] 14 | internal NetConfigType DataType; // m_eDataType ESteamNetworkingConfigDataType 15 | 16 | [FieldOffset( 8 )] 17 | internal long Int64Value; // m_int64 int64_t 18 | 19 | [FieldOffset( 8 )] 20 | internal int Int32Value; // m_val_int32 int32_t 21 | 22 | [FieldOffset( 8 )] 23 | internal float FloatValue; // m_val_float float 24 | 25 | [FieldOffset( 8 )] 26 | internal IntPtr PointerValue; // m_val_functionPtr void * 27 | 28 | 29 | // TODO - support strings, maybe 30 | } 31 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/NetMsg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Steamworks.Data 5 | { 6 | [StructLayout( LayoutKind.Sequential )] 7 | internal partial struct NetMsg 8 | { 9 | internal IntPtr DataPtr; 10 | internal int DataSize; 11 | internal Connection Connection; 12 | internal NetIdentity Identity; 13 | internal long ConnectionUserData; 14 | internal long RecvTime; 15 | internal long MessageNumber; 16 | internal IntPtr FreeDataPtr; 17 | internal IntPtr ReleasePtr; 18 | internal int Channel; 19 | internal SendType Flags; 20 | internal long UserData; 21 | internal ushort IdxLane; 22 | internal ushort _pad1__; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/NetPingLocation.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Steamworks.Data 4 | { 5 | /// 6 | /// 7 | /// Object that describes a "location" on the Internet with sufficient 8 | /// detail that we can reasonably estimate an upper bound on the ping between 9 | /// the two hosts, even if a direct route between the hosts is not possible, 10 | /// and the connection must be routed through the Steam Datagram Relay network. 11 | /// This does not contain any information that identifies the host. Indeed, 12 | /// if two hosts are in the same building or otherwise have nearly identical 13 | /// networking characteristics, then it's valid to use the same location 14 | /// object for both of them. 15 | /// 16 | /// NOTE: This object should only be used in the same process! Do not serialize it, 17 | /// send it over the wire, or persist it in a file or database! If you need 18 | /// to do that, convert it to a string representation using the methods in 19 | /// ISteamNetworkingUtils(). 20 | /// 21 | /// 22 | [StructLayout( LayoutKind.Explicit, Size = 512 )] 23 | public struct NetPingLocation 24 | { 25 | public static NetPingLocation? TryParseFromString( string str ) 26 | { 27 | var result = default( NetPingLocation ); 28 | if ( !SteamNetworkingUtils.Internal.ParsePingLocationString( str, ref result ) ) 29 | return null; 30 | 31 | return result; 32 | } 33 | 34 | public override string ToString() 35 | { 36 | SteamNetworkingUtils.Internal.ConvertPingLocationToString( ref this, out var strVal ); 37 | return strVal; 38 | } 39 | 40 | /// Estimate the round-trip latency between two arbitrary locations, in 41 | /// milliseconds. This is a conservative estimate, based on routing through 42 | /// the relay network. For most basic relayed connections, this ping time 43 | /// will be pretty accurate, since it will be based on the route likely to 44 | /// be actually used. 45 | /// 46 | /// If a direct IP route is used (perhaps via NAT traversal), then the route 47 | /// will be different, and the ping time might be better. Or it might actually 48 | /// be a bit worse! Standard IP routing is frequently suboptimal! 49 | /// 50 | /// But even in this case, the estimate obtained using this method is a 51 | /// reasonable upper bound on the ping time. (Also it has the advantage 52 | /// of returning immediately and not sending any packets.) 53 | /// 54 | /// In a few cases we might not able to estimate the route. In this case 55 | /// a negative value is returned. k_nSteamNetworkingPing_Failed means 56 | /// the reason was because of some networking difficulty. (Failure to 57 | /// ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot 58 | /// currently answer the question for some other reason. 59 | /// 60 | /// Do you need to be able to do this from a backend/matchmaking server? 61 | /// You are looking for the "ticketgen" library. 62 | public int EstimatePingTo( NetPingLocation target ) 63 | { 64 | return SteamNetworkingUtils.Internal.EstimatePingTimeBetweenTwoLocations( ref this, ref target ); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/Socket.cs: -------------------------------------------------------------------------------- 1 |  2 | using System.Runtime.InteropServices; 3 | 4 | namespace Steamworks.Data 5 | { 6 | [StructLayout( LayoutKind.Sequential )] 7 | public struct Socket 8 | { 9 | internal uint Id; 10 | public override string ToString() => Id.ToString(); 11 | public static implicit operator Socket( uint value ) => new Socket() { Id = value }; 12 | public static implicit operator uint( Socket value ) => value.Id; 13 | 14 | /// 15 | /// Destroy a listen socket. All the connections that were accepting on the listen 16 | /// socket are closed ungracefully. 17 | /// 18 | public bool Close() 19 | { 20 | return SteamNetworkingSockets.Internal.CloseListenSocket( Id ); 21 | } 22 | 23 | public SocketManager Manager 24 | { 25 | get => SteamNetworkingSockets.GetSocketManager( Id ); 26 | set => SteamNetworkingSockets.SetSocketManager( Id, value ); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Networking/SteamDatagramRelayAuthTicket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Steamworks.Data 7 | { 8 | struct SteamDatagramRelayAuthTicket 9 | { 10 | // Not implemented, not used 11 | }; 12 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/Favourites.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.ServerList 4 | { 5 | public class Favourites : Base 6 | { 7 | internal override void LaunchQuery() 8 | { 9 | using var filters = new ServerFilterMarshaler( GetFilters() ); 10 | request = Internal.RequestFavoritesServerList( AppId.Value, filters.Pointer, (uint)filters.Count, IntPtr.Zero ); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/Friends.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.ServerList 4 | { 5 | public class Friends : Base 6 | { 7 | internal override void LaunchQuery() 8 | { 9 | using var filters = new ServerFilterMarshaler( GetFilters() ); 10 | request = Internal.RequestFriendsServerList( AppId.Value, filters.Pointer, (uint)filters.Count, IntPtr.Zero ); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/History.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.ServerList 4 | { 5 | public class History : Base 6 | { 7 | internal override void LaunchQuery() 8 | { 9 | using var filters = new ServerFilterMarshaler( GetFilters() ); 10 | request = Internal.RequestHistoryServerList( AppId.Value, filters.Pointer, (uint)filters.Count, IntPtr.Zero ); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/Internet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.ServerList 4 | { 5 | public class Internet : Base 6 | { 7 | internal override void LaunchQuery() 8 | { 9 | using var filters = new ServerFilterMarshaler( GetFilters() ); 10 | request = Internal.RequestInternetServerList( AppId.Value, filters.Pointer, (uint)filters.Count, IntPtr.Zero ); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/IpList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace Steamworks.ServerList 6 | { 7 | public class IpList : Internet 8 | { 9 | public List Ips = new List(); 10 | bool wantsCancel; 11 | 12 | public IpList( IEnumerable list ) 13 | { 14 | Ips.AddRange( list ); 15 | } 16 | 17 | public IpList( params string[] list ) 18 | { 19 | Ips.AddRange( list ); 20 | } 21 | 22 | public override async Task RunQueryAsync( float timeoutSeconds = 10 ) 23 | { 24 | int blockSize = 16; 25 | int pointer = 0; 26 | 27 | var ips = Ips.ToArray(); 28 | 29 | wantsCancel = false; 30 | 31 | while ( !wantsCancel ) 32 | { 33 | var sublist = ips.Skip( pointer ).Take( blockSize ).ToList(); 34 | if ( sublist.Count == 0 ) 35 | break; 36 | 37 | using ( var list = new ServerList.Internet() ) 38 | { 39 | list.AddFilter( "or", sublist.Count.ToString() ); 40 | 41 | foreach ( var server in sublist ) 42 | { 43 | list.AddFilter( "gameaddr", server ); 44 | } 45 | 46 | await list.RunQueryAsync( timeoutSeconds ); 47 | 48 | Responsive.AddRange( list.Responsive ); 49 | Responsive = Responsive.Distinct().ToList(); 50 | Unresponsive.AddRange( list.Unresponsive ); 51 | Unresponsive = Unresponsive.Distinct().ToList(); 52 | } 53 | 54 | pointer += sublist.Count(); 55 | 56 | InvokeChanges(); 57 | } 58 | 59 | return true; 60 | } 61 | 62 | // note: Cancel doesn't get called in Dispose because request is always null for this class 63 | public override void Cancel() 64 | { 65 | wantsCancel = true; 66 | } 67 | 68 | public override void Dispose() 69 | { 70 | base.Dispose(); 71 | 72 | wantsCancel = true; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/LocalNetwork.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.ServerList 4 | { 5 | public class LocalNetwork : Base 6 | { 7 | internal override void LaunchQuery() 8 | { 9 | request = Internal.RequestLANServerList( AppId.Value, IntPtr.Zero ); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/ServerList/ServerFilterMarshaler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Steamworks.Data; 4 | 5 | namespace Steamworks.ServerList; 6 | 7 | internal struct ServerFilterMarshaler : IDisposable 8 | { 9 | private static readonly int SizeOfPointer = Marshal.SizeOf(); 10 | private static readonly int SizeOfKeyValuePair = Marshal.SizeOf(); 11 | 12 | private IntPtr _arrayPtr; 13 | private IntPtr _itemsPtr; 14 | 15 | public int Count { get; private set; } 16 | public IntPtr Pointer => _arrayPtr; 17 | 18 | public ServerFilterMarshaler( MatchMakingKeyValuePair[] filters ) 19 | { 20 | if ( filters == null || filters.Length == 0 ) 21 | { 22 | Count = 0; 23 | _arrayPtr = IntPtr.Zero; 24 | _itemsPtr = IntPtr.Zero; 25 | return; 26 | } 27 | 28 | Count = filters.Length; 29 | _arrayPtr = Marshal.AllocHGlobal( SizeOfPointer * filters.Length ); 30 | _itemsPtr = Marshal.AllocHGlobal( SizeOfKeyValuePair * filters.Length ); 31 | 32 | var arrayDst = _arrayPtr; 33 | var itemDst = _itemsPtr; 34 | foreach ( var filter in filters ) 35 | { 36 | Marshal.WriteIntPtr( arrayDst, itemDst ); 37 | arrayDst += SizeOfPointer; 38 | 39 | Marshal.StructureToPtr( filter, itemDst, false ); 40 | itemDst += SizeOfKeyValuePair; 41 | } 42 | } 43 | 44 | public void Dispose() 45 | { 46 | if ( _arrayPtr != IntPtr.Zero ) 47 | { 48 | Marshal.FreeHGlobal( _arrayPtr ); 49 | _arrayPtr = IntPtr.Zero; 50 | } 51 | 52 | if ( _itemsPtr != IntPtr.Zero ) 53 | { 54 | Marshal.FreeHGlobal( _itemsPtr ); 55 | _itemsPtr = IntPtr.Zero; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/SteamMatchmakingServers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Steamworks.Data; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// Methods for clients to access matchmaking services, favorites, and to operate on game lobbies 12 | /// 13 | internal class SteamMatchmakingServers : SteamClientClass 14 | { 15 | internal static ISteamMatchmakingServers Internal => Interface as ISteamMatchmakingServers; 16 | 17 | internal override bool InitializeInterface( bool server ) 18 | { 19 | SetInterface( server, new ISteamMatchmakingServers( server ) ); 20 | if ( Interface.Self == IntPtr.Zero ) return false; 21 | 22 | return true; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/SteamMusic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Steamworks.Data; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// Functions to control music playback in the steam client. 12 | /// This gives games the opportunity to do things like pause the music or lower the volume, 13 | /// when an important cut scene is shown, and start playing afterwards. 14 | /// Nothing uses Steam Music though so this can probably get fucked 15 | /// 16 | public class SteamMusic : SteamClientClass 17 | { 18 | internal static ISteamMusic Internal => Interface as ISteamMusic; 19 | 20 | internal override bool InitializeInterface( bool server ) 21 | { 22 | SetInterface( server, new ISteamMusic( server ) ); 23 | if ( Interface.Self == IntPtr.Zero ) return false; 24 | 25 | InstallEvents(); 26 | return true; 27 | } 28 | 29 | internal static void InstallEvents() 30 | { 31 | Dispatch.Install( x => OnPlaybackChanged?.Invoke() ); 32 | Dispatch.Install( x => OnVolumeChanged?.Invoke( x.NewVolume ) ); 33 | } 34 | 35 | /// 36 | /// Invoked when playback status is changed. 37 | /// 38 | public static event Action OnPlaybackChanged; 39 | 40 | /// 41 | /// Invoked when the volume of the music player is changed. 42 | /// 43 | public static event Action OnVolumeChanged; 44 | 45 | /// 46 | /// Checks if Steam Music is enabled. 47 | /// 48 | public static bool IsEnabled => Internal.BIsEnabled(); 49 | 50 | /// 51 | /// if a song is currently playing, paused, or queued up to play; otherwise . 52 | /// 53 | public static bool IsPlaying => Internal.BIsPlaying(); 54 | 55 | /// 56 | /// Gets the current status of the Steam Music player 57 | /// 58 | public static MusicStatus Status => Internal.GetPlaybackStatus(); 59 | 60 | /// 61 | /// Plays the music player. 62 | /// 63 | public static void Play() => Internal.Play(); 64 | 65 | /// 66 | /// Pauses the music player. 67 | /// 68 | public static void Pause() => Internal.Pause(); 69 | 70 | /// 71 | /// Forces the music player to play the previous song. 72 | /// 73 | public static void PlayPrevious() => Internal.PlayPrevious(); 74 | 75 | /// 76 | /// Forces the music player to skip to the next song. 77 | /// 78 | public static void PlayNext() => Internal.PlayNext(); 79 | 80 | /// 81 | /// Gets and sets the current volume of the Steam Music player 82 | /// 83 | public static float Volume 84 | { 85 | get => Internal.GetVolume(); 86 | set => Internal.SetVolume( value ); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/SteamParental.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Steamworks.Data; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// Undocumented Parental Settings 12 | /// 13 | public class SteamParental : SteamSharedClass 14 | { 15 | internal static ISteamParentalSettings Internal => Interface as ISteamParentalSettings; 16 | 17 | internal override bool InitializeInterface( bool server ) 18 | { 19 | SetInterface( server, new ISteamParentalSettings( server ) ); 20 | if ( Interface.Self == IntPtr.Zero ) return false; 21 | 22 | InstallEvents( server ); 23 | 24 | return true; 25 | } 26 | 27 | internal static void InstallEvents( bool server ) 28 | { 29 | Dispatch.Install( x => OnSettingsChanged?.Invoke(), server ); 30 | } 31 | 32 | /// 33 | /// Parental Settings Changed 34 | /// 35 | public static event Action OnSettingsChanged; 36 | 37 | 38 | /// 39 | /// 40 | /// 41 | public static bool IsParentalLockEnabled => Internal.BIsParentalLockEnabled(); 42 | 43 | /// 44 | /// 45 | /// 46 | public static bool IsParentalLockLocked => Internal.BIsParentalLockLocked(); 47 | 48 | /// 49 | /// 50 | /// 51 | public static bool IsAppBlocked( AppId app ) => Internal.BIsAppBlocked( app.Value ); 52 | 53 | /// 54 | /// 55 | /// 56 | public static bool BIsAppInBlockList( AppId app ) => Internal.BIsAppInBlockList( app.Value ); 57 | 58 | /// 59 | /// 60 | /// 61 | public static bool IsFeatureBlocked( ParentalFeature feature ) => Internal.BIsFeatureBlocked( feature ); 62 | 63 | /// 64 | /// 65 | /// 66 | public static bool BIsFeatureInBlockList( ParentalFeature feature ) => Internal.BIsFeatureInBlockList( feature ); 67 | } 68 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/SteamParties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Steamworks.Data; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// This API can be used to selectively advertise your multiplayer game session in a Steam chat room group. 12 | /// Tell Steam the number of player spots that are available for your party, and a join-game string, and it 13 | /// will show a beacon in the selected group and allow that many users to “follow” the beacon to your party. 14 | /// Adjust the number of open slots if other players join through alternate matchmaking methods. 15 | /// 16 | public class SteamParties : SteamClientClass 17 | { 18 | internal static ISteamParties Internal => Interface as ISteamParties; 19 | 20 | internal override bool InitializeInterface( bool server ) 21 | { 22 | SetInterface( server, new ISteamParties( server ) ); 23 | if ( Interface.Self == IntPtr.Zero ) return false; 24 | 25 | InstallEvents( server ); 26 | 27 | return true; 28 | } 29 | 30 | internal void InstallEvents( bool server ) 31 | { 32 | Dispatch.Install( x => OnBeaconLocationsUpdated?.Invoke(), server ); 33 | Dispatch.Install( x => OnActiveBeaconsUpdated?.Invoke(), server ); 34 | } 35 | 36 | /// 37 | /// Invoked when the list of possible Party beacon locations has changed 38 | /// 39 | public static event Action OnBeaconLocationsUpdated; 40 | 41 | /// 42 | /// Invoked when the list of active beacons may have changed 43 | /// 44 | public static event Action OnActiveBeaconsUpdated; 45 | 46 | /// 47 | /// Gets the amount of beacons that are active. 48 | /// 49 | public static int ActiveBeaconCount => (int) Internal.GetNumActiveBeacons(); 50 | 51 | /// 52 | /// Gets an of active beacons. 53 | /// 54 | public static IEnumerable ActiveBeacons 55 | { 56 | get 57 | { 58 | for ( uint i = 0; i < ActiveBeaconCount; i++ ) 59 | { 60 | yield return new PartyBeacon 61 | { 62 | Id = Internal.GetBeaconByIndex( i ) 63 | }; 64 | } 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/SteamRemotePlay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Steamworks.Data; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// Functions that provide information about Steam Remote Play sessions, streaming your game content to another computer or to a Steam Link app or hardware. 12 | /// 13 | public class SteamRemotePlay : SteamClientClass 14 | { 15 | internal static ISteamRemotePlay Internal => Interface as ISteamRemotePlay; 16 | 17 | internal override bool InitializeInterface( bool server ) 18 | { 19 | SetInterface( server, new ISteamRemotePlay( server ) ); 20 | if ( Interface.Self == IntPtr.Zero ) return false; 21 | 22 | InstallEvents( server ); 23 | 24 | return true; 25 | } 26 | 27 | internal void InstallEvents( bool server ) 28 | { 29 | Dispatch.Install( x => OnSessionConnected?.Invoke( x.SessionID ), server ); 30 | Dispatch.Install( x => OnSessionDisconnected?.Invoke( x.SessionID ), server ); 31 | } 32 | 33 | /// 34 | /// Invoked when a session is connected. 35 | /// 36 | public static event Action OnSessionConnected; 37 | 38 | /// 39 | /// Invoked when a session becomes disconnected. 40 | /// 41 | public static event Action OnSessionDisconnected; 42 | 43 | /// 44 | /// Gets the number of currently connected Steam Remote Play sessions 45 | /// 46 | public static int SessionCount => (int) Internal.GetSessionCount(); 47 | 48 | /// 49 | /// Get the currently connected Steam Remote Play session ID at the specified index. 50 | /// IsValid will return if it's out of bounds 51 | /// 52 | public static RemotePlaySession GetSession( int index ) => (RemotePlaySession) Internal.GetSessionID( index ).Value; 53 | 54 | 55 | /// 56 | /// Invite a friend to Remote Play Together. 57 | /// This returns if the invite can't be sent 58 | /// 59 | public static bool SendInvite( SteamId steamid ) => Internal.BSendRemotePlayTogetherInvite( steamid ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/SteamVideo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Steamworks.Data; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// Class for utilizing the Steam Video API. 12 | /// 13 | public class SteamVideo : SteamClientClass 14 | { 15 | internal static ISteamVideo Internal => Interface as ISteamVideo; 16 | 17 | internal override bool InitializeInterface( bool server ) 18 | { 19 | SetInterface( server, new ISteamVideo( server ) ); 20 | if ( Interface.Self == IntPtr.Zero ) return false; 21 | 22 | InstallEvents(); 23 | 24 | return true; 25 | } 26 | 27 | internal static void InstallEvents() 28 | { 29 | } 30 | 31 | /// 32 | /// Return if currently using Steam's live broadcasting 33 | /// 34 | public static bool IsBroadcasting 35 | { 36 | get 37 | { 38 | int viewers = 0; 39 | return Internal.IsBroadcasting( ref viewers ); 40 | } 41 | } 42 | 43 | /// 44 | /// Returns the number of viewers that are watching the stream, or 0 if is . 45 | /// 46 | public static int NumViewers 47 | { 48 | get 49 | { 50 | int viewers = 0; 51 | 52 | if ( !Internal.IsBroadcasting( ref viewers ) ) 53 | return 0; 54 | 55 | return viewers; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/AppId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks 8 | { 9 | /// 10 | /// Represents the ID of a Steam application. 11 | /// 12 | public struct AppId 13 | { 14 | public uint Value; 15 | 16 | public override string ToString() => Value.ToString(); 17 | 18 | public static implicit operator AppId( uint value ) 19 | { 20 | return new AppId{ Value = value }; 21 | } 22 | 23 | public static implicit operator AppId( int value ) 24 | { 25 | return new AppId { Value = (uint) value }; 26 | } 27 | 28 | public static implicit operator uint( AppId value ) 29 | { 30 | return value.Value; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/Clan.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace Steamworks 7 | { 8 | public struct Clan 9 | { 10 | public SteamId Id; 11 | 12 | public Clan(SteamId id) 13 | { 14 | Id = id; 15 | } 16 | 17 | public string Name => SteamFriends.Internal.GetClanName(Id); 18 | 19 | public string Tag => SteamFriends.Internal.GetClanTag(Id); 20 | 21 | public int ChatMemberCount => SteamFriends.Internal.GetClanChatMemberCount(Id); 22 | 23 | public Friend Owner => new Friend(SteamFriends.Internal.GetClanOwner(Id)); 24 | 25 | public bool Public => SteamFriends.Internal.IsClanPublic(Id); 26 | 27 | /// 28 | /// Is the clan an official game group? 29 | /// 30 | public bool Official => SteamFriends.Internal.IsClanOfficialGameGroup(Id); 31 | 32 | /// 33 | /// Asynchronously fetches the officer list for a given clan 34 | /// 35 | /// Whether the request was successful or not 36 | public async Task RequestOfficerList() 37 | { 38 | var req = await SteamFriends.Internal.RequestClanOfficerList(Id); 39 | return req.HasValue && req.Value.Success != 0x0; 40 | } 41 | 42 | public IEnumerable GetOfficers() 43 | { 44 | for (int i = 0; i < SteamFriends.Internal.GetClanOfficerCount(Id); i++) 45 | { 46 | yield return new Friend(SteamFriends.Internal.GetClanOfficerByIndex(Id, i)); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/Controller.cs: -------------------------------------------------------------------------------- 1 | using Steamworks.Data; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace Steamworks 6 | { 7 | public struct Controller 8 | { 9 | internal InputHandle_t Handle; 10 | 11 | internal Controller( InputHandle_t inputHandle_t ) 12 | { 13 | this.Handle = inputHandle_t; 14 | } 15 | 16 | public ulong Id => Handle.Value; 17 | public InputType InputType => SteamInput.Internal.GetInputTypeForHandle( Handle ); 18 | 19 | /// 20 | /// Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive') 21 | /// This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in 22 | /// our state loops, instead of trying to place it in all of your state transitions. 23 | /// 24 | public string ActionSet 25 | { 26 | set => SteamInput.Internal.ActivateActionSet( Handle, SteamInput.Internal.GetActionSetHandle( value ) ); 27 | } 28 | 29 | public void DeactivateLayer( string layer ) => SteamInput.Internal.DeactivateActionSetLayer( Handle, SteamInput.Internal.GetActionSetHandle( layer ) ); 30 | public void ActivateLayer( string layer ) => SteamInput.Internal.ActivateActionSetLayer( Handle, SteamInput.Internal.GetActionSetHandle( layer ) ); 31 | public void ClearLayers() => SteamInput.Internal.DeactivateAllActionSetLayers( Handle ); 32 | 33 | 34 | /// 35 | /// Returns the current state of the supplied digital game action 36 | /// 37 | public DigitalState GetDigitalState( string actionName ) 38 | { 39 | return SteamInput.Internal.GetDigitalActionData( Handle, SteamInput.GetDigitalActionHandle( actionName ) ); 40 | } 41 | 42 | /// 43 | /// Returns the current state of these supplied analog game action 44 | /// 45 | public AnalogState GetAnalogState( string actionName ) 46 | { 47 | return SteamInput.Internal.GetAnalogActionData( Handle, SteamInput.GetAnalogActionHandle( actionName ) ); 48 | } 49 | 50 | 51 | public override string ToString() => $"{InputType}.{Handle.Value}"; 52 | 53 | 54 | public static bool operator ==( Controller a, Controller b ) => a.Equals( b ); 55 | public static bool operator !=( Controller a, Controller b ) => !(a == b); 56 | public override bool Equals( object p ) => this.Equals( (Controller)p ); 57 | public override int GetHashCode() => Handle.GetHashCode(); 58 | public bool Equals( Controller p ) => p.Handle == Handle; 59 | } 60 | 61 | [StructLayout( LayoutKind.Sequential, Pack = 1 )] 62 | public struct AnalogState 63 | { 64 | public InputSourceMode EMode; // eMode EInputSourceMode 65 | public float X; // x float 66 | public float Y; // y float 67 | internal byte BActive; // bActive byte 68 | public bool Active => BActive != 0; 69 | } 70 | 71 | [StructLayout( LayoutKind.Sequential, Pack = 1 )] 72 | internal struct MotionState 73 | { 74 | public float RotQuatX; // rotQuatX float 75 | public float RotQuatY; // rotQuatY float 76 | public float RotQuatZ; // rotQuatZ float 77 | public float RotQuatW; // rotQuatW float 78 | public float PosAccelX; // posAccelX float 79 | public float PosAccelY; // posAccelY float 80 | public float PosAccelZ; // posAccelZ float 81 | public float RotVelX; // rotVelX float 82 | public float RotVelY; // rotVelY float 83 | public float RotVelZ; // rotVelZ float 84 | } 85 | 86 | [StructLayout( LayoutKind.Sequential, Pack = 1 )] 87 | public struct DigitalState 88 | { 89 | [MarshalAs( UnmanagedType.I1 )] 90 | internal byte BState; // bState byte 91 | [MarshalAs( UnmanagedType.I1 )] 92 | internal byte BActive; // bActive byte 93 | 94 | public bool Pressed => BState != 0; 95 | public bool Active => BActive != 0; 96 | } 97 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/DepotId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | public struct DepotId 10 | { 11 | public uint Value; 12 | 13 | public static implicit operator DepotId( uint value ) 14 | { 15 | return new DepotId { Value = value }; 16 | } 17 | 18 | public static implicit operator DepotId( int value ) 19 | { 20 | return new DepotId { Value = (uint) value }; 21 | } 22 | 23 | public static implicit operator uint( DepotId value ) 24 | { 25 | return value.Value; 26 | } 27 | 28 | public override string ToString() => Value.ToString(); 29 | } 30 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/DlcInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | /// 10 | /// Provides information about a DLC. 11 | /// 12 | public struct DlcInformation 13 | { 14 | /// 15 | /// The of the DLC. 16 | /// 17 | public AppId AppId { get; internal set; } 18 | 19 | /// 20 | /// The name of the DLC. 21 | /// 22 | public string Name { get; internal set; } 23 | 24 | /// 25 | /// Whether or not the DLC is available. 26 | /// 27 | public bool Available { get; internal set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/DownloadProgress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | /// 10 | /// Represents download progress. 11 | /// 12 | public struct DownloadProgress 13 | { 14 | /// 15 | /// Whether or not the download is currently active. 16 | /// 17 | public bool Active; 18 | 19 | /// 20 | /// How many bytes have been downloaded. 21 | /// 22 | public ulong BytesDownloaded; 23 | 24 | /// 25 | /// How many bytes in total the download is. 26 | /// 27 | public ulong BytesTotal; 28 | 29 | /// 30 | /// Gets the amount of bytes left that need to be downloaded. 31 | /// 32 | public ulong BytesRemaining => BytesTotal - BytesDownloaded; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/DurationControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | /// 10 | /// Sent for games with enabled anti indulgence / duration control, for enabled users. 11 | /// Lets the game know whether persistent rewards or XP should be granted at normal rate, half rate, or zero rate. 12 | /// 13 | public struct DurationControl 14 | { 15 | internal DurationControl_t _inner; 16 | 17 | /// 18 | /// appid generating playtime 19 | /// 20 | public AppId Appid => _inner.Appid; 21 | 22 | /// 23 | /// is duration control applicable to user + game combination 24 | /// 25 | public bool Applicable => _inner.Applicable; 26 | 27 | /// 28 | /// playtime since most recent 5 hour gap in playtime, only counting up to regulatory limit of playtime, in seconds 29 | /// 30 | internal TimeSpan PlaytimeInLastFiveHours => TimeSpan.FromSeconds( _inner.CsecsLast5h ); 31 | 32 | /// 33 | /// playtime on current calendar day 34 | /// 35 | internal TimeSpan PlaytimeToday => TimeSpan.FromSeconds( _inner.CsecsLast5h ); 36 | 37 | /// 38 | /// recommended progress 39 | /// 40 | internal DurationControlProgress Progress => _inner.Progress; 41 | } 42 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/FileDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | /// 10 | /// Represents details of a file. 11 | /// 12 | public struct FileDetails 13 | { 14 | /// 15 | /// The size of the file in bytes. 16 | /// 17 | public ulong SizeInBytes; 18 | public string Sha1; 19 | public uint Flags; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/GameId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks.Data 4 | { 5 | public enum GameIdType : byte 6 | { 7 | App = 0, 8 | GameMod = 1, 9 | Shortcut = 2, 10 | P2P = 3, 11 | } 12 | 13 | public struct GameId : IEquatable 14 | { 15 | /* 16 | # ifdef VALVE_BIG_ENDIAN 17 | unsigned int m_nModID : 32; 18 | unsigned int m_nType : 8; 19 | unsigned int m_nAppID : 24; 20 | #else 21 | unsigned int m_nAppID : 24; 22 | unsigned int m_nType : 8; 23 | unsigned int m_nModID : 32; 24 | #endif 25 | */ 26 | 27 | // 0xAAAAAAAA_BBCCCCCC 28 | // A = m_nModID 29 | // B = m_nType 30 | // C = m_nAppID 31 | public ulong Value; 32 | 33 | public GameIdType Type 34 | { 35 | get => (GameIdType)(byte)( Value >> 24 ); 36 | set => Value = ( Value & 0xFFFFFFFF_00FFFFFF ) | ( (ulong)(byte)value << 24 ); 37 | } 38 | 39 | public uint AppId 40 | { 41 | get => (uint)( Value & 0x00000000_00FFFFFF ); 42 | set => Value = ( Value & 0xFFFFFFFF_FF000000 ) | (value & 0x00000000_00FFFFFF); 43 | } 44 | 45 | public uint ModId 46 | { 47 | get => (uint)( Value >> 32 ); 48 | set => Value = ( Value & 0x00000000_FFFFFFFF ) | ( (ulong)value << 32 ); 49 | } 50 | 51 | public static implicit operator GameId( ulong value ) 52 | { 53 | return new GameId { Value = value }; 54 | } 55 | 56 | public static implicit operator ulong( GameId value ) 57 | { 58 | return value.Value; 59 | } 60 | 61 | public bool Equals(GameId other) 62 | { 63 | return Value == other.Value; 64 | } 65 | 66 | public override bool Equals(object obj) 67 | { 68 | return obj is GameId other && Equals(other); 69 | } 70 | 71 | public override int GetHashCode() 72 | { 73 | return Value.GetHashCode(); 74 | } 75 | 76 | public static bool operator ==(GameId left, GameId right) 77 | { 78 | return left.Equals(right); 79 | } 80 | 81 | public static bool operator !=(GameId left, GameId right) 82 | { 83 | return !left.Equals(right); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/GamePhaseRecordingInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Steamworks; 2 | 3 | public struct GamePhaseRecordingInfo 4 | { 5 | public string PhaseId; 6 | public ulong RecordingMs; 7 | public ulong LongestClipMs; 8 | public uint ClipCount; 9 | public uint ScreenshotCount; 10 | } 11 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/Image.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Steamworks.Data 3 | { 4 | public struct Image 5 | { 6 | public uint Width; 7 | public uint Height; 8 | public byte[] Data; 9 | 10 | /// 11 | /// Returns the color of the pixel at the specified position. 12 | /// 13 | /// X-coordinate 14 | /// Y-coordinate 15 | /// The color. 16 | /// If the X and Y or out of bounds. 17 | public Color GetPixel( int x, int y ) 18 | { 19 | if ( x < 0 || x >= Width ) throw new System.ArgumentException( "x out of bounds" ); 20 | if ( y < 0 || y >= Height ) throw new System.ArgumentException( "y out of bounds" ); 21 | 22 | Color c = new Color(); 23 | 24 | var i = (y * Width + x) * 4; 25 | 26 | c.r = Data[i + 0]; 27 | c.g = Data[i + 1]; 28 | c.b = Data[i + 2]; 29 | c.a = Data[i + 3]; 30 | 31 | return c; 32 | } 33 | 34 | /// 35 | /// Returns "{Width}x{Height} ({length of }bytes)" 36 | /// 37 | /// 38 | public override string ToString() 39 | { 40 | return $"{Width}x{Height} ({Data.Length}bytes)"; 41 | } 42 | } 43 | 44 | /// 45 | /// Represents a color. 46 | /// 47 | public struct Color 48 | { 49 | public byte r, g, b, a; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/InventoryPurchaseResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Steamworks.Data 9 | { 10 | public struct InventoryPurchaseResult 11 | { 12 | public Result Result; 13 | public ulong OrderID; 14 | public ulong TransID; 15 | } 16 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/InventoryRecipe.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Steamworks.Data; 6 | 7 | namespace Steamworks 8 | { 9 | /// 10 | /// A structured description of an item exchange 11 | /// 12 | public struct InventoryRecipe : IEquatable 13 | { 14 | public struct Ingredient 15 | { 16 | /// 17 | /// The definition ID of the ingredient. 18 | /// 19 | public int DefinitionId; 20 | 21 | /// 22 | /// If we don't know about this item definition this might be null. 23 | /// In which case, DefinitionId should still hold the correct id. 24 | /// 25 | public InventoryDef Definition; 26 | 27 | /// 28 | /// The amount of this item needed. Generally this will be 1. 29 | /// 30 | public int Count; 31 | 32 | internal static Ingredient FromString( string part ) 33 | { 34 | var i = new Ingredient(); 35 | i.Count = 1; 36 | 37 | try 38 | { 39 | if ( part.Contains( "x" ) ) 40 | { 41 | var idx = part.IndexOf( 'x' ); 42 | 43 | int count = 0; 44 | if ( int.TryParse( part.Substring( idx + 1 ), out count ) ) 45 | i.Count = count; 46 | 47 | part = part.Substring( 0, idx ); 48 | } 49 | 50 | i.DefinitionId = int.Parse( part ); 51 | i.Definition = SteamInventory.FindDefinition( i.DefinitionId ); 52 | 53 | } 54 | catch ( System.Exception ) 55 | { 56 | return i; 57 | } 58 | 59 | return i; 60 | } 61 | } 62 | 63 | /// 64 | /// The item that this will create. 65 | /// 66 | public InventoryDef Result; 67 | 68 | /// 69 | /// The items, with quantity required to create this item. 70 | /// 71 | public Ingredient[] Ingredients; 72 | 73 | public string Source; 74 | 75 | internal static InventoryRecipe FromString( string part, InventoryDef Result ) 76 | { 77 | var r = new InventoryRecipe 78 | { 79 | Result = Result, 80 | Source = part 81 | }; 82 | 83 | var parts = part.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries ); 84 | 85 | r.Ingredients = parts.Select( x => Ingredient.FromString( x ) ).Where( x => x.DefinitionId != 0 ).ToArray(); 86 | return r; 87 | } 88 | 89 | internal bool ContainsIngredient( InventoryDef inventoryDef ) 90 | { 91 | return Ingredients.Any( x => x.DefinitionId == inventoryDef.Id ); 92 | } 93 | 94 | public static bool operator ==( InventoryRecipe a, InventoryRecipe b ) => a.GetHashCode() == b.GetHashCode(); 95 | public static bool operator !=( InventoryRecipe a, InventoryRecipe b ) => a.GetHashCode() != b.GetHashCode(); 96 | public override bool Equals( object p ) => this.Equals( (InventoryRecipe)p ); 97 | public override int GetHashCode() 98 | { 99 | return Source.GetHashCode(); 100 | } 101 | 102 | public bool Equals( InventoryRecipe p ) => p.GetHashCode() == GetHashCode(); 103 | } 104 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/LeaderboardEntry.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Steamworks.Data 4 | { 5 | public struct LeaderboardEntry 6 | { 7 | public Friend User; 8 | public int GlobalRank; 9 | public int Score; 10 | public int[] Details; 11 | // UGCHandle_t m_hUGC 12 | 13 | internal static LeaderboardEntry From( LeaderboardEntry_t e, int[] detailsBuffer ) 14 | { 15 | var r = new LeaderboardEntry 16 | { 17 | User = new Friend( e.SteamIDUser ), 18 | GlobalRank = e.GlobalRank, 19 | Score = e.Score, 20 | Details = null 21 | }; 22 | 23 | if ( e.CDetails > 0 ) 24 | { 25 | r.Details = detailsBuffer.Take( e.CDetails ).ToArray(); 26 | } 27 | 28 | return r; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/LeaderboardUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Steamworks.Data 4 | { 5 | public struct LeaderboardUpdate 6 | { 7 | public int Score; 8 | public bool Changed; 9 | public int NewGlobalRank; 10 | public int OldGlobalRank; 11 | public int RankChange => NewGlobalRank - OldGlobalRank; 12 | 13 | internal static LeaderboardUpdate From( LeaderboardScoreUploaded_t e ) => 14 | new LeaderboardUpdate 15 | { 16 | Score = e.Score, 17 | Changed = e.ScoreChanged == 1, 18 | NewGlobalRank = e.GlobalRankNew, 19 | OldGlobalRank = e.GlobalRankPrevious 20 | }; 21 | } 22 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/MatchMakingKeyValuePair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Steamworks.Data 5 | { 6 | [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize, CharSet = CharSet.Ansi )] 7 | internal partial struct MatchMakingKeyValuePair 8 | { 9 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 10 | internal string Key; 11 | 12 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 13 | internal string Value; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/NumericalFilter.cs: -------------------------------------------------------------------------------- 1 | namespace Steamworks.Data 2 | { 3 | struct NumericalFilter 4 | { 5 | public string Key { get; internal set; } 6 | public int Value { get; internal set; } 7 | public LobbyComparison Comparer { get; internal set; } 8 | 9 | internal NumericalFilter ( string k, int v, LobbyComparison c ) 10 | { 11 | Key = k; 12 | Value = v; 13 | Comparer = c; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/OutgoingPacket.cs: -------------------------------------------------------------------------------- 1 | namespace Steamworks.Data 2 | { 3 | /// 4 | /// A server query packet. 5 | /// 6 | public struct OutgoingPacket 7 | { 8 | /// 9 | /// Target IP address 10 | /// 11 | public uint Address { get; internal set; } 12 | 13 | /// 14 | /// Target port 15 | /// 16 | public ushort Port { get; internal set; } 17 | 18 | /// 19 | /// This data is pooled. Make a copy if you don't use it immediately. 20 | /// This buffer is also quite large - so pay attention to Size. 21 | /// 22 | public byte[] Data { get; internal set; } 23 | 24 | /// 25 | /// Size of the data 26 | /// 27 | public int Size { get; internal set; } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/P2Packet.cs: -------------------------------------------------------------------------------- 1 | namespace Steamworks.Data 2 | { 3 | public struct P2Packet 4 | { 5 | public SteamId SteamId; 6 | public byte[] Data; 7 | } 8 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/PartyBeacon.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Steamworks.Data; 3 | 4 | namespace Steamworks 5 | { 6 | public struct PartyBeacon 7 | { 8 | static ISteamParties Internal => SteamParties.Internal; 9 | 10 | internal PartyBeaconID_t Id; 11 | 12 | /// 13 | /// Gets the owner of the beacon. 14 | /// 15 | public SteamId Owner 16 | { 17 | get 18 | { 19 | var owner = default( SteamId ); 20 | var location = default( SteamPartyBeaconLocation_t ); 21 | Internal.GetBeaconDetails( Id, ref owner, ref location, out _ ); 22 | return owner; 23 | } 24 | } 25 | 26 | /// 27 | /// Gets metadata related to the beacon. 28 | /// 29 | public string MetaData 30 | { 31 | get 32 | { 33 | var owner = default( SteamId ); 34 | var location = default( SteamPartyBeaconLocation_t ); 35 | _ = Internal.GetBeaconDetails( Id, ref owner, ref location, out var strVal ); 36 | return strVal; 37 | } 38 | } 39 | 40 | /// 41 | /// Will attempt to join the party. If successful will return a connection string. 42 | /// If failed, will return 43 | /// 44 | public async Task JoinAsync() 45 | { 46 | var result = await Internal.JoinParty( Id ); 47 | if ( !result.HasValue || result.Value.Result != Result.OK ) 48 | return null; 49 | 50 | return result.Value.ConnectStringUTF8(); 51 | } 52 | 53 | /// 54 | /// When a user follows your beacon, Steam will reserve one of the open party slots for them, and send your game a ReservationNotification callback. 55 | /// When that user joins your party, call this method to notify Steam that the user has joined successfully. 56 | /// 57 | public void OnReservationCompleted( SteamId steamid ) 58 | { 59 | Internal.OnReservationCompleted( Id, steamid ); 60 | } 61 | 62 | /// 63 | /// To cancel a reservation (due to timeout or user input), call this. 64 | /// Steam will open a new reservation slot. 65 | /// Note: The user may already be in-flight to your game, so it's possible they will still connect and try to join your party. 66 | /// 67 | public void CancelReservation( SteamId steamid ) 68 | { 69 | Internal.CancelReservation( Id, steamid ); 70 | } 71 | 72 | /// 73 | /// Turn off the beacon. 74 | /// 75 | public bool Destroy() 76 | { 77 | return Internal.DestroyBeacon( Id ); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/RemotePlaySession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Steamworks.Data 5 | { 6 | /// 7 | /// Represents a RemotePlaySession from the SteamRemotePlay interface 8 | /// 9 | public struct RemotePlaySession 10 | { 11 | public uint Id { get; set; } 12 | 13 | public override string ToString() => Id.ToString(); 14 | public static implicit operator RemotePlaySession( uint value ) => new RemotePlaySession() { Id = value }; 15 | public static implicit operator uint( RemotePlaySession value ) => value.Id; 16 | 17 | /// 18 | /// Returns true if this session was valid when created. This will stay true even 19 | /// after disconnection - so be sure to watch SteamRemotePlay.OnSessionDisconnected 20 | /// 21 | public bool IsValid => Id > 0; 22 | 23 | /// 24 | /// Get the SteamID of the connected user 25 | /// 26 | public SteamId SteamId => SteamRemotePlay.Internal.GetSessionSteamID( Id ); 27 | 28 | /// 29 | /// Get the name of the session client device 30 | /// 31 | public string ClientName => SteamRemotePlay.Internal.GetSessionClientName( Id ); 32 | 33 | /// 34 | /// Get the name of the session client device 35 | /// 36 | public SteamDeviceFormFactor FormFactor => SteamRemotePlay.Internal.GetSessionClientFormFactor( Id ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/Screenshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | /// 10 | /// Represents a screenshot that was taken by a user. 11 | /// 12 | public struct Screenshot 13 | { 14 | internal ScreenshotHandle Value; 15 | 16 | /// 17 | /// Tags a user as being visible in the screenshot 18 | /// 19 | public bool TagUser( SteamId user ) 20 | { 21 | return SteamScreenshots.Internal.TagUser( Value, user ); 22 | } 23 | 24 | /// 25 | /// Sets the location of the screenshot. 26 | /// 27 | public bool SetLocation( string location ) 28 | { 29 | return SteamScreenshots.Internal.SetLocation( Value, location ); 30 | } 31 | 32 | public bool TagPublishedFile( PublishedFileId file ) 33 | { 34 | return SteamScreenshots.Internal.TagPublishedFile( Value, file ); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/ServerInit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | 8 | namespace Steamworks 9 | { 10 | /// 11 | /// Used to set up the server. 12 | /// The variables in here are all required to be set, and can't be changed once the server is created. 13 | /// 14 | public struct SteamServerInit 15 | { 16 | public IPAddress IpAddress; 17 | public ushort GamePort; 18 | public ushort QueryPort; 19 | public bool Secure; 20 | 21 | /// 22 | /// The version string is usually in the form x.x.x.x, and is used by the master server to detect when the server is out of date. 23 | /// If you go into the dedicated server tab on steamworks you'll be able to server the latest version. If this version number is 24 | /// less than that latest version then your server won't show. 25 | /// 26 | public string VersionString; 27 | 28 | /// 29 | /// This should be the same directory game where gets installed into. Just the folder name, not the whole path. I.e. "Rust", "Garrysmod". 30 | /// 31 | public string ModDir; 32 | 33 | /// 34 | /// The game description. Setting this to the full name of your game is recommended. 35 | /// 36 | public string GameDescription; 37 | 38 | /// 39 | /// Is a dedicated server 40 | /// 41 | public bool DedicatedServer; 42 | 43 | 44 | public SteamServerInit( string modDir, string gameDesc ) 45 | { 46 | DedicatedServer = true; 47 | ModDir = modDir; 48 | GameDescription = gameDesc; 49 | GamePort = 27015; 50 | QueryPort = 27016; 51 | Secure = true; 52 | VersionString = "1.0.0.0"; 53 | IpAddress = null; 54 | } 55 | 56 | /// 57 | /// If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE into usQueryPort, then it causes the game server API to use 58 | /// "GameSocketShare" mode, which means that the game is responsible for sending and receiving UDP packets for the master 59 | /// server updater. 60 | /// 61 | /// More info about this here: https://partner.steamgames.com/doc/api/ISteamGameServer#HandleIncomingPacket 62 | /// 63 | public SteamServerInit WithQueryShareGamePort() 64 | { 65 | QueryPort = 0xFFFF; 66 | return this; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/SteamId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks 8 | { 9 | /// 10 | /// Represents the ID of a user or steam lobby. 11 | /// 12 | public struct SteamId 13 | { 14 | public ulong Value; 15 | 16 | public static implicit operator SteamId( ulong value ) 17 | { 18 | return new SteamId { Value = value }; 19 | } 20 | 21 | public static implicit operator ulong( SteamId value ) 22 | { 23 | return value.Value; 24 | } 25 | 26 | public override string ToString() => Value.ToString(); 27 | 28 | public uint AccountId => (uint) (Value & 0xFFFFFFFFul); 29 | 30 | public bool IsValid => Value != default; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/SteamIpAddress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | 7 | namespace Steamworks.Data 8 | { 9 | [StructLayout( LayoutKind.Explicit, Pack = Platform.StructPlatformPackSize )] 10 | internal partial struct SteamIPAddress 11 | { 12 | [FieldOffset( 0 )] 13 | public uint Ip4Address; // Host Order 14 | 15 | [FieldOffset( 16 )] 16 | internal SteamIPType Type; // m_eType ESteamIPType 17 | 18 | public static implicit operator System.Net.IPAddress( SteamIPAddress value ) 19 | { 20 | if ( value.Type == SteamIPType.Type4 ) 21 | return Utility.Int32ToIp( value.Ip4Address ); 22 | 23 | throw new System.Exception( $"Oops - can't convert SteamIPAddress to System.Net.IPAddress because no-one coded support for {value.Type} yet" ); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/SteamParamStringArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Steamworks.Data; 4 | 5 | namespace Steamworks.Ugc 6 | { 7 | internal struct SteamParamStringArray : IDisposable 8 | { 9 | public SteamParamStringArray_t Value; 10 | 11 | IntPtr[] NativeStrings; 12 | IntPtr NativeArray; 13 | 14 | public static SteamParamStringArray From( string[] array ) 15 | { 16 | var a = new SteamParamStringArray(); 17 | 18 | a.NativeStrings = new IntPtr[array.Length]; 19 | for ( int i = 0; i < a.NativeStrings.Length; i++ ) 20 | { 21 | a.NativeStrings[i] = Marshal.StringToHGlobalAnsi( array[i] ); 22 | } 23 | 24 | var size = Marshal.SizeOf( typeof( IntPtr ) ) * a.NativeStrings.Length; 25 | a.NativeArray = Marshal.AllocHGlobal( size ); 26 | Marshal.Copy( a.NativeStrings, 0, a.NativeArray, a.NativeStrings.Length ); 27 | 28 | a.Value = new SteamParamStringArray_t 29 | { 30 | Strings = a.NativeArray, 31 | NumStrings = array.Length 32 | }; 33 | 34 | return a; 35 | } 36 | 37 | public void Dispose() 38 | { 39 | foreach ( var x in NativeStrings ) 40 | Marshal.FreeHGlobal( x ); 41 | 42 | Marshal.FreeHGlobal( NativeArray ); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/Ugc.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | #pragma warning disable 649 4 | 5 | namespace Steamworks.Data 6 | { 7 | public struct Ugc 8 | { 9 | internal UGCHandle_t Handle; 10 | } 11 | } 12 | 13 | #pragma warning restore 649 14 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/UgcAdditionalPreview.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Steamworks.Data 8 | { 9 | public struct UgcAdditionalPreview 10 | { 11 | internal UgcAdditionalPreview( string urlOrVideoID, string originalFileName, ItemPreviewType itemPreviewType ) 12 | { 13 | this.UrlOrVideoID = urlOrVideoID; 14 | this.OriginalFileName = originalFileName; 15 | this.ItemPreviewType = itemPreviewType; 16 | } 17 | 18 | public string UrlOrVideoID { get; private set; } 19 | public string OriginalFileName { get; private set; } 20 | public ItemPreviewType ItemPreviewType { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/UgcAdditionalPreview.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48f086235d5dbeb44bccbb40802e30fb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Structs/UserItemVote.cs: -------------------------------------------------------------------------------- 1 | using Steamworks.Data; 2 | 3 | namespace Steamworks.Ugc 4 | { 5 | public struct UserItemVote 6 | { 7 | public bool VotedUp; 8 | public bool VotedDown; 9 | public bool VoteSkipped; 10 | 11 | internal static UserItemVote? From(GetUserItemVoteResult_t result) 12 | { 13 | return new UserItemVote 14 | { 15 | VotedUp = result.VotedUp, 16 | VotedDown = result.VotedDown, 17 | VoteSkipped = result.VoteSkipped 18 | }; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Utility/Epoch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Steamworks 4 | { 5 | static internal class Epoch 6 | { 7 | private static readonly DateTime epoch = new DateTime( 1970, 1, 1, 0, 0, 0, DateTimeKind.Utc ); 8 | 9 | /// 10 | /// Returns the current Unix Epoch 11 | /// 12 | public static int Current => (int)(DateTime.UtcNow.Subtract( epoch ).TotalSeconds); 13 | 14 | /// 15 | /// Convert an epoch to a datetime 16 | /// 17 | public static DateTime ToDateTime( decimal unixTime ) => epoch.AddSeconds( (long)unixTime ); 18 | 19 | /// 20 | /// Convert a DateTime to a unix time 21 | /// 22 | public static uint FromDateTime( DateTime dt ) => (uint)(dt.Subtract( epoch ).TotalSeconds); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Utility/Helpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | using System.Collections.Generic; 5 | 6 | namespace Steamworks 7 | { 8 | internal static class Helpers 9 | { 10 | public const int MemoryBufferSize = 1024 * 32; 11 | 12 | internal struct Memory : IDisposable 13 | { 14 | private const int MaxBagSize = 4; 15 | private static readonly Queue BufferBag = new Queue(); 16 | 17 | public IntPtr Ptr { get; private set; } 18 | 19 | public static implicit operator IntPtr(in Memory m) => m.Ptr; 20 | 21 | internal static unsafe Memory Take() 22 | { 23 | IntPtr ptr; 24 | lock (BufferBag) 25 | { 26 | ptr = BufferBag.Count > 0 ? BufferBag.Dequeue() : Marshal.AllocHGlobal(MemoryBufferSize); 27 | } 28 | ((byte*)ptr)[0] = 0; 29 | return new Memory 30 | { 31 | Ptr = ptr 32 | }; 33 | } 34 | 35 | public void Dispose() 36 | { 37 | if (Ptr == IntPtr.Zero) { return; } 38 | lock (BufferBag) 39 | { 40 | if (BufferBag.Count < MaxBagSize) 41 | { 42 | BufferBag.Enqueue(Ptr); 43 | } 44 | else 45 | { 46 | Marshal.FreeHGlobal(Ptr); 47 | } 48 | } 49 | Ptr = IntPtr.Zero; 50 | } 51 | } 52 | 53 | public static Memory TakeMemory() 54 | { 55 | return Memory.Take(); 56 | } 57 | 58 | 59 | private static byte[][] BufferPool = new byte[4][]; 60 | private static int BufferPoolIndex; 61 | 62 | /// 63 | /// Returns a buffer. This will get returned and reused later on. 64 | /// We shouldn't really be using this anymore. 65 | /// 66 | public static byte[] TakeBuffer( int minSize ) 67 | { 68 | lock ( BufferPool ) 69 | { 70 | BufferPoolIndex++; 71 | 72 | if ( BufferPoolIndex >= BufferPool.Length ) 73 | BufferPoolIndex = 0; 74 | 75 | if ( BufferPool[BufferPoolIndex] == null ) 76 | BufferPool[BufferPoolIndex] = new byte[1024 * 256]; 77 | 78 | if ( BufferPool[BufferPoolIndex].Length < minSize ) 79 | { 80 | BufferPool[BufferPoolIndex] = new byte[minSize + 1024]; 81 | } 82 | 83 | return BufferPool[BufferPoolIndex]; 84 | } 85 | } 86 | 87 | internal unsafe static string MemoryToString( IntPtr ptr ) 88 | { 89 | var len = 0; 90 | 91 | for( len = 0; len < MemoryBufferSize; len++ ) 92 | { 93 | if ( ((byte*)ptr)[len] == 0 ) 94 | break; 95 | } 96 | 97 | if ( len == 0 ) 98 | return string.Empty; 99 | 100 | return Utility.Utf8NoBom.GetString( (byte*)ptr, len ); 101 | } 102 | 103 | internal static string BuildVersionString( params string[] interfaceVersions ) 104 | { 105 | var sb = new StringBuilder(); 106 | foreach ( var version in interfaceVersions ) 107 | { 108 | sb.Append( version ).Append( '\0' ); 109 | } 110 | 111 | sb.Append( '\0' ); 112 | return sb.ToString(); 113 | } 114 | } 115 | 116 | internal class MonoPInvokeCallbackAttribute : Attribute 117 | { 118 | public MonoPInvokeCallbackAttribute() { } 119 | } 120 | 121 | /// 122 | /// Prevent unity from stripping shit we depend on 123 | /// https://docs.unity3d.com/Manual/ManagedCodeStripping.html 124 | /// 125 | internal class PreserveAttribute : System.Attribute { } 126 | } 127 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Utility/Platform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | 9 | namespace Steamworks 10 | { 11 | internal static class Platform 12 | { 13 | #if PLATFORM_WIN64 14 | public const int StructPlatformPackSize = 8; 15 | public const string LibraryName = "steam_api64"; 16 | #elif PLATFORM_WIN32 17 | public const int StructPlatformPackSize = 8; 18 | public const string LibraryName = "steam_api"; 19 | #elif PLATFORM_POSIX 20 | public const int StructPlatformPackSize = 4; 21 | public const string LibraryName = "libsteam_api"; 22 | #endif 23 | 24 | public const CallingConvention CC = CallingConvention.Cdecl; 25 | public const int StructPackSize = 4; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Utility/SteamInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Sockets; 7 | using System.Runtime.InteropServices; 8 | using System.Text; 9 | 10 | namespace Steamworks 11 | { 12 | internal abstract class SteamInterface 13 | { 14 | public virtual IntPtr GetUserInterfacePointer() => IntPtr.Zero; 15 | public virtual IntPtr GetServerInterfacePointer() => IntPtr.Zero; 16 | public virtual IntPtr GetGlobalInterfacePointer() => IntPtr.Zero; 17 | 18 | public IntPtr Self; 19 | public IntPtr SelfGlobal; 20 | public IntPtr SelfServer; 21 | public IntPtr SelfClient; 22 | 23 | public bool IsValid => Self != IntPtr.Zero; 24 | public bool IsServer { get; private set; } 25 | 26 | internal void SetupInterface( bool gameServer ) 27 | { 28 | if ( Self != IntPtr.Zero ) 29 | return; 30 | 31 | IsServer = gameServer; 32 | SelfGlobal = GetGlobalInterfacePointer(); 33 | Self = SelfGlobal; 34 | 35 | if ( Self != IntPtr.Zero ) 36 | return; 37 | 38 | if ( gameServer ) 39 | { 40 | SelfServer = GetServerInterfacePointer(); 41 | Self = SelfServer; 42 | } 43 | else 44 | { 45 | SelfClient = GetUserInterfacePointer(); 46 | Self = SelfClient; 47 | } 48 | } 49 | 50 | internal void ShutdownInterface() 51 | { 52 | Self = IntPtr.Zero; 53 | } 54 | } 55 | 56 | public abstract class SteamClass 57 | { 58 | internal abstract bool InitializeInterface( bool server ); 59 | internal abstract void DestroyInterface( bool server ); 60 | } 61 | 62 | public class SteamSharedClass : SteamClass 63 | { 64 | internal static SteamInterface Interface => InterfaceClient ?? InterfaceServer; 65 | internal static SteamInterface InterfaceClient; 66 | internal static SteamInterface InterfaceServer; 67 | 68 | internal override bool InitializeInterface( bool server ) 69 | { 70 | return false; 71 | } 72 | 73 | internal virtual void SetInterface( bool server, SteamInterface iface ) 74 | { 75 | if ( server ) 76 | { 77 | InterfaceServer = iface; 78 | } 79 | 80 | if ( !server ) 81 | { 82 | InterfaceClient = iface; 83 | } 84 | } 85 | 86 | internal override void DestroyInterface( bool server ) 87 | { 88 | if ( !server ) 89 | { 90 | InterfaceClient = null; 91 | } 92 | 93 | if ( server ) 94 | { 95 | InterfaceServer = null; 96 | } 97 | } 98 | } 99 | 100 | public class SteamClientClass : SteamClass 101 | { 102 | internal static SteamInterface Interface; 103 | 104 | internal override bool InitializeInterface( bool server ) 105 | { 106 | return false; 107 | } 108 | 109 | internal virtual void SetInterface( bool server, SteamInterface iface ) 110 | { 111 | if ( server ) 112 | throw new System.NotSupportedException(); 113 | 114 | Interface = iface; 115 | } 116 | 117 | internal override void DestroyInterface( bool server ) 118 | { 119 | Interface = null; 120 | } 121 | } 122 | 123 | public class SteamServerClass : SteamClass 124 | { 125 | internal static SteamInterface Interface; 126 | 127 | internal override bool InitializeInterface( bool server ) 128 | { 129 | return false; 130 | } 131 | 132 | internal virtual void SetInterface( bool server, SteamInterface iface ) 133 | { 134 | if ( !server ) 135 | throw new System.NotSupportedException(); 136 | 137 | Interface = iface; 138 | } 139 | 140 | internal override void DestroyInterface( bool server ) 141 | { 142 | Interface = null; 143 | } 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/Utility/Utf8String.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | 5 | namespace Steamworks 6 | { 7 | internal struct Utf8StringToNative : IDisposable 8 | { 9 | public IntPtr Pointer { get; private set; } 10 | 11 | public unsafe Utf8StringToNative( string value ) 12 | { 13 | if ( value == null ) 14 | { 15 | Pointer = IntPtr.Zero; 16 | return; 17 | } 18 | 19 | fixed ( char* strPtr = value ) 20 | { 21 | var len = Utility.Utf8NoBom.GetByteCount( value ); 22 | var mem = Marshal.AllocHGlobal( len + 1 ); 23 | 24 | var wlen = Utility.Utf8NoBom.GetBytes( strPtr, value.Length, (byte*)mem, len + 1 ); 25 | 26 | ( (byte*)mem )[wlen] = 0; 27 | 28 | Pointer = mem; 29 | } 30 | } 31 | 32 | public void Dispose() 33 | { 34 | if ( Pointer != IntPtr.Zero ) 35 | { 36 | Marshal.FreeHGlobal( Pointer ); 37 | Pointer = IntPtr.Zero; 38 | } 39 | } 40 | } 41 | 42 | internal struct Utf8StringPointer 43 | { 44 | #pragma warning disable 649 45 | internal IntPtr ptr; 46 | #pragma warning restore 649 47 | 48 | public unsafe static implicit operator string( Utf8StringPointer p ) 49 | { 50 | if ( p.ptr == IntPtr.Zero ) 51 | return null; 52 | 53 | var bytes = (byte*)p.ptr; 54 | 55 | var dataLen = 0; 56 | while ( dataLen < 1024 * 1024 * 64 ) 57 | { 58 | if ( bytes[dataLen] == 0 ) 59 | break; 60 | 61 | dataLen++; 62 | } 63 | 64 | return Utility.Utf8NoBom.GetString( bytes, dataLen ); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Facepunch.Steamworks/steam_api.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks/steam_api.dll -------------------------------------------------------------------------------- /Facepunch.Steamworks/steam_api64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Facepunch.Steamworks/steam_api64.dll -------------------------------------------------------------------------------- /Generator/CodeWriter/Callbacks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Generator 8 | { 9 | public partial class CodeWriter 10 | { 11 | void Callbacks() 12 | { 13 | var callbackList = new List(); 14 | 15 | foreach ( var c in def.callback_structs ) 16 | { 17 | var name = Cleanup.ConvertType( c.Name ); 18 | 19 | if ( !Cleanup.ShouldCreate( name ) ) 20 | continue; 21 | 22 | if ( name.Contains( "::" ) ) 23 | continue; 24 | 25 | var partial = ""; 26 | if ( c.Methods != null ) partial = " partial"; 27 | 28 | int defaultPack = c.IsPack4OnWindows ? 4 : 8; 29 | 30 | var isCallback = true; 31 | var iface = ""; 32 | if ( isCallback ) 33 | iface = " : ICallbackData"; 34 | 35 | // 36 | // Main struct 37 | // 38 | WriteLine( $"[StructLayout( LayoutKind.Sequential, Pack = Platform.{(c.IsPack4OnWindows?"StructPackSize": "StructPlatformPackSize")} )]" ); 39 | StartBlock( $"{Cleanup.Expose( name )}{partial} struct {name}{iface}" ); 40 | { 41 | // 42 | // The fields 43 | // 44 | StructFields( c.Fields ); 45 | WriteLine(); 46 | 47 | if ( isCallback ) 48 | { 49 | WriteLine( "#region SteamCallback" ); 50 | { 51 | 52 | WriteLine( $"public static int _datasize = System.Runtime.InteropServices.Marshal.SizeOf( typeof({name}) );" ); 53 | WriteLine( $"public int DataSize => _datasize;" ); 54 | WriteLine( $"public CallbackType CallbackType => CallbackType.{name.Replace( "_t", "" )};" ); 55 | } 56 | WriteLine( "#endregion" ); 57 | } 58 | 59 | if ( c.Enums != null ) 60 | { 61 | foreach ( var e in c.Enums ) 62 | { 63 | WriteEnum( e, e.Name ); 64 | } 65 | } 66 | 67 | // if ( c.CallbackId ) ) 68 | { 69 | callbackList.Add( c ); 70 | } 71 | 72 | } 73 | EndBlock(); 74 | WriteLine(); 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Generator/CodeWriter/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Generator 8 | { 9 | public partial class CodeWriter 10 | { 11 | private void Constants() 12 | { 13 | StartBlock( "internal static class Defines" ); 14 | foreach ( var o in def.Consts ) 15 | { 16 | var type = o.Type; 17 | type = Cleanup.ConvertType( type ); 18 | 19 | var val = o.Val; 20 | 21 | // Don't need to ull in c# 22 | if ( val.EndsWith( "ull" ) ) 23 | val = val.Replace( "ull", "" ); 24 | 25 | val = val.Replace( "uint32", "uint" ); 26 | val = val.Replace( "16U", "16" ); 27 | val = val.Replace( "8U", "8" ); 28 | val = val.Replace( ".f", ".0f" ); 29 | 30 | // we're not an actual typedef so can't cast like this 31 | val = val.Replace( "( SteamItemInstanceID_t ) ~ 0", "~default(ulong)" ); 32 | 33 | // This is defined as 0xffffffff - which is too big for an int 34 | // It seems like the loop around is required, so we just hard code it 35 | if ( o.Name == "HSERVERQUERY_INVALID" && val == "0xffffffff" ) 36 | val = "-1"; 37 | 38 | WriteLine( $"internal static readonly {type} {o.Name} = {val};" ); 39 | } 40 | EndBlock(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Generator/CodeWriter/CustomEnums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Generator 8 | { 9 | public partial class CodeWriter 10 | { 11 | void CustomEnums() 12 | { 13 | StartBlock( "public enum CallbackType" ); 14 | foreach ( var c in def.callback_structs.OrderBy( x => x.CallbackId ) ) 15 | { 16 | if ( Cleanup.IsDeprecated( c.Name ) ) 17 | Write( "// " ); 18 | 19 | WriteLine( $"{c.Name.Replace( "_t", "" ) } = {c.CallbackId}," ); 20 | } 21 | EndBlock(); 22 | 23 | int last = -1; 24 | 25 | StartBlock( "internal static partial class CallbackTypeFactory" ); 26 | StartBlock( "internal static System.Collections.Generic.Dictionary All = new System.Collections.Generic.Dictionary" ); 27 | foreach ( var c in def.callback_structs.OrderBy( x => x.CallbackId ) ) 28 | { 29 | if ( Cleanup.IsDeprecated( c.Name ) ) 30 | continue; 31 | 32 | if ( last == c.CallbackId ) 33 | Write( "// " ); 34 | 35 | WriteLine( $"{{ CallbackType.{c.Name.Replace( "_t", "" ) }, typeof( {Cleanup.ConvertType(c.Name)} )}}," ); 36 | 37 | last = c.CallbackId; 38 | } 39 | EndBlock( ";" ); 40 | EndBlock(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Generator/CodeWriter/StructFunctions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Generator 8 | { 9 | public partial class CodeWriter 10 | { 11 | void StructFunctions() 12 | { 13 | foreach ( var c in def.structs.Union( def.callback_structs.Select( x => x as SteamApiDefinition.StructDef ) ).OrderBy( x => x.Name ) ) 14 | { 15 | var name = Cleanup.ConvertType( c.Name ); 16 | 17 | if ( name.Contains( "::" ) ) 18 | continue; 19 | 20 | if ( c.Methods == null || c.Methods.Length == 0 ) 21 | continue; 22 | 23 | // 24 | // Main struct 25 | // 26 | StartBlock( $"{Cleanup.Expose( name )} partial struct {name}" ); 27 | { 28 | foreach ( var func in c.Methods ) 29 | { 30 | if ( func.Name.Contains( "operator" ) ) 31 | func.Name = func.FlatName.Substring( func.FlatName.LastIndexOf( '_' ) + 1 ); 32 | 33 | var returnType = BaseType.Parse( func.ReturnType, null, func.CallResult ); 34 | returnType.Func = func.Name; 35 | 36 | var args = ProcessArgs( func ); 37 | var delegateargstr = string.Join( ", ", args.Select( x => x.AsNativeArgument() ) ); 38 | 39 | if ( !string.IsNullOrEmpty( func.Desc ) ) 40 | { 41 | WriteLine( "/// " ); 42 | WriteLine( $"/// {func.Desc}" ); 43 | WriteLine( "/// " ); 44 | } 45 | 46 | if ( returnType.ReturnAttribute != null ) 47 | WriteLine( returnType.ReturnAttribute ); 48 | 49 | var _unsafe = ""; 50 | var firstArg = $"ref {name} self"; 51 | 52 | // 53 | // If this is NetMsg then the ORIGINAL pointer address is important 54 | // because we need to pass in the original pointer - not just the data 55 | // 56 | if ( name == "NetMsg" ) 57 | { 58 | firstArg = $"{name}* self"; 59 | _unsafe = " unsafe"; 60 | } 61 | 62 | WriteLine( $"[DllImport( Platform.LibraryName, EntryPoint = \"{func.FlatName}\", CallingConvention = Platform.CC)]" ); 63 | WriteLine( $"internal static{_unsafe} extern {returnType.TypeNameFrom} Internal{func.Name}( {firstArg}, {delegateargstr} );".Replace( $"( {firstArg}, )", $"( {firstArg} )" ) ); 64 | WriteLine(); 65 | 66 | } 67 | 68 | 69 | } 70 | EndBlock(); 71 | WriteLine(); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Generator/CodeWriter/Types.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Generator 9 | { 10 | public partial class CodeWriter 11 | { 12 | // 13 | // Don't give a fuck about these types 14 | // 15 | public readonly static string[] SkipTypes = new string[] 16 | { 17 | "ValvePackingSentinel_t", 18 | "SteamAPIWarningMessageHook_t", 19 | "Salt_t", 20 | "SteamAPI_CheckCallbackRegistered_t", 21 | "compile_time_assert_type", 22 | "SteamErrMsg", 23 | }; 24 | 25 | // 26 | // Native types and function defs 27 | // 28 | public readonly static string[] SkipTypesStartingWith = new string[] 29 | { 30 | "uint", 31 | "int", 32 | "ulint", 33 | "lint", 34 | "PFN" 35 | }; 36 | 37 | private void Types() 38 | { 39 | foreach ( var o in def.typedefs.Where( x => !x.Name.Contains( "::" ) ) ) 40 | { 41 | if ( !Cleanup.ShouldCreate( o.Name ) ) 42 | continue; 43 | 44 | var typeName = Cleanup.ConvertType( o.Name ); 45 | 46 | if ( !Cleanup.ShouldCreate( typeName ) ) 47 | continue; 48 | 49 | if ( SkipTypes.Contains( o.Name ) ) 50 | continue; 51 | 52 | if ( SkipTypesStartingWith.Any( x => o.Name.StartsWith( x ) ) ) 53 | continue; 54 | 55 | StartBlock( $"{Cleanup.Expose( typeName )} struct {typeName} : IEquatable<{typeName}>, IComparable<{typeName}>" ); 56 | { 57 | WriteLine( $"// Name: {o.Name}, Type: {o.Type}" ); 58 | 59 | if ( o.Type == "char [1024]" ) 60 | { 61 | WriteLine( $"public fixed char[1024] Value;" ); 62 | } 63 | else 64 | { 65 | WriteLine( $"public {ToManagedType( o.Type )} Value;" ); 66 | } 67 | WriteLine(); 68 | WriteLine( $"public static implicit operator {typeName}( {ToManagedType( o.Type )} value ) => new {typeName}(){{ Value = value }};" ); 69 | WriteLine( $"public static implicit operator {ToManagedType( o.Type )}( {typeName} value ) => value.Value;" ); 70 | WriteLine( $"public override string ToString() => Value.ToString();" ); 71 | WriteLine( $"public override int GetHashCode() => Value.GetHashCode();" ); 72 | WriteLine( $"public override bool Equals( object p ) => this.Equals( ({typeName}) p );" ); 73 | WriteLine( $"public bool Equals( {typeName} p ) => p.Value == Value;" ); 74 | WriteLine( $"public static bool operator ==( {typeName} a, {typeName} b ) => a.Equals( b );" ); 75 | WriteLine( $"public static bool operator !=( {typeName} a, {typeName} b ) => !a.Equals( b );" ); 76 | 77 | if ( ToManagedType( o.Type ) == "IntPtr" ) 78 | WriteLine( $"public int CompareTo( {typeName} other ) => Value.ToInt64().CompareTo( other.Value.ToInt64() );" ); 79 | else 80 | WriteLine( $"public int CompareTo( {typeName} other ) => Value.CompareTo( other.Value );" ); 81 | } 82 | EndBlock(); 83 | WriteLine(); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Generator/CodeWriter/Writing.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Generator; 8 | 9 | namespace Generator 10 | { 11 | public partial class CodeWriter 12 | { 13 | private StringBuilder sb = new StringBuilder(); 14 | 15 | private int indent = 0; 16 | private bool skipIndent = false; 17 | public string Indent { get { if ( skipIndent ) { return ""; } return new string( '\t', indent ); } } 18 | 19 | private void EndBlock( string end = "" ) 20 | { 21 | indent--; 22 | WriteLine( "}" + end ); 23 | } 24 | 25 | 26 | private void WriteLine( string v = "" ) 27 | { 28 | sb.AppendLine( $"{Indent}{v}" ); 29 | skipIndent = false; 30 | } 31 | 32 | private void Write( string v = "" ) 33 | { 34 | sb.Append( $"{Indent}{v}" ); 35 | skipIndent = true; 36 | } 37 | 38 | private void StartBlock( string v ) 39 | { 40 | WriteLine( v ); 41 | WriteLine( "{" ); 42 | 43 | indent++; 44 | } 45 | 46 | private void Else( string v = "" ) 47 | { 48 | indent--; 49 | 50 | WriteLine( "}" ); 51 | WriteLine( "else"+ v ); 52 | WriteLine( "{" ); 53 | 54 | indent++; 55 | } 56 | 57 | private void WriteLines( List beforeLines ) 58 | { 59 | foreach ( var line in beforeLines ) 60 | { 61 | if ( line == "}" ) 62 | indent--; 63 | 64 | WriteLine( line ); 65 | 66 | if ( line == "{" ) 67 | indent++; 68 | } 69 | } 70 | 71 | } 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /Generator/Generator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | Exe 5 | false 6 | 10 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Generator/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Newtonsoft.Json; 7 | 8 | namespace Generator 9 | { 10 | class Program 11 | { 12 | public static SteamApiDefinition Definitions; 13 | 14 | static void Main( string[] args ) 15 | { 16 | var content = System.IO.File.ReadAllText( "steam_sdk/steam_api.json" ); 17 | var def = Newtonsoft.Json.JsonConvert.DeserializeObject( content ); 18 | 19 | Definitions = def; 20 | 21 | var generator = new CodeWriter( def ); 22 | 23 | generator.ToFolder( "../Facepunch.Steamworks/Generated/" ); 24 | } 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /Generator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle( "Generator" )] 9 | [assembly: AssemblyDescription( "" )] 10 | [assembly: AssemblyConfiguration( "" )] 11 | [assembly: AssemblyCompany( "" )] 12 | [assembly: AssemblyProduct( "Generator" )] 13 | [assembly: AssemblyCopyright( "Copyright © 2016" )] 14 | [assembly: AssemblyTrademark( "" )] 15 | [assembly: AssemblyCulture( "" )] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible( false )] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid( "b7225d11-2aaa-49d6-ae93-a73696ea35fe" )] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion( "1.0.0.0" )] 36 | [assembly: AssemblyFileVersion( "1.0.0.0" )] 37 | -------------------------------------------------------------------------------- /Generator/Types/BoolType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// Special care needs to be taken with bool types. Apparently BOOL in WINDOWS.H are 4 bytes. 10 | /// But in reality and in native c++ they're 1 byte. 11 | /// Of course marshalling by default expects them to be 4 bytes - because why not eh. So we have 12 | /// to add a few attributes to make sure we don't get fucked over by bill gates again. 13 | /// 14 | internal class BoolType : BaseType 15 | { 16 | public override string TypeName => $"bool"; 17 | public override string AsArgument() => $"[MarshalAs( UnmanagedType.U1 )] {Ref}{TypeName} {VarName}"; 18 | public override string ReturnAttribute => "[return: MarshalAs( UnmanagedType.I1 )]"; 19 | 20 | } -------------------------------------------------------------------------------- /Generator/Types/ConstCharType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// To pass a string we use a custom marshaller (Utf8StringToNative) to convert it 10 | /// from a utf8 string to a pointer. If we just pass it as a string it won't be utf8 encoded. 11 | /// 12 | /// To receive we have a special struct called Utf8StringPointer which can implicitly change 13 | /// the pointer to a utf8 string. 14 | /// 15 | internal class ConstCharType : BaseType 16 | { 17 | public override string TypeName => $"string"; 18 | public override string TypeNameFrom => $"Utf8StringPointer"; 19 | public override string AsArgument() => $"{Ref}string {VarName}"; 20 | public override string AsNativeArgument() => $"{Ref}IntPtr {VarName}"; 21 | public override string AsCallArgument() => $"str__{VarName}.Pointer"; 22 | 23 | public override string Ref => ""; 24 | } 25 | -------------------------------------------------------------------------------- /Generator/Types/FetchStringType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// Passes a pointer to a buffer as an argument, then converts 10 | /// it into a string which is returned via an out param. 11 | /// 12 | /// This is used of "char *" parameters which expect you to pass in 13 | /// a buffer to retrieve the text. Usually \0 terminated. 14 | /// 15 | 16 | internal class FetchStringType : BaseType 17 | { 18 | public string BufferSizeParamName; // optional, use next parameter if not set 19 | 20 | public override string TypeName => $"string"; 21 | public override string AsArgument() => $"out string {VarName}"; 22 | 23 | public override string AsNativeArgument() => $"IntPtr {VarName}"; 24 | 25 | public override string AsCallArgument() => $"mem__{VarName}"; 26 | public override string Ref => ""; 27 | } 28 | -------------------------------------------------------------------------------- /Generator/Types/LiteralType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// Used to replace a variable with a literal. 10 | /// 11 | /// This is used when we can determine a parameter ourselves. For example 12 | /// if you're passing a buffer and a paramter is the buffer length 13 | /// 14 | 15 | internal class LiteralType : BaseType 16 | { 17 | private string Value; 18 | private BaseType baseType; 19 | 20 | public LiteralType( BaseType baseType, string value ) 21 | { 22 | this.baseType = baseType; 23 | this.Value = value; 24 | 25 | VarName = baseType.VarName; 26 | } 27 | 28 | public bool IsOutValue => !string.IsNullOrEmpty( Ref ); 29 | public string OutVarDeclaration => IsOutValue ? $"{baseType.TypeName} sz{VarName} = {Value};" : null; 30 | 31 | public override bool ShouldSkipAsArgument => true; 32 | 33 | public override string Ref => baseType.Ref; 34 | public override bool IsVector => false; 35 | public override string AsArgument() => baseType.AsArgument(); 36 | public override string AsCallArgument() => string.IsNullOrEmpty( Ref ) ? Value : $"{Ref}sz{VarName}"; 37 | } 38 | -------------------------------------------------------------------------------- /Generator/Types/SteamApiCallType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// Functions returning SteamAPICall_t are converted to be asyncronhous 10 | /// and return a generic CallResult struct with the T of the result type. 11 | /// 12 | internal class SteamApiCallType : BaseType 13 | { 14 | public string CallResult; 15 | public override string TypeName => "SteamAPICall_t"; 16 | public override string Return( string varname ) 17 | { 18 | return $"return new CallResult<{CallResult}>( {varname}, IsServer );"; 19 | } 20 | 21 | public override string ReturnType 22 | { 23 | get 24 | { 25 | if ( !string.IsNullOrEmpty( CallResult ) ) 26 | return $"CallResult<{CallResult}>"; 27 | 28 | return $"CallResult"; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Generator/Types/StructType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// The struct can be passed as a pointer or as plain old data. 10 | /// If it's a pointer we need to marshal it back to our type 11 | /// (this only happens in a couple of places in the sdk) 12 | /// 13 | 14 | internal class StructType : BaseType 15 | { 16 | public string StructName; 17 | 18 | public override string TypeName => IsPointer && TreatAsPointer ? StructName + PointerSuffix : StructName; 19 | 20 | public override string TypeNameFrom => IsPointer && !TreatAsPointer ? "IntPtr" : TypeName; 21 | 22 | public override string AsArgument() => IsPointer && TreatAsPointer ? $"{TypeName} {VarName}" : base.AsArgument(); 23 | 24 | public override string AsCallArgument() => IsPointer && TreatAsPointer ? VarName : base.AsCallArgument(); 25 | 26 | public override bool TreatAsPointer => StructName == "NetMsg"; 27 | 28 | public bool IsPointer => NativeType.EndsWith( "*" ); 29 | 30 | public override string Return( string varname ) 31 | { 32 | if ( IsPointer && !TreatAsPointer ) 33 | { 34 | return $"return {varname}.ToType<{TypeName}>();"; 35 | } 36 | 37 | return base.Return( varname ); 38 | } 39 | 40 | private string PointerSuffix => new string( '*', NativeType.Count( c => c == '*' ) ); 41 | } -------------------------------------------------------------------------------- /Generator/Types/VoidType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | /// 9 | /// Nothing - just priny void 10 | /// 11 | internal class VoidType : BaseType 12 | { 13 | public override string TypeName => $"void"; 14 | public override string TypeNameFrom => $"void"; 15 | public override string Return( string varname ) => ""; 16 | public override bool IsVoid => true; 17 | } -------------------------------------------------------------------------------- /Generator/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Generator/steam_sdk/isteamappticket.h: -------------------------------------------------------------------------------- 1 | //====== Copyright 1996-2008, Valve Corporation, All rights reserved. ======= 2 | // 3 | // Purpose: a private, but well versioned, interface to get at critical bits 4 | // of a steam3 appticket - consumed by the simple drm wrapper to let it 5 | // ask about ownership with greater confidence. 6 | // 7 | //============================================================================= 8 | 9 | #ifndef ISTEAMAPPTICKET_H 10 | #define ISTEAMAPPTICKET_H 11 | #pragma once 12 | 13 | //----------------------------------------------------------------------------- 14 | // Purpose: hand out a reasonable "future proof" view of an app ownership ticket 15 | // the raw (signed) buffer, and indices into that buffer where the appid and 16 | // steamid are located. the sizes of the appid and steamid are implicit in 17 | // (each version of) the interface - currently uin32 appid and uint64 steamid 18 | //----------------------------------------------------------------------------- 19 | class ISteamAppTicket 20 | { 21 | public: 22 | virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature ) = 0; 23 | }; 24 | 25 | #define STEAMAPPTICKET_INTERFACE_VERSION "STEAMAPPTICKET_INTERFACE_VERSION001" 26 | 27 | 28 | #endif // ISTEAMAPPTICKET_H 29 | -------------------------------------------------------------------------------- /Generator/steam_sdk/isteamgamecoordinator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/isteamgamecoordinator.h -------------------------------------------------------------------------------- /Generator/steam_sdk/isteamgameserverstats.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/isteamgameserverstats.h -------------------------------------------------------------------------------- /Generator/steam_sdk/isteaminventory.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/isteaminventory.h -------------------------------------------------------------------------------- /Generator/steam_sdk/isteammusic.h: -------------------------------------------------------------------------------- 1 | //============ Copyright (c) Valve Corporation, All rights reserved. ============ 2 | 3 | #ifndef ISTEAMMUSIC_H 4 | #define ISTEAMMUSIC_H 5 | #ifdef _WIN32 6 | #pragma once 7 | #endif 8 | 9 | #include "steam_api_common.h" 10 | 11 | //----------------------------------------------------------------------------- 12 | // Purpose: 13 | //----------------------------------------------------------------------------- 14 | enum AudioPlayback_Status 15 | { 16 | AudioPlayback_Undefined = 0, 17 | AudioPlayback_Playing = 1, 18 | AudioPlayback_Paused = 2, 19 | AudioPlayback_Idle = 3 20 | }; 21 | 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: Functions to control music playback in the steam client 25 | //----------------------------------------------------------------------------- 26 | class ISteamMusic 27 | { 28 | public: 29 | virtual bool BIsEnabled() = 0; 30 | virtual bool BIsPlaying() = 0; 31 | 32 | virtual AudioPlayback_Status GetPlaybackStatus() = 0; 33 | 34 | virtual void Play() = 0; 35 | virtual void Pause() = 0; 36 | virtual void PlayPrevious() = 0; 37 | virtual void PlayNext() = 0; 38 | 39 | // volume is between 0.0 and 1.0 40 | virtual void SetVolume( float flVolume ) = 0; 41 | virtual float GetVolume() = 0; 42 | 43 | }; 44 | 45 | #define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001" 46 | 47 | // Global interface accessor 48 | inline ISteamMusic *SteamMusic(); 49 | STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusic *, SteamMusic, STEAMMUSIC_INTERFACE_VERSION ); 50 | 51 | // callbacks 52 | #if defined( VALVE_CALLBACK_PACK_SMALL ) 53 | #pragma pack( push, 4 ) 54 | #elif defined( VALVE_CALLBACK_PACK_LARGE ) 55 | #pragma pack( push, 8 ) 56 | #else 57 | #error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx 58 | #endif 59 | 60 | 61 | STEAM_CALLBACK_BEGIN( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 ) 62 | STEAM_CALLBACK_END(0) 63 | 64 | STEAM_CALLBACK_BEGIN( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 ) 65 | STEAM_CALLBACK_MEMBER( 0, float, m_flNewVolume ) 66 | STEAM_CALLBACK_END(1) 67 | 68 | #pragma pack( pop ) 69 | 70 | 71 | #endif // #define ISTEAMMUSIC_H 72 | -------------------------------------------------------------------------------- /Generator/steam_sdk/isteamparentalsettings.h: -------------------------------------------------------------------------------- 1 | //====== Copyright � 2013-, Valve Corporation, All rights reserved. ======= 2 | // 3 | // Purpose: Interface to Steam parental settings (Family View) 4 | // 5 | //============================================================================= 6 | 7 | #ifndef ISTEAMPARENTALSETTINGS_H 8 | #define ISTEAMPARENTALSETTINGS_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include "steam_api_common.h" 14 | 15 | // Feature types for parental settings 16 | enum EParentalFeature 17 | { 18 | k_EFeatureInvalid = 0, 19 | k_EFeatureStore = 1, 20 | k_EFeatureCommunity = 2, 21 | k_EFeatureProfile = 3, 22 | k_EFeatureFriends = 4, 23 | k_EFeatureNews = 5, 24 | k_EFeatureTrading = 6, 25 | k_EFeatureSettings = 7, 26 | k_EFeatureConsole = 8, 27 | k_EFeatureBrowser = 9, 28 | k_EFeatureParentalSetup = 10, 29 | k_EFeatureLibrary = 11, 30 | k_EFeatureTest = 12, 31 | k_EFeatureSiteLicense = 13, 32 | k_EFeatureKioskMode_Deprecated = 14, 33 | k_EFeatureBlockAlways = 15, 34 | k_EFeatureMax 35 | }; 36 | 37 | class ISteamParentalSettings 38 | { 39 | public: 40 | virtual bool BIsParentalLockEnabled() = 0; 41 | virtual bool BIsParentalLockLocked() = 0; 42 | 43 | virtual bool BIsAppBlocked( AppId_t nAppID ) = 0; 44 | virtual bool BIsAppInBlockList( AppId_t nAppID ) = 0; 45 | 46 | virtual bool BIsFeatureBlocked( EParentalFeature eFeature ) = 0; 47 | virtual bool BIsFeatureInBlockList( EParentalFeature eFeature ) = 0; 48 | }; 49 | 50 | #define STEAMPARENTALSETTINGS_INTERFACE_VERSION "STEAMPARENTALSETTINGS_INTERFACE_VERSION001" 51 | 52 | // Global interface accessor 53 | inline ISteamParentalSettings *SteamParentalSettings(); 54 | STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamParentalSettings *, SteamParentalSettings, STEAMPARENTALSETTINGS_INTERFACE_VERSION ); 55 | 56 | //----------------------------------------------------------------------------- 57 | // Purpose: Callback for querying UGC 58 | //----------------------------------------------------------------------------- 59 | struct SteamParentalSettingsChanged_t 60 | { 61 | enum { k_iCallback = k_ISteamParentalSettingsCallbacks + 1 }; 62 | }; 63 | 64 | 65 | #endif // ISTEAMPARENTALSETTINGS_H 66 | -------------------------------------------------------------------------------- /Generator/steam_sdk/isteamps3overlayrenderer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/isteamps3overlayrenderer.h -------------------------------------------------------------------------------- /Generator/steam_sdk/isteamvideo.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/isteamvideo.h -------------------------------------------------------------------------------- /Generator/steam_sdk/steam_gameserver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/steam_gameserver.h -------------------------------------------------------------------------------- /Generator/steam_sdk/steamencryptedappticket.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/steamencryptedappticket.h -------------------------------------------------------------------------------- /Generator/steam_sdk/steamhttpenums.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/Generator/steam_sdk/steamhttpenums.h -------------------------------------------------------------------------------- /Generator/steam_sdk/steamuniverse.h: -------------------------------------------------------------------------------- 1 | //========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef STEAMUNIVERSE_H 8 | #define STEAMUNIVERSE_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | 14 | // Steam universes. Each universe is a self-contained Steam instance. 15 | enum EUniverse 16 | { 17 | k_EUniverseInvalid = 0, 18 | k_EUniversePublic = 1, 19 | k_EUniverseBeta = 2, 20 | k_EUniverseInternal = 3, 21 | k_EUniverseDev = 4, 22 | // k_EUniverseRC = 5, // no such universe anymore 23 | k_EUniverseMax 24 | }; 25 | 26 | 27 | #endif // STEAMUNIVERSE_H 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Facepunch Studios LTD 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Posix.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc89a528dd38bd04a90af929e9c0f80e 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux64: 0 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 1 23 | Exclude Win64: 1 24 | - first: 25 | Any: 26 | second: 27 | enabled: 0 28 | settings: {} 29 | - first: 30 | Editor: Editor 31 | second: 32 | enabled: 1 33 | settings: 34 | CPU: AnyCPU 35 | DefaultValueInitialized: true 36 | OS: OSX 37 | - first: 38 | Facebook: Win 39 | second: 40 | enabled: 0 41 | settings: 42 | CPU: None 43 | - first: 44 | Facebook: Win64 45 | second: 46 | enabled: 0 47 | settings: 48 | CPU: None 49 | - first: 50 | Standalone: Linux64 51 | second: 52 | enabled: 1 53 | settings: 54 | CPU: AnyCPU 55 | - first: 56 | Standalone: OSXUniversal 57 | second: 58 | enabled: 1 59 | settings: 60 | CPU: AnyCPU 61 | - first: 62 | Standalone: Win 63 | second: 64 | enabled: 0 65 | settings: 66 | CPU: None 67 | - first: 68 | Standalone: Win64 69 | second: 70 | enabled: 0 71 | settings: 72 | CPU: None 73 | - first: 74 | Windows Store Apps: WindowsStoreApps 75 | second: 76 | enabled: 0 77 | settings: 78 | CPU: AnyCPU 79 | userData: 80 | assetBundleName: 81 | assetBundleVariant: 82 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Posix.pdb.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70840efe0f145064cbb0b568f11d7ff5 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Posix.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f13b7820b3a9b6145a8ea48a92291748 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Win32.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb41692bc4208c0449c96c0576331408 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux64: 1 21 | Exclude OSXUniversal: 1 22 | Exclude Win: 0 23 | Exclude Win64: 1 24 | - first: 25 | Any: 26 | second: 27 | enabled: 1 28 | settings: {} 29 | - first: 30 | Editor: Editor 31 | second: 32 | enabled: 1 33 | settings: 34 | CPU: x86 35 | DefaultValueInitialized: true 36 | OS: Windows 37 | - first: 38 | Facebook: Win 39 | second: 40 | enabled: 0 41 | settings: 42 | CPU: AnyCPU 43 | - first: 44 | Facebook: Win64 45 | second: 46 | enabled: 0 47 | settings: 48 | CPU: None 49 | - first: 50 | Standalone: Linux64 51 | second: 52 | enabled: 0 53 | settings: 54 | CPU: None 55 | - first: 56 | Standalone: OSXUniversal 57 | second: 58 | enabled: 0 59 | settings: 60 | CPU: None 61 | - first: 62 | Standalone: Win 63 | second: 64 | enabled: 1 65 | settings: 66 | CPU: AnyCPU 67 | - first: 68 | Standalone: Win64 69 | second: 70 | enabled: 0 71 | settings: 72 | CPU: None 73 | - first: 74 | Windows Store Apps: WindowsStoreApps 75 | second: 76 | enabled: 0 77 | settings: 78 | CPU: AnyCPU 79 | userData: 80 | assetBundleName: 81 | assetBundleVariant: 82 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Win32.pdb.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b8e838f93aba6a47a16dbe26efbe02d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Win32.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c9eb7c3219a16948b7520dc7026cf20 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Win64.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3ad7ccc15f481747842885a21b7b4ab 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux: 1 21 | Exclude Linux64: 1 22 | Exclude LinuxUniversal: 1 23 | Exclude OSXUniversal: 1 24 | Exclude Win: 1 25 | Exclude Win64: 0 26 | - first: 27 | Any: 28 | second: 29 | enabled: 1 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 1 35 | settings: 36 | CPU: x86_64 37 | DefaultValueInitialized: true 38 | OS: Windows 39 | - first: 40 | Facebook: Win 41 | second: 42 | enabled: 0 43 | settings: 44 | CPU: None 45 | - first: 46 | Facebook: Win64 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: AnyCPU 51 | - first: 52 | Standalone: Linux 53 | second: 54 | enabled: 0 55 | settings: 56 | CPU: None 57 | - first: 58 | Standalone: Linux64 59 | second: 60 | enabled: 0 61 | settings: 62 | CPU: None 63 | - first: 64 | Standalone: LinuxUniversal 65 | second: 66 | enabled: 0 67 | settings: 68 | CPU: None 69 | - first: 70 | Standalone: OSXUniversal 71 | second: 72 | enabled: 0 73 | settings: 74 | CPU: None 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 0 79 | settings: 80 | CPU: None 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 1 85 | settings: 86 | CPU: AnyCPU 87 | - first: 88 | Windows Store Apps: WindowsStoreApps 89 | second: 90 | enabled: 0 91 | settings: 92 | CPU: AnyCPU 93 | userData: 94 | assetBundleName: 95 | assetBundleVariant: 96 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Win64.pdb.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f57f6707f14421449c3145099b82743 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/Facepunch.Steamworks.Win64.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea452b431085aed499c01339e89fce8b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9eb418beccc204946862a1a8f099ec39 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/linux32.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce9561d2de976e74684ab44c5fec0813 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/linux32/libsteam_api.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/linux32/libsteam_api.so -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/linux32/libsteam_api.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd99b19e202e95a44ace17e10bac2feb 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 1 20 | Exclude Linux: 1 21 | Exclude Linux64: 1 22 | Exclude LinuxUniversal: 1 23 | Exclude OSXUniversal: 1 24 | Exclude Win: 1 25 | Exclude Win64: 1 26 | - first: 27 | Any: 28 | second: 29 | enabled: 0 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 0 35 | settings: 36 | CPU: AnyCPU 37 | DefaultValueInitialized: true 38 | OS: AnyOS 39 | - first: 40 | Facebook: Win 41 | second: 42 | enabled: 0 43 | settings: 44 | CPU: AnyCPU 45 | - first: 46 | Facebook: Win64 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: AnyCPU 51 | - first: 52 | Standalone: Linux 53 | second: 54 | enabled: 0 55 | settings: 56 | CPU: None 57 | - first: 58 | Standalone: Linux64 59 | second: 60 | enabled: 0 61 | settings: 62 | CPU: None 63 | - first: 64 | Standalone: LinuxUniversal 65 | second: 66 | enabled: 0 67 | settings: 68 | CPU: None 69 | - first: 70 | Standalone: OSXUniversal 71 | second: 72 | enabled: 0 73 | settings: 74 | CPU: None 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 0 79 | settings: 80 | CPU: AnyCPU 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 0 85 | settings: 86 | CPU: AnyCPU 87 | userData: 88 | assetBundleName: 89 | assetBundleVariant: 90 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/linux64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b478e6d3d1ef9848b43453c8e68cd0d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/linux64/libsteam_api.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/linux64/libsteam_api.so -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/linux64/libsteam_api.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3b75fd2a03fb3149b60c2040555c3fe 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux: 1 21 | Exclude Linux64: 0 22 | Exclude LinuxUniversal: 0 23 | Exclude OSXUniversal: 1 24 | Exclude Win: 0 25 | Exclude Win64: 0 26 | - first: 27 | Any: 28 | second: 29 | enabled: 1 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 1 35 | settings: 36 | CPU: x86_64 37 | DefaultValueInitialized: true 38 | OS: Linux 39 | - first: 40 | Facebook: Win 41 | second: 42 | enabled: 0 43 | settings: 44 | CPU: AnyCPU 45 | - first: 46 | Facebook: Win64 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: AnyCPU 51 | - first: 52 | Standalone: Linux 53 | second: 54 | enabled: 0 55 | settings: 56 | CPU: None 57 | - first: 58 | Standalone: Linux64 59 | second: 60 | enabled: 1 61 | settings: 62 | CPU: x86_64 63 | - first: 64 | Standalone: LinuxUniversal 65 | second: 66 | enabled: 1 67 | settings: 68 | CPU: x86_64 69 | - first: 70 | Standalone: OSXUniversal 71 | second: 72 | enabled: 0 73 | settings: 74 | CPU: None 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 1 79 | settings: 80 | CPU: AnyCPU 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 1 85 | settings: 86 | CPU: AnyCPU 87 | userData: 88 | assetBundleName: 89 | assetBundleVariant: 90 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/osx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93319165ca0834f41b428adbdad19105 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/osx/libsteam_api.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/osx/libsteam_api.dylib -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/osx/libsteam_api.dylib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d6647fb9d80f5b4f9b2ff1378756bee 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux64: 1 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 1 23 | Exclude Win64: 1 24 | - first: 25 | Any: 26 | second: 27 | enabled: 0 28 | settings: {} 29 | - first: 30 | Editor: Editor 31 | second: 32 | enabled: 1 33 | settings: 34 | CPU: AnyCPU 35 | DefaultValueInitialized: true 36 | OS: AnyOS 37 | - first: 38 | Standalone: Linux64 39 | second: 40 | enabled: 0 41 | settings: 42 | CPU: x86_64 43 | - first: 44 | Standalone: OSXUniversal 45 | second: 46 | enabled: 1 47 | settings: 48 | CPU: AnyCPU 49 | - first: 50 | Standalone: Win 51 | second: 52 | enabled: 0 53 | settings: 54 | CPU: x86 55 | - first: 56 | Standalone: Win64 57 | second: 58 | enabled: 0 59 | settings: 60 | CPU: x86_64 61 | userData: 62 | assetBundleName: 63 | assetBundleVariant: 64 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/steam_api.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/steam_api.dll -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/steam_api.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f47308500f9b7734392a75ff281c7457 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux: 0 21 | Exclude Linux64: 0 22 | Exclude LinuxUniversal: 0 23 | Exclude OSXUniversal: 0 24 | Exclude Win: 0 25 | Exclude Win64: 1 26 | - first: 27 | Any: 28 | second: 29 | enabled: 1 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 1 35 | settings: 36 | CPU: x86 37 | DefaultValueInitialized: true 38 | OS: Windows 39 | - first: 40 | Facebook: Win 41 | second: 42 | enabled: 0 43 | settings: 44 | CPU: AnyCPU 45 | - first: 46 | Facebook: Win64 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: None 51 | - first: 52 | Standalone: Linux 53 | second: 54 | enabled: 1 55 | settings: 56 | CPU: x86 57 | - first: 58 | Standalone: Linux64 59 | second: 60 | enabled: 1 61 | settings: 62 | CPU: x86_64 63 | - first: 64 | Standalone: LinuxUniversal 65 | second: 66 | enabled: 1 67 | settings: 68 | CPU: AnyCPU 69 | - first: 70 | Standalone: OSXUniversal 71 | second: 72 | enabled: 1 73 | settings: 74 | CPU: AnyCPU 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 1 79 | settings: 80 | CPU: AnyCPU 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 0 85 | settings: 86 | CPU: None 87 | userData: 88 | assetBundleName: 89 | assetBundleVariant: 90 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/steam_api.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/steam_api.lib -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/steam_api.lib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ffd5813d91aefd459583d77d2e49ddd 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/win64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4080c4017456bde44a6f4b5915b8d27c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/win64/steam_api64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/win64/steam_api64.dll -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/win64/steam_api64.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf5718c4ee1c31e458f8a58a77f4eef0 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux: 0 21 | Exclude Linux64: 0 22 | Exclude LinuxUniversal: 0 23 | Exclude OSXUniversal: 0 24 | Exclude Win: 1 25 | Exclude Win64: 0 26 | - first: 27 | Any: 28 | second: 29 | enabled: 1 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 1 35 | settings: 36 | CPU: x86_64 37 | DefaultValueInitialized: true 38 | OS: AnyOS 39 | - first: 40 | Facebook: Win 41 | second: 42 | enabled: 0 43 | settings: 44 | CPU: None 45 | - first: 46 | Facebook: Win64 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: AnyCPU 51 | - first: 52 | Standalone: Linux 53 | second: 54 | enabled: 1 55 | settings: 56 | CPU: x86 57 | - first: 58 | Standalone: Linux64 59 | second: 60 | enabled: 1 61 | settings: 62 | CPU: x86_64 63 | - first: 64 | Standalone: LinuxUniversal 65 | second: 66 | enabled: 1 67 | settings: 68 | CPU: AnyCPU 69 | - first: 70 | Standalone: OSXUniversal 71 | second: 72 | enabled: 1 73 | settings: 74 | CPU: AnyCPU 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 0 79 | settings: 80 | CPU: None 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 1 85 | settings: 86 | CPU: AnyCPU 87 | userData: 88 | assetBundleName: 89 | assetBundleVariant: 90 | -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/win64/steam_api64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Facepunch/Facepunch.Steamworks/aa87fe557fa0578b4361bf0f23848d64d0c94a79/UnityPlugin/redistributable_bin/win64/steam_api64.lib -------------------------------------------------------------------------------- /UnityPlugin/redistributable_bin/win64/steam_api64.lib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7f47a56d1502a54aac85b9fadc6741e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------