Merge branch 'linux_overlay' into 'master'

Fix Steam overlay for Linux

See merge request Mr_Goldberg/goldberg_emulator!48
This commit is contained in:
Dāvis 2022-07-12 07:52:28 +00:00
commit ecc8931f8c
4 changed files with 20 additions and 8 deletions

View File

@ -22,6 +22,7 @@ endif()
# Add option to enable experimental build
option(EMU_EXPERIMENTAL_BUILD "Enable experimental build" OFF)
option(EMU_OVERLAY "Enable overlay support" OFF)
# Set CXX standard
set(CMAKE_CXX_STANDARD 14)
@ -86,6 +87,9 @@ if(WIN32)
ImGui/impls/windows/*.cpp
glew/glew.c
)
if(EMU_OVERLAY AND NOT EMU_EXPERIMENTAL_BUILD)
message(FATAL_ERROR "You need to enable experimental build to use overlay on Windows")
endif()
elseif(UNIX)
file(GLOB OVERLAY_EXPERIMENTAL_SRC_SHARED
overlay_experimental/*.cpp
@ -105,7 +109,7 @@ endif()
add_library(${LIB_STEAM_API}
SHARED
$<$<BOOL:${EMU_EXPERIMENTAL_BUILD}>:${DETOURS_SRC_SHARED}>
$<$<AND:$<BOOL:${EMU_EXPERIMENTAL_BUILD}>,$<BOOL:${EMU_OVERLAY}>>:${OVERLAY_EXPERIMENTAL_SRC_SHARED}>
$<$<BOOL:${EMU_OVERLAY}>:${OVERLAY_EXPERIMENTAL_SRC_SHARED}>
${DLL_SRC_SHARED}
${PROTO_SRCS}
${PROTO_HDRS}

View File

@ -783,10 +783,13 @@ void Renderer_Detector::renderer_found(Base_Hook* hook)
game_renderer = hook;
if (hook == nullptr)
{
PRINT_DEBUG("We found a renderer but couldn't hook it, aborting overlay hook.\n");
}
else
{
PRINT_DEBUG("Hooked renderer in %d/%d tries\n", _hook_retries, max_hook_retries);
}
hm.RemoveHook(rendererdetect_hook);
}

View File

@ -17,6 +17,11 @@ static constexpr int base_notif_window_id = 0 * max_window_id;
static constexpr int base_friend_window_id = 1 * max_window_id;
static constexpr int base_friend_item_id = 2 * max_window_id;
std::chrono::milliseconds Notification::fade_in = std::chrono::milliseconds(2000);
std::chrono::milliseconds Notification::fade_out = std::chrono::milliseconds(2000);
std::chrono::milliseconds Notification::show_time = std::chrono::milliseconds(6000) + fade_in + fade_out;
std::chrono::milliseconds Notification::fade_out_start = show_time - fade_out;
int find_free_id(std::vector<int> & ids, int base)
{
std::sort(ids.begin(), ids.end());
@ -355,11 +360,11 @@ bool Steam_Overlay::FriendJoinable(std::pair<const Friend, friend_window_state>
{
Steam_Friends* steamFriends = get_steam_client()->steam_friends;
if( std::string(steamFriends->GetFriendRichPresence(f.first.id(), "connect")).length() > 0 )
if( std::string(steamFriends->GetFriendRichPresence((uint64)f.first.id(), "connect")).length() > 0 )
return true;
FriendGameInfo_t friend_game_info = {};
steamFriends->GetFriendGamePlayed(f.first.id(), &friend_game_info);
steamFriends->GetFriendGamePlayed((uint64)f.first.id(), &friend_game_info);
if (friend_game_info.m_steamIDLobby.IsValid() && (f.second.window_state & window_state_lobby_invite))
return true;

View File

@ -54,10 +54,10 @@ struct Notification
{
static constexpr float width = 0.25;
static constexpr float height = 5.0;
static constexpr std::chrono::milliseconds fade_in = std::chrono::milliseconds(2000);
static constexpr std::chrono::milliseconds fade_out = std::chrono::milliseconds(2000);
static constexpr std::chrono::milliseconds show_time = std::chrono::milliseconds(6000) + fade_in + fade_out;
static constexpr std::chrono::milliseconds fade_out_start = show_time - fade_out;
static std::chrono::milliseconds fade_in;
static std::chrono::milliseconds fade_out;
static std::chrono::milliseconds show_time;
static std::chrono::milliseconds fade_out_start;
static constexpr float r = 0.16;
static constexpr float g = 0.29;
static constexpr float b = 0.48;