mirror of
https://github.com/BanjoRecomp/BanjoRecomp
synced 2026-05-23 06:34:20 -04:00
Add --show-console option
This commit is contained in:
+1
-1
@@ -290,7 +290,7 @@ if (WIN32)
|
||||
)
|
||||
|
||||
# target_sources(BanjoRecompiled PRIVATE ${CMAKE_SOURCE_DIR}/icons/app.rc)
|
||||
target_link_libraries(BanjoRecompiled PRIVATE SDL2)
|
||||
target_link_libraries(BanjoRecompiled PRIVATE SDL2 Winmm.lib)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "BanjoRecompiled.exe",
|
||||
"name": "BanjoRecompiled.exe",
|
||||
"currentDir": "${workspaceRoot}"
|
||||
"currentDir": "${workspaceRoot}",
|
||||
"args": ["--show-console"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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