From 7322056df24d29fe3ce63ac736651dfb392f8ebc Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 1 Dec 2022 02:02:06 -0600 Subject: [PATCH] [nostalgia/tools/pack] Use ox::preload function instead of bare model function in preloading --- src/nostalgia/tools/pack/pack.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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, "/"); } }