PPTC meets ExeFS Patching. (#1865)

* PPTC meets ExeFS Patching.

* InternalVersion = 1865

* Ready!

* Optimized the PtcProfiler Load/Save methods.
This commit is contained in:
LDj3SNuD 2021-05-13 20:05:15 +02:00 committed by GitHub
parent a8022ca3a1
commit 57ea3f93a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 190 additions and 166 deletions

View file

@ -50,7 +50,12 @@ namespace ARMeilleure.Translation.PTC
T structure = default(T);
Span<T> spanT = MemoryMarshal.CreateSpan(ref structure, 1);
stream.Read(MemoryMarshal.AsBytes(spanT));
int bytesCount = stream.Read(MemoryMarshal.AsBytes(spanT));
if (bytesCount != Unsafe.SizeOf<T>())
{
throw new EndOfStreamException();
}
return structure;
}
@ -130,7 +135,12 @@ namespace ARMeilleure.Translation.PTC
T[] item = new T[itemLength];
stream.Read(MemoryMarshal.AsBytes(item.AsSpan()));
int bytesCount = stream.Read(MemoryMarshal.AsBytes(item.AsSpan()));
if (bytesCount != itemLength)
{
throw new EndOfStreamException();
}
list.Add(item);
}