1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 18:48:29 +02:00

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.
This commit is contained in:
Misa 2022-08-29 09:37:30 -07:00
parent e7e74bb8ab
commit aca1e8695c

View File

@ -6,11 +6,6 @@
#include <unistd.h>
#define STDOUT_IS_TTY isatty(STDOUT_FILENO)
#define STDERR_IS_TTY isatty(STDERR_FILENO)
#elif defined(_WIN32)
#include <io.h>
#include <windows.h>
#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;
}
}