mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-23 11:35:47 +00:00
Small cleanup in AMemory and removed some unused usings
This commit is contained in:
parent
9136897d4a
commit
7822348439
5 changed files with 16 additions and 16 deletions
|
@ -355,11 +355,18 @@ namespace ChocolArm64.Memory
|
||||||
|
|
||||||
public byte[] ReadBytes(long Position, long Size)
|
public byte[] ReadBytes(long Position, long Size)
|
||||||
{
|
{
|
||||||
|
if ((uint)Size > int.MaxValue)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(Size));
|
||||||
|
}
|
||||||
|
|
||||||
EnsureRangeIsValid(Position, Size, AMemoryPerm.Read);
|
EnsureRangeIsValid(Position, Size, AMemoryPerm.Read);
|
||||||
|
|
||||||
byte[] Result = new byte[Size];
|
byte[] Data = new byte[Size];
|
||||||
Marshal.Copy((IntPtr)(RamPtr + (uint)Position), Result, 0, (int)Size);
|
|
||||||
return Result;
|
Marshal.Copy((IntPtr)(RamPtr + (uint)Position), Data, 0, (int)Size);
|
||||||
|
|
||||||
|
return Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector128<float> ReadVector8Unchecked(long Position)
|
public Vector128<float> ReadVector8Unchecked(long Position)
|
||||||
|
@ -392,9 +399,7 @@ namespace ChocolArm64.Memory
|
||||||
{
|
{
|
||||||
if (Sse.IsSupported)
|
if (Sse.IsSupported)
|
||||||
{
|
{
|
||||||
byte* Address = RamPtr + (uint)Position;
|
return Sse.LoadScalarVector128((float*)(RamPtr + (uint)Position));
|
||||||
|
|
||||||
return Sse.LoadScalarVector128((float*)Address);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -420,9 +425,7 @@ namespace ChocolArm64.Memory
|
||||||
{
|
{
|
||||||
if (Sse.IsSupported)
|
if (Sse.IsSupported)
|
||||||
{
|
{
|
||||||
byte* Address = RamPtr + (uint)Position;
|
return Sse.LoadVector128((float*)(RamPtr + (uint)Position));
|
||||||
|
|
||||||
return Sse.LoadVector128((float*)Address);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -678,11 +681,12 @@ namespace ChocolArm64.Memory
|
||||||
|
|
||||||
private void EnsureRangeIsValid(long Position, long Size, AMemoryPerm Perm)
|
private void EnsureRangeIsValid(long Position, long Size, AMemoryPerm Perm)
|
||||||
{
|
{
|
||||||
long EndPos = (Position + Size);
|
long EndPos = Position + Size;
|
||||||
Position = Position & ~AMemoryMgr.PageMask; //check base of each page
|
|
||||||
while (Position < EndPos)
|
while ((ulong)Position < (ulong)EndPos)
|
||||||
{
|
{
|
||||||
EnsureAccessIsValid(Position, Perm);
|
EnsureAccessIsValid(Position, Perm);
|
||||||
|
|
||||||
Position += AMemoryMgr.PageSize;
|
Position += AMemoryMgr.PageSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using ChocolArm64.State;
|
using ChocolArm64.State;
|
||||||
using Ryujinx.Core.Logging;
|
using Ryujinx.Core.Logging;
|
||||||
using Ryujinx.Core.OsHle.Handles;
|
using Ryujinx.Core.OsHle.Handles;
|
||||||
using System;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using static Ryujinx.Core.OsHle.ErrorCode;
|
using static Ryujinx.Core.OsHle.ErrorCode;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using ChocolArm64.Memory;
|
using ChocolArm64.Memory;
|
||||||
using Ryujinx.Core.Logging;
|
|
||||||
using Ryujinx.Core.OsHle.Ipc;
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using ChocolArm64.Memory;
|
|
||||||
using Ryujinx.Core.Logging;
|
using Ryujinx.Core.Logging;
|
||||||
using Ryujinx.Core.OsHle.Ipc;
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using ChocolArm64.Memory;
|
|
||||||
using Ryujinx.Core.OsHle.Handles;
|
using Ryujinx.Core.OsHle.Handles;
|
||||||
using Ryujinx.Core.OsHle.Ipc;
|
using Ryujinx.Core.OsHle.Ipc;
|
||||||
using Ryujinx.Core.OsHle.Services.Android;
|
using Ryujinx.Core.OsHle.Services.Android;
|
||||||
|
|
Loading…
Reference in a new issue