-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReceiver.h
More file actions
67 lines (56 loc) · 1.99 KB
/
Receiver.h
File metadata and controls
67 lines (56 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
// ============================================================
// Receiver.h - High-Compatibility DX11 Hijack
// ============================================================
#include "NetworkFuser.h"
struct IocpRecvContext;
class ReceiverModule
{
public:
explicit ReceiverModule(const FuserConfig& cfg);
~ReceiverModule();
bool Init();
void Run();
void Stop();
private:
bool CreateOverlayWindow();
bool InitDX11();
bool InitSocket();
void ReleaseDX11();
void RecvThreadProc();
void RenderThreadProc();
void RenderFrame(const uint8_t* bgra, uint32_t fw, uint32_t fh);
void PumpMessages();
// Config
FuserConfig m_cfg;
// Network
SOCKET m_sock = INVALID_SOCKET;
std::atomic<bool> m_running{false};
std::thread m_recvThread;
// Frame hand-off
std::mutex m_frameMtx;
std::condition_variable m_frameCv;
std::vector<uint8_t> m_pendingFrame;
uint32_t m_pendingW = 0;
uint32_t m_pendingH = 0;
bool m_frameReady = false;
// Window
HWND m_hwndOverlay = nullptr;
HWND m_hwndParent = nullptr;
UINT m_overlayW = 0;
UINT m_overlayH = 0;
// DirectX 11
ID3D11Device* m_d3dDevice = nullptr;
ID3D11DeviceContext* m_d3dContext = nullptr;
IDXGISwapChain* m_swapChain = nullptr;
ID3D11RenderTargetView* m_renderTargetView = nullptr;
ID3D11Texture2D* m_uploadTex = nullptr;
ID3D11ShaderResourceView* m_shaderResView = nullptr;
ID3D11VertexShader* m_vertexShader = nullptr;
ID3D11PixelShader* m_pixelShader = nullptr;
ID3D11SamplerState* m_sampler = nullptr;
ID3D11BlendState* m_blendState = nullptr;
D3D11_VIEWPORT m_viewport{};
uint32_t m_frameWidth = 0;
uint32_t m_frameHeight = 0;
};