Skip to content

Commit d98408f

Browse files
committed
xrEngine: separate xrRender_R* and xrGame initialization
A bit of cleanup
1 parent 6d4d007 commit d98408f

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

src/xrEngine/EngineAPI.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,21 @@ void CEngineAPI::InitializeRenderers()
130130

131131
void CEngineAPI::Initialize(void)
132132
{
133-
InitializeRenderers();
133+
hGame = std::make_unique<XRay::Module>("xrGame");
134134

135-
// game
136-
{
137-
constexpr pcstr g_name = "xrGame";
138-
hGame = std::make_unique<XRay::Module>(g_name);
139-
140-
if (!hGame->exist())
141-
R_CHK(GetLastError());
142-
R_ASSERT2(hGame, "Game DLL raised exception during loading or there is no game DLL at all");
135+
if (!hGame->exist())
136+
R_CHK(GetLastError());
137+
R_ASSERT2(hGame, "Game DLL raised exception during loading or there is no game DLL at all");
143138

144-
pCreate = (Factory_Create*)hGame->getProcAddress("xrFactory_Create");
145-
R_ASSERT(pCreate);
139+
pCreate = (Factory_Create*)hGame->getProcAddress("xrFactory_Create");
140+
R_ASSERT(pCreate);
146141

147-
pDestroy = (Factory_Destroy*)hGame->getProcAddress("xrFactory_Destroy");
148-
R_ASSERT(pDestroy);
149-
}
142+
pDestroy = (Factory_Destroy*)hGame->getProcAddress("xrFactory_Destroy");
143+
R_ASSERT(pDestroy);
150144

151145
//////////////////////////////////////////////////////////////////////////
152146
// vTune
153-
tune_enabled = FALSE;
147+
tune_enabled = false;
154148
if (strstr(Core.Params, "-tune"))
155149
{
156150
constexpr pcstr g_name = "vTuneAPI";
@@ -194,11 +188,11 @@ void CEngineAPI::CreateRendererList()
194188
vid_quality_token[0].name = xr_strdup("renderer_r1");
195189

196190
vid_quality_token[1].id = -1;
197-
vid_quality_token[1].name = NULL;
191+
vid_quality_token[1].name = nullptr;
198192

199193
#else
200194
// TODO: ask renderers if they are supported!
201-
if (vid_quality_token != NULL)
195+
if (vid_quality_token != nullptr)
202196
return;
203197
bool bSupports_r2 = false;
204198
bool bSupports_r2_5 = false;

src/xrEngine/EngineAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ENGINE_API CEngineAPI
5454
BENCH_SEC_SCRAMBLEMEMBER1
5555
Factory_Create* pCreate;
5656
Factory_Destroy* pDestroy;
57-
BOOL tune_enabled;
57+
bool tune_enabled;
5858
VTPause* tune_pause;
5959
VTResume* tune_resume;
6060
void Initialize();

src/xrEngine/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ void InitEngine()
4242
Device.Initialize();
4343
}
4444

45-
static void InitEngineExt() { Engine.External.Initialize(); }
4645
namespace
4746
{
4847
struct PathIncludePred
@@ -393,7 +392,8 @@ int RunApplication(pcstr commandLine)
393392
#else
394393
Console->Execute("renderer renderer_r1");
395394
#endif
396-
InitEngineExt(); // load xrRender and xrGame
395+
Engine.External.InitializeRenderers();
396+
Engine.External.Initialize();
397397
Startup();
398398
Core._destroy();
399399
// check for need to execute something external

0 commit comments

Comments
 (0)