aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs
blob: 8f585b0f7a002faf4f3413f07b728ebfe5c7fcf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
        }
    }
}