Ejemplo n.º 1
0
void CLogger::CallbackHandlerThread()
{
	for(; !this->TestDestroy(); this->Sleep(100))
	{
		wxMutexLocker steamLock(m_steamLock);

		if(!m_hPipe || m_hPipe == -1)
		{
			if(!InitSteam())
				continue;
		}

		static unsigned int i = 0;
		if(++i % 50 == 0)
		{
			// This dummy call will trigger the IPCFailure_t callback if Steam has been closed.
			if(m_pSteamUser)
				m_pSteamUser->BLoggedOn();
		}

		CallbackMsg_t callbackMsg;
		while(Steam_BGetCallback(m_hPipe, &callbackMsg))
		{
			switch(callbackMsg.m_iCallback)
			{
			case IPCFailure_t::k_iCallback:
				{
					IPCFailure_t* pIPCFailure = (IPCFailure_t*)callbackMsg.m_pubParam;
					OnIPCFailure(pIPCFailure);
					break;
				}
			case FriendChatMsg_t::k_iCallback:
				{
					FriendChatMsg_t* pFriendChatMsg = (FriendChatMsg_t*)callbackMsg.m_pubParam;
					OnFriendChatMsg(pFriendChatMsg);
					break;
				}
			case ChatRoomMsg_t::k_iCallback:
				{
					ChatRoomMsg_t* pChatRoomMsg = (ChatRoomMsg_t*)callbackMsg.m_pubParam;
					OnChatRoomMsg(pChatRoomMsg);
					break;
				}
			case ChatRoomDlgClose_t::k_iCallback:
				{
					ChatRoomDlgClose_t* pChatRoomDlgClose = (ChatRoomDlgClose_t*)callbackMsg.m_pubParam;
					OnChatRoomDlgClose(pChatRoomDlgClose);
					break;
				}
			}
			Steam_FreeLastCallback(m_hPipe);
		}
	}
}
	void CUser::RunCallbackSizeCheck()
	{
		SteamServersConnected_t* steamServersConnected = new SteamServersConnected_t();
		OnSteamServersConnected(steamServersConnected);
		delete steamServersConnected;
		
		SteamServerConnectFailure_t* steamServerConnectFailure = new SteamServerConnectFailure_t();
		OnSteamServerConnectFailure(steamServerConnectFailure);
		delete steamServerConnectFailure;
		
		SteamServersDisconnected_t* steamServersDisconnected = new SteamServersDisconnected_t();
		OnSteamServersDisconnected(steamServersDisconnected);
		delete steamServersDisconnected;
		
		ClientGameServerDeny_t* clientGameServerDeny = new ClientGameServerDeny_t();
		OnClientGameServerDeny(clientGameServerDeny);
		delete clientGameServerDeny;
		
		IPCFailure_t* ipcFailure = new IPCFailure_t();
		OnIPCFailure(ipcFailure);
		delete ipcFailure;
		
		ValidateAuthTicketResponse_t* validateAuthTicketResponse = new ValidateAuthTicketResponse_t();
		OnValidateAuthTicketResponse(validateAuthTicketResponse);
		delete validateAuthTicketResponse;
		
		MicroTxnAuthorizationResponse_t* microTxnAuthorizationResponse = new MicroTxnAuthorizationResponse_t();
		OnMicroTxnAuthorizationResponse(microTxnAuthorizationResponse);
		delete microTxnAuthorizationResponse;
		
		GetAuthSessionTicketResponse_t* getAuthSessionTicketResponse = new GetAuthSessionTicketResponse_t();
		OnGetAuthSessionTicketResponse(getAuthSessionTicketResponse);
		delete getAuthSessionTicketResponse;
		
		GameWebCallback_t* gameWebCallback = new GameWebCallback_t();
		OnGameWebCallback(gameWebCallback);
		delete gameWebCallback;
		
		EncryptedAppTicketResponse_t* encryptedAppTicketResponse = new EncryptedAppTicketResponse_t();
		OnEncryptedAppTicketResponse(encryptedAppTicketResponse, false);
		delete encryptedAppTicketResponse;
	}