goldberg_emulator/overlay_experimental/steam_overlay.h

108 lines
2.8 KiB
C
Raw Normal View History

#ifndef __INCLUDED_STEAM_OVERLAY_H__
#define __INCLUDED_STEAM_OVERLAY_H__
2019-07-25 23:33:07 +02:00
#include "../dll/base.h"
2019-07-25 23:33:07 +02:00
#include "Hook_Manager.h"
2019-08-02 11:16:30 +02:00
#include <map>
2019-08-02 13:02:20 +02:00
#include <queue>
2019-07-25 23:33:07 +02:00
2019-08-02 13:02:20 +02:00
enum window_state
{
2019-08-02 13:02:20 +02:00
window_state_none = 0,
window_state_show = 1<<0,
window_state_invite = 1<<1,
window_state_join = 1<<2,
window_state_lobby_invite = 1<<3,
window_state_rich_invite = 1<<4
};
2019-07-25 23:33:07 +02:00
2019-08-02 13:02:20 +02:00
struct friend_window_state
2019-08-02 11:16:30 +02:00
{
2019-08-02 13:02:20 +02:00
uint8 window_state;
2019-08-02 11:16:30 +02:00
union
{
uint64 lobbyId;
char connect[k_cchMaxRichPresenceValueLength];
};
};
struct Friend_Less
{
bool operator()(const Friend& lhs, const Friend& rhs) const
{
return lhs.id() < rhs.id();
}
};
2019-07-25 23:33:07 +02:00
class Steam_Overlay
{
Settings* settings;
SteamCallResults* callback_results;
SteamCallBacks* callbacks;
RunEveryRunCB* run_every_runcb;
Networking* network;
2019-08-02 11:16:30 +02:00
// friend id, show client window (to chat and accept invite maybe)
2019-08-02 13:02:20 +02:00
std::map<Friend, friend_window_state, Friend_Less> friends;
2019-07-25 23:33:07 +02:00
HWND game_hwnd;
WNDPROC game_hwnd_proc;
bool is_ready;
bool show_overlay;
Base_Hook window_hooks;
ENotificationPosition notif_position;
int h_inset, v_inset;
// Callback infos
2019-08-02 13:02:20 +02:00
std::queue<Friend> has_friend_action;
bool overlay_state_changed;
2019-07-25 23:33:07 +02:00
Steam_Overlay(Steam_Overlay const&) = delete;
Steam_Overlay(Steam_Overlay&&) = delete;
Steam_Overlay& operator=(Steam_Overlay const&) = delete;
Steam_Overlay& operator=(Steam_Overlay&&) = delete;
bool IgnoreMsg(const MSG* lpMsg);
LRESULT HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
2019-07-25 23:33:07 +02:00
static LRESULT CALLBACK sHookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT WINAPI MyDispatchMessageA(const MSG* lpMsg);
static LRESULT WINAPI MyDispatchMessageW(const MSG* lpMsg);
2019-07-25 23:33:07 +02:00
static void steam_overlay_run_every_runcb(void* object);
void RunCallbacks();
2019-07-25 23:33:07 +02:00
public:
Steam_Overlay(Settings* settings, SteamCallResults* callback_results, SteamCallBacks* callbacks, RunEveryRunCB* run_every_runcb, Networking *network);
2019-07-25 23:33:07 +02:00
~Steam_Overlay();
2019-07-25 23:33:07 +02:00
HWND GetGameHwnd() const;
2019-07-25 23:33:07 +02:00
bool Ready() const;
2019-07-25 23:33:07 +02:00
bool NeedPresent() const;
2019-07-25 23:33:07 +02:00
void SetNotificationPosition(ENotificationPosition eNotificationPosition);
2019-07-25 23:33:07 +02:00
void SetNotificationInset(int nHorizontalInset, int nVerticalInset);
void SetupOverlay();
2019-07-25 23:33:07 +02:00
void HookReady(void* hWnd);
2019-07-25 23:33:07 +02:00
void OverlayProc(int width, int height);
2019-07-25 23:33:07 +02:00
void OpenOverlayInvite(CSteamID lobbyId);
void OpenOverlay(const char* pchDialog);
2019-07-25 23:33:07 +02:00
void ShowOverlay(bool state);
2019-08-02 11:16:30 +02:00
2019-08-02 13:02:20 +02:00
void AddLobbyInvite(Friend friendId, uint64 lobbyId);
void AddRichInvite(Friend friendId, const char* connect_str);
2019-08-02 11:16:30 +02:00
void FriendConnect(Friend _friend);
void FriendDisconnect(Friend _friend);
};
2019-07-25 23:33:07 +02:00
#endif//__INCLUDED_STEAM_OVERLAY_H__