[keel] Split out Nostalgia Foundation and Pack lib into Keel

This commit is contained in:
2023-03-24 21:20:55 -05:00
parent 4a95a79926
commit 7beb3cc6fc
50 changed files with 185 additions and 206 deletions
+5 -8
View File
@@ -8,12 +8,9 @@
#include <ox/fs/fs.hpp>
#include <ox/logconn/logconn.hpp>
#include <keel/keel.hpp>
#include <nostalgia/appmodules/appmodules.hpp>
#include <nostalgia/core/typestore.hpp>
#include <nostalgia/foundation/foundation.hpp>
#include <nostalgia/foundation/module.hpp>
#include "pack/pack.hpp"
using namespace nostalgia;
@@ -46,7 +43,7 @@ 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 (const auto mod : keel::modules()) {
for (auto gen : mod->types()) {
oxReturnError(gen(ts));
}
@@ -69,11 +66,11 @@ static ox::Error run(const ox::ClArgs &args) noexcept {
ox::Buffer dstBuff(32 * ox::units::MB);
oxReturnError(ox::FileSystem32::format(dstBuff.data(), dstBuff.size()));
ox::FileSystem32 dst(ox::FileStore32(dstBuff.data(), dstBuff.size()));
oxRequire(ctx, foundation::init(ox::make_unique<ox::PassThroughFS>(argSrc), "nost-pack"));
oxRequire(ctx, keel::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(keel::pack(ctx.get(), &ts, &dst));
oxRequireM(pl, keel::GbaPreloader::make());
oxReturnError(preload(&ts, &dst, pl.get()));
oxReturnError(dst.resize());
// resize buffer