console setup errors will no longer deny a server startup

This commit is contained in:
Anonymous275 2020-11-17 08:28:02 +02:00
parent 667a22b0f8
commit 04de729d7c
2 changed files with 8 additions and 11 deletions

View File

@ -99,25 +99,22 @@ char _getch(void) {
#endif // WIN32
void SetupConsole() {
#if defined(WIN32) && !defined(DEBUG)
#if defined(WIN32)
DWORD outMode = 0;
HANDLE stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
if (stdoutHandle == INVALID_HANDLE_VALUE) {
error("Invalid handle");
std::this_thread::sleep_for(std::chrono::seconds(3));
_Exit(GetLastError());
error("Invalid console handle! Inputs will not work properly");
return;
}
if (!GetConsoleMode(stdoutHandle, &outMode)) {
error("Invalid console mode");
std::this_thread::sleep_for(std::chrono::seconds(3));
_Exit(GetLastError());
error("Invalid console mode! Inputs will not work properly");
return;
}
// Enable ANSI escape codes
outMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(stdoutHandle, outMode)) {
error("failed to set console mode");
std::this_thread::sleep_for(std::chrono::seconds(3));
_Exit(GetLastError());
error("failed to set console mode! Inputs will not work properly");
return;
}
#else
#endif // WIN32

View File

@ -9,7 +9,7 @@
std::string CustomIP;
std::string GetSVer() {
return std::string(Sec("1.11"));
return std::string(Sec("1.12"));
}
std::string GetCVer() {
return std::string(Sec("1.70"));