diff --git a/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs b/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs index 200e746e84..c985a4bbdd 100644 --- a/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs +++ b/Ryujinx.Core/OsHle/Ipc/IpcMessage.cs @@ -181,7 +181,7 @@ namespace Ryujinx.Core.OsHle.Ipc 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, SendBuff[0].Size); } @@ -189,19 +189,19 @@ namespace Ryujinx.Core.OsHle.Ipc 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/Am/ILibraryAppletAccessor.cs b/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletAccessor.cs index 1749b686e6..c990d647d7 100644 --- a/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletAccessor.cs +++ b/Ryujinx.Core/OsHle/Services/Am/ILibraryAppletAccessor.cs @@ -2,7 +2,6 @@ using Ryujinx.Core.OsHle.Handles; using Ryujinx.Core.OsHle.Ipc; using System.Collections.Generic; -using System.IO; namespace Ryujinx.Core.OsHle.Services.Am { diff --git a/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs b/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs index d2083251c0..424bf6a9a3 100644 --- a/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs +++ b/Ryujinx.Core/OsHle/Services/Aud/IAudioDevice.cs @@ -131,8 +131,7 @@ namespace Ryujinx.Core.OsHle.Services.Aud Context.ResponseData.Write(DeviceNames.Length); - long Position = Context.Request.GetBufferType0x21().Position; - long Size = Context.Request.GetBufferType0x21().Size; + (long Position, long Size) = Context.Request.GetBufferType0x22(); long BasePosition = Position; diff --git a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs index 64bbd43012..16acf59206 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs @@ -181,7 +181,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv 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 f3aba0747a..7262247114 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvGpuAS/NvGpuASIoctl.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int BindChannel(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -48,7 +48,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int AllocSpace(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASAllocSpace Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -85,7 +85,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int FreeSpace(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASAllocSpace Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -102,7 +102,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int UnmapBuffer(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASUnmapBuffer Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -119,7 +119,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int MapBufferEx(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuASMapBufferEx Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -191,7 +191,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int GetVaRegions(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -201,7 +201,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS private static int InitializeEx(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); diff --git a/Ryujinx.Core/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs b/Ryujinx.Core/OsHle/Services/Nv/NvGpuGpu/NvGpuGpuIoctl.cs index fec361bcb3..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(); @@ -78,7 +78,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int ZbcSetTable(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -88,7 +88,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int GetCharacteristics(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvGpuGpuGetCharacteristics Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -138,7 +138,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu private static int GetTpcMasks(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + 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 38f5fcd4ca..857218eae3 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs @@ -28,7 +28,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetUserData(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -38,7 +38,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetNvMap(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -48,7 +48,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SubmitGpfifo(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -80,7 +80,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int AllocObjCtx(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -90,7 +90,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int ZcullBind(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -100,7 +100,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetErrorNotifier(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -110,7 +110,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int SetPriority(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); @@ -120,7 +120,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel private static int AllocGpfifoEx2(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + 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 19fc88a60c..1997f981f5 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs @@ -72,7 +72,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int GetConfig(ServiceCtx Context) { 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 Name = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0x41, 0x41); @@ -97,7 +97,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int EventRegister(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; int EventId = Context.Memory.ReadInt32(InputPosition); @@ -109,7 +109,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int SyncptReadMinOrMax(ServiceCtx Context, bool Max) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostCtrlSyncptRead Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -135,7 +135,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int SyncptWait(ServiceCtx Context, bool Extended) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvHostCtrlSyncptWait Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -203,7 +203,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl private static int EventWait(ServiceCtx Context, bool Async) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + 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 1b03e68a80..aff2683efc 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/NvMap/NvMapIoctl.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/NvMap/NvMapIoctl.cs @@ -37,7 +37,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Create(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapCreate Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -62,7 +62,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int FromId(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapFromId Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -87,7 +87,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Alloc(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapAlloc Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -150,7 +150,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Free(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapFree Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -189,7 +189,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int Param(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapParam Args = AMemoryHelper.Read(Context.Memory, InputPosition); @@ -223,7 +223,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap private static int GetId(ServiceCtx Context) { long InputPosition = Context.Request.GetBufferType0x21().Position; - long OutputPosition = Context.Request.GetBufferType0x22Position(); + long OutputPosition = Context.Request.GetBufferType0x22().Position; NvMapGetId Args = AMemoryHelper.Read(Context.Memory, InputPosition);