Skip to content

Commit

Permalink
fix linux console crash, comment code out until someone figures out a…
Browse files Browse the repository at this point in the history
… more proper fix
  • Loading branch information
dankmeme01 committed Oct 1, 2024
1 parent 47e0ca5 commit 8ecb1c5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions loader/src/platform/windows/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ void console::setup() {
path = std::string(buf, count - 1);
}

// count == 0 => not a console and not a file, assume it's closed
// wine does something weird with /dev/null? not sure tbh but it's definitely up to no good
// TODO: the isWine check is pretty hacky but without it the game does not launch at all and i cba to figure it out rn
if ((count == 0 || path.ends_with("\\dev\\null"))) {
s_outHandle = nullptr;
CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE));
CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
CloseHandle(GetStdHandle(STD_ERROR_HANDLE));
FreeConsole();
SetStdHandle(STD_OUTPUT_HANDLE, nullptr);
SetStdHandle(STD_INPUT_HANDLE, nullptr);
SetStdHandle(STD_ERROR_HANDLE, nullptr);
}
// TODO: this code causes a crash when piping game's output somewhere (and in some other cases), so it's removed for now
// // count == 0 => not a console and not a file, assume it's closed
// // wine does something weird with /dev/null? not sure tbh but it's definitely up to no good
// if ((count == 0 || path.ends_with("\\dev\\null"))) {
// s_outHandle = nullptr;
// CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE));
// CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
// CloseHandle(GetStdHandle(STD_ERROR_HANDLE));
// FreeConsole();
// SetStdHandle(STD_OUTPUT_HANDLE, nullptr);
// SetStdHandle(STD_INPUT_HANDLE, nullptr);
// SetStdHandle(STD_ERROR_HANDLE, nullptr);
// }
}

// clion console supports escape codes but we can't query that because it's a named pipe
Expand Down

0 comments on commit 8ecb1c5

Please sign in to comment.