chore(build): update file io calls to work with updated BC

This commit is contained in:
VDm 2025-03-18 21:03:40 +04:00
parent f893467b7c
commit e3b6b932da
3 changed files with 10 additions and 5 deletions

View File

@ -22,7 +22,7 @@
#include <storm/Error.hpp>
#include <storm/Log.hpp>
#include <bc/os/Path.hpp>
#include <bc/file/File.hpp>
#include <bc/File.hpp>
CVar* Client::g_accountNameVar;

View File

@ -209,7 +209,7 @@ int32_t CVar::Load(HOSFILE file) {
auto grown = 0x1fff < size;
int32_t result = 0;
size_t bytesRead = 0;
uint32_t bytesRead = 0;
if (OsReadFile(file, data, size, &bytesRead) == 0) {
result = 0;

View File

@ -5,7 +5,7 @@
#include <storm/Error.hpp>
#include <storm/Memory.hpp>
#include <storm/String.hpp>
#include <bc/file/File.hpp>
#include <bc/File.hpp>
#include "util/Filesystem.hpp"
static char s_basepath[STORM_MAX_PATH] = { 0 };
@ -150,7 +150,9 @@ int32_t SFile::OpenEx(SArchive* archive, const char* filename, uint32_t flags, S
void* filehandle;
HANDLE handle;
uint32_t openflags = BC_FILE_OPEN_MUST_EXIST | BC_FILE_OPEN_SHARE_READ | BC_FILE_OPEN_READ;
using Mode = Blizzard::File::Mode;
uint32_t openflags = Mode::mustexist | Mode::shareread | Mode::read;
Blizzard::File::StreamRecord* stream;
// Attempt to open plain file first
@ -212,7 +214,10 @@ int32_t SFile::Read(SFile* file, void* buffer, size_t bytestoread, size_t* bytes
switch (file->m_type) {
case SFILE_PLAIN: {
auto stream = reinterpret_cast<Blizzard::File::StreamRecord*>(file->m_handle);
Blizzard::File::Read(stream, buffer, bytestoread, bytesread);
int32_t count = static_cast<int32_t>(bytestoread);
Blizzard::File::Read(stream, buffer, &count);
if (bytesread)
*bytesread = (count >= 0) ? static_cast<size_t>(count) : 0;
return 1;
}
case SFILE_PAQ: {