aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/OsHle/Services/IpcService.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-07-29 01:36:29 -0300
committerGitHub <noreply@github.com>2018-07-29 01:36:29 -0300
commitfdda67d4762c6a283ff0f1f76c02a02b21d9b119 (patch)
treeeb78495b4df7b74dd4765d79546e3f6ebe4d0892 /Ryujinx.HLE/OsHle/Services/IpcService.cs
parent7a308d9e7305a864504ff9eae32c3927643dbf47 (diff)
Some fix to IRequest on NIFM, support sending objects to services (#294)
Diffstat (limited to 'Ryujinx.HLE/OsHle/Services/IpcService.cs')
-rw-r--r--Ryujinx.HLE/OsHle/Services/IpcService.cs39
1 files changed, 34 insertions, 5 deletions
diff --git a/Ryujinx.HLE/OsHle/Services/IpcService.cs b/Ryujinx.HLE/OsHle/Services/IpcService.cs
index 25fd56fe..3c1a136f 100644
--- a/Ryujinx.HLE/OsHle/Services/IpcService.cs
+++ b/Ryujinx.HLE/OsHle/Services/IpcService.cs
@@ -50,9 +50,18 @@ namespace Ryujinx.HLE.OsHle.Services
int DomainWord0 = Context.RequestData.ReadInt32();
int DomainObjId = Context.RequestData.ReadInt32();
- long Padding = Context.RequestData.ReadInt64();
+ int DomainCmd = (DomainWord0 >> 0) & 0xff;
+ int InputObjCount = (DomainWord0 >> 8) & 0xff;
+ int DataPayloadSize = (DomainWord0 >> 16) & 0xffff;
- int DomainCmd = DomainWord0 & 0xff;
+ Context.RequestData.BaseStream.Seek(0x10 + DataPayloadSize, SeekOrigin.Begin);
+
+ for (int Index = 0; Index < InputObjCount; Index++)
+ {
+ Context.Request.ObjectIds.Add(Context.RequestData.ReadInt32());
+ }
+
+ Context.RequestData.BaseStream.Seek(0x10, SeekOrigin.Begin);
if (DomainCmd == 1)
{
@@ -88,14 +97,14 @@ namespace Ryujinx.HLE.OsHle.Services
if (IsDomain)
{
- foreach (int Id in Context.Response.ResponseObjIds)
+ foreach (int Id in Context.Response.ObjectIds)
{
Context.ResponseData.Write(Id);
}
Context.ResponseData.BaseStream.Seek(0, SeekOrigin.Begin);
- Context.ResponseData.Write(Context.Response.ResponseObjIds.Count);
+ Context.ResponseData.Write(Context.Response.ObjectIds.Count);
}
Context.ResponseData.BaseStream.Seek(IsDomain ? 0x10 : 0, SeekOrigin.Begin);
@@ -117,7 +126,7 @@ namespace Ryujinx.HLE.OsHle.Services
if (Service.IsDomain)
{
- Context.Response.ResponseObjIds.Add(Service.Add(Obj));
+ Context.Response.ObjectIds.Add(Service.Add(Obj));
}
else
{
@@ -129,6 +138,26 @@ namespace Ryujinx.HLE.OsHle.Services
}
}
+ protected static T GetObject<T>(ServiceCtx Context, int Index) where T : IpcService
+ {
+ IpcService Service = Context.Session.Service;
+
+ if (!Service.IsDomain)
+ {
+ int Handle = Context.Request.HandleDesc.ToMove[Index];
+
+ KSession Session = Context.Process.HandleTable.GetData<KSession>(Handle);
+
+ return Session?.Service is T ? (T)Session.Service : null;
+ }
+
+ int ObjId = Context.Request.ObjectIds[Index];
+
+ IIpcService Obj = Service.GetObject(ObjId);
+
+ return Obj is T ? (T)Obj : null;
+ }
+
private int Add(IIpcService Obj)
{
return DomainObjects.Add(Obj);