diff --git a/src/pbg3/FileAbstraction.cpp b/src/pbg3/FileAbstraction.cpp index e2171030..53575428 100644 --- a/src/pbg3/FileAbstraction.cpp +++ b/src/pbg3/FileAbstraction.cpp @@ -106,16 +106,24 @@ i32 FileAbstraction::ReadByte() } } -i32 FileAbstraction::WriteByte(u8 b) +i32 FileAbstraction::WriteByte(u32 b) { - u8 res; + u8 outByte; u32 outBytesWritten; - - if (this->Write(&b, 1, &outBytesWritten) == FALSE) + + outByte = b; + if (this->Write(&outByte, 1, &outBytesWritten) == FALSE) { return -1; } - return outBytesWritten != 0 ? b : -1; + else + { + if (outBytesWritten == 0) + { + return -1; + } + return b; + } } i32 FileAbstraction::Seek(u32 amount, u32 seekFrom) diff --git a/src/pbg3/FileAbstraction.hpp b/src/pbg3/FileAbstraction.hpp index c1aad377..d1885130 100644 --- a/src/pbg3/FileAbstraction.hpp +++ b/src/pbg3/FileAbstraction.hpp @@ -14,7 +14,7 @@ class IFileAbstraction virtual i32 Read(u8 *data, u32 dataLen, u32 *numBytesRead) = 0; virtual i32 Write(u8 *data, u32 dataLen, u32 *outWritten) = 0; virtual i32 ReadByte() = 0; - virtual i32 WriteByte(u8 b) = 0; + virtual i32 WriteByte(u32 b) = 0; virtual i32 Seek(u32 amount, u32 seekFrom) = 0; virtual u32 Tell() = 0; virtual u32 GetSize() = 0; @@ -32,7 +32,7 @@ class FileAbstraction : public IFileAbstraction virtual i32 Read(u8 *data, u32 dataLen, u32 *numBytesRead); virtual i32 Write(u8 *data, u32 dataLen, u32 *outWritten); virtual i32 ReadByte(); - virtual i32 WriteByte(u8 b); + virtual i32 WriteByte(u32 b); virtual i32 Seek(u32 amount, u32 seekFrom); virtual u32 Tell(); virtual u32 GetSize();