forked from lStewieAl/Geck-Extender
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugCellShaders.h
More file actions
139 lines (124 loc) · 2.49 KB
/
DebugCellShaders.h
File metadata and controls
139 lines (124 loc) · 2.49 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#pragma once
_declspec(naked) void DebugShaderHook925E80()
{
static const UInt32 debugAddr = 0x925E8D;
static const UInt32 retnAddr = 0x925ECE;
_asm
{
mov eax, [0xF23C04] // g_renderWindowShaderDebugFlags
cmp eax, 1
jl noDebugFlags
cmp eax, 6
jg noDebugFlags
jmp debugAddr
noDebugFlags :
mov ecx, [0xF23C30]
jmp retnAddr
}
}
_declspec(naked) void DebugShaderHook9261D0()
{
static const UInt32 debugAddr = 0x9261EB;
static const UInt32 retnAddr = 0x926229;
_asm
{
mov eax, [0xF23C04] // g_renderWindowShaderDebugFlags
cmp eax, 1
jl noDebugFlags
cmp eax, 6
jg noDebugFlags
jmp debugAddr
noDebugFlags :
mov esi, [edi + 0xF8]
jmp retnAddr
}
}
_declspec(naked) void DebugShaderHook952F60()
{
static const UInt32 debugAddr = 0x9538D5;
static const UInt32 retnAddr = 0x95374A;
_asm
{
je debugFlags
mov eax, [0xF23C04] // g_renderWindowShaderDebugFlags
test eax, eax
jne debugFlags
jmp retnAddr
debugFlags :
jmp debugAddr
}
}
_declspec(naked) void DebugShaderHook965B40()
{
static const UInt32 retnAddr = 0x965B78;
_asm
{
mov eax, [0xF23C04] // g_renderWindowShaderDebugFlags
cmp eax, 6
ja debugFlags
cmp edi, 0x1BD
jb noDebug
cmp edi, 0x1E1
jbe debugFlags
noDebug:
mov ecx, [0xF983E4]
mov edx, [ecx + 0x24]
mov eax, [edx]
test eax, eax
je jmp1
mov ecx, [0xF23F80]
mov[eax + 8], ecx
jmp1:
mov edx, [0xF983E4]
mov eax, [edx + 0x24]
mov eax, [eax + 4]
test eax, eax
je done
mov ecx, [0xF23F60]
mov[eax + 8], ecx
jmp done
debugFlags:
mov edx, [esi]
mov eax, [edx + 0x13C]
push ebx
push edi
call eax
done:
jmp retnAddr
}
}
_declspec(naked) void DebugShaderHook9661C0()
{
_asm
{
mov eax, [0xF23C04] // g_renderWindowShaderDebugFlags
cmp eax, 1
je shader1
cmp eax, 2
je shader2
cmp eax, 4
je shader4
cmp eax, 5
je shader5
shader1:
shader2:
shader4:
shader5:
// done
add esp, 0x10
ret 8
}
}
void RestoreRenderWindowDebugShaders()
{
WriteRelJump(0x925EC8, UInt32(DebugShaderHook925E80));
WriteRelJump(0x926223, UInt32(DebugShaderHook9261D0));
WriteRelJump(0x953744, UInt32(DebugShaderHook952F60));
WriteRelJump(0x965B6C, UInt32(DebugShaderHook965B40));
WriteRelJump(0x965B6C, UInt32(DebugShaderHook965B40));
// add in switch statements
WriteRelJump(0x9663C0, UInt32(DebugShaderHook9661C0));
WriteRelJump(0x9663D0, UInt32(DebugShaderHook9661C0));
WriteRelJump(0x966336, UInt32(DebugShaderHook9661C0));
// still need to add the two switch statements in sub_94DA90 and sub_9661C0
}