mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
refactor: completely remove Linux check for winapi hooks
This commit is contained in:
parent
ba320e3f06
commit
5b0be77856
3 changed files with 2 additions and 49 deletions
|
|
@ -19,8 +19,7 @@ namespace Dalamud.Game.Network.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WinSockHandlers()
|
public WinSockHandlers()
|
||||||
{
|
{
|
||||||
this.ws2SocketHook = HookManager.DirtyLinuxUser ? null
|
this.ws2SocketHook = Hook<SocketDelegate>.FromSymbol("ws2_32.dll", "socket", this.OnSocket, true);
|
||||||
: Hook<SocketDelegate>.FromSymbol("ws2_32.dll", "socket", this.OnSocket, true);
|
|
||||||
this.ws2SocketHook?.Enable();
|
this.ws2SocketHook?.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,51 +27,6 @@ namespace Dalamud.Hooking.Internal
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether the client is running under Linux Wine.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A value indicating whether the game is running under Wine.</returns>
|
|
||||||
internal static bool DirtyLinuxUser
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// TODO: Temporary for testing
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (checkLinuxOnce)
|
|
||||||
{
|
|
||||||
checkLinuxOnce = false;
|
|
||||||
|
|
||||||
bool Check1()
|
|
||||||
{
|
|
||||||
return EnvironmentConfiguration.XlWineOnLinux;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Check2()
|
|
||||||
{
|
|
||||||
var hModule = NativeFunctions.GetModuleHandleW("ntdll.dll");
|
|
||||||
var proc1 = NativeFunctions.GetProcAddress(hModule, "wine_get_version");
|
|
||||||
var proc2 = NativeFunctions.GetProcAddress(hModule, "wine_get_build_id");
|
|
||||||
|
|
||||||
return proc1 != IntPtr.Zero || proc2 != IntPtr.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Check3()
|
|
||||||
{
|
|
||||||
return Registry.CurrentUser.OpenSubKey(@"Software\Wine") != null ||
|
|
||||||
Registry.LocalMachine.OpenSubKey(@"Software\Wine") != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isRunningLinux = Check1() || Check2() || Check3())
|
|
||||||
{
|
|
||||||
Log.Information($"Dalamud detected running on Wine");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return isRunningLinux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a static list of tracked and registered hooks.
|
/// Gets a static list of tracked and registered hooks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,7 @@ namespace Dalamud.Interface.Internal
|
||||||
Log.Error(e, "RTSS Free failed");
|
Log.Error(e, "RTSS Free failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setCursorHook = HookManager.DirtyLinuxUser ? null
|
this.setCursorHook = Hook<SetCursorDelegate>.FromSymbol("user32.dll", "SetCursor", this.SetCursorDetour, true);
|
||||||
: Hook<SetCursorDelegate>.FromSymbol("user32.dll", "SetCursor", this.SetCursorDetour, true);
|
|
||||||
this.presentHook = new Hook<PresentDelegate>(this.address.Present, this.PresentDetour);
|
this.presentHook = new Hook<PresentDelegate>(this.address.Present, this.PresentDetour);
|
||||||
this.resizeBuffersHook = new Hook<ResizeBuffersDelegate>(this.address.ResizeBuffers, this.ResizeBuffersDetour);
|
this.resizeBuffersHook = new Hook<ResizeBuffersDelegate>(this.address.ResizeBuffers, this.ResizeBuffersDetour);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue