- Fixed WindowsInput bugs causing the program to close on random key chords.
This commit is contained in:
parent
ecfa890c75
commit
b499db2f0a
5 changed files with 112 additions and 110 deletions
|
@ -119,8 +119,8 @@
|
|||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsInput, Version=6.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WindowsInput.6.1.1\lib\net461\WindowsInput.dll</HintPath>
|
||||
<Reference Include="WindowsInput, Version=6.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WindowsInput.6.1.0\lib\net461\WindowsInput.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -244,10 +244,11 @@ namespace BetterJoyForCemu {
|
|||
public byte LED = 0x0;
|
||||
|
||||
public string serial_number;
|
||||
bool thirdParty = false;
|
||||
|
||||
private float[] activeData;
|
||||
|
||||
public Joycon(IntPtr handle_, bool imu, bool localize, float alpha, bool left, string path, string serialNum, int id = 0, bool isPro = false, bool isSnes = false) {
|
||||
public Joycon(IntPtr handle_, bool imu, bool localize, float alpha, bool left, string path, string serialNum, int id = 0, bool isPro = false, bool isSnes = false, bool thirdParty = false) {
|
||||
serial_number = serialNum;
|
||||
activeData = new float[6];
|
||||
handle = handle_;
|
||||
|
@ -264,6 +265,7 @@ namespace BetterJoyForCemu {
|
|||
this.isPro = isPro || isSnes;
|
||||
this.isSnes = isSnes;
|
||||
isUSB = serialNum == "000000000001";
|
||||
thirdParty = thirdParty;
|
||||
|
||||
this.path = path;
|
||||
|
||||
|
@ -1030,7 +1032,7 @@ namespace BetterJoyForCemu {
|
|||
}
|
||||
|
||||
private void dump_calibration_data() {
|
||||
if (isSnes)
|
||||
if (isSnes || thirdParty)
|
||||
return;
|
||||
HIDapi.hid_set_nonblocking(handle, 0);
|
||||
byte[] buf_ = ReadSPI(0x80, (isLeft ? (byte)0x12 : (byte)0x1d), 9); // get user calibration data if possible
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace BetterJoyForCemu {
|
|||
|
||||
bool isPro = prod_id == product_pro;
|
||||
bool isSnes = prod_id == product_snes;
|
||||
j.Add(new Joycon(handle, EnableIMU, EnableLocalize & EnableIMU, 0.05f, isLeft, enumerate.path, enumerate.serial_number, j.Count, isPro, isSnes));
|
||||
j.Add(new Joycon(handle, EnableIMU, EnableLocalize & EnableIMU, 0.05f, isLeft, enumerate.path, enumerate.serial_number, j.Count, isPro, isSnes, thirdParty != null));
|
||||
|
||||
foundNew = true;
|
||||
j.Last().form = form;
|
||||
|
@ -362,8 +362,8 @@ namespace BetterJoyForCemu {
|
|||
|
||||
public static List<SController> thirdPartyCons = new List<SController>();
|
||||
|
||||
private static WindowsInput.Events.Sources.IKeyboardEventSource keyboard;
|
||||
private static WindowsInput.Events.Sources.IMouseEventSource mouse;
|
||||
private static WindowsInput.EventSources.IKeyboardEventSource keyboard;
|
||||
private static WindowsInput.EventSources.IMouseEventSource mouse;
|
||||
|
||||
public static void Start() {
|
||||
pid = Process.GetCurrentProcess().Id.ToString(); // get current process id for HidCerberus.Srv
|
||||
|
@ -446,7 +446,7 @@ namespace BetterJoyForCemu {
|
|||
form.console.AppendText("All systems go\r\n");
|
||||
}
|
||||
|
||||
private static void Mouse_MouseEvent(object sender, WindowsInput.Events.Sources.EventSourceEventArgs<WindowsInput.Events.Sources.MouseEvent> e) {
|
||||
private static void Mouse_MouseEvent(object sender, WindowsInput.EventSources.EventSourceEventArgs<WindowsInput.EventSources.MouseEvent> e) {
|
||||
if (e.Data.ButtonDown != null) {
|
||||
string res_val = Config.Value("reset_mouse");
|
||||
if (res_val.StartsWith("mse_"))
|
||||
|
@ -469,7 +469,7 @@ namespace BetterJoyForCemu {
|
|||
}
|
||||
}
|
||||
|
||||
private static void Keyboard_KeyEvent(object sender, WindowsInput.Events.Sources.EventSourceEventArgs<WindowsInput.Events.Sources.KeyboardEvent> e) {
|
||||
private static void Keyboard_KeyEvent(object sender, WindowsInput.EventSources.EventSourceEventArgs<WindowsInput.EventSources.KeyboardEvent> e) {
|
||||
if (e.Data.KeyDown != null) {
|
||||
string res_val = Config.Value("reset_mouse");
|
||||
if (res_val.StartsWith("key_"))
|
||||
|
|
|
@ -11,8 +11,8 @@ using System.Windows.Forms;
|
|||
|
||||
namespace BetterJoyForCemu {
|
||||
public partial class Reassign : Form {
|
||||
private WindowsInput.Events.Sources.IKeyboardEventSource keyboard;
|
||||
private WindowsInput.Events.Sources.IMouseEventSource mouse;
|
||||
private WindowsInput.EventSources.IKeyboardEventSource keyboard;
|
||||
private WindowsInput.EventSources.IMouseEventSource mouse;
|
||||
|
||||
ContextMenuStrip menu_joy_buttons = new ContextMenuStrip();
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace BetterJoyForCemu {
|
|||
mouse.MouseEvent += Mouse_MouseEvent;
|
||||
}
|
||||
|
||||
private void Mouse_MouseEvent(object sender, WindowsInput.Events.Sources.EventSourceEventArgs<WindowsInput.Events.Sources.MouseEvent> e) {
|
||||
private void Mouse_MouseEvent(object sender, WindowsInput.EventSources.EventSourceEventArgs<WindowsInput.EventSources.MouseEvent> e) {
|
||||
if (curAssignment != null && e.Data.ButtonDown != null) {
|
||||
Config.SetValue((string)curAssignment.Tag, "mse_" + ((int)e.Data.ButtonDown.Button));
|
||||
AsyncPrettyName(curAssignment);
|
||||
|
@ -82,7 +82,7 @@ namespace BetterJoyForCemu {
|
|||
}
|
||||
}
|
||||
|
||||
private void Keyboard_KeyEvent(object sender, WindowsInput.Events.Sources.EventSourceEventArgs<WindowsInput.Events.Sources.KeyboardEvent> e) {
|
||||
private void Keyboard_KeyEvent(object sender, WindowsInput.EventSources.EventSourceEventArgs<WindowsInput.EventSources.KeyboardEvent> e) {
|
||||
if (curAssignment != null && e.Data.KeyDown != null) {
|
||||
Config.SetValue((string)curAssignment.Tag, "key_" + ((int)e.Data.KeyDown.Key));
|
||||
AsyncPrettyName(curAssignment);
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
<package id="Crc32.NET" version="1.2.0" targetFramework="net461" />
|
||||
<package id="JetBrains.Annotations" version="2020.1.0" targetFramework="net461" />
|
||||
<package id="Nefarius.ViGEm.Client" version="1.16.150" targetFramework="net461" />
|
||||
<package id="WindowsInput" version="6.1.1" targetFramework="net461" />
|
||||
<package id="WindowsInput" version="6.1.0" targetFramework="net461" />
|
||||
</packages>
|
Loading…
Add table
Reference in a new issue