Skip to content

Commit 2143429

Browse files
authored
Merge pull request #128 from SplitScreen-Me/wip-v2.3.4
v2.3.4
2 parents e34f511 + f62739f commit 2143429

6 files changed

Lines changed: 292 additions & 13 deletions

File tree

Master/NucleusGaming/Coop/ProtoInput/ProtoInput.cs

Lines changed: 217 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public class ExposedValues
2929
public uint FindWindowHookID = (uint)ProtoHookIDs.FindWindowHookID;
3030
public uint CreateSingleHIDHookID = (uint)ProtoHookIDs.CreateSingleHIDHookID;
3131
public uint WindowStyleHookID = (uint)ProtoHookIDs.WindowStyleHookID;
32+
public uint MoveWindowHookID = (uint)ProtoHookIDs.MoveWindowHookID;
33+
public uint AdjustWindowRectHookID = (uint)ProtoHookIDs.AdjustWindowRectHookID;
34+
public uint RemoveBorderHookID = (uint)ProtoHookIDs.RemoveBorderHookID;
3235

3336
public uint RawInputFilterID = (uint)ProtoMessageFilterIDs.RawInputFilterID;
3437
public uint MouseMoveFilterID = (uint)ProtoMessageFilterIDs.MouseMoveFilterID;
@@ -62,7 +65,10 @@ public enum ProtoHookIDs : uint
6265
BlockRawInputHookID,
6366
FindWindowHookID,
6467
CreateSingleHIDHookID,
65-
WindowStyleHookID
68+
WindowStyleHookID,
69+
MoveWindowHookID,
70+
AdjustWindowRectHookID,
71+
RemoveBorderHookID
6672
};
6773

6874
public enum ProtoMessageFilterIDs : uint
@@ -123,7 +129,8 @@ public static extern void SetupMessagesToSend(uint instanceHandle,
123129
bool sendMouseWheelMessages,
124130
bool sendMouseButtonMessages,
125131
bool sendMouseMoveMessages,
126-
bool sendKeyboardPressMessages);
132+
bool sendKeyboardPressMessages,
133+
bool sendMouseDblClkMessages);
127134

128135
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
129136
public static extern void StartFocusMessageLoop(uint instanceHandle, int milliseconds,
@@ -135,6 +142,9 @@ public static extern void StartFocusMessageLoop(uint instanceHandle, int millise
135142
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
136143
public static extern void SetDrawFakeCursor(uint instanceHandle, bool enable);
137144

145+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
146+
public static extern void SetDrawFakeCursorFix(uint instanceHandle, bool enable);
147+
138148
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
139149
public static extern void SetExternalFreezeFakeInput(uint instanceHandle, bool enableFreeze);
140150

@@ -157,6 +167,19 @@ public static extern void StartFocusMessageLoop(uint instanceHandle, int millise
157167
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
158168
public static extern void SetShowCursorWhenImageUpdated(uint instanceHandle, bool enable);
159169

170+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
171+
public static extern void SetPutMouseInsideWindow(uint instanceHandle, bool enable);
172+
173+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
174+
public static extern void SetDefaultTopLeftMouseBounds(uint instanceHandle, bool enable);
175+
176+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
177+
public static extern void SetDefaultBottomRightMouseBounds(uint instanceHandle, bool enable);
178+
179+
// This MUST be called before calling InstallHook on the RemoveBorderhook
180+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
181+
public static extern void SetDontWaitWindowBorder(uint instanceHandle, bool enable);
182+
160183
// Both of these functions require RenameHandlesHookHookID hook
161184
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
162185
public static extern void AddHandleToRename(uint instanceHandle, string name);
@@ -184,6 +207,12 @@ public static extern void SetDinputDeviceGUID(uint instanceHandle,
184207
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
185208
public static extern void SetSetWindowPosSettings(uint instanceHandle, int posx, int posy, int width, int height);
186209

210+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
211+
public static extern void SetSetWindowPosDontResize(uint instanceHandle, bool enable);
212+
213+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
214+
public static extern void SetSetWindowPosDontReposition(uint instanceHandle, bool enable);
215+
187216
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
188217
public static extern void SetCreateSingleHIDName(uint instanceHandle, string name);
189218

@@ -213,6 +242,18 @@ public static extern void SetDinputDeviceGUID(uint instanceHandle,
213242

214243
[DllImport("ProtoInputUtilDynamic32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
215244
public static extern void GetTaskbarVisibility(out bool autoHide, out bool alwaysOnTop);
245+
246+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
247+
public static extern void SetMoveWindowSettings(uint instanceHandle, int posx, int posy, int width, int height);
248+
249+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
250+
public static extern void SetMoveWindowDontResize(uint instanceHandle, bool enable);
251+
252+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
253+
public static extern void SetMoveWindowDontReposition(uint instanceHandle, bool enable);
254+
255+
[DllImport("ProtoInputLoader32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
256+
public static extern void SetAdjustWindowRectSettings(uint instanceHandle, int posx, int posy, int width, int height);
216257
}
217258

218259
private static class ProtoInput64
@@ -261,7 +302,8 @@ public static extern void SetupMessagesToSend(uint instanceHandle,
261302
bool sendMouseWheelMessages,
262303
bool sendMouseButtonMessages,
263304
bool sendMouseMoveMessages,
264-
bool sendKeyboardPressMessages);
305+
bool sendKeyboardPressMessages,
306+
bool sendMouseDblClkMessages);
265307

266308
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
267309
public static extern void StartFocusMessageLoop(uint instanceHandle, int milliseconds,
@@ -273,6 +315,9 @@ public static extern void StartFocusMessageLoop(uint instanceHandle, int millise
273315
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
274316
public static extern void SetDrawFakeCursor(uint instanceHandle, bool enable);
275317

318+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
319+
public static extern void SetDrawFakeCursorFix(uint instanceHandle, bool enable);
320+
276321
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
277322
public static extern void SetExternalFreezeFakeInput(uint instanceHandle, bool enableFreeze);
278323

@@ -319,6 +364,12 @@ public static extern void SetDinputDeviceGUID(uint instanceHandle,
319364
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
320365
public static extern void SetSetWindowPosSettings(uint instanceHandle, int posx, int posy, int width, int height);
321366

367+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
368+
public static extern void SetSetWindowPosDontResize(uint instanceHandle, bool enable);
369+
370+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
371+
public static extern void SetSetWindowPosDontReposition(uint instanceHandle, bool enable);
372+
322373
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
323374
public static extern void SetCreateSingleHIDName(uint instanceHandle, string name);
324375

@@ -337,6 +388,19 @@ public static extern void SetDinputDeviceGUID(uint instanceHandle,
337388
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
338389
public static extern void SetShowCursorWhenImageUpdated(uint instanceHandle, bool enable);
339390

391+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
392+
public static extern void SetPutMouseInsideWindow(uint instanceHandle, bool enable);
393+
394+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
395+
public static extern void SetDefaultTopLeftMouseBounds(uint instanceHandle, bool enable);
396+
397+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
398+
public static extern void SetDefaultBottomRightMouseBounds(uint instanceHandle, bool enable);
399+
400+
// This MUST be called before calling InstallHook on the RemoveBorderhook
401+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
402+
public static extern void SetDontWaitWindowBorder(uint instanceHandle, bool enable);
403+
340404
[DllImport("ProtoInputUtilDynamic64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
341405
public static extern uint LockInput(bool lockInput);
342406

@@ -351,6 +415,18 @@ public static extern void SetDinputDeviceGUID(uint instanceHandle,
351415

352416
[DllImport("ProtoInputUtilDynamic64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
353417
public static extern void GetTaskbarVisibility(out bool autoHide, out bool alwaysOnTop);
418+
419+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
420+
public static extern void SetMoveWindowSettings(uint instanceHandle, int posx, int posy, int width, int height);
421+
422+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
423+
public static extern void SetMoveWindowDontResize(uint instanceHandle, bool enable);
424+
425+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
426+
public static extern void SetMoveWindowDontReposition(uint instanceHandle, bool enable);
427+
428+
[DllImport("ProtoInputLoader64.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
429+
public static extern void SetAdjustWindowRectSettings(uint instanceHandle, int posx, int posy, int width, int height);
354430
}
355431

356432
public uint LockInput(bool lockInput)
@@ -569,23 +645,26 @@ public void SetupMessagesToSend(uint instanceHandle,
569645
bool sendMouseWheelMessages,
570646
bool sendMouseButtonMessages,
571647
bool sendMouseMoveMessages,
572-
bool sendKeyboardPressMessages)
648+
bool sendKeyboardPressMessages,
649+
bool sendMouseDblClkMessages)
573650
{
574651
if (IntPtr.Size == 4)
575652
{
576653
ProtoInput32.SetupMessagesToSend(instanceHandle,
577654
sendMouseWheelMessages,
578655
sendMouseButtonMessages,
579656
sendMouseMoveMessages,
580-
sendKeyboardPressMessages);
657+
sendKeyboardPressMessages,
658+
sendMouseDblClkMessages);
581659
}
582660
else
583661
{
584662
ProtoInput64.SetupMessagesToSend(instanceHandle,
585663
sendMouseWheelMessages,
586664
sendMouseButtonMessages,
587665
sendMouseMoveMessages,
588-
sendKeyboardPressMessages);
666+
sendKeyboardPressMessages,
667+
sendMouseDblClkMessages);
589668
}
590669
}
591670

@@ -627,6 +706,17 @@ public void SetDrawFakeCursor(uint instanceHandle, bool enable)
627706
ProtoInput64.SetDrawFakeCursor(instanceHandle, enable);
628707
}
629708
}
709+
public void SetDrawFakeCursorFix(uint instanceHandle, bool enable)
710+
{
711+
if (IntPtr.Size == 4)
712+
{
713+
ProtoInput32.SetDrawFakeCursorFix(instanceHandle, enable);
714+
}
715+
else
716+
{
717+
ProtoInput64.SetDrawFakeCursorFix(instanceHandle, enable);
718+
}
719+
}
630720

631721
public void SetExternalFreezeFakeInput(uint instanceHandle, bool enableFreeze)
632722
{
@@ -717,6 +807,54 @@ public void SetShowCursorWhenImageUpdated(uint instanceHandle, bool enable)
717807
}
718808
}
719809

810+
public void SetPutMouseInsideWindow(uint instanceHandle, bool enable)
811+
{
812+
if (IntPtr.Size == 4)
813+
{
814+
ProtoInput32.SetPutMouseInsideWindow(instanceHandle, enable);
815+
}
816+
else
817+
{
818+
ProtoInput64.SetPutMouseInsideWindow(instanceHandle, enable);
819+
}
820+
}
821+
822+
public void SetDefaultTopLeftMouseBounds(uint instanceHandle, bool enable)
823+
{
824+
if (IntPtr.Size == 4)
825+
{
826+
ProtoInput32.SetDefaultTopLeftMouseBounds(instanceHandle, enable);
827+
}
828+
else
829+
{
830+
ProtoInput64.SetDefaultTopLeftMouseBounds(instanceHandle, enable);
831+
}
832+
}
833+
834+
public void SetDefaultBottomRightMouseBounds(uint instanceHandle, bool enable)
835+
{
836+
if (IntPtr.Size == 4)
837+
{
838+
ProtoInput32.SetDefaultBottomRightMouseBounds(instanceHandle, enable);
839+
}
840+
else
841+
{
842+
ProtoInput64.SetDefaultBottomRightMouseBounds(instanceHandle, enable);
843+
}
844+
}
845+
846+
public void SetDontWaitWindowBorder(uint instanceHandle, bool enable)
847+
{
848+
if (IntPtr.Size == 4)
849+
{
850+
ProtoInput32.SetDontWaitWindowBorder(instanceHandle, enable);
851+
}
852+
else
853+
{
854+
ProtoInput64.SetDontWaitWindowBorder(instanceHandle, enable);
855+
}
856+
}
857+
720858
/// <summary>
721859
/// Require RenameHandlesHookHookID hook
722860
/// </summary>
@@ -831,6 +969,30 @@ public void SetSetWindowPosSettings(uint instanceHandle, int posx, int posy, int
831969
}
832970
}
833971

972+
public void SetSetWindowPosDontResize(uint instanceHandle, bool enable)
973+
{
974+
if (IntPtr.Size == 4)
975+
{
976+
ProtoInput32.SetSetWindowPosDontResize(instanceHandle, enable);
977+
}
978+
else
979+
{
980+
ProtoInput64.SetSetWindowPosDontResize(instanceHandle, enable);
981+
}
982+
}
983+
984+
public void SetSetWindowPosDontReposition(uint instanceHandle, bool enable)
985+
{
986+
if (IntPtr.Size == 4)
987+
{
988+
ProtoInput32.SetSetWindowPosDontReposition(instanceHandle, enable);
989+
}
990+
else
991+
{
992+
ProtoInput64.SetSetWindowPosDontReposition(instanceHandle, enable);
993+
}
994+
}
995+
834996
public void SetCreateSingleHIDName(uint instanceHandle, string name)
835997
{
836998
if (IntPtr.Size == 4)
@@ -918,5 +1080,54 @@ public void SetTaskbarAutohide(bool autohide)
9181080
ProtoInput64.SetTaskbarVisibility(autohide, false);
9191081
}
9201082
}
1083+
1084+
public void SetMoveWindowSettings(uint instanceHandle, int posx, int posy, int width, int height)
1085+
{
1086+
if (IntPtr.Size == 4)
1087+
{
1088+
ProtoInput32.SetMoveWindowSettings(instanceHandle, posx, posy, width, height);
1089+
}
1090+
else
1091+
{
1092+
ProtoInput64.SetMoveWindowSettings(instanceHandle, posx, posy, width, height);
1093+
}
1094+
}
1095+
1096+
public void SetMoveWindowDontResize(uint instanceHandle, bool enable)
1097+
{
1098+
if (IntPtr.Size == 4)
1099+
{
1100+
ProtoInput32.SetMoveWindowDontResize(instanceHandle, enable);
1101+
}
1102+
else
1103+
{
1104+
ProtoInput64.SetMoveWindowDontResize(instanceHandle, enable);
1105+
}
1106+
}
1107+
1108+
public void SetMoveWindowDontReposition(uint instanceHandle, bool enable)
1109+
{
1110+
if (IntPtr.Size == 4)
1111+
{
1112+
ProtoInput32.SetMoveWindowDontReposition(instanceHandle, enable);
1113+
}
1114+
else
1115+
{
1116+
ProtoInput64.SetMoveWindowDontReposition(instanceHandle, enable);
1117+
}
1118+
}
1119+
1120+
public void SetAdjustWindowRectSettings(uint instanceHandle, int posx, int posy, int width, int height)
1121+
{
1122+
if (IntPtr.Size == 4)
1123+
{
1124+
ProtoInput32.SetAdjustWindowRectSettings(instanceHandle, posx, posy, width, height);
1125+
}
1126+
else
1127+
{
1128+
ProtoInput64.SetAdjustWindowRectSettings(instanceHandle, posx, posy, width, height);
1129+
}
1130+
}
1131+
9211132
}
9221133
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace Nucleus.Gaming
2+
{
3+
public enum SetWindowPosHook
4+
{
5+
True = 1,
6+
DontResize,
7+
DontReposition
8+
}
9+
10+
public enum MoveWindowHook
11+
{
12+
True = 1,
13+
DontResize,
14+
DontReposition
15+
}
16+
17+
public enum DrawFakeCursor
18+
{
19+
True = 1,
20+
Fix
21+
}
22+
23+
public enum PutMouseInsideWindow
24+
{
25+
True = 1,
26+
IgnoreTopLeft,
27+
IgnoreBottomRight
28+
}
29+
30+
public enum SetRemoveBorderHook
31+
{
32+
True = 1,
33+
DontWait
34+
}
35+
}

0 commit comments

Comments
 (0)