Motion Fixes (#1589)

* fix stalling when server is offline

* add retry timer to fail server connections, fix alt slot number

* fix alt slot key issue

* fix crash when saving controller config with empty fields

* code fixes

* add index check in motion hid update, made HandleResponse async

Co-authored-by: Emmanuel <nhv3@localhost.localdomain>
This commit is contained in:
emmauss 2020-10-28 19:52:07 +00:00 committed by GitHub
parent c9841dab38
commit 9f13f957af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 218 additions and 139 deletions

View file

@ -447,6 +447,8 @@ namespace Ryujinx.Ui
Enum.TryParse(_rSl.Label, out Key rButtonSl);
Enum.TryParse(_rSr.Label, out Key rButtonSr);
int.TryParse(_dsuServerPort.Buffer.Text, out int port);
return new KeyboardConfig
{
Index = int.Parse(_inputDevice.ActiveId.Split("/")[1]),
@ -489,11 +491,11 @@ namespace Ryujinx.Ui
EnableMotion = _enableMotion.Active,
MirrorInput = _mirrorInput.Active,
Slot = (int)_slotNumber.Value,
AltSlot = (int)_slotNumber.Value,
AltSlot = (int)_altSlotNumber.Value,
Sensitivity = (int)_sensitivity.Value,
GyroDeadzone = _gyroDeadzone.Value,
DsuServerHost = _dsuServerHost.Buffer.Text,
DsuServerPort = int.Parse(_dsuServerPort.Buffer.Text)
DsuServerPort = port
};
}
@ -525,6 +527,8 @@ namespace Ryujinx.Ui
Enum.TryParse(_rSl.Label, out ControllerInputId rButtonSl);
Enum.TryParse(_rSr.Label, out ControllerInputId rButtonSr);
int.TryParse(_dsuServerPort.Buffer.Text, out int port);
return new ControllerConfig
{
Index = int.Parse(_inputDevice.ActiveId.Split("/")[1]),
@ -570,11 +574,11 @@ namespace Ryujinx.Ui
EnableMotion = _enableMotion.Active,
MirrorInput = _mirrorInput.Active,
Slot = (int)_slotNumber.Value,
AltSlot = (int)_slotNumber.Value,
AltSlot = (int)_altSlotNumber.Value,
Sensitivity = (int)_sensitivity.Value,
GyroDeadzone = _gyroDeadzone.Value,
DsuServerHost = _dsuServerHost.Buffer.Text,
DsuServerPort = int.Parse(_dsuServerPort.Buffer.Text)
DsuServerPort = port
};
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="_altSlotNumber">
@ -9,28 +9,28 @@
</object>
<object class="GtkAdjustment" id="_controllerDeadzoneLeft">
<property name="upper">1</property>
<property name="value">0.05</property>
<property name="value">0.050000000000000003</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.1</property>
<property name="page_increment">0.10000000000000001</property>
</object>
<object class="GtkAdjustment" id="_controllerDeadzoneRight">
<property name="upper">1</property>
<property name="value">0.05</property>
<property name="value">0.050000000000000003</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.1</property>
<property name="page_increment">0.10000000000000001</property>
</object>
<object class="GtkAdjustment" id="_controllerTriggerThreshold">
<property name="upper">1</property>
<property name="value">0.5</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.1</property>
<property name="page_increment">0.10000000000000001</property>
</object>
<object class="GtkAdjustment" id="_gyroDeadzone">
<property name="upper">100</property>
<property name="value">0.01</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.1</property>
<property name="page_size">0.1</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_size">0.10000000000000001</property>
</object>
<object class="GtkAdjustment" id="_sensitivity">
<property name="upper">1000</property>
@ -50,6 +50,9 @@
<property name="window_position">center</property>
<property name="default_width">1100</property>
<property name="default_height">600</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -1803,6 +1806,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">_altSlotNumber</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
@ -2030,8 +2034,5 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View file

@ -512,7 +512,7 @@ namespace Ryujinx.Ui
currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick);
motionDevice.Poll(inputConfig.PlayerIndex, inputConfig.Slot);
motionDevice.Poll(inputConfig, inputConfig.Slot);
SixAxisInput sixAxisInput = new SixAxisInput()
{
@ -537,7 +537,7 @@ namespace Ryujinx.Ui
{
if (!inputConfig.MirrorInput)
{
motionDevice.Poll(inputConfig.PlayerIndex, inputConfig.AltSlot);
motionDevice.Poll(inputConfig, inputConfig.AltSlot);
sixAxisInput = new SixAxisInput()
{