From aca1e8695ceddee3cb43b8719c30c85bcd60148e Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 29 Aug 2022 09:37:30 -0700 Subject: [PATCH] Remove attempt to autoenable color output on Win32 This started when I saw the warning that GetVersionExW was deprecated, then looked it up and found StackOverflow answers saying that you should basically detect the feature directly instead of checking the version, which makes sense to me. Then I found that I could probably detect color support by using GetConsoleMode and GetStdHandle. But then I asked myself what the point was unless you could get color output directly in the terminal, which it seems like you really can't if your app is a GUI app. (I have no idea why Windows makes this pointless distinction between console and GUI apps...) I tested Command Prompt, PowerShell, Windows Terminal (which is just PowerShell again), and even Git Bash (MINGW64), but none of them will ever give the console output of a GUI app such as VVVVVV. The closest I got is that Git Bash doesn't seem to detach the process, but it will simply produce no output. At this point I feel like it's not worth it keeping this code around if it didn't even work in the first place, so I'm removing it. People can always enable color by using the -forcecolor command-line argument anyway. --- desktop_version/src/Vlogging.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/desktop_version/src/Vlogging.c b/desktop_version/src/Vlogging.c index d0f6ed63..f79db700 100644 --- a/desktop_version/src/Vlogging.c +++ b/desktop_version/src/Vlogging.c @@ -6,11 +6,6 @@ #include #define STDOUT_IS_TTY isatty(STDOUT_FILENO) #define STDERR_IS_TTY isatty(STDERR_FILENO) -#elif defined(_WIN32) - #include - #include - #define STDOUT_IS_TTY _isatty(_fileno(stdout)) - #define STDERR_IS_TTY _isatty(_fileno(stderr)) #else #define STDOUT_IS_TTY 0 #define STDERR_IS_TTY 0 @@ -33,22 +28,7 @@ static int error_enabled = 1; void vlog_init(void) { -#ifdef _WIN32 - OSVERSIONINFO osvi; - SDL_zero(osvi); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionExW(&osvi); -#endif - - if (STDOUT_IS_TTY - && STDERR_IS_TTY -#ifdef _WIN32 - /* Windows supports ANSI escape sequences starting with Windows 10 - * build 10586. We don't care to emit them on anything lower. */ - && osvi.dwMajorVersion >= 10 - && osvi.dwBuildNumber >= 10586 -#endif - ) { + if (STDOUT_IS_TTY && STDERR_IS_TTY) { color_enabled = 1; } }