diff --git a/src/nostalgia/tools/pack/pack.cpp b/src/nostalgia/tools/pack/pack.cpp index b0ab5e4f..f945b9f3 100644 --- a/src/nostalgia/tools/pack/pack.cpp +++ b/src/nostalgia/tools/pack/pack.cpp @@ -16,8 +16,6 @@ namespace nostalgia { -using Preloader = ox::ModelHandlerInterface; - static ox::Error pathToInode(ox::FileSystem *dest, ox::ModelObject *obj) noexcept { auto &o = *obj; auto type = static_cast(o["type"].get()); @@ -145,13 +143,14 @@ static ox::Error copy(ox::FileSystem *src, ox::FileSystem *dest, ox::CRString pa } // transformations need to be done after the copy to the new FS is complete -static ox::Error preloadObj(core::TypeStore *ts, ox::FileSystem *romFs, Preloader *pl, ox::CRString path) noexcept { +static ox::Error preloadObj(core::TypeStore *ts, ox::FileSystem *romFs, GbaPreloader *pl, ox::CRString path) noexcept { // load file oxRequireM(buff, romFs->read(path.c_str())); oxRequireM(obj, ox::readClaw(ts, buff)); if (obj.type()->preloadable) { // preload - oxReturnError(model(pl, &obj)); + auto err = ox::preload(pl, &obj); + oxReturnError(err); const core::PreloadPtr p{.preloadAddr = 0}; oxReturnError(ox::writeMC(&p).moveTo(&buff)); } else { @@ -164,7 +163,7 @@ static ox::Error preloadObj(core::TypeStore *ts, ox::FileSystem *romFs, Preloade // claw file transformations are broken out because path to inode // transformations need to be done after the copy to the new FS is complete -static ox::Error preload(core::TypeStore *ts, ox::FileSystem *romFs, Preloader *pl, ox::CRString path) noexcept { +static ox::Error preloadDir(core::TypeStore *ts, ox::FileSystem *romFs, GbaPreloader *pl, ox::CRString path) noexcept { // copy oxTracef("pack::preload", "path: {}", path); oxRequire(fileList, romFs->ls(path)); @@ -173,7 +172,7 @@ static ox::Error preload(core::TypeStore *ts, ox::FileSystem *romFs, Preloader * oxRequire(stat, romFs->stat(filePath.c_str())); if (stat.fileType == ox::FileType::Directory) { const auto dir = path + name + '/'; - oxReturnError(preload(ts, romFs, pl, dir)); + oxReturnError(preloadDir(ts, romFs, pl, dir)); } else { oxReturnError(preloadObj(ts, romFs, pl, filePath)); } @@ -211,7 +210,7 @@ ox::Error pack(core::TypeStore *ts, ox::FileSystem *src, ox::FileSystem *dest) n } ox::Error preload(core::TypeStore *ts, ox::FileSystem *src, GbaPreloader *pl) noexcept { - return preload(ts, src, pl->interface(), "/"); + return preloadDir(ts, src, pl, "/"); } }