[nostaliga] Cleanup
This commit is contained in:
parent
8c7f6ffafc
commit
2887fa7819
@ -1,6 +1,5 @@
|
||||
add_library(
|
||||
NostalgiaCore
|
||||
context.cpp
|
||||
gfx.cpp
|
||||
keelmodule.cpp
|
||||
typeconv.cpp
|
||||
|
@ -1,3 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
@ -9,7 +9,6 @@
|
||||
#include <ox/std/buffer.hpp>
|
||||
#include <ox/std/size.hpp>
|
||||
|
||||
#include <keel/context.hpp>
|
||||
#include <turbine/context.hpp>
|
||||
|
||||
#include "initparams.hpp"
|
||||
@ -27,11 +26,13 @@ class Context {
|
||||
Context(const Context &other) noexcept = delete;
|
||||
Context(const Context &&other) noexcept = delete;
|
||||
|
||||
auto &rom() noexcept {
|
||||
const auto &rom() const noexcept {
|
||||
return *turbineCtx->rom;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams& = {}) noexcept;
|
||||
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "color.hpp"
|
||||
#include "context.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams& = {}) noexcept;
|
||||
|
||||
}
|
||||
#include "gfx.hpp"
|
||||
#include "initparams.hpp"
|
||||
#include "keelmodule.hpp"
|
||||
#include "palette.hpp"
|
||||
#include "ptidxconv.hpp"
|
||||
#include "tilesheet.hpp"
|
||||
#include "typeconv.hpp"
|
@ -130,7 +130,7 @@ ox::Error loadBgTileSheet(Context *ctx,
|
||||
const ox::FileAddress &tilesheetAddr,
|
||||
const ox::FileAddress &paletteAddr) noexcept {
|
||||
oxRequire(tsStat, ctx->rom().stat(tilesheetAddr));
|
||||
oxRequire(ts, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(tilesheetAddr));
|
||||
oxRequire(ts, static_cast<const ox::MemFS&>(ctx->rom()).directAccess(tilesheetAddr));
|
||||
GbaTileMapTarget target;
|
||||
target.pal.palette = MEM_BG_PALETTE;
|
||||
target.cbbData = &g_cbbData[cbb];
|
||||
@ -139,7 +139,7 @@ ox::Error loadBgTileSheet(Context *ctx,
|
||||
// load external palette if available
|
||||
if (paletteAddr) {
|
||||
oxRequire(palStat, ctx->rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(ctx->rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
|
||||
}
|
||||
// update bpp of all bgs with the updated cbb
|
||||
@ -156,7 +156,7 @@ ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
const ox::FileAddress &tilesheetAddr,
|
||||
const ox::FileAddress &paletteAddr) noexcept {
|
||||
oxRequire(tsStat, ctx->rom().stat(tilesheetAddr));
|
||||
oxRequire(ts, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(tilesheetAddr));
|
||||
oxRequire(ts, static_cast<const ox::MemFS&>(ctx->rom()).directAccess(tilesheetAddr));
|
||||
GbaTileMapTarget target;
|
||||
target.pal.palette = MEM_SPRITE_PALETTE;
|
||||
target.tileMap = MEM_SPRITE_TILES;
|
||||
@ -164,7 +164,7 @@ ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
// load external palette if available
|
||||
if (paletteAddr) {
|
||||
oxRequire(palStat, ctx->rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(ctx->rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
|
||||
}
|
||||
return {};
|
||||
@ -174,7 +174,7 @@ ox::Error loadBgPalette(Context *ctx, unsigned, const ox::FileAddress &paletteAd
|
||||
GbaPaletteTarget target;
|
||||
target.palette = MEM_BG_PALETTE;
|
||||
oxRequire(palStat, ctx->rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(ctx->rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target));
|
||||
return {};
|
||||
}
|
||||
@ -183,7 +183,7 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
|
||||
GbaPaletteTarget target;
|
||||
target.palette = &MEM_SPRITE_PALETTE[cbb];
|
||||
oxRequire(palStat, ctx->rom().stat(paletteAddr));
|
||||
oxRequire(pal, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(paletteAddr));
|
||||
oxRequire(pal, static_cast<const ox::MemFS&>(ctx->rom()).directAccess(paletteAddr));
|
||||
oxReturnError(ox::readMC(pal, palStat.size, &target));
|
||||
return {};
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
target_sources(
|
||||
NostalgiaCore PRIVATE
|
||||
context.cpp
|
||||
core.cpp
|
||||
gfx.cpp
|
||||
)
|
||||
target_link_libraries(
|
||||
|
@ -11,4 +11,11 @@ GlContext::~GlContext() noexcept {
|
||||
shutdownGfx(this);
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams ¶ms) noexcept {
|
||||
ox::UPtr<Context> ctx = ox::make_unique<GlContext>();
|
||||
ctx->turbineCtx = tctx;
|
||||
oxReturnError(initGfx(ctx.get(), params));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/context.hpp>
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
|
||||
#include <nostalgia/core/core.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams ¶ms) noexcept {
|
||||
ox::UPtr<Context> ctx = ox::make_unique<GlContext>();
|
||||
ctx->turbineCtx = tctx;
|
||||
oxReturnError(initGfx(ctx.get(), params));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
}
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include <keel/media.hpp>
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
|
||||
#include "sceneeditor-imgui.hpp"
|
||||
|
||||
namespace nostalgia::scene {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <studio/studio.hpp>
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <turbine/context.hpp>
|
||||
|
||||
#include "sceneeditor.hpp"
|
||||
#include "sceneeditorview.hpp"
|
||||
|
@ -2,6 +2,8 @@
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <keel/keel.hpp>
|
||||
|
||||
#include "sceneeditor.hpp"
|
||||
|
||||
namespace nostalgia::scene {
|
||||
|
@ -4,9 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <studio/studio.hpp>
|
||||
#include <turbine/context.hpp>
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <nostalgia/scene/scene.hpp>
|
||||
|
||||
namespace nostalgia::scene {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/core.hpp>
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
|
||||
#include "sceneeditorview.hpp"
|
||||
|
||||
@ -22,7 +22,7 @@ void SceneEditorView::draw(int width, int height) noexcept {
|
||||
if (width != m_frameBuffer.width || height != m_frameBuffer.height) {
|
||||
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height);
|
||||
}
|
||||
glutils::FrameBufferBind frameBufferBind(m_frameBuffer);
|
||||
const glutils::FrameBufferBind frameBufferBind(m_frameBuffer);
|
||||
core::gl::drawMainView(m_cctx.get(), {width, height});
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <glutils/glutils.hpp>
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <nostalgia/core/context.hpp>
|
||||
#include <nostalgia/scene/scene.hpp>
|
||||
|
||||
namespace nostalgia::scene {
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <turbine/turbine.hpp>
|
||||
#include <studio/studio.hpp>
|
||||
|
||||
namespace nostalgia::scene {
|
||||
|
Loading…
x
Reference in New Issue
Block a user