+static void steamworks_process_api_call( HSteamPipe pipe,
+ CallbackMsg_t *callback )
+{
+ SteamAPICallCompleted_t *pCallCompleted =
+ (SteamAPICallCompleted_t *)callback->m_pubParam;
+
+ int bFailed;
+
+ void *temp = alloca( pCallCompleted->m_cubParam );
+
+ if( SteamAPI_ManualDispatch_GetAPICallResult(
+ pipe,
+ pCallCompleted->m_hAsyncCall,
+ temp,
+ pCallCompleted->m_cubParam,
+ pCallCompleted->m_iCallback,
+ &bFailed )
+ )
+ {
+ /*
+ * Dispatch the call result to the registered handler(s) for the
+ * call identified by pCallCompleted->m_hAsyncCall
+ */
+
+ vg_info( "steamworks_event::api_call_completed( %lu )\n",
+ pCallCompleted->m_hAsyncCall );
+
+ int j=0;
+ for( int i=0; i<steam_async_track_count; i++ )
+ {
+ if( steam_async_trackers[j].id != pCallCompleted->m_hAsyncCall )
+ {
+ steam_async_trackers[j ++] = steam_async_trackers[i];
+ }
+ else
+ {
+ steam_async *pasync = &steam_async_trackers[j];
+ pasync->p_handler( temp, pasync->data );
+ }
+ }
+
+ if( steam_async_track_count == j )
+ {
+ vg_error( "No tracker was register for API call\n" );
+ }
+
+ steam_async_track_count = j;
+ }
+ else
+ {
+#if 0
+ typedef enum ESteamAPICallFailure
+ {
+ k_ESteamAPICallFailureNone = -1,
+ k_ESteamAPICallFailureSteamGone = 0,
+ k_ESteamAPICallFailureNetworkFailure = 1,
+ k_ESteamAPICallFailureInvalidHandle = 2,
+ k_ESteamAPICallFailureMismatchedCallback = 3,
+ }
+
+ ESteamAPICallFailure;
+ ESteamAPICallFailure fail_why =
+ SteamAPI_ISteamUtils_GetAPICallFailureReason(
+ steam_api_classes.utils, pCallCompleted->m_hAsyncCall );
+
+ vg_error( "steamworks_event: error getting call result on"
+ "%lu (code %d)\n",
+ pCallCompleted->m_hAsyncCall, fail_why );
+#endif
+ }
+}
+