From cae5347c0c4506542cf29554c291e0a591c348ff Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 18 Sep 2022 11:31:46 +0200 Subject: [PATCH] Some steam fixes --- src/client/steam/interfaces/apps.cpp | 25 +++++++++------- src/client/steam/interfaces/user.cpp | 15 +++++++--- src/client/steam/interfaces/user_stats.cpp | 33 ++++++++++++++++++++-- 3 files changed, 57 insertions(+), 16 deletions(-) diff --git a/src/client/steam/interfaces/apps.cpp b/src/client/steam/interfaces/apps.cpp index f3de1074..e017bf73 100644 --- a/src/client/steam/interfaces/apps.cpp +++ b/src/client/steam/interfaces/apps.cpp @@ -104,37 +104,42 @@ namespace steam steam_id apps::GetAppOwner() { - return SteamUser()->GetSteamID(); + return SteamUser()->GetSteamID(); } const char* apps::GetLaunchQueryParam(const char* pchKey) { - return ""; + return ""; } + bool apps::GetDlcDownloadProgress(uint32_t nAppID, uint64_t* punBytesDownloaded, uint64_t* punBytesTotal) { - *punBytesTotal = 0; - *punBytesDownloaded = 0; - return false; + *punBytesTotal = 0; + *punBytesDownloaded = 0; + return false; } + int apps::GetAppBuildId() { - return 0; + return 0; } + void apps::RequestAllProofOfPurchaseKeys() { - } + uint64_t apps::GetFileDetails(const char* pszFileName) { - return 0; + return 0; } + int apps::GetLaunchCommandLine(char* pszCommandLine, int cubCommandLine) { - return 0; + return 0; } + bool apps::BIsSubscribedFromFamilySharing() { - return false; + return false; } } diff --git a/src/client/steam/interfaces/user.cpp b/src/client/steam/interfaces/user.cpp index dba80621..e01e8c75 100644 --- a/src/client/steam/interfaces/user.cpp +++ b/src/client/steam/interfaces/user.cpp @@ -18,7 +18,7 @@ namespace steam int user::GetHSteamUser() { - return NULL; + return 1; } bool user::LoggedOn() @@ -70,7 +70,7 @@ namespace steam unsigned int cbUncompressedDestBufferSize, unsigned int* nUncompressBytesWritten, unsigned int nUncompressedVoiceDesiredSampleRate) { - return 0; + return 2; } int user::DecompressVoice(void* pCompressed, unsigned int cbCompressed, void* pDestBuffer, @@ -86,6 +86,7 @@ namespace steam unsigned int user::GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket) { + static uint32_t ticket = 0; *pcbTicket = 1; @@ -115,7 +116,7 @@ namespace steam unsigned int user::UserHasLicenseForApp(steam_id steamID, unsigned int appID) { - return 0; + return 1; } bool user::BIsBehindNAT() @@ -155,7 +156,13 @@ namespace steam { if (cbMaxTicket < 0 || auth_ticket.empty()) return false; - const auto size = std::min(size_t(cbMaxTicket), auth_ticket.size()); + const auto size = auth_ticket.size(); + if (size_t(cbMaxTicket) < size) + { + *pcbTicket = static_cast(size); + return false; + } + std::memcpy(pTicket, auth_ticket.data(), size); *pcbTicket = static_cast(size); diff --git a/src/client/steam/interfaces/user_stats.cpp b/src/client/steam/interfaces/user_stats.cpp index 13d4ccc0..8e736051 100644 --- a/src/client/steam/interfaces/user_stats.cpp +++ b/src/client/steam/interfaces/user_stats.cpp @@ -3,8 +3,37 @@ namespace steam { + namespace + { + struct user_stats_received + { + enum { callback_id = 1101 }; + + uint64_t m_n_game_id; + int m_e_result; + steam_id m_steam_id_user; + }; + } + bool user_stats::RequestCurrentStats() { + + static uint32_t ticket = 0; + + game_id game{}; + game.raw.mod_id = 0; + game.raw.type = 0; + game.raw.app_id = SteamUtils()->GetAppID(); + + const auto result = callbacks::register_call(); + auto* response = static_cast(calloc( + 1, sizeof(user_stats_received))); + response->m_steam_id_user = SteamUser()->GetSteamID(); + response->m_e_result = 1; // k_EResultOK; + response->m_n_game_id = game.bits; + + callbacks::return_call(response, sizeof(user_stats_received), + user_stats_received::callback_id, result); return true; } @@ -20,12 +49,12 @@ namespace steam bool user_stats::SetStat(const char* pchName, int nData) { - return false; + return true; } bool user_stats::SetStat(const char* pchName, float fData) { - return false; + return true; } bool user_stats::UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength)