mirror of
https://github.com/BanjoRecomp/BanjoRecomp
synced 2026-06-26 16:32:02 -04:00
Add --show-console option
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <timeapi.h>
|
||||
#include "SDL_syswm.h"
|
||||
#endif
|
||||
|
||||
@@ -543,6 +544,26 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Set up high resolution timing period.
|
||||
timeBeginPeriod(1);
|
||||
|
||||
// Process arguments.
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "--show-console") == 0)
|
||||
{
|
||||
if (GetConsoleWindow() == nullptr)
|
||||
{
|
||||
AllocConsole();
|
||||
freopen("CONIN$", "r", stdin);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up console output to accept UTF-8 on windows
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
|
||||
@@ -683,5 +704,10 @@ int main(int argc, char** argv) {
|
||||
release_preload(preload_context);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// End high resolution timing period.
|
||||
timeEndPeriod(1);
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user