Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement ISteamAppDisableUpdate001 #55

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions dll/dll/steam_app_disable_update.h
Original file line number Diff line number Diff line change
@@ -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
<http://www.gnu.org/licenses/>. */

#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__
5 changes: 5 additions & 0 deletions dll/dll/steam_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -140,6 +141,7 @@ public ISteamClient
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{};
Expand Down Expand Up @@ -243,6 +245,9 @@ public ISteamClient
// 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() );
Expand Down
88 changes: 88 additions & 0 deletions dll/steam_app_disable_update.cpp
Original file line number Diff line number Diff line change
@@ -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
<http://www.gnu.org/licenses/>. */

#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()) {

}
}
2 changes: 2 additions & 0 deletions dll/steam_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions dll/steam_client_interface_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ISteamAppDisableUpdate *>(static_cast<ISteamAppDisableUpdate *>(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 )
{
Expand Down Expand Up @@ -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);
Expand Down
19 changes: 19 additions & 0 deletions sdk/steam/isteamappdisableupdate.h
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions sdk/steam/steam_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down