implement steambilling

This commit is contained in:
a 2024-12-06 22:45:10 +02:00
parent 8422cc49b5
commit 30761a108c
7 changed files with 613 additions and 0 deletions

97
dll/dll/steam_billing.h Normal file
View File

@ -0,0 +1,97 @@
/* 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_BILLING_H__
#define __INCLUDED_STEAM_BILLING_H__
#include "base.h"
class Steam_Billing:
public ISteamBilling
{
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_Billing(class Settings *settings, class Networking *network, class SteamCallResults *callback_results, class SteamCallBacks *callbacks, class RunEveryRunCB *run_every_runcb);
~Steam_Billing();
bool _unknown_fn_1( );
bool _unknown_fn_2( );
bool _unknown_fn_3( );
bool _unknown_fn_4( );
bool _unknown_fn_5( );
bool _unknown_fn_6( );
bool _unknown_fn_7( );
bool _unknown_fn_8( );
bool _unknown_fn_9( );
bool _unknown_fn_10( );
bool _unknown_fn_11( );
bool _unknown_fn_12( );
bool _unknown_fn_13( );
bool _unknown_fn_14( );
bool _unknown_fn_15( );
bool _unknown_fn_16( );
bool _unknown_fn_17( );
bool _unknown_fn_18( );
bool _unknown_fn_19( );
int _unknown_fn_20( );
int _unknown_fn_21( );
int _unknown_fn_22( );
int _unknown_fn_23( );
int _unknown_fn_24( );
int _unknown_fn_25( );
int _unknown_fn_26( );
const char* _unknown_fn_27( ); // returns null string (str address is inside .rdata so it can't change at runtime)
int _unknown_fn_28( );
int _unknown_fn_29( ); // mov eax, 2
int _unknown_fn_30( );
int _unknown_fn_31( );
int _unknown_fn_32( );
int _unknown_fn_33( );
int _unknown_fn_34( );
int _unknown_fn_35( );
int _unknown_fn_36( );
int _unknown_fn_37( );
const char* _unknown_fn_38( ); // returns null string (str address is inside .rdata so it can't change at runtime)
int _unknown_fn_39( );
int _unknown_fn_40( );
bool _unknown_fn_41( );
bool _unknown_fn_42( );
bool _unknown_fn_43( );
};
#endif // __INCLUDED_STEAM_BILLING_H__

View File

@ -51,6 +51,7 @@
#include "steam_parties.h" #include "steam_parties.h"
#include "steam_remoteplay.h" #include "steam_remoteplay.h"
#include "steam_tv.h" #include "steam_tv.h"
#include "steam_billing.h"
#include "steam_gameserver.h" #include "steam_gameserver.h"
#include "steam_gameserverstats.h" #include "steam_gameserverstats.h"
@ -142,6 +143,7 @@ public:
Steam_GameStats *steam_gamestats{}; Steam_GameStats *steam_gamestats{};
Steam_Timeline *steam_timeline{}; Steam_Timeline *steam_timeline{};
Steam_App_Disable_Update *steam_app_disable_update{}; Steam_App_Disable_Update *steam_app_disable_update{};
Steam_Billing *steam_billing{};
Steam_GameServer *steam_gameserver{}; Steam_GameServer *steam_gameserver{};
Steam_Utils *steam_gameserver_utils{}; Steam_Utils *steam_gameserver_utils{};
@ -248,6 +250,8 @@ public:
// steam appp disable update // steam appp disable update
ISteamAppDisableUpdate *GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ); ISteamAppDisableUpdate *GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
// steam billing
ISteamBilling *GetISteamBilling( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion );
// Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead. // Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead.
STEAM_PRIVATE_API( void RunFrame() ); STEAM_PRIVATE_API( void RunFrame() );

427
dll/steam_billing.cpp Normal file
View File

@ -0,0 +1,427 @@
/* 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/>. */
// this interface is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll
// real client returns 0/false in all these functions, the TODO notes are just for the names
#include "dll/steam_billing.h"
void Steam_Billing::steam_run_every_runcb(void *object)
{
// PRINT_DEBUG_ENTRY();
auto inst = (Steam_Billing *)object;
inst->steam_run_callback();
}
void Steam_Billing::steam_network_callback(void *object, Common_Message *msg)
{
// PRINT_DEBUG_ENTRY();
auto inst = (Steam_Billing *)object;
inst->network_callback(msg);
}
Steam_Billing::Steam_Billing(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_Billing::steam_network_callback, this);
this->run_every_runcb->add(&Steam_Billing::steam_run_every_runcb, this);
}
Steam_Billing::~Steam_Billing()
{
this->network->rmCallback(CALLBACK_ID_USER_STATUS, settings->get_local_steam_id(), &Steam_Billing::steam_network_callback, this);
this->run_every_runcb->remove(&Steam_Billing::steam_run_every_runcb, this);
}
bool Steam_Billing::_unknown_fn_1( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_2( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_3( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_4( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_5( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_6( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_7( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_8( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_9( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_10( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_11( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_12( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_13( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_14( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_15( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_16( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_17( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_18( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_19( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
int Steam_Billing::_unknown_fn_20( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_21( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_22( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_23( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_24( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_25( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_26( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
const char* Steam_Billing::_unknown_fn_27( ) // returns null string (str address is inside .rdata so it can't change at runtime)
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return "";
}
int Steam_Billing::_unknown_fn_28( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_29( ) // mov eax, 2
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_30( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_31( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_32( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_33( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_34( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_35( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_36( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_37( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
const char* Steam_Billing::_unknown_fn_38( ) // returns null string (str address is inside .rdata so it can't change at runtime)
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return "";
}
int Steam_Billing::_unknown_fn_39( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
int Steam_Billing::_unknown_fn_40( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return 0;
}
bool Steam_Billing::_unknown_fn_41( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_42( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
bool Steam_Billing::_unknown_fn_43( )
{
PRINT_DEBUG_TODO();
std::lock_guard lock(global_mutex);
return false;
}
void Steam_Billing::steam_run_callback()
{
}
void Steam_Billing::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) {
}
}
}

View File

@ -125,6 +125,7 @@ Steam_Client::Steam_Client()
steam_gamestats = new Steam_GameStats(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_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); steam_app_disable_update = new Steam_App_Disable_Update(settings_client, network, callback_results_client, callbacks_client, run_every_runcb);
steam_billing = new Steam_Billing(settings_client, network, callback_results_client, callbacks_client, run_every_runcb);
// server // server
PRINT_DEBUG("init gameserver"); PRINT_DEBUG("init gameserver");
@ -207,6 +208,7 @@ Steam_Client::~Steam_Client()
DEL_INST(steam_gamestats); DEL_INST(steam_gamestats);
DEL_INST(steam_timeline); DEL_INST(steam_timeline);
DEL_INST(steam_app_disable_update); DEL_INST(steam_app_disable_update);
DEL_INST(steam_billing);
DEL_INST(steam_utils); DEL_INST(steam_utils);
DEL_INST(steam_friends); DEL_INST(steam_friends);

View File

@ -18,6 +18,21 @@
#include "dll/steam_client.h" #include "dll/steam_client.h"
// retrieves the ISteamBilling interface associated with the handle
ISteamBilling *Steam_Client::GetISteamBilling( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{
PRINT_DEBUG("%s", pchVersion);
if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return nullptr;
if (strcmp(pchVersion, "SteamBilling001") == 0) {
return nullptr; // real steamclient64.dll returns null
} else if (strcmp(pchVersion, STEAMBILLING_INTERFACE_VERSION) == 0) {
return reinterpret_cast<ISteamBilling *>(static_cast<ISteamBilling *>(steam_billing));
}
report_missing_impl_and_exit(pchVersion, EMU_FUNC_NAME);
}
// retrieves the ISteamAppDisableUpdate interface associated with the handle // retrieves the ISteamAppDisableUpdate interface associated with the handle
ISteamAppDisableUpdate *Steam_Client::GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) ISteamAppDisableUpdate *Steam_Client::GetISteamAppDisableUpdate( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion )
{ {
@ -466,6 +481,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
return GetISteamTimeline(hSteamUser, hSteamPipe, pchVersion); return GetISteamTimeline(hSteamUser, hSteamPipe, pchVersion);
} else if (strstr(pchVersion, "SteamAppDisableUpdate") == pchVersion) { } else if (strstr(pchVersion, "SteamAppDisableUpdate") == pchVersion) {
return GetISteamAppDisableUpdate(hSteamUser, hSteamPipe, pchVersion); return GetISteamAppDisableUpdate(hSteamUser, hSteamPipe, pchVersion);
} else if (strstr(pchVersion, "SteamBilling") == pchVersion) {
return GetISteamBilling(hSteamUser, hSteamPipe, pchVersion);
} }
PRINT_DEBUG("No interface: %s", pchVersion); PRINT_DEBUG("No interface: %s", pchVersion);

65
sdk/steam/isteambilling.h Normal file
View File

@ -0,0 +1,65 @@
#ifndef ISTEAMBILLING_H
#define ISTEAMBILLING_H
// this interface is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll
class ISteamBilling
{
public:
virtual bool _unknown_fn_1( ) = 0;
virtual bool _unknown_fn_2( ) = 0;
virtual bool _unknown_fn_3( ) = 0;
virtual bool _unknown_fn_4( ) = 0;
virtual bool _unknown_fn_5( ) = 0;
virtual bool _unknown_fn_6( ) = 0;
virtual bool _unknown_fn_7( ) = 0;
virtual bool _unknown_fn_8( ) = 0;
virtual bool _unknown_fn_9( ) = 0;
virtual bool _unknown_fn_10( ) = 0;
virtual bool _unknown_fn_11( ) = 0;
virtual bool _unknown_fn_12( ) = 0;
virtual bool _unknown_fn_13( ) = 0;
virtual bool _unknown_fn_14( ) = 0;
virtual bool _unknown_fn_15( ) = 0;
virtual bool _unknown_fn_16( ) = 0;
virtual bool _unknown_fn_17( ) = 0;
virtual bool _unknown_fn_18( ) = 0;
virtual bool _unknown_fn_19( ) = 0;
virtual int _unknown_fn_20( ) = 0;
virtual int _unknown_fn_21( ) = 0;
virtual int _unknown_fn_22( ) = 0;
virtual int _unknown_fn_23( ) = 0;
virtual int _unknown_fn_24( ) = 0;
virtual int _unknown_fn_25( ) = 0;
virtual int _unknown_fn_26( ) = 0;
virtual const char* _unknown_fn_27( ) = 0; // returns null string (str address is inside .rdata so it can't change at runtime)
virtual int _unknown_fn_28( ) = 0;
virtual int _unknown_fn_29( ) = 0; // mov eax, 2
virtual int _unknown_fn_30( ) = 0;
virtual int _unknown_fn_31( ) = 0;
virtual int _unknown_fn_32( ) = 0;
virtual int _unknown_fn_33( ) = 0;
virtual int _unknown_fn_34( ) = 0;
virtual int _unknown_fn_35( ) = 0;
virtual int _unknown_fn_36( ) = 0;
virtual int _unknown_fn_37( ) = 0;
virtual const char* _unknown_fn_38( ) = 0; // returns null string (str address is inside .rdata so it can't change at runtime)
virtual int _unknown_fn_39( ) = 0;
virtual int _unknown_fn_40( ) = 0;
virtual bool _unknown_fn_41( ) = 0;
virtual bool _unknown_fn_42( ) = 0;
virtual bool _unknown_fn_43( ) = 0;
};
#define STEAMBILLING_INTERFACE_VERSION "SteamBilling002"
#endif // ISTEAMBILLING_H

View File

@ -22,6 +22,7 @@
// All of the interfaces // All of the interfaces
#include "isteamappdisableupdate.h" #include "isteamappdisableupdate.h"
#include "isteambilling.h"
#include "isteamclient.h" #include "isteamclient.h"
#include "isteamclient007.h" #include "isteamclient007.h"
#include "isteamclient008.h" #include "isteamclient008.h"