Stubs for NFP

This commit is contained in:
fearlessTobi 2018-06-05 15:34:43 +02:00
parent df33dcc489
commit d4599a312e
4 changed files with 114 additions and 1 deletions

View file

@ -0,0 +1,16 @@
namespace Ryujinx.Core.OsHle.Services.Hid
{
enum ControllerID
{
ControllerPlayer1 = 0,
ControllerPlayer2 = 1,
ControllerPlayer3 = 2,
ControllerPlayer4 = 3,
ControllerPlayer5 = 4,
ControllerPlayer6 = 5,
ControllerPlayer7 = 6,
ControllerPlayer8 = 7,
ControllerHandheld = 8,
ControllerUnknown = 9,
}
}

View file

@ -0,0 +1,7 @@
namespace Ryujinx.Core.OsHle.Services.Nfp
{
enum DeviceState
{
Initialized = 0
}
}

View file

@ -1,6 +1,8 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
using Ryujinx.Core.OsHle.Handles;
using Ryujinx.Core.OsHle.Services.Hid;
namespace Ryujinx.Core.OsHle.Services.Nfp
{
@ -10,18 +12,98 @@ namespace Ryujinx.Core.OsHle.Services.Nfp
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
ulong device_handle = 0xDEAD;
ControllerID npad_id = ControllerID.ControllerPlayer1;
State state = State.NonInitialized;
DeviceState device_state = DeviceState.Initialized;
private KEvent ActivateEvent;
private KEvent DeactivateEvent;
private KEvent AvailabilityChangeEvent;
public IUser()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, Initialize }
{ 0, Initialize },
{ 17, AttachActivateEvent },
{ 18, AttachDeactivateEvent },
{ 19, GetState },
{ 20, GetDeviceState },
{ 21, GetNpadId },
{ 23, AttachAvailabilityChangeEvent }
};
ActivateEvent = new KEvent();
DeactivateEvent = new KEvent();
AvailabilityChangeEvent = new KEvent();
}
public long Initialize(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
state = State.Initialized;
return 0;
}
public long AttachActivateEvent(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
int Handle = Context.Process.HandleTable.OpenHandle(ActivateEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);;
return 0;
}
public long AttachDeactivateEvent(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
int Handle = Context.Process.HandleTable.OpenHandle(DeactivateEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
return 0;
}
public long GetState(ServiceCtx Context)
{
Context.ResponseData.Write((int)state);
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
return 0;
}
public long GetDeviceState(ServiceCtx Context)
{
Context.ResponseData.Write((int)device_state);
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
return 0;
}
public long GetNpadId(ServiceCtx Context)
{
Context.ResponseData.Write((int)npad_id);
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
return 0;
}
public long AttachAvailabilityChangeEvent(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
int Handle = Context.Process.HandleTable.OpenHandle(AvailabilityChangeEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
return 0;
}
}

View file

@ -0,0 +1,8 @@
namespace Ryujinx.Core.OsHle.Services.Nfp
{
enum State
{
NonInitialized = 0,
Initialized = 1
}
}