[nostalgia/core/gba] Update for Ox FS changes

This commit is contained in:
Gary Talent 2023-01-27 00:01:14 -06:00
parent 1cfa594c92
commit 1aceeebd5d
2 changed files with 8 additions and 8 deletions

View File

@ -151,7 +151,7 @@ ox::Error loadBgTileSheet(Context *ctx,
const ox::FileAddress &tilesheetAddr, const ox::FileAddress &tilesheetAddr,
const ox::FileAddress &paletteAddr) noexcept { const ox::FileAddress &paletteAddr) noexcept {
oxRequire(tsStat, ctx->rom->stat(tilesheetAddr)); oxRequire(tsStat, ctx->rom->stat(tilesheetAddr));
oxRequire(ts, ctx->rom->directAccess(tilesheetAddr)); oxRequire(ts, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(tilesheetAddr));
GbaTileMapTarget target; GbaTileMapTarget target;
target.pal.palette = MEM_BG_PALETTE; target.pal.palette = MEM_BG_PALETTE;
target.cbbData = &g_cbbData[cbb]; target.cbbData = &g_cbbData[cbb];
@ -160,7 +160,7 @@ ox::Error loadBgTileSheet(Context *ctx,
// load external palette if available // load external palette if available
if (paletteAddr) { if (paletteAddr) {
oxRequire(palStat, ctx->rom->stat(paletteAddr)); oxRequire(palStat, ctx->rom->stat(paletteAddr));
oxRequire(pal, ctx->rom->directAccess(paletteAddr)); oxRequire(pal, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(paletteAddr));
oxReturnError(ox::readMC(pal, palStat.size, &target.pal)); oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
} }
// update bpp of all bgs with the updated cbb // update bpp of all bgs with the updated cbb
@ -177,7 +177,7 @@ ox::Error loadSpriteTileSheet(Context *ctx,
const ox::FileAddress &tilesheetAddr, const ox::FileAddress &tilesheetAddr,
const ox::FileAddress &paletteAddr) noexcept { const ox::FileAddress &paletteAddr) noexcept {
oxRequire(tsStat, ctx->rom->stat(tilesheetAddr)); oxRequire(tsStat, ctx->rom->stat(tilesheetAddr));
oxRequire(ts, ctx->rom->directAccess(tilesheetAddr)); oxRequire(ts, static_cast<ox::MemFS*>(ctx->rom.get())->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;
@ -185,7 +185,7 @@ ox::Error loadSpriteTileSheet(Context *ctx,
// load external palette if available // load external palette if available
if (paletteAddr) { if (paletteAddr) {
oxRequire(palStat, ctx->rom->stat(paletteAddr)); oxRequire(palStat, ctx->rom->stat(paletteAddr));
oxRequire(pal, ctx->rom->directAccess(paletteAddr)); oxRequire(pal, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(paletteAddr));
oxReturnError(ox::readMC(pal, palStat.size, &target.pal)); oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
} }
return {}; return {};
@ -195,7 +195,7 @@ ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAd
GbaPaletteTarget target; GbaPaletteTarget target;
target.palette = MEM_BG_PALETTE; target.palette = MEM_BG_PALETTE;
oxRequire(palStat, ctx->rom->stat(paletteAddr)); oxRequire(palStat, ctx->rom->stat(paletteAddr));
oxRequire(pal, ctx->rom->directAccess(paletteAddr)); oxRequire(pal, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(paletteAddr));
oxReturnError(ox::readMC(pal, palStat.size, &target)); oxReturnError(ox::readMC(pal, palStat.size, &target));
return {}; return {};
} }
@ -204,7 +204,7 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
GbaPaletteTarget target; GbaPaletteTarget target;
target.palette = &MEM_SPRITE_PALETTE[cbb]; target.palette = &MEM_SPRITE_PALETTE[cbb];
oxRequire(palStat, ctx->rom->stat(paletteAddr)); oxRequire(palStat, ctx->rom->stat(paletteAddr));
oxRequire(pal, ctx->rom->directAccess(paletteAddr)); oxRequire(pal, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(paletteAddr));
oxReturnError(ox::readMC(pal, palStat.size, &target)); oxReturnError(ox::readMC(pal, palStat.size, &target));
return {}; return {};
} }

View File

@ -33,7 +33,7 @@ void unloadRom(char*) noexcept {
ox::Result<std::size_t> getPreloadAddr(Context *ctx, ox::CRStringView path) noexcept { ox::Result<std::size_t> getPreloadAddr(Context *ctx, ox::CRStringView path) noexcept {
oxRequire(stat, ctx->rom->stat(path)); oxRequire(stat, ctx->rom->stat(path));
oxRequire(buff, ctx->rom->directAccess(path)); oxRequire(buff, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(path));
PreloadPtr p; PreloadPtr p;
oxReturnError(ox::readMC(buff, stat.size, &p)); oxReturnError(ox::readMC(buff, stat.size, &p));
return p.preloadAddr + ctx->preloadSectionOffset; return p.preloadAddr + ctx->preloadSectionOffset;
@ -41,7 +41,7 @@ ox::Result<std::size_t> getPreloadAddr(Context *ctx, ox::CRStringView path) noex
ox::Result<std::size_t> getPreloadAddr(Context *ctx, const ox::FileAddress &file) noexcept { ox::Result<std::size_t> getPreloadAddr(Context *ctx, const ox::FileAddress &file) noexcept {
oxRequire(stat, ctx->rom->stat(file)); oxRequire(stat, ctx->rom->stat(file));
oxRequire(buff, ctx->rom->directAccess(file)); oxRequire(buff, static_cast<ox::MemFS*>(ctx->rom.get())->directAccess(file));
PreloadPtr p; PreloadPtr p;
oxReturnError(ox::readMC(buff, stat.size, &p)); oxReturnError(ox::readMC(buff, stat.size, &p));
return p.preloadAddr + ctx->preloadSectionOffset; return p.preloadAddr + ctx->preloadSectionOffset;