diff --git a/dll/dll/steam_app_disable_update.h b/dll/dll/steam_app_disable_update.h new file mode 100644 index 00000000..e9267568 --- /dev/null +++ b/dll/dll/steam_app_disable_update.h @@ -0,0 +1,47 @@ +/* Copyright (C) 2019 Mr Goldberg + This file is part of the Goldberg Emulator + + The Goldberg Emulator is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The Goldberg Emulator is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the Goldberg Emulator; if not, see + . */ + +#ifndef __INCLUDED_STEAM_APP_DISABLE_UPDATE_H__ +#define __INCLUDED_STEAM_APP_DISABLE_UPDATE_H__ + +#include "base.h" + +class Steam_App_Disable_Update: +public ISteamAppDisableUpdate +{ + class Settings *settings{}; + class Networking *network{}; + class SteamCallResults *callback_results{}; + class SteamCallBacks *callbacks{}; + class RunEveryRunCB *run_every_runcb{}; + + static void steam_network_callback(void *object, Common_Message *msg); + static void steam_run_every_runcb(void *object); + + void steam_run_callback(); + void network_callback(Common_Message *msg); + +public: + Steam_App_Disable_Update(class Settings *settings, class Networking *network, class SteamCallResults *callback_results, class SteamCallBacks *callbacks, class RunEveryRunCB *run_every_runcb); + ~Steam_App_Disable_Update(); + + // probably means how many seconds to keep the updates disabled + void SetAppUpdateDisabledSecondsRemaining(int32 nSeconds); + +}; + +#endif // __INCLUDED_STEAM_APP_DISABLE_UPDATE_H__ diff --git a/dll/dll/steam_client.h b/dll/dll/steam_client.h index 1e2f37cd..93f53584 100644 --- a/dll/dll/steam_client.h +++ b/dll/dll/steam_client.h @@ -56,6 +56,7 @@ #include "steam_gameserverstats.h" #include "steam_gamestats.h" #include "steam_timeline.h" +#include "steam_app_disable_update.h" #include "steam_masterserver_updater.h" #include "overlay/steam_overlay.h" @@ -140,6 +141,7 @@ public: Steam_TV *steam_tv{}; Steam_GameStats *steam_gamestats{}; Steam_Timeline *steam_timeline{}; + Steam_App_Disable_Update *steam_app_disable_update{}; Steam_GameServer *steam_gameserver{}; Steam_Utils *steam_gameserver_utils{}; @@ -243,6 +245,9 @@ public: // steam timeline ISteamTimeline *GetISteamTimeline( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ); + // steam appp disable update + ISteamAppDisableUpdate *GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ); + // Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead. STEAM_PRIVATE_API( void RunFrame() ); diff --git a/dll/steam_app_disable_update.cpp b/dll/steam_app_disable_update.cpp new file mode 100644 index 00000000..1bcf37d3 --- /dev/null +++ b/dll/steam_app_disable_update.cpp @@ -0,0 +1,88 @@ +/* Copyright (C) 2019 Mr Goldberg + This file is part of the Goldberg Emulator + + The Goldberg Emulator is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The Goldberg Emulator is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the Goldberg Emulator; if not, see + . */ + +#include "dll/steam_app_disable_update.h" + + +void Steam_App_Disable_Update::steam_run_every_runcb(void *object) +{ + // PRINT_DEBUG_ENTRY(); + + auto inst = (Steam_App_Disable_Update *)object; + inst->steam_run_callback(); +} + +void Steam_App_Disable_Update::steam_network_callback(void *object, Common_Message *msg) +{ + // PRINT_DEBUG_ENTRY(); + + auto inst = (Steam_App_Disable_Update *)object; + inst->network_callback(msg); +} + + + +Steam_App_Disable_Update::Steam_App_Disable_Update(class Settings *settings, class Networking *network, class SteamCallResults *callback_results, class SteamCallBacks *callbacks, class RunEveryRunCB *run_every_runcb) +{ + this->settings = settings; + this->network = network; + this->callback_results = callback_results; + this->callbacks = callbacks; + this->run_every_runcb = run_every_runcb; + + // this->network->setCallback(CALLBACK_ID_USER_STATUS, settings->get_local_steam_id(), &Steam_App_Disable_Update::steam_network_callback, this); + // this->run_every_runcb->add(&Steam_App_Disable_Update::steam_run_every_runcb, this); +} + +Steam_App_Disable_Update::~Steam_App_Disable_Update() +{ + // this->network->rmCallback(CALLBACK_ID_USER_STATUS, settings->get_local_steam_id(), &Steam_App_Disable_Update::steam_network_callback, this); + // this->run_every_runcb->remove(&Steam_App_Disable_Update::steam_run_every_runcb, this); +} + + +void Steam_App_Disable_Update::SetAppUpdateDisabledSecondsRemaining(int32 nSeconds) +{ + PRINT_DEBUG_TODO(); + std::lock_guard lock(global_mutex); + +} + + + +void Steam_App_Disable_Update::steam_run_callback() +{ +} + + + +void Steam_App_Disable_Update::network_callback(Common_Message *msg) +{ + if (msg->has_low_level()) { + if (msg->low_level().type() == Low_Level::CONNECT) { + + } + + if (msg->low_level().type() == Low_Level::DISCONNECT) { + + } + } + + if (msg->has_networking_sockets()) { + + } +} diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index dc3a453f..8aadadd8 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -124,6 +124,7 @@ Steam_Client::Steam_Client() steam_tv = new Steam_TV(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_gamestats = new Steam_GameStats(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); steam_timeline = new Steam_Timeline(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); + steam_app_disable_update = new Steam_App_Disable_Update(settings_client, network, callback_results_client, callbacks_client, run_every_runcb); // server PRINT_DEBUG("init gameserver"); @@ -205,6 +206,7 @@ Steam_Client::~Steam_Client() DEL_INST(steam_tv); DEL_INST(steam_gamestats); DEL_INST(steam_timeline); + DEL_INST(steam_app_disable_update); DEL_INST(steam_utils); DEL_INST(steam_friends); diff --git a/dll/steam_client_interface_getter.cpp b/dll/steam_client_interface_getter.cpp index e0736ee9..4aa2e245 100644 --- a/dll/steam_client_interface_getter.cpp +++ b/dll/steam_client_interface_getter.cpp @@ -18,6 +18,19 @@ #include "dll/steam_client.h" +// retrieves the ISteamAppDisableUpdate interface associated with the handle +ISteamAppDisableUpdate *Steam_Client::GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) +{ + PRINT_DEBUG("%s", pchVersion); + if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return nullptr; + + if (strcmp(pchVersion, STEAMAPPDISABLEUPDATE_INTERFACE_VERSION) == 0) { + return reinterpret_cast(static_cast(steam_app_disable_update)); + } + + report_missing_impl_and_exit(pchVersion, EMU_FUNC_NAME); +} + // retrieves the ISteamTimeline interface associated with the handle ISteamTimeline *Steam_Client::GetISteamTimeline( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) { @@ -422,6 +435,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe return GetAppTicket(hSteamUser, hSteamPipe, pchVersion); } else if (strstr(pchVersion, "STEAMTIMELINE_INTERFACE") == pchVersion) { return GetISteamTimeline(hSteamUser, hSteamPipe, pchVersion); + } else if (strstr(pchVersion, "SteamAppDisableUpdate") == pchVersion) { + return GetISteamAppDisableUpdate(hSteamUser, hSteamPipe, pchVersion); } PRINT_DEBUG("No interface: %s", pchVersion); diff --git a/sdk/steam/isteamappdisableupdate.h b/sdk/steam/isteamappdisableupdate.h new file mode 100644 index 00000000..a3a5e98d --- /dev/null +++ b/sdk/steam/isteamappdisableupdate.h @@ -0,0 +1,19 @@ + +#ifndef ISTEAMAPPDISABLEUPDATE_H +#define ISTEAMAPPDISABLEUPDATE_H + +// this interface is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll +// requested by appid 730 + +class ISteamAppDisableUpdate +{ +public: + + // probably means how many seconds to keep the updates disabled + virtual void SetAppUpdateDisabledSecondsRemaining(int32 nSeconds) = 0; + +}; + +#define STEAMAPPDISABLEUPDATE_INTERFACE_VERSION "SteamAppDisableUpdate001" + +#endif // ISTEAMAPPDISABLEUPDATE_H diff --git a/sdk/steam/steam_api.h b/sdk/steam/steam_api.h index c626a627..942cd871 100644 --- a/sdk/steam/steam_api.h +++ b/sdk/steam/steam_api.h @@ -21,6 +21,7 @@ #include "steam_api_common.h" // All of the interfaces +#include "isteamappdisableupdate.h" #include "isteamclient.h" #include "isteamclient007.h" #include "isteamclient008.h"