Compare commits

..

2 Commits

Author SHA1 Message Date
5598dfdd87 [nostalgia/player] Update hardcoded tilesheet refs to new file ext
All checks were successful
Build / build (push) Successful in 3m16s
2025-01-23 00:19:35 -06:00
6ef462adcc [keel] Add clearer Error handling 2025-01-23 00:15:55 -06:00
3 changed files with 15 additions and 9 deletions

View File

@ -65,7 +65,7 @@ static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool d
[[maybe_unused]]
static ox::Error runTest(turbine::Context &tctx) {
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"};
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.nts"};
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
OX_REQUIRE_M(cctx, gfx::init(tctx));
turbine::setApplicationData(tctx, cctx.get());
@ -91,10 +91,10 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
gfx::TileSheetSet const set{
.bpp = 4,
.entries = {
{ .tilesheet = ox::StringLiteral{"/TileSheets/Chester.ng"}, .sections{{.begin = 0, .tiles = 1}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.ng"}, .sections{{.begin = 0, .tiles = 2}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/CD.ng"}, .sections{{.begin = 0, .tiles = 2}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.ng"}, .sections{{.begin = 1, .tiles = 1}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/Chester.nts"}, .sections{{.begin = 0, .tiles = 1}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.nts"}, .sections{{.begin = 0, .tiles = 2}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/CD.nts"}, .sections{{.begin = 0, .tiles = 2}} },
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.nts"}, .sections{{.begin = 1, .tiles = 1}} },
},
};
constexpr auto bgPalBank = 1;

View File

@ -63,8 +63,11 @@ namespace detail {
template<typename T>
constexpr auto makeLoader(Context &ctx) {
return [&ctx](ox::StringViewCR assetId) -> ox::Result<T> {
OX_REQUIRE(p, ctx.uuidToPath.at(assetId));
OX_REQUIRE(buff, ctx.rom->read(*p));
auto const p = ctx.uuidToPath.at(assetId);
if (p.error) {
return ox::Error{1, "Asset ID not found"};
}
OX_REQUIRE(buff, ctx.rom->read(*p.value));
auto [obj, err] = readAsset<T>(buff);
if (err) {
if (err != ox::Error_ClawTypeVersionMismatch && err != ox::Error_ClawTypeMismatch) {

View File

@ -76,8 +76,11 @@ ox::Error buildUuidMap(Context &ctx) noexcept {
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept {
#ifndef OX_BARE_METAL
OX_REQUIRE(out, ctx.pathToUuid.at(path));
return *out;
auto const out = ctx.pathToUuid.at(path);
if (out.error) {
return ox::Error{1, "Path not found"};
}
return *out.value;
#else
return ox::Error(1, "UUID to path conversion not supported on this platform");
#endif