mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 12:28:07 +01:00
Fix some major issues (networking didn't work, gameservers didn't work) with the steamclient version.
Implemented a basic steampipe alloc system and fixed build.
This commit is contained in:
parent
4e6aa809de
commit
11cb3ce998
7 changed files with 147 additions and 66 deletions
|
@ -2,9 +2,6 @@
|
|||
#define CLIENT_HSTEAMUSER 12
|
||||
#define SERVER_HSTEAMUSER 13
|
||||
|
||||
#define CLIENT_STEAM_PIPE 5
|
||||
#define SERVER_STEAM_PIPE 6
|
||||
|
||||
#define DEFAULT_NAME "Goldberg"
|
||||
#define PROGRAM_NAME "Goldberg SteamEmu"
|
||||
#define DEFAULT_LANGUAGE "english"
|
||||
|
|
69
dll/dll.cpp
69
dll/dll.cpp
|
@ -15,6 +15,7 @@
|
|||
License along with the Goldberg Emulator; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define STEAM_API_FUNCTIONS_IMPL
|
||||
#include "dll.h"
|
||||
|
||||
|
||||
|
@ -203,14 +204,17 @@ STEAMAPI_API void * S_CALLTYPE SteamInternal_ContextInit( void *pContextInitData
|
|||
//steam_api.h
|
||||
// SteamAPI_Init must be called before using any other API functions. If it fails, an
|
||||
// error message will be output to the debugger (or stderr) with further information.
|
||||
static HSteamPipe user_steam_pipe;
|
||||
STEAMAPI_API bool S_CALLTYPE SteamAPI_Init()
|
||||
{
|
||||
PRINT_DEBUG("SteamAPI_Init called\n");
|
||||
if (user_steam_pipe) return true;
|
||||
#ifdef EMU_EXPERIMENTAL_BUILD
|
||||
crack_SteamAPI_Init();
|
||||
#endif
|
||||
load_old_interface_versions();
|
||||
get_steam_client()->userLogIn();
|
||||
user_steam_pipe = get_steam_client()->CreateSteamPipe();
|
||||
get_steam_client()->ConnectToGlobalUser(user_steam_pipe);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -226,6 +230,8 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_Shutdown()
|
|||
{
|
||||
PRINT_DEBUG("SteamAPI_Shutdown\n");
|
||||
get_steam_client()->clientShutdown();
|
||||
get_steam_client()->BReleaseSteamPipe(user_steam_pipe);
|
||||
user_steam_pipe = 0;
|
||||
}
|
||||
|
||||
// SteamAPI_RestartAppIfNecessary ensures that your executable was launched through Steam.
|
||||
|
@ -416,8 +422,7 @@ STEAMAPI_API const char *SteamAPI_GetSteamInstallPath()
|
|||
STEAMAPI_API HSteamPipe SteamAPI_GetHSteamPipe()
|
||||
{
|
||||
PRINT_DEBUG("SteamAPI_GetHSteamPipe\n");
|
||||
if (!get_steam_client()->user_logged_in) return 0;
|
||||
return CLIENT_STEAM_PIPE;
|
||||
return user_steam_pipe;
|
||||
}
|
||||
|
||||
// sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks
|
||||
|
@ -484,11 +489,11 @@ STEAMAPI_API void * S_CALLTYPE SteamGameServerInternal_CreateInterface( const ch
|
|||
return SteamInternal_CreateInterface(ver);
|
||||
}
|
||||
|
||||
static HSteamPipe server_steam_pipe;
|
||||
STEAMAPI_API HSteamPipe S_CALLTYPE SteamGameServer_GetHSteamPipe()
|
||||
{
|
||||
PRINT_DEBUG("SteamGameServer_GetHSteamPipe\n");
|
||||
if (!get_steam_client()->server_init) return 0;
|
||||
return SERVER_STEAM_PIPE;
|
||||
return server_steam_pipe;
|
||||
}
|
||||
|
||||
STEAMAPI_API HSteamUser S_CALLTYPE SteamGameServer_GetHSteamUser()
|
||||
|
@ -533,10 +538,12 @@ STEAMAPI_API bool S_CALLTYPE SteamInternal_GameServer_Init( uint32 unIP, uint16
|
|||
{
|
||||
PRINT_DEBUG("SteamInternal_GameServer_Init %u %hu %hu %hu %u %s\n", unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString);
|
||||
load_old_interface_versions();
|
||||
get_steam_client()->serverInit();
|
||||
get_steam_client()->CreateLocalUser(&server_steam_pipe, k_EAccountTypeGameServer);
|
||||
//g_pSteamClientGameServer is only used in pre 1.37 (where the interface versions are not provided by the game)
|
||||
g_pSteamClientGameServer = SteamGameServerClient();
|
||||
return get_steam_client()->steam_gameserver->InitGameServer(unIP, usGamePort, usQueryPort, eServerMode, 0, pchVersionString);
|
||||
uint32 unFlags = 0;
|
||||
if (eServerMode == eServerModeAuthenticationAndSecure) unFlags = k_unServerFlagSecure;
|
||||
return get_steam_client()->steam_gameserver->InitGameServer(unIP, usGamePort, usQueryPort, unFlags, 0, pchVersionString);
|
||||
}
|
||||
|
||||
//SteamGameServer004 and before:
|
||||
|
@ -575,7 +582,9 @@ STEAMAPI_API bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16
|
|||
STEAMAPI_API void SteamGameServer_Shutdown()
|
||||
{
|
||||
PRINT_DEBUG("SteamGameServer_Shutdown\n");
|
||||
get_steam_clientserver_old()->serverShutdown();
|
||||
get_steam_client()->serverShutdown();
|
||||
get_steam_client()->BReleaseSteamPipe(server_steam_pipe);
|
||||
server_steam_pipe = 0;
|
||||
g_pSteamClientGameServer = NULL; //TODO: check if this actually gets nulled when SteamGameServer_Shutdown is called
|
||||
}
|
||||
|
||||
|
@ -752,15 +761,26 @@ STEAMCLIENT_API bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMsg_t *p
|
|||
PRINT_DEBUG("%s %i\n", __FUNCTION__, hSteamPipe);
|
||||
std::queue<struct cb_data> *q = NULL;
|
||||
HSteamUser m_hSteamUser = 0;
|
||||
get_steam_client()->callback_results_server->setCbAll(&cb_add_queue_server);
|
||||
get_steam_client()->callback_results_client->setCbAll(&cb_add_queue_client);
|
||||
get_steam_client()->RunCallbacks(true, true);
|
||||
if (hSteamPipe == SERVER_STEAM_PIPE) {
|
||||
Steam_Client *steam_client = get_steam_client();
|
||||
steam_client->callback_results_server->setCbAll(&cb_add_queue_server);
|
||||
steam_client->callback_results_client->setCbAll(&cb_add_queue_client);
|
||||
steam_client->RunCallbacks(true, true);
|
||||
if (!steam_client->steamclient_server_inited) {
|
||||
while(!server_cb.empty()) server_cb.pop();
|
||||
}
|
||||
|
||||
if (!steam_client->steam_pipes.count(hSteamPipe)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (steam_client->steam_pipes[hSteamPipe] == Steam_Pipe::SERVER) {
|
||||
q = &server_cb;
|
||||
m_hSteamUser = SERVER_HSTEAMUSER;
|
||||
} else {
|
||||
} else if (steam_client->steam_pipes[hSteamPipe] == Steam_Pipe::CLIENT) {
|
||||
q = &client_cb;
|
||||
m_hSteamUser = CLIENT_HSTEAMUSER;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (q->empty()) return false;
|
||||
|
@ -780,10 +800,17 @@ STEAMCLIENT_API void Steam_FreeLastCallback( HSteamPipe hSteamPipe )
|
|||
{
|
||||
PRINT_DEBUG("%s %i\n", __FUNCTION__, hSteamPipe);
|
||||
std::queue<struct cb_data> *q = NULL;
|
||||
if (hSteamPipe == SERVER_STEAM_PIPE) {
|
||||
Steam_Client *steam_client = get_steam_client();
|
||||
if (!steam_client->steam_pipes.count(hSteamPipe)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (steam_client->steam_pipes[hSteamPipe] == Steam_Pipe::SERVER) {
|
||||
q = &server_cb;
|
||||
} else {
|
||||
} else if (steam_client->steam_pipes[hSteamPipe] == Steam_Pipe::CLIENT) {
|
||||
q = &client_cb;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!q->empty()) q->pop();
|
||||
|
@ -792,11 +819,17 @@ STEAMCLIENT_API void Steam_FreeLastCallback( HSteamPipe hSteamPipe )
|
|||
STEAMCLIENT_API bool Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed )
|
||||
{
|
||||
PRINT_DEBUG("Steam_GetAPICallResult %i %llu %i %i\n", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected);
|
||||
if (!hSteamPipe) return false;
|
||||
if (hSteamPipe == SERVER_STEAM_PIPE) {
|
||||
Steam_Client *steam_client = get_steam_client();
|
||||
if (!steam_client->steam_pipes.count(hSteamPipe)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (steam_client->steam_pipes[hSteamPipe] == Steam_Pipe::SERVER) {
|
||||
return get_steam_client()->steam_gameserver_utils->GetAPICallResult(hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
} else {
|
||||
} else if (steam_client->steam_pipes[hSteamPipe] == Steam_Pipe::CLIENT) {
|
||||
return get_steam_client()->steam_utils->GetAPICallResult(hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,15 +159,24 @@ void Steam_Client::setAppID(uint32 appid)
|
|||
HSteamPipe Steam_Client::CreateSteamPipe()
|
||||
{
|
||||
PRINT_DEBUG("CreateSteamPipe\n");
|
||||
return CLIENT_STEAM_PIPE;
|
||||
HSteamPipe pipe = steam_pipe_counter++;
|
||||
PRINT_DEBUG("creating pipe %i\n", pipe);
|
||||
|
||||
steam_pipes[pipe] = Steam_Pipe::NO_USER;
|
||||
return pipe;
|
||||
}
|
||||
|
||||
// Releases a previously created communications pipe
|
||||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
bool Steam_Client::BReleaseSteamPipe( HSteamPipe hSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG("BReleaseSteamPipe\n");
|
||||
PRINT_DEBUG("BReleaseSteamPipe %i\n", hSteamPipe);
|
||||
if (steam_pipes.count(hSteamPipe)) {
|
||||
steam_pipes.erase(hSteamPipe);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// connects to an existing global user, failing if none exists
|
||||
|
@ -175,7 +184,13 @@ bool Steam_Client::BReleaseSteamPipe( HSteamPipe hSteamPipe )
|
|||
// NOT THREADSAFE - ensure that no other threads are accessing Steamworks API when calling
|
||||
HSteamUser Steam_Client::ConnectToGlobalUser( HSteamPipe hSteamPipe )
|
||||
{
|
||||
PRINT_DEBUG("ConnectToGlobalUser\n");
|
||||
PRINT_DEBUG("ConnectToGlobalUser %i\n", hSteamPipe);
|
||||
if (!steam_pipes.count(hSteamPipe)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
userLogIn();
|
||||
steam_pipes[hSteamPipe] = Steam_Pipe::CLIENT;
|
||||
return CLIENT_HSTEAMUSER;
|
||||
}
|
||||
|
||||
|
@ -184,13 +199,19 @@ HSteamUser Steam_Client::ConnectToGlobalUser( HSteamPipe hSteamPipe )
|
|||
HSteamUser Steam_Client::CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType )
|
||||
{
|
||||
PRINT_DEBUG("CreateLocalUser %p %i\n", phSteamPipe, eAccountType);
|
||||
if (eAccountType == k_EAccountTypeIndividual) {
|
||||
if (phSteamPipe) *phSteamPipe = CLIENT_STEAM_PIPE;
|
||||
return CLIENT_HSTEAMUSER;
|
||||
} else {
|
||||
if (phSteamPipe) *phSteamPipe = SERVER_STEAM_PIPE;
|
||||
//if (eAccountType == k_EAccountTypeIndividual) {
|
||||
//Is this actually used?
|
||||
//if (phSteamPipe) *phSteamPipe = CLIENT_STEAM_PIPE;
|
||||
//return CLIENT_HSTEAMUSER;
|
||||
//} else { //k_EAccountTypeGameServer
|
||||
serverInit();
|
||||
|
||||
HSteamPipe pipe = CreateSteamPipe();
|
||||
if (phSteamPipe) *phSteamPipe = pipe;
|
||||
steam_pipes[pipe] = Steam_Pipe::SERVER;
|
||||
steamclient_server_inited = true;
|
||||
return SERVER_HSTEAMUSER;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
HSteamUser Steam_Client::CreateLocalUser( HSteamPipe *phSteamPipe )
|
||||
|
@ -203,13 +224,16 @@ HSteamUser Steam_Client::CreateLocalUser( HSteamPipe *phSteamPipe )
|
|||
void Steam_Client::ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser )
|
||||
{
|
||||
PRINT_DEBUG("ReleaseUser\n");
|
||||
if (hUser == SERVER_HSTEAMUSER && steam_pipes.count(hSteamPipe)) {
|
||||
steamclient_server_inited = false;
|
||||
}
|
||||
}
|
||||
|
||||
// retrieves the ISteamUser interface associated with the handle
|
||||
ISteamUser *Steam_Client::GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamUser %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "SteamUser009") == 0) {
|
||||
return (ISteamUser *)(void *)(ISteamUser009 *)steam_user;
|
||||
|
@ -246,7 +270,7 @@ ISteamUser *Steam_Client::GetISteamUser( HSteamUser hSteamUser, HSteamPipe hStea
|
|||
ISteamGameServer *Steam_Client::GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamGameServer %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "SteamGameServer005") == 0) {
|
||||
return (ISteamGameServer *)(void *)(ISteamGameServer005 *)steam_gameserver;
|
||||
|
@ -289,7 +313,7 @@ void Steam_Client::SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPor
|
|||
ISteamFriends *Steam_Client::GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamFriends %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "SteamFriends004") == 0) {
|
||||
return (ISteamFriends *)(void *)(ISteamFriends004 *)steam_friends;
|
||||
|
@ -330,11 +354,11 @@ ISteamFriends *Steam_Client::GetISteamFriends( HSteamUser hSteamUser, HSteamPipe
|
|||
ISteamUtils *Steam_Client::GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamUtils %s\n", pchVersion);
|
||||
if (!hSteamPipe) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe)) return NULL;
|
||||
|
||||
Steam_Utils *steam_utils_temp;
|
||||
|
||||
if (hSteamPipe == SERVER_STEAM_PIPE) {
|
||||
if (steam_pipes[hSteamPipe] == Steam_Pipe::SERVER) {
|
||||
steam_utils_temp = steam_gameserver_utils;
|
||||
} else {
|
||||
steam_utils_temp = steam_utils;
|
||||
|
@ -367,7 +391,7 @@ ISteamUtils *Steam_Client::GetISteamUtils( HSteamPipe hSteamPipe, const char *pc
|
|||
ISteamMatchmaking *Steam_Client::GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamMatchmaking %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "SteamMatchMaking001") == 0) {
|
||||
//TODO
|
||||
|
@ -404,7 +428,7 @@ ISteamMatchmaking *Steam_Client::GetISteamMatchmaking( HSteamUser hSteamUser, HS
|
|||
ISteamMatchmakingServers *Steam_Client::GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamMatchmakingServers %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
return steam_matchmaking_servers;
|
||||
}
|
||||
|
||||
|
@ -412,7 +436,7 @@ ISteamMatchmakingServers *Steam_Client::GetISteamMatchmakingServers( HSteamUser
|
|||
void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamGenericInterface %s\n", pchVersion);
|
||||
if (!hSteamPipe) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe)) return NULL;
|
||||
|
||||
bool server = false;
|
||||
if (hSteamUser == SERVER_HSTEAMUSER) {
|
||||
|
@ -541,7 +565,7 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
|
|||
ISteamUserStats *Steam_Client::GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamUserStats %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "STEAMUSERSTATS_INTERFACE_VERSION001") == 0) {
|
||||
//TODO
|
||||
|
@ -578,7 +602,7 @@ ISteamUserStats *Steam_Client::GetISteamUserStats( HSteamUser hSteamUser, HSteam
|
|||
ISteamGameServerStats *Steam_Client::GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamGameServerStats %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_gameserverstats;
|
||||
}
|
||||
|
||||
|
@ -586,7 +610,7 @@ ISteamGameServerStats *Steam_Client::GetISteamGameServerStats( HSteamUser hSteam
|
|||
ISteamApps *Steam_Client::GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamApps %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
if (hSteamUser == SERVER_HSTEAMUSER) {
|
||||
return steam_gameserver_apps;
|
||||
}
|
||||
|
@ -598,7 +622,7 @@ ISteamApps *Steam_Client::GetISteamApps( HSteamUser hSteamUser, HSteamPipe hStea
|
|||
ISteamNetworking *Steam_Client::GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamNetworking %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
Steam_Networking *steam_networking_temp;
|
||||
|
||||
|
@ -631,7 +655,7 @@ ISteamNetworking *Steam_Client::GetISteamNetworking( HSteamUser hSteamUser, HSte
|
|||
ISteamRemoteStorage *Steam_Client::GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamRemoteStorage %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION001") == 0) {
|
||||
return (ISteamRemoteStorage *)(void *)(ISteamRemoteStorage001 *)steam_remote_storage;
|
||||
|
@ -672,7 +696,7 @@ ISteamRemoteStorage *Steam_Client::GetISteamRemoteStorage( HSteamUser hSteamuser
|
|||
ISteamScreenshots *Steam_Client::GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamScreenshots %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_screenshots;
|
||||
}
|
||||
|
||||
|
@ -714,7 +738,7 @@ bool Steam_Client::BShutdownIfAllPipesClosed()
|
|||
ISteamHTTP *Steam_Client::GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamHTTP %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
if (hSteamuser == SERVER_HSTEAMUSER) {
|
||||
return steam_gameserver_http;
|
||||
}
|
||||
|
@ -726,14 +750,14 @@ ISteamHTTP *Steam_Client::GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hStea
|
|||
void *Steam_Client::DEPRECATED_GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("DEPRECATED_GetISteamUnifiedMessages %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return (void *)(ISteamUnifiedMessages *)steam_unified_messages;
|
||||
}
|
||||
|
||||
ISteamUnifiedMessages *Steam_Client::GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamUnifiedMessages %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_unified_messages;
|
||||
}
|
||||
|
||||
|
@ -741,7 +765,7 @@ ISteamUnifiedMessages *Steam_Client::GetISteamUnifiedMessages( HSteamUser hSteam
|
|||
ISteamController *Steam_Client::GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamController %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "STEAMCONTROLLER_INTERFACE_VERSION") == 0) {
|
||||
return (ISteamController *)(void *)(ISteamController001 *)steam_controller;
|
||||
|
@ -769,7 +793,7 @@ ISteamController *Steam_Client::GetISteamController( HSteamUser hSteamUser, HSte
|
|||
ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamUGC %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
Steam_UGC *steam_ugc_temp;
|
||||
|
||||
if (hSteamUser == SERVER_HSTEAMUSER) {
|
||||
|
@ -821,7 +845,7 @@ ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamP
|
|||
ISteamAppList *Steam_Client::GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamAppList %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
return steam_applist;
|
||||
}
|
||||
|
||||
|
@ -829,7 +853,7 @@ ISteamAppList *Steam_Client::GetISteamAppList( HSteamUser hSteamUser, HSteamPipe
|
|||
ISteamMusic *Steam_Client::GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamMusic %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_music;
|
||||
}
|
||||
|
||||
|
@ -837,7 +861,7 @@ ISteamMusic *Steam_Client::GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSt
|
|||
ISteamMusicRemote *Steam_Client::GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion)
|
||||
{
|
||||
PRINT_DEBUG("GetISteamMusicRemote %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_musicremote;
|
||||
}
|
||||
|
||||
|
@ -845,7 +869,7 @@ ISteamMusicRemote *Steam_Client::GetISteamMusicRemote(HSteamUser hSteamuser, HSt
|
|||
ISteamHTMLSurface *Steam_Client::GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion)
|
||||
{
|
||||
PRINT_DEBUG("GetISteamHTMLSurface %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
|
||||
if (strcmp(pchVersion, "STEAMHTMLSURFACE_INTERFACE_VERSION_001") == 0) {
|
||||
return (ISteamHTMLSurface *)(void *)(ISteamHTMLSurface001 *)steam_HTMLsurface;
|
||||
|
@ -894,7 +918,7 @@ void Steam_Client::Remove_SteamAPI_CPostAPIResultInProcess( SteamAPI_PostAPIResu
|
|||
ISteamInventory *Steam_Client::GetISteamInventory( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamInventory %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
Steam_Inventory *steam_inventory_temp;
|
||||
Settings *settings_temp;
|
||||
SteamCallBacks *callbacks_temp;
|
||||
|
@ -923,7 +947,7 @@ ISteamInventory *Steam_Client::GetISteamInventory( HSteamUser hSteamuser, HSteam
|
|||
ISteamVideo *Steam_Client::GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamVideo %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_video;
|
||||
}
|
||||
|
||||
|
@ -931,21 +955,21 @@ ISteamVideo *Steam_Client::GetISteamVideo( HSteamUser hSteamuser, HSteamPipe hSt
|
|||
ISteamParentalSettings *Steam_Client::GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamParentalSettings %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
return steam_parental;
|
||||
}
|
||||
|
||||
ISteamMasterServerUpdater *Steam_Client::GetISteamMasterServerUpdater( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamMasterServerUpdater %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
return steam_masterserver_updater;
|
||||
}
|
||||
|
||||
ISteamContentServer *Steam_Client::GetISteamContentServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamContentServer %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -953,7 +977,7 @@ ISteamContentServer *Steam_Client::GetISteamContentServer( HSteamUser hSteamUser
|
|||
ISteamGameSearch *Steam_Client::GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamGameSearch %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamuser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamuser) return NULL;
|
||||
|
||||
return steam_game_search;
|
||||
}
|
||||
|
@ -962,7 +986,7 @@ ISteamGameSearch *Steam_Client::GetISteamGameSearch( HSteamUser hSteamuser, HSte
|
|||
ISteamInput *Steam_Client::GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamInput %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
return steam_controller;
|
||||
}
|
||||
|
@ -971,7 +995,7 @@ ISteamInput *Steam_Client::GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSt
|
|||
ISteamParties *Steam_Client::GetISteamParties( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamParties %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
return steam_parties;
|
||||
}
|
||||
|
@ -979,7 +1003,7 @@ ISteamParties *Steam_Client::GetISteamParties( HSteamUser hSteamUser, HSteamPipe
|
|||
ISteamRemotePlay *Steam_Client::GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
|
||||
{
|
||||
PRINT_DEBUG("GetISteamRemotePlay %s\n", pchVersion);
|
||||
if (!hSteamPipe || !hSteamUser) return NULL;
|
||||
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL;
|
||||
|
||||
return steam_remoteplay;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
|
||||
#include <thread>
|
||||
|
||||
enum Steam_Pipe {
|
||||
NO_USER,
|
||||
CLIENT,
|
||||
SERVER
|
||||
};
|
||||
|
||||
class Steam_Client :
|
||||
public ISteamClient007,
|
||||
public ISteamClient008,
|
||||
|
@ -124,6 +130,10 @@ public:
|
|||
bool user_logged_in = false;
|
||||
bool server_init = false;
|
||||
std::thread background_keepalive;
|
||||
bool steamclient_server_inited = false;
|
||||
|
||||
unsigned steam_pipe_counter = 2;
|
||||
std::map<HSteamPipe, enum Steam_Pipe> steam_pipes;
|
||||
|
||||
Steam_Client();
|
||||
~Steam_Client();
|
||||
|
|
|
@ -177,7 +177,7 @@ bool Steam_GameServer::BSecure()
|
|||
PRINT_DEBUG("BSecure\n");
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
if (!policy_response_called) return false;
|
||||
return flags == eServerModeAuthenticationAndSecure;
|
||||
return !!(flags & k_unServerFlagSecure);
|
||||
}
|
||||
|
||||
CSteamID Steam_GameServer::GetSteamID()
|
||||
|
@ -414,6 +414,7 @@ bool Steam_GameServer::BSetServerType( uint32 unServerFlags, uint32 unGameIP, ui
|
|||
version.erase(std::remove(version.begin(), version.end(), ' '), version.end());
|
||||
version.erase(std::remove(version.begin(), version.end(), '.'), version.end());
|
||||
server_data.set_version(stoi(version));
|
||||
flags = unServerFlags;
|
||||
|
||||
//TODO?
|
||||
return true;
|
||||
|
@ -662,7 +663,7 @@ void Steam_GameServer::RunCallbacks()
|
|||
if (logged_in && !policy_response_called) {
|
||||
PRINT_DEBUG("Steam_GameServer::GSPolicyResponse_t\n");
|
||||
GSPolicyResponse_t data;
|
||||
data.m_bSecure = flags == eServerModeAuthenticationAndSecure;
|
||||
data.m_bSecure = !!(flags & k_unServerFlagSecure);
|
||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), 0.11);
|
||||
policy_response_called = true;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ APP_NAME="bin/test_executable"
|
|||
APP_ID=480
|
||||
APP_PATH=$(dirname "$0")
|
||||
CONFIG_PATH=$(dirname "$0")
|
||||
#path to steam-runtime/run.sh
|
||||
STEAM_RUNTIME=""
|
||||
|
||||
CUR_DIR=$(pwd)
|
||||
cd "$CONFIG_PATH"
|
||||
|
@ -17,7 +19,13 @@ cp x86/steamclient.so ~/.steam/sdk32/steamclient.so
|
|||
cp x86_64/steamclient.so ~/.steam/sdk64/steamclient.so
|
||||
echo $BASHPID > ~/.steam/steam.pid
|
||||
cd "$APP_PATH"
|
||||
if [ -z "$STEAM_RUNTIME" ]
|
||||
then
|
||||
SteamAppPath="$APP_PATH" SteamAppId=$APP_ID SteamGameId=$APP_ID "$APP_NAME"
|
||||
else
|
||||
SteamAppPath="$APP_PATH" SteamAppId=$APP_ID SteamGameId=$APP_ID "$STEAM_RUNTIME" "$APP_NAME"
|
||||
fi
|
||||
|
||||
cd "$CUR_DIR"
|
||||
#restore original
|
||||
rm -f ~/.steam/steam.pid
|
||||
|
|
|
@ -39,11 +39,19 @@
|
|||
#endif // STEAM_API_EXPORTS
|
||||
#endif
|
||||
|
||||
#ifdef STEAM_API_EXPORTS
|
||||
#ifdef STEAM_API_FUNCTIONS_IMPL
|
||||
#ifdef STEAMCLIENT_DLL
|
||||
#define S_API static
|
||||
#else
|
||||
#define S_API S_API_EXPORT
|
||||
#endif
|
||||
#else
|
||||
#define S_API
|
||||
#endif
|
||||
#else
|
||||
#define S_API S_API_EXPORT
|
||||
#endif
|
||||
|
||||
#if ( defined(STEAM_API_EXPORTS) || defined(STEAM_API_NODLL) ) && !defined(API_GEN)
|
||||
#define STEAM_PRIVATE_API( ... ) __VA_ARGS__
|
||||
|
|
Loading…
Reference in a new issue