[nostalgia/core] Cleanup

This commit is contained in:
2023-06-26 23:51:23 -05:00
parent 741026680a
commit 874592cffd
9 changed files with 48 additions and 38 deletions

View File

@@ -11,9 +11,9 @@ namespace nostalgia::core {
GbaContext::GbaContext(turbine::Context *tctx) noexcept: turbineCtx(tctx) {
}
ox::Error initGfx(Context *ctx, const InitParams&) noexcept;
ox::Error initGfx(Context *ctx, InitParams const&) noexcept;
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams &params) noexcept {
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, InitParams const&params) noexcept {
auto ctx = ox::make_unique<GbaContext>(tctx);
oxReturnError(initGfx(ctx.get(), params));
return ox::UPtr<Context>(ctx.release());

View File

@@ -15,7 +15,7 @@ struct GbaContext: public core::Context {
explicit GbaContext(turbine::Context *tctx) noexcept;
[[nodiscard]]
const auto &rom() const noexcept {
auto const&rom() const noexcept {
return *turbine::rom(*turbineCtx);
}

View File

@@ -69,7 +69,7 @@ constexpr ox::Error model(auto *io, ox::CommonPtrWith<GbaTileMapTarget> auto *t)
return io->template field<uint8_t, decltype(handleTileMap)>("tileMap", handleTileMap);
}
ox::Error initGfx(Context*, const InitParams&) noexcept {
ox::Error initGfx(Context*, InitParams const&) noexcept {
for (auto bgCtl = &REG_BG0CTL; bgCtl <= &REG_BG3CTL; bgCtl += 2) {
teagba::bgSetSbb(bgCtl, 28);
}
@@ -108,8 +108,8 @@ void setBgCbb(Context*, unsigned bgIdx, unsigned cbb) noexcept {
static ox::Error loadBgTileSheet(
const ox::MemFS &rom,
unsigned cbb,
const ox::FileAddress &tilesheetAddr,
const ox::FileAddress &paletteAddr) noexcept {
ox::FileAddress const&tilesheetAddr,
ox::FileAddress const&paletteAddr) noexcept {
oxRequire(tsStat, rom.stat(tilesheetAddr));
oxRequire(ts, rom.directAccess(tilesheetAddr));
GbaTileMapTarget target;
@@ -136,8 +136,8 @@ static ox::Error loadBgTileSheet(
ox::Error loadBgTileSheet(
Context *ctx,
unsigned cbb,
const ox::FileAddress &tilesheetAddr,
const ox::FileAddress &paletteAddr) noexcept {
ox::FileAddress const&tilesheetAddr,
ox::FileAddress const&paletteAddr) noexcept {
auto &gctx = static_cast<GbaContext&>(*ctx);
auto &rom = static_cast<const ox::MemFS&>(gctx.rom());
return loadBgTileSheet(rom, cbb, tilesheetAddr, paletteAddr);
@@ -145,8 +145,8 @@ ox::Error loadBgTileSheet(
ox::Error loadSpriteTileSheet(
Context *ctx,
const ox::FileAddress &tilesheetAddr,
const ox::FileAddress &paletteAddr) noexcept {
ox::FileAddress const&tilesheetAddr,
ox::FileAddress const&paletteAddr) noexcept {
auto &gctx = static_cast<GbaContext&>(*ctx);
auto &rom = static_cast<const ox::MemFS&>(gctx.rom());
oxRequire(tsStat, gctx.rom().stat(tilesheetAddr));
@@ -164,7 +164,7 @@ ox::Error loadSpriteTileSheet(
return {};
}
ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAddr) noexcept {
ox::Error loadBgPalette(Context *ctx, unsigned, ox::FileAddress const&paletteAddr) noexcept {
auto &gctx = static_cast<GbaContext&>(*ctx);
auto &rom = static_cast<const ox::MemFS&>(gctx.rom());
GbaPaletteTarget target;
@@ -175,7 +175,7 @@ ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAd
return {};
}
ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &paletteAddr) noexcept {
ox::Error loadSpritePalette(Context *ctx, unsigned cbb, ox::FileAddress const&paletteAddr) noexcept {
auto &gctx = static_cast<GbaContext&>(*ctx);
auto &rom = static_cast<const ox::MemFS&>(gctx.rom());
GbaPaletteTarget target;

View File

@@ -7,5 +7,5 @@
#include <nostalgia/core/context.hpp>
namespace nostalgia::core {
ox::Error initGfx(Context *ctx, const InitParams&) noexcept;
ox::Error initGfx(Context *ctx, InitParams const&) noexcept;
}

View File

@@ -15,7 +15,7 @@ namespace ox {
using namespace nostalgia::core;
void panic(const char *file, int line, const char *panicMsg, const ox::Error &err) noexcept {
void panic(const char *file, int line, const char *panicMsg, ox::Error const&err) noexcept {
oxIgnoreError(initGfx(nullptr, {}));
oxIgnoreError(initConsole(nullptr));
// enable only BG 0