From 4f177c9ee7452274f5e792349e9b443d78a27816 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 6 Mar 2018 17:27:50 -0300 Subject: [PATCH] More Vi/NvFlinger/NvDrv stubs, allow paths starting with //, do not allow paths that don't start with at least a /, increase map region size --- Ryujinx.Core/OsHle/MemoryRegions.cs | 2 +- .../OsHle/Services/Nv/ServiceNvDrv.cs | 20 +++++++++++++++++++ .../Services/Vi/IApplicationDisplayService.cs | 6 ++++++ .../Services/Vi/IManagerDisplayService.cs | 10 ++++++++-- Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs | 6 ++++++ Ryujinx.Core/VirtualFs.cs | 10 +++++++++- 6 files changed, 50 insertions(+), 4 deletions(-) diff --git a/Ryujinx.Core/OsHle/MemoryRegions.cs b/Ryujinx.Core/OsHle/MemoryRegions.cs index e362ba9f..7f5ab0ed 100644 --- a/Ryujinx.Core/OsHle/MemoryRegions.cs +++ b/Ryujinx.Core/OsHle/MemoryRegions.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Core.OsHle public const long AddrSpaceStart = 0x08000000; public const long MapRegionAddress = 0x10000000; - public const long MapRegionSize = 0x10000000; + public const long MapRegionSize = 0x20000000; public const long MainStackSize = 0x100000; diff --git a/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs b/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs index 0ea1d2ac..515c15e0 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs @@ -38,6 +38,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.NvServices { ("/dev/nvmap", 0x0101), NvMapIocCreate }, { ("/dev/nvmap", 0x0103), NvMapIocFromId }, { ("/dev/nvmap", 0x0104), NvMapIocAlloc }, + { ("/dev/nvmap", 0x0105), NvMapIocFree }, { ("/dev/nvmap", 0x0109), NvMapIocParam }, { ("/dev/nvmap", 0x010e), NvMapIocGetId }, }; @@ -585,6 +586,25 @@ namespace Ryujinx.Core.OsHle.IpcServices.NvServices return 0; } + private static long NvMapIocFree(ServiceCtx Context) + { + long Position = Context.Request.GetSendBuffPtr(); + + MemReader Reader = new MemReader(Context.Memory, Position); + MemWriter Writer = new MemWriter(Context.Memory, Position + 8); + + int Handle = Reader.ReadInt32(); + int Padding = Reader.ReadInt32(); + + HNvMap NvMap = Context.Ns.Os.Handles.GetData(Handle); + + Writer.WriteInt64(0); + Writer.WriteInt32(NvMap.Size); + Writer.WriteInt32(0); + + return 0; + } + private static long NvMapIocParam(ServiceCtx Context) { long Position = Context.Request.GetSendBuffPtr(); diff --git a/Ryujinx.Core/OsHle/Services/Vi/IApplicationDisplayService.cs b/Ryujinx.Core/OsHle/Services/Vi/IApplicationDisplayService.cs index 04dfee15..4e40b99b 100644 --- a/Ryujinx.Core/OsHle/Services/Vi/IApplicationDisplayService.cs +++ b/Ryujinx.Core/OsHle/Services/Vi/IApplicationDisplayService.cs @@ -26,6 +26,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi { 1010, OpenDisplay }, { 1020, CloseDisplay }, { 2020, OpenLayer }, + { 2021, CloseLayer }, { 2030, CreateStrayLayer }, { 2101, SetLayerScalingMode }, { 5202, GetDisplayVSyncEvent } @@ -96,6 +97,11 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi return 0; } + public long CloseLayer(ServiceCtx Context) + { + return 0; + } + public long CreateStrayLayer(ServiceCtx Context) { long LayerFlags = Context.RequestData.ReadInt64(); diff --git a/Ryujinx.Core/OsHle/Services/Vi/IManagerDisplayService.cs b/Ryujinx.Core/OsHle/Services/Vi/IManagerDisplayService.cs index 5adee78d..69dbff47 100644 --- a/Ryujinx.Core/OsHle/Services/Vi/IManagerDisplayService.cs +++ b/Ryujinx.Core/OsHle/Services/Vi/IManagerDisplayService.cs @@ -13,8 +13,9 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi { m_Commands = new Dictionary() { - { 2010, CreateManagedLayer }, - { 6000, AddToLayerStack } + { 2010, CreateManagedLayer }, + { 2011, DestroyManagedLayer }, + { 6000, AddToLayerStack } }; } @@ -25,6 +26,11 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi return 0; } + public long DestroyManagedLayer(ServiceCtx Context) + { + return 0; + } + public static long AddToLayerStack(ServiceCtx Context) { return 0; diff --git a/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs b/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs index 720dd44f..740a35f9 100644 --- a/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs +++ b/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs @@ -70,6 +70,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android { ("android.gui.IGraphicBufferProducer", 0x8), GbpCancelBuffer }, { ("android.gui.IGraphicBufferProducer", 0x9), GbpQuery }, { ("android.gui.IGraphicBufferProducer", 0xa), GbpConnect }, + { ("android.gui.IGraphicBufferProducer", 0xb), GbpDisconnect }, { ("android.gui.IGraphicBufferProducer", 0xe), GbpPreallocBuffer } }; @@ -212,6 +213,11 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android return MakeReplyParcel(Context, 1280, 720, 0, 0, 0); } + private long GbpDisconnect(ServiceCtx Context, BinaryReader ParcelReader) + { + return MakeReplyParcel(Context, 0); + } + private long GbpPreallocBuffer(ServiceCtx Context, BinaryReader ParcelReader) { int Slot = ParcelReader.ReadInt32(); diff --git a/Ryujinx.Core/VirtualFs.cs b/Ryujinx.Core/VirtualFs.cs index 195fb6a3..c0858e0e 100644 --- a/Ryujinx.Core/VirtualFs.cs +++ b/Ryujinx.Core/VirtualFs.cs @@ -18,10 +18,18 @@ namespace Ryujinx.Core public string GetFullPath(string BasePath, string FileName) { - if (FileName.StartsWith('/')) + if (FileName.StartsWith("//")) + { + FileName = FileName.Substring(2); + } + else if (FileName.StartsWith('/')) { FileName = FileName.Substring(1); } + else + { + return null; + } string FullPath = Path.GetFullPath(Path.Combine(BasePath, FileName));