Some steam fixes

This commit is contained in:
momo5502 2022-09-18 11:31:46 +02:00
parent 1a925b352c
commit cae5347c0c
3 changed files with 57 additions and 16 deletions

View File

@ -104,37 +104,42 @@ namespace steam
steam_id apps::GetAppOwner() steam_id apps::GetAppOwner()
{ {
return SteamUser()->GetSteamID(); return SteamUser()->GetSteamID();
} }
const char* apps::GetLaunchQueryParam(const char* pchKey) const char* apps::GetLaunchQueryParam(const char* pchKey)
{ {
return ""; return "";
} }
bool apps::GetDlcDownloadProgress(uint32_t nAppID, uint64_t* punBytesDownloaded, uint64_t* punBytesTotal) bool apps::GetDlcDownloadProgress(uint32_t nAppID, uint64_t* punBytesDownloaded, uint64_t* punBytesTotal)
{ {
*punBytesTotal = 0; *punBytesTotal = 0;
*punBytesDownloaded = 0; *punBytesDownloaded = 0;
return false; return false;
} }
int apps::GetAppBuildId() int apps::GetAppBuildId()
{ {
return 0; return 0;
} }
void apps::RequestAllProofOfPurchaseKeys() void apps::RequestAllProofOfPurchaseKeys()
{ {
} }
uint64_t apps::GetFileDetails(const char* pszFileName) uint64_t apps::GetFileDetails(const char* pszFileName)
{ {
return 0; return 0;
} }
int apps::GetLaunchCommandLine(char* pszCommandLine, int cubCommandLine) int apps::GetLaunchCommandLine(char* pszCommandLine, int cubCommandLine)
{ {
return 0; return 0;
} }
bool apps::BIsSubscribedFromFamilySharing() bool apps::BIsSubscribedFromFamilySharing()
{ {
return false; return false;
} }
} }

View File

@ -18,7 +18,7 @@ namespace steam
int user::GetHSteamUser() int user::GetHSteamUser()
{ {
return NULL; return 1;
} }
bool user::LoggedOn() bool user::LoggedOn()
@ -70,7 +70,7 @@ namespace steam
unsigned int cbUncompressedDestBufferSize, unsigned int* nUncompressBytesWritten, unsigned int cbUncompressedDestBufferSize, unsigned int* nUncompressBytesWritten,
unsigned int nUncompressedVoiceDesiredSampleRate) unsigned int nUncompressedVoiceDesiredSampleRate)
{ {
return 0; return 2;
} }
int user::DecompressVoice(void* pCompressed, unsigned int cbCompressed, void* pDestBuffer, 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) unsigned int user::GetAuthSessionTicket(void* pTicket, int cbMaxTicket, unsigned int* pcbTicket)
{ {
static uint32_t ticket = 0; static uint32_t ticket = 0;
*pcbTicket = 1; *pcbTicket = 1;
@ -115,7 +116,7 @@ namespace steam
unsigned int user::UserHasLicenseForApp(steam_id steamID, unsigned int appID) unsigned int user::UserHasLicenseForApp(steam_id steamID, unsigned int appID)
{ {
return 0; return 1;
} }
bool user::BIsBehindNAT() bool user::BIsBehindNAT()
@ -155,7 +156,13 @@ namespace steam
{ {
if (cbMaxTicket < 0 || auth_ticket.empty()) return false; 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<unsigned>(size);
return false;
}
std::memcpy(pTicket, auth_ticket.data(), size); std::memcpy(pTicket, auth_ticket.data(), size);
*pcbTicket = static_cast<unsigned>(size); *pcbTicket = static_cast<unsigned>(size);

View File

@ -3,8 +3,37 @@
namespace steam 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() 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<user_stats_received*>(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; return true;
} }
@ -20,12 +49,12 @@ namespace steam
bool user_stats::SetStat(const char* pchName, int nData) bool user_stats::SetStat(const char* pchName, int nData)
{ {
return false; return true;
} }
bool user_stats::SetStat(const char* pchName, float fData) bool user_stats::SetStat(const char* pchName, float fData)
{ {
return false; return true;
} }
bool user_stats::UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength) bool user_stats::UpdateAvgRateStat(const char* pchName, float flCountThisSession, double dSessionLength)