Skip to content

Commit

Permalink
Merge pull request #54 from ZeroFox5866/proto
Browse files Browse the repository at this point in the history
Added DontShowCursorWhenImageUpdated option from Proto Input
  • Loading branch information
Ilyaki committed Sep 1, 2021
2 parents d9b5676 + 8f44025 commit 465a848
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Master/NucleusCoopTool/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Nucleus.Coop
/// </summary>
public partial class MainForm : BaseForm
{
public string version = "v1.1.1";
public string version = "v1.1.2";

private Settings settingsForm = null;

Expand Down
2 changes: 1 addition & 1 deletion Master/NucleusGaming/Coop/Generic/GenericGameHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ public string Play()

if(isDebug)
{
Log("NucleusCoop mod version: 1.1.1");
Log("NucleusCoop mod version: 1.1.2");

Log("########## START OF SCRIPT ##########");
string line;
Expand Down
14 changes: 14 additions & 0 deletions Master/NucleusGaming/Coop/ProtoInput/ProtoInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ public static extern void StartFocusMessageLoop(uint instanceHandle, int millise
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetUseOpenXinput(uint instanceHandle, bool useOpenXinput);

[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetShowCursorWhenImageUpdated(uint instanceHandle, bool enable);

// Both of these functions require RenameHandlesHookHookID hook
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern void AddHandleToRename(uint instanceHandle, string name);
Expand Down Expand Up @@ -333,6 +336,9 @@ public static extern void SetDinputDeviceGUID(uint instanceHandle,
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetRawInputBypass(uint instanceHandle, bool enabled);

[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetShowCursorWhenImageUpdated(uint instanceHandle, bool enable);

[DllImport("ProtoInputUtilDynamic64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern uint LockInput(bool lockInput);

Expand Down Expand Up @@ -597,6 +603,14 @@ public void SetUseOpenXinput(uint instanceHandle, bool useOpenXinput)
ProtoInput64.SetUseOpenXinput(instanceHandle, useOpenXinput);
}

public void SetShowCursorWhenImageUpdated(uint instanceHandle, bool enable)
{
if (IntPtr.Size == 4)
ProtoInput32.SetShowCursorWhenImageUpdated(instanceHandle, enable);
else
ProtoInput64.SetShowCursorWhenImageUpdated(instanceHandle, enable);
}

/// <summary>
/// Require RenameHandlesHookHookID hook
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions Master/NucleusGaming/Coop/ProtoInput/ProtoInputLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ private static void SetupInstance(uint instanceHandle, int instanceIndex, Generi
if (gen.ProtoInput.GetKeyStateHook) ProtoInput.protoInput.InstallHook(instanceHandle, ProtoInput.ProtoHookIDs.GetKeyStateHookID);
if (gen.ProtoInput.GetAsyncKeyStateHook) ProtoInput.protoInput.InstallHook(instanceHandle, ProtoInput.ProtoHookIDs.GetAsyncKeyStateHookID);
if (gen.ProtoInput.GetKeyboardStateHook) ProtoInput.protoInput.InstallHook(instanceHandle, ProtoInput.ProtoHookIDs.GetKeyboardStateHookID);

ProtoInput.protoInput.SetShowCursorWhenImageUpdated(instanceHandle, !gen.ProtoInput.DontShowCursorWhenImageUpdated);
if (gen.ProtoInput.CursorVisibilityHook) ProtoInput.protoInput.InstallHook(instanceHandle, ProtoInput.ProtoHookIDs.CursorVisibilityStateHookID);

ProtoInput.protoInput.SetCursorClipOptions(instanceHandle, gen.ProtoInput.ClipCursorHookCreatesFakeClip);
Expand Down
1 change: 1 addition & 0 deletions Master/NucleusGaming/Coop/ProtoInput/ProtoInputOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class ProtoInputOptions
public bool ExtendFakeCursorBounds;
public bool EnableToggleFakeCursorVisibilityShortcut;
public uint ToggleFakeCursorVisibilityShortcutVkey = 0x24; // VK_HOME
public bool DontShowCursorWhenImageUpdated;

public bool UseDinputRedirection;

Expand Down

0 comments on commit 465a848

Please sign in to comment.