More dedi progress

This commit is contained in:
momo5502 2022-07-03 19:07:52 +02:00
parent 954072ff02
commit 8a395b525b
2 changed files with 54 additions and 36 deletions

View File

@ -3,6 +3,37 @@
namespace steam namespace steam
{ {
namespace
{
gameserveritem_t* get_server_item()
{
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::RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, void* matchmaking_servers::RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
matchmaking_server_list_response* pRequestServersResponse) matchmaking_server_list_response* pRequestServersResponse)
{ {
@ -47,30 +78,7 @@ namespace steam
gameserveritem_t* matchmaking_servers::GetServerDetails(void* hRequest, int iServer) gameserveritem_t* matchmaking_servers::GetServerDetails(void* hRequest, int iServer)
{ {
static gameserveritem_t server{}; return get_server_item();
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)
@ -95,9 +103,11 @@ namespace steam
{ {
} }
int matchmaking_servers::PingServer(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse) void* matchmaking_servers::PingServer(unsigned int unIP, unsigned short usPort,
matchmaking_ping_response* pRequestServersResponse)
{ {
return 0; pRequestServersResponse->ServerResponded(*get_server_item());
return reinterpret_cast<void*>(7);
} }
int matchmaking_servers::PlayerDetails(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse) int matchmaking_servers::PlayerDetails(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse)

View File

@ -9,14 +9,6 @@ namespace steam
eNoServersListedOnMasterServer eNoServersListedOnMasterServer
} matchmaking_server_response; } 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 class servernetadr_t
{ {
public: public:
@ -48,6 +40,21 @@ namespace steam
steam_id m_steamID; steam_id m_steamID;
}; };
class matchmaking_ping_response
{
public:
virtual void ServerResponded(gameserveritem_t& server) = 0;
virtual void ServerFailedToRespond() = 0;
};
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 matchmaking_servers class matchmaking_servers
{ {
public: public:
@ -55,7 +62,8 @@ namespace steam
virtual void* RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters, virtual void* RequestInternetServerList(unsigned int iApp, void** ppchFilters, unsigned int nFilters,
matchmaking_server_list_response* pRequestServersResponse); matchmaking_server_list_response* pRequestServersResponse);
virtual void* RequestLANServerList(unsigned int iApp, matchmaking_server_list_response* 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,
matchmaking_server_list_response* 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,
@ -71,7 +79,7 @@ namespace steam
virtual bool IsRefreshing(void* hRequest); virtual bool IsRefreshing(void* hRequest);
virtual int GetServerCount(void* hRequest); virtual int GetServerCount(void* hRequest);
virtual void RefreshServer(void* hRequest, int iServer); virtual void RefreshServer(void* hRequest, int iServer);
virtual int PingServer(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse); virtual void* PingServer(unsigned int unIP, unsigned short usPort, matchmaking_ping_response* pRequestServersResponse);
virtual int PlayerDetails(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse); virtual int PlayerDetails(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse);
virtual int ServerRules(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse); virtual int ServerRules(unsigned int unIP, unsigned short usPort, void* pRequestServersResponse);
virtual void CancelServerQuery(int hServerQuery); virtual void CancelServerQuery(int hServerQuery);