Skip to content

Commit

Permalink
Export engine startup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Feb 5, 2018
1 parent 43445e5 commit 235f697
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
25 changes: 13 additions & 12 deletions src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Entry point is in xr_3da/entry_point.cpp
#include "stdafx.h"
#include "main.h"
#include "xr_3da/resource.h"

#include <process.h>
Expand Down Expand Up @@ -38,7 +39,7 @@ HWND logoWindow = nullptr;
void RunBenchmark(pcstr name);
}

void InitEngine()
ENGINE_API void InitEngine()
{
Engine.Initialize();
Device.Initialize();
Expand All @@ -62,7 +63,7 @@ struct PathIncludePred
};
}

void InitSettings()
ENGINE_API void InitSettings()
{
string_path fname;
FS.update_path(fname, "$game_config$", "system.ltx");
Expand All @@ -84,7 +85,7 @@ void InitSettings()
make_string("Cannot find file %s.\nReinstalling application may fix this problem.", fname));
}

void InitConsole()
ENGINE_API void InitConsole()
{
if (GEnv.isDedicatedServer)
Console = new CTextConsole();
Expand All @@ -101,16 +102,16 @@ void InitConsole()
}
}

void InitInput()
ENGINE_API void InitInput()
{
bool captureInput = !strstr(Core.Params, "-i");
pInput = new CInput(captureInput);
}

void destroyInput() { xr_delete(pInput); }
void InitSound() { ISoundManager::_create(); }
void destroySound() { ISoundManager::_destroy(); }
void destroySettings()
ENGINE_API void destroyInput() { xr_delete(pInput); }
ENGINE_API void InitSound() { ISoundManager::_create(); }
ENGINE_API void destroySound() { ISoundManager::_destroy(); }
ENGINE_API void destroySettings()
{
auto s = const_cast<CInifile**>(&pSettings);
xr_delete(*s);
Expand All @@ -119,14 +120,14 @@ void destroySettings()
xr_delete(pGameIni);
}

void destroyConsole()
ENGINE_API void destroyConsole()
{
Console->Execute("cfg_save");
Console->Destroy();
xr_delete(Console);
}

void destroyEngine()
ENGINE_API void destroyEngine()
{
Device.Destroy();
Engine.Destroy();
Expand Down Expand Up @@ -161,7 +162,7 @@ void CheckPrivilegySlowdown()
#endif
}

void Startup()
ENGINE_API void Startup()
{
execUserScript();
InitSound();
Expand Down Expand Up @@ -226,7 +227,7 @@ static INT_PTR CALLBACK LogoWndProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
return true;
}

XR_EXPORT int RunApplication(pcstr commandLine)
ENGINE_API int RunApplication(pcstr commandLine)
{
if (strstr(commandLine, "-nosplash") == 0)
{
Expand Down
19 changes: 19 additions & 0 deletions src/xrEngine/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

ENGINE_API void InitEngine();
ENGINE_API void destroyEngine();

ENGINE_API void InitSettings();
ENGINE_API void destroySettings();

ENGINE_API void InitConsole();
ENGINE_API void destroyConsole();

ENGINE_API void InitInput();
ENGINE_API void destroyInput();

ENGINE_API void InitSound();
ENGINE_API void destroySound();

ENGINE_API void Startup();
ENGINE_API int RunApplication(pcstr commandLine);
1 change: 1 addition & 0 deletions src/xrEngine/xrEngine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
<ClInclude Include="LightAnimLibrary.h" />
<ClInclude Include="line_editor.h" />
<ClInclude Include="line_edit_control.h" />
<ClInclude Include="main.h" />
<ClInclude Include="mp_logging.h" />
<ClInclude Include="ObjectAnimator.h" />
<ClInclude Include="ObjectDump.h" />
Expand Down
1 change: 1 addition & 0 deletions src/xrEngine/xrEngine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@
<ClInclude Include="profiler_inline.h">
<Filter>General\Profiler</Filter>
</ClInclude>
<ClInclude Include="main.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="defines.cpp">
Expand Down
5 changes: 1 addition & 4 deletions src/xr_3da/entry_point.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#include "stdafx.h"
#include "resource.h"

#include "StickyKeyFilter.hpp"
#include "xrCore/xrCore.h"
#include "xrCore/xrDebug_macros.h"

extern ENGINE_API int RunApplication(pcstr);
#include "xrEngine/main.h"

int entry_point(pcstr commandLine)
{
Expand Down
1 change: 1 addition & 0 deletions src/xr_3da/stdafx.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once

#include "Common/Common.hpp"
#include "xrCore/xrCore.h"

0 comments on commit 235f697

Please sign in to comment.