Skip to content

Commit 14baeb3

Browse files
committed
Renamed def files and fixed issue with debug layer.
1 parent 08f42f4 commit 14baeb3

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed
File renamed without changes.

dxgi/dllmain.cpp

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#define WIN32_LEAN_AND_MEAN
22
#include <windows.h>
33

4+
using Compat_t = void*(WINAPI *)();
5+
Compat_t RealCompatValue = nullptr;
6+
Compat_t RealCompatString = nullptr;
7+
48
typedef HRESULT(WINAPI* DXGIFactoryCreate0)(REFIID riid, void** ppFactory);
59
typedef HRESULT(WINAPI* DXGIFactoryCreate1)(REFIID riid, void** ppFactory);
610
typedef HRESULT(WINAPI* DXGIFactoryCreate2)(UINT Flags, REFIID riid, void** ppFactory);
@@ -62,21 +66,29 @@ FARPROC GetDXGIFunction(LPCSTR name)
6266

6367
extern "C" void* WINAPI CompatValue()
6468
{
65-
static auto func = GET_DXGI_FUNC(CompatValue);
66-
return func();
69+
return RealCompatValue();
6770
}
6871

6972
extern "C" void* WINAPI CompatString()
7073
{
71-
static auto func = GET_DXGI_FUNC(CompatString);
72-
return func();
74+
return RealCompatString();
7375
}
7476

7577
BOOL APIENTRY DllMain( HMODULE hModule,
76-
DWORD ul_reason_for_call,
78+
DWORD fdwReason,
7779
LPVOID lpReserved
7880
)
7981
{
80-
return TRUE;
82+
switch (fdwReason)
83+
{
84+
case DLL_PROCESS_ATTACH:
85+
RealCompatValue = GET_DXGI_FUNC(CompatValue);
86+
RealCompatString = GET_DXGI_FUNC(CompatString);
87+
break;
88+
case DLL_PROCESS_DETACH:
89+
RealCompatValue = nullptr;
90+
RealCompatString = nullptr;
91+
break;
92+
}
8193
}
8294

dxgi/dxgi.vcxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<OptimizeReferences>true</OptimizeReferences>
9898
<GenerateDebugInformation>true</GenerateDebugInformation>
9999
<EnableUAC>false</EnableUAC>
100-
<ModuleDefinitionFile>deffile</ModuleDefinitionFile>
100+
<ModuleDefinitionFile>deffile.def</ModuleDefinitionFile>
101101
</Link>
102102
<PostBuildEvent>
103103
<Command>IF DEFINED GW2_INSTALL_DIR (
@@ -135,7 +135,7 @@ xcopy "$(TargetPath)" "$(GW2_INSTALL_DIR)\" /Y
135135
<SubSystem>Windows</SubSystem>
136136
<GenerateDebugInformation>true</GenerateDebugInformation>
137137
<EnableUAC>false</EnableUAC>
138-
<ModuleDefinitionFile>deffile</ModuleDefinitionFile>
138+
<ModuleDefinitionFile>deffile.def</ModuleDefinitionFile>
139139
</Link>
140140
<PostBuildEvent>
141141
<Command>IF DEFINED GW2_INSTALL_DIR (
@@ -170,7 +170,7 @@ xcopy "$(TargetPath)" "$(GW2_INSTALL_DIR)\" /Y
170170
<ClCompile Include="dllmain.cpp" />
171171
</ItemGroup>
172172
<ItemGroup>
173-
<None Include="deffile" />
173+
<None Include="deffile.def" />
174174
</ItemGroup>
175175
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
176176
<ImportGroup Label="ExtensionTargets">
File renamed without changes.

loader_core/loader_core.vcxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ xcopy "$(TargetPath)" "$(GW2_INSTALL_DIR)\" /Y
120120
<Link>
121121
<SubSystem>Windows</SubSystem>
122122
<GenerateDebugInformation>true</GenerateDebugInformation>
123-
<ModuleDefinitionFile>deffile</ModuleDefinitionFile>
123+
<ModuleDefinitionFile>deffile.def</ModuleDefinitionFile>
124124
</Link>
125125
<PostBuildEvent>
126126
<Command>IF DEFINED GW2_INSTALL_DIR (
@@ -168,7 +168,7 @@ xcopy "$(TargetPath)" "$(GW2_INSTALL_DIR)\" /Y
168168
<EnableCOMDATFolding>true</EnableCOMDATFolding>
169169
<OptimizeReferences>true</OptimizeReferences>
170170
<GenerateDebugInformation>true</GenerateDebugInformation>
171-
<ModuleDefinitionFile>deffile</ModuleDefinitionFile>
171+
<ModuleDefinitionFile>deffile.def</ModuleDefinitionFile>
172172
</Link>
173173
<PostBuildEvent>
174174
<Command>IF DEFINED GW2_INSTALL_DIR (
@@ -204,7 +204,7 @@ xcopy "$(TargetPath)" "$(GW2_INSTALL_DIR)\" /Y
204204
</ClCompile>
205205
</ItemGroup>
206206
<ItemGroup>
207-
<None Include="deffile" />
207+
<None Include="deffile.def" />
208208
</ItemGroup>
209209
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
210210
<ImportGroup Label="ExtensionTargets">

loader_core/loader_core.vcxproj.filters

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@
6262
</ClCompile>
6363
</ItemGroup>
6464
<ItemGroup>
65-
<None Include="deffile" />
65+
<None Include="deffile.def" />
6666
</ItemGroup>
6767
</Project>

0 commit comments

Comments
 (0)