| 543 | } |
| 544 | |
| 545 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) |
| 546 | { |
| 547 | CheckIfRedistInstalled(); |
| 548 | |
| 549 | // Process command line arguments. |
| 550 | bool setup = false; |
| 551 | std::string levelFile = {}; |
| 552 | LPWSTR* argv; |
| 553 | int argc; |
| 554 | argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
| 555 | std::string gameDir{}; |
| 556 | |
| 557 | // Parse command line arguments. |
| 558 | for (int i = 1; i < argc; i++) |
| 559 | { |
| 560 | if (ArgEquals(argv[i], "setup")) |
| 561 | { |
| 562 | setup = true; |
| 563 | } |
| 564 | else if (ArgEquals(argv[i], "debug")) |
| 565 | { |
| 566 | DebugMode = true; |
| 567 | } |
| 568 | else if (ArgEquals(argv[i], "level") && argc > (i + 1)) |
| 569 | { |
| 570 | levelFile = TEN::Utils::ToString(argv[i + 1]); |
| 571 | } |
| 572 | else if (ArgEquals(argv[i], "hash") && argc > (i + 1)) |
| 573 | { |
| 574 | SystemNameHash = std::stoul(std::wstring(argv[i + 1])); |
| 575 | } |
| 576 | else if (ArgEquals(argv[i], "gamedir") && argc > (i + 1)) |
| 577 | { |
| 578 | gameDir = TEN::Utils::ToString(argv[i + 1]); |
| 579 | } |
| 580 | } |
| 581 | LocalFree(argv); |
| 582 | |
| 583 | // Construct asset directory. |
| 584 | gameDir = ConstructAssetDirectory(gameDir); |
| 585 | |
| 586 | // Hide console window if mode isn't debug. |
| 587 | #if !_DEBUG |
| 588 | if (!DebugMode) |
| 589 | { |
| 590 | FreeConsole(); |
| 591 | } |
| 592 | else |
| 593 | #endif |
| 594 | { |
| 595 | // Set console to UTF-8 mode for proper Unicode character display. |
| 596 | SetConsoleOutputCP(CP_UTF8); |
| 597 | SetConsoleCP(CP_UTF8); |
| 598 | |
| 599 | ConsoleThreadHandle = BeginThread(ConsoleInput, ConsoleThreadID); |
| 600 | } |
| 601 | |
| 602 | // Clear application structure. |
no test coverage detected