From 647d0962df5b54334af965b88f784409afbf6223 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 25 Dec 2019 20:28:17 -0300 Subject: Initialize GPU physical memory accessor from KProcess, to allow homebrew that never maps anything on the GPU to work --- Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs | 15 ------------- Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | 31 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 15 deletions(-) delete mode 100644 Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs create mode 100644 Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs (limited to 'Ryujinx.Graphics.Gpu/Memory') diff --git a/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs b/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs deleted file mode 100644 index 73b3a9e1..00000000 --- a/Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Ryujinx.Graphics.Gpu.Memory -{ - public interface IPhysicalMemory - { - int GetPageSize(); - - Span Read(ulong address, ulong size); - - void Write(ulong address, Span data); - - (ulong, ulong)[] GetModifiedRanges(ulong address, ulong size, ResourceName name); - } -} \ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs b/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs new file mode 100644 index 00000000..8f585b0f --- /dev/null +++ b/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs @@ -0,0 +1,31 @@ +using System; + +namespace Ryujinx.Graphics.Gpu.Memory +{ + using CpuMemoryManager = ARMeilleure.Memory.MemoryManager; + + class PhysicalMemory + { + private readonly CpuMemoryManager _cpuMemory; + + public PhysicalMemory(CpuMemoryManager cpuMemory) + { + _cpuMemory = cpuMemory; + } + + public Span Read(ulong address, ulong size) + { + return _cpuMemory.ReadBytes((long)address, (long)size); + } + + public void Write(ulong address, Span data) + { + _cpuMemory.WriteBytes((long)address, data.ToArray()); + } + + public (ulong, ulong)[] GetModifiedRanges(ulong address, ulong size, ResourceName name) + { + return _cpuMemory.GetModifiedRanges(address, size, (int)name); + } + } +} \ No newline at end of file -- cgit v1.2.3