1
0
Fork 0
mirror of https://github.com/Detanup01/gbe_fork.git synced 2025-03-28 14:56:24 +01:00

old steammatchmaking

This commit is contained in:
a 2024-12-06 22:24:33 +02:00
parent e492aec54b
commit fa27cf4abc
5 changed files with 189 additions and 8 deletions

View file

@ -56,6 +56,7 @@ struct Chat_Entry {
class Steam_Matchmaking :
public ISteamMatchmaking001,
public ISteamMatchmaking002,
public ISteamMatchmaking003,
public ISteamMatchmaking004,
@ -383,6 +384,30 @@ public:
// you must be the lobby owner of both lobbies
bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent );
// older sdk -------------------------------------------------------------------
// returns the details of the game server
// iGame is of range [0,GetFavoriteGameCount())
// *pnIP, *pnConnPort are filled in the with IP:port of the game server
// *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
bool GetFavoriteGame( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer );
// adds the game server to the local list; updates the time played of the server if it already exists in the list
int AddFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer );
// removes the game server from the local storage; returns true if one was removed
bool RemoveFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags );
bool GetFavoriteGame2( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer );
int AddFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer );
bool RemoveFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags );
void RequestLobbyList( uint64 ulGameID, MatchMakingKeyValuePair_t *pFilters, uint32 nFilters );
void CreateLobby( uint64 ulGameID, bool bPrivate );
bool SetLobbyMemberData_OLD( CSteamID steamIDLobby, const char *pchKey, const char *pchValue );
// older sdk -------------------------------------------------------------------
};
#endif // __INCLUDED_STEAM_MATCHMAKING_H__

View file

@ -251,9 +251,8 @@ ISteamMatchmaking *Steam_Client::GetISteamMatchmaking( HSteamUser hSteamUser, HS
PRINT_DEBUG("%s", pchVersion);
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
if (strcmp(pchVersion, "SteamMatchMaking001") == 0) { // SteamMatchMaking001 Not found in public Archive, must be before 1.00
//TODO
return reinterpret_cast<ISteamMatchmaking *>(static_cast<ISteamMatchmaking002 *>(steam_matchmaking));
if (strcmp(pchVersion, "SteamMatchMaking001") == 0) { // SteamMatchMaking001 Not found in public Archive, from proton src
return reinterpret_cast<ISteamMatchmaking *>(static_cast<ISteamMatchmaking001 *>(steam_matchmaking));
} else if (strcmp(pchVersion, "SteamMatchMaking002") == 0) {
return reinterpret_cast<ISteamMatchmaking *>(static_cast<ISteamMatchmaking002 *>(steam_matchmaking));
} else if (strcmp(pchVersion, "SteamMatchMaking003") == 0) {

View file

@ -1242,6 +1242,79 @@ bool Steam_Matchmaking::SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDL
// older sdk -------------------------------------------------------------------
// returns the details of the game server
// iGame is of range [0,GetFavoriteGameCount())
// *pnIP, *pnConnPort are filled in the with IP:port of the game server
// *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
bool Steam_Matchmaking::GetFavoriteGame( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer )
{
PRINT_DEBUG("old");
return GetFavoriteGame(iGame, reinterpret_cast<AppId_t *>(pnAppID), pnIP, pnConnPort, 0, punFlags, pRTime32LastPlayedOnServer );
}
// adds the game server to the local list; updates the time played of the server if it already exists in the list
int Steam_Matchmaking::AddFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer )
{
PRINT_DEBUG("old");
return AddFavoriteGame( (AppId_t)nAppID, nIP, nConnPort, 0, unFlags, rTime32LastPlayedOnServer );
}
// removes the game server from the local storage; returns true if one was removed
bool Steam_Matchmaking::RemoveFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags )
{
PRINT_DEBUG("old");
return RemoveFavoriteGame( (AppId_t)nAppID, nIP, nConnPort, 0, unFlags );
}
bool Steam_Matchmaking::GetFavoriteGame2( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer )
{
PRINT_DEBUG("old");
return GetFavoriteGame(iGame, reinterpret_cast<AppId_t *>(pnAppID), pnIP, pnConnPort, pnQueryPort, punFlags, pRTime32LastPlayedOnServer );
}
int Steam_Matchmaking::AddFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer )
{
PRINT_DEBUG("old");
return AddFavoriteGame( (AppId_t)nAppID, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer );
}
bool Steam_Matchmaking::RemoveFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags )
{
PRINT_DEBUG("old");
return RemoveFavoriteGame( (AppId_t)nAppID, nIP, nConnPort, nQueryPort, unFlags );
}
void Steam_Matchmaking::RequestLobbyList( uint64 ulGameID, MatchMakingKeyValuePair_t *pFilters, uint32 nFilters )
{
PRINT_DEBUG("old");
if (pFilters && nFilters > 0) {
for (size_t fidx = 0; fidx < nFilters; ++fidx) {
auto &kv = pFilters[fidx];
AddRequestLobbyListFilter(kv.m_szKey, kv.m_szValue);
}
}
RequestLobbyList();
}
void Steam_Matchmaking::CreateLobby( uint64 ulGameID, bool bPrivate )
{
PRINT_DEBUG("old");
CreateLobby(bPrivate);
}
bool Steam_Matchmaking::SetLobbyMemberData_OLD( CSteamID steamIDLobby, const char *pchKey, const char *pchValue )
{
PRINT_DEBUG("old");
SetLobbyMemberData(steamIDLobby, pchKey, pchValue);
return true;
}
// older sdk -------------------------------------------------------------------
void Steam_Matchmaking::remove_lobbies()
{
uint64 current_time = std::chrono::duration_cast<std::chrono::duration<uint64>>(std::chrono::system_clock::now().time_since_epoch()).count();

View file

@ -0,0 +1,83 @@
#ifndef ISTEAMMATCHMAKING001_H
#define ISTEAMMATCHMAKING001_H
#ifdef STEAM_WIN32
#pragma once
#endif
// this interface version is not found in public SDK archives, it is based on proton src: https://github.com/ValveSoftware/Proton/tree/proton_9.0/lsteamclient
//-----------------------------------------------------------------------------
// Purpose: Functions for match making services for clients to get to favorites
// and to operate on game lobbies.
//-----------------------------------------------------------------------------
class ISteamMatchmaking001
{
public:
// game server favorites storage
// saves basic details about a multiplayer game server locally
// returns the number of favorites servers the user has stored
virtual int GetFavoriteGameCount() = 0;
// returns the details of the game server
// iGame is of range [0,GetFavoriteGameCount())
// *pnIP, *pnConnPort are filled in the with IP:port of the game server
// *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections
// *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added
virtual bool GetFavoriteGame( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0;
// adds the game server to the local list; updates the time played of the server if it already exists in the list
virtual int AddFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) = 0;
// removes the game server from the local storage; returns true if one was removed
virtual bool RemoveFavoriteGame( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint32 unFlags ) = 0;
virtual bool GetFavoriteGame2( int iGame, uint32 *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0;
virtual int AddFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) = 0;
virtual bool RemoveFavoriteGame2( uint32 nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
///////
// Game lobby functions
virtual void RequestLobbyList( uint64 ulGameID, MatchMakingKeyValuePair_t *pFilters, uint32 nFilters ) = 0;
virtual CSteamID GetLobbyByIndex( int iLobby ) = 0;
virtual void CreateLobby( uint64 ulGameID, bool bPrivate ) = 0;
virtual void JoinLobby_OLD( CSteamID steamIDLobby ) = 0;
virtual void LeaveLobby( CSteamID steamIDLobby ) = 0;
virtual bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) = 0;
virtual int GetNumLobbyMembers( CSteamID steamIDLobby ) = 0;
virtual CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) = 0;
virtual const char *GetLobbyData( CSteamID SteamIDLobby, const char *pchKey ) = 0;
// Sets a key/value pair in the lobby metadata
// each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data
// this can be used to set lobby names, map, etc.
// to reset a key, just set it to ""
// other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback
virtual bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0;
// As above, but gets per-user data for someone in this lobby
virtual const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey ) = 0;
// Sets per-user metadata (for the local user implicitly)
virtual bool SetLobbyMemberData_OLD( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0;
// Broadcasts a chat message to the all the users in the lobby
// users in the lobby (including the local user) will receive a LobbyChatMsg_t callback
// returns true if the message is successfully sent
virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0;
// Get a chat message as specified in a LobbyChatMsg_t callback
// iChatID is the LobbyChatMsg_t::m_iChatID value in the callback
// *pSteamIDUser is filled in with the CSteamID of the member
// *pvData is filled in with the message itself
// return value is the number of bytes written into the buffer
virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
// Fetch metadata for a lobby you're not necessarily in right now
// this will send down all the metadata associated with a lobby
// this is an asynchronous call
// returns false if the local user is not connected to the Steam servers
virtual bool RequestLobbyData( CSteamID steamIDLobby ) = 0;
};
#endif // ISTEAMMATCHMAKING001_H

View file

@ -85,6 +85,7 @@
#include "isteamutils008.h"
#include "isteamutils009.h"
#include "isteammatchmaking.h"
#include "isteammatchmaking001.h"
#include "isteammatchmaking002.h"
#include "isteammatchmaking003.h"
#include "isteammatchmaking004.h"