Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert "remove this thing" #1099

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion loader/src/platform/windows/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ bool redirectStd(FILE* which, std::string const& name, const Severity sev) {
return true;
}

static bool isWine() {
if (auto mod = GetModuleHandle("ntdll.dll")) {
return GetProcAddress(mod, "wine_get_version") != nullptr;
}
return false;
}

void console::setup() {
// if the game launched from a console or with a console already attached,
// this is where we find that out and save its handle
Expand All @@ -118,7 +125,7 @@ void console::setup() {
// 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"))) {
if ((count == 0 || path.ends_with("\\dev\\null")) && !isWine()) {
s_outHandle = nullptr;
CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE));
CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
Expand Down