Windows: partially revert a5306d60ee to fix crashes on Windows 7

Very strange behavior. Needs further investigation
This commit is contained in:
李通洲
2022-11-20 02:18:06 +08:00
parent 55c6374949
commit b6b95581cd
+3 -2
View File
@@ -125,6 +125,7 @@ static void initState(FFstate* state)
#ifdef WIN32
//https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?source=recommendations&view=msvc-170#utf-8-support
setlocale(LC_ALL, ".UTF8");
setvbuf(stdout, NULL, _IOFBF, 4096);
#endif
state->logoWidth = 0;
@@ -334,7 +335,7 @@ static void resetConsole()
BOOL WINAPI consoleHandler(DWORD signal)
{
FF_UNUSED(signal);
resetConsole();
resetConsole();
exit(0);
}
#else
@@ -360,7 +361,7 @@ void ffStart(FFinstance* instance)
DWORD mode = 0;
GetConsoleMode(hStdout, &mode);
SetConsoleMode(hStdout, mode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
SetConsoleOutputCP(CP_UTF8);
// SetConsoleOutputCP(CP_UTF8);
#else
struct sigaction action = { .sa_handler = exitSignalHandler };
sigaction(SIGINT, &action, NULL);