|
1 | 1 | #include "stdafx.h"
|
2 |
| -#include "xrCore/xr_ini.h" |
3 |
| -#include <process.h> |
4 | 2 | #include "xrAI.h"
|
5 | 3 |
|
6 |
| -#include "xr_graph_merge.h" |
7 | 4 | #include "game_spawn_constructor.h"
|
8 |
| -#include "xrCrossTable.h" |
9 | 5 |
|
10 |
| -#include "game_graph_builder.h" |
11 | 6 | #include <mmsystem.h>
|
12 |
| -#include "spawn_patcher.h" |
13 | 7 |
|
14 | 8 | #pragma comment(linker, "/STACK:0x800000,0x400000")
|
15 | 9 |
|
|
18 | 12 | #include "xrCore/cdecl_cast.hpp"
|
19 | 13 | #include "xrCore/ModuleLookup.hpp"
|
20 | 14 |
|
| 15 | +#include "factory_api.h" |
| 16 | + |
| 17 | +Factory_Create* create_entity = 0; |
| 18 | +Factory_Destroy* destroy_entity = 0; |
| 19 | + |
21 | 20 | LevelCompilerLoggerWindow& Logger = LevelCompilerLoggerWindow();
|
22 | 21 |
|
23 | 22 | CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
|
@@ -126,7 +125,25 @@ void execute(LPSTR cmd)
|
126 | 125 | }
|
127 | 126 | char* no_separator_check = strstr(cmd, "-no_separator_check");
|
128 | 127 | clear_temp_folder();
|
| 128 | + |
| 129 | + const auto hFactory = std::make_unique<XRay::Module>("xrSE_Factory"); |
| 130 | + |
| 131 | + if (!hFactory->exist()) |
| 132 | + R_CHK(GetLastError()); |
| 133 | + R_ASSERT2(hFactory->exist(), "Factory DLL raised exception during loading or there is no factory DLL at all"); |
| 134 | + |
| 135 | + create_entity = (Factory_Create*)hFactory->getProcAddress("_create_entity@4"); |
| 136 | + R_ASSERT(create_entity); |
| 137 | + |
| 138 | + destroy_entity = (Factory_Destroy*)hFactory->getProcAddress("_destroy_entity@4"); |
| 139 | + R_ASSERT(destroy_entity); |
| 140 | + |
129 | 141 | CGameSpawnConstructor(name, output, start, !!no_separator_check);
|
| 142 | + |
| 143 | + hFactory->close(); |
| 144 | + |
| 145 | + create_entity = nullptr; |
| 146 | + destroy_entity = nullptr; |
130 | 147 | }
|
131 | 148 | else if (strstr(cmd, "-verify"))
|
132 | 149 | {
|
@@ -169,32 +186,13 @@ void Startup(LPSTR lpCmdLine)
|
169 | 186 | Logger.Destroy();
|
170 | 187 | }
|
171 | 188 |
|
172 |
| -#include "factory_api.h" |
173 |
| - |
174 |
| -Factory_Create* create_entity = 0; |
175 |
| -Factory_Destroy* destroy_entity = 0; |
176 |
| - |
177 | 189 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
178 | 190 | {
|
179 | 191 | xrDebug::Initialize(false);
|
180 | 192 | Core.Initialize("xrai", 0);
|
181 | 193 |
|
182 |
| - const auto hFactory = std::make_unique<XRay::Module>("xrSE_Factory"); |
183 |
| - |
184 |
| - if (!hFactory->exist()) |
185 |
| - R_CHK(GetLastError()); |
186 |
| - R_ASSERT2(hFactory->exist(), "Factory DLL raised exception during loading or there is no factory DLL at all"); |
187 |
| - |
188 |
| - create_entity = (Factory_Create*)hFactory->getProcAddress("_create_entity@4"); |
189 |
| - R_ASSERT(create_entity); |
190 |
| - |
191 |
| - destroy_entity = (Factory_Destroy*)hFactory->getProcAddress("_destroy_entity@4"); |
192 |
| - R_ASSERT(destroy_entity); |
193 |
| - |
194 | 194 | Startup(lpCmdLine);
|
195 | 195 |
|
196 |
| - hFactory->close(); |
197 |
| - |
198 | 196 | Core._destroy();
|
199 | 197 |
|
200 | 198 | return (0);
|
|
0 commit comments