From 456db46065524846156b4b3257a88e422aedd630 Mon Sep 17 00:00:00 2001 From: Coxxs <58-coxxs@users.noreply.git.ryujinx.app> Date: Sun, 16 Nov 2025 18:24:41 -0600 Subject: [PATCH] Stub IWriterForApplication: 0 (CreateContextRegistrar) (ryubing/ryujinx!183) See merge request ryubing/ryujinx!183 --- src/Ryujinx.Common/Logging/LogClass.cs | 1 + .../HOS/Services/Ectx/IContextRegistrar.cs | 32 +++++++++++++++++++ .../Services/Ectx/IWriterForApplication.cs | 9 ++++++ 3 files changed, 42 insertions(+) create mode 100644 src/Ryujinx.HLE/HOS/Services/Ectx/IContextRegistrar.cs diff --git a/src/Ryujinx.Common/Logging/LogClass.cs b/src/Ryujinx.Common/Logging/LogClass.cs index 89f0336dc..eb0821db6 100644 --- a/src/Ryujinx.Common/Logging/LogClass.cs +++ b/src/Ryujinx.Common/Logging/LogClass.cs @@ -35,6 +35,7 @@ namespace Ryujinx.Common.Logging ServiceBsd, ServiceBtm, ServiceCaps, + ServiceEctx, ServiceFatal, ServiceFriend, ServiceFs, diff --git a/src/Ryujinx.HLE/HOS/Services/Ectx/IContextRegistrar.cs b/src/Ryujinx.HLE/HOS/Services/Ectx/IContextRegistrar.cs new file mode 100644 index 000000000..34adfe9be --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Services/Ectx/IContextRegistrar.cs @@ -0,0 +1,32 @@ +using System; +using Ryujinx.Common.Logging; +using Ryujinx.Horizon.Common; + +namespace Ryujinx.HLE.HOS.Services.Ectx +{ + class IContextRegistrar : DisposableIpcService + { + public IContextRegistrar(ServiceCtx context) { } + + [CommandCmif(0)] // 11.0.0+ + // Complete(nn::Result result, buffer raw_context) -> (i32 context_descriptor) + public ResultCode Complete(ServiceCtx context) + { + Result result = new(context.RequestData.ReadInt32()); + ulong rawContextPosition = context.Request.SendBuff[0].Position; + ulong rawContextSize = context.Request.SendBuff[0].Size; + + byte[] rawContext = new byte[rawContextSize]; + + context.Memory.Read(rawContextPosition, rawContext); + + context.ResponseData.Write(0); // TODO: return context_descriptor + + Logger.Stub?.PrintStub(LogClass.ServiceEctx, $"Result: {result}, rawContext: {Convert.ToHexString(rawContext)}" ); + + return ResultCode.Success; + } + + protected override void Dispose(bool isDisposing) { } + } +} diff --git a/src/Ryujinx.HLE/HOS/Services/Ectx/IWriterForApplication.cs b/src/Ryujinx.HLE/HOS/Services/Ectx/IWriterForApplication.cs index cf2cdddc2..c8ef155e3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ectx/IWriterForApplication.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ectx/IWriterForApplication.cs @@ -4,5 +4,14 @@ namespace Ryujinx.HLE.HOS.Services.Ectx class IWriterForApplication : IpcService { public IWriterForApplication(ServiceCtx context) { } + + [CommandCmif(0)] + // CreateContextRegistrar() -> object + public ResultCode CreateContextRegistrar(ServiceCtx context) + { + MakeObject(context, new IContextRegistrar(context)); + + return ResultCode.Success; + } } }