aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-05-02 22:01:30 +0200
committerGitHub <noreply@github.com>2021-05-02 22:01:30 +0200
commit3443023a0844822f4f320ea4f75d9522fb5bbc01 (patch)
treea86a0d7b7d3af8d15daa6a94af680f9eff79593b /Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs
parent0e9823d7e6668731598b6f04b551efa801969e7b (diff)
hid: Rewrite shared memory management (#2257)
* hid: Rewrite shared memory management This entirely rewrite our ancient (and original) HID shared memory interface to be more usable and accurate. HID update logics were updated to reflect those changes but should work still the same way it previously did. This need heavy testing just in case to avoid possible regressions. * Silence warnings * Address gdkchan's comments * Address Ac_K's comments * Address one missing nit
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs19
1 files changed, 11 insertions, 8 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs b/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs
index 7e708e32..e3b95390 100644
--- a/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs
+++ b/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs
@@ -1,3 +1,6 @@
+using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
+using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad;
+
namespace Ryujinx.HLE.HOS.Services.Hid
{
public class DebugPadDevice : BaseDevice
@@ -6,20 +9,20 @@ namespace Ryujinx.HLE.HOS.Services.Hid
public void Update()
{
- ref ShMemDebugPad debugPad = ref _device.Hid.SharedMemory.DebugPad;
+ ref RingLifo<DebugPadState> lifo = ref _device.Hid.SharedMemory.DebugPad;
+
+ ref DebugPadState previousEntry = ref lifo.GetCurrentEntryRef();
- int currentIndex = UpdateEntriesHeader(ref debugPad.Header, out int previousIndex);
+ DebugPadState newState = new DebugPadState();
- if (!Active)
+ if (Active)
{
- return;
+ // TODO: This is a debug device only present in dev environment, do we want to support it?
}
- ref DebugPadEntry currentEntry = ref debugPad.Entries[currentIndex];
- DebugPadEntry previousEntry = debugPad.Entries[previousIndex];
+ newState.SamplingNumber = previousEntry.SamplingNumber + 1;
- currentEntry.SampleTimestamp = previousEntry.SampleTimestamp + 1;
- currentEntry.SampleTimestamp2 = previousEntry.SampleTimestamp2 + 1;
+ lifo.Write(ref newState);
}
}
} \ No newline at end of file