From 10af9ac6954077352ea57311581dfe7543d5cb7d Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 27 Jan 2024 01:41:34 +0100 Subject: [PATCH] Tier0: add overload for reading pointer data and fix write overload Write should've been a pointer instead. --- r5dev/public/tier0/binstream.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/r5dev/public/tier0/binstream.h b/r5dev/public/tier0/binstream.h index 6c01f660..7d92e5d6 100644 --- a/r5dev/public/tier0/binstream.h +++ b/r5dev/public/tier0/binstream.h @@ -46,7 +46,13 @@ public: // Purpose: reads any value from the file with specified size //----------------------------------------------------------------------------- template - void Read(T& tValue, size_t nSize) + void Read(T* tValue, const size_t nSize) + { + if (IsReadable()) + m_Stream.read(reinterpret_cast(tValue), nSize); + } + template + void Read(T& tValue, const size_t nSize) { if (IsReadable()) m_Stream.read(reinterpret_cast(&tValue), nSize); @@ -84,7 +90,7 @@ public: // Purpose: writes any value to the file with specified size //----------------------------------------------------------------------------- template - void Write(T tValue, size_t nSize) + void Write(T* tValue, size_t nSize) { if (!IsWritable()) return;