Compare commits
No commits in common. "b4205535fbee455bee925ab3aa90780e00eead27" and "624455705f0a1f2a09eeb5d086edae2da133bf06" have entirely different histories.
b4205535fb
...
624455705f
|
@ -284,7 +284,7 @@ void Steam_Overlay::FriendConnect(Friend _friend)
|
||||||
item.window_state = window_state_none;
|
item.window_state = window_state_none;
|
||||||
item.id = id;
|
item.id = id;
|
||||||
memset(item.chat_input, 0, max_chat_len);
|
memset(item.chat_input, 0, max_chat_len);
|
||||||
item.joinable = false;
|
item.has_lobby = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PRINT_DEBUG("No more free id to create a friend window\n");
|
PRINT_DEBUG("No more free id to create a friend window\n");
|
||||||
|
@ -351,16 +351,16 @@ void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_
|
||||||
PRINT_DEBUG("No more free id to create a notification window\n");
|
PRINT_DEBUG("No more free id to create a notification window\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Steam_Overlay::FriendJoinable(std::pair<const Friend, friend_window_state> &f)
|
bool Steam_Overlay::FriendHasLobby(uint64 friend_id)
|
||||||
{
|
{
|
||||||
Steam_Friends* steamFriends = get_steam_client()->steam_friends;
|
Steam_Friends* steamFriends = get_steam_client()->steam_friends;
|
||||||
|
|
||||||
if( std::string(steamFriends->GetFriendRichPresence(f.first.id(), "connect")).length() > 0 )
|
if( std::string(steamFriends->GetFriendRichPresence(friend_id, "connect")).length() > 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
FriendGameInfo_t friend_game_info = {};
|
FriendGameInfo_t friend_game_info = {};
|
||||||
steamFriends->GetFriendGamePlayed(f.first.id(), &friend_game_info);
|
steamFriends->GetFriendGamePlayed(friend_id, &friend_game_info);
|
||||||
if (friend_game_info.m_steamIDLobby.IsValid() && (f.second.window_state & window_state_lobby_invite))
|
if (friend_game_info.m_steamIDLobby.IsValid())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -398,7 +398,7 @@ void Steam_Overlay::BuildContextMenu(Friend const& frd, friend_window_state& sta
|
||||||
has_friend_action.push(frd);
|
has_friend_action.push(frd);
|
||||||
close_popup = true;
|
close_popup = true;
|
||||||
}
|
}
|
||||||
if (state.joinable && ImGui::Button("Join###PopupJoin"))
|
if (state.has_lobby && ImGui::Button("Join###PopupJoin"))
|
||||||
{
|
{
|
||||||
state.window_state |= window_state_join;
|
state.window_state |= window_state_join;
|
||||||
has_friend_action.push(frd);
|
has_friend_action.push(frd);
|
||||||
|
@ -447,7 +447,6 @@ void Steam_Overlay::BuildFriendWindow(Friend const& frd, friend_window_state& st
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Accept"))
|
if (ImGui::Button("Accept"))
|
||||||
{
|
{
|
||||||
state.window_state |= window_state_join;
|
|
||||||
this->has_friend_action.push(frd);
|
this->has_friend_action.push(frd);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -568,7 +567,6 @@ void Steam_Overlay::BuildNotifications(int width, int height)
|
||||||
ImGui::TextWrapped("%s", it->message.c_str());
|
ImGui::TextWrapped("%s", it->message.c_str());
|
||||||
if (ImGui::Button("Join"))
|
if (ImGui::Button("Join"))
|
||||||
{
|
{
|
||||||
it->frd->second.window_state |= window_state_join;
|
|
||||||
friend_actions_temp.push(it->frd->first);
|
friend_actions_temp.push(it->frd->first);
|
||||||
it->start_time = std::chrono::seconds(0);
|
it->start_time = std::chrono::seconds(0);
|
||||||
}
|
}
|
||||||
|
@ -726,7 +724,7 @@ void Steam_Overlay::RunCallbacks()
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
|
std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
|
||||||
{
|
{
|
||||||
i.second.joinable = FriendJoinable(i);
|
i.second.has_lobby = FriendHasLobby(i.first.id());
|
||||||
});
|
});
|
||||||
|
|
||||||
while (!has_friend_action.empty())
|
while (!has_friend_action.empty())
|
||||||
|
@ -776,6 +774,31 @@ void Steam_Overlay::RunCallbacks()
|
||||||
if (friend_info->second.window_state & window_state_join)
|
if (friend_info->second.window_state & window_state_join)
|
||||||
{
|
{
|
||||||
std::string connect = steamFriends->GetFriendRichPresence(friend_id, "connect");
|
std::string connect = steamFriends->GetFriendRichPresence(friend_id, "connect");
|
||||||
|
if (connect.length() > 0)
|
||||||
|
{
|
||||||
|
GameRichPresenceJoinRequested_t data = {};
|
||||||
|
data.m_steamIDFriend.SetFromUint64(friend_id);
|
||||||
|
strncpy(data.m_rgchConnect, connect.c_str(), k_cchMaxRichPresenceValueLength - 1);
|
||||||
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FriendGameInfo_t friend_game_info = {};
|
||||||
|
steamFriends->GetFriendGamePlayed(friend_id, &friend_game_info);
|
||||||
|
if (friend_game_info.m_steamIDLobby.IsValid())
|
||||||
|
{
|
||||||
|
// TODO: Look if thats really JoinLobby ?
|
||||||
|
// I saw on steamdev that overlay sends a GameLobbyJoinRequested_t
|
||||||
|
//GameLobbyJoinRequested_t data;
|
||||||
|
//data.m_steamIDLobby.SetFromUint64(friend_info->second.lobbyId);
|
||||||
|
//data.m_steamIDFriend.SetFromUint64(friend_id);
|
||||||
|
//callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
|
steamMatchmaking->JoinLobby(friend_game_info.m_steamIDLobby);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
friend_info->second.window_state &= ~window_state_join;
|
||||||
|
}
|
||||||
// The user got a lobby invite and accepted it
|
// The user got a lobby invite and accepted it
|
||||||
if (friend_info->second.window_state & window_state_lobby_invite)
|
if (friend_info->second.window_state & window_state_lobby_invite)
|
||||||
{
|
{
|
||||||
|
@ -785,7 +808,7 @@ void Steam_Overlay::RunCallbacks()
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
|
|
||||||
friend_info->second.window_state &= ~window_state_lobby_invite;
|
friend_info->second.window_state &= ~window_state_lobby_invite;
|
||||||
} else
|
}
|
||||||
// The user got a rich presence invite and accepted it
|
// The user got a rich presence invite and accepted it
|
||||||
if (friend_info->second.window_state & window_state_rich_invite)
|
if (friend_info->second.window_state & window_state_rich_invite)
|
||||||
{
|
{
|
||||||
|
@ -795,15 +818,6 @@ void Steam_Overlay::RunCallbacks()
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
||||||
|
|
||||||
friend_info->second.window_state &= ~window_state_rich_invite;
|
friend_info->second.window_state &= ~window_state_rich_invite;
|
||||||
} else if (connect.length() > 0)
|
|
||||||
{
|
|
||||||
GameRichPresenceJoinRequested_t data = {};
|
|
||||||
data.m_steamIDFriend.SetFromUint64(friend_id);
|
|
||||||
strncpy(data.m_rgchConnect, connect.c_str(), k_cchMaxRichPresenceValueLength - 1);
|
|
||||||
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
friend_info->second.window_state &= ~window_state_join;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
has_friend_action.pop();
|
has_friend_action.pop();
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct friend_window_state
|
||||||
std::string chat_history;
|
std::string chat_history;
|
||||||
char chat_input[max_chat_len];
|
char chat_input[max_chat_len];
|
||||||
|
|
||||||
bool joinable;
|
bool has_lobby;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Friend_Less
|
struct Friend_Less
|
||||||
|
@ -110,7 +110,7 @@ class Steam_Overlay
|
||||||
void Callback(Common_Message* msg);
|
void Callback(Common_Message* msg);
|
||||||
void RunCallbacks();
|
void RunCallbacks();
|
||||||
|
|
||||||
bool FriendJoinable(std::pair<const Friend, friend_window_state> &f);
|
bool FriendHasLobby(uint64 friend_id);
|
||||||
bool IHaveLobby();
|
bool IHaveLobby();
|
||||||
|
|
||||||
void NotifyUser(friend_window_state& friend_state);
|
void NotifyUser(friend_window_state& friend_state);
|
||||||
|
|
|
@ -50,11 +50,7 @@ void DX11_Hook::resetRenderState()
|
||||||
{
|
{
|
||||||
if (initialized)
|
if (initialized)
|
||||||
{
|
{
|
||||||
if (mainRenderTargetView) {
|
|
||||||
mainRenderTargetView->Release();
|
mainRenderTargetView->Release();
|
||||||
mainRenderTargetView = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pContext->Release();
|
pContext->Release();
|
||||||
|
|
||||||
ImGui_ImplDX11_Shutdown();
|
ImGui_ImplDX11_Shutdown();
|
||||||
|
@ -82,34 +78,9 @@ void DX11_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
||||||
io.IniFilename = NULL;
|
io.IniFilename = NULL;
|
||||||
|
|
||||||
ID3D11Texture2D* pBackBuffer;
|
ID3D11Texture2D* pBackBuffer;
|
||||||
|
|
||||||
pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
||||||
|
|
||||||
ID3D11RenderTargetView *get_targets[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {};
|
|
||||||
pContext->OMGetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, get_targets, NULL);
|
|
||||||
bool bind_target = true;
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) {
|
|
||||||
if (get_targets[i]) {
|
|
||||||
ID3D11Resource *res = NULL;
|
|
||||||
get_targets[i]->GetResource(&res);
|
|
||||||
if (res) {
|
|
||||||
if (res == (ID3D11Resource*)pBackBuffer) {
|
|
||||||
bind_target = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
res->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
get_targets[i]->Release();
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bind_target) {
|
|
||||||
pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetView);
|
pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetView);
|
||||||
}
|
|
||||||
|
|
||||||
pBackBuffer->Release();
|
pBackBuffer->Release();
|
||||||
|
|
||||||
ImGui_ImplDX11_Init(pDevice, pContext);
|
ImGui_ImplDX11_Init(pDevice, pContext);
|
||||||
|
@ -131,10 +102,7 @@ void DX11_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|
||||||
if (mainRenderTargetView) {
|
|
||||||
pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,11 +144,7 @@ DX11_Hook::~DX11_Hook()
|
||||||
|
|
||||||
if (initialized)
|
if (initialized)
|
||||||
{
|
{
|
||||||
if (mainRenderTargetView) {
|
|
||||||
mainRenderTargetView->Release();
|
mainRenderTargetView->Release();
|
||||||
mainRenderTargetView = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pContext->Release();
|
pContext->Release();
|
||||||
|
|
||||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||||
|
|
Loading…
Reference in New Issue