[nostalgia/core/gba] Cleanup
This commit is contained in:
parent
07fb60ed3d
commit
696bae0721
@ -148,8 +148,9 @@ ox::Error loadSpriteTileSheet(
|
|||||||
const ox::FileAddress &tilesheetAddr,
|
const ox::FileAddress &tilesheetAddr,
|
||||||
const ox::FileAddress &paletteAddr) noexcept {
|
const ox::FileAddress &paletteAddr) noexcept {
|
||||||
auto &gctx = static_cast<GbaContext&>(*ctx);
|
auto &gctx = static_cast<GbaContext&>(*ctx);
|
||||||
|
auto &rom = static_cast<const ox::MemFS&>(gctx.rom());
|
||||||
oxRequire(tsStat, gctx.rom().stat(tilesheetAddr));
|
oxRequire(tsStat, gctx.rom().stat(tilesheetAddr));
|
||||||
oxRequire(ts, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(tilesheetAddr));
|
oxRequire(ts, rom.directAccess(tilesheetAddr));
|
||||||
GbaTileMapTarget target;
|
GbaTileMapTarget target;
|
||||||
target.pal.palette = MEM_SPRITE_PALETTE;
|
target.pal.palette = MEM_SPRITE_PALETTE;
|
||||||
target.tileMap = MEM_SPRITE_TILES;
|
target.tileMap = MEM_SPRITE_TILES;
|
||||||
@ -157,7 +158,7 @@ ox::Error loadSpriteTileSheet(
|
|||||||
// load external palette if available
|
// load external palette if available
|
||||||
if (paletteAddr) {
|
if (paletteAddr) {
|
||||||
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
||||||
oxRequire(pal, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(paletteAddr));
|
oxRequire(pal, rom.directAccess(paletteAddr));
|
||||||
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target.pal));
|
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target.pal));
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
@ -165,10 +166,11 @@ ox::Error loadSpriteTileSheet(
|
|||||||
|
|
||||||
ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAddr) noexcept {
|
ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAddr) noexcept {
|
||||||
auto &gctx = static_cast<GbaContext&>(*ctx);
|
auto &gctx = static_cast<GbaContext&>(*ctx);
|
||||||
|
auto &rom = static_cast<const ox::MemFS&>(gctx.rom());
|
||||||
GbaPaletteTarget target;
|
GbaPaletteTarget target;
|
||||||
target.palette = MEM_BG_PALETTE;
|
target.palette = MEM_BG_PALETTE;
|
||||||
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
oxRequire(palStat, gctx.rom().stat(paletteAddr));
|
||||||
oxRequire(pal, static_cast<const ox::MemFS&>(gctx.rom()).directAccess(paletteAddr));
|
oxRequire(pal, rom.directAccess(paletteAddr));
|
||||||
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target));
|
oxReturnError(ox::readMC(pal, static_cast<std::size_t>(palStat.size), &target));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user