aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs
blob: 77e9205f004ad5be5e46e5a2a38d02c780bc7777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespace Ryujinx.HLE.HOS.Services.Hid
{
    public class DebugPadDevice : BaseDevice
    {
        public DebugPadDevice(Switch device, bool active) : base(device, active) { }

        public void Update()
        {
            ref ShMemDebugPad debugPad = ref _device.Hid.SharedMemory.DebugPad;

            int currentIndex = UpdateEntriesHeader(ref debugPad.Header, out int previousIndex);

            if (!Active)
            {
                return;
            }

            ref DebugPadEntry currentEntry = ref debugPad.Entries[currentIndex];
            DebugPadEntry previousEntry = debugPad.Entries[previousIndex];

            currentEntry.SampleTimestamp = previousEntry.SampleTimestamp + 1;
        }
    }
}