mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +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
|
@ -42,7 +42,8 @@ namespace nx
|
||||||
le_uint32_t file;
|
le_uint32_t file;
|
||||||
le_uint32_t hash;
|
le_uint32_t hash;
|
||||||
le_uint32_t name_size;
|
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
|
struct sRomfsFileEntry
|
||||||
|
@ -53,7 +54,8 @@ namespace nx
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
le_uint32_t hash;
|
le_uint32_t hash;
|
||||||
le_uint32_t name_size;
|
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)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ void RomfsProcess::importDirectory(uint32_t dir_offset, sDirectory& dir)
|
||||||
printf(" name=%s\n", f_node->name);
|
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();
|
file_addr = f_node->sibling.get();
|
||||||
mFileNum++;
|
mFileNum++;
|
||||||
|
@ -176,7 +176,7 @@ void RomfsProcess::importDirectory(uint32_t dir_offset, sDirectory& dir)
|
||||||
{
|
{
|
||||||
nx::sRomfsDirEntry* c_node = get_dir_node(child_addr);
|
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());
|
importDirectory(child_addr, dir.dir_list.atBack());
|
||||||
|
|
||||||
child_addr = c_node->sibling.get();
|
child_addr = c_node->sibling.get();
|
||||||
|
|
Loading…
Reference in a new issue