Compare commits

...

4 Commits

Author SHA1 Message Date
Mr_Goldberg 3f44827326
Basic JoinClanChatRoom implementation. 2020-01-20 11:48:15 -05:00
Mr_Goldberg 6308eb1e0c
Readme change. 2020-01-20 11:47:29 -05:00
Mr_Goldberg 43a5b13302
Use different mutex for overlay to try to fix lag. 2020-01-20 11:47:12 -05:00
Nemirtingas 1dc5bcc5c1
Fix hooks not working
Even if dxgi is hooked, it will not be rehooked, HookDXGIPresent has a check, but different dx versions need a call to loadFunctions.
2020-01-20 11:45:04 -05:00
7 changed files with 27 additions and 14 deletions

View File

@ -104,6 +104,7 @@ Do not run more than one steam game with the same appid at the same time on the
Overlay (Note: at the moment this feature is only enabled in the windows experimental builds): Overlay (Note: at the moment this feature is only enabled in the windows experimental builds):
The overlay can be disabled by putting a file named disable_overlay.txt in the steam_settings folder. This is for games that depend on the steam overlay to let people join multiplayer games. The overlay can be disabled by putting a file named disable_overlay.txt in the steam_settings folder. This is for games that depend on the steam overlay to let people join multiplayer games.
Use SHIFT-TAB to open the overlay.
Controller (Note: at the moment this feature is only enabled in the windows experimental builds and the linux builds): Controller (Note: at the moment this feature is only enabled in the windows experimental builds and the linux builds):
SteamController/SteamInput support is limited to XInput controllers. If your controller is not XInput, there are many tools (at least for windows) that you can use to make it emulate an XInput one. SteamController/SteamInput support is limited to XInput controllers. If your controller is not XInput, there are many tools (at least for windows) that you can use to make it emulate an XInput one.

View File

@ -481,7 +481,7 @@ SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CS
// steamIDSource can be the steamID of a group, game server, lobby or chat room // steamIDSource can be the steamID of a group, game server, lobby or chat room
int GetFriendCountFromSource( CSteamID steamIDSource ) int GetFriendCountFromSource( CSteamID steamIDSource )
{ {
PRINT_DEBUG("Steam_Friends::GetFriendCountFromSource\n"); PRINT_DEBUG("Steam_Friends::GetFriendCountFromSource %llu\n", steamIDSource.ConvertToUint64());
//TODO //TODO
return 0; return 0;
} }
@ -866,8 +866,13 @@ AppId_t GetFriendCoplayGame( CSteamID steamIDFriend )
STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t ) STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t )
SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan )
{ {
PRINT_DEBUG("Steam_Friends::JoinClanChatRoom\n"); PRINT_DEBUG("Steam_Friends::JoinClanChatRoom %llu\n", steamIDClan.ConvertToUint64());
return 0; //TODO actually join a room
std::lock_guard<std::recursive_mutex> lock(global_mutex);
JoinClanChatRoomCompletionResult_t data;
data.m_steamIDClanChat = steamIDClan;
data.m_eChatRoomEnterResponse = k_EChatRoomEnterResponseSuccess;
return callback_results->addCallResult(data.k_iCallback, &data, sizeof(data));
} }
bool LeaveClanChatRoom( CSteamID steamIDClan ) bool LeaveClanChatRoom( CSteamID steamIDClan )

View File

@ -591,7 +591,7 @@ bool GetItemDefinitionIDs(
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs, STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize )
{ {
PRINT_DEBUG("GetItemDefinitionIDs\n"); PRINT_DEBUG("GetItemDefinitionIDs %p\n", pItemDefIDs);
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!punItemDefIDsArraySize) if (!punItemDefIDsArraySize)
return false; return false;

View File

@ -189,7 +189,7 @@ bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCal
// Deprecated. Applications should use SteamAPI_RunCallbacks() instead. Game servers do not need to call this function. // Deprecated. Applications should use SteamAPI_RunCallbacks() instead. Game servers do not need to call this function.
STEAM_PRIVATE_API( void RunFrame() STEAM_PRIVATE_API( void RunFrame()
{ {
PRINT_DEBUG("RunFrame\n"); PRINT_DEBUG("Steam_Utils::RunFrame\n");
} }
) )

View File

@ -271,7 +271,7 @@ void Renderer_Detector::hook_dx9()
void Renderer_Detector::hook_dx10() void Renderer_Detector::hook_dx10()
{ {
if (!_dxgi_hooked && !_renderer_found) if (!_dx10_hooked && !_renderer_found)
{ {
create_hwnd(); create_hwnd();
if (dummy_hWnd == nullptr) if (dummy_hWnd == nullptr)
@ -324,7 +324,7 @@ void Renderer_Detector::hook_dx10()
void Renderer_Detector::hook_dx11() void Renderer_Detector::hook_dx11()
{ {
if (!_dxgi_hooked && !_renderer_found) if (!_dx11_hooked && !_renderer_found)
{ {
create_hwnd(); create_hwnd();
if (dummy_hWnd == nullptr) if (dummy_hWnd == nullptr)
@ -378,7 +378,7 @@ void Renderer_Detector::hook_dx11()
void Renderer_Detector::hook_dx12() void Renderer_Detector::hook_dx12()
{ {
if (!_dxgi_hooked && !_renderer_found) if (!_dx12_hooked && !_renderer_found)
{ {
create_hwnd(); create_hwnd();
if (dummy_hWnd == nullptr) if (dummy_hWnd == nullptr)

View File

@ -123,7 +123,7 @@ void Steam_Overlay::SetNotificationInset(int nHorizontalInset, int nVerticalInse
void Steam_Overlay::SetupOverlay() void Steam_Overlay::SetupOverlay()
{ {
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
if (!setup_overlay_called) if (!setup_overlay_called)
{ {
setup_overlay_called = true; setup_overlay_called = true;
@ -238,7 +238,7 @@ void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
if (!Ready()) if (!Ready())
return; return;
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
auto i = friends.find(friendId); auto i = friends.find(friendId);
if (i != friends.end()) if (i != friends.end())
{ {
@ -257,7 +257,7 @@ void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
if (!Ready()) if (!Ready())
return; return;
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
auto i = friends.find(friendId); auto i = friends.find(friendId);
if (i != friends.end()) if (i != friends.end())
{ {
@ -273,7 +273,7 @@ void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
void Steam_Overlay::FriendConnect(Friend _friend) void Steam_Overlay::FriendConnect(Friend _friend)
{ {
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
int id = find_free_friend_id(friends); int id = find_free_friend_id(friends);
if (id != 0) if (id != 0)
{ {
@ -289,7 +289,7 @@ void Steam_Overlay::FriendConnect(Friend _friend)
void Steam_Overlay::FriendDisconnect(Friend _friend) void Steam_Overlay::FriendDisconnect(Friend _friend)
{ {
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
auto it = friends.find(_friend); auto it = friends.find(_friend);
if (it != friends.end()) if (it != friends.end())
friends.erase(it); friends.erase(it);
@ -297,6 +297,7 @@ void Steam_Overlay::FriendDisconnect(Friend _friend)
void Steam_Overlay::AddMessageNotification(std::string const& message) void Steam_Overlay::AddMessageNotification(std::string const& message)
{ {
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
int id = find_free_notification_id(notifications); int id = find_free_notification_id(notifications);
if (id != 0) if (id != 0)
{ {
@ -313,6 +314,7 @@ void Steam_Overlay::AddMessageNotification(std::string const& message)
void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach) void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach)
{ {
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
int id = find_free_notification_id(notifications); int id = find_free_notification_id(notifications);
if (id != 0) if (id != 0)
{ {
@ -330,6 +332,7 @@ void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach)
void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_state>& wnd_state) void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_state>& wnd_state)
{ {
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
int id = find_free_notification_id(notifications); int id = find_free_notification_id(notifications);
if (id != 0) if (id != 0)
{ {
@ -596,7 +599,7 @@ void Steam_Overlay::CreateFonts()
// Try to make this function as short as possible or it might affect game's fps. // Try to make this function as short as possible or it might affect game's fps.
void Steam_Overlay::OverlayProc() void Steam_Overlay::OverlayProc()
{ {
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
if (!Ready()) if (!Ready())
return; return;
@ -666,6 +669,7 @@ void Steam_Overlay::OverlayProc()
void Steam_Overlay::Callback(Common_Message *msg) void Steam_Overlay::Callback(Common_Message *msg)
{ {
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
if (msg->has_steam_messages()) if (msg->has_steam_messages())
{ {
Friend frd; Friend frd;
@ -689,6 +693,7 @@ void Steam_Overlay::Callback(Common_Message *msg)
void Steam_Overlay::RunCallbacks() void Steam_Overlay::RunCallbacks()
{ {
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
if (overlay_state_changed) if (overlay_state_changed)
{ {
GameOverlayActivated_t data = { 0 }; GameOverlayActivated_t data = { 0 };

View File

@ -92,6 +92,8 @@ class Steam_Overlay
std::vector<Notification> notifications; std::vector<Notification> notifications;
bool overlay_state_changed; bool overlay_state_changed;
std::recursive_mutex overlay_mutex;
Steam_Overlay(Steam_Overlay const&) = delete; Steam_Overlay(Steam_Overlay const&) = delete;
Steam_Overlay(Steam_Overlay&&) = delete; Steam_Overlay(Steam_Overlay&&) = delete;
Steam_Overlay& operator=(Steam_Overlay const&) = delete; Steam_Overlay& operator=(Steam_Overlay const&) = delete;