goldberg_emulator/overlay_experimental/steam_overlay.h

115 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>
#include <vector>
2019-07-25 23:33:07 +02:00
enum friend_action
{
friend_action_none = 0,
friend_action_invite = 1<<0,
friend_action_join = 1<<1
};
2019-07-25 23:33:07 +02:00
2019-08-02 11:16:30 +02:00
enum invitation_type
{
invitation_type_lobby,
invitation_type_rich
};
struct invitation
{
uint8 type;
uint64 friendId;
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)
std::map<Friend, bool, 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;
2019-08-02 11:16:30 +02:00
std::vector<invitation> invitations;
// Callback infos
uint64 friend_to_action;
int 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
void AddLobbyInvite(uint64 friendId, uint64 lobbyId);
void AddRichInvite(uint64 friendId, const char* connect_str);
void FriendConnect(Friend _friend);
void FriendDisconnect(Friend _friend);
};
2019-07-25 23:33:07 +02:00
#endif//__INCLUDED_STEAM_OVERLAY_H__