Skip to content

Commit bcb6a23

Browse files
committed
Fix Render_R1 do not load.
1 parent adfa5b3 commit bcb6a23

File tree

7 files changed

+27
-101
lines changed

7 files changed

+27
-101
lines changed

src/Layers/xrRenderPC_R1/xrRender_R1.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,5 @@ extern "C" void XR_EXPORT SetupEnv()
1414
#ifdef DEBUG
1515
GEnv.DRender = &DebugRenderImpl;
1616
#endif
17-
xrRender_initconsole();
18-
}
19-
20-
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
21-
{
22-
switch (ul_reason_for_call)
23-
{
24-
case DLL_PROCESS_ATTACH: SetupEnv(); break;
25-
case DLL_THREAD_ATTACH:
26-
case DLL_THREAD_DETACH:
27-
case DLL_PROCESS_DETACH: break;
28-
}
29-
return TRUE;
17+
xrRender_initconsole(); // XXX: Xottab_DUTY: move somewhere
3018
}

src/Layers/xrRenderPC_R2/xrRender_R2.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// xrRender_R2.cpp : Defines the entry point for the DLL application.
2-
//
31
#include "stdafx.h"
42
#include "Layers/xrRender/dxRenderFactory.h"
53
#include "Layers/xrRender/dxUIRender.h"
@@ -16,26 +14,10 @@ extern "C" void XR_EXPORT SetupEnv()
1614
#ifdef DEBUG
1715
GEnv.DRender = &DebugRenderImpl;
1816
#endif
19-
xrRender_initconsole();
17+
xrRender_initconsole(); // XXX: Xottab_DUTY: move somewhere
2018
}
2119

22-
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
23-
{
24-
switch (ul_reason_for_call)
25-
{
26-
case DLL_PROCESS_ATTACH: SetupEnv(); break;
27-
case DLL_THREAD_ATTACH:
28-
case DLL_THREAD_DETACH:
29-
case DLL_PROCESS_DETACH: break;
30-
}
31-
return TRUE;
32-
}
33-
34-
extern "C" {
35-
bool _declspec(dllexport) SupportsAdvancedRendering();
36-
};
37-
38-
bool _declspec(dllexport) SupportsAdvancedRendering()
20+
extern "C" bool XR_EXPORT SupportsAdvancedRendering()
3921
{
4022
D3DCAPS9 caps;
4123
CHW _HW;

src/Layers/xrRenderPC_R3/xrRender_R3.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// xrRender_R2.cpp : Defines the entry point for the DLL application.
2-
//
31
#include "stdafx.h"
42
#include "Layers/xrRender/dxRenderFactory.h"
53
#include "Layers/xrRender/dxUIRender.h"
@@ -16,26 +14,10 @@ extern "C" void XR_EXPORT SetupEnv()
1614
#ifdef DEBUG
1715
GEnv.DRender = &DebugRenderImpl;
1816
#endif
19-
xrRender_initconsole();
17+
xrRender_initconsole(); // XXX: Xottab_DUTY: move somewhere
2018
}
2119

22-
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
23-
{
24-
switch (ul_reason_for_call)
25-
{
26-
case DLL_PROCESS_ATTACH: SetupEnv(); break;
27-
case DLL_THREAD_ATTACH:
28-
case DLL_THREAD_DETACH:
29-
case DLL_PROCESS_DETACH: break;
30-
}
31-
return TRUE;
32-
}
33-
34-
extern "C" {
35-
bool _declspec(dllexport) SupportsDX10Rendering();
36-
};
37-
38-
bool _declspec(dllexport) SupportsDX10Rendering()
20+
extern "C" bool XR_EXPORT SupportsDX10Rendering()
3921
{
4022
return xrRender_test_hw() ? true : false;
4123
/*

src/Layers/xrRenderPC_R4/xrRender_R4.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// xrRender_R2.cpp : Defines the entry point for the DLL application.
2-
//
31
#include "stdafx.h"
42
#include "Layers/xrRender/dxRenderFactory.h"
53
#include "Layers/xrRender/dxUIRender.h"
@@ -19,23 +17,7 @@ extern "C" void XR_EXPORT SetupEnv()
1917
xrRender_initconsole(); // XXX: Xottab_DUTY: move somewhere
2018
}
2119

22-
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
23-
{
24-
switch (ul_reason_for_call)
25-
{
26-
case DLL_PROCESS_ATTACH: SetupEnv(); break;
27-
case DLL_THREAD_ATTACH:
28-
case DLL_THREAD_DETACH:
29-
case DLL_PROCESS_DETACH: break;
30-
}
31-
return TRUE;
32-
}
33-
34-
extern "C" {
35-
bool _declspec(dllexport) SupportsDX11Rendering();
36-
};
37-
38-
bool _declspec(dllexport) SupportsDX11Rendering()
20+
extern "C" bool XR_EXPORT SupportsDX11Rendering()
3921
{
4022
return xrRender_test_hw() ? true : false;
4123
/*

src/xrCore/ModuleLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace XRay
66
{
77
Module::Module(const bool dontUnload) : handle(nullptr), dontUnload(dontUnload) {}
88

9-
Module::Module(pcstr moduleName, bool dontUnload /*= false*/) : handle(nullptr)
9+
Module::Module(pcstr moduleName, bool dontUnload /*= false*/) : handle(nullptr), dontUnload(dontUnload)
1010
{
1111
open(moduleName);
1212
}

src/xrEngine/EngineAPI.cpp

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
#include "stdafx.h"
66
#include "EngineAPI.h"
7-
#include "xrCDB/xrXRC.h"
8-
#include "xrScriptEngine/script_engine.hpp"
97

108
#include "xrCore/ModuleLookup.hpp"
119

@@ -98,12 +96,10 @@ void CEngineAPI::InitializeRenderers()
9896
InitializeNotDedicated();
9997
#endif // DEDICATED_SERVER
10098

101-
if (!hRender->exist())
99+
if ((!hRender->exist()) | (!psDeviceFlags.test(rsR4|rsR3|rsR2)))
102100
{
103101
// try to load R1
104-
psDeviceFlags.set(rsR4, false);
105-
psDeviceFlags.set(rsR3, false);
106-
psDeviceFlags.set(rsR2, false);
102+
psDeviceFlags.set(rsR4|rsR3|rsR2, false);
107103
renderer_value = 0; // con cmd
108104

109105
hRender->open(r1_name);
@@ -158,19 +154,15 @@ void CEngineAPI::Initialize(void)
158154

159155
void CEngineAPI::Destroy(void)
160156
{
161-
pCreate = 0;
162-
pDestroy = 0;
157+
if (hGame) hGame->close();
158+
if (hTuner) hTuner->close();
159+
if (hRender) hRender->close();
160+
pCreate = nullptr;
161+
pDestroy = nullptr;
163162
Engine.Event._destroy();
164163
XRC.r_clear_compact();
165164
}
166165

167-
extern "C"
168-
{
169-
using SupportsAdvancedRendering = bool __cdecl();
170-
using SupportsDX10Rendering = bool XR_EXPORT();
171-
using SupportsDX11Rendering = bool XR_EXPORT();
172-
};
173-
174166
void CEngineAPI::CreateRendererList()
175167
{
176168
#ifdef DEDICATED_SERVER
@@ -208,10 +200,10 @@ void CEngineAPI::CreateRendererList()
208200
if (hRender->exist())
209201
{
210202
bSupports_r2 = true;
211-
auto test_rendering =
212-
(SupportsAdvancedRendering*)hRender->getProcAddress("SupportsAdvancedRendering");
213-
R_ASSERT(test_rendering);
214-
bSupports_r2_5 = test_rendering();
203+
using SupportsAdvancedRendering = bool(*)();
204+
auto test = (SupportsAdvancedRendering)hRender->getProcAddress("SupportsAdvancedRendering");
205+
R_ASSERT(test);
206+
bSupports_r2_5 = test();
215207
}
216208

217209
// try to initialize R3
@@ -222,10 +214,10 @@ void CEngineAPI::CreateRendererList()
222214
SetErrorMode(0);
223215
if (hRender->exist())
224216
{
225-
auto test_dx10_rendering =
226-
(SupportsDX10Rendering*)hRender->getProcAddress("SupportsDX10Rendering");
227-
R_ASSERT(test_dx10_rendering);
228-
bSupports_r3 = test_dx10_rendering();
217+
using SupportsDX10Rendering = bool(*)();
218+
auto test = (SupportsDX10Rendering)hRender->getProcAddress("SupportsDX10Rendering");
219+
R_ASSERT(test);
220+
bSupports_r3 = test();
229221
}
230222

231223
// try to initialize R4
@@ -236,10 +228,10 @@ void CEngineAPI::CreateRendererList()
236228
SetErrorMode(0);
237229
if (hRender->exist())
238230
{
239-
auto test_dx11_rendering =
240-
(SupportsDX11Rendering*)hRender->getProcAddress("SupportsDX11Rendering");
241-
R_ASSERT(test_dx11_rendering);
242-
bSupports_r4 = test_dx11_rendering();
231+
using SupportsDX11Rendering = bool(*)();
232+
auto test = (SupportsDX11Rendering)hRender->getProcAddress("SupportsDX11Rendering");
233+
R_ASSERT(test);
234+
bSupports_r4 = test();
243235
}
244236
}
245237

src/xrEngine/EngineAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ typedef void __cdecl VTResume(void);
4747
class ENGINE_API CEngineAPI
4848
{
4949
std::unique_ptr<XRay::Module> hGame;
50-
std::unique_ptr<XRay::Module> hRender;
5150
std::unique_ptr<XRay::Module> hTuner;
51+
std::unique_ptr<XRay::Module> hRender;
5252

5353
public:
5454
BENCH_SEC_SCRAMBLEMEMBER1

0 commit comments

Comments
 (0)