[jasper/player] Make player default to working dir for asset dir
All checks were successful
Build / build (push) Successful in 3m18s

This commit is contained in:
Gary Talent 2024-06-01 18:06:28 -05:00
parent ce9ce3f0e5
commit f338a6a86a

View File

@ -16,6 +16,7 @@
namespace ncore = nostalgia::core; namespace ncore = nostalgia::core;
namespace jasper { namespace jasper {
ox::Error run(turbine::Context &tctx, ox::StringView, ox::SpanView<ox::String> args) noexcept { ox::Error run(turbine::Context &tctx, ox::StringView, ox::SpanView<ox::String> args) noexcept {
oxOut("Jasper Player\n"); oxOut("Jasper Player\n");
oxRequire(nctx, ncore::init(tctx)); oxRequire(nctx, ncore::init(tctx));
@ -36,6 +37,7 @@ ox::Error run(turbine::Context &tctx, ox::StringView, ox::SpanView<ox::String> a
oxOut("Exiting...\n"); oxOut("Exiting...\n");
return {}; return {};
} }
} }
namespace olympic { namespace olympic {
@ -46,13 +48,13 @@ ox::Error run(
[[maybe_unused]] ox::StringView projectDataDir, [[maybe_unused]] ox::StringView projectDataDir,
int argc, int argc,
char const**argv) noexcept { char const**argv) noexcept {
if (argc < 2) { auto path = ".";
return OxError(1, "Insufficient arguments given to olympic::run"); if (argc > 1) {
path = argv[1];
} }
auto const path = ox::StringView(argv[1]);
oxRequireM(fs, keel::loadRomFs(path)); oxRequireM(fs, keel::loadRomFs(path));
oxRequireM(tctx, turbine::init(std::move(fs), project)); oxRequireM(tctx, turbine::init(std::move(fs), project));
constexpr ox::FileAddress BootfileAddr = ox::StringLiteral("/Bootfile"); constexpr ox::FileAddress BootfileAddr = ox::StringLiteral{"/Bootfile"};
oxRequire(bootfile, keel::readObj<jasper::core::Bootfile>(keelCtx(*tctx), BootfileAddr)); oxRequire(bootfile, keel::readObj<jasper::core::Bootfile>(keelCtx(*tctx), BootfileAddr));
return jasper::run(*tctx, bootfile->app, bootfile->args); return jasper::run(*tctx, bootfile->app, bootfile->args);
} }