From d78609cceb2dc4993623e777d5b0ba42232990cc Mon Sep 17 00:00:00 2001 From: superp00t Date: Sun, 16 Mar 2025 02:18:03 -0400 Subject: [PATCH] fix(file): added missing Read and ReadP calls on Windows --- bc/system/file/Stacked.cpp | 3 +-- bc/system/file/Stacked.hpp | 1 - bc/system/file/System_File.cpp | 16 +++++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bc/system/file/Stacked.cpp b/bc/system/file/Stacked.cpp index ff5b178..2b031b9 100644 --- a/bc/system/file/Stacked.cpp +++ b/bc/system/file/Stacked.cpp @@ -1,7 +1,6 @@ - +#include "bc/system/file/Stacked.hpp" #include "bc/file/Filesystem.hpp" #include "bc/system/file/System_File.hpp" -#include "bc/system/file/Stacked.hpp" #include "bc/String.hpp" #include "bc/Memory.hpp" diff --git a/bc/system/file/Stacked.hpp b/bc/system/file/Stacked.hpp index 1a6724d..98f0d82 100644 --- a/bc/system/file/Stacked.hpp +++ b/bc/system/file/Stacked.hpp @@ -3,7 +3,6 @@ #include "bc/file/Types.hpp" #include "bc/file/Filesystem.hpp" -#include "bc/system/file/System_File.hpp" #include diff --git a/bc/system/file/System_File.cpp b/bc/system/file/System_File.cpp index 99d424c..0a1f0b9 100644 --- a/bc/system/file/System_File.cpp +++ b/bc/system/file/System_File.cpp @@ -308,12 +308,26 @@ bool write_init(Blizzard::File::StreamRecord* file, void* data, LPOVERLAPPED ove return write_func(file, data, overlapped, count); } +bool Read(Blizzard::File::Filesystem* fs, Stacked::FileParms* parms) { + return read_func(parms->file, parms->data, nullptr, reinterpret_cast(&parms->count)); +} + +bool ReadP(Blizzard::File::Filesystem* fs, Stacked::FileParms* parms) { + OVERLAPPED overlapped; + overlapped.Offset = static_cast(parms->offset & 0xFFFFFFFF); + overlapped.OffsetHigh = static_cast((parms->offset >> 32) & 0xFFFFFFFF); + overlapped.Internal = 0; + overlapped.InternalHigh = 0; + overlapped.hEvent = nullptr; + return read_func(parms->file, parms->data, &overlapped, reinterpret_cast(&parms->count)); +} + bool Write(Blizzard::File::Filesystem* fs, Stacked::FileParms* parms) { return write_func(parms->file, parms->data, nullptr, reinterpret_cast(&parms->count)); } bool WriteP(Blizzard::File::Filesystem* fs, Stacked::FileParms* parms) { - OVERLAPPED overlapped = {}; + OVERLAPPED overlapped; overlapped.Offset = static_cast(parms->offset & 0xFFFFFFFF); overlapped.OffsetHigh = static_cast((parms->offset >> 32) & 0xFFFFFFFF); overlapped.Internal = 0;