[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:
committed by
Radosław Gliński
parent
e85c2392ba
commit
fe739208b6
@@ -89,7 +89,8 @@ void UserProfile::LoadProfileIcon(XTileType tile_type) {
|
||||
|
||||
std::vector<uint8_t> data(file->entry()->size());
|
||||
size_t written_bytes = 0;
|
||||
file->ReadSync(data.data(), file->entry()->size(), 0, &written_bytes);
|
||||
file->ReadSync(std::span<uint8_t>(data.data(), file->entry()->size()), 0,
|
||||
&written_bytes);
|
||||
file->Destroy();
|
||||
|
||||
profile_images_.insert({tile_type, data});
|
||||
@@ -114,7 +115,8 @@ std::vector<uint8_t> UserProfile::LoadGpd(const uint32_t title_id) {
|
||||
std::vector<uint8_t> data(entry->size());
|
||||
|
||||
size_t read_size = 0;
|
||||
result = file->ReadSync(data.data(), entry->size(), 0, &read_size);
|
||||
result = file->ReadSync(std::span<uint8_t>(data.data(), entry->size()), 0,
|
||||
&read_size);
|
||||
if (result != X_STATUS_SUCCESS || read_size != entry->size()) {
|
||||
XELOGW(
|
||||
"User {} (XUID: {:016X}) cannot read profile GPD! Status: {:08X} read: "
|
||||
@@ -150,7 +152,8 @@ bool UserProfile::WriteGpd(const uint32_t title_id) {
|
||||
}
|
||||
|
||||
size_t written_bytes = 0;
|
||||
file->WriteSync(data.data(), data.size(), 0, &written_bytes);
|
||||
file->WriteSync(std::span<uint8_t>(data.data(), data.size()), 0,
|
||||
&written_bytes);
|
||||
file->Destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user