SMO stubs and implementations (#129)

* WIP SMO stubs and implementations

* fixes?

* Add StorageHelper

* Whoops

* Compliant with review.

* Remove unnecessary usings
This commit is contained in:
Starlet 2018-06-02 18:46:09 -04:00 committed by gdkchan
parent f03a43fa38
commit 250e2084f4
22 changed files with 449 additions and 109 deletions

View file

@ -23,6 +23,7 @@ namespace Ryujinx.Core.Logging
ServiceHid, ServiceHid,
ServiceLm, ServiceLm,
ServiceMm, ServiceMm,
ServiceNfp,
ServiceNifm, ServiceNifm,
ServiceNs, ServiceNs,
ServiceNv, ServiceNv,
@ -32,6 +33,7 @@ namespace Ryujinx.Core.Logging
ServiceSet, ServiceSet,
ServiceSfdnsres, ServiceSfdnsres,
ServiceSm, ServiceSm,
ServiceSsl,
ServiceSss, ServiceSss,
ServiceTime, ServiceTime,
ServiceVi ServiceVi

View file

@ -174,34 +174,34 @@ namespace Ryujinx.Core.OsHle.Ipc
return 0; return 0;
} }
public long GetBufferType0x21Position() public (long Position, long Size) GetBufferType0x21()
{ {
if (PtrBuff.Count > 0 && PtrBuff[0].Position != 0) if (PtrBuff.Count > 0 && PtrBuff[0].Position != 0 && PtrBuff[0].Size != 0)
{ {
return PtrBuff[0].Position; return (PtrBuff[0].Position, PtrBuff[0].Size);
} }
if (SendBuff.Count > 0) if (SendBuff.Count > 0 && SendBuff[0].Position != 0 && SendBuff[0].Size != 0)
{ {
return SendBuff[0].Position; return (SendBuff[0].Position, SendBuff[0].Size);
} }
return 0; return (0, 0);
} }
public long GetBufferType0x22Position() public (long Position, long Size) GetBufferType0x22()
{ {
if (RecvListBuff.Count > 0 && RecvListBuff[0].Position != 0) if (RecvListBuff.Count > 0 && RecvListBuff[0].Position != 0 && RecvListBuff[0].Size != 0)
{ {
return RecvListBuff[0].Position; return (RecvListBuff[0].Position, RecvListBuff[0].Size);
} }
if (ReceiveBuff.Count > 0) if (ReceiveBuff.Count > 0 && ReceiveBuff[0].Position != 0 && ReceiveBuff[0].Size != 0)
{ {
return ReceiveBuff[0].Position; return (ReceiveBuff[0].Position, ReceiveBuff[0].Size);
} }
return 0; return (0, 0);
} }
} }
} }

View file

@ -16,6 +16,7 @@ namespace Ryujinx.Core.OsHle.Services.Acc
{ {
{ 0, GetUserCount }, { 0, GetUserCount },
{ 3, ListOpenUsers }, { 3, ListOpenUsers },
{ 4, GetLastOpenedUser },
{ 5, GetProfile }, { 5, GetProfile },
{ 100, InitializeApplicationInfo }, { 100, InitializeApplicationInfo },
{ 101, GetBaasAccountManagerForApplication } { 101, GetBaasAccountManagerForApplication }
@ -38,6 +39,16 @@ namespace Ryujinx.Core.OsHle.Services.Acc
return 0; return 0;
} }
public long GetLastOpenedUser(ServiceCtx Context)
{
Context.ResponseData.Write(0L);
Context.ResponseData.Write(0L);
Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
return 0;
}
public long GetProfile(ServiceCtx Context) public long GetProfile(ServiceCtx Context)
{ {
MakeObject(Context, new IProfile()); MakeObject(Context, new IProfile());

View file

@ -1,7 +1,6 @@
using Ryujinx.Core.Logging; using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc; using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace Ryujinx.Core.OsHle.Services.Am namespace Ryujinx.Core.OsHle.Services.Am
{ {
@ -15,22 +14,22 @@ namespace Ryujinx.Core.OsHle.Services.Am
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 1, PopLaunchParameter }, { 1, PopLaunchParameter },
{ 20, EnsureSaveData }, { 20, EnsureSaveData },
{ 21, GetDesiredLanguage }, { 21, GetDesiredLanguage },
{ 22, SetTerminateResult }, { 22, SetTerminateResult },
{ 23, GetDisplayVersion }, { 23, GetDisplayVersion },
{ 40, NotifyRunning }, { 40, NotifyRunning },
{ 50, GetPseudoDeviceId } { 50, GetPseudoDeviceId },
{ 66, InitializeGamePlayRecording },
{ 67, SetGamePlayRecordingState }
}; };
} }
private const uint LaunchParamsMagic = 0xc79497ca;
public long PopLaunchParameter(ServiceCtx Context) public long PopLaunchParameter(ServiceCtx Context)
{ {
//Only the first 0x18 bytes of the Data seems to be actually used. //Only the first 0x18 bytes of the Data seems to be actually used.
MakeObject(Context, new IStorage(MakeLaunchParams())); MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0; return 0;
} }
@ -99,22 +98,20 @@ namespace Ryujinx.Core.OsHle.Services.Am
return 0; return 0;
} }
private byte[] MakeLaunchParams() public long InitializeGamePlayRecording(ServiceCtx Context)
{ {
//Size needs to be at least 0x88 bytes otherwise application errors. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
using (MemoryStream MS = new MemoryStream())
{
BinaryWriter Writer = new BinaryWriter(MS);
MS.SetLength(0x88); return 0;
}
Writer.Write(LaunchParamsMagic); public long SetGamePlayRecordingState(ServiceCtx Context)
Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used. {
Writer.Write(1L); //User Id Low (note: User Id needs to be != 0) int State = Context.RequestData.ReadInt32();
Writer.Write(0L); //User Id High
return MS.ToArray(); Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
}
return 0;
} }
} }
} }

View file

@ -0,0 +1,71 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Handles;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.Core.OsHle.Services.Am
{
class ILibraryAppletAccessor : IpcService
{
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private KEvent StateChangedEvent;
public ILibraryAppletAccessor()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetAppletStateChangedEvent },
{ 10, Start },
{ 30, GetResult },
{ 100, PushInData },
{ 101, PopOutData }
};
StateChangedEvent = new KEvent();
}
public long GetAppletStateChangedEvent(ServiceCtx Context)
{
StateChangedEvent.WaitEvent.Set();
int Handle = Context.Process.HandleTable.OpenHandle(StateChangedEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long Start(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long GetResult(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long PushInData(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long PopOutData(ServiceCtx Context)
{
MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0;
}
}
}

View file

@ -13,8 +13,23 @@ namespace Ryujinx.Core.OsHle.Services.Am
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
//... { 0, CreateLibraryApplet },
{ 10, CreateStorage }
}; };
} }
public long CreateLibraryApplet(ServiceCtx Context)
{
MakeObject(Context, new ILibraryAppletAccessor());
return 0;
}
public long CreateStorage(ServiceCtx Context)
{
MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0;
}
} }
} }

View file

@ -1,4 +1,5 @@
using Ryujinx.Core.Logging; using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Handles;
using Ryujinx.Core.OsHle.Ipc; using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic; using System.Collections.Generic;
@ -10,11 +11,14 @@ namespace Ryujinx.Core.OsHle.Services.Am
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private KEvent LaunchableEvent;
public ISelfController() public ISelfController()
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 1, LockExit }, { 1, LockExit },
{ 9, GetLibraryAppletLaunchableEvent },
{ 10, SetScreenShotPermission }, { 10, SetScreenShotPermission },
{ 11, SetOperationModeChangedNotification }, { 11, SetOperationModeChangedNotification },
{ 12, SetPerformanceModeChangedNotification }, { 12, SetPerformanceModeChangedNotification },
@ -23,6 +27,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
{ 16, SetOutOfFocusSuspendingEnabled }, { 16, SetOutOfFocusSuspendingEnabled },
{ 50, SetHandlesRequestToDisplay } { 50, SetHandlesRequestToDisplay }
}; };
LaunchableEvent = new KEvent();
} }
public long LockExit(ServiceCtx Context) public long LockExit(ServiceCtx Context)
@ -30,6 +36,19 @@ namespace Ryujinx.Core.OsHle.Services.Am
return 0; return 0;
} }
public long GetLibraryAppletLaunchableEvent(ServiceCtx Context)
{
LaunchableEvent.WaitEvent.Set();
int Handle = Context.Process.HandleTable.OpenHandle(LaunchableEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long SetScreenShotPermission(ServiceCtx Context) public long SetScreenShotPermission(ServiceCtx Context)
{ {
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;

View file

@ -1,4 +1,5 @@
using ChocolArm64.Memory; using ChocolArm64.Memory;
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc; using Ryujinx.Core.OsHle.Ipc;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -18,6 +19,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 0, GetSize }, { 0, GetSize },
{ 10, Write },
{ 11, Read } { 11, Read }
}; };
@ -31,6 +33,13 @@ namespace Ryujinx.Core.OsHle.Services.Am
return 0; return 0;
} }
public long Write(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long Read(ServiceCtx Context) public long Read(ServiceCtx Context)
{ {
long ReadPosition = Context.RequestData.ReadInt64(); long ReadPosition = Context.RequestData.ReadInt64();

View file

@ -0,0 +1,27 @@
using System.IO;
namespace Ryujinx.Core.OsHle.Services.Am
{
class StorageHelper
{
private const uint LaunchParamsMagic = 0xc79497ca;
public static byte[] MakeLaunchParams()
{
//Size needs to be at least 0x88 bytes otherwise application errors.
using (MemoryStream MS = new MemoryStream())
{
BinaryWriter Writer = new BinaryWriter(MS);
MS.SetLength(0x88);
Writer.Write(LaunchParamsMagic);
Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
Writer.Write(0L); //User Id High
return MS.ToArray();
}
}
}
}

View file

@ -19,11 +19,17 @@ namespace Ryujinx.Core.OsHle.Services.Aud
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 0, ListAudioDeviceName }, { 0, ListAudioDeviceName },
{ 1, SetAudioDeviceOutputVolume }, { 1, SetAudioDeviceOutputVolume },
{ 3, GetActiveAudioDeviceName }, { 3, GetActiveAudioDeviceName },
{ 4, QueryAudioDeviceSystemEvent }, { 4, QueryAudioDeviceSystemEvent },
{ 5, GetActiveChannelCount } { 5, GetActiveChannelCount },
{ 6, ListAudioDeviceNameAuto },
{ 7, SetAudioDeviceOutputVolumeAuto },
{ 8, GetAudioDeviceOutputVolumeAuto },
{ 10, GetActiveAudioDeviceNameAuto },
{ 11, QueryAudioDeviceInputEvent },
{ 12, QueryAudioDeviceOutputEvent }
}; };
SystemEvent = new KEvent(); SystemEvent = new KEvent();
@ -118,5 +124,102 @@ namespace Ryujinx.Core.OsHle.Services.Aud
return 0; return 0;
} }
public long ListAudioDeviceNameAuto(ServiceCtx Context)
{
string[] DeviceNames = SystemStateMgr.AudioOutputs;
Context.ResponseData.Write(DeviceNames.Length);
(long Position, long Size) = Context.Request.GetBufferType0x22();
long BasePosition = Position;
foreach (string Name in DeviceNames)
{
byte[] Buffer = Encoding.UTF8.GetBytes(Name + '\0');
if ((Position - BasePosition) + Buffer.Length > Size)
{
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!");
break;
}
AMemoryHelper.WriteBytes(Context.Memory, Position, Buffer);
Position += Buffer.Length;
}
return 0;
}
public long SetAudioDeviceOutputVolumeAuto(ServiceCtx Context)
{
float Volume = Context.RequestData.ReadSingle();
long Position = Context.Request.SendBuff[0].Position;
long Size = Context.Request.SendBuff[0].Size;
byte[] DeviceNameBuffer = AMemoryHelper.ReadBytes(Context.Memory, Position, Size);
string DeviceName = Encoding.UTF8.GetString(DeviceNameBuffer);
Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
return 0;
}
public long GetAudioDeviceOutputVolumeAuto(ServiceCtx Context)
{
Context.ResponseData.Write(1f);
Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
return 0;
}
public long GetActiveAudioDeviceNameAuto(ServiceCtx Context)
{
string Name = Context.Ns.Os.SystemState.ActiveAudioOutput;
long Position = Context.Request.RecvListBuff[0].Position;
long Size = Context.Request.RecvListBuff[0].Size;
byte[] DeviceNameBuffer = Encoding.UTF8.GetBytes(Name + '\0');
if ((ulong)DeviceNameBuffer.Length <= (ulong)Size)
{
AMemoryHelper.WriteBytes(Context.Memory, Position, DeviceNameBuffer);
}
else
{
Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {Size} too small!");
}
return 0;
}
public long QueryAudioDeviceInputEvent(ServiceCtx Context)
{
int Handle = Context.Process.HandleTable.OpenHandle(SystemEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
return 0;
}
public long QueryAudioDeviceOutputEvent(ServiceCtx Context)
{
int Handle = Context.Process.HandleTable.OpenHandle(SystemEvent);
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAudio, "Stubbed.");
return 0;
}
} }
} }

View file

@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc; using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic; using System.Collections.Generic;
@ -15,6 +16,7 @@ namespace Ryujinx.Core.OsHle.Services.FspSrv
{ {
{ 1, SetCurrentProcess }, { 1, SetCurrentProcess },
{ 18, OpenSdCardFileSystem }, { 18, OpenSdCardFileSystem },
{ 22, CreateSaveDataFileSystem },
{ 51, OpenSaveDataFileSystem }, { 51, OpenSaveDataFileSystem },
{ 200, OpenDataStorageByCurrentProcess }, { 200, OpenDataStorageByCurrentProcess },
{ 203, OpenPatchDataStorageByCurrentProcess }, { 203, OpenPatchDataStorageByCurrentProcess },
@ -34,6 +36,13 @@ namespace Ryujinx.Core.OsHle.Services.FspSrv
return 0; return 0;
} }
public long CreateSaveDataFileSystem(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceFs, "Stubbed.");
return 0;
}
public long OpenSaveDataFileSystem(ServiceCtx Context) public long OpenSaveDataFileSystem(ServiceCtx Context)
{ {
MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetGameSavesPath())); MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetGameSavesPath()));

View file

@ -0,0 +1,28 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.Core.OsHle.Services.Nfp
{
class IUser : IpcService
{
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IUser()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, Initialize }
};
}
public long Initialize(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed.");
return 0;
}
}
}

View file

@ -0,0 +1,27 @@
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.Core.OsHle.Services.Nfp
{
class IUserManager : IpcService
{
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IUserManager()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetUserInterface }
};
}
public long GetUserInterface(ServiceCtx Context)
{
MakeObject(Context, new IUser());
return 0;
}
}
}

View file

@ -13,7 +13,8 @@ namespace Ryujinx.Core.OsHle.Services.Nifm
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
{ 4, CreateGeneralServiceOld } { 4, CreateGeneralServiceOld },
{ 5, CreateGeneralService }
}; };
} }
@ -23,5 +24,12 @@ namespace Ryujinx.Core.OsHle.Services.Nifm
return 0; return 0;
} }
public long CreateGeneralService(ServiceCtx Context)
{
MakeObject(Context, new IGeneralService());
return 0;
}
} }
} }

View file

@ -174,14 +174,14 @@ namespace Ryujinx.Core.OsHle.Services.Nv
private static int ProcessIoctl(ServiceCtx Context, int Cmd, IoctlProcessor Processor) private static int ProcessIoctl(ServiceCtx Context, int Cmd, IoctlProcessor Processor)
{ {
if (CmdIn(Cmd) && Context.Request.GetBufferType0x21Position() == 0) if (CmdIn(Cmd) && Context.Request.GetBufferType0x21().Position == 0)
{ {
Context.Ns.Log.PrintError(LogClass.ServiceNv, "Input buffer is null!"); Context.Ns.Log.PrintError(LogClass.ServiceNv, "Input buffer is null!");
return NvResult.InvalidInput; return NvResult.InvalidInput;
} }
if (CmdOut(Cmd) && Context.Request.GetBufferType0x22Position() == 0) if (CmdOut(Cmd) && Context.Request.GetBufferType0x22().Position == 0)
{ {
Context.Ns.Log.PrintError(LogClass.ServiceNv, "Output buffer is null!"); Context.Ns.Log.PrintError(LogClass.ServiceNv, "Output buffer is null!");

View file

@ -37,8 +37,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int BindChannel(ServiceCtx Context) private static int BindChannel(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -47,8 +47,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int AllocSpace(ServiceCtx Context) private static int AllocSpace(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASAllocSpace Args = AMemoryHelper.Read<NvGpuASAllocSpace>(Context.Memory, InputPosition); NvGpuASAllocSpace Args = AMemoryHelper.Read<NvGpuASAllocSpace>(Context.Memory, InputPosition);
@ -84,8 +84,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int FreeSpace(ServiceCtx Context) private static int FreeSpace(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASAllocSpace Args = AMemoryHelper.Read<NvGpuASAllocSpace>(Context.Memory, InputPosition); NvGpuASAllocSpace Args = AMemoryHelper.Read<NvGpuASAllocSpace>(Context.Memory, InputPosition);
@ -101,8 +101,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int UnmapBuffer(ServiceCtx Context) private static int UnmapBuffer(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASUnmapBuffer Args = AMemoryHelper.Read<NvGpuASUnmapBuffer>(Context.Memory, InputPosition); NvGpuASUnmapBuffer Args = AMemoryHelper.Read<NvGpuASUnmapBuffer>(Context.Memory, InputPosition);
@ -118,8 +118,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int MapBufferEx(ServiceCtx Context) private static int MapBufferEx(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASMapBufferEx Args = AMemoryHelper.Read<NvGpuASMapBufferEx>(Context.Memory, InputPosition); NvGpuASMapBufferEx Args = AMemoryHelper.Read<NvGpuASMapBufferEx>(Context.Memory, InputPosition);
@ -190,8 +190,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int GetVaRegions(ServiceCtx Context) private static int GetVaRegions(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -200,8 +200,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int InitializeEx(ServiceCtx Context) private static int InitializeEx(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -210,7 +210,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int Remap(ServiceCtx Context) private static int Remap(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
NvGpuASRemap Args = AMemoryHelper.Read<NvGpuASRemap>(Context.Memory, InputPosition); NvGpuASRemap Args = AMemoryHelper.Read<NvGpuASRemap>(Context.Memory, InputPosition);

View file

@ -38,7 +38,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int ZcullGetCtxSize(ServiceCtx Context) private static int ZcullGetCtxSize(ServiceCtx Context)
{ {
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuZcullGetCtxSize Args = new NvGpuGpuZcullGetCtxSize(); NvGpuGpuZcullGetCtxSize Args = new NvGpuGpuZcullGetCtxSize();
@ -53,7 +53,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int ZcullGetInfo(ServiceCtx Context) private static int ZcullGetInfo(ServiceCtx Context)
{ {
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuZcullGetInfo Args = new NvGpuGpuZcullGetInfo(); NvGpuGpuZcullGetInfo Args = new NvGpuGpuZcullGetInfo();
@ -77,8 +77,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int ZbcSetTable(ServiceCtx Context) private static int ZbcSetTable(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -87,8 +87,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetCharacteristics(ServiceCtx Context) private static int GetCharacteristics(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuGetCharacteristics Args = AMemoryHelper.Read<NvGpuGpuGetCharacteristics>(Context.Memory, InputPosition); NvGpuGpuGetCharacteristics Args = AMemoryHelper.Read<NvGpuGpuGetCharacteristics>(Context.Memory, InputPosition);
@ -137,8 +137,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetTpcMasks(ServiceCtx Context) private static int GetTpcMasks(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuGetTpcMasks Args = AMemoryHelper.Read<NvGpuGpuGetTpcMasks>(Context.Memory, InputPosition); NvGpuGpuGetTpcMasks Args = AMemoryHelper.Read<NvGpuGpuGetTpcMasks>(Context.Memory, InputPosition);
@ -154,7 +154,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetActiveSlotMask(ServiceCtx Context) private static int GetActiveSlotMask(ServiceCtx Context)
{ {
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuGetActiveSlotMask Args = new NvGpuGpuGetActiveSlotMask(); NvGpuGpuGetActiveSlotMask Args = new NvGpuGpuGetActiveSlotMask();
@ -170,7 +170,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetGpuTime(ServiceCtx Context) private static int GetGpuTime(ServiceCtx Context)
{ {
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Memory.WriteInt64(OutputPosition, GetPTimerNanoSeconds()); Context.Memory.WriteInt64(OutputPosition, GetPTimerNanoSeconds());

View file

@ -27,8 +27,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetUserData(ServiceCtx Context) private static int SetUserData(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -37,8 +37,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetNvMap(ServiceCtx Context) private static int SetNvMap(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -47,8 +47,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SubmitGpfifo(ServiceCtx Context) private static int SubmitGpfifo(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read<NvHostChannelSubmitGpfifo>(Context.Memory, InputPosition); NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read<NvHostChannelSubmitGpfifo>(Context.Memory, InputPosition);
@ -79,8 +79,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int AllocObjCtx(ServiceCtx Context) private static int AllocObjCtx(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -89,8 +89,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int ZcullBind(ServiceCtx Context) private static int ZcullBind(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -99,8 +99,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetErrorNotifier(ServiceCtx Context) private static int SetErrorNotifier(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -109,8 +109,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetPriority(ServiceCtx Context) private static int SetPriority(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@ -119,8 +119,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int AllocGpfifoEx2(ServiceCtx Context) private static int AllocGpfifoEx2(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");

View file

@ -40,7 +40,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int SyncptIncr(ServiceCtx Context) private static int SyncptIncr(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
int Id = Context.Memory.ReadInt32(InputPosition); int Id = Context.Memory.ReadInt32(InputPosition);
@ -71,8 +71,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int GetConfig(ServiceCtx Context) private static int GetConfig(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
string Nv = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0, 0x41); string Nv = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0, 0x41);
string Name = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0x41, 0x41); string Name = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0x41, 0x41);
@ -96,8 +96,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int EventRegister(ServiceCtx Context) private static int EventRegister(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
int EventId = Context.Memory.ReadInt32(InputPosition); int EventId = Context.Memory.ReadInt32(InputPosition);
@ -108,8 +108,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int SyncptReadMinOrMax(ServiceCtx Context, bool Max) private static int SyncptReadMinOrMax(ServiceCtx Context, bool Max)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostCtrlSyncptRead Args = AMemoryHelper.Read<NvHostCtrlSyncptRead>(Context.Memory, InputPosition); NvHostCtrlSyncptRead Args = AMemoryHelper.Read<NvHostCtrlSyncptRead>(Context.Memory, InputPosition);
@ -134,8 +134,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int SyncptWait(ServiceCtx Context, bool Extended) private static int SyncptWait(ServiceCtx Context, bool Extended)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostCtrlSyncptWait Args = AMemoryHelper.Read<NvHostCtrlSyncptWait>(Context.Memory, InputPosition); NvHostCtrlSyncptWait Args = AMemoryHelper.Read<NvHostCtrlSyncptWait>(Context.Memory, InputPosition);
@ -202,8 +202,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int EventWait(ServiceCtx Context, bool Async) private static int EventWait(ServiceCtx Context, bool Async)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostCtrlSyncptWaitEx Args = AMemoryHelper.Read<NvHostCtrlSyncptWaitEx>(Context.Memory, InputPosition); NvHostCtrlSyncptWaitEx Args = AMemoryHelper.Read<NvHostCtrlSyncptWaitEx>(Context.Memory, InputPosition);

View file

@ -36,8 +36,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Create(ServiceCtx Context) private static int Create(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapCreate Args = AMemoryHelper.Read<NvMapCreate>(Context.Memory, InputPosition); NvMapCreate Args = AMemoryHelper.Read<NvMapCreate>(Context.Memory, InputPosition);
@ -61,8 +61,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int FromId(ServiceCtx Context) private static int FromId(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapFromId Args = AMemoryHelper.Read<NvMapFromId>(Context.Memory, InputPosition); NvMapFromId Args = AMemoryHelper.Read<NvMapFromId>(Context.Memory, InputPosition);
@ -86,8 +86,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Alloc(ServiceCtx Context) private static int Alloc(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapAlloc Args = AMemoryHelper.Read<NvMapAlloc>(Context.Memory, InputPosition); NvMapAlloc Args = AMemoryHelper.Read<NvMapAlloc>(Context.Memory, InputPosition);
@ -149,8 +149,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Free(ServiceCtx Context) private static int Free(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapFree Args = AMemoryHelper.Read<NvMapFree>(Context.Memory, InputPosition); NvMapFree Args = AMemoryHelper.Read<NvMapFree>(Context.Memory, InputPosition);
@ -188,8 +188,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Param(ServiceCtx Context) private static int Param(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapParam Args = AMemoryHelper.Read<NvMapParam>(Context.Memory, InputPosition); NvMapParam Args = AMemoryHelper.Read<NvMapParam>(Context.Memory, InputPosition);
@ -222,8 +222,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int GetId(ServiceCtx Context) private static int GetId(ServiceCtx Context)
{ {
long InputPosition = Context.Request.GetBufferType0x21Position(); long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22Position(); long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapGetId Args = AMemoryHelper.Read<NvMapGetId>(Context.Memory, InputPosition); NvMapGetId Args = AMemoryHelper.Read<NvMapGetId>(Context.Memory, InputPosition);

View file

@ -8,6 +8,7 @@ using Ryujinx.Core.OsHle.Services.Friend;
using Ryujinx.Core.OsHle.Services.FspSrv; using Ryujinx.Core.OsHle.Services.FspSrv;
using Ryujinx.Core.OsHle.Services.Hid; using Ryujinx.Core.OsHle.Services.Hid;
using Ryujinx.Core.OsHle.Services.Lm; using Ryujinx.Core.OsHle.Services.Lm;
using Ryujinx.Core.OsHle.Services.Nfp;
using Ryujinx.Core.OsHle.Services.Ns; using Ryujinx.Core.OsHle.Services.Ns;
using Ryujinx.Core.OsHle.Services.Nv; using Ryujinx.Core.OsHle.Services.Nv;
using Ryujinx.Core.OsHle.Services.Pctl; using Ryujinx.Core.OsHle.Services.Pctl;
@ -79,6 +80,9 @@ namespace Ryujinx.Core.OsHle.Services
case "lm": case "lm":
return new ILogService(); return new ILogService();
case "nfp:user":
return new IUserManager();
case "nifm:u": case "nifm:u":
return new Nifm.IStaticService(); return new Nifm.IStaticService();

View file

@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc; using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic; using System.Collections.Generic;
@ -13,8 +14,17 @@ namespace Ryujinx.Core.OsHle.Services.Ssl
{ {
m_Commands = new Dictionary<int, ServiceProcessRequest>() m_Commands = new Dictionary<int, ServiceProcessRequest>()
{ {
//... { 5, SetInterfaceVersion }
}; };
} }
public long SetInterfaceVersion(ServiceCtx Context)
{
int Version = Context.RequestData.ReadInt32();
Context.Ns.Log.PrintStub(LogClass.ServiceSsl, "Stubbed.");
return 0;
}
} }
} }