[VFS] Rewrote STFS to use memory mapping

- Replaced old-style buffer, buffer_length with std::span
- Added STFS and SVOD specific Entry and File classes
- Other smaller improvements
This commit is contained in:
Gliniak
2025-05-13 21:05:46 +02:00
committed by Radosław Gliński
parent e85c2392ba
commit fe739208b6
36 changed files with 481 additions and 206 deletions

View File

@@ -277,7 +277,9 @@ dword_result_t XexLoadImageHeaders_entry(pointer_t<X_ANSI_STRING> path,
size_t bytes_read = 0;
X_STATUS result_status = vfs_file->ReadSync(
reinterpret_cast<void*>(header.host_address()), 2048, 0, &bytes_read);
std::span<uint8_t>(reinterpret_cast<uint8_t*>(header.host_address()),
2048),
0, &bytes_read);
if (result_status < 0) {
vfs_file->Destroy();
@@ -298,8 +300,10 @@ dword_result_t XexLoadImageHeaders_entry(pointer_t<X_ANSI_STRING> path,
result_status = X_STATUS_SUCCESS;
} else {
result_status = vfs_file->ReadSync(
reinterpret_cast<void*>(header.host_address() + 2048),
header_size - 2048, 2048, &bytes_read);
std::span<uint8_t>(
reinterpret_cast<uint8_t*>(header.host_address() + 2048),
header_size - 2048),
2048, &bytes_read);
if (result_status >= X_STATUS_SUCCESS) {
result_status = X_STATUS_SUCCESS;
}