[nostalgia] Add type registration to Module, fix FileAddress conversion in vectors for nost-pack
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <nostalgia/appmodules/appmodules.hpp>
|
||||
#include <nostalgia/core/typestore.hpp>
|
||||
#include <nostalgia/foundation/foundation.hpp>
|
||||
#include <nostalgia/foundation/module.hpp>
|
||||
|
||||
#include "pack/pack.hpp"
|
||||
|
||||
@@ -44,6 +45,15 @@ static ox::Result<ox::Buffer> readFileBuff(ox::CRStringView path) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
static ox::Error generateTypes(ox::TypeStore *ts) noexcept {
|
||||
for (const auto mod : *foundation::modules()) {
|
||||
for (auto gen : mod->types()) {
|
||||
oxReturnError(gen(ts));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
static ox::Error run(const ox::ClArgs &args) noexcept {
|
||||
loadModules();
|
||||
const auto argSrc = args.getString("src", "");
|
||||
@@ -61,6 +71,7 @@ static ox::Error run(const ox::ClArgs &args) noexcept {
|
||||
ox::FileSystem32 dst(ox::FileStore32(dstBuff.data(), dstBuff.size()));
|
||||
const auto ctx = foundation::init(ox::make_unique<ox::PassThroughFS>(argSrc), "nost-pack");
|
||||
core::TypeStore ts(ctx->rom.get());
|
||||
oxReturnError(generateTypes(&ts));
|
||||
oxReturnError(pack(ctx.get(), &ts, &dst));
|
||||
oxRequireM(pl, GbaPreloader::make());
|
||||
oxReturnError(preload(&ts, &dst, pl.get()));
|
||||
|
||||
Reference in New Issue
Block a user