Allow "reinterpretation" of framebuffer/zeta formats (#418)

* (Re)Implement format reinterpretation, other changes

* Implement writeback to guest memory, some refactoring

* More refactoring, implement reinterpretation the old way again

* Clean up

* Some fixes on M2MF (old Dma engine), added partial support for P2MF, fix conditional ssy, add Z24S8 zeta format, other fixes

* nit: Formatting

* Address PR feedback
This commit is contained in:
gdkchan 2018-09-18 01:30:35 -03:00 committed by GitHub
parent 3d16dbe12c
commit 193bf223ec

View File

@ -287,6 +287,14 @@ namespace ChocolArm64.Memory
return Data;
}
public void ReadBytes(long Position, byte[] Data, int StartIndex, int Size)
{
//Note: This will be moved later.
EnsureRangeIsValid(Position, (uint)Size);
Marshal.Copy((IntPtr)Translate(Position), Data, StartIndex, Size);
}
public void WriteSByte(long Position, sbyte Value)
{
WriteByte(Position, (byte)Value);
@ -403,6 +411,27 @@ namespace ChocolArm64.Memory
Marshal.Copy(Data, 0, (IntPtr)TranslateWrite(Position), Data.Length);
}
public void WriteBytes(long Position, byte[] Data, int StartIndex, int Size)
{
//Note: This will be moved later.
//Using Translate instead of TranslateWrite is on purpose.
EnsureRangeIsValid(Position, (uint)Size);
Marshal.Copy(Data, StartIndex, (IntPtr)Translate(Position), Size);
}
public void CopyBytes(long Src, long Dst, long Size)
{
//Note: This will be moved later.
EnsureRangeIsValid(Src, Size);
EnsureRangeIsValid(Dst, Size);
byte* SrcPtr = Translate(Src);
byte* DstPtr = TranslateWrite(Dst);
Buffer.MemoryCopy(SrcPtr, DstPtr, Size, Size);
}
public void Map(long VA, long PA, long Size)
{
SetPTEntries(VA, RamPtr + PA, Size);