forked from Mirror/Ryujinx
hid: A little cleanup (#2950)
While I'm looking to the code, I've found some syntax issue, and a little inconsistencie between `ActivateNpad` and `ActivateNpadWithRevision`. Nothing more.
This commit is contained in:
parent
ef39b2ebdd
commit
322c14ee31
4 changed files with 43 additions and 69 deletions
|
@ -1,17 +1,17 @@
|
|||
using Ryujinx.Common;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
|
|
|
@ -5,9 +5,7 @@ using Ryujinx.HLE.HOS.Kernel.Common;
|
|||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -667,38 +665,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
// ActivateNpad(nn::applet::AppletResourceUserId)
|
||||
public ResultCode ActivateNpad(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
context.Device.Hid.Npads.Active = true;
|
||||
|
||||
// Initialize entries to avoid issues with some games.
|
||||
|
||||
List<GamepadInput> emptyGamepadInputs = new List<GamepadInput>();
|
||||
List<SixAxisInput> emptySixAxisInputs = new List<SixAxisInput>();
|
||||
|
||||
for (int player = 0; player < NpadDevices.MaxControllers; player++)
|
||||
{
|
||||
GamepadInput gamepadInput = new GamepadInput();
|
||||
SixAxisInput sixaxisInput = new SixAxisInput();
|
||||
|
||||
gamepadInput.PlayerId = (PlayerIndex)player;
|
||||
sixaxisInput.PlayerId = (PlayerIndex)player;
|
||||
|
||||
sixaxisInput.Orientation = new float[9];
|
||||
|
||||
emptyGamepadInputs.Add(gamepadInput);
|
||||
emptySixAxisInputs.Add(sixaxisInput);
|
||||
}
|
||||
|
||||
for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++)
|
||||
{
|
||||
context.Device.Hid.Npads.Update(emptyGamepadInputs);
|
||||
context.Device.Hid.Npads.UpdateSixAxis(emptySixAxisInputs);
|
||||
}
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId });
|
||||
|
||||
return ResultCode.Success;
|
||||
return ActiveNpadImpl(context);
|
||||
}
|
||||
|
||||
[CommandHipc(104)]
|
||||
|
@ -773,12 +740,20 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
}
|
||||
|
||||
[CommandHipc(109)] // 5.0.0+
|
||||
// ActivateNpadWithRevision(nn::applet::AppletResourceUserId, int revision)
|
||||
// ActivateNpadWithRevision(nn::applet::AppletResourceUserId, ulong revision)
|
||||
public ResultCode ActivateNpadWithRevision(ServiceCtx context)
|
||||
{
|
||||
int revision = context.RequestData.ReadInt32();
|
||||
ulong revision = context.RequestData.ReadUInt64();
|
||||
|
||||
return ActiveNpadImpl(context, revision);
|
||||
}
|
||||
|
||||
private ResultCode ActiveNpadImpl(ServiceCtx context, ulong revision = 0)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
context.Device.Hid.Npads.Active = true;
|
||||
|
||||
// Initialize entries to avoid issues with some games.
|
||||
|
||||
List<GamepadInput> emptyGamepadInputs = new List<GamepadInput>();
|
||||
|
|
Loading…
Reference in a new issue