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

Do not patch window resize fn if libX11.so not found #98

Merged
merged 1 commit into from
Nov 18, 2022
Merged
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
19 changes: 19 additions & 0 deletions MOD.Scripts.Core/MODUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,25 @@ public static bool HasBrokenWindowResize()
// There are no higurashi games with versions between those, but the patch code should do nothing if it can't find anything.
bool is_broken = version < new Version(5, 6, 7);
Debug.Log($"Detected Unity {version}, which has {(is_broken ? "broken" : "working")} window resize");

// Extra check to see if we can actually call any X11 functions, as in some cases you will get a DllNotFoundException: libX11.so
if (is_broken)
{
try
{
IntPtr display = XOpenDisplay(IntPtr.Zero);
if (display != IntPtr.Zero)
{
XCloseDisplay(display);
}
}
catch (DllNotFoundException e)
{
Debug.Log($"X11 not available - assuming window resize is not broken: {e}");
return false;
}
}

return is_broken;
}

Expand Down