mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
Merge e99a74685a into 01ae24e46e
This commit is contained in:
commit
c98f4771b8
|
|
@ -52,12 +52,15 @@ X_STATUS StfsContainerFile::ReadSync(void* buffer, size_t buffer_length,
|
||||||
size_t read_length =
|
size_t read_length =
|
||||||
std::min(record.length - read_offset, remaining_length);
|
std::min(record.length - read_offset, remaining_length);
|
||||||
|
|
||||||
|
auto global_lock = global_critical_region_.Acquire();
|
||||||
|
{
|
||||||
auto& file = entry_->files()->at(record.file);
|
auto& file = entry_->files()->at(record.file);
|
||||||
xe::filesystem::Seek(file, record.offset + read_offset, SEEK_SET);
|
xe::filesystem::Seek(file, record.offset + read_offset, SEEK_SET);
|
||||||
auto num_read = fread(p, 1, read_length, file);
|
auto num_read = fread(p, 1, read_length, file);
|
||||||
|
|
||||||
*out_bytes_read += num_read;
|
*out_bytes_read += num_read;
|
||||||
p += num_read;
|
p += num_read;
|
||||||
|
}
|
||||||
src_offset += record.length;
|
src_offset += record.length;
|
||||||
remaining_length -= read_length;
|
remaining_length -= read_length;
|
||||||
if (remaining_length == 0) {
|
if (remaining_length == 0) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef XENIA_VFS_DEVICES_STFS_CONTAINER_FILE_H_
|
#ifndef XENIA_VFS_DEVICES_STFS_CONTAINER_FILE_H_
|
||||||
#define 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/vfs/file.h"
|
||||||
|
|
||||||
#include "xenia/xbox.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; }
|
X_STATUS SetLength(size_t length) override { return X_STATUS_ACCESS_DENIED; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
xe::global_critical_region global_critical_region_;
|
||||||
StfsContainerEntry* entry_;
|
StfsContainerEntry* entry_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue