Implementing overlay into existing code.

merge-requests/28/head
Nemirtingas 2019-07-25 23:33:28 +02:00
parent bf9d85755c
commit a60a106daf
5 changed files with 34 additions and 18 deletions

View File

@ -200,7 +200,11 @@ S_API bool S_CALLTYPE SteamAPI_Init()
crack_SteamAPI_Init();
#endif
load_old_interface_versions();
get_steam_client()->userLogIn();
Steam_Client* client = get_steam_client();
client->userLogIn();
client->steam_overlay->SetupOverlay();
return true;
}

View File

@ -303,9 +303,12 @@ Steam_Client::Steam_Client()
PRINT_DEBUG("steam client init: id: %llu server id: %llu appid: %u port: %u \n", user_id.ConvertToUint64(), settings_server->get_local_steam_id().ConvertToUint64(), appid, port);
steam_overlay = new Steam_Overlay(settings_client, callback_results_client, callbacks_client, run_every_runcb);
steam_user = new Steam_User(settings_client, local_storage, network, callback_results_client, callbacks_client);
steam_friends = new Steam_Friends(settings_client, network, callback_results_client, callbacks_client, run_every_runcb);
steam_utils = new Steam_Utils(settings_client, callback_results_client);
steam_friends = new Steam_Friends(settings_client, network, callback_results_client, callbacks_client, run_every_runcb, steam_overlay);
steam_utils = new Steam_Utils(settings_client, callback_results_client, steam_overlay);
steam_matchmaking = new Steam_Matchmaking(settings_client, network, callback_results_client, callbacks_client, run_every_runcb);
steam_matchmaking_servers = new Steam_Matchmaking_Servers(settings_client, network);
steam_user_stats = new Steam_User_Stats(settings_client, local_storage, callback_results_client, callbacks_client);
@ -333,7 +336,7 @@ Steam_Client::Steam_Client()
PRINT_DEBUG("client init gameserver\n");
steam_gameserver = new Steam_GameServer(settings_server, network, callbacks_server);
steam_gameserver_utils = new Steam_Utils(settings_server, callback_results_server);
steam_gameserver_utils = new Steam_Utils(settings_server, callback_results_server, steam_overlay);
steam_gameserverstats = new Steam_GameServerStats(settings_server, network, callback_results_server, callbacks_server);
steam_gameserver_networking = new Steam_Networking(settings_server, network, callbacks_server, run_every_runcb);
steam_gameserver_http = new Steam_HTTP(settings_server, network, callback_results_server, callbacks_server);

View File

@ -48,6 +48,8 @@
#include "steam_gameserverstats.h"
#include "steam_masterserver_updater.h"
#include "../overlay_experimental/steam_overlay.h"
#include <thread>
class Steam_Client :
@ -113,6 +115,8 @@ public:
Steam_Game_Coordinator *steam_gameserver_game_coordinator;
Steam_Masterserver_Updater *steam_masterserver_updater;
Steam_Overlay* steam_overlay;
bool user_logged_in = false;
bool server_init = false;
std::thread background_keepalive;

View File

@ -40,6 +40,7 @@ public ISteamFriends
class SteamCallBacks *callbacks;
class SteamCallResults *callback_results;
class RunEveryRunCB *run_every_runcb;
class Steam_Overlay* overlay;
Friend us;
bool modified;
@ -99,13 +100,14 @@ static void steam_friends_run_every_runcb(void *object)
steam_friends->RunCallbacks();
}
Steam_Friends(class Settings *settings, class Networking *network, class SteamCallResults *callback_results, class SteamCallBacks *callbacks, class RunEveryRunCB *run_every_runcb)
Steam_Friends(Settings* settings, Networking* network, SteamCallResults* callback_results, SteamCallBacks* callbacks, RunEveryRunCB* run_every_runcb, Steam_Overlay* overlay):
settings(settings),
network(network),
callbacks(callbacks),
callback_results(callback_results),
run_every_runcb(run_every_runcb),
overlay(overlay)
{
this->settings = settings;
this->network = network;
this->callbacks = callbacks;
this->callback_results = callback_results;
this->run_every_runcb = run_every_runcb;
this->network->setCallback(CALLBACK_ID_FRIEND, settings->get_local_steam_id(), &Steam_Friends::steam_friends_callback, this);
this->network->setCallback(CALLBACK_ID_FRIEND_MESSAGES, settings->get_local_steam_id(), &Steam_Friends::steam_friends_callback, this);
this->network->setCallback(CALLBACK_ID_USER_STATUS, settings->get_local_steam_id(), &Steam_Friends::steam_friends_callback, this);

View File

@ -17,6 +17,7 @@
#include "base.h"
#include "local_storage.h"
#include "../overlay_experimental/steam_overlay.h"
static std::chrono::time_point<std::chrono::steady_clock> app_initialized_time = std::chrono::steady_clock::now();
@ -34,13 +35,14 @@ public ISteamUtils
private:
Settings *settings;
class SteamCallResults *callback_results;
Steam_Overlay* overlay;
public:
Steam_Utils(Settings *settings, class SteamCallResults *callback_results)
{
this->settings = settings;
this->callback_results = callback_results;
}
Steam_Utils(Settings *settings, class SteamCallResults *callback_results, Steam_Overlay *overlay):
settings(settings),
callback_results(callback_results),
overlay(overlay)
{}
// return the number of seconds since the user
uint32 GetSecondsSinceAppActive()
@ -144,6 +146,7 @@ uint32 GetAppID()
void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition )
{
PRINT_DEBUG("SetOverlayNotificationPosition\n");
overlay->SetNotificationPosition(eNotificationPosition);
}
@ -218,8 +221,7 @@ void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction )
bool IsOverlayEnabled()
{
PRINT_DEBUG("IsOverlayEnabled\n");
//TODO
return false;
return overlay->Ready();
}
@ -235,7 +237,7 @@ bool IsOverlayEnabled()
bool BOverlayNeedsPresent()
{
PRINT_DEBUG("BOverlayNeedsPresent\n");
return false;
return overlay->NeedPresent();
}
@ -305,6 +307,7 @@ bool IsSteamRunningInVR()
void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset )
{
PRINT_DEBUG("SetOverlayNotificationInset\n");
overlay->SetNotificationInset(nHorizontalInset, nVerticalInset);
}