diff --git a/src/nostalgia/modules/gfx/src/gfx-gba.cpp b/src/nostalgia/modules/gfx/src/gfx-gba.cpp index faea11bd..ad67b35b 100644 --- a/src/nostalgia/modules/gfx/src/gfx-gba.cpp +++ b/src/nostalgia/modules/gfx/src/gfx-gba.cpp @@ -35,11 +35,6 @@ class Context { Context(Context const &&other) noexcept = delete; virtual ~Context() noexcept = default; - [[nodiscard]] - ox::MemFS const &rom() const noexcept { - return static_cast(*turbine::rom(turbineCtx)); - } - }; void safeDelete(Context *ctx) noexcept { @@ -81,7 +76,7 @@ ox::Error loadBgPalette( if (palette.pages.empty()) { return {}; } - auto const paletteMem = MEM_BG_PALETTE + palBank * 16; + auto const paletteMem = ox::Span{MEM_BG_PALETTE} + palBank * 16; for (auto i = 0u; i < colorCnt(palette, page); ++i) { paletteMem[i] = color(palette, page, i); } @@ -95,9 +90,8 @@ ox::Error loadSpritePalette( if (palette.pages.empty()) { return {}; } - auto const paletteMem = MEM_SPRITE_PALETTE; for (auto i = 0u; i < colorCnt(palette, page); ++i) { - paletteMem[i] = color(palette, page, i); + MEM_SPRITE_PALETTE[i] = color(palette, page, i); } return {}; } @@ -240,7 +234,7 @@ ox::Error loadSpriteTileSheet( Context &ctx, TileSheetSet const &set) noexcept { auto const bpp = static_cast(set.bpp); - OX_RETURN_ERROR(loadTileSheetSet(ctx, {MEM_SPRITE_TILES, 32 * ox::units::KB}, set)); + OX_RETURN_ERROR(loadTileSheetSet(ctx, MEM_SPRITE_TILES, set)); setSpritesBpp(bpp); return {}; } @@ -349,9 +343,9 @@ void panic(char const *file, int line, char const *panicMsg, ox::Error const &er using namespace nostalgia::gfx; // reset heap to make sure we have enough memory to allocate context data OX_ALLOW_UNSAFE_BUFFERS_BEGIN - auto const heapBegin = reinterpret_cast(MEM_EWRAM_BEGIN); - auto const heapSz = (MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2; - auto const heapEnd = reinterpret_cast(MEM_EWRAM_BEGIN + heapSz); + auto const heapBegin = reinterpret_cast(MEM_EWRAM.data()); + auto const heapSz = MEM_EWRAM.size() / 2; + auto const heapEnd = reinterpret_cast(MEM_EWRAM.data() + heapSz); ox::heapmgr::initHeap(heapBegin, heapEnd); OX_ALLOW_UNSAFE_BUFFERS_END auto tctx = turbine::init(keel::loadRomFs("").unwrap(), "Nostalgia").unwrap(); diff --git a/src/olympic/turbine/src/gba/turbine.cpp b/src/olympic/turbine/src/gba/turbine.cpp index df24c0ed..e8706d02 100644 --- a/src/olympic/turbine/src/gba/turbine.cpp +++ b/src/olympic/turbine/src/gba/turbine.cpp @@ -50,7 +50,7 @@ OX_ALLOW_UNSAFE_BUFFERS_BEGIN constexpr auto headerP1Len = ox::strlen(headerP2); constexpr auto headerP2Len = ox::strlen(headerP1); constexpr auto headerLen = headerP1Len + headerP2Len; - for (auto current = MEM_ROM; current < reinterpret_cast(0x0a000000); current += headerLen) { + for (auto current = MEM_ROM.data(); current < reinterpret_cast(0x0a000000); current += headerLen) { if (memcmp(current, headerP1, headerP1Len) == 0 && memcmp(current + headerP1Len, headerP2, headerP2Len) == 0) { return reinterpret_cast(current + headerLen);