in Steam_Utils::IsAPICallCompleted initialize the pFailed param to false

This commit is contained in:
otavepto 2024-03-16 07:13:43 +02:00
parent 325631e1fd
commit db07e4aadf
5 changed files with 8 additions and 8 deletions

View File

@ -938,7 +938,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSte
/// You must call this after dispatching the callback, if SteamAPI_ManualDispatch_GetNextCallback returns true.
STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe hSteamPipe )
{
PRINT_DEBUG("%s %i\n", __FUNCTION__, hSteamPipe);
PRINT_DEBUG("SteamAPI_ManualDispatch_FreeLastCallback %i\n", hSteamPipe);
std::queue<struct cb_data> *q = NULL;
Steam_Client *steam_client = get_steam_client();
auto it = steam_client->steam_pipes.find(hSteamPipe);
@ -1102,7 +1102,7 @@ STEAMCLIENT_API steam_bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMs
STEAMCLIENT_API void Steam_FreeLastCallback( HSteamPipe hSteamPipe )
{
PRINT_DEBUG("%s %i\n", __FUNCTION__, hSteamPipe);
PRINT_DEBUG("Steam_FreeLastCallback %i\n", hSteamPipe);
SteamAPI_ManualDispatch_FreeLastCallback( hSteamPipe );
}

View File

@ -204,7 +204,7 @@ public:
}
PRINT_DEBUG("addCallResult ERROR\n");
return 0;
return k_uAPICallInvalid;
}
SteamAPICall_t reserveCallResult() {
@ -296,6 +296,7 @@ public:
while (c != std::end(callresults)) {
if (c->to_delete) {
if (c->timed_out()) {
PRINT_DEBUG("runCallResults removed callresult %i\n", c->iCallback);
c = callresults.erase(c);
} else {
++c;

View File

@ -172,7 +172,7 @@ SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToR
if ((size - nOffset) < cubToRead) cubToRead = size - nOffset;
struct Async_Read a_read;
struct Async_Read a_read{};
data.m_eResult = k_EResultOK;
a_read.offset = data.m_nOffset = nOffset;
a_read.api_call = data.m_hFileReadAsync = callback_results->reserveCallResult();

View File

@ -1910,7 +1910,7 @@ void Steam_Client::RunCallbacks(bool runClientCB, bool runGameserverCB, bool run
callbacks_client->runCallBacks();
last_cb_run = std::chrono::duration_cast<std::chrono::duration<unsigned long long>>(std::chrono::system_clock::now().time_since_epoch()).count();
PRINT_DEBUG("Steam_Client::RunCallbacks done ------------------------------------------------------\n\n");
PRINT_DEBUG("Steam_Client::RunCallbacks done ------------------------------------------------------\n");
}
void Steam_Client::DestroyAllInterfaces()

View File

@ -147,9 +147,9 @@ void Steam_Utils::SetOverlayNotificationPosition( ENotificationPosition eNotific
// can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed )
{
PRINT_DEBUG("Steam_Utils::IsAPICallCompleted: %llu\n", hSteamAPICall);
PRINT_DEBUG("Steam_Utils::IsAPICallCompleted %llu\n", hSteamAPICall);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (pbFailed) *pbFailed = true;
if (pbFailed) *pbFailed = false;
if (hSteamAPICall == 1) { //bug ? soul calibur 6 calls this function with the return value 1 of Steam_User_Stats::RequestCurrentStats and expects this function to return true
if (pbFailed) *pbFailed = true;
@ -157,7 +157,6 @@ bool Steam_Utils::IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFail
}
if (!callback_results->exists(hSteamAPICall)) return false;
if (pbFailed) *pbFailed = false;
return true; //all api calls "complete" right away
}