aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Cpu/Tracking/CpuRegionHandle.cs
blob: e766460fe93f13c9431bbe38cfaab6eed3dd3c66 (plain) (blame)
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
32
33
34
35
36
37
using Ryujinx.Memory.Tracking;
using System;

namespace Ryujinx.Cpu.Tracking
{
    public class CpuRegionHandle : IRegionHandle
    {
        private readonly RegionHandle _impl;

        public bool Dirty => _impl.Dirty;
        public bool Unmapped => _impl.Unmapped;
        public ulong Address => _impl.Address;
        public ulong Size => _impl.Size;
        public ulong EndAddress => _impl.EndAddress;

        internal CpuRegionHandle(RegionHandle impl)
        {
            _impl = impl;
        }

        public void Dispose() => _impl.Dispose();
        public bool DirtyOrVolatile() => _impl.DirtyOrVolatile();
        public void ForceDirty() => _impl.ForceDirty();
        public IRegionHandle GetHandle() => _impl;
        public void RegisterAction(RegionSignal action) => _impl.RegisterAction(action);
        public void RegisterPreciseAction(PreciseRegionSignal action) => _impl.RegisterPreciseAction(action);
        public void RegisterDirtyEvent(Action action) => _impl.RegisterDirtyEvent(action);
        public void Reprotect(bool asDirty = false) => _impl.Reprotect(asDirty);

        public bool OverlapsWith(ulong address, ulong size) => _impl.OverlapsWith(address, size);

        public bool RangeEquals(CpuRegionHandle other)
        {
            return _impl.RealAddress == other._impl.RealAddress && _impl.RealSize == other._impl.RealSize;
        }
    }
}