-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugMouseDevice.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common; | ||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugMouse; | ||
|
||
namespace Ryujinx.HLE.HOS.Services.Hid | ||
{ | ||
public class DebugMouseDevice : BaseDevice | ||
{ | ||
public DebugMouseDevice(Switch device, bool active) : base(device, active) { } | ||
|
||
public void Update() | ||
{ | ||
ref RingLifo<DebugMouseState> lifo = ref _device.Hid.SharedMemory.DebugMouse; | ||
|
||
ref DebugMouseState previousEntry = ref lifo.GetCurrentEntryRef(); | ||
|
||
DebugMouseState newState = new() | ||
{ | ||
SamplingNumber = previousEntry.SamplingNumber + 1, | ||
}; | ||
|
||
if (Active) | ||
{ | ||
// TODO: This is a debug device only present in dev environment, do we want to support it? | ||
} | ||
|
||
lifo.Write(ref newState); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugMouse/DebugMouseAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugMouse | ||
{ | ||
[Flags] | ||
enum DebugMouseAttribute : uint | ||
{ | ||
None = 0, | ||
Transferable = 1 << 0, | ||
IsConnected = 1 << 1, | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugMouse/DebugMouseButton.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
|
||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugMouse | ||
{ | ||
[Flags] | ||
enum DebugMouseButton : uint | ||
{ | ||
None = 0, | ||
Left = 1 << 0, | ||
Right = 1 << 1, | ||
Middle = 1 << 2, | ||
Forward = 1 << 3, | ||
Back = 1 << 4, | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugMouse/DebugMouseState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugMouse | ||
{ | ||
[StructLayout(LayoutKind.Sequential, Pack = 1)] | ||
struct DebugMouseState : ISampledDataStruct | ||
{ | ||
public ulong SamplingNumber; | ||
public int X; | ||
public int Y; | ||
public int DeltaX; | ||
public int DeltaY; | ||
public int WheelDeltaX; | ||
public int WheelDeltaY; | ||
public DebugMouseButton Buttons; | ||
public DebugMouseAttribute Attributes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters