Merge remote-tracking branch 'Mr_Goldberg/master' into overlay_h

merge-requests/28/head
Nemirtingas 2020-01-10 08:16:16 +01:00
commit 118dee9278
81 changed files with 2782 additions and 204 deletions

View File

@ -84,6 +84,9 @@ build_windows:
- wine cmd /c build_win_release.bat - wine cmd /c build_win_release.bat
- mkdir release/debug_experimental - mkdir release/debug_experimental
- mv steam_api.dll steam_api64.dll release/debug_experimental/ - mv steam_api.dll steam_api64.dll release/debug_experimental/
- wine cmd /c build_win_debug_experimental_steamclient.bat
- mkdir release/debug_experimental_steamclient
- mv steamclient.dll steamclient64.dll release/debug_experimental_steamclient/
- cp Readme_debug.txt release/debug_experimental/Readme.txt - cp Readme_debug.txt release/debug_experimental/Readme.txt
artifacts: artifacts:
paths: paths:

View File

@ -120,6 +120,9 @@ If you look at: steamcontrollerconfigdetails, you will see something like: 17796
1779660455 refers to a file id that you can dl using your favorite steam workshop downloader site. 1779660455 refers to a file id that you can dl using your favorite steam workshop downloader site.
The url would be: https://steamcommunity.com/sharedfiles/filedetails/?id=1779660455 The url would be: https://steamcommunity.com/sharedfiles/filedetails/?id=1779660455
The glyphs directory contains some glyphs for the controller buttons for the games that use the GetGlyphForActionOrigin function.
If you want to use the real steam glyphs instead of the free ones in the example directory copy them from: <Steam Directory>\tenfoot\resource\images\library\controller\api folder.
Valid digital button names: Valid digital button names:
DUP DUP
DDOWN DDOWN

View File

@ -5,9 +5,12 @@ mkdir -p linux/x86_64
mkdir -p linux/lobby_connect mkdir -p linux/lobby_connect
mkdir -p linux/tools mkdir -p linux/tools
cp scripts/find_interfaces.sh linux/tools/ cp scripts/find_interfaces.sh linux/tools/
cp scripts/steamclient_loader.sh linux/tools/
../protobuf/prefix_x86/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto ../protobuf/prefix_x86/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto
g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -s -o linux/x86/libsteam_api.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -std=c++11 && echo built32 g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -s -o linux/x86/libsteam_api.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -std=c++11 && echo built32
g++ -m32 -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -s -o linux/x86/steamclient.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -std=c++11 && echo built32_steamclient
g++ -m32 -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x86 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -std=c++11 && echo built_lobby_connect32 g++ -m32 -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x86 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix_x86/include/ -L../protobuf/prefix_x86/lib/ -lprotobuf-lite -lpthread -std=c++11 && echo built_lobby_connect32
../protobuf/prefix/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto ../protobuf/prefix/bin/protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto
g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -s -o linux/x86_64/libsteam_api.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -std=c++11 && echo built64 g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -s -o linux/x86_64/libsteam_api.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -std=c++11 && echo built64
g++ -shared -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DSTEAMCLIENT_DLL -DNDEBUG -s -o linux/x86_64/steamclient.so dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -std=c++11 && echo built64_steamclient
g++ -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x64 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -std=c++11 && echo built_lobby_connect64 g++ -fvisibility=hidden -Wl,--exclude-libs,ALL -DGNUC -DNO_OVERLAY -DEMU_RELEASE_BUILD -DNDEBUG -DNO_DISK_WRITES -DLOBBY_CONNECT -s -o linux/lobby_connect/lobby_connect_x64 lobby_connect.cpp dll/*.cpp dll/*.cc -Wno-return-type -I../protobuf/prefix/include/ -L../protobuf/prefix/lib/ -lprotobuf-lite -lpthread -std=c++11 && echo built_lobby_connect64

View File

@ -0,0 +1,11 @@
cd /d "%~dp0"
call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /I%PROTOBUF_X86_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c "%PROTOBUF_X86_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /link /OUT:steamclient.dll
cl /LD steamnetworkingsockets.cpp /EHsc /MP12 /link /OUT:steamnetworkingsockets.dll
call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /I%PROTOBUF_X64_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c "%PROTOBUF_X64_LIBRARY%" Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib /EHsc /MP12 /link /OUT:steamclient64.dll
cl /LD steamnetworkingsockets.cpp /EHsc /MP12 /link /OUT:steamnetworkingsockets64.dll

View File

@ -126,27 +126,27 @@ static unsigned generate_account_id()
CSteamID generate_steam_id_user() CSteamID generate_steam_id_user()
{ {
return CSteamID(generate_account_id(), k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeIndividual); return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance, k_EUniversePublic, k_EAccountTypeIndividual);
} }
static CSteamID generate_steam_anon_user() static CSteamID generate_steam_anon_user()
{ {
return CSteamID(generate_account_id(), k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeAnonUser); return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance, k_EUniversePublic, k_EAccountTypeAnonUser);
} }
CSteamID generate_steam_id_server() CSteamID generate_steam_id_server()
{ {
return CSteamID(generate_account_id(), k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeGameServer); return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance, k_EUniversePublic, k_EAccountTypeGameServer);
} }
CSteamID generate_steam_id_anonserver() CSteamID generate_steam_id_anonserver()
{ {
return CSteamID(generate_account_id(), k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeAnonGameServer); return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance, k_EUniversePublic, k_EAccountTypeAnonGameServer);
} }
CSteamID generate_steam_id_lobby() CSteamID generate_steam_id_lobby()
{ {
return CSteamID(generate_account_id(), k_unSteamUserDesktopInstance | k_EChatInstanceFlagLobby, k_EUniversePublic, k_EAccountTypeChat); return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance | k_EChatInstanceFlagLobby, k_EUniversePublic, k_EAccountTypeChat);
} }
#ifndef STEAM_WIN32 #ifndef STEAM_WIN32

View File

@ -445,14 +445,7 @@ public:
void runCallBacks() { void runCallBacks() {
for (auto & c : callbacks) { for (auto & c : callbacks) {
std::vector<std::vector<char>> res_back = c.second.results;
c.second.results.clear(); c.second.results.clear();
for (auto r : res_back) {
for (auto cb: c.second.callbacks) {
//PRINT_DEBUG("Calling callback %i\n", cb->GetICallback());
//cb->Run(&(r[0]));
}
}
} }
} }
}; };

View File

@ -162,6 +162,8 @@ static void *create_client_interface(const char *ver)
steam_client = (ISteamClient017 *)get_steam_client(); steam_client = (ISteamClient017 *)get_steam_client();
} else if (strcmp(ver, "SteamClient018") == 0) { } else if (strcmp(ver, "SteamClient018") == 0) {
steam_client = (ISteamClient018 *)get_steam_client(); steam_client = (ISteamClient018 *)get_steam_client();
} else if (strcmp(ver, "SteamClient019") == 0) {
steam_client = (ISteamClient019 *)get_steam_client();
} else if (strcmp(ver, STEAMCLIENT_INTERFACE_VERSION) == 0) { } else if (strcmp(ver, STEAMCLIENT_INTERFACE_VERSION) == 0) {
steam_client = (ISteamClient *)get_steam_client(); steam_client = (ISteamClient *)get_steam_client();
} else { } else {

View File

@ -19,7 +19,7 @@
#ifdef STEAMCLIENT_DLL #ifdef STEAMCLIENT_DLL
#define STEAMAPI_API static #define STEAMAPI_API static
#define STEAMCLIENT_API S_API #define STEAMCLIENT_API S_API_EXPORT
#else #else
#define STEAMAPI_API S_API #define STEAMAPI_API S_API
#define STEAMCLIENT_API static #define STEAMCLIENT_API static

View File

@ -54,6 +54,8 @@ STEAMAPI_API class ISteamGameServer * SteamAPI_ISteamClient_GetISteamGameServer(
STEAMAPI_API void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, uint32 unIP, uint16 usPort) STEAMAPI_API void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, uint32 unIP, uint16 usPort)
{ {
//Note: this function was updated but currently doesn't do anything so I'm just leaving it like this for now.
//void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, const struct SteamIPAddress_t & unIP, uint16 usPort)
return get_steam_client()->SetLocalIPBinding(unIP, usPort); return get_steam_client()->SetLocalIPBinding(unIP, usPort);
} }
@ -1106,6 +1108,18 @@ STEAMAPI_API int SteamAPI_ISteamUtils_FilterText(intptr_t instancePtr, char * pc
return (ptr)->FilterText(pchOutFilteredText, nByteSizeOutFilteredText, pchInputMessage, bLegalOnly); return (ptr)->FilterText(pchOutFilteredText, nByteSizeOutFilteredText, pchInputMessage, bLegalOnly);
} }
STEAMAPI_API ESteamIPv6ConnectivityState SteamAPI_ISteamUtils_GetIPv6ConnectivityState(intptr_t instancePtr, ESteamIPv6ConnectivityProtocol eProtocol)
{
int test1 = ((char *)instancePtr - (char*)get_steam_client()->steam_utils);
int test2 = ((char *)instancePtr - (char*)get_steam_client()->steam_gameserver_utils);
auto ptr = get_steam_client()->steam_gameserver_utils;
if (test1 >= 0 && (test2 < 0 || test1 < test2)) {
ptr = get_steam_client()->steam_utils;
}
return (ptr)->GetIPv6ConnectivityState(eProtocol);
}
STEAMAPI_API int SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(intptr_t instancePtr) STEAMAPI_API int SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(intptr_t instancePtr)
{ {
return (get_steam_client()->steam_matchmaking)->GetFavoriteGameCount(); return (get_steam_client()->steam_matchmaking)->GetFavoriteGameCount();
@ -2236,7 +2250,7 @@ STEAMAPI_API bool SteamAPI_ISteamNetworking_AllowP2PPacketRelay(intptr_t instanc
return ((ISteamNetworking *)instancePtr)->AllowP2PPacketRelay(bAllow); return ((ISteamNetworking *)instancePtr)->AllowP2PPacketRelay(bAllow);
} }
STEAMAPI_API SNetListenSocket_t SteamAPI_ISteamNetworking_CreateListenSocket(intptr_t instancePtr, int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay) STEAMAPI_API SNetListenSocket_t SteamAPI_ISteamNetworking_CreateListenSocket(intptr_t instancePtr, int nVirtualP2PPort, struct SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay)
{ {
return ((ISteamNetworking *)instancePtr)->CreateListenSocket(nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay); return ((ISteamNetworking *)instancePtr)->CreateListenSocket(nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay);
} }
@ -2246,7 +2260,7 @@ STEAMAPI_API SNetSocket_t SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(in
return ((ISteamNetworking *)instancePtr)->CreateP2PConnectionSocket(steamIDTarget, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay); return ((ISteamNetworking *)instancePtr)->CreateP2PConnectionSocket(steamIDTarget, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay);
} }
STEAMAPI_API SNetSocket_t SteamAPI_ISteamNetworking_CreateConnectionSocket(intptr_t instancePtr, uint32 nIP, uint16 nPort, int nTimeoutSec) STEAMAPI_API SNetSocket_t SteamAPI_ISteamNetworking_CreateConnectionSocket(intptr_t instancePtr, struct SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec)
{ {
return ((ISteamNetworking *)instancePtr)->CreateConnectionSocket(nIP, nPort, nTimeoutSec); return ((ISteamNetworking *)instancePtr)->CreateConnectionSocket(nIP, nPort, nTimeoutSec);
} }
@ -2286,12 +2300,12 @@ STEAMAPI_API bool SteamAPI_ISteamNetworking_RetrieveData(intptr_t instancePtr, S
return ((ISteamNetworking *)instancePtr)->RetrieveData(hListenSocket, pubDest, cubDest, pcubMsgSize, phSocket); return ((ISteamNetworking *)instancePtr)->RetrieveData(hListenSocket, pubDest, cubDest, pcubMsgSize, phSocket);
} }
STEAMAPI_API bool SteamAPI_ISteamNetworking_GetSocketInfo(intptr_t instancePtr, SNetSocket_t hSocket, class CSteamID * pSteamIDRemote, int * peSocketStatus, uint32 * punIPRemote, uint16 * punPortRemote) STEAMAPI_API bool SteamAPI_ISteamNetworking_GetSocketInfo(intptr_t instancePtr, SNetSocket_t hSocket, class CSteamID * pSteamIDRemote, int * peSocketStatus, struct SteamIPAddress_t * punIPRemote, uint16 * punPortRemote)
{ {
return ((ISteamNetworking *)instancePtr)->GetSocketInfo(hSocket, pSteamIDRemote, peSocketStatus, punIPRemote, punPortRemote); return ((ISteamNetworking *)instancePtr)->GetSocketInfo(hSocket, pSteamIDRemote, peSocketStatus, punIPRemote, punPortRemote);
} }
STEAMAPI_API bool SteamAPI_ISteamNetworking_GetListenSocketInfo(intptr_t instancePtr, SNetListenSocket_t hListenSocket, uint32 * pnIP, uint16 * pnPort) STEAMAPI_API bool SteamAPI_ISteamNetworking_GetListenSocketInfo(intptr_t instancePtr, SNetListenSocket_t hListenSocket, struct SteamIPAddress_t * pnIP, uint16 * pnPort)
{ {
return ((ISteamNetworking *)instancePtr)->GetListenSocketInfo(hListenSocket, pnIP, pnPort); return ((ISteamNetworking *)instancePtr)->GetListenSocketInfo(hListenSocket, pnIP, pnPort);
} }
@ -2306,6 +2320,7 @@ STEAMAPI_API int SteamAPI_ISteamNetworking_GetMaxPacketSize(intptr_t instancePtr
return ((ISteamNetworking *)instancePtr)->GetMaxPacketSize(hSocket); return ((ISteamNetworking *)instancePtr)->GetMaxPacketSize(hSocket);
} }
STEAMAPI_API ScreenshotHandle SteamAPI_ISteamScreenshots_WriteScreenshot(intptr_t instancePtr, void * pubRGB, uint32 cubRGB, int nWidth, int nHeight) STEAMAPI_API ScreenshotHandle SteamAPI_ISteamScreenshots_WriteScreenshot(intptr_t instancePtr, void * pubRGB, uint32 cubRGB, int nWidth, int nHeight)
{ {
return (get_steam_client()->steam_screenshots)->WriteScreenshot(pubRGB, cubRGB, nWidth, nHeight); return (get_steam_client()->steam_screenshots)->WriteScreenshot(pubRGB, cubRGB, nWidth, nHeight);
@ -3230,6 +3245,19 @@ STEAMAPI_API bool SteamAPI_ISteamUGC_AddRequiredTag(intptr_t instancePtr, UGCQue
return (ptr)->AddRequiredTag(handle, pTagName); return (ptr)->AddRequiredTag(handle, pTagName);
} }
STEAMAPI_API bool SteamAPI_ISteamUGC_AddRequiredTagGroup(intptr_t instancePtr, UGCQueryHandle_t handle, const struct SteamParamStringArray_t * pTagGroups)
{
int test1 = ((char *)instancePtr - (char*)get_steam_client()->steam_ugc);
int test2 = ((char *)instancePtr - (char*)get_steam_client()->steam_gameserver_ugc);
auto ptr = get_steam_client()->steam_gameserver_ugc;
if (test1 >= 0 && (test2 < 0 || test1 < test2)) {
ptr = get_steam_client()->steam_ugc;
}
return (ptr)->AddRequiredTagGroup(handle, pTagGroups);
}
STEAMAPI_API bool SteamAPI_ISteamUGC_AddExcludedTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName) STEAMAPI_API bool SteamAPI_ISteamUGC_AddExcludedTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName)
{ {
int test1 = ((char *)instancePtr - (char*)get_steam_client()->steam_ugc); int test1 = ((char *)instancePtr - (char*)get_steam_client()->steam_ugc);
@ -4671,31 +4699,36 @@ STEAMAPI_API uint32 SteamAPI_ISteamRemotePlay_GetSessionCount(intptr_t instanceP
return ((ISteamRemotePlay *)instancePtr)->GetSessionCount(); return ((ISteamRemotePlay *)instancePtr)->GetSessionCount();
} }
STEAMAPI_API uint32 SteamAPI_ISteamRemotePlay_GetSessionID(intptr_t instancePtr, int iSessionIndex) STEAMAPI_API RemotePlaySessionID_t SteamAPI_ISteamRemotePlay_GetSessionID(intptr_t instancePtr, int iSessionIndex)
{ {
return ((ISteamRemotePlay *)instancePtr)->GetSessionID(iSessionIndex); return ((ISteamRemotePlay *)instancePtr)->GetSessionID(iSessionIndex);
} }
STEAMAPI_API uint64 SteamAPI_ISteamRemotePlay_GetSessionSteamID(intptr_t instancePtr, uint32 unSessionID) STEAMAPI_API uint64 SteamAPI_ISteamRemotePlay_GetSessionSteamID(intptr_t instancePtr, RemotePlaySessionID_t unSessionID)
{ {
return ((ISteamRemotePlay *)instancePtr)->GetSessionSteamID(unSessionID).ConvertToUint64(); return ((ISteamRemotePlay *)instancePtr)->GetSessionSteamID(unSessionID).ConvertToUint64();
} }
STEAMAPI_API const char * SteamAPI_ISteamRemotePlay_GetSessionClientName(intptr_t instancePtr, uint32 unSessionID) STEAMAPI_API const char * SteamAPI_ISteamRemotePlay_GetSessionClientName(intptr_t instancePtr, RemotePlaySessionID_t unSessionID)
{ {
return ((ISteamRemotePlay *)instancePtr)->GetSessionClientName(unSessionID); return ((ISteamRemotePlay *)instancePtr)->GetSessionClientName(unSessionID);
} }
STEAMAPI_API ESteamDeviceFormFactor SteamAPI_ISteamRemotePlay_GetSessionClientFormFactor(intptr_t instancePtr, uint32 unSessionID) STEAMAPI_API ESteamDeviceFormFactor SteamAPI_ISteamRemotePlay_GetSessionClientFormFactor(intptr_t instancePtr, RemotePlaySessionID_t unSessionID)
{ {
return ((ISteamRemotePlay *)instancePtr)->GetSessionClientFormFactor(unSessionID); return ((ISteamRemotePlay *)instancePtr)->GetSessionClientFormFactor(unSessionID);
} }
STEAMAPI_API bool SteamAPI_ISteamRemotePlay_BGetSessionClientResolution(intptr_t instancePtr, uint32 unSessionID, int * pnResolutionX, int * pnResolutionY) STEAMAPI_API bool SteamAPI_ISteamRemotePlay_BGetSessionClientResolution(intptr_t instancePtr, RemotePlaySessionID_t unSessionID, int * pnResolutionX, int * pnResolutionY)
{ {
return ((ISteamRemotePlay *)instancePtr)->BGetSessionClientResolution(unSessionID, pnResolutionX, pnResolutionY); return ((ISteamRemotePlay *)instancePtr)->BGetSessionClientResolution(unSessionID, pnResolutionX, pnResolutionY);
} }
STEAMAPI_API bool SteamAPI_ISteamRemotePlay_BSendRemotePlayTogetherInvite(intptr_t instancePtr, class CSteamID steamIDFriend)
{
return ((ISteamRemotePlay *)instancePtr)->BSendRemotePlayTogetherInvite(steamIDFriend);
}
STEAMAPI_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString) STEAMAPI_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString)
{ {
return ((ISteamGameServer *)instancePtr)->InitGameServer(unIP, usGamePort, usQueryPort, unFlags, nGameAppId, pchVersionString); return ((ISteamGameServer *)instancePtr)->InitGameServer(unIP, usGamePort, usQueryPort, unFlags, nGameAppId, pchVersionString);
@ -4876,8 +4909,9 @@ STEAMAPI_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation(intptr
return ((ISteamGameServer *)instancePtr)->GetServerReputation(); return ((ISteamGameServer *)instancePtr)->GetServerReputation();
} }
STEAMAPI_API uint32 SteamAPI_ISteamGameServer_GetPublicIP(intptr_t instancePtr) STEAMAPI_API struct SteamIPAddress_t SteamAPI_ISteamGameServer_GetPublicIP(intptr_t instancePtr)
{ {
//TODO: check if this actually works (ret value changed from uint32 to struct)
return ((ISteamGameServer *)instancePtr)->GetPublicIP(); return ((ISteamGameServer *)instancePtr)->GetPublicIP();
} }

View File

@ -45,6 +45,45 @@ static IP_PORT broadcasts[MAX_BROADCASTS];
#include <iphlpapi.h> #include <iphlpapi.h>
//windows xp support
static int
inet_pton4(const char *src, uint32_t *dst)
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
u_char tmp[sizeof(uint32_t)], *tp;
saw_digit = 0;
octets = 0;
*(tp = tmp) = 0;
while ((ch = *src++) != '\0') {
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
size_t nx = *tp * 10 + (pch - digits);
if (nx > 255)
return (0);
*tp = (u_char) nx;
if (! saw_digit) {
if (++octets > 4)
return (0);
saw_digit = 1;
}
} else if (ch == '.' && saw_digit) {
if (octets == 4)
return (0);
*++tp = 0;
saw_digit = 0;
} else
return (0);
}
if (octets < 4)
return (0);
memcpy(dst, tmp, sizeof(uint32_t));
return (1);
}
static void get_broadcast_info(uint16 port) static void get_broadcast_info(uint16 port)
{ {
number_broadcasts = 0; number_broadcasts = 0;
@ -71,13 +110,11 @@ static void get_broadcast_info(uint16 port)
IP_ADAPTER_INFO *pAdapter = pAdapterInfo; IP_ADAPTER_INFO *pAdapter = pAdapterInfo;
while (pAdapter) { while (pAdapter) {
unsigned long iface_ip = 0, subnet_mask = 0; uint32_t iface_ip = 0, subnet_mask = 0;
if (inet_pton4(pAdapter->IpAddressList.IpMask.String, &subnet_mask) == 1
if (inet_pton(AF_INET, pAdapter->IpAddressList.IpMask.String, &subnet_mask) == 1 && inet_pton4(pAdapter->IpAddressList.IpAddress.String, &iface_ip) == 1) {
&& inet_pton(AF_INET, pAdapter->IpAddressList.IpAddress.String, &iface_ip) == 1) {
IP_PORT *ip_port = &broadcasts[number_broadcasts]; IP_PORT *ip_port = &broadcasts[number_broadcasts];
//ip_port->ip.family = AF_INET;
uint32 broadcast_ip = iface_ip | ~subnet_mask; uint32 broadcast_ip = iface_ip | ~subnet_mask;
ip_port->ip = broadcast_ip; ip_port->ip = broadcast_ip;
ip_port->port = port; ip_port->port = port;
@ -221,6 +258,11 @@ static void run_at_startup()
WSADATA wsaData; WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != NO_ERROR) if (WSAStartup(MAKEWORD(2, 2), &wsaData) != NO_ERROR)
return; return;
for (int i = 0; i < 10; ++i) {
//hack: the game Full Mojo Rampage calls WSACleanup on startup so we call WSAStartup a few times so it doesn't get deallocated.
WSAStartup(MAKEWORD(2, 2), &wsaData);
}
#else #else
#endif #endif

View File

@ -135,6 +135,7 @@ public:
//controller //controller
struct Controller_Settings controller_settings; struct Controller_Settings controller_settings;
std::string glyphs_directory;
//networking //networking
bool disable_networking = false; bool disable_networking = false;

View File

@ -104,6 +104,8 @@ static void load_gamecontroller_settings(Settings *settings)
PRINT_DEBUG("Added %u action names to %s\n", button_pairs.size(), action_set_name.c_str()); PRINT_DEBUG("Added %u action names to %s\n", button_pairs.size(), action_set_name.c_str());
} }
} }
settings->glyphs_directory = path + (PATH_SEPARATOR "glyphs" PATH_SEPARATOR);
} }
uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out) uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out)

View File

@ -213,9 +213,8 @@ uint32 Steam_Apps::GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uin
// returns current app install folder for AppID, returns folder name length // returns current app install folder for AppID, returns folder name length
uint32 Steam_Apps::GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) uint32 Steam_Apps::GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize )
{ {
PRINT_DEBUG("GetAppInstallDir %u %u\n", appID, cchFolderBufferSize); PRINT_DEBUG("GetAppInstallDir %u %p %u\n", appID, pchFolder, cchFolderBufferSize);
//TODO return real path instead of dll path //TODO return real path instead of dll path
if (!pchFolder || !cchFolderBufferSize) return 0;
std::string installed_path = settings->getAppInstallPath(appID); std::string installed_path = settings->getAppInstallPath(appID);
if (installed_path.size() == 0) { if (installed_path.size() == 0) {
@ -232,8 +231,11 @@ uint32 Steam_Apps::GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchF
} }
PRINT_DEBUG("path %s\n", installed_path.c_str()); PRINT_DEBUG("path %s\n", installed_path.c_str());
if (cchFolderBufferSize && pchFolder) {
snprintf(pchFolder, cchFolderBufferSize, "%s", installed_path.c_str()); snprintf(pchFolder, cchFolderBufferSize, "%s", installed_path.c_str());
return strlen(pchFolder); }
return installed_path.length(); //Real steam always returns the actual path length, not the copied one.
} }
// returns true if that app is installed (not necessarily owned) // returns true if that app is installed (not necessarily owned)

View File

@ -169,6 +169,7 @@ HSteamPipe Steam_Client::CreateSteamPipe()
bool Steam_Client::BReleaseSteamPipe( HSteamPipe hSteamPipe ) bool Steam_Client::BReleaseSteamPipe( HSteamPipe hSteamPipe )
{ {
PRINT_DEBUG("BReleaseSteamPipe\n"); PRINT_DEBUG("BReleaseSteamPipe\n");
return true;
} }
// connects to an existing global user, failing if none exists // connects to an existing global user, failing if none exists
@ -263,6 +264,8 @@ ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSte
return (ISteamGameServer *)(void *)(ISteamGameServer010 *)steam_gameserver; return (ISteamGameServer *)(void *)(ISteamGameServer010 *)steam_gameserver;
} else if (strcmp(pchVersion, "SteamGameServer011") == 0) { } else if (strcmp(pchVersion, "SteamGameServer011") == 0) {
return (ISteamGameServer *)(void *)(ISteamGameServer011 *)steam_gameserver; return (ISteamGameServer *)(void *)(ISteamGameServer011 *)steam_gameserver;
} else if (strcmp(pchVersion, "SteamGameServer012") == 0) {
return (ISteamGameServer *)(void *)(ISteamGameServer012 *)steam_gameserver;
} else if (strcmp(pchVersion, STEAMGAMESERVER_INTERFACE_VERSION) == 0) { } else if (strcmp(pchVersion, STEAMGAMESERVER_INTERFACE_VERSION) == 0) {
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver; return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
} else { } else {
@ -276,7 +279,12 @@ ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSte
// this must be set before CreateLocalUser() // this must be set before CreateLocalUser()
void Steam_Client::SetLocalIPBinding( uint32 unIP, uint16 usPort ) void Steam_Client::SetLocalIPBinding( uint32 unIP, uint16 usPort )
{ {
PRINT_DEBUG("SetLocalIPBinding %u %hu\n", unIP, usPort); PRINT_DEBUG("SetLocalIPBinding old %u %hu\n", unIP, usPort);
}
void Steam_Client::SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort )
{
PRINT_DEBUG("SetLocalIPBinding %i %u %hu\n", unIP.m_eType, unIP.m_unIPv4, usPort);
} }
// returns the ISteamFriends interface // returns the ISteamFriends interface
@ -444,6 +452,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
return (void *)(ISteamNetworkingSockets001 *) steam_networking_sockets_temp; return (void *)(ISteamNetworkingSockets001 *) steam_networking_sockets_temp;
} else if (strcmp(pchVersion, "SteamNetworkingSockets002") == 0) { } else if (strcmp(pchVersion, "SteamNetworkingSockets002") == 0) {
return (void *)(ISteamNetworkingSockets002 *) steam_networking_sockets_temp; return (void *)(ISteamNetworkingSockets002 *) steam_networking_sockets_temp;
} else if (strcmp(pchVersion, "SteamNetworkingSockets003") == 0) {
return (void *)(ISteamNetworkingSockets003 *) steam_networking_sockets_temp;
} else { } else {
return (void *)(ISteamNetworkingSockets *) steam_networking_sockets_temp; return (void *)(ISteamNetworkingSockets *) steam_networking_sockets_temp;
} }
@ -459,6 +469,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
} else if (strstr(pchVersion, "SteamNetworkingUtils") == pchVersion) { } else if (strstr(pchVersion, "SteamNetworkingUtils") == pchVersion) {
if (strcmp(pchVersion, "SteamNetworkingUtils001") == 0) { if (strcmp(pchVersion, "SteamNetworkingUtils001") == 0) {
return (void *)(ISteamNetworkingUtils001 *)steam_networking_utils; return (void *)(ISteamNetworkingUtils001 *)steam_networking_utils;
} else if (strcmp(pchVersion, "SteamNetworkingUtils002") == 0) {
return (void *)(ISteamNetworkingUtils002 *)steam_networking_utils;
} else if (strcmp(pchVersion, STEAMNETWORKINGUTILS_INTERFACE_VERSION) == 0) { } else if (strcmp(pchVersion, STEAMNETWORKINGUTILS_INTERFACE_VERSION) == 0) {
return (void *)(ISteamNetworkingUtils *)steam_networking_utils; return (void *)(ISteamNetworkingUtils *)steam_networking_utils;
} else { } else {
@ -606,6 +618,8 @@ ISteamNetworking *Steam_Client::GetISteamNetworking( HSteamUser hSteamUser, HSte
return (ISteamNetworking *)(void *)(ISteamNetworking003 *)steam_networking_temp; return (ISteamNetworking *)(void *)(ISteamNetworking003 *)steam_networking_temp;
} else if (strcmp(pchVersion, "SteamNetworking004") == 0) { } else if (strcmp(pchVersion, "SteamNetworking004") == 0) {
return (ISteamNetworking *)(void *)(ISteamNetworking004 *)steam_networking_temp; return (ISteamNetworking *)(void *)(ISteamNetworking004 *)steam_networking_temp;
} else if (strcmp(pchVersion, "SteamNetworking005") == 0) {
return (ISteamNetworking *)(void *)(ISteamNetworking005 *)steam_networking_temp;
} else if (strcmp(pchVersion, STEAMUGC_INTERFACE_VERSION) == 0) { } else if (strcmp(pchVersion, STEAMUGC_INTERFACE_VERSION) == 0) {
return (ISteamNetworking *)(void *)(ISteamNetworking *)steam_networking_temp; return (ISteamNetworking *)(void *)(ISteamNetworking *)steam_networking_temp;
} else { } else {
@ -793,6 +807,8 @@ ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamP
return (ISteamUGC *)(void *)(ISteamUGC012 *)steam_ugc_temp; return (ISteamUGC *)(void *)(ISteamUGC012 *)steam_ugc_temp;
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION012") == 0) { } else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION012") == 0) {
return (ISteamUGC *)(void *)(ISteamUGC012 *)steam_ugc_temp; return (ISteamUGC *)(void *)(ISteamUGC012 *)steam_ugc_temp;
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION013") == 0) {
return (ISteamUGC *)(void *)(ISteamUGC013 *)steam_ugc_temp;
} else if (strcmp(pchVersion, STEAMUGC_INTERFACE_VERSION) == 0) { } else if (strcmp(pchVersion, STEAMUGC_INTERFACE_VERSION) == 0) {
return (ISteamUGC *)(void *)(ISteamUGC *)steam_ugc_temp; return (ISteamUGC *)(void *)(ISteamUGC *)steam_ugc_temp;
} else { } else {
@ -1462,3 +1478,8 @@ void Steam_Client::RunCallbacks(bool runClientCB, bool runGameserverCB)
PRINT_DEBUG("Steam_Client::RunCallbacks done\n"); PRINT_DEBUG("Steam_Client::RunCallbacks done\n");
} }
void Steam_Client::DestroyAllInterfaces()
{
PRINT_DEBUG("Steam_Client::DestroyAllInterfaces\n");
}

View File

@ -70,6 +70,7 @@ public ISteamClient015,
public ISteamClient016, public ISteamClient016,
public ISteamClient017, public ISteamClient017,
public ISteamClient018, public ISteamClient018,
public ISteamClient019,
public ISteamClient public ISteamClient
{ {
public: public:
@ -162,6 +163,7 @@ public:
// set the local IP and Port to bind to // set the local IP and Port to bind to
// this must be set before CreateLocalUser() // this must be set before CreateLocalUser()
void SetLocalIPBinding( uint32 unIP, uint16 usPort ); void SetLocalIPBinding( uint32 unIP, uint16 usPort );
void SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort );
// returns the ISteamFriends interface // returns the ISteamFriends interface
ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ); ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
@ -286,4 +288,6 @@ public:
void clientShutdown(); void clientShutdown();
bool IsServerInit(); bool IsServerInit();
bool IsUserLogIn(); bool IsUserLogIn();
void DestroyAllInterfaces();
}; };

View File

@ -129,6 +129,9 @@ public ISteamInput
std::map<ControllerActionSetHandle_t, struct Controller_Map> controller_maps; std::map<ControllerActionSetHandle_t, struct Controller_Map> controller_maps;
std::map<ControllerHandle_t, struct Controller_Action> controllers; std::map<ControllerHandle_t, struct Controller_Action> controllers;
std::map<EInputActionOrigin, std::string> steaminput_glyphs;
std::map<EControllerActionOrigin, std::string> steamcontroller_glyphs;
bool disabled; bool disabled;
void set_handles(std::map<std::string, std::map<std::string, std::pair<std::set<std::string>, std::string>>> action_sets) { void set_handles(std::map<std::string, std::map<std::string, std::pair<std::set<std::string>, std::string>>> action_sets) {
@ -788,14 +791,86 @@ const char *GetStringForActionOrigin( EInputActionOrigin eOrigin )
// Get a local path to art for on-screen glyph for a particular origin // Get a local path to art for on-screen glyph for a particular origin
const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin )
{ {
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin\n"); PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin %i\n", eOrigin);
return "";
if (steamcontroller_glyphs.empty()) {
std::string dir = settings->glyphs_directory;
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_A] = dir + "button_a.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_B] = dir + "button_b.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_X] = dir + "button_x.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_Y] = dir + "button_y.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftBumper] = dir + "shoulder_l.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightBumper] = dir + "shoulder_r.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_Start] = dir + "xbox_button_start.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_Back] = dir + "xbox_button_select.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftTrigger_Pull] = dir + "trigger_l_pull.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftTrigger_Click] = dir + "trigger_l_click.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightTrigger_Pull] = dir + "trigger_r_pull.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightTrigger_Click] = dir + "trigger_r_click.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftStick_Move] = dir + "stick_l_move.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftStick_Click] = dir + "stick_l_click.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftStick_DPadNorth] = dir + "stick_dpad_n.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftStick_DPadSouth] = dir + "stick_dpad_s.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftStick_DPadWest] = dir + "stick_dpad_w.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_LeftStick_DPadEast] = dir + "stick_dpad_e.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightStick_Move] = dir + "stick_r_move.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightStick_Click] = dir + "stick_r_click.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightStick_DPadNorth] = dir + "stick_dpad_n.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightStick_DPadSouth] = dir + "stick_dpad_s.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightStick_DPadWest] = dir + "stick_dpad_w.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_RightStick_DPadEast] = dir + "stick_dpad_e.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_DPad_North] = dir + "xbox_button_dpad_n.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_DPad_South] = dir + "xbox_button_dpad_s.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_DPad_West] = dir + "xbox_button_dpad_w.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_DPad_East] = dir + "xbox_button_dpad_e.png";
steamcontroller_glyphs[k_EControllerActionOrigin_XBox360_DPad_Move] = dir + "xbox_button_dpad_move.png";
}
auto glyph = steamcontroller_glyphs.find(eOrigin);
if (glyph == steamcontroller_glyphs.end()) return "";
return glyph->second.c_str();
} }
const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin )
{ {
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin steaminput\n"); PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin steaminput %i\n", eOrigin);
return ""; if (steaminput_glyphs.empty()) {
std::string dir = settings->glyphs_directory;
steaminput_glyphs[k_EInputActionOrigin_XBox360_A] = dir + "button_a.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_B] = dir + "button_b.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_X] = dir + "button_x.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_Y] = dir + "button_y.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftBumper] = dir + "shoulder_l.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightBumper] = dir + "shoulder_r.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_Start] = dir + "xbox_button_start.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_Back] = dir + "xbox_button_select.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftTrigger_Pull] = dir + "trigger_l_pull.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftTrigger_Click] = dir + "trigger_l_click.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightTrigger_Pull] = dir + "trigger_r_pull.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightTrigger_Click] = dir + "trigger_r_click.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftStick_Move] = dir + "stick_l_move.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftStick_Click] = dir + "stick_l_click.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftStick_DPadNorth] = dir + "stick_dpad_n.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftStick_DPadSouth] = dir + "stick_dpad_s.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftStick_DPadWest] = dir + "stick_dpad_w.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_LeftStick_DPadEast] = dir + "stick_dpad_e.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightStick_Move] = dir + "stick_r_move.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightStick_Click] = dir + "stick_r_click.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightStick_DPadNorth] = dir + "stick_dpad_n.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightStick_DPadSouth] = dir + "stick_dpad_s.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightStick_DPadWest] = dir + "stick_dpad_w.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_RightStick_DPadEast] = dir + "stick_dpad_e.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_DPad_North] = dir + "xbox_button_dpad_n.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_DPad_South] = dir + "xbox_button_dpad_s.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_DPad_West] = dir + "xbox_button_dpad_w.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_DPad_East] = dir + "xbox_button_dpad_e.png";
steaminput_glyphs[k_EInputActionOrigin_XBox360_DPad_Move] = dir + "xbox_button_dpad_move.png";
//steaminput_glyphs[] = dir + "";
}
auto glyph = steaminput_glyphs.find(eOrigin);
if (glyph == steaminput_glyphs.end()) return "";
return glyph->second.c_str();
} }
// Returns the input type for a particular handle // Returns the input type for a particular handle

View File

@ -541,15 +541,22 @@ SteamAPICall_t Steam_GameServer::GetServerReputation()
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
uint32 Steam_GameServer::GetPublicIP() uint32 Steam_GameServer::GetPublicIP_old()
{ {
PRINT_DEBUG("GetPublicIP\n"); PRINT_DEBUG("GetPublicIP_old\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
uint32 ip = network->getOwnIP(); uint32 ip = network->getOwnIP();
PRINT_DEBUG("%X\n", ip); PRINT_DEBUG("%X\n", ip);
return ip; return ip;
} }
SteamIPAddress_t Steam_GameServer::GetPublicIP()
{
PRINT_DEBUG("GetPublicIP\n");
SteamIPAddress_t ip = SteamIPAddress_t::IPv4Any();
ip.m_unIPv4 = GetPublicIP_old();
return ip;
}
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own // These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages // socket to talk to the master server on, it lets the game use its socket to forward messages

View File

@ -34,6 +34,7 @@ public ISteamGameServer008,
public ISteamGameServer009, public ISteamGameServer009,
public ISteamGameServer010, public ISteamGameServer010,
public ISteamGameServer011, public ISteamGameServer011,
public ISteamGameServer012,
public ISteamGameServer public ISteamGameServer
{ {
class Settings *settings; class Settings *settings;
@ -275,7 +276,8 @@ public:
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
uint32 GetPublicIP(); uint32 GetPublicIP_old();
SteamIPAddress_t GetPublicIP();
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own // These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages // socket to talk to the master server on, it lets the game use its socket to forward messages

View File

@ -1353,7 +1353,7 @@ void Callback(Common_Message *msg)
if (msg->lobby_messages().type() == Lobby_Messages::JOIN) { if (msg->lobby_messages().type() == Lobby_Messages::JOIN) {
PRINT_DEBUG("LOBBY MESSAGE: JOIN\n"); PRINT_DEBUG("LOBBY MESSAGE: JOIN\n");
enter_lobby(lobby, (uint64)msg->source_id()); enter_lobby(lobby, (uint64)msg->source_id());
trigger_lobby_member_join_leave((uint64)lobby->room_id(), (uint64)msg->source_id(), false, true); trigger_lobby_member_join_leave((uint64)lobby->room_id(), (uint64)msg->source_id(), false, true, 0.01);
} }
if (msg->lobby_messages().type() == Lobby_Messages::MEMBER_DATA) { if (msg->lobby_messages().type() == Lobby_Messages::MEMBER_DATA) {

View File

@ -59,6 +59,7 @@ public ISteamNetworking001,
public ISteamNetworking002, public ISteamNetworking002,
public ISteamNetworking003, public ISteamNetworking003,
public ISteamNetworking004, public ISteamNetworking004,
public ISteamNetworking005,
public ISteamNetworking public ISteamNetworking
{ {
class Settings *settings; class Settings *settings;
@ -480,7 +481,7 @@ SNetListenSocket_t socket_number = 0;
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only // pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay )
{ {
PRINT_DEBUG("Steam_Networking::CreateListenSocket %i %u %hu %u\n", nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay); PRINT_DEBUG("Steam_Networking::CreateListenSocket old %i %u %hu %u\n", nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
for (auto & c : listen_sockets) { for (auto & c : listen_sockets) {
if (c.nVirtualP2PPort == nVirtualP2PPort || c.nPort == nPort) if (c.nVirtualP2PPort == nVirtualP2PPort || c.nPort == nPort)
@ -499,6 +500,13 @@ SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 n
return socket.id; return socket.id;
} }
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay )
{
PRINT_DEBUG("Steam_Networking::CreateListenSocket %i %i %u %hu %u\n", nVirtualP2PPort, nIP.m_eType, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay);
//TODO: ipv6
return CreateListenSocket(nVirtualP2PPort, nIP.m_unIPv4, nPort, bAllowUseOfPacketRelay);
}
SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort ) SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort )
{ {
PRINT_DEBUG("Steam_Networking::CreateListenSocket old\n"); PRINT_DEBUG("Steam_Networking::CreateListenSocket old\n");
@ -525,12 +533,18 @@ SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort
SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec )
{ {
PRINT_DEBUG("Steam_Networking::CreateConnectionSocket %u %hu %i\n", nIP, nPort, nTimeoutSec); PRINT_DEBUG("Steam_Networking::CreateConnectionSocket_old %u %hu %i\n", nIP, nPort, nTimeoutSec);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
//TODO: nTimeoutSec //TODO: nTimeoutSec
return create_connection_socket((uint64)0, 0, nIP, nPort); return create_connection_socket((uint64)0, 0, nIP, nPort);
} }
SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec )
{
PRINT_DEBUG("Steam_Networking::CreateConnectionSocket %i %u %hu %i\n", nIP.m_eType, nIP.m_unIPv4, nPort, nTimeoutSec);
//TODO: ipv6
return CreateConnectionSocket(nIP.m_unIPv4, nPort, nTimeoutSec);
}
// disconnects the connection to the socket, if any, and invalidates the handle // disconnects the connection to the socket, if any, and invalidates the handle
// any unread data on the socket will be thrown away // any unread data on the socket will be thrown away
@ -692,7 +706,7 @@ bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDe
// returns information about the specified socket, filling out the contents of the pointers // returns information about the specified socket, filling out the contents of the pointers
bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote )
{ {
PRINT_DEBUG("Steam_Networking::GetSocketInfo\n"); PRINT_DEBUG("Steam_Networking::GetSocketInfo_old\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
struct steam_connection_socket *socket = get_connection_socket(hSocket); struct steam_connection_socket *socket = get_connection_socket(hSocket);
if (!socket) return false; if (!socket) return false;
@ -717,12 +731,28 @@ bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocke
return true; return true;
} }
bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, SteamIPAddress_t *punIPRemote, uint16 *punPortRemote )
{
PRINT_DEBUG("Steam_Networking::GetSocketInfo\n");
//TODO: ipv6
uint32 *ip_remote = NULL;
if (punIPRemote) {
ip_remote = &(punIPRemote->m_unIPv4);
}
bool ret = GetSocketInfo(hSocket, pSteamIDRemote, peSocketStatus, ip_remote, punPortRemote );
if (punIPRemote && ret) {
punIPRemote->m_eType = k_ESteamIPTypeIPv4;
}
return ret;
}
// returns which local port the listen socket is bound to // returns which local port the listen socket is bound to
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only // *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort )
{ {
PRINT_DEBUG("Steam_Networking::GetListenSocketInfo\n"); PRINT_DEBUG("Steam_Networking::GetListenSocketInfo_old\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&hListenSocket](struct steam_listen_socket const& conn) { return conn.id == hListenSocket;}); auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&hListenSocket](struct steam_listen_socket const& conn) { return conn.id == hListenSocket;});
if (conn == listen_sockets.end()) return false; if (conn == listen_sockets.end()) return false;
@ -731,6 +761,22 @@ bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16
return true; return true;
} }
bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pnIP, uint16 *pnPort )
{
PRINT_DEBUG("Steam_Networking::GetListenSocketInfo\n");
//TODO: ipv6
uint32 *ip = NULL;
if (pnIP) {
ip = &(pnIP->m_unIPv4);
}
bool ret = GetListenSocketInfo(hListenSocket, ip, pnPort );
if (pnIP && ret) {
pnIP->m_eType = k_ESteamIPTypeIPv4;
}
return ret;
}
// returns true to describe how the socket ended up connecting // returns true to describe how the socket ended up connecting
ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket )

View File

@ -49,6 +49,7 @@ struct Connect_Socket {
class Steam_Networking_Sockets : class Steam_Networking_Sockets :
public ISteamNetworkingSockets001, public ISteamNetworkingSockets001,
public ISteamNetworkingSockets002, public ISteamNetworkingSockets002,
public ISteamNetworkingSockets003,
public ISteamNetworkingSockets public ISteamNetworkingSockets
{ {
class Settings *settings; class Settings *settings;
@ -238,6 +239,11 @@ HSteamListenSocket CreateListenSocket( int nSteamConnectVirtualPort, uint32 nIP,
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t /// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
/// will be posted. The connection will be in the connecting state. /// will be posted. The connection will be in the connecting state.
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress )
{
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP old\n");
}
HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP\n"); PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketIP\n");
} }
@ -261,6 +267,11 @@ HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddre
/// way of knowing who is actually on the other end, and thus are vulnerable to /// way of knowing who is actually on the other end, and thus are vulnerable to
/// man-in-the-middle attacks. /// man-in-the-middle attacks.
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address )
{
PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress old\n");
}
HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress\n"); PRINT_DEBUG("Steam_Networking_Sockets::ConnectByIPAddress\n");
} }
@ -277,7 +288,15 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address )
/// when your app initializes /// when your app initializes
HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) HSteamListenSocket CreateListenSocketP2P( int nVirtualPort )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketP2P %i\n", nVirtualPort); PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketP2P old %i\n", nVirtualPort);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return new_listen_socket(nVirtualPort);
}
HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{
PRINT_DEBUG("Steam_Networking_Sockets::CreateListenSocketP2P old %i\n", nVirtualPort);
//TODO config options
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
return new_listen_socket(nVirtualPort); return new_listen_socket(nVirtualPort);
} }
@ -295,7 +314,7 @@ HSteamListenSocket CreateListenSocketP2P( int nVirtualPort )
/// when your app initializes /// when your app initializes
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P %u\n", nVirtualPort); PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P old %i\n", nVirtualPort);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr(); const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr();
@ -315,6 +334,13 @@ HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, i
return socket; return socket;
} }
HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2P %i\n", nVirtualPort);
//TODO config options
return ConnectP2P(identityRemote, nVirtualPort);
}
/// Creates a connection and begins talking to a remote destination. The remote host /// Creates a connection and begins talking to a remote destination. The remote host
/// must be listening with a matching call to CreateListenSocket. /// must be listening with a matching call to CreateListenSocket.
/// ///
@ -567,6 +593,9 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
/// sockets that does not write excessively small chunks will /// sockets that does not write excessively small chunks will
/// work without any changes. /// work without any changes.
/// ///
/// The pOutMessageNumber is an optional pointer to receive the
/// message number assigned to the message, if sending was successful.
///
/// Returns: /// Returns:
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big. /// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend) /// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
@ -576,7 +605,7 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
/// we were not ready to send it. /// we were not ready to send it.
/// - k_EResultLimitExceeded: there was already too much data queued to be sent. /// - k_EResultLimitExceeded: there was already too much data queued to be sent.
/// (See k_ESteamNetworkingConfig_SendBufferSize) /// (See k_ESteamNetworkingConfig_SendBufferSize)
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags ) EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, int64 *pOutMessageNumber )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::SendMessageToConnection %u, len %u, flags %i\n", hConn, cbData, nSendFlags); PRINT_DEBUG("Steam_Networking_Sockets::SendMessageToConnection %u, len %u, flags %i\n", hConn, cbData, nSendFlags);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
@ -603,6 +632,50 @@ virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *
return k_EResultFail; return k_EResultFail;
} }
EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags )
{
PRINT_DEBUG("Steam_Networking_Sockets::SendMessageToConnection old %u, len %u, flags %i\n", hConn, cbData, nSendFlags);
return SendMessageToConnection(hConn, pData, cbData, nSendFlags, NULL);
}
/// Send one or more messages without copying the message payload.
/// This is the most efficient way to send messages. To use this
/// function, you must first allocate a message object using
/// ISteamNetworkingUtils::AllocateMessage. (Do not declare one
/// on the stack or allocate your own.)
///
/// You should fill in the message payload. You can either let
/// it allocate the buffer for you and then fill in the payload,
/// or if you already have a buffer allocated, you can just point
/// m_pData at your buffer and set the callback to the appropriate function
/// to free it. Note that if you use your own buffer, it MUST remain valid
/// until the callback is executed. And also note that your callback can be
/// invoked at ant time from any thread (perhaps even before SendMessages
/// returns!), so it MUST be fast and threadsafe.
///
/// You MUST also fill in:
/// - m_conn - the handle of the connection to send the message to
/// - m_nFlags - bitmask of k_nSteamNetworkingSend_xxx flags.
///
/// All other fields are currently reserved and should not be modified.
///
/// The library will take ownership of the message structures. They may
/// be modified or become invalid at any time, so you must not read them
/// after passing them to this function.
///
/// pOutMessageNumberOrResult is an optional array that will receive,
/// for each message, the message number that was assigned to the message
/// if sending was successful. If sending failed, then a negative EResult
/// valid is placed into the array. For example, the array will hold
/// -k_EResultInvalidState if the connection was in an invalid state.
/// See ISteamNetworkingSockets::SendMessageToConnection for possible
/// failure codes.
void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult )
{
PRINT_DEBUG("Steam_Networking_Sockets::SendMessages\n");
}
/// If Nagle is enabled (its on by default) then when calling /// If Nagle is enabled (its on by default) then when calling
/// SendMessageToConnection the message will be queued up the Nagle time /// SendMessageToConnection the message will be queued up the Nagle time
/// before being sent to merge small messages into the same packet. /// before being sent to merge small messages into the same packet.
@ -637,7 +710,7 @@ SteamNetworkingMessage_t *get_steam_message_connection(HSteamNetConnection hConn
pMsg->m_cbSize = size; pMsg->m_cbSize = size;
memcpy(pMsg->m_pData, connect_socket->second.data.front().data(), size); memcpy(pMsg->m_pData, connect_socket->second.data.front().data(), size);
pMsg->m_conn = hConn; pMsg->m_conn = hConn;
pMsg->m_sender = connect_socket->second.remote_identity; pMsg->m_identityPeer = connect_socket->second.remote_identity;
pMsg->m_nConnUserData = connect_socket->second.user_data; pMsg->m_nConnUserData = connect_socket->second.user_data;
//TODO //TODO
//pMsg->m_usecTimeReceived = //pMsg->m_usecTimeReceived =
@ -957,7 +1030,7 @@ int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameSer
/// when your app initializes /// when your app initializes
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer\n"); PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer old\n");
} }
/// Client call to connect to a server hosted in a Valve data center, on the specified virtual /// Client call to connect to a server hosted in a Valve data center, on the specified virtual
@ -968,9 +1041,13 @@ HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentit
/// connection to Steam or the central backend, or the app is restarted or crashes, etc. /// connection to Steam or the central backend, or the app is restarted or crashes, etc.
HSteamNetConnection ConnectToHostedDedicatedServer( CSteamID steamIDTarget, int nVirtualPort ) HSteamNetConnection ConnectToHostedDedicatedServer( CSteamID steamIDTarget, int nVirtualPort )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer old\n"); PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer older\n");
} }
HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{
PRINT_DEBUG("Steam_Networking_Sockets::ConnectToHostedDedicatedServer\n");
}
// //
// Servers hosted in Valve data centers // Servers hosted in Valve data centers
@ -1058,7 +1135,24 @@ virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRo
/// Note that this call MUST be made through the SteamNetworkingSocketsGameServer() interface /// Note that this call MUST be made through the SteamNetworkingSocketsGameServer() interface
HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort )
{ {
PRINT_DEBUG("Steam_Networking_Sockets::CreateHostedDedicatedServerListenSocket %i\n", nVirtualPort); PRINT_DEBUG("Steam_Networking_Sockets::CreateHostedDedicatedServerListenSocket old %i\n", nVirtualPort);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return new_listen_socket(nVirtualPort);
}
/// Create a listen socket on the specified virtual port. The physical UDP port to use
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
/// configured, this call will fail.
///
/// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface
///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{
PRINT_DEBUG("Steam_Networking_Sockets::CreateHostedDedicatedServerListenSocket old %i\n", nVirtualPort);
//TODO config options
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
return new_listen_socket(nVirtualPort); return new_listen_socket(nVirtualPort);
} }
@ -1172,6 +1266,85 @@ EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *
PRINT_DEBUG("Steam_Networking_Sockets::GetGameCoordinatorServerLogin\n"); PRINT_DEBUG("Steam_Networking_Sockets::GetGameCoordinatorServerLogin\n");
} }
//
// Relayed connections using custom signaling protocol
//
// This is used if you have your own method of sending out-of-band
// signaling / rendezvous messages through a mutually trusted channel.
//
/// Create a P2P "client" connection that does signaling over a custom
/// rendezvous/signaling channel.
///
/// pSignaling points to a new object that you create just for this connection.
/// It must stay valid until Release() is called. Once you pass the
/// object to this function, it assumes ownership. Release() will be called
/// from within the function call if the call fails. Furthermore, until Release()
/// is called, you should be prepared for methods to be invoked on your
/// object from any thread! You need to make sure your object is threadsafe!
/// Furthermore, you should make sure that dispatching the methods is done
/// as quickly as possible.
///
/// This function will immediately construct a connection in the "connecting"
/// state. Soon after (perhaps before this function returns, perhaps in another thread),
/// the connection will begin sending signaling messages by calling
/// ISteamNetworkingConnectionCustomSignaling::SendSignal.
///
/// When the remote peer accepts the connection (See
/// ISteamNetworkingCustomSignalingRecvContext::OnConnectRequest),
/// it will begin sending signaling messages. When these messages are received,
/// you can pass them to the connection using ReceivedP2PCustomSignal.
///
/// If you know the identity of the peer that you expect to be on the other end,
/// you can pass their identity to improve debug output or just detect bugs.
/// If you don't know their identity yet, you can pass NULL, and their
/// identity will be established in the connection handshake.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes
///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nOptions, const SteamNetworkingConfigValue_t *pOptions )
{
PRINT_DEBUG("Steam_Networking_Sockets::ConnectP2PCustomSignaling\n");
}
/// Called when custom signaling has received a message. When your
/// signaling channel receives a message, it should save off whatever
/// routing information was in the envelope into the context object,
/// and then pass the payload to this function.
///
/// A few different things can happen next, depending on the message:
///
/// - If the signal is associated with existing connection, it is dealt
/// with immediately. If any replies need to be sent, they will be
/// dispatched using the ISteamNetworkingConnectionCustomSignaling
/// associated with the connection.
/// - If the message represents a connection request (and the request
/// is not redundant for an existing connection), a new connection
/// will be created, and ReceivedConnectRequest will be called on your
/// context object to determine how to proceed.
/// - Otherwise, the message is for a connection that does not
/// exist (anymore). In this case, we *may* call SendRejectionReply
/// on your context object.
///
/// In any case, we will not save off pContext or access it after this
/// function returns.
///
/// Returns true if the message was parsed and dispatched without anything
/// unusual or suspicious happening. Returns false if there was some problem
/// with the message that prevented ordinary handling. (Debug output will
/// usually have more information.)
///
/// If you expect to be using relayed connections, then you probably want
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext )
{
PRINT_DEBUG("Steam_Networking_Sockets::ReceivedP2PCustomSignal\n");
}
// TEMP KLUDGE Call to invoke all queued callbacks. // TEMP KLUDGE Call to invoke all queued callbacks.
// Eventually this function will go away, and callwacks will be ordinary Steamworks callbacks. // Eventually this function will go away, and callwacks will be ordinary Steamworks callbacks.
// You should call this at the same time you call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks // You should call this at the same time you call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks

View File

@ -19,6 +19,7 @@
class Steam_Networking_Utils : class Steam_Networking_Utils :
public ISteamNetworkingUtils001, public ISteamNetworkingUtils001,
public ISteamNetworkingUtils002,
public ISteamNetworkingUtils public ISteamNetworkingUtils
{ {
class Settings *settings; class Settings *settings;
@ -65,6 +66,32 @@ Steam_Networking_Utils(class Settings *settings, class Networking *network, clas
this->run_every_runcb->remove(&Steam_Networking_Utils::steam_run_every_runcb, this); this->run_every_runcb->remove(&Steam_Networking_Utils::steam_run_every_runcb, this);
} }
/// Allocate and initialize a message object. Usually the reason
/// you call this is to pass it to ISteamNetworkingSockets::SendMessages.
/// The returned object will have all of the relevant fields cleared to zero.
///
/// Optionally you can also request that this system allocate space to
/// hold the payload itself. If cbAllocateBuffer is nonzero, the system
/// will allocate memory to hold a payload of at least cbAllocateBuffer bytes.
/// m_pData will point to the allocated buffer, m_cbSize will be set to the
/// size, and m_pfnFreeData will be set to the proper function to free up
/// the buffer.
///
/// If cbAllocateBuffer=0, then no buffer is allocated. m_pData will be NULL,
/// m_cbSize will be zero, and m_pfnFreeData will be NULL. You will need to
/// set each of these.
///
/// You can use SteamNetworkingMessage_t::Release to free up the message
/// bookkeeping object and any associated buffer. See
/// ISteamNetworkingSockets::SendMessages for details on reference
/// counting and ownership.
SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer )
{
PRINT_DEBUG("Steam_Networking_Utils::AllocateMessage\n");
//TODO
return NULL;
}
bool InitializeRelayAccess() bool InitializeRelayAccess()
{ {
PRINT_DEBUG("Steam_Networking_Utils::InitializeRelayAccess\n"); PRINT_DEBUG("Steam_Networking_Utils::InitializeRelayAccess\n");

View File

@ -105,6 +105,14 @@ bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *p
return false; return false;
} }
// Invite a friend to Remote Play Together
// This returns false if the invite can't be sent
bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend )
{
PRINT_DEBUG("Steam_RemotePlay::BSendRemotePlayTogetherInvite\n");
return false;
}
void RunCallbacks() void RunCallbacks()
{ {
} }

View File

@ -37,6 +37,7 @@ public ISteamUGC008,
public ISteamUGC009, public ISteamUGC009,
public ISteamUGC010, public ISteamUGC010,
public ISteamUGC012, public ISteamUGC012,
public ISteamUGC013,
public ISteamUGC public ISteamUGC
{ {
class Settings *settings; class Settings *settings;
@ -274,6 +275,11 @@ bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName )
return true; return true;
} }
bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t *pTagGroups )
{
PRINT_DEBUG("Steam_UGC::AddRequiredTagGroup\n");
return true;
}
bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName )
{ {

View File

@ -373,4 +373,12 @@ int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const
return 0; return 0;
} }
// Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol.
// This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
ESteamIPv6ConnectivityState GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol )
{
PRINT_DEBUG("GetIPv6ConnectivityState\n");
return k_ESteamIPv6ConnectivityState_Unknown;
}
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,24 @@
#!/bin/bash
APP_PATH=./example_executable
APP_ID=480
set -e
mkdir -p ~/.steam/sdk64
mkdir -p ~/.steam/sdk32
#make a backup of original files
mv ~/.steam/steam.pid ~/.steam/steam.pid.orig || true
mv ~/.steam/sdk64/steamclient.so ~/.steam/sdk64/steamclient.so.orig || true
mv ~/.steam/sdk32/steamclient.so ~/.steam/sdk32/steamclient.so.orig || true
#copy our files
cp x86/steamclient.so ~/.steam/sdk32/steamclient.so
cp x86_64/steamclient.so ~/.steam/sdk64/steamclient.so
echo $BASHPID > ~/.steam/steam.pid
SteamAppId=$APP_ID SteamGameId=$APP_ID $APP_PATH
#restore original
rm -f ~/.steam/steam.pid
rm -f ~/.steam/sdk64/steamclient.so
rm -f ~/.steam/sdk32/steamclient.so
mv ~/.steam/steam.pid.orig ~/.steam/steam.pid
mv ~/.steam/sdk64/steamclient.so.orig ~/.steam/sdk64/steamclient.so || true
mv ~/.steam/sdk32/steamclient.so.orig ~/.steam/sdk32/steamclient.so || true

View File

@ -56,7 +56,7 @@ public:
// set the local IP and Port to bind to // set the local IP and Port to bind to
// this must be set before CreateLocalUser() // this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0; virtual void SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort ) = 0;
// returns the ISteamFriends interface // returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
@ -159,8 +159,10 @@ public:
// Steam Remote Play interface // Steam Remote Play interface
virtual ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; virtual ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
STEAM_PRIVATE_API( virtual void DestroyAllInterfaces() = 0; )
}; };
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient019" #define STEAMCLIENT_INTERFACE_VERSION "SteamClient020"
#ifndef STEAM_API_EXPORTS #ifndef STEAM_API_EXPORTS

View File

@ -0,0 +1,144 @@
#ifndef ISTEAMCLIENT019_H
#define ISTEAMCLIENT019_H
#ifdef STEAM_WIN32
#pragma once
#endif
class ISteamClient019
{
public:
// Creates a communication pipe to the Steam client.
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamPipe CreateSteamPipe() = 0;
// Releases a previously created communications pipe
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0;
// connects to an existing global user, failing if none exists
// used by the game to coordinate with the steamUI
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0;
// used by game servers, create a steam user that won't be shared with anyone else
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0;
// removes an allocated user
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0;
// retrieves the ISteamUser interface associated with the handle
virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// retrieves the ISteamGameServer interface associated with the handle
virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// set the local IP and Port to bind to
// this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0;
// returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUtils interface
virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmaking interface
virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamMatchmakingServers interface
virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the a generic interface
virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamUserStats interface
virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns the ISteamGameServerStats interface
virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns apps interface
virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// networking
virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// remote storage
virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// user screenshots
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// game search
virtual ISteamGameSearch *GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
// returns the number of IPC calls made since the last time this function was called
// Used for perf debugging so you can understand how many IPC calls your game makes per frame
// Every IPC call is at minimum a thread context switch if not a process one so you want to rate
// control how often you do them.
virtual uint32 GetIPCCallCount() = 0;
// API warning handling
// 'int' is the severity; 0 for msg, 1 for warning
// 'const char *' is the text of the message
// callbacks will occur directly after the API function is called that generated the warning or message.
virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
// Trigger global shutdown for the DLL
virtual bool BShutdownIfAllPipesClosed() = 0;
// Expose HTTP interface
virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Deprecated - the ISteamUnifiedMessages interface is no longer intended for public consumption.
STEAM_PRIVATE_API( virtual void *DEPRECATED_GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0 ; )
// Exposes the ISteamController interface - deprecated in favor of Steam Input
virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamUGC interface
virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// returns app list interface, only available on specially registered apps
virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Music Player
virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Music Player Remote
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
// html page display
virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
// Helper functions for internal Steam usage
STEAM_PRIVATE_API( virtual void DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess( void (*)() ) = 0; )
STEAM_PRIVATE_API( virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0; )
// inventory
virtual ISteamInventory *GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Video
virtual ISteamVideo *GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Parental controls
virtual ISteamParentalSettings *GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the Steam Input interface for controller support
virtual ISteamInput *GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Steam Parties interface
virtual ISteamParties *GetISteamParties( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Steam Remote Play interface
virtual ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
};
#endif // ISTEAMCLIENT019_H

View File

@ -344,9 +344,15 @@ public:
// Rich Presence data is automatically shared between friends who are in the same game // Rich Presence data is automatically shared between friends who are in the same game
// Each user has a set of Key/Value pairs // Each user has a set of Key/Value pairs
// Note the following limits: k_cchMaxRichPresenceKeys, k_cchMaxRichPresenceKeyLength, k_cchMaxRichPresenceValueLength // Note the following limits: k_cchMaxRichPresenceKeys, k_cchMaxRichPresenceKeyLength, k_cchMaxRichPresenceValueLength
// There are two magic keys: // There are five magic keys:
// "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list // "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list
// "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game // "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game
// "steam_display" - Names a rich presence localization token that will be displayed in the viewing user's selected language
// in the Steam client UI. For more info: https://partner.steamgames.com/doc/api/ISteamFriends#richpresencelocalization
// "steam_player_group" - When set, indicates to the Steam client that the player is a member of a particular group. Players in the same group
// may be organized together in various places in the Steam UI.
// "steam_player_group_size" - When set, indicates the total number of players in the steam_player_group. The Steam client may use this number to
// display additional information about a group when all of the members are not part of a user's friends list.
// GetFriendRichPresence() returns an empty string "" if no value is set // GetFriendRichPresence() returns an empty string "" if no value is set
// SetRichPresence() to a NULL or an empty string deletes the key // SetRichPresence() to a NULL or an empty string deletes the key
// You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount() // You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount()
@ -362,7 +368,6 @@ public:
// Rich invite support. // Rich invite support.
// If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string. // If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.
// (Or you can configure yout game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.) // (Or you can configure yout game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.)
// Invites can only be sent to friends.
virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0; virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;
// recently-played-with friends iteration // recently-played-with friends iteration

View File

@ -199,7 +199,7 @@ public:
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
virtual uint32 GetPublicIP() = 0; virtual SteamIPAddress_t GetPublicIP() = 0;
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own // These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages // socket to talk to the master server on, it lets the game use its socket to forward messages
@ -250,7 +250,7 @@ public:
}; };
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012" #define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer013"
#ifndef STEAM_API_EXPORTS #ifndef STEAM_API_EXPORTS
// Global accessor // Global accessor

View File

@ -90,7 +90,7 @@ public:
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
virtual uint32 GetPublicIP() = 0; virtual uint32 GetPublicIP_old() = 0;
}; };
#endif // ISTEAMGAMESERVER008_H #endif // ISTEAMGAMESERVER008_H

View File

@ -90,7 +90,7 @@ public:
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
virtual uint32 GetPublicIP() = 0; virtual uint32 GetPublicIP_old() = 0;
// Sets a string defining the "gamedata" for this server, this is optional, but if it is set // Sets a string defining the "gamedata" for this server, this is optional, but if it is set
// it allows users to filter in the matchmaking/server-browser interfaces based on the value // it allows users to filter in the matchmaking/server-browser interfaces based on the value

View File

@ -91,7 +91,7 @@ public:
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
virtual uint32 GetPublicIP() = 0; virtual uint32 GetPublicIP_old() = 0;
// Sets a string defining the "gamedata" for this server, this is optional, but if it is set // Sets a string defining the "gamedata" for this server, this is optional, but if it is set
// it allows users to filter in the matchmaking/server-browser interfaces based on the value // it allows users to filter in the matchmaking/server-browser interfaces based on the value

View File

@ -189,7 +189,7 @@ public:
// Returns the public IP of the server according to Steam, useful when the server is // Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly // behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to // connect to
virtual uint32 GetPublicIP() = 0; virtual uint32 GetPublicIP_old() = 0;
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own // These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages // socket to talk to the master server on, it lets the game use its socket to forward messages

View File

@ -0,0 +1,242 @@
#ifndef ISTEAMGAMESERVER012_H
#define ISTEAMGAMESERVER012_H
#ifdef STEAM_WIN32
#pragma once
#endif
class ISteamGameServer012
{
public:
public:
//
// Basic server data. These properties, if set, must be set before before calling LogOn. They
// may not be changed after logged in.
//
/// This is called by SteamGameServer_Init, and you will usually not need to call it directly
virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0;
/// Game product identifier. This is currently used by the master server for version checking purposes.
/// It's a required field, but will eventually will go away, and the AppID will be used for this purpose.
virtual void SetProduct( const char *pszProduct ) = 0;
/// Description of the game. This is a required field and is displayed in the steam server browser....for now.
/// This is a required field, but it will go away eventually, as the data should be determined from the AppID.
virtual void SetGameDescription( const char *pszGameDescription ) = 0;
/// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning
/// this application is the original game, not a mod.
///
/// @see k_cbMaxGameServerGameDir
virtual void SetModDir( const char *pszModDir ) = 0;
/// Is this is a dedicated server? The default value is false.
virtual void SetDedicatedServer( bool bDedicated ) = 0;
//
// Login
//
/// Begin process to login to a persistent game server account
///
/// You need to register for callbacks to determine the result of this operation.
/// @see SteamServersConnected_t
/// @see SteamServerConnectFailure_t
/// @see SteamServersDisconnected_t
virtual void LogOn( const char *pszToken ) = 0;
/// Login to a generic, anonymous account.
///
/// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init,
/// but this is no longer the case.
virtual void LogOnAnonymous() = 0;
/// Begin process of logging game server out of steam
virtual void LogOff() = 0;
// status functions
virtual bool BLoggedOn() = 0;
virtual bool BSecure() = 0;
virtual CSteamID GetSteamID() = 0;
/// Returns true if the master server has requested a restart.
/// Only returns true once per request.
virtual bool WasRestartRequested() = 0;
//
// Server state. These properties may be changed at any time.
//
/// Max player count that will be reported to server browser and client queries
virtual void SetMaxPlayerCount( int cPlayersMax ) = 0;
/// Number of bots. Default value is zero
virtual void SetBotPlayerCount( int cBotplayers ) = 0;
/// Set the name of server as it will appear in the server browser
///
/// @see k_cbMaxGameServerName
virtual void SetServerName( const char *pszServerName ) = 0;
/// Set name of map to report in the server browser
///
/// @see k_cbMaxGameServerName
virtual void SetMapName( const char *pszMapName ) = 0;
/// Let people know if your server will require a password
virtual void SetPasswordProtected( bool bPasswordProtected ) = 0;
/// Spectator server. The default value is zero, meaning the service
/// is not used.
virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0;
/// Name of the spectator server. (Only used if spectator port is nonzero.)
///
/// @see k_cbMaxGameServerMapName
virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0;
/// Call this to clear the whole list of key/values that are sent in rules queries.
virtual void ClearAllKeyValues() = 0;
/// Call this to add/update a key/value pair.
virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0;
/// Sets a string defining the "gametags" for this server, this is optional, but if it is set
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
///
/// @see k_cbMaxGameServerTags
virtual void SetGameTags( const char *pchGameTags ) = 0;
/// Sets a string defining the "gamedata" for this server, this is optional, but if it is set
/// it allows users to filter in the matchmaking/server-browser interfaces based on the value
/// don't set this unless it actually changes, its only uploaded to the master once (when
/// acknowledged)
///
/// @see k_cbMaxGameServerGameData
virtual void SetGameData( const char *pchGameData ) = 0;
/// Region identifier. This is an optional field, the default value is empty, meaning the "world" region
virtual void SetRegion( const char *pszRegion ) = 0;
//
// Player list management / authentication
//
// Handles receiving a new connection from a Steam user. This call will ask the Steam
// servers to validate the users identity, app ownership, and VAC status. If the Steam servers
// are off-line, then it will validate the cached ticket itself which will validate app ownership
// and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection()
// and must then be sent up to the game server for authentication.
//
// Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL
// If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication
// for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)
virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0;
// Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.
//
// Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect()
// when this user leaves the server just like you would for a real user.
virtual CSteamID CreateUnauthenticatedUserConnection() = 0;
// Should be called whenever a user leaves our game server, this lets Steam internally
// track which users are currently on which servers for the purposes of preventing a single
// account being logged into multiple servers, showing who is currently on a server, etc.
virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0;
// Update the data to be displayed in the server browser and matchmaking interfaces for a user
// currently connected to the server. For regular users you must call this after you receive a
// GSUserValidationSuccess callback.
//
// Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)
virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0;
// New auth system APIs - do not mix with the old auth system APIs.
// ----------------------------------------------------------------
// Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).
// pcbTicket retrieves the length of the actual ticket.
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
// After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
// Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t
// returns false if we're not connected to the steam servers and thus cannot ask
virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0;
// these two functions s are deprecated, and will not return results
// they will be removed in a future version of the SDK
virtual void GetGameplayStats( ) = 0;
STEAM_CALL_RESULT( GSReputation_t )
virtual SteamAPICall_t GetServerReputation() = 0;
// Returns the public IP of the server according to Steam, useful when the server is
// behind NAT and you want to advertise its IP in a lobby for other clients to directly
// connect to
virtual uint32 GetPublicIP_old() = 0;
// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own
// socket to talk to the master server on, it lets the game use its socket to forward messages
// back and forth. This prevents us from requiring server ops to open up yet another port
// in their firewalls.
//
// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001
// These are used when you've elected to multiplex the game server's UDP socket
// rather than having the master server updater use its own sockets.
//
// Source games use this to simplify the job of the server admins, so they
// don't have to open up more ports on their firewalls.
// Call this when a packet that starts with 0xFFFFFFFF comes in. That means
// it's for us.
virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0;
// AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.
// This gets a packet that the master server updater needs to send out on UDP.
// It returns the length of the packet it wants to send, or 0 if there are no more packets to send.
// Call this each frame until it returns 0.
virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0;
//
// Control heartbeats / advertisement with master server
//
// Call this as often as you like to tell the master server updater whether or not
// you want it to be active (default: off).
virtual void EnableHeartbeats( bool bActive ) = 0;
// You usually don't need to modify this.
// Pass -1 to use the default value for iHeartbeatInterval.
// Some mods change this.
virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0;
// Force a heartbeat to steam at the next opportunity
virtual void ForceHeartbeat() = 0;
// associate this game server with this clan for the purposes of computing player compat
STEAM_CALL_RESULT( AssociateWithClanResult_t )
virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0;
// ask if any of the current players dont want to play with this new player - or vice versa
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0;
};
#endif // ISTEAMGAMESERVER012_H

View File

@ -209,14 +209,14 @@ public:
// pass in 0 if you just want the default local IP // pass in 0 if you just want the default local IP
// unPort is the port to use // unPort is the port to use
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only // pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0; virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0;
// creates a socket and begin connection to a remote destination // creates a socket and begin connection to a remote destination
// can connect via a known steamID (client or game server), or directly to an IP // can connect via a known steamID (client or game server), or directly to an IP
// on success will trigger a SocketStatusCallback_t callback // on success will trigger a SocketStatusCallback_t callback
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState // on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0; virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0;
virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0; virtual SNetSocket_t CreateConnectionSocket( SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec ) = 0;
// disconnects the connection to the socket, if any, and invalidates the handle // disconnects the connection to the socket, if any, and invalidates the handle
// any unread data on the socket will be thrown away // any unread data on the socket will be thrown away
@ -258,11 +258,11 @@ public:
virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0; virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// returns information about the specified socket, filling out the contents of the pointers // returns information about the specified socket, filling out the contents of the pointers
virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) = 0; virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, SteamIPAddress_t *punIPRemote, uint16 *punPortRemote ) = 0;
// returns which local port the listen socket is bound to // returns which local port the listen socket is bound to
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only // *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) = 0; virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, SteamIPAddress_t *pnIP, uint16 *pnPort ) = 0;
// returns true to describe how the socket ended up connecting // returns true to describe how the socket ended up connecting
virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0; virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0;
@ -270,7 +270,7 @@ public:
// max packet size, in bytes // max packet size, in bytes
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0; virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
}; };
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking005" #define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking006"
#ifndef STEAM_API_EXPORTS #ifndef STEAM_API_EXPORTS
// Global interface accessor // Global interface accessor

View File

@ -0,0 +1,159 @@
#ifndef ISTEAMNETWORKING005_H
#define ISTEAMNETWORKING005_H
#ifdef STEAM_WIN32
#pragma once
#endif
class ISteamNetworking005
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
//
// UDP-style (connectionless) networking interface. These functions send messages using
// an API organized around the destination. Reliable and unreliable messages are supported.
//
// For a more TCP-style interface (meaning you have a connection handle), see the functions below.
// Both interface styles can send both reliable and unreliable messages.
//
// Automatically establishes NAT-traversing or Relay server connections
// Sends a P2P packet to the specified user
// UDP-like, unreliable and a max packet size of 1200 bytes
// the first packet send may be delayed as the NAT-traversal code runs
// if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t
// see EP2PSend enum above for the descriptions of the different ways of sending packets
//
// nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket()
// with the same channel number in order to retrieve the data on the other end
// using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources
virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0;
// returns true if any data is available for read, and the amount of data that will need to be read
virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0;
// reads in a packet that has been sent from another user via SendP2PPacket()
// returns the size of the message and the steamID of the user who sent it in the last two parameters
// if the buffer passed in is too small, the message will be truncated
// this call is not blocking, and will return false if no data is available
virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0;
// AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback
// P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet
// if you don't want to talk to the user, just ignore the request
// if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically
// this may be called multiple times for a single user
// (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request)
virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
// call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood
// if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted
virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0;
// call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels
// open channels to a user have been closed, the open session to the user will be closed and new data from this
// user will trigger a P2PSessionRequest_t callback
virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0;
// fills out P2PSessionState_t structure with details about the underlying connection to the user
// should only needed for debugging purposes
// returns false if no connection exists to the specified user
virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0;
// Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection
// or NAT-traversal cannot be established. Only applies to connections created after setting this value,
// or to existing connections that need to automatically reconnect after this value is set.
//
// P2P packet relay is allowed by default
virtual bool AllowP2PPacketRelay( bool bAllow ) = 0;
////////////////////////////////////////////////////////////////////////////////////////////
//
// LISTEN / CONNECT connection-oriented interface functions
//
// These functions are more like a client-server TCP API. One side is the "server"
// and "listens" for incoming connections, which then must be "accepted." The "client"
// initiates a connection by "connecting." Sending and receiving is done through a
// connection handle.
//
// For a more UDP-style interface, where you do not track connection handles but
// simply send messages to a SteamID, use the UDP-style functions above.
//
// Both methods can send both reliable and unreliable methods.
//
////////////////////////////////////////////////////////////////////////////////////////////
// creates a socket and listens others to connect
// will trigger a SocketStatusCallback_t callback on another client connecting
// nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports
// this can usually just be 0 unless you want multiple sets of connections
// unIP is the local IP address to bind to
// pass in 0 if you just want the default local IP
// unPort is the port to use
// pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only
virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0;
// creates a socket and begin connection to a remote destination
// can connect via a known steamID (client or game server), or directly to an IP
// on success will trigger a SocketStatusCallback_t callback
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0;
virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0;
// disconnects the connection to the socket, if any, and invalidates the handle
// any unread data on the socket will be thrown away
// if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect
virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
// destroying a listen socket will automatically kill all the regular sockets generated from it
virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0;
// sending data
// must be a handle to a connected socket
// data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets
// use the reliable flag with caution; although the resend rate is pretty aggressive,
// it can still cause stalls in receiving data (like TCP)
virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0;
// receiving data
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0;
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0;
// checks for data from any socket that has been connected off this listen socket
// returns false if there is no data remaining
// fills out *pcubMsgSize with the size of the next message, in bytes
// fills out *phSocket with the socket that data is available on
virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// retrieves data from any socket that has been connected off this listen socket
// fills in pubDest with the contents of the message
// messages are always complete, of the same size as was sent (i.e. packetized, not streaming)
// if *pcubMsgSize < cubDest, only partial data is written
// returns false if no data is available
// fills out *phSocket with the socket that data is available on
virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0;
// returns information about the specified socket, filling out the contents of the pointers
virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) = 0;
// returns which local port the listen socket is bound to
// *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only
virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) = 0;
// returns true to describe how the socket ended up connecting
virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0;
// max packet size, in bytes
virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0;
};
#endif // ISTEAMNETWORKING005_H

View File

@ -22,6 +22,8 @@
class ISteamNetworkingSocketsCallbacks; class ISteamNetworkingSocketsCallbacks;
struct SteamNetAuthenticationStatus_t; struct SteamNetAuthenticationStatus_t;
class ISteamNetworkingConnectionCustomSignaling;
class ISteamNetworkingCustomSignalingRecvContext;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/// Lower level networking interface that more closely mirrors the standard /// Lower level networking interface that more closely mirrors the standard
@ -46,15 +48,20 @@ public:
/// You must select a specific local port to listen on and set it /// You must select a specific local port to listen on and set it
/// the port field of the local address. /// the port field of the local address.
/// ///
/// Usually you wil set the IP portion of the address to zero, (SteamNetworkingIPAddr::Clear()). /// Usually you will set the IP portion of the address to zero (SteamNetworkingIPAddr::Clear()).
/// This means that you will not bind to any particular local interface. In addition, /// This means that you will not bind to any particular local interface (i.e. the same
/// if possible the socket will be bound in "dual stack" mode, which means that it can /// as INADDR_ANY in plain socket code). Furthermore, if possible the socket will be bound
/// accept both IPv4 and IPv6 clients. If you wish to bind a particular interface, then /// in "dual stack" mode, which means that it can accept both IPv4 and IPv6 client connections.
/// set the local address to the appropriate IPv4 or IPv6 IP. /// If you really do wish to bind a particular interface, then set the local address to the
/// appropriate IPv4 or IPv6 IP.
///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
/// ///
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t /// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
/// will be posted. The connection will be in the connecting state. /// will be posted. The connection will be in the connecting state.
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) = 0; virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Creates a connection and begins talking to a "server" over UDP at the /// Creates a connection and begins talking to a "server" over UDP at the
/// given IPv4 or IPv6 address. The remote host must be listening with a /// given IPv4 or IPv6 address. The remote host must be listening with a
@ -74,7 +81,11 @@ public:
/// distributed through some other out-of-band mechanism), you don't have any /// distributed through some other out-of-band mechanism), you don't have any
/// way of knowing who is actually on the other end, and thus are vulnerable to /// way of knowing who is actually on the other end, and thus are vulnerable to
/// man-in-the-middle attacks. /// man-in-the-middle attacks.
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) = 0; ///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P /// Like CreateListenSocketIP, but clients will connect using ConnectP2P
@ -87,20 +98,24 @@ public:
/// ///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess() /// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes /// when your app initializes
virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) = 0; ///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Begin connecting to a server that is identified using a platform-specific identifier. /// Begin connecting to a server that is identified using a platform-specific identifier.
/// This requires some sort of third party rendezvous service, and will depend on the /// This uses the default rendezvous service, which depends on the platform and library
/// platform and what other libraries and services you are integrating with. /// configuration. (E.g. on Steam, it goes through the steam backend.) The traffic is relayed
/// /// over the Steam Datagram Relay network.
/// At the time of this writing, there is only one supported rendezvous service: Steam.
/// Set the SteamID (whether "user" or "gameserver") and Steam will determine if the
/// client is online and facilitate a relay connection. Note that all P2P connections on
/// Steam are currently relayed.
/// ///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess() /// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes /// when your app initializes
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0; ///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
#endif #endif
/// Accept an incoming connection that has been received on a listen socket. /// Accept an incoming connection that has been received on a listen socket.
@ -136,6 +151,12 @@ public:
/// Returns k_EResultInvalidState if the connection is not in the appropriate state. /// Returns k_EResultInvalidState if the connection is not in the appropriate state.
/// (Remember that the connection state could change in between the time that the /// (Remember that the connection state could change in between the time that the
/// notification being posted to the queue and when it is received by the application.) /// notification being posted to the queue and when it is received by the application.)
///
/// A note about connection configuration options. If you need to set any configuration
/// options that are common to all connections accepted through a particular listen
/// socket, consider setting the options on the listen socket, since such options are
/// inherited automatically. If you really do need to set options that are connection
/// specific, it is safe to set them on the connection before accepting the connection.
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0; virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
/// Disconnects from the remote host and invalidates the connection handle. /// Disconnects from the remote host and invalidates the connection handle.
@ -208,6 +229,9 @@ public:
/// sockets that does not write excessively small chunks will /// sockets that does not write excessively small chunks will
/// work without any changes. /// work without any changes.
/// ///
/// The pOutMessageNumber is an optional pointer to receive the
/// message number assigned to the message, if sending was successful.
///
/// Returns: /// Returns:
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big. /// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend) /// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
@ -217,7 +241,41 @@ public:
/// we were not ready to send it. /// we were not ready to send it.
/// - k_EResultLimitExceeded: there was already too much data queued to be sent. /// - k_EResultLimitExceeded: there was already too much data queued to be sent.
/// (See k_ESteamNetworkingConfig_SendBufferSize) /// (See k_ESteamNetworkingConfig_SendBufferSize)
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags ) = 0; virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, int64 *pOutMessageNumber ) = 0;
/// Send one or more messages without copying the message payload.
/// This is the most efficient way to send messages. To use this
/// function, you must first allocate a message object using
/// ISteamNetworkingUtils::AllocateMessage. (Do not declare one
/// on the stack or allocate your own.)
///
/// You should fill in the message payload. You can either let
/// it allocate the buffer for you and then fill in the payload,
/// or if you already have a buffer allocated, you can just point
/// m_pData at your buffer and set the callback to the appropriate function
/// to free it. Note that if you use your own buffer, it MUST remain valid
/// until the callback is executed. And also note that your callback can be
/// invoked at ant time from any thread (perhaps even before SendMessages
/// returns!), so it MUST be fast and threadsafe.
///
/// You MUST also fill in:
/// - m_conn - the handle of the connection to send the message to
/// - m_nFlags - bitmask of k_nSteamNetworkingSend_xxx flags.
///
/// All other fields are currently reserved and should not be modified.
///
/// The library will take ownership of the message structures. They may
/// be modified or become invalid at any time, so you must not read them
/// after passing them to this function.
///
/// pOutMessageNumberOrResult is an optional array that will receive,
/// for each message, the message number that was assigned to the message
/// if sending was successful. If sending failed, then a negative EResult
/// valid is placed into the array. For example, the array will hold
/// -k_EResultInvalidState if the connection was in an invalid state.
/// See ISteamNetworkingSockets::SendMessageToConnection for possible
/// failure codes.
virtual void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult ) = 0;
/// Flush any messages waiting on the Nagle timer and send them /// Flush any messages waiting on the Nagle timer and send them
/// at the next transmission opportunity (often that means right now). /// at the next transmission opportunity (often that means right now).
@ -347,23 +405,6 @@ public:
/// details, pass non-NULL to receive them. /// details, pass non-NULL to receive them.
virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0; virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0;
/// Certificate provision by the application. (On Steam, Steam will handle all this automatically)
#ifndef STEAMNETWORKINGSOCKETS_STEAM
/// Get blob that describes a certificate request. You can send this to your game coordinator.
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
/// size. (256 bytes is a very conservative estimate.)
///
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
/// Set the certificate. The certificate blob should be the output of
/// SteamDatagram_CreateCert.
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
#endif
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
// //
@ -394,7 +435,11 @@ public:
/// ///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess() /// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes /// when your app initializes
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) = 0; ///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
// //
// Servers hosted in data centers known to the Valve relay network // Servers hosted in data centers known to the Valve relay network
@ -446,7 +491,11 @@ public:
/// configured, this call will fail. /// configured, this call will fail.
/// ///
/// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface /// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) = 0; ///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Generate an authentication blob that can be used to securely login with /// Generate an authentication blob that can be used to securely login with
/// your backend, using SteamDatagram_ParseHostedServerLogin. (See /// your backend, using SteamDatagram_ParseHostedServerLogin. (See
@ -480,8 +529,97 @@ public:
/// and don't share it directly with clients. /// and don't share it directly with clients.
virtual EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) = 0; virtual EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) = 0;
//
// Relayed connections using custom signaling protocol
//
// This is used if you have your own method of sending out-of-band
// signaling / rendezvous messages through a mutually trusted channel.
//
/// Create a P2P "client" connection that does signaling over a custom
/// rendezvous/signaling channel.
///
/// pSignaling points to a new object that you create just for this connection.
/// It must stay valid until Release() is called. Once you pass the
/// object to this function, it assumes ownership. Release() will be called
/// from within the function call if the call fails. Furthermore, until Release()
/// is called, you should be prepared for methods to be invoked on your
/// object from any thread! You need to make sure your object is threadsafe!
/// Furthermore, you should make sure that dispatching the methods is done
/// as quickly as possible.
///
/// This function will immediately construct a connection in the "connecting"
/// state. Soon after (perhaps before this function returns, perhaps in another thread),
/// the connection will begin sending signaling messages by calling
/// ISteamNetworkingConnectionCustomSignaling::SendSignal.
///
/// When the remote peer accepts the connection (See
/// ISteamNetworkingCustomSignalingRecvContext::OnConnectRequest),
/// it will begin sending signaling messages. When these messages are received,
/// you can pass them to the connection using ReceivedP2PCustomSignal.
///
/// If you know the identity of the peer that you expect to be on the other end,
/// you can pass their identity to improve debug output or just detect bugs.
/// If you don't know their identity yet, you can pass NULL, and their
/// identity will be established in the connection handshake.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes
///
/// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Called when custom signaling has received a message. When your
/// signaling channel receives a message, it should save off whatever
/// routing information was in the envelope into the context object,
/// and then pass the payload to this function.
///
/// A few different things can happen next, depending on the message:
///
/// - If the signal is associated with existing connection, it is dealt
/// with immediately. If any replies need to be sent, they will be
/// dispatched using the ISteamNetworkingConnectionCustomSignaling
/// associated with the connection.
/// - If the message represents a connection request (and the request
/// is not redundant for an existing connection), a new connection
/// will be created, and ReceivedConnectRequest will be called on your
/// context object to determine how to proceed.
/// - Otherwise, the message is for a connection that does not
/// exist (anymore). In this case, we *may* call SendRejectionReply
/// on your context object.
///
/// In any case, we will not save off pContext or access it after this
/// function returns.
///
/// Returns true if the message was parsed and dispatched without anything
/// unusual or suspicious happening. Returns false if there was some problem
/// with the message that prevented ordinary handling. (Debug output will
/// usually have more information.)
///
/// If you expect to be using relayed connections, then you probably want
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext ) = 0;
#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR #endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR
/// Certificate provision by the application. (On Steam, Steam will handle all this automatically)
#ifndef STEAMNETWORKINGSOCKETS_STEAM
/// Get blob that describes a certificate request. You can send this to your game coordinator.
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
/// size. (256 bytes is a very conservative estimate.)
///
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
/// Set the certificate. The certificate blob should be the output of
/// SteamDatagram_CreateCert.
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
#endif
// Invoke all callbacks queued for this interface. // Invoke all callbacks queued for this interface.
// On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism. // On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism.
// So if you have code that is also targeting Steam, you should call this at about the // So if you have code that is also targeting Steam, you should call this at about the
@ -492,7 +630,84 @@ public:
protected: protected:
// ~ISteamNetworkingSockets(); // Silence some warnings // ~ISteamNetworkingSockets(); // Silence some warnings
}; };
#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets003" #define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets006"
/// Interface used to send signaling messages for a particular connection.
/// You will need to construct one of these per connection.
///
/// - For connections initiated locally, you will construct it and pass
/// it to ISteamNetworkingSockets::ConnectP2PCustomSignaling.
/// - For connections initiated remotely and "accepted" locally, you
/// will return it from ISteamNetworkingCustomSignalingRecvContext::OnConnectRequest
class ISteamNetworkingConnectionCustomSignaling
{
public:
/// Called to send a rendezvous message to the remote peer. This may be called
/// from any thread, at any time, so you need to be thread-safe! Don't take
/// any locks that might hold while calling into SteamNetworkingSockets functions,
/// because this could lead to deadlocks.
///
/// Note that when initiating a connection, we may not know the identity
/// of the peer, if you did not specify it in ConnectP2PCustomSignaling.
///
/// Return true if a best-effort attempt was made to deliver the message.
/// If you return false, it is assumed that the situation is fatal;
/// the connection will be closed, and Release() will be called
/// eventually.
///
/// Signaling objects will not be shared between connections.
/// You can assume that the same value of hConn will be used
/// every time.
virtual bool SendSignal( HSteamNetConnection hConn, const SteamNetConnectionInfo_t &info, const void *pMsg, int cbMsg ) = 0;
/// Called when the connection no longer needs to send signals.
/// Note that this happens eventually (but not immediately) after
/// the connection is closed. Signals may need to be sent for a brief
/// time after the connection is closed, to clean up the connection.
virtual void Release() = 0;
};
/// Interface used when a custom signal is received.
/// See ISteamNetworkingSockets::ReceivedP2PCustomSignal
class ISteamNetworkingCustomSignalingRecvContext
{
public:
/// Called when the signal represents a request for a new connection.
///
/// If you want to ignore the request, just return NULL. In this case,
/// the peer will NOT receive any reply. You should consider ignoring
/// requests rather than actively rejecting them, as a security measure.
/// If you actively reject requests, then this makes it possible to detect
/// if a user is online or not, just by sending them a request.
///
/// If you wish to send back a rejection, then use
/// ISteamNetworkingSockets::CloseConnection() and then return NULL.
/// We will marshal a properly formatted rejection signal and
/// call SendRejectionSignal() so you can send it to them.
///
/// If you return a signaling object, the connection is NOT immediately
/// accepted by default. Instead, it stays in the "connecting" state,
/// and the usual callback is posted, and your app can accept the
/// connection using ISteamNetworkingSockets::AcceptConnection. This
/// may be useful so that these sorts of connections can be more similar
/// to your application code as other types of connections accepted on
/// a listen socket. If this is not useful and you want to skip this
/// callback process and immediately accept the connection, call
/// ISteamNetworkingSockets::AcceptConnection before returning the
/// signaling object.
///
/// After accepting a connection (through either means), the connection
/// will transition into the "finding route" state.
virtual ISteamNetworkingConnectionCustomSignaling *OnConnectRequest( HSteamNetConnection hConn, const SteamNetworkingIdentity &identityPeer ) = 0;
/// This is called actively communication rejection or failure
/// to the incoming message. If you intend to ignore all incoming requests
/// that you do not wish to accept, then it's not strictly necessary to
/// implement this.
virtual void SendRejectionSignal( const SteamNetworkingIdentity &identityPeer, const void *pMsg, int cbMsg ) = 0;
};
extern "C" { extern "C" {
@ -506,7 +721,7 @@ extern "C" {
inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_Lib(); } inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_Lib(); }
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_Lib(); } inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_Lib(); }
#elif defined( STEAMNETWORKINGSOCKETS_OPENSOURCE ) #elif defined( STEAMNETWORKINGSOCKETS_OPENSOURCE ) || defined( STEAMNETWORKINGSOCKETS_STREAMINGCLIENT )
// Opensource GameNetworkingSockets // Opensource GameNetworkingSockets
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets(); STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets();
@ -585,6 +800,8 @@ struct SteamNetConnectionStatusChangedCallback_t
/// - The list of trusted CA certificates that might be relevant for this /// - The list of trusted CA certificates that might be relevant for this
/// app. /// app.
/// - A valid certificate issued by a CA. /// - A valid certificate issued by a CA.
///
/// This callback is posted whenever the state of our readiness changes.
struct SteamNetAuthenticationStatus_t struct SteamNetAuthenticationStatus_t
{ {
enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 2 }; enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 2 };

View File

@ -0,0 +1,463 @@
#ifndef ISTEAMNETWORKINGSOCKETS003
#define ISTEAMNETWORKINGSOCKETS003
class ISteamNetworkingSockets003
{
public:
/// Creates a "server" socket that listens for clients to connect to by
/// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
///
/// You must select a specific local port to listen on and set it
/// the port field of the local address.
///
/// Usually you wil set the IP portion of the address to zero, (SteamNetworkingIPAddr::Clear()).
/// This means that you will not bind to any particular local interface. In addition,
/// if possible the socket will be bound in "dual stack" mode, which means that it can
/// accept both IPv4 and IPv6 clients. If you wish to bind a particular interface, then
/// set the local address to the appropriate IPv4 or IPv6 IP.
///
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
/// will be posted. The connection will be in the connecting state.
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) = 0;
/// Creates a connection and begins talking to a "server" over UDP at the
/// given IPv4 or IPv6 address. The remote host must be listening with a
/// matching call to CreateListenSocketIP on the specified port.
///
/// A SteamNetConnectionStatusChangedCallback_t callback will be triggered when we start
/// connecting, and then another one on either timeout or successful connection.
///
/// If the server does not have any identity configured, then their network address
/// will be the only identity in use. Or, the network host may provide a platform-specific
/// identity with or without a valid certificate to authenticate that identity. (These
/// details will be contained in the SteamNetConnectionStatusChangedCallback_t.) It's
/// up to your application to decide whether to allow the connection.
///
/// By default, all connections will get basic encryption sufficient to prevent
/// casual eavesdropping. But note that without certificates (or a shared secret
/// distributed through some other out-of-band mechanism), you don't have any
/// way of knowing who is actually on the other end, and thus are vulnerable to
/// man-in-the-middle attacks.
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) = 0;
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P
///
/// nVirtualPort specifies how clients can connect to this socket using
/// ConnectP2P. It's very common for applications to only have one listening socket;
/// in that case, use zero. If you need to open multiple listen sockets and have clients
/// be able to connect to one or the other, then nVirtualPort should be a small integer (<1000)
/// unique to each listen socket you create.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes
virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) = 0;
/// Begin connecting to a server that is identified using a platform-specific identifier.
/// This requires some sort of third party rendezvous service, and will depend on the
/// platform and what other libraries and services you are integrating with.
///
/// At the time of this writing, there is only one supported rendezvous service: Steam.
/// Set the SteamID (whether "user" or "gameserver") and Steam will determine if the
/// client is online and facilitate a relay connection. Note that all P2P connections on
/// Steam are currently relayed.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0;
#endif
/// Accept an incoming connection that has been received on a listen socket.
///
/// When a connection attempt is received (perhaps after a few basic handshake
/// packets have been exchanged to prevent trivial spoofing), a connection interface
/// object is created in the k_ESteamNetworkingConnectionState_Connecting state
/// and a SteamNetConnectionStatusChangedCallback_t is posted. At this point, your
/// application MUST either accept or close the connection. (It may not ignore it.)
/// Accepting the connection will transition it either into the connected state,
/// or the finding route state, depending on the connection type.
///
/// You should take action within a second or two, because accepting the connection is
/// what actually sends the reply notifying the client that they are connected. If you
/// delay taking action, from the client's perspective it is the same as the network
/// being unresponsive, and the client may timeout the connection attempt. In other
/// words, the client cannot distinguish between a delay caused by network problems
/// and a delay caused by the application.
///
/// This means that if your application goes for more than a few seconds without
/// processing callbacks (for example, while loading a map), then there is a chance
/// that a client may attempt to connect in that interval and fail due to timeout.
///
/// If the application does not respond to the connection attempt in a timely manner,
/// and we stop receiving communication from the client, the connection attempt will
/// be timed out locally, transitioning the connection to the
/// k_ESteamNetworkingConnectionState_ProblemDetectedLocally state. The client may also
/// close the connection before it is accepted, and a transition to the
/// k_ESteamNetworkingConnectionState_ClosedByPeer is also possible depending the exact
/// sequence of events.
///
/// Returns k_EResultInvalidParam if the handle is invalid.
/// Returns k_EResultInvalidState if the connection is not in the appropriate state.
/// (Remember that the connection state could change in between the time that the
/// notification being posted to the queue and when it is received by the application.)
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
/// Disconnects from the remote host and invalidates the connection handle.
/// Any unread data on the connection is discarded.
///
/// nReason is an application defined code that will be received on the other
/// end and recorded (when possible) in backend analytics. The value should
/// come from a restricted range. (See ESteamNetConnectionEnd.) If you don't need
/// to communicate any information to the remote host, and do not want analytics to
/// be able to distinguish "normal" connection terminations from "exceptional" ones,
/// You may pass zero, in which case the generic value of
/// k_ESteamNetConnectionEnd_App_Generic will be used.
///
/// pszDebug is an optional human-readable diagnostic string that will be received
/// by the remote host and recorded (when possible) in backend analytics.
///
/// If you wish to put the socket into a "linger" state, where an attempt is made to
/// flush any remaining sent data, use bEnableLinger=true. Otherwise reliable data
/// is not flushed.
///
/// If the connection has already ended and you are just freeing up the
/// connection interface, the reason code, debug string, and linger flag are
/// ignored.
virtual bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger ) = 0;
/// Destroy a listen socket. All the connections that were accepting on the listen
/// socket are closed ungracefully.
virtual bool CloseListenSocket( HSteamListenSocket hSocket ) = 0;
/// Set connection user data. the data is returned in the following places
/// - You can query it using GetConnectionUserData.
/// - The SteamNetworkingmessage_t structure.
/// - The SteamNetConnectionInfo_t structure. (Which is a member of SteamNetConnectionStatusChangedCallback_t.)
///
/// Returns false if the handle is invalid.
virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0;
/// Fetch connection user data. Returns -1 if handle is invalid
/// or if you haven't set any userdata on the connection.
virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) = 0;
/// Set a name for the connection, used mostly for debugging
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0;
/// Fetch connection name. Returns false if handle is invalid
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0;
/// Send a message to the remote host on the specified connection.
///
/// nSendFlags determines the delivery guarantees that will be provided,
/// when data should be buffered, etc. E.g. k_nSteamNetworkingSend_Unreliable
///
/// Note that the semantics we use for messages are not precisely
/// the same as the semantics of a standard "stream" socket.
/// (SOCK_STREAM) For an ordinary stream socket, the boundaries
/// between chunks are not considered relevant, and the sizes of
/// the chunks of data written will not necessarily match up to
/// the sizes of the chunks that are returned by the reads on
/// the other end. The remote host might read a partial chunk,
/// or chunks might be coalesced. For the message semantics
/// used here, however, the sizes WILL match. Each send call
/// will match a successful read call on the remote host
/// one-for-one. If you are porting existing stream-oriented
/// code to the semantics of reliable messages, your code should
/// work the same, since reliable message semantics are more
/// strict than stream semantics. The only caveat is related to
/// performance: there is per-message overhead to retain the
/// message sizes, and so if your code sends many small chunks
/// of data, performance will suffer. Any code based on stream
/// sockets that does not write excessively small chunks will
/// work without any changes.
///
/// Returns:
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
/// - k_EResultInvalidState: connection is in an invalid state
/// - k_EResultNoConnection: connection has ended
/// - k_EResultIgnored: You used k_nSteamNetworkingSend_NoDelay, and the message was dropped because
/// we were not ready to send it.
/// - k_EResultLimitExceeded: there was already too much data queued to be sent.
/// (See k_ESteamNetworkingConfig_SendBufferSize)
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags ) = 0;
/// Flush any messages waiting on the Nagle timer and send them
/// at the next transmission opportunity (often that means right now).
///
/// If Nagle is enabled (it's on by default) then when calling
/// SendMessageToConnection the message will be buffered, up to the Nagle time
/// before being sent, to merge small messages into the same packet.
/// (See k_ESteamNetworkingConfig_NagleTime)
///
/// Returns:
/// k_EResultInvalidParam: invalid connection handle
/// k_EResultInvalidState: connection is in an invalid state
/// k_EResultNoConnection: connection has ended
/// k_EResultIgnored: We weren't (yet) connected, so this operation has no effect.
virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) = 0;
/// Fetch the next available message(s) from the connection, if any.
/// Returns the number of messages returned into your array, up to nMaxMessages.
/// If the connection handle is invalid, -1 is returned.
///
/// The order of the messages returned in the array is relevant.
/// Reliable messages will be received in the order they were sent (and with the
/// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket).
///
/// Unreliable messages may be dropped, or delivered out of order withrespect to
/// each other or with respect to reliable messages. The same unreliable message
/// may be received multiple times.
///
/// If any messages are returned, you MUST call SteamNetworkingMessage_t::Release() on each
/// of them free up resources after you are done. It is safe to keep the object alive for
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
/// Same as ReceiveMessagesOnConnection, but will return the next message available
/// on any connection that was accepted through the specified listen socket. Examine
/// SteamNetworkingMessage_t::m_conn to know which client connection.
///
/// Delivery order of messages among different clients is not defined. They may
/// be returned in an order different from what they were actually received. (Delivery
/// order of messages from the same client is well defined, and thus the order of the
/// messages is relevant!)
virtual int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
/// Returns basic information about the high-level state of the connection.
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
/// Returns a small set of information about the real-time state of the connection
/// Returns false if the connection handle is invalid, or the connection has ended.
virtual bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) = 0;
/// Returns detailed connection stats in text format. Useful
/// for dumping to a log, etc.
///
/// Returns:
/// -1 failure (bad connection handle)
/// 0 OK, your buffer was filled in and '\0'-terminated
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated.
/// Try again with a buffer of at least N bytes.
virtual int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) = 0;
/// Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to.
///
/// An IPv6 address of ::0 means "any IPv4 or IPv6"
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
virtual bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) = 0;
/// Create a pair of connections that are talking to each other, e.g. a loopback connection.
/// This is very useful for testing, or so that your client/server code can work the same
/// even when you are running a local "server".
///
/// The two connections will immediately be placed into the connected state, and no callbacks
/// will be posted immediately. After this, if you close either connection, the other connection
/// will receive a callback, exactly as if they were communicating over the network. You must
/// close *both* sides in order to fully clean up the resources!
///
/// By default, internal buffers are used, completely bypassing the network, the chopping up of
/// messages into packets, encryption, copying the payload, etc. This means that loopback
/// packets, by default, will not simulate lag or loss. Passing true for bUseNetworkLoopback will
/// cause the socket pair to send packets through the local network loopback device (127.0.0.1)
/// on ephemeral ports. Fake lag and loss are supported in this case, and CPU time is expended
/// to encrypt and decrypt.
///
/// If you wish to assign a specific identity to either connection, you may pass a particular
/// identity. Otherwise, if you pass nullptr, the respective connection will assume a generic
/// "localhost" identity. If you use real network loopback, this might be translated to the
/// actual bound loopback port. Otherwise, the port will be zero.
virtual bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 ) = 0;
/// Get the identity assigned to this interface.
/// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned
/// to the gameserver. Returns false and sets the result to an invalid identity if we don't know
/// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID
/// even if they are not signed into Steam.)
virtual bool GetIdentity( SteamNetworkingIdentity *pIdentity ) = 0;
/// Indicate our desire to be ready participate in authenticated communications.
/// If we are currently not ready, then steps will be taken to obtain the necessary
/// certificates. (This includes a certificate for us, as well as any CA certificates
/// needed to authenticate peers.)
///
/// You can call this at program init time if you know that you are going to
/// be making authenticated connections, so that we will be ready immediately when
/// those connections are attempted. (Note that essentially all connections require
/// authentication, with the exception of ordinary UDP connections with authentication
/// disabled using k_ESteamNetworkingConfig_IP_AllowWithoutAuth.) If you don't call
/// this function, we will wait until a feature is utilized that that necessitates
/// these resources.
///
/// You can also call this function to force a retry, if failure has occurred.
/// Once we make an attempt and fail, we will not automatically retry.
/// In this respect, the behavior of the system after trying and failing is the same
/// as before the first attempt: attempting authenticated communication or calling
/// this function will call the system to attempt to acquire the necessary resources.
///
/// You can use GetAuthenticationStatus or listen for SteamNetAuthenticationStatus_t
/// to monitor the status.
///
/// Returns the current value that would be returned from GetAuthenticationStatus.
virtual ESteamNetworkingAvailability InitAuthentication() = 0;
/// Query our readiness to participate in authenticated communications. A
/// SteamNetAuthenticationStatus_t callback is posted any time this status changes,
/// but you can use this function to query it at any time.
///
/// The value of SteamNetAuthenticationStatus_t::m_eAvail is returned. If you only
/// want this high level status, you can pass NULL for pDetails. If you want further
/// details, pass non-NULL to receive them.
virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0;
/// Certificate provision by the application. (On Steam, Steam will handle all this automatically)
#ifndef STEAMNETWORKINGSOCKETS_STEAM
/// Get blob that describes a certificate request. You can send this to your game coordinator.
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
/// size. (256 bytes is a very conservative estimate.)
///
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
/// Set the certificate. The certificate blob should be the output of
/// SteamDatagram_CreateCert.
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
#endif
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
//
// Clients connecting to dedicated servers hosted in a data center,
// using central-authority-granted tickets.
//
/// Call this when you receive a ticket from your backend / matchmaking system. Puts the
/// ticket into a persistent cache, and optionally returns the parsed ticket.
///
/// See stamdatagram_ticketgen.h for more details.
virtual bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
/// Search cache for a ticket to talk to the server on the specified virtual port.
/// If found, returns the number of seconds until the ticket expires, and optionally
/// the complete cracked ticket. Returns 0 if we don't have a ticket.
///
/// Typically this is useful just to confirm that you have a ticket, before you
/// call ConnectToHostedDedicatedServer to connect to the server.
virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
/// Client call to connect to a server hosted in a Valve data center, on the specified virtual
/// port. You must have placed a ticket for this server into the cache, or else this connect attempt will fail!
///
/// You may wonder why tickets are stored in a cache, instead of simply being passed as an argument
/// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
/// when your app initializes
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) = 0;
//
// Servers hosted in data centers known to the Valve relay network
//
/// Returns the value of the SDR_LISTEN_PORT environment variable. This
/// is the UDP server your server will be listening on. This will
/// configured automatically for you in production environments.
///
/// In development, you'll need to set it yourself. See
/// https://partner.steamgames.com/doc/api/ISteamNetworkingSockets
/// for more information on how to configure dev environments.
virtual uint16 GetHostedDedicatedServerPort() = 0;
/// Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server
/// is running in. This will be k_SteamDatagramPOPID_dev in non-production envirionment.
virtual SteamNetworkingPOPID GetHostedDedicatedServerPOPID() = 0;
/// Return info about the hosted server. This contains the PoPID of the server,
/// and opaque routing information that can be used by the relays to send traffic
/// to your server.
///
/// You will need to send this information to your backend, and put it in tickets,
/// so that the relays will know how to forward traffic from
/// clients to your server. See SteamDatagramRelayAuthTicket for more info.
///
/// Also, note that the routing information is contained in SteamDatagramGameCoordinatorServerLogin,
/// so if possible, it's preferred to use GetGameCoordinatorServerLogin to send this info
/// to your game coordinator service, and also login securely at the same time.
///
/// On a successful exit, k_EResultOK is returned
///
/// Unsuccessful exit:
/// - Something other than k_EResultOK is returned.
/// - k_EResultInvalidState: We are not configured to listen for SDR (SDR_LISTEN_SOCKET
/// is not set.)
/// - k_EResultPending: we do not (yet) have the authentication information needed.
/// (See GetAuthenticationStatus.) If you use environment variables to pre-fetch
/// the network config, this data should always be available immediately.
/// - A non-localized diagnostic debug message will be placed in m_data that describes
/// the cause of the failure.
///
/// NOTE: The returned blob is not encrypted. Send it to your backend, but don't
/// directly share it with clients.
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
/// Create a listen socket on the specified virtual port. The physical UDP port to use
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
/// configured, this call will fail.
///
/// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) = 0;
/// Generate an authentication blob that can be used to securely login with
/// your backend, using SteamDatagram_ParseHostedServerLogin. (See
/// steamdatagram_gamecoordinator.h)
///
/// Before calling the function:
/// - Populate the app data in pLoginInfo (m_cbAppData and m_appData). You can leave
/// all other fields uninitialized.
/// - *pcbSignedBlob contains the size of the buffer at pBlob. (It should be
/// at least k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized.)
///
/// On a successful exit:
/// - k_EResultOK is returned
/// - All of the remaining fields of pLoginInfo will be filled out.
/// - *pcbSignedBlob contains the size of the serialized blob that has been
/// placed into pBlob.
///
/// Unsuccessful exit:
/// - Something other than k_EResultOK is returned.
/// - k_EResultNotLoggedOn: you are not logged in (yet)
/// - See GetHostedDedicatedServerAddress for more potential failure return values.
/// - A non-localized diagnostic debug message will be placed in pBlob that describes
/// the cause of the failure.
///
/// This works by signing the contents of the SteamDatagramGameCoordinatorServerLogin
/// with the cert that is issued to this server. In dev environments, it's OK if you do
/// not have a cert. (You will need to enable insecure dev login in SteamDatagram_ParseHostedServerLogin.)
/// Otherwise, you will need a signed cert.
///
/// NOTE: The routing blob returned here is not encrypted. Send it to your backend
/// and don't share it directly with clients.
virtual EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) = 0;
#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR
// Invoke all callbacks queued for this interface.
// On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism.
// So if you have code that is also targeting Steam, you should call this at about the
// same time you would call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks.
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
virtual void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks ) = 0;
#endif
protected:
// ~ISteamNetworkingSockets(); // Silence some warnings
};
#endif // ISTEAMNETWORKINGSOCKETS003

View File

@ -22,6 +22,35 @@ struct SteamRelayNetworkStatus_t;
class ISteamNetworkingUtils class ISteamNetworkingUtils
{ {
public: public:
//
// Efficient message sending
//
/// Allocate and initialize a message object. Usually the reason
/// you call this is to pass it to ISteamNetworkingSockets::SendMessages.
/// The returned object will have all of the relevant fields cleared to zero.
///
/// Optionally you can also request that this system allocate space to
/// hold the payload itself. If cbAllocateBuffer is nonzero, the system
/// will allocate memory to hold a payload of at least cbAllocateBuffer bytes.
/// m_pData will point to the allocated buffer, m_cbSize will be set to the
/// size, and m_pfnFreeData will be set to the proper function to free up
/// the buffer.
///
/// If cbAllocateBuffer=0, then no buffer is allocated. m_pData will be NULL,
/// m_cbSize will be zero, and m_pfnFreeData will be NULL. You will need to
/// set each of these.
///
/// You can use SteamNetworkingMessage_t::Release to free up the message
/// bookkeeping object and any associated buffer. See
/// ISteamNetworkingSockets::SendMessages for details on reference
/// counting and ownership.
virtual SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer ) = 0;
//
// Access to Steam Datagram Relay (SDR) network
//
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
// //
@ -203,8 +232,9 @@ public:
/// ///
/// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg /// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
/// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT /// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT
/// request a high detail level and then filter out messages in your callback. Instead, /// request a high detail level and then filter out messages in your callback. This incurs
/// call function function to adjust the desired level of detail. /// all of the expense of formatting the messages, which are then discarded. Setting a high
/// priority value (low numeric value) here allows the library to avoid doing this work.
/// ///
/// IMPORTANT: This may be called from a service thread, while we own a mutex, etc. /// IMPORTANT: This may be called from a service thread, while we own a mutex, etc.
/// Your output function must be threadsafe and fast! Do not make any other /// Your output function must be threadsafe and fast! Do not make any other
@ -228,7 +258,7 @@ public:
/// - eScope: Onto what type of object are you applying the setting? /// - eScope: Onto what type of object are you applying the setting?
/// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc. /// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.
/// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly! /// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!
/// - pArg: Value to set it to. You can pass NULL to remove a non-global sett at this scope, /// - pArg: Value to set it to. You can pass NULL to remove a non-global setting at this scope,
/// causing the value for that object to use global defaults. Or at global scope, passing NULL /// causing the value for that object to use global defaults. Or at global scope, passing NULL
/// will reset any custom value and restore it to the system default. /// will reset any custom value and restore it to the system default.
/// NOTE: When setting callback functions, do not pass the function pointer directly. /// NOTE: When setting callback functions, do not pass the function pointer directly.
@ -236,6 +266,12 @@ public:
virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0; ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0;
/// Set a configuration value, using a struct to pass the value.
/// (This is just a convenience shortcut; see below for the implementation and
/// a little insight into how SteamNetworkingConfigValue_t is used when
/// setting config options during listen socket and connection creation.)
bool SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj );
/// Get a configuration value. /// Get a configuration value.
/// - eValue: which value to fetch /// - eValue: which value to fetch
/// - eScopeType: query setting on what type of object /// - eScopeType: query setting on what type of object
@ -250,6 +286,9 @@ public:
/// pOutNextValue can be used to iterate through all of the known configuration values. /// pOutNextValue can be used to iterate through all of the known configuration values.
/// (Use GetFirstConfigValue() to begin the iteration, will be k_ESteamNetworkingConfig_Invalid on the last value) /// (Use GetFirstConfigValue() to begin the iteration, will be k_ESteamNetworkingConfig_Invalid on the last value)
/// Any of the output parameters can be NULL if you do not need that information. /// Any of the output parameters can be NULL if you do not need that information.
///
/// See k_ESteamNetworkingConfig_EnumerateDevVars for some more info about "dev" variables,
/// which are usually excluded from the set of variables enumerated using this function.
virtual bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue ) = 0; virtual bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue ) = 0;
/// Return the lowest numbered configuration value available in the current environment. /// Return the lowest numbered configuration value available in the current environment.
@ -265,7 +304,7 @@ public:
protected: protected:
// ~ISteamNetworkingUtils(); // Silence some warnings // ~ISteamNetworkingUtils(); // Silence some warnings
}; };
#define STEAMNETWORKINGUTILS_INTERFACE_VERSION "SteamNetworkingUtils002" #define STEAMNETWORKINGUTILS_INTERFACE_VERSION "SteamNetworkingUtils003"
// Global accessor. // Global accessor.
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB #ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
@ -281,7 +320,13 @@ protected:
#ifndef STEAM_API_EXPORTS #ifndef STEAM_API_EXPORTS
// Steamworks SDK // Steamworks SDK
inline ISteamNetworkingUtils *SteamNetworkingUtils(); inline ISteamNetworkingUtils *SteamNetworkingUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) ); STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils,
/* Prefer user version of the interface. But if it isn't found, then use
gameserver one. Yes, this is a completely terrible hack */
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) ?
SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) :
SteamInternal_FindOrCreateGameServerInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION )
)
#else #else
inline ISteamNetworkingUtils *SteamNetworkingUtils() { return (ISteamNetworkingUtils *)SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION );} inline ISteamNetworkingUtils *SteamNetworkingUtils() { return (ISteamNetworkingUtils *)SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION );}
#endif #endif
@ -337,6 +382,13 @@ inline bool ISteamNetworkingUtils::SetGlobalConfigValueString( ESteamNetworkingC
inline bool ISteamNetworkingUtils::SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Int32, &val ); } inline bool ISteamNetworkingUtils::SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Int32, &val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Float, &val ); } inline bool ISteamNetworkingUtils::SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Float, &val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_String, val ); } inline bool ISteamNetworkingUtils::SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_String, val ); }
inline bool ISteamNetworkingUtils::SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj )
{
// Locate the argument. Strings are a special case, since the
// "value" (the whole string buffer) doesn't fit in the struct
const void *pVal = ( opt.m_eDataType == k_ESteamNetworkingConfig_String ) ? (const void *)opt.m_val.m_string : (const void *)&opt.m_val;
return SetConfigValue( opt.m_eValue, eScopeType, scopeObj, opt.m_eDataType, pVal );
}
#if !defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) && defined( STEAMNETWORKINGSOCKETS_STEAMCLIENT ) #if !defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) && defined( STEAMNETWORKINGSOCKETS_STEAMCLIENT )
inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingUtils()->SteamNetworkingIPAddr_ToString( *this, buf, cbBuf, bWithPort ); } inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingUtils()->SteamNetworkingIPAddr_ToString( *this, buf, cbBuf, bWithPort ); }

View File

@ -0,0 +1,255 @@
#ifndef ISTEAMNETWORKINGUTILS002
#define ISTEAMNETWORKINGUTILS002
//-----------------------------------------------------------------------------
/// Misc networking utilities for checking the local networking environment
/// and estimating pings.
class ISteamNetworkingUtils002
{
public:
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
//
// Initialization and status check
//
/// If you know that you are going to be using the relay network, call
/// this to initialize the relay network or check if that initialization
/// has completed. If you do not call this, the initialization will
/// happen the first time you use a feature that requires access to the
/// relay network, and that use will be delayed.
///
/// Use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
/// callbacks to know when initialization has completed.
/// Typically initialization completes in a few seconds.
///
/// Note: dedicated servers hosted in known data centers do *not* need
/// to call this, since they do not make routing decisions. However, if
/// the dedicated server will be using P2P functionality, it will act as
/// a "client" and this should be called.
inline void InitRelayNetworkAccess();
/// Fetch current status of the relay network.
///
/// SteamRelayNetworkStatus_t is also a callback. It will be triggered on
/// both the user and gameserver interfaces any time the status changes, or
/// ping measurement starts or stops.
///
/// SteamRelayNetworkStatus_t::m_eAvail is returned. If you want
/// more details, you can pass a non-NULL value.
virtual ESteamNetworkingAvailability GetRelayNetworkStatus( SteamRelayNetworkStatus_t *pDetails ) = 0;
//
// "Ping location" functions
//
// We use the ping times to the valve relays deployed worldwide to
// generate a "marker" that describes the location of an Internet host.
// Given two such markers, we can estimate the network latency between
// two hosts, without sending any packets. The estimate is based on the
// optimal route that is found through the Valve network. If you are
// using the Valve network to carry the traffic, then this is precisely
// the ping you want. If you are not, then the ping time will probably
// still be a reasonable estimate.
//
// This is extremely useful to select peers for matchmaking!
//
// The markers can also be converted to a string, so they can be transmitted.
// We have a separate library you can use on your app's matchmaking/coordinating
// server to manipulate these objects. (See steamdatagram_gamecoordinator.h)
/// Return location info for the current host. Returns the approximate
/// age of the data, in seconds, or -1 if no data is available.
///
/// It takes a few seconds to initialize access to the relay network. If
/// you call this very soon after calling InitRelayNetworkAccess,
/// the data may not be available yet.
///
/// This always return the most up-to-date information we have available
/// right now, even if we are in the middle of re-calculating ping times.
virtual float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) = 0;
/// Estimate the round-trip latency between two arbitrary locations, in
/// milliseconds. This is a conservative estimate, based on routing through
/// the relay network. For most basic relayed connections, this ping time
/// will be pretty accurate, since it will be based on the route likely to
/// be actually used.
///
/// If a direct IP route is used (perhaps via NAT traversal), then the route
/// will be different, and the ping time might be better. Or it might actually
/// be a bit worse! Standard IP routing is frequently suboptimal!
///
/// But even in this case, the estimate obtained using this method is a
/// reasonable upper bound on the ping time. (Also it has the advantage
/// of returning immediately and not sending any packets.)
///
/// In a few cases we might not able to estimate the route. In this case
/// a negative value is returned. k_nSteamNetworkingPing_Failed means
/// the reason was because of some networking difficulty. (Failure to
/// ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot
/// currently answer the question for some other reason.
///
/// Do you need to be able to do this from a backend/matchmaking server?
/// You are looking for the "ticketgen" library.
virtual int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 ) = 0;
/// Same as EstimatePingTime, but assumes that one location is the local host.
/// This is a bit faster, especially if you need to calculate a bunch of
/// these in a loop to find the fastest one.
///
/// In rare cases this might return a slightly different estimate than combining
/// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because
/// this function uses a slightly more complete set of information about what
/// route would be taken.
virtual int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation ) = 0;
/// Convert a ping location into a text format suitable for sending over the wire.
/// The format is a compact and human readable. However, it is subject to change
/// so please do not parse it yourself. Your buffer must be at least
/// k_cchMaxSteamNetworkingPingLocationString bytes.
virtual void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize ) = 0;
/// Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand
/// the string.
virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) = 0;
/// Check if the ping data of sufficient recency is available, and if
/// it's too old, start refreshing it.
///
/// Please only call this function when you *really* do need to force an
/// immediate refresh of the data. (For example, in response to a specific
/// user input to refresh this information.) Don't call it "just in case",
/// before every connection, etc. That will cause extra traffic to be sent
/// for no benefit. The library will automatically refresh the information
/// as needed.
///
/// Returns true if sufficiently recent data is already available.
///
/// Returns false if sufficiently recent data is not available. In this
/// case, ping measurement is initiated, if it is not already active.
/// (You cannot restart a measurement already in progress.)
///
/// You can use GetRelayNetworkStatus or listen for SteamRelayNetworkStatus_t
/// to know when ping measurement completes.
virtual bool CheckPingDataUpToDate( float flMaxAgeSeconds ) = 0;
//
// List of Valve data centers, and ping times to them. This might
// be useful to you if you are use our hosting, or just need to measure
// latency to a cloud data center where we are running relays.
//
/// Fetch ping time of best available relayed route from this host to
/// the specified data center.
virtual int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP ) = 0;
/// Get *direct* ping time to the relays at the data center.
virtual int GetDirectPingToPOP( SteamNetworkingPOPID popID ) = 0;
/// Get number of network points of presence in the config
virtual int GetPOPCount() = 0;
/// Get list of all POP IDs. Returns the number of entries that were filled into
/// your list.
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
#endif // #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
//
// Misc
//
/// Fetch current timestamp. This timer has the following properties:
///
/// - Monotonicity is guaranteed.
/// - The initial value will be at least 24*3600*30*1e6, i.e. about
/// 30 days worth of microseconds. In this way, the timestamp value of
/// 0 will always be at least "30 days ago". Also, negative numbers
/// will never be returned.
/// - Wraparound / overflow is not a practical concern.
///
/// If you are running under the debugger and stop the process, the clock
/// might not advance the full wall clock time that has elapsed between
/// calls. If the process is not blocked from normal operation, the
/// timestamp values will track wall clock time, even if you don't call
/// the function frequently.
///
/// The value is only meaningful for this run of the process. Don't compare
/// it to values obtained on another computer, or other runs of the same process.
virtual SteamNetworkingMicroseconds GetLocalTimestamp() = 0;
/// Set a function to receive network-related information that is useful for debugging.
/// This can be very useful during development, but it can also be useful for troubleshooting
/// problems with tech savvy end users. If you have a console or other log that customers
/// can examine, these log messages can often be helpful to troubleshoot network issues.
/// (Especially any warning/error messages.)
///
/// The detail level indicates what message to invoke your callback on. Lower numeric
/// value means more important, and the value you pass is the lowest priority (highest
/// numeric value) you wish to receive callbacks for.
///
/// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
/// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT
/// request a high detail level and then filter out messages in your callback. Instead,
/// call function function to adjust the desired level of detail.
///
/// IMPORTANT: This may be called from a service thread, while we own a mutex, etc.
/// Your output function must be threadsafe and fast! Do not make any other
/// Steamworks calls from within the handler.
virtual void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc ) = 0;
//
// Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.
//
// Shortcuts for common cases. (Implemented as inline functions below)
bool SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val );
bool SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val );
bool SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val );
bool SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val );
bool SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val );
bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val );
/// Set a configuration value.
/// - eValue: which value is being set
/// - eScope: Onto what type of object are you applying the setting?
/// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.
/// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!
/// - pArg: Value to set it to. You can pass NULL to remove a non-global sett at this scope,
/// causing the value for that object to use global defaults. Or at global scope, passing NULL
/// will reset any custom value and restore it to the system default.
/// NOTE: When setting callback functions, do not pass the function pointer directly.
/// Your argument should be a pointer to a function pointer.
virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0;
/// Get a configuration value.
/// - eValue: which value to fetch
/// - eScopeType: query setting on what type of object
/// - eScopeArg: the object to query the setting for
/// - pOutDataType: If non-NULL, the data type of the value is returned.
/// - pResult: Where to put the result. Pass NULL to query the required buffer size. (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)
/// - cbResult: IN: the size of your buffer. OUT: the number of bytes filled in or required.
virtual ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult ) = 0;
/// Returns info about a configuration value. Returns false if the value does not exist.
/// pOutNextValue can be used to iterate through all of the known configuration values.
/// (Use GetFirstConfigValue() to begin the iteration, will be k_ESteamNetworkingConfig_Invalid on the last value)
/// Any of the output parameters can be NULL if you do not need that information.
virtual bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue ) = 0;
/// Return the lowest numbered configuration value available in the current environment.
virtual ESteamNetworkingConfigValue GetFirstConfigValue() = 0;
// String conversions. You'll usually access these using the respective
// inline methods.
virtual void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort ) = 0;
virtual bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ) = 0;
virtual void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ) = 0;
virtual bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) = 0;
protected:
// ~ISteamNetworkingUtils(); // Silence some warnings
};
#endif // ISTEAMNETWORKINGUTILS002

View File

@ -14,13 +14,16 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
enum ESteamDeviceFormFactor enum ESteamDeviceFormFactor
{ {
k_ESteamDeviceFormFactorUnknown, k_ESteamDeviceFormFactorUnknown = 0,
k_ESteamDeviceFormFactorPhone, k_ESteamDeviceFormFactorPhone = 1,
k_ESteamDeviceFormFactorTablet, k_ESteamDeviceFormFactorTablet = 2,
k_ESteamDeviceFormFactorComputer, k_ESteamDeviceFormFactorComputer = 3,
k_ESteamDeviceFormFactorTV, k_ESteamDeviceFormFactorTV = 4,
}; };
// Steam Remote Play session ID
typedef uint32 RemotePlaySessionID_t;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Functions to provide information about Steam Remote Play sessions // Purpose: Functions to provide information about Steam Remote Play sessions
@ -32,21 +35,25 @@ public:
virtual uint32 GetSessionCount() = 0; virtual uint32 GetSessionCount() = 0;
// Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds. // Get the currently connected Steam Remote Play session ID at the specified index. Returns zero if index is out of bounds.
virtual uint32 GetSessionID( int iSessionIndex ) = 0; virtual RemotePlaySessionID_t GetSessionID( int iSessionIndex ) = 0;
// Get the SteamID of the connected user // Get the SteamID of the connected user
virtual CSteamID GetSessionSteamID( uint32 unSessionID ) = 0; virtual CSteamID GetSessionSteamID( RemotePlaySessionID_t unSessionID ) = 0;
// Get the name of the session client device // Get the name of the session client device
// This returns NULL if the sessionID is not valid // This returns NULL if the sessionID is not valid
virtual const char *GetSessionClientName( uint32 unSessionID ) = 0; virtual const char *GetSessionClientName( RemotePlaySessionID_t unSessionID ) = 0;
// Get the form factor of the session client device // Get the form factor of the session client device
virtual ESteamDeviceFormFactor GetSessionClientFormFactor( uint32 unSessionID ) = 0; virtual ESteamDeviceFormFactor GetSessionClientFormFactor( RemotePlaySessionID_t unSessionID ) = 0;
// Get the resolution, in pixels, of the session client device // Get the resolution, in pixels, of the session client device
// This is set to 0x0 if the resolution is not available // This is set to 0x0 if the resolution is not available
virtual bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *pnResolutionY ) = 0; virtual bool BGetSessionClientResolution( RemotePlaySessionID_t unSessionID, int *pnResolutionX, int *pnResolutionY ) = 0;
// Invite a friend to Remote Play Together
// This returns false if the invite can't be sent
virtual bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend ) = 0;
}; };
#define STEAMREMOTEPLAY_INTERFACE_VERSION "STEAMREMOTEPLAY_INTERFACE_VERSION001" #define STEAMREMOTEPLAY_INTERFACE_VERSION "STEAMREMOTEPLAY_INTERFACE_VERSION001"
@ -66,12 +73,12 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemotePlay *, SteamRemotePlay, STEAM
STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionConnected_t, k_iSteamRemotePlayCallbacks + 1 ) STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionConnected_t, k_iSteamRemotePlayCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, uint32, m_unSessionID ) STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
STEAM_CALLBACK_END( 0 ) STEAM_CALLBACK_END( 0 )
STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionDisconnected_t, k_iSteamRemotePlayCallbacks + 2 ) STEAM_CALLBACK_BEGIN( SteamRemotePlaySessionDisconnected_t, k_iSteamRemotePlayCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, uint32, m_unSessionID ) STEAM_CALLBACK_MEMBER( 0, RemotePlaySessionID_t, m_unSessionID )
STEAM_CALLBACK_END( 0 ) STEAM_CALLBACK_END( 0 )

View File

@ -65,9 +65,10 @@ enum ERemoteStoragePlatform
k_ERemoteStoragePlatformOSX = (1 << 1), k_ERemoteStoragePlatformOSX = (1 << 1),
k_ERemoteStoragePlatformPS3 = (1 << 2), k_ERemoteStoragePlatformPS3 = (1 << 2),
k_ERemoteStoragePlatformLinux = (1 << 3), k_ERemoteStoragePlatformLinux = (1 << 3),
k_ERemoteStoragePlatformReserved2 = (1 << 4), k_ERemoteStoragePlatformSwitch = (1 << 4),
k_ERemoteStoragePlatformAndroid = (1 << 5), k_ERemoteStoragePlatformAndroid = (1 << 5),
k_ERemoteStoragePlatformIOS = (1 << 6), k_ERemoteStoragePlatformIOS = (1 << 6),
// NB we get one more before we need to widen some things
k_ERemoteStoragePlatformAll = 0xffffffff k_ERemoteStoragePlatformAll = 0xffffffff
}; };

View File

@ -47,7 +47,7 @@ enum EUGCMatchingUGCType
k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides
k_EUGCMatchingUGCType_ControllerBindings = 11, k_EUGCMatchingUGCType_ControllerBindings = 11,
k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users) k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users)
k_EUGCMatchingUGCType_All = ~0, // return everything k_EUGCMatchingUGCType_All = ~0, // @note: will only be valid for CreateQueryUserUGCRequest requests
}; };
// Different lists of published UGC for a user. // Different lists of published UGC for a user.
@ -234,6 +234,7 @@ public:
// Options to set for querying UGC // Options to set for querying UGC
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool AddRequiredTagGroup( UGCQueryHandle_t handle, const SteamParamStringArray_t *pTagGroups ) = 0; // match any of the tags in this group
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0; virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0;
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0; virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
@ -353,7 +354,7 @@ public:
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0; virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
}; };
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION013" #define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION014"
#ifndef STEAM_API_EXPORTS #ifndef STEAM_API_EXPORTS
// Global interface accessor // Global interface accessor

164
sdk_includes/isteamugc013.h Normal file
View File

@ -0,0 +1,164 @@
#ifndef ISTEAMUGC013_H
#define ISTEAMUGC013_H
#ifdef STEAM_WIN32
#pragma once
#endif
class ISteamUGC013
{
public:
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL ) = 0;
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
// Send the query to Steam
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Retrieve an individual result after receiving the callback for querying UGC
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue ) = 0;
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
// Return the first value matching the pchKey. Note that a key may map to multiple values. Returns false if there was an error or no matching value was found.
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
// Release the request to free up memory, after retrieving results
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Options to set for querying UGC
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0;
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
virtual bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0;
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
// Options only for querying user UGC
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
// Options only for querying all UGC
virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0;
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0;
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
// Steam Workshop Creator API
STEAM_CALL_RESULT( CreateItemResult_t )
virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet
virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
virtual bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) = 0; // use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.
virtual bool RemoveAllItemKeyValueTags( UGCUpdateHandle_t handle ) = 0; // remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)
virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag.
virtual bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) = 0; // add preview video for this item
virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
// Steam Workshop Consumer API
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
// get EItemState flags about item on this client
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
// game servers can set a specific workshop folder before issuing any UGC commands.
// This is helpful if you want to support multiple game servers running out of the same install folder
virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0;
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
virtual void SuspendDownloads( bool bSuspend ) = 0;
// usage tracking
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
virtual SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTrackingForAllItems() = 0;
// parent-child relationship or dependency management
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
virtual SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
virtual SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
// add/remove app dependence/requirements (usually DLC)
STEAM_CALL_RESULT( AddAppDependencyResult_t )
virtual SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
virtual SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
// request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times
// until all app dependencies have been returned
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
virtual SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) = 0;
// delete the item without prompting the user
STEAM_CALL_RESULT( DeleteItemResult_t )
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
};
#endif // ISTEAMUGC013_H

View File

@ -168,7 +168,12 @@ public:
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t ) STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0; virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
// retrieve a finished ticket // Retrieves a finished ticket.
// If no ticket is available, or your buffer is too small, returns false.
// Upon exit, *pcbTicket will be either the size of the ticket copied into your buffer
// (if true was returned), or the size needed (if false was returned). To determine the
// proper size of the ticket, you can pass pTicket=NULL and cbMaxTicket=0; if a ticket
// is available, *pcbTicket will contain the size needed, otherwise it will be zero.
virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Trading Card badges data access // Trading Card badges data access
@ -392,8 +397,8 @@ struct MarketEligibilityResponse_t
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: sent for games with enabled anti indulgence / duration control, for // Purpose: sent for games with enabled anti indulgence / duration control, for
// enabled users. Lets the game know whether persistent rewards or XP should be // enabled users. Lets the game know whether the user can keep playing or
// granted at normal rate, half rate, or zero rate. // whether the game should exit, and returns info about remaining gameplay time.
// //
// This callback is fired asynchronously in response to timers triggering. // This callback is fired asynchronously in response to timers triggering.
// It is also fired in response to calls to GetDurationControl(). // It is also fired in response to calls to GetDurationControl().
@ -406,9 +411,13 @@ struct DurationControl_t
AppId_t m_appid; // appid generating playtime AppId_t m_appid; // appid generating playtime
bool m_bApplicable; // is duration control applicable to user + game combination bool m_bApplicable; // is duration control applicable to user + game combination
int32 m_csecsLast5h; // playtime in trailing 5 hour window plus current session, in seconds int32 m_csecsLast5h; // playtime since most recent 5 hour gap in playtime, only counting up to regulatory limit of playtime, in seconds
EDurationControlProgress m_progress; // recommended progress
EDurationControlProgress m_progress; // recommended progress (either everything is fine, or please exit game)
EDurationControlNotification m_notification; // notification to show, if any (always k_EDurationControlNotification_None for API calls) EDurationControlNotification m_notification; // notification to show, if any (always k_EDurationControlNotification_None for API calls)
int32 m_csecsToday; // playtime on current calendar day
int32 m_csecsRemaining; // playtime remaining until the user hits a regulatory limit
}; };

View File

@ -160,10 +160,10 @@ public:
// ask SteamUI to create and render its OpenVR dashboard // ask SteamUI to create and render its OpenVR dashboard
virtual void StartVRDashboard() = 0; virtual void StartVRDashboard() = 0;
// Returns true if the HMD content will be streamed via Steam In-Home Streaming // Returns true if the HMD content will be streamed via Steam Remote Play
virtual bool IsVRHeadsetStreamingEnabled() = 0; virtual bool IsVRHeadsetStreamingEnabled() = 0;
// Set whether the HMD content will be streamed via Steam In-Home Streaming // Set whether the HMD content will be streamed via Steam Remote Play
// If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed. // If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed.
// If this is set to false, then the application window will be streamed instead, and remote input will be allowed. // If this is set to false, then the application window will be streamed instead, and remote input will be allowed.
// The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game. // The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.
@ -184,6 +184,10 @@ public:
// bLegalOnly should be false if you want profanity and legally required filtering (where required) and true if you want legally required filtering only // bLegalOnly should be false if you want profanity and legally required filtering (where required) and true if you want legally required filtering only
// Returns the number of characters (not bytes) filtered. // Returns the number of characters (not bytes) filtered.
virtual int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly ) = 0; virtual int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly ) = 0;
// Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol.
// This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
virtual ESteamIPv6ConnectivityState GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol ) = 0;
}; };
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils009" #define STEAMUTILS_INTERFACE_VERSION "SteamUtils009"

View File

@ -34,6 +34,7 @@
#include "isteamclient016.h" #include "isteamclient016.h"
#include "isteamclient017.h" #include "isteamclient017.h"
#include "isteamclient018.h" #include "isteamclient018.h"
#include "isteamclient019.h"
#include "isteamuser.h" #include "isteamuser.h"
#include "isteamuser009.h" #include "isteamuser009.h"
#include "isteamuser010.h" #include "isteamuser010.h"
@ -83,6 +84,7 @@
#include "isteamuserstats003.h" #include "isteamuserstats003.h"
#include "isteamapps.h" #include "isteamapps.h"
#include "isteamnetworking.h" #include "isteamnetworking.h"
#include "isteamnetworking005.h"
#include "isteamnetworking004.h" #include "isteamnetworking004.h"
#include "isteamnetworking003.h" #include "isteamnetworking003.h"
#include "isteamnetworking002.h" #include "isteamnetworking002.h"
@ -91,8 +93,10 @@
#include "isteamnetworkingsockets.h" #include "isteamnetworkingsockets.h"
#include "isteamnetworkingutils.h" #include "isteamnetworkingutils.h"
#include "isteamnetworkingutils001.h" #include "isteamnetworkingutils001.h"
#include "isteamnetworkingutils002.h"
#include "isteamnetworkingsockets001.h" #include "isteamnetworkingsockets001.h"
#include "isteamnetworkingsockets002.h" #include "isteamnetworkingsockets002.h"
#include "isteamnetworkingsockets003.h"
#include "isteamremotestorage.h" #include "isteamremotestorage.h"
#include "isteamremotestorage001.h" #include "isteamremotestorage001.h"
#include "isteamremotestorage002.h" #include "isteamremotestorage002.h"
@ -129,6 +133,7 @@
#include "isteamugc009.h" #include "isteamugc009.h"
#include "isteamugc010.h" #include "isteamugc010.h"
#include "isteamugc012.h" #include "isteamugc012.h"
#include "isteamugc013.h"
#include "isteamapplist.h" #include "isteamapplist.h"
#include "isteamhtmlsurface.h" #include "isteamhtmlsurface.h"
#include "isteamhtmlsurface001.h" #include "isteamhtmlsurface001.h"

View File

@ -19,26 +19,32 @@
// S_API defines the linkage and calling conventions for steam_api.dll exports // S_API defines the linkage and calling conventions for steam_api.dll exports
#if defined( STEAM_WIN32 ) && !defined( _X360 ) #if defined( STEAM_WIN32 ) && !defined( _X360 )
#if defined( STEAM_API_EXPORTS ) #if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __declspec( dllexport ) #define S_API_EXPORT extern "C" __declspec( dllexport )
#elif defined( STEAM_API_NODLL ) #elif defined( STEAM_API_NODLL )
#define S_API extern "C" #define S_API_EXPORT extern "C"
#else #else
#define S_API extern "C" __declspec( dllimport ) #define S_API_EXPORT extern "C" __declspec( dllimport )
#endif // STEAM_API_EXPORTS #endif // STEAM_API_EXPORTS
#elif defined( GNUC ) #elif defined( GNUC )
#if defined( STEAM_API_EXPORTS ) #if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default"))) #define S_API_EXPORT extern "C" __attribute__ ((visibility("default")))
#else #else
#define S_API extern "C" #define S_API_EXPORT extern "C"
#endif // STEAM_API_EXPORTS #endif // STEAM_API_EXPORTS
#else // !WIN32 #else // !WIN32
#if defined( STEAM_API_EXPORTS ) #if defined( STEAM_API_EXPORTS )
#define S_API extern "C" #define S_API_EXPORT extern "C"
#else #else
#define S_API extern "C" #define S_API_EXPORT extern "C"
#endif // STEAM_API_EXPORTS #endif // STEAM_API_EXPORTS
#endif #endif
#ifdef STEAMCLIENT_DLL
#define S_API static
#else
#define S_API S_API_EXPORT
#endif
#if ( defined(STEAM_API_EXPORTS) || defined(STEAM_API_NODLL) ) && !defined(API_GEN) #if ( defined(STEAM_API_EXPORTS) || defined(STEAM_API_NODLL) ) && !defined(API_GEN)
#define STEAM_PRIVATE_API( ... ) __VA_ARGS__ #define STEAM_PRIVATE_API( ... ) __VA_ARGS__
#elif defined(STEAM_API_EXPORTS) && defined(API_GEN) #elif defined(STEAM_API_EXPORTS) && defined(API_GEN)

View File

@ -78,6 +78,7 @@ typedef uint64 SteamItemInstanceID_t;
typedef int32 SteamItemDef_t; typedef int32 SteamItemDef_t;
typedef int32 SteamInventoryResult_t; typedef int32 SteamInventoryResult_t;
typedef uint64 SteamInventoryUpdateHandle_t; typedef uint64 SteamInventoryUpdateHandle_t;
typedef uint32 RemotePlaySessionID_t;
// OpenVR Constants // OpenVR Constants
int const_k_iSteamUserCallbacks = 100; int const_k_iSteamUserCallbacks = 100;
int const_k_iSteamGameServerCallbacks = 200; int const_k_iSteamGameServerCallbacks = 200;
@ -166,6 +167,7 @@ S_API void SteamAPI_ISteamClient_ReleaseUser(intptr_t instancePtr, HSteamPipe hS
S_API class ISteamUser * SteamAPI_ISteamClient_GetISteamUser(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); S_API class ISteamUser * SteamAPI_ISteamClient_GetISteamUser(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamGameServer * SteamAPI_ISteamClient_GetISteamGameServer(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); S_API class ISteamGameServer * SteamAPI_ISteamClient_GetISteamGameServer(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, uint32 unIP, uint16 usPort); S_API void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, uint32 unIP, uint16 usPort);
//S_API void SteamAPI_ISteamClient_SetLocalIPBinding(intptr_t instancePtr, const struct SteamIPAddress_t & unIP, uint16 usPort)
S_API class ISteamFriends * SteamAPI_ISteamClient_GetISteamFriends(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); S_API class ISteamFriends * SteamAPI_ISteamClient_GetISteamFriends(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamUtils * SteamAPI_ISteamClient_GetISteamUtils(intptr_t instancePtr, HSteamPipe hSteamPipe, const char * pchVersion); S_API class ISteamUtils * SteamAPI_ISteamClient_GetISteamUtils(intptr_t instancePtr, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamMatchmaking * SteamAPI_ISteamClient_GetISteamMatchmaking(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion); S_API class ISteamMatchmaking * SteamAPI_ISteamClient_GetISteamMatchmaking(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
@ -330,6 +332,7 @@ S_API void SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled(intptr_t instancePt
S_API bool SteamAPI_ISteamUtils_IsSteamChinaLauncher(intptr_t instancePtr); S_API bool SteamAPI_ISteamUtils_IsSteamChinaLauncher(intptr_t instancePtr);
S_API bool SteamAPI_ISteamUtils_InitFilterText(intptr_t instancePtr); S_API bool SteamAPI_ISteamUtils_InitFilterText(intptr_t instancePtr);
S_API int SteamAPI_ISteamUtils_FilterText(intptr_t instancePtr, char * pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly); S_API int SteamAPI_ISteamUtils_FilterText(intptr_t instancePtr, char * pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly);
S_API ESteamIPv6ConnectivityState SteamAPI_ISteamUtils_GetIPv6ConnectivityState(intptr_t instancePtr, ESteamIPv6ConnectivityProtocol eProtocol);
S_API int SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(intptr_t instancePtr); S_API int SteamAPI_ISteamMatchmaking_GetFavoriteGameCount(intptr_t instancePtr);
S_API bool SteamAPI_ISteamMatchmaking_GetFavoriteGame(intptr_t instancePtr, int iGame, AppId_t * pnAppID, uint32 * pnIP, uint16 * pnConnPort, uint16 * pnQueryPort, uint32 * punFlags, uint32 * pRTime32LastPlayedOnServer); S_API bool SteamAPI_ISteamMatchmaking_GetFavoriteGame(intptr_t instancePtr, int iGame, AppId_t * pnAppID, uint32 * pnIP, uint16 * pnConnPort, uint16 * pnQueryPort, uint32 * punFlags, uint32 * pRTime32LastPlayedOnServer);
S_API int SteamAPI_ISteamMatchmaking_AddFavoriteGame(intptr_t instancePtr, AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer); S_API int SteamAPI_ISteamMatchmaking_AddFavoriteGame(intptr_t instancePtr, AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer);
@ -556,9 +559,9 @@ S_API bool SteamAPI_ISteamNetworking_CloseP2PSessionWithUser(intptr_t instancePt
S_API bool SteamAPI_ISteamNetworking_CloseP2PChannelWithUser(intptr_t instancePtr, class CSteamID steamIDRemote, int nChannel); S_API bool SteamAPI_ISteamNetworking_CloseP2PChannelWithUser(intptr_t instancePtr, class CSteamID steamIDRemote, int nChannel);
S_API bool SteamAPI_ISteamNetworking_GetP2PSessionState(intptr_t instancePtr, class CSteamID steamIDRemote, struct P2PSessionState_t * pConnectionState); S_API bool SteamAPI_ISteamNetworking_GetP2PSessionState(intptr_t instancePtr, class CSteamID steamIDRemote, struct P2PSessionState_t * pConnectionState);
S_API bool SteamAPI_ISteamNetworking_AllowP2PPacketRelay(intptr_t instancePtr, bool bAllow); S_API bool SteamAPI_ISteamNetworking_AllowP2PPacketRelay(intptr_t instancePtr, bool bAllow);
S_API SNetListenSocket_t SteamAPI_ISteamNetworking_CreateListenSocket(intptr_t instancePtr, int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay); S_API SNetListenSocket_t SteamAPI_ISteamNetworking_CreateListenSocket(intptr_t instancePtr, int nVirtualP2PPort, struct SteamIPAddress_t nIP, uint16 nPort, bool bAllowUseOfPacketRelay);
S_API SNetSocket_t SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(intptr_t instancePtr, class CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay); S_API SNetSocket_t SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(intptr_t instancePtr, class CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay);
S_API SNetSocket_t SteamAPI_ISteamNetworking_CreateConnectionSocket(intptr_t instancePtr, uint32 nIP, uint16 nPort, int nTimeoutSec); S_API SNetSocket_t SteamAPI_ISteamNetworking_CreateConnectionSocket(intptr_t instancePtr, struct SteamIPAddress_t nIP, uint16 nPort, int nTimeoutSec);
S_API bool SteamAPI_ISteamNetworking_DestroySocket(intptr_t instancePtr, SNetSocket_t hSocket, bool bNotifyRemoteEnd); S_API bool SteamAPI_ISteamNetworking_DestroySocket(intptr_t instancePtr, SNetSocket_t hSocket, bool bNotifyRemoteEnd);
S_API bool SteamAPI_ISteamNetworking_DestroyListenSocket(intptr_t instancePtr, SNetListenSocket_t hSocket, bool bNotifyRemoteEnd); S_API bool SteamAPI_ISteamNetworking_DestroyListenSocket(intptr_t instancePtr, SNetListenSocket_t hSocket, bool bNotifyRemoteEnd);
S_API bool SteamAPI_ISteamNetworking_SendDataOnSocket(intptr_t instancePtr, SNetSocket_t hSocket, void * pubData, uint32 cubData, bool bReliable); S_API bool SteamAPI_ISteamNetworking_SendDataOnSocket(intptr_t instancePtr, SNetSocket_t hSocket, void * pubData, uint32 cubData, bool bReliable);
@ -566,8 +569,8 @@ S_API bool SteamAPI_ISteamNetworking_IsDataAvailableOnSocket(intptr_t instancePt
S_API bool SteamAPI_ISteamNetworking_RetrieveDataFromSocket(intptr_t instancePtr, SNetSocket_t hSocket, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize); S_API bool SteamAPI_ISteamNetworking_RetrieveDataFromSocket(intptr_t instancePtr, SNetSocket_t hSocket, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize);
S_API bool SteamAPI_ISteamNetworking_IsDataAvailable(intptr_t instancePtr, SNetListenSocket_t hListenSocket, uint32 * pcubMsgSize, SNetSocket_t * phSocket); S_API bool SteamAPI_ISteamNetworking_IsDataAvailable(intptr_t instancePtr, SNetListenSocket_t hListenSocket, uint32 * pcubMsgSize, SNetSocket_t * phSocket);
S_API bool SteamAPI_ISteamNetworking_RetrieveData(intptr_t instancePtr, SNetListenSocket_t hListenSocket, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize, SNetSocket_t * phSocket); S_API bool SteamAPI_ISteamNetworking_RetrieveData(intptr_t instancePtr, SNetListenSocket_t hListenSocket, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize, SNetSocket_t * phSocket);
S_API bool SteamAPI_ISteamNetworking_GetSocketInfo(intptr_t instancePtr, SNetSocket_t hSocket, class CSteamID * pSteamIDRemote, int * peSocketStatus, uint32 * punIPRemote, uint16 * punPortRemote); S_API bool SteamAPI_ISteamNetworking_GetSocketInfo(intptr_t instancePtr, SNetSocket_t hSocket, class CSteamID * pSteamIDRemote, int * peSocketStatus, struct SteamIPAddress_t * punIPRemote, uint16 * punPortRemote);
S_API bool SteamAPI_ISteamNetworking_GetListenSocketInfo(intptr_t instancePtr, SNetListenSocket_t hListenSocket, uint32 * pnIP, uint16 * pnPort); S_API bool SteamAPI_ISteamNetworking_GetListenSocketInfo(intptr_t instancePtr, SNetListenSocket_t hListenSocket, struct SteamIPAddress_t * pnIP, uint16 * pnPort);
S_API ESNetSocketConnectionType SteamAPI_ISteamNetworking_GetSocketConnectionType(intptr_t instancePtr, SNetSocket_t hSocket); S_API ESNetSocketConnectionType SteamAPI_ISteamNetworking_GetSocketConnectionType(intptr_t instancePtr, SNetSocket_t hSocket);
S_API int SteamAPI_ISteamNetworking_GetMaxPacketSize(intptr_t instancePtr, SNetSocket_t hSocket); S_API int SteamAPI_ISteamNetworking_GetMaxPacketSize(intptr_t instancePtr, SNetSocket_t hSocket);
S_API ScreenshotHandle SteamAPI_ISteamScreenshots_WriteScreenshot(intptr_t instancePtr, void * pubRGB, uint32 cubRGB, int nWidth, int nHeight); S_API ScreenshotHandle SteamAPI_ISteamScreenshots_WriteScreenshot(intptr_t instancePtr, void * pubRGB, uint32 cubRGB, int nWidth, int nHeight);
@ -731,6 +734,7 @@ S_API bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag(intptr_t instancePtr, UGCQu
S_API bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag0(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, const char * pchKey, char * pchValue, uint32 cchValueSize); S_API bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag0(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, const char * pchKey, char * pchValue, uint32 cchValueSize);
S_API bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle); S_API bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle);
S_API bool SteamAPI_ISteamUGC_AddRequiredTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName); S_API bool SteamAPI_ISteamUGC_AddRequiredTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName);
S_API bool SteamAPI_ISteamUGC_AddRequiredTagGroup(intptr_t instancePtr, UGCQueryHandle_t handle, const struct SteamParamStringArray_t * pTagGroups);
S_API bool SteamAPI_ISteamUGC_AddExcludedTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName); S_API bool SteamAPI_ISteamUGC_AddExcludedTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName);
S_API bool SteamAPI_ISteamUGC_SetReturnOnlyIDs(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnOnlyIDs); S_API bool SteamAPI_ISteamUGC_SetReturnOnlyIDs(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnOnlyIDs);
S_API bool SteamAPI_ISteamUGC_SetReturnKeyValueTags(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnKeyValueTags); S_API bool SteamAPI_ISteamUGC_SetReturnKeyValueTags(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnKeyValueTags);
@ -889,11 +893,12 @@ S_API bool SteamAPI_ISteamParentalSettings_BIsAppInBlockList(intptr_t instancePt
S_API bool SteamAPI_ISteamParentalSettings_BIsFeatureBlocked(intptr_t instancePtr, EParentalFeature eFeature); S_API bool SteamAPI_ISteamParentalSettings_BIsFeatureBlocked(intptr_t instancePtr, EParentalFeature eFeature);
S_API bool SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList(intptr_t instancePtr, EParentalFeature eFeature); S_API bool SteamAPI_ISteamParentalSettings_BIsFeatureInBlockList(intptr_t instancePtr, EParentalFeature eFeature);
S_API uint32 SteamAPI_ISteamRemotePlay_GetSessionCount(intptr_t instancePtr); S_API uint32 SteamAPI_ISteamRemotePlay_GetSessionCount(intptr_t instancePtr);
S_API uint32 SteamAPI_ISteamRemotePlay_GetSessionID(intptr_t instancePtr, int iSessionIndex); S_API RemotePlaySessionID_t SteamAPI_ISteamRemotePlay_GetSessionID(intptr_t instancePtr, int iSessionIndex);
S_API uint64 SteamAPI_ISteamRemotePlay_GetSessionSteamID(intptr_t instancePtr, uint32 unSessionID); S_API uint64 SteamAPI_ISteamRemotePlay_GetSessionSteamID(intptr_t instancePtr, RemotePlaySessionID_t unSessionID);
S_API const char * SteamAPI_ISteamRemotePlay_GetSessionClientName(intptr_t instancePtr, uint32 unSessionID); S_API const char * SteamAPI_ISteamRemotePlay_GetSessionClientName(intptr_t instancePtr, RemotePlaySessionID_t unSessionID);
S_API ESteamDeviceFormFactor SteamAPI_ISteamRemotePlay_GetSessionClientFormFactor(intptr_t instancePtr, uint32 unSessionID); S_API ESteamDeviceFormFactor SteamAPI_ISteamRemotePlay_GetSessionClientFormFactor(intptr_t instancePtr, RemotePlaySessionID_t unSessionID);
S_API bool SteamAPI_ISteamRemotePlay_BGetSessionClientResolution(intptr_t instancePtr, uint32 unSessionID, int * pnResolutionX, int * pnResolutionY); S_API bool SteamAPI_ISteamRemotePlay_BGetSessionClientResolution(intptr_t instancePtr, RemotePlaySessionID_t unSessionID, int * pnResolutionX, int * pnResolutionY);
S_API bool SteamAPI_ISteamRemotePlay_BSendRemotePlayTogetherInvite(intptr_t instancePtr, class CSteamID steamIDFriend);
S_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString); S_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString);
S_API void SteamAPI_ISteamGameServer_SetProduct(intptr_t instancePtr, const char * pszProduct); S_API void SteamAPI_ISteamGameServer_SetProduct(intptr_t instancePtr, const char * pszProduct);
S_API void SteamAPI_ISteamGameServer_SetGameDescription(intptr_t instancePtr, const char * pszGameDescription); S_API void SteamAPI_ISteamGameServer_SetGameDescription(intptr_t instancePtr, const char * pszGameDescription);
@ -930,7 +935,7 @@ S_API EUserHasLicenseForAppResult SteamAPI_ISteamGameServer_UserHasLicenseForApp
S_API bool SteamAPI_ISteamGameServer_RequestUserGroupStatus(intptr_t instancePtr, class CSteamID steamIDUser, class CSteamID steamIDGroup); S_API bool SteamAPI_ISteamGameServer_RequestUserGroupStatus(intptr_t instancePtr, class CSteamID steamIDUser, class CSteamID steamIDGroup);
S_API void SteamAPI_ISteamGameServer_GetGameplayStats(intptr_t instancePtr); S_API void SteamAPI_ISteamGameServer_GetGameplayStats(intptr_t instancePtr);
S_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation(intptr_t instancePtr); S_API SteamAPICall_t SteamAPI_ISteamGameServer_GetServerReputation(intptr_t instancePtr);
S_API uint32 SteamAPI_ISteamGameServer_GetPublicIP(intptr_t instancePtr); S_API struct SteamIPAddress_t SteamAPI_ISteamGameServer_GetPublicIP(intptr_t instancePtr);
S_API bool SteamAPI_ISteamGameServer_HandleIncomingPacket(intptr_t instancePtr, const void * pData, int cbData, uint32 srcIP, uint16 srcPort); S_API bool SteamAPI_ISteamGameServer_HandleIncomingPacket(intptr_t instancePtr, const void * pData, int cbData, uint32 srcIP, uint16 srcPort);
S_API int SteamAPI_ISteamGameServer_GetNextOutgoingPacket(intptr_t instancePtr, void * pOut, int cbMaxOut, uint32 * pNetAdr, uint16 * pPort); S_API int SteamAPI_ISteamGameServer_GetNextOutgoingPacket(intptr_t instancePtr, void * pOut, int cbMaxOut, uint32 * pNetAdr, uint16 * pPort);
S_API void SteamAPI_ISteamGameServer_EnableHeartbeats(intptr_t instancePtr, bool bActive); S_API void SteamAPI_ISteamGameServer_EnableHeartbeats(intptr_t instancePtr, bool bActive);

View File

@ -12,6 +12,7 @@
#include "steam_api.h" #include "steam_api.h"
#include "isteamgameserver.h" #include "isteamgameserver.h"
#include "isteamgameserver012.h"
#include "isteamgameserver011.h" #include "isteamgameserver011.h"
#include "isteamgameserver010.h" #include "isteamgameserver010.h"
#include "isteamgameserver009.h" #include "isteamgameserver009.h"

View File

@ -25,6 +25,7 @@
// General result codes // General result codes
enum EResult enum EResult
{ {
k_EResultNone = 0, // no result
k_EResultOK = 1, // success k_EResultOK = 1, // success
k_EResultFail = 2, // generic failure k_EResultFail = 2, // generic failure
k_EResultNoConnection = 3, // no/failed network connection k_EResultNoConnection = 3, // no/failed network connection
@ -275,6 +276,8 @@ enum EAppOwnershipFlags
k_EAppOwnershipFlags_RentalNotActivated = 0x10000, // Rental hasn't been activated yet k_EAppOwnershipFlags_RentalNotActivated = 0x10000, // Rental hasn't been activated yet
k_EAppOwnershipFlags_Rental = 0x20000, // Is a rental k_EAppOwnershipFlags_Rental = 0x20000, // Is a rental
k_EAppOwnershipFlags_SiteLicense = 0x40000, // Is from a site license k_EAppOwnershipFlags_SiteLicense = 0x40000, // Is from a site license
k_EAppOwnershipFlags_LegacyFreeSub = 0x80000, // App only owned through Steam's legacy free sub
k_EAppOwnershipFlags_InvalidOSType = 0x100000, // app not supported on current OS version, used to indicate a game is 32-bit on post-catalina. Currently it's own flag so the library will display a notice.
}; };
@ -298,9 +301,9 @@ enum EAppType
k_EAppType_Franchise = 0x400, // A hub for collections of multiple apps, eg films, series, games k_EAppType_Franchise = 0x400, // A hub for collections of multiple apps, eg films, series, games
k_EAppType_Video = 0x800, // A video component of either a Film or TVSeries (may be the feature, an episode, preview, making-of, etc) k_EAppType_Video = 0x800, // A video component of either a Film or TVSeries (may be the feature, an episode, preview, making-of, etc)
k_EAppType_Plugin = 0x1000, // Plug-in types for other Apps k_EAppType_Plugin = 0x1000, // Plug-in types for other Apps
k_EAppType_Music = 0x2000, // Music files k_EAppType_MusicAlbum = 0x2000, // "Video game soundtrack album"
k_EAppType_Series = 0x4000, // Container app for video series k_EAppType_Series = 0x4000, // Container app for video series
k_EAppType_Comic = 0x8000, // Comic Book k_EAppType_Comic_UNUSED = 0x8000, // Comic Book
k_EAppType_Beta = 0x10000, // this is a beta version of a game k_EAppType_Beta = 0x10000, // this is a beta version of a game
k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only
@ -380,10 +383,7 @@ typedef bool (*PFNLegacyKeyInstalled)();
const unsigned int k_unSteamAccountIDMask = 0xFFFFFFFF; const unsigned int k_unSteamAccountIDMask = 0xFFFFFFFF;
const unsigned int k_unSteamAccountInstanceMask = 0x000FFFFF; const unsigned int k_unSteamAccountInstanceMask = 0x000FFFFF;
// we allow 3 simultaneous user account instances right now, 1= desktop, 2 = console, 4 = web, 0 = all const unsigned int k_unSteamUserDefaultInstance = 1; // fixed instance for all individual users
const unsigned int k_unSteamUserDesktopInstance = 1;
const unsigned int k_unSteamUserConsoleInstance = 2;
const unsigned int k_unSteamUserWebInstance = 4;
// Special flags for Chat accounts - they go in the top 8 bits // Special flags for Chat accounts - they go in the top 8 bits
// of the steam ID's "instance", leaving 12 for the actual instances // of the steam ID's "instance", leaving 12 for the actual instances
@ -538,6 +538,7 @@ enum EVRHMDType
k_eEVRHMDType_HP_Unknown = 80, // HP unknown HMD k_eEVRHMDType_HP_Unknown = 80, // HP unknown HMD
k_eEVRHMDType_HP_WindowsMR = 81, // HP Windows MR headset k_eEVRHMDType_HP_WindowsMR = 81, // HP Windows MR headset
k_eEVRHMDType_HP_Reverb = 82, // HP Reverb Windows MR headset
k_eEVRHMDType_Samsung_Unknown = 90, // Samsung unknown HMD k_eEVRHMDType_Samsung_Unknown = 90, // Samsung unknown HMD
k_eEVRHMDType_Samsung_Odyssey = 91, // Samsung Odyssey Windows MR headset k_eEVRHMDType_Samsung_Odyssey = 91, // Samsung Odyssey Windows MR headset
@ -657,24 +658,35 @@ enum EMarketNotAllowedReasonFlags
// describes XP / progress restrictions to apply for games with duration control / // describes XP / progress restrictions to apply for games with duration control /
// anti-indulgence enabled for minor Steam China users. // anti-indulgence enabled for minor Steam China users.
// //
// WARNING: DO NOT RENUMBER
enum EDurationControlProgress enum EDurationControlProgress
{ {
k_EDurationControlProgress_Full, // Full progress k_EDurationControlProgress_Full = 0, // Full progress
k_EDurationControlProgress_Half, // XP or persistent rewards should be halved k_EDurationControlProgress_Half = 1, // deprecated - XP or persistent rewards should be halved
k_EDurationControlProgress_None, // XP or persistent rewards should be stopped k_EDurationControlProgress_None = 2, // deprecated - XP or persistent rewards should be stopped
k_EDurationControl_ExitSoon_3h = 3, // allowed 3h time since 5h gap/break has elapsed, game should exit - steam will terminate the game soon
k_EDurationControl_ExitSoon_5h = 4, // allowed 5h time in calendar day has elapsed, game should exit - steam will terminate the game soon
k_EDurationControl_ExitSoon_Night = 5, // game running after day period, game should exit - steam will terminate the game soon
}; };
// //
// describes which notification timer has expired, for steam china duration control feature // describes which notification timer has expired, for steam china duration control feature
// //
// WARNING: DO NOT RENUMBER
enum EDurationControlNotification enum EDurationControlNotification
{ {
k_EDurationControlNotification_None, // just informing you about progress, no notification to show k_EDurationControlNotification_None = 0, // just informing you about progress, no notification to show
k_EDurationControlNotification_1Hour, // "you've been playing for an hour" k_EDurationControlNotification_1Hour = 1, // "you've been playing for N hours"
k_EDurationControlNotification_3Hours, // "you've been playing for 3 hours; take a break"
k_EDurationControlNotification_HalfProgress, // "your XP / progress is half normal" k_EDurationControlNotification_3Hours = 2, // deprecated - "you've been playing for 3 hours; take a break"
k_EDurationControlNotification_NoProgress, // "your XP / progress is zero" k_EDurationControlNotification_HalfProgress = 3,// deprecated - "your XP / progress is half normal"
k_EDurationControlNotification_NoProgress = 4, // deprecated - "your XP / progress is zero"
k_EDurationControlNotification_ExitSoon_3h = 5, // allowed 3h time since 5h gap/break has elapsed, game should exit - steam will terminate the game soon
k_EDurationControlNotification_ExitSoon_5h = 6, // allowed 5h time in calendar day has elapsed, game should exit - steam will terminate the game soon
k_EDurationControlNotification_ExitSoon_Night = 7,// game running after day period, game should exit - steam will terminate the game soon
}; };
@ -721,7 +733,7 @@ public:
CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType ) CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType )
{ {
#if defined(_SERVER) && defined(Assert) #if defined(_SERVER) && defined(Assert)
Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( unAccountInstance > k_unSteamUserWebInstance ) ) ); // enforce that for individual accounts, instance is always 1 Assert( ( k_EAccountTypeIndividual != eAccountType ) || ( unAccountInstance == k_unSteamUserDefaultInstance ) ); // enforce that for individual accounts, instance is always 1
#endif // _SERVER #endif // _SERVER
InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType ); InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType );
} }
@ -763,8 +775,7 @@ public:
} }
else else
{ {
// by default we pick the desktop instance m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDefaultInstance;
m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance;
} }
} }
@ -831,7 +842,7 @@ public:
pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits; pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits;
m_steamid.m_comp.m_EUniverse = eUniverse; // set the universe m_steamid.m_comp.m_EUniverse = eUniverse; // set the universe
m_steamid.m_comp.m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual m_steamid.m_comp.m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual
m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; // Steam2 only knew desktop instances m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDefaultInstance; // Steam2 only knew one instance
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1000,8 +1011,7 @@ public:
// simple accessors // simple accessors
void SetAccountID( uint32 unAccountID ) { m_steamid.m_comp.m_unAccountID = unAccountID; } void SetAccountID( uint32 unAccountID ) { m_steamid.m_comp.m_unAccountID = unAccountID; }
void SetAccountInstance( uint32 unInstance ){ m_steamid.m_comp.m_unAccountInstance = unInstance; } void SetAccountInstance( uint32 unInstance ){ m_steamid.m_comp.m_unAccountInstance = unInstance; }
void ClearIndividualInstance() { if ( BIndividualAccount() ) m_steamid.m_comp.m_unAccountInstance = 0; }
bool HasNoIndividualInstance() const { return BIndividualAccount() && (m_steamid.m_comp.m_unAccountInstance==0); }
AccountID_t GetAccountID() const { return m_steamid.m_comp.m_unAccountID; } AccountID_t GetAccountID() const { return m_steamid.m_comp.m_unAccountID; }
uint32 GetUnAccountInstance() const { return m_steamid.m_comp.m_unAccountInstance; } uint32 GetUnAccountInstance() const { return m_steamid.m_comp.m_unAccountInstance; }
EAccountType GetEAccountType() const { return ( EAccountType ) m_steamid.m_comp.m_EAccountType; } EAccountType GetEAccountType() const { return ( EAccountType ) m_steamid.m_comp.m_EAccountType; }
@ -1071,7 +1081,7 @@ inline bool CSteamID::IsValid() const
if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual ) if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual )
{ {
if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance > k_unSteamUserWebInstance ) if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != k_unSteamUserDefaultInstance )
return false; return false;
} }
@ -1166,6 +1176,17 @@ public:
m_gameID.m_nType = k_EGameIDTypeGameMod; m_gameID.m_nType = k_EGameIDTypeGameMod;
} }
CGameID( const CGameID &that )
{
m_ulGameID = that.m_ulGameID;
}
CGameID& operator=( const CGameID & that )
{
m_ulGameID = that.m_ulGameID;
return *this;
}
// Hidden functions used only by Steam // Hidden functions used only by Steam
explicit CGameID( const char *pchGameID ); explicit CGameID( const char *pchGameID );
const char *Render() const; // render this Game ID to string const char *Render() const; // render this Game ID to string
@ -1404,6 +1425,23 @@ enum EPlayerResult_t
k_EPlayerResultCompleted = 5, // player completed game k_EPlayerResultCompleted = 5, // player completed game
}; };
enum ESteamIPv6ConnectivityProtocol
{
k_ESteamIPv6ConnectivityProtocol_Invalid = 0,
k_ESteamIPv6ConnectivityProtocol_HTTP = 1, // because a proxy may make this different than other protocols
k_ESteamIPv6ConnectivityProtocol_UDP = 2, // test UDP connectivity. Uses a port that is commonly needed for other Steam stuff. If UDP works, TCP probably works.
};
// For the above transport protocol, what do we think the local machine's connectivity to the internet over ipv6 is like
enum ESteamIPv6ConnectivityState
{
k_ESteamIPv6ConnectivityState_Unknown = 0, // We haven't run a test yet
k_ESteamIPv6ConnectivityState_Good = 1, // We have recently been able to make a request on ipv6 for the given protocol
k_ESteamIPv6ConnectivityState_Bad = 2, // We failed to make a request, either because this machine has no ipv6 address assigned, or it has no upstream connectivity
};
// Define compile time assert macros to let us validate the structure sizes. // Define compile time assert macros to let us validate the structure sizes.
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1]; #define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];

View File

@ -29,6 +29,8 @@ S_API bool SteamEncryptedAppTicket_BUserOwnsAppInTicket( uint8 *rgubTicketDecryp
S_API bool SteamEncryptedAppTicket_BUserIsVacBanned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted ); S_API bool SteamEncryptedAppTicket_BUserIsVacBanned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
S_API bool SteamEncryptedAppTicket_BGetAppDefinedValue( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pValue );
S_API const uint8 *SteamEncryptedAppTicket_GetUserVariableData( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pcubUserData ); S_API const uint8 *SteamEncryptedAppTicket_GetUserVariableData( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pcubUserData );
S_API bool SteamEncryptedAppTicket_BIsTicketSigned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, const uint8 *pubRSAKey, uint32 cubRSAKey ); S_API bool SteamEncryptedAppTicket_BIsTicketSigned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, const uint8 *pubRSAKey, uint32 cubRSAKey );

View File

@ -0,0 +1,113 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Kludge adapter that's used for the transition standalone library.
// This is not the opensource code, or the one in the Steamworks SDK.
//
//=============================================================================
#ifndef STEAMNETWORKINGSOCKETS
#define STEAMNETWORKINGSOCKETS
#ifdef _WIN32
#pragma once
#endif
#include "isteamnetworkingsockets.h"
struct SteamRelayNetworkStatus_t;
struct P2PSessionRequest_t;
struct P2PSessionConnectFail_t;
#if !defined( STEAMNETWORKINGSOCKETS_PARTNER ) && !defined( STEAMNETWORKINGSOCKETS_STREAMINGCLIENT )
#error "Shouldn't be including this!"
#endif
#ifdef STEAMNETWORKINGSOCKETS_STEAM
// #KLUDGE! So we don't have to link with steam_api.lib
#include <steam/steam_api.h>
#include <steam/steam_gameserver.h>
/////////////////////////////////////////////////////////////////////////////
// Temp internal gross stuff you should ignore
typedef void * ( S_CALLTYPE *FSteamInternal_CreateInterface )( const char *);
typedef void ( S_CALLTYPE *FSteamAPI_RegisterCallback)( class CCallbackBase *pCallback, int iCallback );
typedef void ( S_CALLTYPE *FSteamAPI_UnregisterCallback)( class CCallbackBase *pCallback );
typedef void ( S_CALLTYPE *FSteamAPI_RegisterCallResult)( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
typedef void ( S_CALLTYPE *FSteamAPI_UnregisterCallResult)( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_SetLauncher( const char *pszLauncher ); // Call this before SteamDatagramClient_Init
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_SetUniverse( EUniverse eUniverse ); // Call this before SteamDatagramClient_Init, to run without steam support
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_Internal_SteamAPIKludge( FSteamAPI_RegisterCallback fnRegisterCallback, FSteamAPI_UnregisterCallback fnUnregisterCallback, FSteamAPI_RegisterCallResult fnRegisterCallResult, FSteamAPI_UnregisterCallResult fnUnregisterCallResult );
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramClient_Init_InternalV9( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg, FSteamInternal_CreateInterface fnCreateInterface, HSteamUser hSteamUser, HSteamPipe hSteamPipe );
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramServer_Init_InternalV2( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg, FSteamInternal_CreateInterface fnCreateInterface, HSteamUser hSteamUser, HSteamPipe hSteamPipe );
/////////////////////////////////////////////////////////////////////////////
/// Initialize the user interface.
inline bool SteamDatagramClient_Init( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg )
{
SteamDatagramClient_Internal_SteamAPIKludge( &::SteamAPI_RegisterCallback, &::SteamAPI_UnregisterCallback, &::SteamAPI_RegisterCallResult, &::SteamAPI_UnregisterCallResult );
return SteamDatagramClient_Init_InternalV9( bNoSteamSupport, errMsg, ::SteamInternal_CreateInterface, ::SteamAPI_GetHSteamUser(), ::SteamAPI_GetHSteamPipe() );
}
/// Initialize the game server interface
inline bool SteamDatagramServer_Init( bool bNoSteamSupport, SteamNetworkingErrMsg &errMsg )
{
SteamDatagramClient_Internal_SteamAPIKludge( &::SteamAPI_RegisterCallback, &::SteamAPI_UnregisterCallback, &::SteamAPI_RegisterCallResult, &::SteamAPI_UnregisterCallResult );
return SteamDatagramServer_Init_InternalV2( bNoSteamSupport, errMsg, &SteamInternal_CreateInterface, ::SteamGameServer_GetHSteamUser(), ::SteamGameServer_GetHSteamPipe() );
}
#else // #ifdef STEAMNETWORKINGSOCKETS_STEAM
/// Initialize client interface
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramClient_Init( bool /* ignored */, SteamNetworkingErrMsg &errMsg );
/// Initialize gameserver interface
STEAMNETWORKINGSOCKETS_INTERFACE bool SteamDatagramServer_Init( bool /* ignored */, SteamNetworkingErrMsg &errMsg );
#endif
/// Shutdown the client interface
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_Kill();
/// Shutdown the game server interface
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramServer_Kill();
/// Call before initializing the library, to set the AppID. This is only needed
/// when running without Steam support. (Either on other platforms, or when
/// intentionally not using steam client.)
STEAMNETWORKINGSOCKETS_INTERFACE void SteamDatagramClient_SetAppID( AppId_t nAppID );
/// Manual polling mode. You should call this before initialize the lib.
/// This will prevent the library from opening up its own service thread,
/// allowing you to pump sockets and stuff from your own thread.
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_SetManualPollMode( bool bFlag );
/// If you call SteamNetworkingSockets_SetManualPollMode, then you need to
/// call this frequently. Any time spent between calls is essentially
/// guaranteed to delay time-sensitive processing, so whatever you are
/// doing, make it quick. If you pass a nonzero wait time, then this
/// function will sleep efficiently, waiting for incoming packets,
/// up to the maximum time you specify. It may return prematurely
/// if packets arrive earlier than your timeout.
STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_Poll( int msMaxWaitTime );
/// TEMP callback dispatch mechanism.
/// You'll override this guy and hook any callbacks you are interested in,
/// and then use ISteamNetworkingSockets::RunCallbacks. Eventually this will go away,
/// and you will register for the callbacks you want using the normal SteamWorks callback
/// mechanisms, and they will get dispatched along with other Steamworks callbacks
/// when you call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks.
class ISteamNetworkingSocketsCallbacks
{
public:
inline ISteamNetworkingSocketsCallbacks() {}
virtual void OnSteamNetConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t * ) {}
virtual void OnP2PSessionRequest( P2PSessionRequest_t * ) {}
virtual void OnP2PSessionConnectFail( P2PSessionConnectFail_t * ) {}
virtual void OnAuthenticationStatusChanged( SteamNetAuthenticationStatus_t * ) {}
virtual void OnRelayNetworkStatusChanged( SteamRelayNetworkStatus_t * ) {}
protected:
inline ~ISteamNetworkingSocketsCallbacks() {}
};
#endif // ISTEAMNETWORKINGSOCKETS

View File

@ -11,6 +11,7 @@
#endif #endif
#include <string.h> #include <string.h>
#include <stdint.h>
//---------------------------------------- //----------------------------------------
// SteamNetworkingSockets library config // SteamNetworkingSockets library config
@ -195,7 +196,11 @@ struct SteamNetworkingIPAddr
bool operator==(const SteamNetworkingIPAddr &x ) const; bool operator==(const SteamNetworkingIPAddr &x ) const;
}; };
/// An abstract way to represent the identity of a network host /// An abstract way to represent the identity of a network host. All identities can
/// be represented as simple string. Furthermore, this string representation is actually
/// used on the wire in several places, even though it is less efficient, in order to
/// facilitate forward compatibility. (Old client code can handle an identity type that
/// it doesn't understand.)
struct SteamNetworkingIdentity struct SteamNetworkingIdentity
{ {
/// Type of identity. /// Type of identity.
@ -236,7 +241,11 @@ struct SteamNetworkingIdentity
/// k_cchMaxString bytes big to avoid truncation. /// k_cchMaxString bytes big to avoid truncation.
void ToString( char *buf, size_t cbBuf ) const; void ToString( char *buf, size_t cbBuf ) const;
/// Parse back a string that was generated using ToString /// Parse back a string that was generated using ToString. If we don't understand the
/// string, but it looks "reasonable" (it matches the pattern type:<type-data> and doesn't
/// have any funcky characters, etc), then we will return true, and the type is set to
/// k_ESteamNetworkingIdentityType_UnknownType. false will only be returned if the string
/// looks invalid.
bool ParseString( const char *pszStr ); bool ParseString( const char *pszStr );
// Max sizes // Max sizes
@ -624,7 +633,7 @@ struct SteamNetworkingQuickConnectionStatus
/// but has now been scheduled for re-transmission. Thus, it's possible to /// but has now been scheduled for re-transmission. Thus, it's possible to
/// observe m_cbPendingReliable increasing between two checks, even if no /// observe m_cbPendingReliable increasing between two checks, even if no
/// calls were made to send reliable data between the checks. Data that is /// calls were made to send reliable data between the checks. Data that is
/// awaiting the nagle delay will appear in these numbers. /// awaiting the Nagle delay will appear in these numbers.
int m_cbPendingUnreliable; int m_cbPendingUnreliable;
int m_cbPendingReliable; int m_cbPendingReliable;
@ -672,7 +681,7 @@ struct SteamNetworkingQuickConnectionStatus
/// and our peer might, too. /// and our peer might, too.
const int k_cbMaxSteamNetworkingSocketsMessageSizeSend = 512 * 1024; const int k_cbMaxSteamNetworkingSocketsMessageSizeSend = 512 * 1024;
/// A message that has been received /// A message that has been received.
struct SteamNetworkingMessage_t struct SteamNetworkingMessage_t
{ {
@ -680,15 +689,20 @@ struct SteamNetworkingMessage_t
void *m_pData; void *m_pData;
/// Size of the payload. /// Size of the payload.
uint32 m_cbSize; int m_cbSize;
/// The connection this came from. (Not used when using the ISteamMessages interface) /// For messages received on connections: what connection did this come from?
/// For outgoing messages: what connection to send it to?
/// Not used when using the ISteamNetworkingMessages interface
HSteamNetConnection m_conn; HSteamNetConnection m_conn;
/// Who sent this to us? /// For inbound messages: Who sent this to us?
SteamNetworkingIdentity m_sender; /// For outbound messages on connections: not used.
/// For outbound messages on the ad-hoc ISteamNetworkingMessages interface: who should we send this to?
SteamNetworkingIdentity m_identityPeer;
/// The user data associated with the connection. /// For messages received on connections, this is the user data
/// associated with the connection.
/// ///
/// This is *usually* the same as calling GetConnection() and then /// This is *usually* the same as calling GetConnection() and then
/// fetching the user data associated with that connection, but for /// fetching the user data associated with that connection, but for
@ -701,12 +715,16 @@ struct SteamNetworkingMessage_t
/// - This is an inline call, so it's *much* faster. /// - This is an inline call, so it's *much* faster.
/// - You might have closed the connection, so fetching the user data /// - You might have closed the connection, so fetching the user data
/// would not be possible. /// would not be possible.
///
/// Not used when sending messages,
int64 m_nConnUserData; int64 m_nConnUserData;
/// Local timestamps when it was received /// Local timestamp when the message was received
/// Not used for outbound messages.
SteamNetworkingMicroseconds m_usecTimeReceived; SteamNetworkingMicroseconds m_usecTimeReceived;
/// Message number assigned by the sender /// Message number assigned by the sender.
/// This is not used for outbound messages
int64 m_nMessageNumber; int64 m_nMessageNumber;
/// Function used to free up m_pData. This mechanism exists so that /// Function used to free up m_pData. This mechanism exists so that
@ -717,19 +735,26 @@ struct SteamNetworkingMessage_t
/// free( pMsg->m_pData ); /// free( pMsg->m_pData );
void (*m_pfnFreeData)( SteamNetworkingMessage_t *pMsg ); void (*m_pfnFreeData)( SteamNetworkingMessage_t *pMsg );
/// Function to used to decrement reference count and, if it's zero, release /// Function to used to decrement the internal reference count and, if
/// the message. You should not normally need to access this directly. /// it's zero, release the message. You should not set this function pointer,
/// (Use Release(), and don't set this.) /// or need to access this directly! Use the Release() function instead!
void (*m_pfnRelease)( SteamNetworkingMessage_t *pMsg ); void (*m_pfnRelease)( SteamNetworkingMessage_t *pMsg );
/// The channel number the message was received on. /// When using ISteamNetworkingMessages, the channel number the message was received on
/// (Not used for messages received on "connections") /// (Not used for messages sent or received on "connections")
int m_nChannel; int m_nChannel;
/// Pad to multiple of 8 bytes /// Bitmask of k_nSteamNetworkingSend_xxx flags.
int m___nPadDummy; /// For received messages, only the k_nSteamNetworkingSend_Reliable bit is valid.
/// For outbound messages, all bits are relevant
int m_nFlags;
#ifdef __cplusplus /// Arbitrary user data that you can use when sending messages using
/// ISteamNetworkingUtils::AllocateMessage and ISteamNetworkingSockets::SendMessage.
/// (The callback you set in m_pfnFreeData might use this field.)
///
/// Not used for received messages.
int64 m_nUserData;
/// You MUST call this when you're done with the object, /// You MUST call this when you're done with the object,
/// to free up memory, etc. /// to free up memory, etc.
@ -743,7 +768,13 @@ struct SteamNetworkingMessage_t
inline int64 GetConnectionUserData() const { return m_nConnUserData; } inline int64 GetConnectionUserData() const { return m_nConnUserData; }
inline SteamNetworkingMicroseconds GetTimeReceived() const { return m_usecTimeReceived; } inline SteamNetworkingMicroseconds GetTimeReceived() const { return m_usecTimeReceived; }
inline int64 GetMessageNumber() const { return m_nMessageNumber; } inline int64 GetMessageNumber() const { return m_nMessageNumber; }
#endif protected:
// Declare destructor protected. You should never need to declare a message
// object on the stack or create one yourself.
// - You will receive a pointer to a message object when you receive messages (e.g. ISteamNetworkingSockets::ReceiveMessagesOnConnection)
// - You can allocate a message object for efficient sending using ISteamNetworkingUtils::AllocateMessage
// - Call Release() to free the object
//inline ~SteamNetworkingMessage_t() {}
}; };
// //
@ -802,7 +833,7 @@ const int k_nSteamNetworkingSend_NoDelay = 4;
// - there is a sufficiently large number of messages queued up already such that the current message // - there is a sufficiently large number of messages queued up already such that the current message
// will not be placed on the wire in the next ~200ms or so. // will not be placed on the wire in the next ~200ms or so.
// //
// if a message is dropped for these reasons, k_EResultIgnored will be returned. // If a message is dropped for these reasons, k_EResultIgnored will be returned.
const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoDelay|k_nSteamNetworkingSend_NoNagle; const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoDelay|k_nSteamNetworkingSend_NoNagle;
// Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message. // Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message.
@ -821,6 +852,21 @@ const int k_nSteamNetworkingSend_Reliable = 8;
// Migration note: This is equivalent to k_EP2PSendReliable // Migration note: This is equivalent to k_EP2PSendReliable
const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable|k_nSteamNetworkingSend_NoNagle; const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable|k_nSteamNetworkingSend_NoNagle;
// By default, message sending is queued, and the work of encryption and talking to
// the operating system sockets, etc is done on a service thread. This is usually a
// a performance win when messages are sent from the "main thread". However, if this
// flag is set, and data is ready to be sent immediately (either from this message
// or earlier queued data), then that work will be done in the current thread, before
// the current call returns. If data is not ready to be sent (due to rate limiting
// or Nagle), then this flag has no effect.
//
// This is an advanced flag used to control performance at a very low level. For
// most applications running on modern hardware with more than one CPU core, doing
// the work of sending on a service thread will yield the best performance. Only
// use this flag if you have a really good reason and understand what you are doing.
// Otherwise you will probably just make performance worse.
const int k_nSteamNetworkingSend_UseCurrentThread = 16;
// //
// Ping location / measurement // Ping location / measurement
// //
@ -960,6 +1006,9 @@ enum ESteamNetworkingConfigValue
/// we don't know our identity or can't get a cert. On the server, it means that /// we don't know our identity or can't get a cert. On the server, it means that
/// we won't automatically reject a connection due to a failure to authenticate. /// we won't automatically reject a connection due to a failure to authenticate.
/// (You can examine the incoming connection and decide whether to accept it.) /// (You can examine the incoming connection and decide whether to accept it.)
///
/// This is a dev configuration value, and you should not let users modify it in
/// production.
k_ESteamNetworkingConfig_IP_AllowWithoutAuth = 23, k_ESteamNetworkingConfig_IP_AllowWithoutAuth = 23,
/// [connection int32] Do not send UDP packets with a payload of /// [connection int32] Do not send UDP packets with a payload of
@ -971,6 +1020,30 @@ enum ESteamNetworkingConfigValue
/// will not fragment, based on k_ESteamNetworkingConfig_MTU_PacketSize /// will not fragment, based on k_ESteamNetworkingConfig_MTU_PacketSize
k_ESteamNetworkingConfig_MTU_DataSize = 33, k_ESteamNetworkingConfig_MTU_DataSize = 33,
/// [connection int32] Allow unencrypted (and unauthenticated) communication.
/// 0: Not allowed (the default)
/// 1: Allowed, but prefer encrypted
/// 2: Allowed, and preferred
/// 3: Required. (Fail the connection if the peer requires encryption.)
///
/// This is a dev configuration value, since its purpose is to disable encryption.
/// You should not let users modify it in production. (But note that it requires
/// the peer to also modify their value in order for encryption to be disabled.)
k_ESteamNetworkingConfig_Unencrypted = 34,
/// [global int32] 0 or 1. Some variables are "dev" variables. They are useful
/// for debugging, but should not be adjusted in production. When this flag is false (the default),
/// such variables will not be enumerated by the ISteamnetworkingUtils::GetFirstConfigValue
/// ISteamNetworkingUtils::GetConfigValueInfo functions. The idea here is that you
/// can use those functions to provide a generic mechanism to set any configuration
/// value from a console or configuration file, looking up the variable by name. Depending
/// on your game, modifying other configuration values may also have negative effects, and
/// you may wish to further lock down which variables are allowed to be modified by the user.
/// (Maybe no variables!) Or maybe you use a whitelist or blacklist approach.
///
/// (This flag is itself a dev variable.)
k_ESteamNetworkingConfig_EnumerateDevVars = 35,
// //
// Settings for SDR relayed connections // Settings for SDR relayed connections
// //
@ -1013,6 +1086,13 @@ enum ESteamNetworkingConfigValue
/// this set (maybe just one). Comma-separated list. /// this set (maybe just one). Comma-separated list.
k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr = 31, k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr = 31,
/// [global string] For debugging. Force ping times to clusters to be the specified
/// values. A comma separated list of <cluster>=<ms> values. E.g. "sto=32,iad=100"
///
/// This is a dev configuration value, you probably should not let users modify it
/// in production.
k_ESteamNetworkingConfig_SDRClient_FakeClusterPing = 36,
// //
// Log levels for debuging information. A higher priority // Log levels for debuging information. A higher priority
// (lower numeric value) will cause more stuff to be printed. // (lower numeric value) will cause more stuff to be printed.
@ -1027,6 +1107,36 @@ enum ESteamNetworkingConfigValue
k_ESteamNetworkingConfigValue__Force32Bit = 0x7fffffff k_ESteamNetworkingConfigValue__Force32Bit = 0x7fffffff
}; };
/// In a few places we need to set configuration options on listen sockets and connections, and
/// have them take effect *before* the listen socket or connection really starts doing anything.
/// Creating the object and then setting the options "immediately" after creation doesn't work
/// completely, because network packets could be received between the time the object is created and
/// when the options are applied. To set options at creation time in a reliable way, they must be
/// passed to the creation function. This structure is used to pass those options.
///
/// For the meaning of these fields, see ISteamNetworkingUtils::SetConfigValue. Basically
/// when the object is created, we just iterate over the list of options and call
/// ISteamNetworkingUtils::SetConfigValueStruct, where the scope arguments are supplied by the
/// object being created.
struct SteamNetworkingConfigValue_t
{
/// Which option is being set
ESteamNetworkingConfigValue m_eValue;
/// Which field below did you fill in?
ESteamNetworkingConfigDataType m_eDataType;
/// Option value
union
{
int32_t m_int32;
int64_t m_int64;
float m_float;
const char *m_string; // Points to your '\0'-terminated buffer
void *m_functionPtr;
} m_val;
};
/// Return value of ISteamNetworkintgUtils::GetConfigValue /// Return value of ISteamNetworkintgUtils::GetConfigValue
enum ESteamNetworkingGetConfigValueResult enum ESteamNetworkingGetConfigValueResult
{ {

View File

@ -223,4 +223,80 @@ const SiteId_t k_ulSiteIdInvalid = 0;
typedef uint64 PartyBeaconID_t; typedef uint64 PartyBeaconID_t;
const PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0; const PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0;
enum ESteamIPType
{
k_ESteamIPTypeIPv4 = 0,
k_ESteamIPTypeIPv6 = 1,
};
#pragma pack( push, 1 )
struct SteamIPAddress_t
{
union {
uint32 m_unIPv4; // Host order
uint8 m_rgubIPv6[16]; // Network order! Same as inaddr_in6. (0011:2233:4455:6677:8899:aabb:ccdd:eeff)
// Internal use only
uint64 m_ipv6Qword[2]; // big endian
};
ESteamIPType m_eType;
bool IsSet() const
{
if ( k_ESteamIPTypeIPv4 == m_eType )
{
return m_unIPv4 != 0;
}
else
{
return m_ipv6Qword[0] !=0 || m_ipv6Qword[1] != 0;
}
}
static SteamIPAddress_t IPv4Any()
{
SteamIPAddress_t ipOut;
ipOut.m_eType = k_ESteamIPTypeIPv4;
ipOut.m_unIPv4 = 0;
return ipOut;
}
static SteamIPAddress_t IPv6Any()
{
SteamIPAddress_t ipOut;
ipOut.m_eType = k_ESteamIPTypeIPv6;
ipOut.m_ipv6Qword[0] = 0;
ipOut.m_ipv6Qword[1] = 0;
return ipOut;
}
static SteamIPAddress_t IPv4Loopback()
{
SteamIPAddress_t ipOut;
ipOut.m_eType = k_ESteamIPTypeIPv4;
ipOut.m_unIPv4 = 0x7f000001;
return ipOut;
}
static SteamIPAddress_t IPv6Loopback()
{
SteamIPAddress_t ipOut;
ipOut.m_eType = k_ESteamIPTypeIPv6;
ipOut.m_ipv6Qword[0] = 0;
ipOut.m_ipv6Qword[1] = 0;
ipOut.m_rgubIPv6[15] = 1;
return ipOut;
}
};
#pragma pack( pop )
#endif // STEAMTYPES_H #endif // STEAMTYPES_H