[nostalgia/tools/pack] Fix nost-pack to pass in proper Context

This commit is contained in:
2023-02-03 01:54:56 -06:00
parent 7868b0678f
commit 8bcffc73ff
4 changed files with 23 additions and 12 deletions
+7 -7
View File
@@ -58,13 +58,13 @@ static ox::Error transformObj(ox::FileSystem *dest, ox::ModelObject *obj) noexce
return {};
}
static ox::Error doTransformations(core::TypeStore *ts, ox::FileSystem *dest, ox::CRStringView filePath) noexcept {
static ox::Error doTransformations(foundation::Context *ctx, core::TypeStore *ts, ox::FileSystem *dest, ox::CRStringView filePath) noexcept {
if (endsWith(filePath, ".ng") || endsWith(filePath, ".npal")) {
// load file
oxRequire(s, dest->stat(filePath));
oxRequireM(buff, dest->read(s.inode));
if (endsWith(filePath, ".ng")) {
oxReturnError(foundation::convertBuffToBuff<core::CompactTileSheet>(nullptr, buff, ox::ClawFormat::Metal).moveTo(&buff));
oxReturnError(foundation::convertBuffToBuff<core::CompactTileSheet>(ctx, buff, ox::ClawFormat::Metal).moveTo(&buff));
}
oxRequireM(obj, ox::readClaw(ts, buff));
// do transformations
@@ -78,7 +78,7 @@ static ox::Error doTransformations(core::TypeStore *ts, ox::FileSystem *dest, ox
// 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 transformClaw(core::TypeStore *ts, ox::FileSystem *dest, ox::CRStringView path) noexcept {
static ox::Error transformClaw(foundation::Context *ctx, core::TypeStore *ts, ox::FileSystem *dest, ox::CRStringView path) noexcept {
// copy
oxTracef("pack::transformClaw", "path: {}", path);
oxRequire(fileList, dest->ls(path));
@@ -87,9 +87,9 @@ static ox::Error transformClaw(core::TypeStore *ts, ox::FileSystem *dest, ox::CR
oxRequire(stat, dest->stat(filePath));
if (stat.fileType == ox::FileType::Directory) {
const auto dir = ox::sfmt("{}{}/", path, name);
oxReturnError(transformClaw(ts, dest, dir));
oxReturnError(transformClaw(ctx, ts, dest, dir));
} else {
oxReturnError(doTransformations(ts, dest, filePath));
oxReturnError(doTransformations(ctx, ts, dest, filePath));
}
}
return {};
@@ -204,10 +204,10 @@ ox::Error appendBinary(ox::Buffer *binBuff, ox::Buffer *fsBuff, GbaPreloader *pl
return {};
}
ox::Error pack(core::TypeStore *ts, ox::FileSystem *src, ox::FileSystem *dest) noexcept {
ox::Error pack(foundation::Context *ctx, core::TypeStore *ts, ox::FileSystem *src, ox::FileSystem *dest) noexcept {
oxReturnError(copy(src, dest, "/"));
oxReturnError(ox::buildTypeDef<core::CompactTileSheet>(ts));
oxReturnError(transformClaw(ts, dest, "/"));
oxReturnError(transformClaw(ctx, ts, dest, "/"));
return {};
}