mirror of
https://github.com/jakcron/nstool
synced 2024-11-22 21:49:30 +00:00
[nx|nstool] Changed Romfs FileNode and DirNode to not include an empty name[] variable.
This commit is contained in:
parent
93509fac5a
commit
8b37665be6
2 changed files with 6 additions and 4 deletions
|
@ -42,7 +42,8 @@ namespace nx
|
|||
le_uint32_t file;
|
||||
le_uint32_t hash;
|
||||
le_uint32_t name_size;
|
||||
char name[];
|
||||
char* name() { return ((char*)(this)) + sizeof(sRomfsDirEntry); }
|
||||
const char* name() const { return ((char*)(this)) + sizeof(sRomfsDirEntry); }
|
||||
};
|
||||
|
||||
struct sRomfsFileEntry
|
||||
|
@ -53,7 +54,8 @@ namespace nx
|
|||
le_uint64_t size;
|
||||
le_uint32_t hash;
|
||||
le_uint32_t name_size;
|
||||
char name[];
|
||||
char* name() { return ((char*)(this)) + sizeof(sRomfsFileEntry); }
|
||||
const char* name() const { return ((char*)(this)) + sizeof(sRomfsFileEntry); }
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ void RomfsProcess::importDirectory(uint32_t dir_offset, sDirectory& dir)
|
|||
printf(" name=%s\n", f_node->name);
|
||||
*/
|
||||
|
||||
dir.file_list.addElement({std::string(f_node->name, f_node->name_size.get()), mHdr.data_offset.get() + f_node->offset.get(), f_node->size.get()});
|
||||
dir.file_list.addElement({std::string(f_node->name(), f_node->name_size.get()), mHdr.data_offset.get() + f_node->offset.get(), f_node->size.get()});
|
||||
|
||||
file_addr = f_node->sibling.get();
|
||||
mFileNum++;
|
||||
|
@ -176,7 +176,7 @@ void RomfsProcess::importDirectory(uint32_t dir_offset, sDirectory& dir)
|
|||
{
|
||||
nx::sRomfsDirEntry* c_node = get_dir_node(child_addr);
|
||||
|
||||
dir.dir_list.addElement({std::string(c_node->name, c_node->name_size.get())});
|
||||
dir.dir_list.addElement({std::string(c_node->name(), c_node->name_size.get())});
|
||||
importDirectory(child_addr, dir.dir_list.atBack());
|
||||
|
||||
child_addr = c_node->sibling.get();
|
||||
|
|
Loading…
Reference in a new issue