This repository has been archived by the owner on Jan 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlgvs_detours.h
91 lines (62 loc) · 2.19 KB
/
lgvs_detours.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
87
88
89
90
91
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
#ifndef LGVS_DETOURS_H
#define LGVS_DETOURS_H
#include <string>
#include <d3d9.h>
namespace lgvs {
class Detours {
public:
typedef HRESULT (STDMETHODCALLTYPE* FP_D3DD9_END_SCENE)(
LPDIRECT3DDEVICE9 self);
typedef HRESULT (STDMETHODCALLTYPE* FP_D3DD9_TEST_COOP_LEVEL)(
LPDIRECT3DDEVICE9 self);
typedef HRESULT (STDMETHODCALLTYPE* FP_D3DD9_RESET)(
LPDIRECT3DDEVICE9 self,
D3DPRESENT_PARAMETERS* presentation_parameters);
Detours();
~Detours();
bool initialize(
FP_D3DD9_END_SCENE fake_end_scene,
FP_D3DD9_TEST_COOP_LEVEL fake_test_coop_level,
FP_D3DD9_RESET fake_reset);
void uninitialize();
bool is_initialized() const;
const std::wstring& get_error_string() const;
HRESULT STDMETHODCALLTYPE d3dd9_end_scene(
LPDIRECT3DDEVICE9 self);
HRESULT STDMETHODCALLTYPE d3dd9_test_coop_level(
LPDIRECT3DDEVICE9 self);
HRESULT STDMETHODCALLTYPE d3dd9_reset(
LPDIRECT3DDEVICE9 self,
D3DPRESENT_PARAMETERS* presentation_parameters);
private:
bool is_initialized_;
bool is_detoured_;
std::wstring error_string_;
HMODULE d3d9_library_;
FP_D3DD9_END_SCENE fake_end_scene_;
FP_D3DD9_TEST_COOP_LEVEL fake_test_coop_level_;
FP_D3DD9_RESET fake_reset_;
FP_D3DD9_END_SCENE real_end_scene_;
FP_D3DD9_TEST_COOP_LEVEL real_test_coop_level_;
FP_D3DD9_RESET real_reset_;
Detours(
const Detours& that);
Detours& operator=(
const Detours& that);
}; // class Detours
} // namespace lgvs
#endif // LGVS_DETOURS_H