Remove IMemoryManager.cs and its references.

This commit is contained in:
LDj3SNuD 2019-10-07 20:51:34 +02:00
parent 4912a5d186
commit aa87ae8c81
18 changed files with 39 additions and 79 deletions

View file

@ -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);
}
}

View file

@ -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<T>(IMemoryManager memory, long position) where T : struct
public unsafe static T Read<T>(MemoryManager memory, long position) where T : struct
{
long size = Marshal.SizeOf<T>();
@ -34,7 +34,7 @@ namespace ARMeilleure.Memory
}
}
public unsafe static void Write<T>(IMemoryManager memory, long position, T value) where T : struct
public unsafe static void Write<T>(MemoryManager memory, long position, T value) where T : struct
{
long size = Marshal.SizeOf<T>();
@ -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())
{

View file

@ -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;

View file

@ -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);

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -12,9 +12,9 @@ namespace Ryujinx.Graphics.Memory
private ConcurrentDictionary<long, int>[] _cachedPages;
private IMemoryManager _memory;
private MemoryManager _memory;
public NvGpuVmmCache(IMemoryManager memory)
public NvGpuVmmCache(MemoryManager memory)
{
_memory = memory;

View file

@ -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;

View file

@ -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,

View file

@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
private LinkedList<KMemoryBlock> _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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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));

View file

@ -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,

View file

@ -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)
{

View file

@ -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).

View file

@ -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;

View file

@ -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;