From bcc099d8ba82bbfbc88626fe85dfc1360c88ea9a Mon Sep 17 00:00:00 2001 From: Aloshi Date: Mon, 24 Nov 2014 21:08:22 -0600 Subject: [PATCH] Attach to parent process when calling --help on Windows. --- es-app/src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index febccf770..393f199fd 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -73,6 +73,14 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height scrape_cmdline = true; }else if(strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { +#ifdef WIN32 + // This is a bit of a hack, but otherwise output will go to nowhere + // when the application is compiled with the "WINDOWS" subsystem (which we usually are). + // If you're an experienced Windows programmer and know how to do this + // the right way, please submit a pull request! + AttachConsole(ATTACH_PARENT_PROCESS); + freopen("CONOUT$", "wb", stdout); +#endif std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n" "Written by Alec \"Aloshi\" Lofquist.\n"