|
1 | 1 | // Entry point is in xr_3da/entry_point.cpp |
2 | 2 | #include "stdafx.h" |
3 | 3 | #include "main.h" |
4 | | -#include "xr_3da/resource.h" |
5 | 4 |
|
6 | 5 | #include <process.h> |
7 | 6 | #include <locale.h> |
@@ -33,6 +32,7 @@ ENGINE_API string_path g_sLaunchWorkingFolder; |
33 | 32 |
|
34 | 33 | namespace |
35 | 34 | { |
| 35 | +bool CheckBenchmark(); |
36 | 36 | void RunBenchmark(pcstr name); |
37 | 37 | } |
38 | 38 |
|
@@ -231,26 +231,8 @@ ENGINE_API int RunApplication() |
231 | 231 | InitConsole(); |
232 | 232 | Engine.External.CreateRendererList(); |
233 | 233 |
|
234 | | - pcstr benchName = "-batch_benchmark "; |
235 | | - if (strstr(Core.Params, benchName)) |
236 | | - { |
237 | | - u32 sz = xr_strlen(benchName); |
238 | | - string64 benchmarkName; |
239 | | - sscanf(strstr(Core.Params, benchName) + sz, "%[^ ] ", benchmarkName); |
240 | | - RunBenchmark(benchmarkName); |
241 | | - return 0; |
242 | | - } |
243 | | - |
244 | | - pcstr sashName = "-openautomate "; |
245 | | - if (strstr(Core.Params, sashName)) |
246 | | - { |
247 | | - u32 sz = xr_strlen(sashName); |
248 | | - string512 sashArg; |
249 | | - sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg); |
250 | | - g_SASH.Init(sashArg); |
251 | | - g_SASH.MainLoop(); |
| 234 | + if (CheckBenchmark()) |
252 | 235 | return 0; |
253 | | - } |
254 | 236 |
|
255 | 237 | if (!GEnv.isDedicatedServer) |
256 | 238 | { |
@@ -295,13 +277,38 @@ ENGINE_API int RunApplication() |
295 | 277 |
|
296 | 278 | namespace |
297 | 279 | { |
| 280 | +bool CheckBenchmark() |
| 281 | +{ |
| 282 | + pcstr benchName = "-batch_benchmark "; |
| 283 | + if (strstr(Core.Params, benchName)) |
| 284 | + { |
| 285 | + const u32 sz = xr_strlen(benchName); |
| 286 | + string64 benchmarkName; |
| 287 | + sscanf(strstr(Core.Params, benchName) + sz, "%[^ ] ", benchmarkName); |
| 288 | + RunBenchmark(benchmarkName); |
| 289 | + return true; |
| 290 | + } |
| 291 | + |
| 292 | + pcstr sashName = "-openautomate "; |
| 293 | + if (strstr(Core.Params, sashName)) |
| 294 | + { |
| 295 | + const u32 sz = xr_strlen(sashName); |
| 296 | + string512 sashArg; |
| 297 | + sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg); |
| 298 | + g_SASH.Init(sashArg); |
| 299 | + g_SASH.MainLoop(); |
| 300 | + return true; |
| 301 | + } |
| 302 | + |
| 303 | + return false; |
| 304 | +} |
298 | 305 | void RunBenchmark(pcstr name) |
299 | 306 | { |
300 | 307 | g_bBenchmark = true; |
301 | 308 | string_path cfgPath; |
302 | 309 | FS.update_path(cfgPath, "$app_data_root$", name); |
303 | 310 | CInifile ini(cfgPath); |
304 | | - u32 benchmarkCount = ini.line_count("benchmark"); |
| 311 | + const u32 benchmarkCount = ini.line_count("benchmark"); |
305 | 312 | for (u32 i = 0; i < benchmarkCount; i++) |
306 | 313 | { |
307 | 314 | LPCSTR benchmarkName, t; |
|
0 commit comments