diff --git a/dll/dll/appticket.h b/dll/dll/appticket.h index 94f92e7a..a813ca59 100644 --- a/dll/dll/appticket.h +++ b/dll/dll/appticket.h @@ -1,3 +1,25 @@ +/* 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_TICKET_H__ +#define __INCLUDED_STEAM_APP_TICKET_H__ + +#include "base.h" +#include "steam/isteamappticket.h" struct AppTicketV1 { @@ -297,4 +319,30 @@ public: return buffer; } -}; \ No newline at end of file +}; + + +class Steam_AppTicket : +public ISteamAppTicket +{ +private: + class Settings *settings; + +public: + Steam_AppTicket(class Settings *settings) : + settings(settings) + { + + } + + virtual uint32 GetAppOwnershipTicketData( uint32 nAppID, void *pvBuffer, uint32 cbBufferLength, uint32 *piAppId, uint32 *piSteamId, uint32 *piSignature, uint32 *pcbSignature ) + { + PRINT_DEBUG("TODO GetAppOwnershipTicketData: %u, %p, %u, %p, %p, %p, %p\n", nAppID, pvBuffer, cbBufferLength, piAppId, piSteamId, piSignature, pcbSignature); + std::lock_guard lock(global_mutex); + + return 0; + + } +}; + +#endif // __INCLUDED_STEAM_APP_TICKET_H__ diff --git a/dll/dll/steam_client.h b/dll/dll/steam_client.h index b7c08561..73a74e5d 100644 --- a/dll/dll/steam_client.h +++ b/dll/dll/steam_client.h @@ -16,6 +16,7 @@ . */ #include "base.h" +#include "appticket.h" #include "steam_user.h" #include "steam_friends.h" #include "steam_utils.h" @@ -127,6 +128,7 @@ public: Steam_Networking_Messages *steam_gameserver_networking_messages; Steam_Game_Coordinator *steam_gameserver_game_coordinator; Steam_Masterserver_Updater *steam_masterserver_updater; + Steam_AppTicket *steam_app_ticket; Steam_Overlay* steam_overlay; @@ -284,6 +286,8 @@ public: // Steam Remote Play interface ISteamRemotePlay *GetISteamRemotePlay( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ); + + ISteamAppTicket *GetAppTicket( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ); void RegisterCallback( class CCallbackBase *pCallback, int iCallback); void UnregisterCallback( class CCallbackBase *pCallback); diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index 55183ad9..6520feb1 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -117,6 +117,9 @@ Steam_Client::Steam_Client() steam_gameserver_game_coordinator = new Steam_Game_Coordinator(settings_server, network, callback_results_server, callbacks_server, run_every_runcb); steam_masterserver_updater = new Steam_Masterserver_Updater(settings_server, network, callback_results_server, callbacks_server, run_every_runcb); + PRINT_DEBUG("client init AppTicket\n"); + steam_app_ticket = new Steam_AppTicket(settings_client); + gameserver_has_ipv6_functions = false; last_cb_run = 0; @@ -705,6 +708,8 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe return GetISteamRemotePlay(hSteamUser, hSteamPipe, pchVersion); } else if (strstr(pchVersion, "STEAMPARENTALSETTINGS_INTERFACE_VERSION") == pchVersion) { return GetISteamParentalSettings(hSteamUser, hSteamPipe, pchVersion); + } else if (strstr(pchVersion, "STEAMAPPTICKET_INTERFACE_VERSION") == pchVersion) { + return GetAppTicket(hSteamUser, hSteamPipe, pchVersion); } else { PRINT_DEBUG("No interface: %s\n", pchVersion); //TODO: all the interfaces @@ -1387,6 +1392,22 @@ ISteamRemotePlay *Steam_Client::GetISteamRemotePlay( HSteamUser hSteamUser, HSte return (ISteamRemotePlay *)(void *)(ISteamRemotePlay *)steam_remoteplay; } +ISteamAppTicket *Steam_Client::GetAppTicket( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) +{ + PRINT_DEBUG("GetAppTicket %s\n", pchVersion); + if (!steam_pipes.count(hSteamPipe) || !hSteamUser) return NULL; + + if (strcmp(pchVersion, STEAMAPPTICKET_INTERFACE_VERSION) == 0) { + return (ISteamAppTicket *)(void *)(ISteamAppTicket *)steam_app_ticket; + } else { + return (ISteamAppTicket *)(void *)(ISteamAppTicket *)steam_app_ticket; + } + + // we can get here if one of the if-statements didn't return in all paths + PRINT_DEBUG("Missing handling for interface: %s\n", pchVersion); + return (ISteamAppTicket *)(void *)(ISteamAppTicket *)steam_app_ticket; +} + void Steam_Client::RegisterCallback( class CCallbackBase *pCallback, int iCallback) { int base_callback = (iCallback / 100) * 100;