diff --git a/Ryujinx.Core/Logging/LogClass.cs b/Ryujinx.Core/Logging/LogClass.cs index 0d9801ff33..d26855d006 100644 --- a/Ryujinx.Core/Logging/LogClass.cs +++ b/Ryujinx.Core/Logging/LogClass.cs @@ -23,6 +23,7 @@ namespace Ryujinx.Core.Logging ServiceHid, ServiceLm, ServiceMm, + ServiceNfp, ServiceNifm, ServiceNs, ServiceNv, @@ -32,6 +33,7 @@ namespace Ryujinx.Core.Logging ServiceSet, ServiceSfdnsres, ServiceSm, + ServiceSsl, ServiceSss, ServiceTime, ServiceVi diff --git a/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs b/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs index afcbb3a439..c985a4bbdd 100644 --- a/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs +++ b/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs @@ -174,34 +174,34 @@ namespace Ryujinx.Core.OsHle.Ipc 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); } } } diff --git a/Ryujinx.Core/OsHle/Services/Acc/IAccountServiceForApplication.cs b/Ryujinx.Core/OsHle/Services/Acc/IAccountServiceForApplication.cs index 7b09b5f0cd..84fb62bdf7 100644 --- a/Ryujinx.Core/OsHle/Services/Acc/IAccountServiceForApplication.cs +++ b/Ryujinx.Core/OsHle/Services/Acc/IAccountServiceForApplication.cs @@ -16,6 +16,7 @@ namespace Ryujinx.Core.OsHle.Services.Acc { { 0, GetUserCount }, { 3, ListOpenUsers }, + { 4, GetLastOpenedUser }, { 5, GetProfile }, { 100, InitializeApplicationInfo }, { 101, GetBaasAccountManagerForApplication } @@ -38,6 +39,16 @@ namespace Ryujinx.Core.OsHle.Services.Acc 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) { MakeObject(Context, new IProfile()); diff --git a/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs b/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs index 73ec7fac31..308a43220c 100644 --- a/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs +++ b/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs @@ -1,7 +1,6 @@ using Ryujinx.Core.Logging; using Ryujinx.Core.OsHle.Ipc; using System.Collections.Generic; -using System.IO; namespace Ryujinx.Core.OsHle.Services.Am { @@ -15,22 +14,22 @@ namespace Ryujinx.Core.OsHle.Services.Am { m_Commands = new Dictionary() { - { 1, PopLaunchParameter }, - { 20, EnsureSaveData }, - { 21, GetDesiredLanguage }, - { 22, SetTerminateResult }, - { 23, GetDisplayVersion }, - { 40, NotifyRunning }, - { 50, GetPseudoDeviceId } + { 1, PopLaunchParameter }, + { 20, EnsureSaveData }, + { 21, GetDesiredLanguage }, + { 22, SetTerminateResult }, + { 23, GetDisplayVersion }, + { 40, NotifyRunning }, + { 50, GetPseudoDeviceId }, + { 66, InitializeGamePlayRecording }, + { 67, SetGamePlayRecordingState } }; } - private const uint LaunchParamsMagic = 0xc79497ca; - public long PopLaunchParameter(ServiceCtx Context) { //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; } @@ -99,22 +98,20 @@ namespace Ryujinx.Core.OsHle.Services.Am return 0; } - private byte[] MakeLaunchParams() + public long InitializeGamePlayRecording(ServiceCtx Context) { - //Size needs to be at least 0x88 bytes otherwise application errors. - using (MemoryStream MS = new MemoryStream()) - { - BinaryWriter Writer = new BinaryWriter(MS); + Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); - MS.SetLength(0x88); + return 0; + } - 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 + public long SetGamePlayRecordingState(ServiceCtx Context) + { + int State = Context.RequestData.ReadInt32(); - return MS.ToArray(); - } + Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + + return 0; } } } diff --git a/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletAccessor.cs b/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletAccessor.cs new file mode 100644 index 0000000000..c990d647d7 --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletAccessor.cs @@ -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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + private KEvent StateChangedEvent; + + public ILibraryAppletAccessor() + { + m_Commands = new Dictionary() + { + { 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; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletCreator.cs b/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletCreator.cs index 7b3e12cc6a..52cd490e72 100644 --- a/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletCreator.cs +++ b/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletCreator.cs @@ -13,8 +13,23 @@ namespace Ryujinx.Core.OsHle.Services.Am { m_Commands = new Dictionary() { - //... + { 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; + } } } \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs b/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs index 41027df076..3fd5c7fc4d 100644 --- a/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs +++ b/Ryujinx.Core/OsHle/Services/Am/ISelfController.cs @@ -1,4 +1,5 @@ using Ryujinx.Core.Logging; +using Ryujinx.Core.OsHle.Handles; using Ryujinx.Core.OsHle.Ipc; using System.Collections.Generic; @@ -10,11 +11,14 @@ namespace Ryujinx.Core.OsHle.Services.Am public override IReadOnlyDictionary Commands => m_Commands; + private KEvent LaunchableEvent; + public ISelfController() { m_Commands = new Dictionary() { { 1, LockExit }, + { 9, GetLibraryAppletLaunchableEvent }, { 10, SetScreenShotPermission }, { 11, SetOperationModeChangedNotification }, { 12, SetPerformanceModeChangedNotification }, @@ -23,6 +27,8 @@ namespace Ryujinx.Core.OsHle.Services.Am { 16, SetOutOfFocusSuspendingEnabled }, { 50, SetHandlesRequestToDisplay } }; + + LaunchableEvent = new KEvent(); } public long LockExit(ServiceCtx Context) @@ -30,6 +36,19 @@ namespace Ryujinx.Core.OsHle.Services.Am 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) { bool Enable = Context.RequestData.ReadByte() != 0 ? true : false; diff --git a/Ryujinx.Core/OsHle/Services/Am/IStorageAccessor.cs b/Ryujinx.Core/OsHle/Services/Am/IStorageAccessor.cs index 12336df2ec..5efc49931f 100644 --- a/Ryujinx.Core/OsHle/Services/Am/IStorageAccessor.cs +++ b/Ryujinx.Core/OsHle/Services/Am/IStorageAccessor.cs @@ -1,4 +1,5 @@ using ChocolArm64.Memory; +using Ryujinx.Core.Logging; using Ryujinx.Core.OsHle.Ipc; using System; using System.Collections.Generic; @@ -18,6 +19,7 @@ namespace Ryujinx.Core.OsHle.Services.Am m_Commands = new Dictionary() { { 0, GetSize }, + { 10, Write }, { 11, Read } }; @@ -31,6 +33,13 @@ namespace Ryujinx.Core.OsHle.Services.Am return 0; } + public long Write(ServiceCtx Context) + { + Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed."); + + return 0; + } + public long Read(ServiceCtx Context) { long ReadPosition = Context.RequestData.ReadInt64(); diff --git a/Ryujinx.Core/OsHle/Services/Am/StorageHelper.cs b/Ryujinx.Core/OsHle/Services/Am/StorageHelper.cs new file mode 100644 index 0000000000..fa4f6bedb1 --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Am/StorageHelper.cs @@ -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(); + } + } + } +} diff --git a/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs b/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs index 1eb61d29f5..424bf6a9a3 100644 --- a/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs +++ b/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs @@ -19,11 +19,17 @@ namespace Ryujinx.Core.OsHle.Services.Aud { m_Commands = new Dictionary() { - { 0, ListAudioDeviceName }, - { 1, SetAudioDeviceOutputVolume }, - { 3, GetActiveAudioDeviceName }, - { 4, QueryAudioDeviceSystemEvent }, - { 5, GetActiveChannelCount } + { 0, ListAudioDeviceName }, + { 1, SetAudioDeviceOutputVolume }, + { 3, GetActiveAudioDeviceName }, + { 4, QueryAudioDeviceSystemEvent }, + { 5, GetActiveChannelCount }, + { 6, ListAudioDeviceNameAuto }, + { 7, SetAudioDeviceOutputVolumeAuto }, + { 8, GetAudioDeviceOutputVolumeAuto }, + { 10, GetActiveAudioDeviceNameAuto }, + { 11, QueryAudioDeviceInputEvent }, + { 12, QueryAudioDeviceOutputEvent } }; SystemEvent = new KEvent(); @@ -118,5 +124,102 @@ namespace Ryujinx.Core.OsHle.Services.Aud 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; + } } } diff --git a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystemProxy.cs index 29c5c68f34..4fbf018a47 100644 --- a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystemProxy.cs @@ -1,3 +1,4 @@ +using Ryujinx.Core.Logging; using Ryujinx.Core.OsHle.Ipc; using System.Collections.Generic; @@ -15,6 +16,7 @@ namespace Ryujinx.Core.OsHle.Services.FspSrv { { 1, SetCurrentProcess }, { 18, OpenSdCardFileSystem }, + { 22, CreateSaveDataFileSystem }, { 51, OpenSaveDataFileSystem }, { 200, OpenDataStorageByCurrentProcess }, { 203, OpenPatchDataStorageByCurrentProcess }, @@ -34,6 +36,13 @@ namespace Ryujinx.Core.OsHle.Services.FspSrv return 0; } + public long CreateSaveDataFileSystem(ServiceCtx Context) + { + Context.Ns.Log.PrintStub(LogClass.ServiceFs, "Stubbed."); + + return 0; + } + public long OpenSaveDataFileSystem(ServiceCtx Context) { MakeObject(Context, new IFileSystem(Context.Ns.VFs.GetGameSavesPath())); diff --git a/Ryujinx.Core/OsHle/Services/Nfp/IUser.cs b/Ryujinx.Core/OsHle/Services/Nfp/IUser.cs new file mode 100644 index 0000000000..199d4e151b --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Nfp/IUser.cs @@ -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 m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IUser() + { + m_Commands = new Dictionary() + { + { 0, Initialize } + }; + } + + public long Initialize(ServiceCtx Context) + { + Context.Ns.Log.PrintStub(LogClass.ServiceNfp, "Stubbed."); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Nfp/IUserManager.cs b/Ryujinx.Core/OsHle/Services/Nfp/IUserManager.cs new file mode 100644 index 0000000000..662987d74a --- /dev/null +++ b/Ryujinx.Core/OsHle/Services/Nfp/IUserManager.cs @@ -0,0 +1,27 @@ +using Ryujinx.Core.OsHle.Ipc; +using System.Collections.Generic; + +namespace Ryujinx.Core.OsHle.Services.Nfp +{ + class IUserManager : IpcService + { + private Dictionary m_Commands; + + public override IReadOnlyDictionary Commands => m_Commands; + + public IUserManager() + { + m_Commands = new Dictionary() + { + { 0, GetUserInterface } + }; + } + + public long GetUserInterface(ServiceCtx Context) + { + MakeObject(Context, new IUser()); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Nifm/IStaticService.cs b/Ryujinx.Core/OsHle/Services/Nifm/IStaticService.cs index 2129ce43a9..b2fe0f9762 100644 --- a/Ryujinx.Core/OsHle/Services/Nifm/IStaticService.cs +++ b/Ryujinx.Core/OsHle/Services/Nifm/IStaticService.cs @@ -13,7 +13,8 @@ namespace Ryujinx.Core.OsHle.Services.Nifm { m_Commands = new Dictionary() { - { 4, CreateGeneralServiceOld } + { 4, CreateGeneralServiceOld }, + { 5, CreateGeneralService } }; } @@ -23,5 +24,12 @@ namespace Ryujinx.Core.OsHle.Services.Nifm return 0; } + + public long CreateGeneralService(ServiceCtx Context) + { + MakeObject(Context, new IGeneralService()); + + return 0; + } } } \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs index aead6e04c6..16acf59206 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs @@ -174,14 +174,14 @@ namespace Ryujinx.Core.OsHle.Services.Nv 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!"); 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!"); diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs b/Ryujinx.Core/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs index 6be45d5c17..7262247114 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs @@ -37,8 +37,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int BindChannel(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -47,8 +47,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int AllocSpace(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASAllocSpace Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -84,8 +84,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int FreeSpace(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASAllocSpace Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -101,8 +101,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int UnmapBuffer(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASUnmapBuffer Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -118,8 +118,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int MapBufferEx(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASMapBufferEx Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -190,8 +190,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int GetVaRegions(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -200,8 +200,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int InitializeEx(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -210,7 +210,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int Remap(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; NvGpuASRemap Args = AMemoryHelper.Read(Context.Memory, InputPosition); diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs b/Ryujinx.Core/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs index b34d346b51..bba78ea8a2 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int ZcullGetCtxSize(ServiceCtx Context) { - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuGpuZcullGetCtxSize Args = new NvGpuGpuZcullGetCtxSize(); @@ -53,7 +53,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int ZcullGetInfo(ServiceCtx Context) { - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuGpuZcullGetInfo Args = new NvGpuGpuZcullGetInfo(); @@ -77,8 +77,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int ZbcSetTable(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -87,8 +87,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int GetCharacteristics(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuGpuGetCharacteristics Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -137,8 +137,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int GetTpcMasks(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuGpuGetTpcMasks Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -154,7 +154,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int GetActiveSlotMask(ServiceCtx Context) { - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuGpuGetActiveSlotMask Args = new NvGpuGpuGetActiveSlotMask(); @@ -170,7 +170,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int GetGpuTime(ServiceCtx Context) { - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Memory.WriteInt64(OutputPosition, GetPTimerNanoSeconds()); diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs b/Ryujinx.Core/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs index 85b4753398..857218eae3 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs @@ -27,8 +27,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetUserData(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -37,8 +37,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetNvMap(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -47,8 +47,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SubmitGpfifo(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -79,8 +79,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int AllocObjCtx(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -89,8 +89,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int ZcullBind(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -99,8 +99,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetErrorNotifier(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -109,8 +109,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetPriority(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -119,8 +119,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int AllocGpfifoEx2(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs b/Ryujinx.Core/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs index 8c705d7f03..1997f981f5 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs @@ -40,7 +40,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int SyncptIncr(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; int Id = Context.Memory.ReadInt32(InputPosition); @@ -71,8 +71,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int GetConfig(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; string Nv = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0, 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) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; 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) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostCtrlSyncptRead Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -134,8 +134,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int SyncptWait(ServiceCtx Context, bool Extended) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostCtrlSyncptWait Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -202,8 +202,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int EventWait(ServiceCtx Context, bool Async) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostCtrlSyncptWaitEx Args = AMemoryHelper.Read(Context.Memory, InputPosition); diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvMap/NvMapIoctl.cs b/Ryujinx.Core/OsHle/Services/Nv/NvMap/NvMapIoctl.cs index f9c1564a5a..aff2683efc 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvMap/NvMapIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvMap/NvMapIoctl.cs @@ -36,8 +36,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Create(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapCreate Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -61,8 +61,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int FromId(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapFromId Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -86,8 +86,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Alloc(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapAlloc Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -149,8 +149,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Free(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapFree Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -188,8 +188,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Param(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapParam Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -222,8 +222,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int GetId(ServiceCtx Context) { - long InputPosition = Context.Request.GetBufferType0x21Position(); - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long InputPosition = Context.Request.GetBufferType0x21().Position; + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapGetId Args = AMemoryHelper.Read(Context.Memory, InputPosition); diff --git a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs index 07dde173e2..05301d1eaf 100644 --- a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs +++ b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs @@ -8,6 +8,7 @@ using Ryujinx.Core.OsHle.Services.Friend; using Ryujinx.Core.OsHle.Services.FspSrv; using Ryujinx.Core.OsHle.Services.Hid; using Ryujinx.Core.OsHle.Services.Lm; +using Ryujinx.Core.OsHle.Services.Nfp; using Ryujinx.Core.OsHle.Services.Ns; using Ryujinx.Core.OsHle.Services.Nv; using Ryujinx.Core.OsHle.Services.Pctl; @@ -79,6 +80,9 @@ namespace Ryujinx.Core.OsHle.Services case "lm": return new ILogService(); + case "nfp:user": + return new IUserManager(); + case "nifm:u": return new Nifm.IStaticService(); diff --git a/Ryujinx.Core/OsHle/Services/Ssl/ISslService.cs b/Ryujinx.Core/OsHle/Services/Ssl/ISslService.cs index 825e336391..3dab451549 100644 --- a/Ryujinx.Core/OsHle/Services/Ssl/ISslService.cs +++ b/Ryujinx.Core/OsHle/Services/Ssl/ISslService.cs @@ -1,3 +1,4 @@ +using Ryujinx.Core.Logging; using Ryujinx.Core.OsHle.Ipc; using System.Collections.Generic; @@ -13,8 +14,17 @@ namespace Ryujinx.Core.OsHle.Services.Ssl { m_Commands = new Dictionary() { - //... + { 5, SetInterfaceVersion } }; } + + public long SetInterfaceVersion(ServiceCtx Context) + { + int Version = Context.RequestData.ReadInt32(); + + Context.Ns.Log.PrintStub(LogClass.ServiceSsl, "Stubbed."); + + return 0; + } } } \ No newline at end of file