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

This commit is contained in:
Nemirtingas 2020-01-10 08:16:16 +01:00
commit 118dee9278
81 changed files with 2782 additions and 204 deletions

View file

@ -126,27 +126,27 @@ static unsigned generate_account_id()
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()
{
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()
{
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()
{
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()
{
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

View file

@ -445,14 +445,7 @@ public:
void runCallBacks() {
for (auto & c : callbacks) {
std::vector<std::vector<char>> res_back = c.second.results;
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();
} else if (strcmp(ver, "SteamClient018") == 0) {
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) {
steam_client = (ISteamClient *)get_steam_client();
} else {

View file

@ -19,7 +19,7 @@
#ifdef STEAMCLIENT_DLL
#define STEAMAPI_API static
#define STEAMCLIENT_API S_API
#define STEAMCLIENT_API S_API_EXPORT
#else
#define STEAMAPI_API S_API
#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)
{
//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);
}
@ -1106,6 +1108,18 @@ STEAMAPI_API int SteamAPI_ISteamUtils_FilterText(intptr_t instancePtr, char * pc
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)
{
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);
}
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);
}
@ -2246,7 +2260,7 @@ STEAMAPI_API SNetSocket_t SteamAPI_ISteamNetworking_CreateP2PConnectionSocket(in
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);
}
@ -2286,12 +2300,12 @@ STEAMAPI_API bool SteamAPI_ISteamNetworking_RetrieveData(intptr_t instancePtr, S
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);
}
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);
}
@ -2306,6 +2320,7 @@ STEAMAPI_API int SteamAPI_ISteamNetworking_GetMaxPacketSize(intptr_t instancePtr
return ((ISteamNetworking *)instancePtr)->GetMaxPacketSize(hSocket);
}
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);
@ -3230,6 +3245,19 @@ STEAMAPI_API bool SteamAPI_ISteamUGC_AddRequiredTag(intptr_t instancePtr, UGCQue
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)
{
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();
}
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);
}
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();
}
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);
}
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);
}
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);
}
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)
{
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();
}
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();
}

View file

@ -45,6 +45,45 @@ static IP_PORT broadcasts[MAX_BROADCASTS];
#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)
{
number_broadcasts = 0;
@ -71,13 +110,11 @@ static void get_broadcast_info(uint16 port)
IP_ADAPTER_INFO *pAdapter = pAdapterInfo;
while (pAdapter) {
unsigned long iface_ip = 0, subnet_mask = 0;
uint32_t iface_ip = 0, subnet_mask = 0;
if (inet_pton(AF_INET, pAdapter->IpAddressList.IpMask.String, &subnet_mask) == 1
&& inet_pton(AF_INET, pAdapter->IpAddressList.IpAddress.String, &iface_ip) == 1) {
if (inet_pton4(pAdapter->IpAddressList.IpMask.String, &subnet_mask) == 1
&& inet_pton4(pAdapter->IpAddressList.IpAddress.String, &iface_ip) == 1) {
IP_PORT *ip_port = &broadcasts[number_broadcasts];
//ip_port->ip.family = AF_INET;
uint32 broadcast_ip = iface_ip | ~subnet_mask;
ip_port->ip = broadcast_ip;
ip_port->port = port;
@ -221,6 +258,11 @@ static void run_at_startup()
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != NO_ERROR)
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
#endif

View file

@ -135,6 +135,7 @@ public:
//controller
struct Controller_Settings controller_settings;
std::string glyphs_directory;
//networking
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());
}
}
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)

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
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
if (!pchFolder || !cchFolderBufferSize) return 0;
std::string installed_path = settings->getAppInstallPath(appID);
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());
snprintf(pchFolder, cchFolderBufferSize, "%s", installed_path.c_str());
return strlen(pchFolder);
if (cchFolderBufferSize && pchFolder) {
snprintf(pchFolder, cchFolderBufferSize, "%s", installed_path.c_str());
}
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)

View file

@ -169,6 +169,7 @@ HSteamPipe Steam_Client::CreateSteamPipe()
bool Steam_Client::BReleaseSteamPipe( HSteamPipe hSteamPipe )
{
PRINT_DEBUG("BReleaseSteamPipe\n");
return true;
}
// 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;
} else if (strcmp(pchVersion, "SteamGameServer011") == 0) {
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) {
return (ISteamGameServer *)(void *)(ISteamGameServer *)steam_gameserver;
} else {
@ -276,7 +279,12 @@ ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSte
// this must be set before CreateLocalUser()
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
@ -444,6 +452,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
return (void *)(ISteamNetworkingSockets001 *) steam_networking_sockets_temp;
} else if (strcmp(pchVersion, "SteamNetworkingSockets002") == 0) {
return (void *)(ISteamNetworkingSockets002 *) steam_networking_sockets_temp;
} else if (strcmp(pchVersion, "SteamNetworkingSockets003") == 0) {
return (void *)(ISteamNetworkingSockets003 *) steam_networking_sockets_temp;
} else {
return (void *)(ISteamNetworkingSockets *) steam_networking_sockets_temp;
}
@ -459,6 +469,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
} else if (strstr(pchVersion, "SteamNetworkingUtils") == pchVersion) {
if (strcmp(pchVersion, "SteamNetworkingUtils001") == 0) {
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) {
return (void *)(ISteamNetworkingUtils *)steam_networking_utils;
} else {
@ -606,6 +618,8 @@ ISteamNetworking *Steam_Client::GetISteamNetworking( HSteamUser hSteamUser, HSte
return (ISteamNetworking *)(void *)(ISteamNetworking003 *)steam_networking_temp;
} else if (strcmp(pchVersion, "SteamNetworking004") == 0) {
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) {
return (ISteamNetworking *)(void *)(ISteamNetworking *)steam_networking_temp;
} else {
@ -793,6 +807,8 @@ ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamP
return (ISteamUGC *)(void *)(ISteamUGC012 *)steam_ugc_temp;
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION012") == 0) {
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) {
return (ISteamUGC *)(void *)(ISteamUGC *)steam_ugc_temp;
} else {
@ -1462,3 +1478,8 @@ void Steam_Client::RunCallbacks(bool runClientCB, bool runGameserverCB)
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 ISteamClient017,
public ISteamClient018,
public ISteamClient019,
public ISteamClient
{
public:
@ -162,6 +163,7 @@ public:
// set the local IP and Port to bind to
// this must be set before CreateLocalUser()
void SetLocalIPBinding( uint32 unIP, uint16 usPort );
void SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort );
// returns the ISteamFriends interface
ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
@ -286,4 +288,6 @@ public:
void clientShutdown();
bool IsServerInit();
bool IsUserLogIn();
void DestroyAllInterfaces();
};

View file

@ -129,6 +129,9 @@ public ISteamInput
std::map<ControllerActionSetHandle_t, struct Controller_Map> controller_maps;
std::map<ControllerHandle_t, struct Controller_Action> controllers;
std::map<EInputActionOrigin, std::string> steaminput_glyphs;
std::map<EControllerActionOrigin, std::string> steamcontroller_glyphs;
bool disabled;
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
const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin )
{
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin\n");
return "";
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin %i\n", eOrigin);
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 )
{
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin steaminput\n");
return "";
PRINT_DEBUG("Steam_Controller::GetGlyphForActionOrigin steaminput %i\n", eOrigin);
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

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
// behind NAT and you want to advertise its IP in a lobby for other clients to directly
// 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);
uint32 ip = network->getOwnIP();
PRINT_DEBUG("%X\n", 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
// 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 ISteamGameServer010,
public ISteamGameServer011,
public ISteamGameServer012,
public ISteamGameServer
{
class Settings *settings;
@ -275,7 +276,8 @@ public:
// 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
uint32 GetPublicIP();
uint32 GetPublicIP_old();
SteamIPAddress_t GetPublicIP();
// 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

View file

@ -1353,7 +1353,7 @@ void Callback(Common_Message *msg)
if (msg->lobby_messages().type() == Lobby_Messages::JOIN) {
PRINT_DEBUG("LOBBY MESSAGE: JOIN\n");
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) {

View file

@ -59,6 +59,7 @@ public ISteamNetworking001,
public ISteamNetworking002,
public ISteamNetworking003,
public ISteamNetworking004,
public ISteamNetworking005,
public ISteamNetworking
{
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
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);
for (auto & c : listen_sockets) {
if (c.nVirtualP2PPort == nVirtualP2PPort || c.nPort == nPort)
@ -499,6 +500,13 @@ SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 n
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 )
{
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 )
{
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);
//TODO: nTimeoutSec
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
// 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
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);
struct steam_connection_socket *socket = get_connection_socket(hSocket);
if (!socket) return false;
@ -717,12 +731,28 @@ bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocke
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
// *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 )
{
PRINT_DEBUG("Steam_Networking::GetListenSocketInfo\n");
PRINT_DEBUG("Steam_Networking::GetListenSocketInfo_old\n");
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;});
if (conn == listen_sockets.end()) return false;
@ -731,6 +761,22 @@ bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16
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
ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket )

View file

@ -49,6 +49,7 @@ struct Connect_Socket {
class Steam_Networking_Sockets :
public ISteamNetworkingSockets001,
public ISteamNetworkingSockets002,
public ISteamNetworkingSockets003,
public ISteamNetworkingSockets
{
class Settings *settings;
@ -238,6 +239,11 @@ HSteamListenSocket CreateListenSocket( int nSteamConnectVirtualPort, uint32 nIP,
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
/// will be posted. The connection will be in the connecting state.
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");
}
@ -261,6 +267,11 @@ HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddre
/// way of knowing who is actually on the other end, and thus are vulnerable to
/// man-in-the-middle attacks.
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");
}
@ -277,7 +288,15 @@ HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address )
/// when your app initializes
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);
return new_listen_socket(nVirtualPort);
}
@ -295,7 +314,7 @@ HSteamListenSocket CreateListenSocketP2P( int nVirtualPort )
/// when your app initializes
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);
const SteamNetworkingIPAddr *ip = identityRemote.GetIPAddr();
@ -315,6 +334,13 @@ HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, i
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
/// 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
/// work without any changes.
///
/// The pOutMessageNumber is an optional pointer to receive the
/// message number assigned to the message, if sending was successful.
///
/// Returns:
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
@ -576,7 +605,7 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
/// 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 )
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);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
@ -603,6 +632,50 @@ virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *
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
/// SendMessageToConnection the message will be queued up the Nagle time
/// 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;
memcpy(pMsg->m_pData, connect_socket->second.data.front().data(), size);
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;
//TODO
//pMsg->m_usecTimeReceived =
@ -957,7 +1030,7 @@ int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameSer
/// when your app initializes
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
@ -968,9 +1041,13 @@ HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentit
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
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
@ -1058,7 +1135,24 @@ virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRo
/// Note that this call MUST be made through the SteamNetworkingSocketsGameServer() interface
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);
return new_listen_socket(nVirtualPort);
}
@ -1172,6 +1266,85 @@ EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *
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.
// 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

View file

@ -19,6 +19,7 @@
class Steam_Networking_Utils :
public ISteamNetworkingUtils001,
public ISteamNetworkingUtils002,
public ISteamNetworkingUtils
{
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);
}
/// 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()
{
PRINT_DEBUG("Steam_Networking_Utils::InitializeRelayAccess\n");

View file

@ -105,6 +105,14 @@ bool BGetSessionClientResolution( uint32 unSessionID, int *pnResolutionX, int *p
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()
{
}

View file

@ -37,6 +37,7 @@ public ISteamUGC008,
public ISteamUGC009,
public ISteamUGC010,
public ISteamUGC012,
public ISteamUGC013,
public ISteamUGC
{
class Settings *settings;
@ -274,6 +275,11 @@ bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName )
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 )
{

View file

@ -373,4 +373,12 @@ int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const
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;
}
};