From 8abd24ca5474b7f94f1c7147f22697733615ede7 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Fri, 16 Aug 2019 00:12:11 +0200 Subject: [PATCH] Re-enabled auto join if overlay is not ready --- dll/steam_friends.h | 42 ++++++++++++++++++------------ overlay_experimental/DX11_Hook.cpp | 6 ++--- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/dll/steam_friends.h b/dll/steam_friends.h index d87c3fef..d12a680e 100644 --- a/dll/steam_friends.h +++ b/dll/steam_friends.h @@ -1035,27 +1035,37 @@ void Callback(Common_Message *msg) if (msg->has_friend_messages()) { if (msg->friend_messages().type() == Friend_Messages::LOBBY_INVITE) { PRINT_DEBUG("Steam_Friends Got Lobby Invite\n"); - //TODO: the user should accept the invite first but we auto accept it because there's no gui yet - // Then we will handle it ! - overlay->SetLobbyInvite(*find_friend(static_cast(msg->source_id())), msg->friend_messages().lobby_id()); - - //GameLobbyJoinRequested_t data; - //data.m_steamIDLobby = CSteamID((uint64)msg->friend_messages().lobby_id()); - //data.m_steamIDFriend = CSteamID((uint64)msg->source_id()); - //callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + if (overlay->Ready()) + { + //TODO: the user should accept the invite first but we auto accept it because there's no gui yet + // Then we will handle it ! + overlay->SetLobbyInvite(*find_friend(static_cast(msg->source_id())), msg->friend_messages().lobby_id()); + } + else + { + GameLobbyJoinRequested_t data; + data.m_steamIDLobby = CSteamID((uint64)msg->friend_messages().lobby_id()); + data.m_steamIDFriend = CSteamID((uint64)msg->source_id()); + callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + } } if (msg->friend_messages().type() == Friend_Messages::GAME_INVITE) { PRINT_DEBUG("Steam_Friends Got Game Invite\n"); //TODO: I'm pretty sure that the user should accept the invite before this is posted but we do like above - // Then we will handle it ! - overlay->SetRichInvite(*find_friend(static_cast(msg->source_id())), msg->friend_messages().connect_str().c_str()); - - //std::string const& connect_str = msg->friend_messages().connect_str(); - //GameRichPresenceJoinRequested_t data = {}; - //data.m_steamIDFriend = CSteamID((uint64)msg->source_id()); - //strncpy(data.m_rgchConnect, connect_str.c_str(), k_cchMaxRichPresenceValueLength - 1); - //callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + if (overlay->Ready()) + { + // Then we will handle it ! + overlay->SetRichInvite(*find_friend(static_cast(msg->source_id())), msg->friend_messages().connect_str().c_str()); + } + else + { + std::string const& connect_str = msg->friend_messages().connect_str(); + GameRichPresenceJoinRequested_t data = {}; + data.m_steamIDFriend = CSteamID((uint64)msg->source_id()); + strncpy(data.m_rgchConnect, connect_str.c_str(), k_cchMaxRichPresenceValueLength - 1); + callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); + } } } } diff --git a/overlay_experimental/DX11_Hook.cpp b/overlay_experimental/DX11_Hook.cpp index 3541d309..1073fbcd 100644 --- a/overlay_experimental/DX11_Hook.cpp +++ b/overlay_experimental/DX11_Hook.cpp @@ -135,7 +135,7 @@ void DX11_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain) // __in_ecount_opt(FeatureLevels) CONST D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, __out_opt ID3D11Device** ppDevice, // __out_opt D3D_FEATURE_LEVEL* pFeatureLevel, __out_opt ID3D11DeviceContext** ppImmediateContext) //{ -// auto res = _D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); +// auto res = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); // // if (SUCCEEDED(res)) // hook->hook_dx11(SDKVersion); @@ -185,12 +185,12 @@ DX11_Hook::DX11_Hook(): _hooked = false; // Hook to D3D11CreateDevice and D3D11CreateDeviceAndSwapChain so we know when it gets called. // If its called, then DX11 will be used to render the overlay. - //_D3D11CreateDevice = (decltype(_D3D11CreateDevice))GetProcAddress(_dll, "D3D11CreateDevice"); + //D3D11CreateDevice = (decltype(D3D11CreateDevice))GetProcAddress(_dll, "D3D11CreateDevice"); D3D11CreateDeviceAndSwapChain = (decltype(D3D11CreateDeviceAndSwapChain))GetProcAddress(_dll, "D3D11CreateDeviceAndSwapChain"); BeginHook(); HookFuncs( - //std::make_pair(&(PVOID&)_D3D11CreateDevice, &DX11_Hook::MyD3D11CreateDevice), + //std::make_pair(&(PVOID&)D3D11CreateDevice, &DX11_Hook::MyD3D11CreateDevice), std::make_pair(&(PVOID&)D3D11CreateDeviceAndSwapChain, &DX11_Hook::MyD3D11CreateDeviceAndSwapChain) ); EndHook();