forked from ToxSylph/SeaOfChoros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
86 lines (64 loc) · 2.57 KB
/
main.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include "tslib/tslib.h"
#include "HookLib/Hooklib.h"
#include "engine.h"
#include <vector>
#include <filesystem>
#pragma comment(lib, "HookLib/Hooklib.lib")
#pragma comment(lib, "HookLib/Zydis.lib")
constexpr tslog::level LOG_LEVEL_TARGET = tslog::level::LOG; // { 0:VERBOSE, 1:LOG, 2:INFO, 3:WARNINGS, 4:ERRORS, 5:CRITICAL, 6:DEBUG, 7:OFF }
constexpr bool SHOULD_ALLOC_CONSOLE = true;
#define safe_release(x) if(x) { x->Release(); x = nullptr; }
namespace fs = std::filesystem;
static DWORD mSize = 0;
static uintptr_t dxgi = NULL;
static HINSTANCE g_hInstance = NULL;
static bool g_Running = false;
static bool g_ShowMenu = false;
static HWND g_TargetWindow = NULL;
static MODULEINFO g_BaseModule;
static ID3D11Device* device = nullptr;
static ID3D11DeviceContext* context = nullptr;
static ID3D11RenderTargetView* rtv = nullptr;
bool init();
bool end();
void run();
bool getBaseModule();
void getModule();
void hookPresent();
void hookResizeBuffer();
void clearDX11Objects();
uintptr_t findGWorld();
uintptr_t findGObjects();
uintptr_t findGNames();
HRESULT presentHook(IDXGISwapChain* swapChain, UINT syncInterval, UINT flags);
typedef HRESULT(*DX11Present)(IDXGISwapChain* swapChain, UINT syncInterval, UINT flags);
DX11Present oDX11Present = nullptr;
HRESULT resizeBufferHook(IDXGISwapChain * swapChain, UINT bufferCount, UINT width, UINT height, DXGI_FORMAT newFormat, UINT swapChainFlags);
typedef HRESULT(*DX11ResizeBuffer)(IDXGISwapChain* swapChain, UINT bufferCount, UINT width, UINT height, DXGI_FORMAT newFormat, UINT swapChainFlags);
DX11ResizeBuffer oDX11ResizeBuffer = nullptr;
// LRESULT CALLBACK windowProcHook(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
WNDPROC oWindowProc = nullptr;
LRESULT CALLBACK windowProcHookEx(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
// WINDOWS DEBUG HELPERS
HCURSOR WINAPI hkSetCursor(HCURSOR hCursor);
BOOL WINAPI hkSetCursorPos(int x, int y);
typedef HCURSOR(WINAPI* fnSetCursor)(HCURSOR hCursor);
typedef BOOL(WINAPI* fnSetCursorPos)(int x, int y);
fnSetCursor oSetCursor = nullptr;
fnSetCursorPos oSetCursorPos = nullptr;
/*
BOOL WINAPI hkClipCursor(const RECT* lpRect);
typedef BOOL(WINAPI* fnClipCursor)(const RECT* lpRect);
fnClipCursor oClipCursor;
BOOL WINAPI hkReleaseCursor();
typedef BOOL(WINAPI* fnReleaseCursor)();
fnReleaseCursor oReleaseCursor;
HWND WINAPI hkSetCapture(HWND hWnd);
typedef HWND(WINAPI* fnSetCapture)(HWND hWnd);
fnSetCapture oSetCapture;
BOOL WINAPI hkGetClipCursor(LPRECT lpRect);
typedef BOOL(WINAPI* fnGetClipCursor)(LPRECT lpRect);
fnGetClipCursor oGetClipCursor;
*/
// END WINDOWS DEBUG HELPERS