VolumeDirectory: Pass address shift to WriteEntryData as argument

This commit is contained in:
Dwayne Slater 2017-03-27 20:53:42 -04:00
parent 108d59b131
commit 1b9268485c
2 changed files with 9 additions and 7 deletions

View File

@ -369,7 +369,7 @@ void CVolumeDirectory::BuildFST()
u32 root_offset = 0; // Offset of root of FST
// write root entry
WriteEntryData(&fst_offset, DIRECTORY_ENTRY, 0, 0, total_entries);
WriteEntryData(&fst_offset, DIRECTORY_ENTRY, 0, 0, total_entries, m_address_shift);
WriteDirectory(rootEntry, &fst_offset, &name_offset, &current_data_address, root_offset);
@ -425,7 +425,7 @@ void CVolumeDirectory::Write32(u32 data, u32 offset, std::vector<u8>* const buff
}
void CVolumeDirectory::WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset,
u64 length)
u64 length, u32 address_shift)
{
m_fst_data[(*entry_offset)++] = type;
@ -433,7 +433,7 @@ void CVolumeDirectory::WriteEntryData(u32* entry_offset, u8 type, u32 name_offse
m_fst_data[(*entry_offset)++] = (name_offset >> 8) & 0xff;
m_fst_data[(*entry_offset)++] = (name_offset)&0xff;
Write32((u32)(data_offset >> m_address_shift), *entry_offset, &m_fst_data);
Write32((u32)(data_offset >> address_shift), *entry_offset, &m_fst_data);
*entry_offset += 4;
Write32((u32)length, *entry_offset, &m_fst_data);
@ -465,8 +465,8 @@ void CVolumeDirectory::WriteDirectory(const File::FSTEntry& parent_entry, u32* f
if (entry.isDirectory)
{
u32 entry_index = *fst_offset / ENTRY_SIZE;
WriteEntryData(fst_offset, DIRECTORY_ENTRY, *name_offset,
parent_entry_index << m_address_shift, entry_index + entry.size + 1);
WriteEntryData(fst_offset, DIRECTORY_ENTRY, *name_offset, parent_entry_index,
entry_index + entry.size + 1, 0);
WriteEntryName(name_offset, entry.virtualName);
WriteDirectory(entry, fst_offset, name_offset, data_offset, entry_index);
@ -474,7 +474,8 @@ void CVolumeDirectory::WriteDirectory(const File::FSTEntry& parent_entry, u32* f
else
{
// put entry in FST
WriteEntryData(fst_offset, FILE_ENTRY, *name_offset, *data_offset, entry.size);
WriteEntryData(fst_offset, FILE_ENTRY, *name_offset, *data_offset, entry.size,
m_address_shift);
WriteEntryName(name_offset, entry.virtualName);
// write entry to virtual disk

View File

@ -85,7 +85,8 @@ private:
void Write32(u32 data, u32 offset, std::vector<u8>* const buffer);
// FST creation
void WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset, u64 length);
void WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset, u64 length,
u32 address_shift);
void WriteEntryName(u32* name_offset, const std::string& name);
void WriteDirectory(const File::FSTEntry& parent_entry, u32* fst_offset, u32* name_offset,
u64* data_offset, u32 parent_entry_index);