diff --git a/ARMeilleure/Memory/IMemoryManager.cs b/ARMeilleure/Memory/IMemoryManager.cs deleted file mode 100644 index bcee5db230..0000000000 --- a/ARMeilleure/Memory/IMemoryManager.cs +++ /dev/null @@ -1,40 +0,0 @@ -using ARMeilleure.State; -using System; - -namespace ARMeilleure.Memory -{ - public interface IMemoryManager : IMemory, IDisposable - { - void Map(long va, long pa, long size); - - void Unmap(long position, long size); - - bool IsMapped(long position); - - long GetPhysicalAddress(long virtualAddress); - - bool IsRegionModified(long position, long size); - - bool TryGetHostAddress(long position, long size, out IntPtr ptr); - - bool IsValidPosition(long position); - - bool AtomicCompareExchangeInt32(long position, int expected, int desired); - - int AtomicIncrementInt32(long position); - - int AtomicDecrementInt32(long position); - - byte[] ReadBytes(long position, long size); - - void ReadBytes(long position, byte[] data, int startIndex, int size); - - void WriteVector128(long position, V128 value); - - void WriteBytes(long position, byte[] data); - - void WriteBytes(long position, byte[] data, int startIndex, int size); - - void CopyBytes(long src, long dst, long size); - } -} \ No newline at end of file diff --git a/ARMeilleure/Memory/MemoryHelper.cs b/ARMeilleure/Memory/MemoryHelper.cs index 71ddac2388..8e310d4d7f 100644 --- a/ARMeilleure/Memory/MemoryHelper.cs +++ b/ARMeilleure/Memory/MemoryHelper.cs @@ -7,7 +7,7 @@ namespace ARMeilleure.Memory { public static class MemoryHelper { - public static void FillWithZeros(IMemoryManager memory, long position, int size) + public static void FillWithZeros(MemoryManager memory, long position, int size) { int size8 = size & ~(8 - 1); @@ -22,7 +22,7 @@ namespace ARMeilleure.Memory } } - public unsafe static T Read(IMemoryManager memory, long position) where T : struct + public unsafe static T Read(MemoryManager memory, long position) where T : struct { long size = Marshal.SizeOf(); @@ -34,7 +34,7 @@ namespace ARMeilleure.Memory } } - public unsafe static void Write(IMemoryManager memory, long position, T value) where T : struct + public unsafe static void Write(MemoryManager memory, long position, T value) where T : struct { long size = Marshal.SizeOf(); @@ -48,7 +48,7 @@ namespace ARMeilleure.Memory memory.WriteBytes(position, data); } - public static string ReadAsciiString(IMemoryManager memory, long position, long maxSize = -1) + public static string ReadAsciiString(MemoryManager memory, long position, long maxSize = -1) { using (MemoryStream ms = new MemoryStream()) { diff --git a/ARMeilleure/Memory/MemoryManager.cs b/ARMeilleure/Memory/MemoryManager.cs index 12c1184373..c62249881d 100644 --- a/ARMeilleure/Memory/MemoryManager.cs +++ b/ARMeilleure/Memory/MemoryManager.cs @@ -7,7 +7,7 @@ using static ARMeilleure.Memory.MemoryManagement; namespace ARMeilleure.Memory { - public unsafe class MemoryManager : IMemoryManager + public unsafe class MemoryManager { public const int PageBits = 12; public const int PageSize = 1 << PageBits; diff --git a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs index ab45e9854e..10c36fe1da 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs @@ -230,7 +230,7 @@ namespace Ryujinx.Graphics.Texture public static byte[] ReadTexture(IMemory memory, GalImage image, long position) { - IMemoryManager cpuMemory; + MemoryManager cpuMemory; if (memory is NvGpuVmm vmm) { @@ -238,7 +238,7 @@ namespace Ryujinx.Graphics.Texture } else { - cpuMemory = (IMemoryManager)memory; + cpuMemory = (MemoryManager)memory; } ISwizzle swizzle = TextureHelper.GetSwizzle(image); diff --git a/Ryujinx.Graphics/Graphics3d/Texture/TextureHelper.cs b/Ryujinx.Graphics/Graphics3d/Texture/TextureHelper.cs index 22b803db3d..e07eb037d1 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/TextureHelper.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/TextureHelper.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Texture } } - public static (IMemoryManager Memory, long Position) GetMemoryAndPosition( + public static (MemoryManager Memory, long Position) GetMemoryAndPosition( IMemory memory, long position) { @@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Texture return (vmm.Memory, vmm.GetPhysicalAddress(position)); } - return ((IMemoryManager)memory, position); + return ((MemoryManager)memory, position); } } } diff --git a/Ryujinx.Graphics/Memory/NvGpuVmm.cs b/Ryujinx.Graphics/Memory/NvGpuVmm.cs index d8ccd6c74b..c72b82e37e 100644 --- a/Ryujinx.Graphics/Memory/NvGpuVmm.cs +++ b/Ryujinx.Graphics/Memory/NvGpuVmm.cs @@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Memory private const int PtLvl0Bit = PtPageBits + PtLvl1Bits; private const int PtLvl1Bit = PtPageBits; - public IMemoryManager Memory { get; private set; } + public MemoryManager Memory { get; private set; } private NvGpuVmmCache _cache; @@ -32,7 +32,7 @@ namespace Ryujinx.Graphics.Memory private long[][] _pageTable; - public NvGpuVmm(IMemoryManager memory) + public NvGpuVmm(MemoryManager memory) { Memory = memory; diff --git a/Ryujinx.Graphics/Memory/NvGpuVmmCache.cs b/Ryujinx.Graphics/Memory/NvGpuVmmCache.cs index 37ead4e0a9..2a5054434d 100644 --- a/Ryujinx.Graphics/Memory/NvGpuVmmCache.cs +++ b/Ryujinx.Graphics/Memory/NvGpuVmmCache.cs @@ -12,9 +12,9 @@ namespace Ryujinx.Graphics.Memory private ConcurrentDictionary[] _cachedPages; - private IMemoryManager _memory; + private MemoryManager _memory; - public NvGpuVmmCache(IMemoryManager memory) + public NvGpuVmmCache(MemoryManager memory) { _memory = memory; diff --git a/Ryujinx.HLE/HOS/Homebrew.cs b/Ryujinx.HLE/HOS/Homebrew.cs index 8e54f82c11..dca02d9181 100644 --- a/Ryujinx.HLE/HOS/Homebrew.cs +++ b/Ryujinx.HLE/HOS/Homebrew.cs @@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS public const string TemporaryNroSuffix = ".ryu_tmp.nro"; // http://switchbrew.org/index.php?title=Homebrew_ABI - public static void WriteHbAbiData(IMemoryManager memory, long position, int mainThreadHandle, string switchPath) + public static void WriteHbAbiData(MemoryManager memory, long position, int mainThreadHandle, string switchPath) { // MainThreadHandle. WriteConfigEntry(memory, ref position, 1, 0, mainThreadHandle); @@ -31,12 +31,12 @@ namespace Ryujinx.HLE.HOS } private static void WriteConfigEntry( - IMemoryManager memory, - ref long position, - int key, - int flags = 0, - long value0 = 0, - long value1 = 0) + MemoryManager memory, + ref long position, + int key, + int flags = 0, + long value0 = 0, + long value1 = 0) { memory.WriteInt32(position + 0x00, key); memory.WriteInt32(position + 0x04, flags); @@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS position += 0x18; } - public static string ReadHbAbiNextLoadPath(IMemoryManager memory, long position) + public static string ReadHbAbiNextLoadPath(MemoryManager memory, long position) { string fileName = null; diff --git a/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs b/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs index beb7878fdd..5eba571704 100644 --- a/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Ipc public static KernelResult IpcCall( Switch device, KProcess process, - IMemoryManager memory, + MemoryManager memory, KThread thread, KClientSession session, IpcMessage request, diff --git a/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs b/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs index fd80b3b9e0..fd2078ee16 100644 --- a/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs +++ b/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private LinkedList _blocks; - private IMemoryManager _cpuMemory; + private MemoryManager _cpuMemory; private Horizon _system; @@ -72,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private MersenneTwister _randomNumberGenerator; - public KMemoryManager(Horizon system, IMemoryManager cpuMemory) + public KMemoryManager(Horizon system, MemoryManager cpuMemory) { _system = system; _cpuMemory = cpuMemory; diff --git a/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs b/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs index 3eea71e213..4219eb7585 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs @@ -217,7 +217,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } } - private void LoadMod0Symbols(IMemoryManager memory, long textOffset) + private void LoadMod0Symbols(MemoryManager memory, long textOffset) { long mod0Offset = textOffset + memory.ReadUInt32(textOffset + 4); @@ -287,7 +287,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } } - private ElfSymbol GetSymbol(IMemoryManager memory, long address, long strTblAddr) + private ElfSymbol GetSymbol(MemoryManager memory, long address, long strTblAddr) { int nameIndex = memory.ReadInt32(address + 0); int info = memory.ReadByte (address + 4); diff --git a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index 5b2598a916..1b16d79a38 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process public bool IsPaused { get; private set; } - public IMemoryManager CpuMemory { get; private set; } + public MemoryManager CpuMemory { get; private set; } public Translator Translator { get; private set; } @@ -1024,7 +1024,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process CpuMemory = new MemoryManager(_system.Device.Memory.RamPointer, addrSpaceBits, useFlatPageTable); - Translator = new Translator((MemoryManager)CpuMemory); + Translator = new Translator(CpuMemory); MemoryManager = new KMemoryManager(_system, CpuMemory); } diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs index 7fcff5f2dc..0908de1083 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs @@ -348,7 +348,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall return KernelResult.InvalidThread; } - IMemoryManager memory = currentProcess.CpuMemory; + MemoryManager memory = currentProcess.CpuMemory; memory.WriteUInt64((long)address + 0x0, thread.Context.GetX(0)); memory.WriteUInt64((long)address + 0x8, thread.Context.GetX(1)); diff --git a/Ryujinx.HLE/HOS/ServiceCtx.cs b/Ryujinx.HLE/HOS/ServiceCtx.cs index df74ba0a8d..fa6cfca3a8 100644 --- a/Ryujinx.HLE/HOS/ServiceCtx.cs +++ b/Ryujinx.HLE/HOS/ServiceCtx.cs @@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS { public Switch Device { get; } public KProcess Process { get; } - public IMemoryManager Memory { get; } + public MemoryManager Memory { get; } public KThread Thread { get; } public KClientSession Session { get; } public IpcMessage Request { get; } @@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS public ServiceCtx( Switch device, KProcess process, - IMemoryManager memory, + MemoryManager memory, KThread thread, KClientSession session, IpcMessage request, diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/IAudioRenderer.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/IAudioRenderer.cs index 0075fd5f0a..aa9b6e516e 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/IAudioRenderer.cs @@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager private KEvent _updateEvent; - private IMemoryManager _memory; + private MemoryManager _memory; private IAalOutput _audioOut; @@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager public IAudioRenderer( Horizon system, - IMemoryManager memory, + MemoryManager memory, IAalOutput audioOut, AudioRendererParameter Params) { diff --git a/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/VoiceContext.cs b/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/VoiceContext.cs index 4bf15a59e9..60fe2e2342 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/VoiceContext.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/VoiceContext.cs @@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager _outStatus.VoiceDropsCount = 0; } - public int[] GetBufferData(IMemoryManager memory, int maxSamples, out int samplesCount) + public int[] GetBufferData(MemoryManager memory, int maxSamples, out int samplesCount) { if (!Playing) { @@ -122,7 +122,7 @@ namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager return output; } - private void UpdateBuffer(IMemoryManager memory) + private void UpdateBuffer(MemoryManager memory) { // TODO: Implement conversion for formats other // than interleaved stereo (2 channels). diff --git a/Ryujinx.HLE/Utilities/StructReader.cs b/Ryujinx.HLE/Utilities/StructReader.cs index 36e5c7d198..cd274a9582 100644 --- a/Ryujinx.HLE/Utilities/StructReader.cs +++ b/Ryujinx.HLE/Utilities/StructReader.cs @@ -5,11 +5,11 @@ namespace Ryujinx.HLE.Utilities { class StructReader { - private IMemoryManager _memory; + private MemoryManager _memory; public long Position { get; private set; } - public StructReader(IMemoryManager memory, long position) + public StructReader(MemoryManager memory, long position) { _memory = memory; Position = position; diff --git a/Ryujinx.HLE/Utilities/StructWriter.cs b/Ryujinx.HLE/Utilities/StructWriter.cs index c156956db7..b488b5d613 100644 --- a/Ryujinx.HLE/Utilities/StructWriter.cs +++ b/Ryujinx.HLE/Utilities/StructWriter.cs @@ -5,11 +5,11 @@ namespace Ryujinx.HLE.Utilities { class StructWriter { - private IMemoryManager _memory; + private MemoryManager _memory; public long Position { get; private set; } - public StructWriter(IMemoryManager memory, long position) + public StructWriter(MemoryManager memory, long position) { _memory = memory; Position = position;