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

Fix Vanilla combination keys prevented in some conditions #92

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Ktisis/Interface/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ internal static bool IsPurposeUsed(Purpose purpose, VirtualKey input) {
match &= key == input || ControlHooks.KeyboardState.IsKeyDown(key);
}

return match;
return match && !ControlHooks.KeyboardState.IsAnyOtherKeyDown(keys);
}

[Serializable]
Expand Down
11 changes: 11 additions & 0 deletions Ktisis/Structs/Input/Keyboard.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

using Dalamud.Game.ClientState.Keys;
Expand Down Expand Up @@ -26,6 +28,15 @@ public unsafe struct KeyboardState {

public bool IsKeyDown(VirtualKey key)
=> KeyMap[(int)key] == 1;
public bool IsAnyOtherKeyDown(IEnumerable<VirtualKey> keys) {
var keysInt = keys.Select(k=>(int)k);

if (keys != null)
for (int i = 0; i < 159; i++)
if (KeyMap[i] == 1 && !keysInt.Contains(i))
return true;
return false;
}
}

[StructLayout(LayoutKind.Sequential)]
Expand Down