[nostalgia/player] Fix build

This commit is contained in:
Gary Talent 2024-12-20 00:27:41 -06:00
parent 37030f9c11
commit aaeec20ac9

View File

@ -67,12 +67,12 @@ static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool d
static ox::Error runTest(turbine::Context &tctx) {
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"};
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
oxRequireM(cctx, core::init(tctx));
OX_REQUIRE_M(cctx, core::init(tctx));
turbine::setApplicationData(tctx, cctx.get());
oxRequire(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
oxReturnError(core::loadSpriteTileSheet(*cctx, TileSheetAddr));
oxReturnError(core::loadSpritePalette(*cctx, PaletteAddr));
oxReturnError(core::initConsole(*cctx));
OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, TileSheetAddr));
OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr));
OX_RETURN_ERROR(core::initConsole(*cctx));
core::puts(*cctx, 10, 9, "DOPENESS!!!");
turbine::setUpdateHandler(tctx, testUpdateHandler);
turbine::setKeyEventHandler(tctx, testKeyEventHandler);
@ -85,9 +85,9 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
// this should make the screen display 'ABCDB', with the A being upside down
// and the first B being backwards
constexpr ox::StringView PaletteAddr{"/Palettes/Charset.npal"};
oxRequireM(cctx, core::init(tctx));
OX_REQUIRE_M(cctx, core::init(tctx));
turbine::setApplicationData(tctx, cctx.get());
oxRequire(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
core::TileSheetSet const set{
.bpp = 4,
.entries = {
@ -98,11 +98,11 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
},
};
constexpr auto bgPalBank = 1;
oxReturnError(core::loadBgTileSheet(*cctx, 0, set));
oxReturnError(core::loadSpriteTileSheet(*cctx, set));
oxReturnError(core::loadBgPalette(*cctx, bgPalBank, PaletteAddr));
oxReturnError(core::loadBgPalette(*cctx, 0, PaletteAddr));
oxReturnError(core::loadSpritePalette(*cctx, PaletteAddr));
OX_RETURN_ERROR(core::loadBgTileSheet(*cctx, 0, set));
OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, set));
OX_RETURN_ERROR(core::loadBgPalette(*cctx, bgPalBank, PaletteAddr));
OX_RETURN_ERROR(core::loadBgPalette(*cctx, 0, PaletteAddr));
OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr));
core::setBgStatus(*cctx, 0, true);
core::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 });
core::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 });
@ -148,12 +148,12 @@ static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool
[[maybe_unused]]
static ox::Error runScene(turbine::Context &tctx) {
constexpr ox::StringView SceneAddr{"/Scenes/Chester.nscn"};
oxRequireM(cctx, core::init(tctx));
oxRequire(scn, keel::readObj<scene::SceneStatic>(keelCtx(tctx), SceneAddr));
OX_REQUIRE_M(cctx, core::init(tctx));
OX_REQUIRE(scn, keel::readObj<scene::SceneStatic>(keelCtx(tctx), SceneAddr));
turbine::setUpdateHandler(tctx, sceneUpdateHandler);
turbine::setKeyEventHandler(tctx, sceneKeyEventHandler);
scene::Scene const scene(*scn);
oxReturnError(scene.setupDisplay(*cctx));
OX_RETURN_ERROR(scene.setupDisplay(*cctx));
return turbine::run(tctx);
}
@ -166,7 +166,7 @@ ox::Error run(
return ox::Error(1, "Please provide path to project directory or OxFS file.");
}
auto const path = args[1];
oxRequireM(fs, keel::loadRomFs(path));
oxRequireM(tctx, turbine::init(std::move(fs), project));
OX_REQUIRE_M(fs, keel::loadRomFs(path));
OX_REQUIRE_M(tctx, turbine::init(std::move(fs), project));
return runTileSheetSetTest(*tctx);
}