Add test server

This commit is contained in:
momo5502 2022-07-02 10:20:11 +02:00
parent 1456f7743e
commit 954072ff02
3 changed files with 95 additions and 23 deletions

View File

@ -4,47 +4,73 @@
namespace steam namespace steam
{ {
void* matchmaking_servers::RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, void* matchmaking_servers::RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse) matchmaking_server_list_response* pRequestServersResponse)
{ {
return nullptr; pRequestServersResponse->ServerResponded(reinterpret_cast<void*>(1), 0);
pRequestServersResponse->RefreshComplete(reinterpret_cast<void*>(1), eServerResponded);
return reinterpret_cast<void*>(1);
} }
void* matchmaking_servers::RequestLANServerList(unsigned int iApp, void* pRequestServersResponse) void* matchmaking_servers::RequestLANServerList(unsigned int iApp,
matchmaking_server_list_response* pRequestServersResponse)
{ {
return nullptr; return reinterpret_cast<void*>(2);
} }
void* matchmaking_servers::RequestFriendsServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, void* matchmaking_servers::RequestFriendsServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse) matchmaking_server_list_response* pRequestServersResponse)
{ {
return nullptr; return reinterpret_cast<void*>(3);
} }
void* matchmaking_servers::RequestFavoritesServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, void* matchmaking_servers::RequestFavoritesServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse) matchmaking_server_list_response* pRequestServersResponse)
{ {
return nullptr; return reinterpret_cast<void*>(4);
} }
void* matchmaking_servers::RequestHistoryServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, void* matchmaking_servers::RequestHistoryServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse) matchmaking_server_list_response* pRequestServersResponse)
{ {
return nullptr; return reinterpret_cast<void*>(5);
} }
void* matchmaking_servers::RequestSpectatorServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, void* matchmaking_servers::RequestSpectatorServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse) matchmaking_server_list_response* pRequestServersResponse)
{ {
return nullptr; return reinterpret_cast<void*>(6);
} }
void matchmaking_servers::ReleaseRequest(void* hServerListRequest) void matchmaking_servers::ReleaseRequest(void* hServerListRequest)
{ {
} }
void* matchmaking_servers::GetServerDetails(void* hRequest, int iServer) gameserveritem_t* matchmaking_servers::GetServerDetails(void* hRequest, int iServer)
{ {
return nullptr; static gameserveritem_t server{};
server.m_NetAdr.m_usConnectionPort = 27017;
server.m_NetAdr.m_usQueryPort = 27017;
server.m_NetAdr.m_unIP = 0x7F000001;
server.m_nPing = 10;
server.m_bHadSuccessfulResponse = true;
server.m_bDoNotRefresh = false;
strcpy_s(server.m_szGameDir, "usermaps");
strcpy_s(server.m_szMap, "mp_nuketown_x");
strcpy_s(server.m_szGameDescription, "Example BO^3I^5I^6I ^7Server");
server.m_nAppID = 311210;
server.m_nPlayers = 0;
server.m_nMaxPlayers = 18;
server.m_nBotPlayers = 0;
server.m_bPassword = false;
server.m_bSecure = true;
server.m_ulTimeLastPlayed = 0;
server.m_nServerVersion = 1000;
strcpy_s(server.m_szServerName, "BO^3I^5I^6I ^7Server");
strcpy_s(server.m_szGameTags,
R"(\gametype\gun\dedicated\true\ranked\true\hardcore\false\zombies\false\modName\usermaps\playerCount\0)");
server.m_steamID = steam_id();
return &server;
} }
void matchmaking_servers::CancelQuery(void* hRequest) void matchmaking_servers::CancelQuery(void* hRequest)
@ -62,7 +88,7 @@ namespace steam
int matchmaking_servers::GetServerCount(void* hRequest) int matchmaking_servers::GetServerCount(void* hRequest)
{ {
return 0; return (reinterpret_cast<void*>(1) == hRequest) ? 1 : 0;
} }
void matchmaking_servers::RefreshServer(void* hRequest, int iServer) void matchmaking_servers::RefreshServer(void* hRequest, int iServer)

View File

@ -2,24 +2,70 @@
namespace steam namespace steam
{ {
typedef enum EMatchMakingServerResponse
{
eServerResponded = 0,
eServerFailedToRespond,
eNoServersListedOnMasterServer
} matchmaking_server_response;
class matchmaking_server_list_response
{
public:
virtual void ServerResponded(void* hRequest, int iServer) = 0;
virtual void ServerFailedToRespond(void* hRequest, int iServer) = 0;
virtual void RefreshComplete(void* hRequest, matchmaking_server_response response) = 0;
};
class servernetadr_t
{
public:
uint16_t m_usConnectionPort;
uint16_t m_usQueryPort;
uint32_t m_unIP;
};
class gameserveritem_t
{
public:
servernetadr_t m_NetAdr;
int m_nPing;
bool m_bHadSuccessfulResponse;
bool m_bDoNotRefresh;
char m_szGameDir[32];
char m_szMap[32];
char m_szGameDescription[64];
uint32_t m_nAppID;
int m_nPlayers;
int m_nMaxPlayers;
int m_nBotPlayers;
bool m_bPassword;
bool m_bSecure;
uint32_t m_ulTimeLastPlayed;
int m_nServerVersion;
char m_szServerName[64];
char m_szGameTags[128];
steam_id m_steamID;
};
class matchmaking_servers class matchmaking_servers
{ {
public: public:
~matchmaking_servers() = default; ~matchmaking_servers() = default;
virtual void* RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, virtual void* RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse); matchmaking_server_list_response* pRequestServersResponse);
virtual void* RequestLANServerList(unsigned int iApp, void* pRequestServersResponse); virtual void* RequestLANServerList(unsigned int iApp, matchmaking_server_list_response* pRequestServersResponse);
virtual void* RequestFriendsServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, virtual void* RequestFriendsServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse); matchmaking_server_list_response* pRequestServersResponse);
virtual void* RequestFavoritesServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, virtual void* RequestFavoritesServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse); matchmaking_server_list_response* pRequestServersResponse);
virtual void* RequestHistoryServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, virtual void* RequestHistoryServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse); matchmaking_server_list_response* pRequestServersResponse);
virtual void* RequestSpectatorServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, virtual void* RequestSpectatorServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
void* pRequestServersResponse); matchmaking_server_list_response* pRequestServersResponse);
virtual void ReleaseRequest(void* hServerListRequest); virtual void ReleaseRequest(void* hServerListRequest);
virtual void* GetServerDetails(void* hRequest, int iServer); virtual gameserveritem_t* GetServerDetails(void* hRequest, int iServer);
virtual void CancelQuery(void* hRequest); virtual void CancelQuery(void* hRequest);
virtual void RefreshQuery(void* hRequest); virtual void RefreshQuery(void* hRequest);
virtual bool IsRefreshing(void* hRequest); virtual bool IsRefreshing(void* hRequest);

View File

@ -50,7 +50,7 @@ namespace steam
unsigned int utils::GetAppID() unsigned int utils::GetAppID()
{ {
return 209660; return 311210;
} }
void utils::SetOverlayNotificationPosition(int eNotificationPosition) void utils::SetOverlayNotificationPosition(int eNotificationPosition)