mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Switch iteration order over RomFS's from "folders before files" to "files before folders".
* This should only affect the for loop in scripts, causing RomFS's to be read in the order described on 3DBrew.
This commit is contained in:
parent
e6a966ccaf
commit
8628e18d35
@ -937,51 +937,23 @@ bool ReadVGameDirLv3(VirtualFile* vfile, VirtualDir* vdir) {
|
|||||||
// start from parent dir object
|
// start from parent dir object
|
||||||
if (vdir->index == -1) vdir->index = 0;
|
if (vdir->index == -1) vdir->index = 0;
|
||||||
|
|
||||||
// first child dir object, skip if not available
|
|
||||||
if (vdir->index == 0) {
|
|
||||||
RomFsLv3DirMeta* parent = LV3_GET_DIR(vdir->offset, &lv3idx);
|
|
||||||
if (!parent) return false;
|
|
||||||
if (parent->offset_child != (u32) -1) {
|
|
||||||
vdir->offset = (u64) parent->offset_child;
|
|
||||||
vdir->index = 1;
|
|
||||||
vfile->flags |= VFLAG_DIR;
|
|
||||||
vfile->offset = vdir->offset;
|
|
||||||
return true;
|
|
||||||
} else vdir->index = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse sibling dirs
|
|
||||||
if (vdir->index == 1) {
|
|
||||||
RomFsLv3DirMeta* current = LV3_GET_DIR(vdir->offset, &lv3idx);
|
|
||||||
if (!current) return false;
|
|
||||||
if (current->offset_sibling != (u32) -1) {
|
|
||||||
vdir->offset = (u64) current->offset_sibling;
|
|
||||||
vfile->flags |= VFLAG_DIR;
|
|
||||||
vfile->offset = vdir->offset;
|
|
||||||
return true;
|
|
||||||
} else if (current->offset_parent != (u32) -1) {
|
|
||||||
vdir->offset = (u64) current->offset_parent;
|
|
||||||
vdir->index = 2;
|
|
||||||
} else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first child file object, skip if not available
|
// first child file object, skip if not available
|
||||||
if (vdir->index == 2) {
|
if (vdir->index == 0) {
|
||||||
RomFsLv3DirMeta* parent = LV3_GET_DIR(vdir->offset, &lv3idx);
|
RomFsLv3DirMeta* parent = LV3_GET_DIR(vdir->offset, &lv3idx);
|
||||||
if (!parent) return false;
|
if (!parent) return false;
|
||||||
if (parent->offset_file != (u32) -1) {
|
if (parent->offset_file != (u32) -1) {
|
||||||
vdir->offset = (u64) parent->offset_file;
|
vdir->offset = (u64) parent->offset_file;
|
||||||
vdir->index = 3;
|
vdir->index = 1;
|
||||||
RomFsLv3FileMeta* lv3file = LV3_GET_FILE(vdir->offset, &lv3idx);
|
RomFsLv3FileMeta* lv3file = LV3_GET_FILE(vdir->offset, &lv3idx);
|
||||||
if (!lv3file) return false;
|
if (!lv3file) return false;
|
||||||
vfile->offset = vdir->offset;
|
vfile->offset = vdir->offset;
|
||||||
vfile->size = lv3file->size_data;
|
vfile->size = lv3file->size_data;
|
||||||
return true;
|
return true;
|
||||||
} else vdir->index = 4;
|
} else vdir->index = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse sibling files
|
// parse sibling files
|
||||||
if (vdir->index == 3) {
|
if (vdir->index == 1) {
|
||||||
RomFsLv3FileMeta* current = LV3_GET_FILE(vdir->offset, &lv3idx);
|
RomFsLv3FileMeta* current = LV3_GET_FILE(vdir->offset, &lv3idx);
|
||||||
if (!current) return false;
|
if (!current) return false;
|
||||||
if (current->offset_sibling != (u32) -1) {
|
if (current->offset_sibling != (u32) -1) {
|
||||||
@ -992,7 +964,35 @@ bool ReadVGameDirLv3(VirtualFile* vfile, VirtualDir* vdir) {
|
|||||||
vfile->size = lv3file->size_data;
|
vfile->size = lv3file->size_data;
|
||||||
return true;
|
return true;
|
||||||
} else if (current->offset_parent != (u32) -1) {
|
} else if (current->offset_parent != (u32) -1) {
|
||||||
vdir->offset = current->offset_parent;
|
vdir->offset = (u64) current->offset_parent;
|
||||||
|
vdir->index = 2;
|
||||||
|
} else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// first child dir object, skip if not available
|
||||||
|
if (vdir->index == 2) {
|
||||||
|
RomFsLv3DirMeta* parent = LV3_GET_DIR(vdir->offset, &lv3idx);
|
||||||
|
if (!parent) return false;
|
||||||
|
if (parent->offset_child != (u32) -1) {
|
||||||
|
vdir->offset = (u64) parent->offset_child;
|
||||||
|
vdir->index = 3;
|
||||||
|
vfile->flags |= VFLAG_DIR;
|
||||||
|
vfile->offset = vdir->offset;
|
||||||
|
return true;
|
||||||
|
} else vdir->index = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse sibling dirs
|
||||||
|
if (vdir->index == 3) {
|
||||||
|
RomFsLv3DirMeta* current = LV3_GET_DIR(vdir->offset, &lv3idx);
|
||||||
|
if (!current) return false;
|
||||||
|
if (current->offset_sibling != (u32) -1) {
|
||||||
|
vdir->offset = (u64) current->offset_sibling;
|
||||||
|
vfile->flags |= VFLAG_DIR;
|
||||||
|
vfile->offset = vdir->offset;
|
||||||
|
return true;
|
||||||
|
} else if (current->offset_parent != (u32) -1) {
|
||||||
|
vdir->offset = (u64) current->offset_parent;
|
||||||
vdir->index = 4;
|
vdir->index = 4;
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user