Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8122 → Rev 8123

/source/voidwrap/src/voidwrap_steam.cpp
5,19 → 5,13
#include "steam_api.h"
#include "compat.h"
 
static CSteamID SteamID;
static uint64_t SteamID64;
static uint64_t AppID;
 
 
static VW_VOID_CONSTCHARPTR Callback_PrintDebug;
 
static void PrintDebug(const char * fmt, ...)
{
if (Callback_PrintDebug == nullptr)
{
return;
}
 
static char tmpstr[8192];
va_list va;
34,9 → 28,7
UNREFERENCED_PARAMETER(nSeverity);
 
if (Callback_PrintDebug == nullptr)
{
return;
}
 
Callback_PrintDebug(pchDebugText);
}
100,65 → 92,46
return;
 
m_pSteamUserStats->ResetAllStats(true);
 
m_bStoreStats = true;
m_bStatsValid = false;
m_bRequestedStats = false;
}
 
void SteamStatsAndAchievementsHandler::OnUserStatsReceived(UserStatsReceived_t * pCallback)
{
if (nullptr == m_pSteamUserStats)
if (nullptr == m_pSteamUserStats || AppID != pCallback->m_nGameID)
return;
 
if (SteamID64 != pCallback->m_nGameID)
return;
 
if (k_EResultOK == pCallback->m_eResult)
{
m_bStatsValid = true;
}
else
{
PrintDebug("RequestStats - failed, %d\n", pCallback->m_eResult);
}
}
 
void SteamStatsAndAchievementsHandler::OnUserStatsStored(UserStatsStored_t * pCallback)
{
if (SteamID64 != pCallback->m_nGameID)
if (AppID != pCallback->m_nGameID)
return;
 
if (k_EResultOK == pCallback->m_eResult)
{
}
else if (k_EResultInvalidParam == pCallback->m_eResult)
{
if (k_EResultInvalidParam == pCallback->m_eResult)
PrintDebug("StoreStats - some failed to validate\n");
}
else
{
PrintDebug("StoreStats - failed, %d\n", pCallback->m_eResult);
}
}
 
void SteamStatsAndAchievementsHandler::Process()
{
if (nullptr == m_pSteamUserStats)
return;
 
if (!m_bRequestedStats)
{
if (nullptr == m_pSteamUserStats)
{
m_bRequestedStats = true;
return;
}
 
m_bRequestedStats = m_pSteamUserStats->RequestCurrentStats();
return;
}
 
if (!m_bStatsValid)
if (!m_bStatsValid || !m_bStoreStats)
return;
 
if (!m_bStoreStats)
return;
 
m_bStoreStats = !m_pSteamUserStats->StoreStats();
}
 
267,9 → 240,7
}
 
SteamUtils()->SetWarningMessageHook(&SteamAPIWarningMessageHook);
 
SteamID = SteamUser()->GetSteamID();
SteamID64 = SteamID.ConvertToUint64();
SteamUtils()->SetOverlayNotificationPosition(k_EPositionTopRight);
AppID = SteamUtils()->GetAppID();
 
#if 0