MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / WinMain

Function WinMain

TombEngine/Specific/winmain.cpp:545–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545int 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.

Callers 1

mainFunction · 0.85

Calls 15

CheckIfRedistInstalledFunction · 0.85
ArgEqualsFunction · 0.85
ToStringFunction · 0.85
ConstructAssetDirectoryFunction · 0.85
InitTENLogFunction · 0.85
GetProductOrFileVersionFunction · 0.85
to_stringFunction · 0.85
TENLogFunction · 0.85
ShowExternalMessageBoxFunction · 0.85
ShutdownTENLogFunction · 0.85
DisableDpiAwarenessFunction · 0.85
InitDefaultConfigurationFunction · 0.85

Tested by

no test coverage detected