From 84b4ae56d8b9ac5ea0991d60fbf19510338021e0 Mon Sep 17 00:00:00 2001 From: Starlet Date: Mon, 9 Jul 2018 22:13:32 -0400 Subject: [PATCH] [NV] Fix NvHostCtrlGetConfig --- .../Nv/NvHostCtrl/NvHostCtrlGetConfig.cs | 14 +++++++++ .../Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs | 29 ++++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlGetConfig.cs diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlGetConfig.cs b/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlGetConfig.cs new file mode 100644 index 000000000..eda199a36 --- /dev/null +++ b/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlGetConfig.cs @@ -0,0 +1,14 @@ +using System.Runtime.InteropServices; + +namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl +{ + struct NvHostCtrlGetConfig + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x41)] + public string DomainString; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x41)] + public string ParameterString; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x101)] + public string ConfigurationString; + } +} \ No newline at end of file diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs b/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs index a9fd9d3ab..8474bbcd0 100644 --- a/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs +++ b/Ryujinx.HLE/OsHle/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs @@ -74,12 +74,33 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvHostCtrl 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); + NvHostCtrlGetConfig Args = AMemoryHelper.Read(Context.Memory, InputPosition); - Context.Memory.WriteByte(OutputPosition + 0x82, 0); + if (Args.DomainString == "nv") + { + if (Args.ParameterString == "NV_MEMORY_PROFILER") + { + Args.ParameterString = "0"; + } + else if (Args.ParameterString == "NVN_THROUGH_OPENGL") + { + Args.ParameterString = "0"; + } + else if (Args.ParameterString == "NVRM_GPU_PREVENT_USE") + { + Args.ParameterString = "0"; + } + else + { + Args.ParameterString = "0"; + } + } + else + { + Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Unimplemented domain string! {Args.DomainString}"); + } - Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed."); + AMemoryHelper.Write(Context.Memory, OutputPosition, Args); return NvResult.Success; }