diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-12-25 20:28:17 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 647d0962df5b54334af965b88f784409afbf6223 (patch) | |
| tree | 3cd884099188341f869919c8235deecdea96be9b /Ryujinx.Graphics.Gpu/Memory | |
| parent | 6cf9a04d981a9e966cccb0dc90182e29aac7e270 (diff) | |
Initialize GPU physical memory accessor from KProcess, to allow homebrew that never maps anything on the GPU to work
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Memory/IPhysicalMemory.cs | 15 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | 31 |
2 files changed, 31 insertions, 15 deletions
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<byte> Read(ulong address, ulong size); - - void Write(ulong address, Span<byte> 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<byte> Read(ulong address, ulong size) + { + return _cpuMemory.ReadBytes((long)address, (long)size); + } + + public void Write(ulong address, Span<byte> 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 |
