1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

try to read objects with bad image tables

This commit is contained in:
Ted John
2016-06-28 21:16:09 +01:00
parent f0844370bb
commit 1b4079536d
5 changed files with 41 additions and 4 deletions

View File

@@ -149,6 +149,14 @@ void MemoryStream::Read(void * buffer, uint64 length)
_position = (void*)((uintptr_t)_position + length);
}
uint64 MemoryStream::TryRead(void * buffer, uint64 length)
{
uint64 remainingBytes = GetLength() - GetPosition();
uint64 bytesToRead = Math::Min(length, remainingBytes);
Read(buffer, bytesToRead);
return bytesToRead;
}
void MemoryStream::Write(const void * buffer, uint64 length)
{
uint64 position = GetPosition();