Fix VFS files not having correct paths recorded.

This commit is contained in:
Dr. Chat
2015-12-17 15:35:39 -06:00
committed by Ben Vanik
parent ab9fac9a98
commit 9cf324f689
7 changed files with 39 additions and 11 deletions

View File

@@ -118,8 +118,8 @@ bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer,
return false;
}
auto entry = new DiscImageEntry(this, parent, std::string(name, name_length),
mmap_.get());
auto entry = DiscImageEntry::Create(
this, parent, std::string(name, name_length), mmap_.get());
entry->attributes_ = attributes | kFileAttributeReadOnly;
entry->size_ = length;
entry->allocation_size_ = xe::round_up(length, bytes_per_sector());
@@ -127,9 +127,6 @@ bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer,
entry->access_timestamp_ = 0;
entry->write_timestamp_ = 0;
// Add to parent.
parent->children_.emplace_back(std::unique_ptr<Entry>(entry));
if (attributes & kFileAttributeDirectory) {
// Folder.
entry->data_offset_ = 0;
@@ -143,7 +140,7 @@ bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer,
// Read child list.
uint8_t* folder_ptr =
state->ptr + state->game_offset + (sector * kXESectorSize);
if (!ReadEntry(state, folder_ptr, 0, entry)) {
if (!ReadEntry(state, folder_ptr, 0, entry.get())) {
return false;
}
}
@@ -153,6 +150,9 @@ bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer,
entry->data_size_ = length;
}
// Add to parent.
parent->children_.emplace_back(std::move(entry));
// Read next file in the list.
if (node_r && !ReadEntry(state, buffer, node_r, parent)) {
return false;