1 /* 2 * Copyright (c) 2015 Derelict Developers 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the names 'Derelict', 'DerelictILUT', nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 module derelict.steamworks.types; 33 34 import derelict.util.system; 35 import derelict.steamworks.enums; 36 import derelict.steamworks.structs; 37 38 alias int32 = int; 39 alias int64 = long; 40 alias uint64 = ulong; 41 alias int16 = short; 42 alias uint16 = ushort; 43 alias uint32 = uint; 44 alias uint8 = ubyte; 45 46 alias intptr_t = void*; 47 48 alias HSteamPipe = int32; 49 alias HSteamUser = int32; 50 alias HAuthTicket = uint32; 51 alias SteamAPICall_t = uint64; 52 alias FriendsGroupID_t = int16; 53 alias AppId_t = uint32; 54 55 extern(C) nothrow 56 { 57 alias SteamAPIWarningMessageHook_t = void function(int, const char *); 58 alias SteamAPI_CheckCallbackRegistered_t = uint32 function( int iCallbackNum ); 59 } 60 61 alias CSteamID = uint64; 62 alias CGameID = uint64; 63 alias HServerListRequest = void*; 64 alias HServerQuery = int; 65 alias UGCHandle_t = uint64; 66 alias SteamLeaderboard_t = uint64; 67 alias SteamLeaderboardEntries_t = uint64; 68 alias UGCFileWriteStreamHandle_t = uint64; 69 alias PublishedFileUpdateHandle_t = uint64; 70 alias PublishedFileId_t = uint64; 71 alias DepotId_t = uint32; 72 alias SNetListenSocket_t = uint32; 73 alias SNetSocket_t = uint32; 74 alias ScreenshotHandle = uint32; 75 alias HTTPRequestHandle = uint32; 76 alias HTTPCookieContainerHandle = uint32; 77 alias ClientUnifiedMessageHandle = uint64; 78 alias UGCQueryHandle_t = uint64; 79 alias UGCUpdateHandle_t = uint64; 80 alias AccountID_t = uint32; 81 alias HHTMLBrowser = uint32; 82 alias RTime32 = uint32; 83 alias SteamInventoryResult_t = int32; 84 alias SteamItemInstanceID_t = uint64; 85 alias SteamItemDef_t = int32; 86 87 struct ISteamGameServer{} 88 struct ISteamMatchmaking{} 89 struct ISteamMatchmakingServers{} 90 struct ISteamUserStats{} 91 struct ISteamGameServerStats{} 92 struct ISteamApps{} 93 struct ISteamNetworking{} 94 struct ISteamRemoteStorage{} 95 struct ISteamScreenshots{} 96 struct ISteamHTTP{} 97 struct ISteamUnifiedMessages{} 98 struct ISteamController{} 99 struct ISteamUGC{} 100 struct ISteamAppList{} 101 struct ISteamMusic{} 102 struct ISteamMusicRemote{} 103 struct ISteamHTMLSurface{} 104 struct ISteamInventory{} 105 struct ISteamVideo{} 106 struct ISteamUtils{} 107 struct ISteamClient{} 108 struct ISteamUser{} 109 struct ISteamFriends{} 110 111 static immutable int k_cbMaxGameServerGameDir = 32; 112 static immutable int k_cbMaxGameServerMapName = 32; 113 static immutable int k_cbMaxGameServerGameDescription = 64; 114 static immutable int k_cbMaxGameServerName = 64; 115 static immutable int k_cbMaxGameServerTags = 128; 116 static immutable int k_cbMaxGameServerGameData = 2048; 117 118 interface ISteamMatchmakingServerListResponse 119 { 120 // Server has responded ok with updated data 121 void ServerResponded( HServerListRequest hRequest, int iServer ); 122 123 // Server has failed to respond 124 void ServerFailedToRespond( HServerListRequest hRequest, int iServer ); 125 126 // A list refresh you had initiated is now 100% completed 127 void RefreshComplete( HServerListRequest hRequest, EMatchMakingServerResponse response ); 128 } 129 130 interface ISteamMatchmakingPingResponse 131 { 132 // Server has responded successfully and has updated data 133 void ServerResponded( gameserveritem_t* server ); 134 135 // Server failed to respond to the ping request 136 void ServerFailedToRespond(); 137 } 138 139 interface ISteamMatchmakingPlayersResponse 140 { 141 // Got data on a new player on the server -- you'll get this callback once per player 142 // on the server which you have requested player data on. 143 void AddPlayerToList( const(char)* pchName, int nScore, float flTimePlayed ); 144 145 // The server failed to respond to the request for player details 146 void PlayersFailedToRespond(); 147 148 // The server has finished responding to the player details request 149 // (ie, you won't get anymore AddPlayerToList callbacks) 150 void PlayersRefreshComplete(); 151 } 152 153 interface ISteamMatchmakingRulesResponse 154 { 155 // Got data on a rule on the server -- you'll get one of these per rule defined on 156 // the server you are querying 157 void RulesResponded( const(char)* pchRule, const(char)* pchValue ); 158 159 // The server failed to respond to the request for rule details 160 void RulesFailedToRespond(); 161 162 // The server has finished responding to the rule details request 163 // (ie, you won't get anymore RulesResponded callbacks) 164 void RulesRefreshComplete(); 165 } 166 167 static immutable const(char)* STEAMAPPLIST_INTERFACE_VERSION = "STEAMAPPLIST_INTERFACE_VERSION001"; 168 static immutable const(char)* STEAMAPPS_INTERFACE_VERSION = "STEAMAPPS_INTERFACE_VERSION008"; 169 static immutable const(char)* STEAMAPPTICKET_INTERFACE_VERSION = "STEAMAPPTICKET_INTERFACE_VERSION001"; 170 static immutable const(char)* STEAMCLIENT_INTERFACE_VERSION = "SteamClient017"; 171 static immutable const(char)* STEAMFRIENDS_INTERFACE_VERSION = "SteamFriends015"; 172 static immutable const(char)* STEAMGAMECOORDINATOR_INTERFACE_VERSION = "SteamGameCoordinator001"; 173 static immutable const(char)* STEAMGAMESERVER_INTERFACE_VERSION = "SteamGameServer012"; 174 static immutable const(char)* STEAMGAMESERVERSTATS_INTERFACE_VERSION = "SteamGameServerStats001"; 175 static immutable const(char)* STEAMHTMLSURFACE_INTERFACE_VERSION = "STEAMHTMLSURFACE_INTERFACE_VERSION_003"; 176 static immutable const(char)* STEAMHTTP_INTERFACE_VERSION = "STEAMHTTP_INTERFACE_VERSION002"; 177 static immutable const(char)* STEAMMATCHMAKING_INTERFACE_VERSION = "SteamMatchMaking009"; 178 static immutable const(char)* STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION = "SteamMatchMakingServers002"; 179 static immutable const(char)* STEAMMUSIC_INTERFACE_VERSION = "STEAMMUSIC_INTERFACE_VERSION001"; 180 static immutable const(char)* STEAMMUSICREMOTE_INTERFACE_VERSION = "STEAMMUSICREMOTE_INTERFACE_VERSION001"; 181 static immutable const(char)* STEAMNETWORKING_INTERFACE_VERSION = "SteamNetworking005"; 182 static immutable const(char)* STEAMUNIFIEDMESSAGES_INTERFACE_VERSION = "STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001"; 183 static immutable const(char)* STEAMUSER_INTERFACE_VERSION = "SteamUser019"; 184 static immutable const(char)* STEAMUSERSTATS_INTERFACE_VERSION = "STEAMUSERSTATS_INTERFACE_VERSION011"; 185 static immutable const(char)* STEAMVIDEO_INTERFACE_VERSION = "STEAMVIDEO_INTERFACE_V002"; 186 187 static immutable uint32 k_cchPublishedDocumentTitleMax = 128 + 1; 188 static immutable uint32 k_cchPublishedDocumentDescriptionMax = 8000; 189 static immutable uint32 k_cchPublishedDocumentChangeDescriptionMax = 8000; 190 static immutable uint32 k_unEnumeratePublishedFilesMaxResults = 50; 191 static immutable uint32 k_cchTagListMax = 1024 + 1; 192 static immutable uint32 k_cchFilenameMax = 260; 193 static immutable uint32 k_cchPublishedFileURLMax = 256;