This commit is contained in:
Radosław Gliński 2025-08-21 12:22:31 +03:00 committed by GitHub
commit c98f4771b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View file

@ -52,12 +52,15 @@ X_STATUS StfsContainerFile::ReadSync(void* buffer, size_t buffer_length,
size_t read_length =
std::min(record.length - read_offset, remaining_length);
auto global_lock = global_critical_region_.Acquire();
{
auto& file = entry_->files()->at(record.file);
xe::filesystem::Seek(file, record.offset + read_offset, SEEK_SET);
auto num_read = fread(p, 1, read_length, file);
*out_bytes_read += num_read;
p += num_read;
}
src_offset += record.length;
remaining_length -= read_length;
if (remaining_length == 0) {

View file

@ -10,6 +10,7 @@
#ifndef XENIA_VFS_DEVICES_STFS_CONTAINER_FILE_H_
#define XENIA_VFS_DEVICES_STFS_CONTAINER_FILE_H_
#include "xenia/base/mutex.h"
#include "xenia/vfs/file.h"
#include "xenia/xbox.h"
@ -35,6 +36,7 @@ class StfsContainerFile : public File {
X_STATUS SetLength(size_t length) override { return X_STATUS_ACCESS_DENIED; }
private:
xe::global_critical_region global_critical_region_;
StfsContainerEntry* entry_;
};