From 1648c1424304fac7a40e0581773d608e4bb1e446 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Tue, 16 Feb 2021 12:30:24 -0500 Subject: [PATCH] Fixed issue with game treating bool return values as an int. --- dll/dll.cpp | 8 ++++---- sdk_includes/steam_api.h | 4 ++-- sdk_includes/steamtypes.h | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dll/dll.cpp b/dll/dll.cpp index b022c3b..be5587a 100644 --- a/dll/dll.cpp +++ b/dll/dll.cpp @@ -769,7 +769,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame( HSteamPipe hSteam /// Fetch the next pending callback on the given pipe, if any. If a callback is available, true is returned /// and the structure is populated. In this case, you MUST call SteamAPI_ManualDispatch_FreeLastCallback /// (after dispatching the callback) before calling SteamAPI_ManualDispatch_GetNextCallback again. -STEAMAPI_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ) +STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ) { PRINT_DEBUG("%s\n", __FUNCTION__); std::queue *q = NULL; @@ -829,7 +829,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPip /// Return the call result for the specified call on the specified pipe. You really should /// only call this in a handler for SteamAPICallCompleted_t callback. -STEAMAPI_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) +STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) { PRINT_DEBUG("SteamAPI_ManualDispatch_GetAPICallResult %i %llu %i %i\n", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected); Steam_Client *steam_client = get_steam_client(); @@ -961,7 +961,7 @@ SteamMasterServerUpdater */ -STEAMCLIENT_API bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ) +STEAMCLIENT_API steam_bool Steam_BGetCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ) { PRINT_DEBUG("%s %i\n", __FUNCTION__, hSteamPipe); SteamAPI_ManualDispatch_Init(); @@ -976,7 +976,7 @@ STEAMCLIENT_API void Steam_FreeLastCallback( HSteamPipe hSteamPipe ) SteamAPI_ManualDispatch_FreeLastCallback( hSteamPipe ); } -STEAMCLIENT_API bool Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed ) +STEAMCLIENT_API steam_bool Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed ) { PRINT_DEBUG("Steam_GetAPICallResult %i %llu %i %i\n", hSteamPipe, hSteamAPICall, cubCallback, iCallbackExpected); return SteamAPI_ManualDispatch_GetAPICallResult(hSteamPipe, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed); diff --git a/sdk_includes/steam_api.h b/sdk_includes/steam_api.h index 8829141..380436b 100644 --- a/sdk_includes/steam_api.h +++ b/sdk_includes/steam_api.h @@ -311,14 +311,14 @@ S_API void S_CALLTYPE SteamAPI_ManualDispatch_RunFrame( HSteamPipe hSteamPipe ); /// Fetch the next pending callback on the given pipe, if any. If a callback is available, true is returned /// and the structure is populated. In this case, you MUST call SteamAPI_ManualDispatch_FreeLastCallback /// (after dispatching the callback) before calling SteamAPI_ManualDispatch_GetNextCallback again. -S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ); +S_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe hSteamPipe, CallbackMsg_t *pCallbackMsg ); /// You must call this after dispatching the callback, if SteamAPI_ManualDispatch_GetNextCallback returns true. S_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe hSteamPipe ); /// Return the call result for the specified call on the specified pipe. You really should /// only call this in a handler for SteamAPICallCompleted_t callback. -S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ); +S_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ); //----------------------------------------------------------------------------------------------------------------------------------------------------------// // diff --git a/sdk_includes/steamtypes.h b/sdk_includes/steamtypes.h index fd2674a..b3440ee 100644 --- a/sdk_includes/steamtypes.h +++ b/sdk_includes/steamtypes.h @@ -10,6 +10,12 @@ #pragma once #endif +/* +for some dumb reason some games like carrion think a bool is an int and use the whole register as a return value +instead of using just al like a normal program. +*/ +typedef unsigned steam_bool; + #define S_CALLTYPE __cdecl // Steam-specific types. Defined here so this header file can be included in other code bases.