This commit is contained in:
parent
80e06a5a57
commit
0727b9a1a8
@ -15,17 +15,24 @@
|
|||||||
|
|
||||||
namespace ncore = nostalgia::core;
|
namespace ncore = nostalgia::core;
|
||||||
|
|
||||||
namespace jasper {
|
using namespace jasper;
|
||||||
|
|
||||||
ox::Error run(turbine::Context &tctx, ox::StringView, ox::SpanView<ox::String> args) noexcept {
|
ox::Error run(
|
||||||
|
ox::StringView project,
|
||||||
|
[[maybe_unused]] ox::StringView appName,
|
||||||
|
[[maybe_unused]] ox::StringView projectDataDir,
|
||||||
|
ox::SpanView<ox::CString> args) noexcept {
|
||||||
|
auto const fsPath = args.size() > 1 ? args[1] : ".";
|
||||||
|
oxRequireM(tctx, turbine::init(fsPath, project));
|
||||||
|
oxRequire(bootfile, keel::readObj<jasper::core::Bootfile>(keelCtx(*tctx), "/Bootfile"));
|
||||||
oxOut("Jasper Player\n");
|
oxOut("Jasper Player\n");
|
||||||
oxRequire(nctx, ncore::init(tctx));
|
oxRequire(nctx, ncore::init(*tctx));
|
||||||
auto const&worldPath = args[0];
|
auto const&worldPath = *bootfile->args.at(0).unwrap();
|
||||||
oxRequire(worldStatic, readObj<world::WorldStatic>(keelCtx(tctx), worldPath));
|
oxRequire(worldStatic, readObj<world::WorldStatic>(keelCtx(*tctx), worldPath));
|
||||||
world::World world(*nctx, *worldStatic);
|
world::World world(*nctx, *worldStatic);
|
||||||
oxReturnError(world.setupDisplay());
|
oxReturnError(world.setupDisplay());
|
||||||
turbine::setApplicationData(tctx, &world);
|
turbine::setApplicationData(*tctx, &world);
|
||||||
setUpdateHandler(tctx, [](turbine::Context &tctx) -> int {
|
setUpdateHandler(*tctx, [](turbine::Context &tctx) -> int {
|
||||||
auto &world = *applicationData<world::World>(tctx);
|
auto &world = *applicationData<world::World>(tctx);
|
||||||
auto [sleepTime, err] = world.update();
|
auto [sleepTime, err] = world.update();
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -33,25 +40,7 @@ ox::Error run(turbine::Context &tctx, ox::StringView, ox::SpanView<ox::String> a
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
oxReturnError(turbine::run(tctx));
|
oxReturnError(turbine::run(*tctx));
|
||||||
oxOut("Exiting...\n");
|
oxOut("Exiting...\n");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ox::Error run(
|
|
||||||
ox::StringView project,
|
|
||||||
[[maybe_unused]] ox::StringView appName,
|
|
||||||
[[maybe_unused]] ox::StringView projectDataDir,
|
|
||||||
ox::SpanView<ox::CString> args) noexcept {
|
|
||||||
auto path = ".";
|
|
||||||
if (args.size() > 1) {
|
|
||||||
path = args[1];
|
|
||||||
}
|
|
||||||
oxRequireM(fs, keel::loadRomFs(path));
|
|
||||||
oxRequireM(tctx, turbine::init(std::move(fs), project));
|
|
||||||
constexpr ox::FileAddress BootfileAddr = ox::StringLiteral{"/Bootfile"};
|
|
||||||
oxRequire(bootfile, keel::readObj<jasper::core::Bootfile>(keelCtx(*tctx), BootfileAddr));
|
|
||||||
return jasper::run(*tctx, bootfile->app, bootfile->args);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user