[nostaliga] Cleanup
This commit is contained in:
parent
8c7f6ffafc
commit
2887fa7819
@ -1,6 +1,5 @@
|
|||||||
add_library(
|
add_library(
|
||||||
NostalgiaCore
|
NostalgiaCore
|
||||||
context.cpp
|
|
||||||
gfx.cpp
|
gfx.cpp
|
||||||
keelmodule.cpp
|
keelmodule.cpp
|
||||||
typeconv.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/buffer.hpp>
|
||||||
#include <ox/std/size.hpp>
|
#include <ox/std/size.hpp>
|
||||||
|
|
||||||
#include <keel/context.hpp>
|
|
||||||
#include <turbine/context.hpp>
|
#include <turbine/context.hpp>
|
||||||
|
|
||||||
#include "initparams.hpp"
|
#include "initparams.hpp"
|
||||||
@ -27,11 +26,13 @@ class Context {
|
|||||||
Context(const Context &other) noexcept = delete;
|
Context(const Context &other) noexcept = delete;
|
||||||
Context(const Context &&other) noexcept = delete;
|
Context(const Context &&other) noexcept = delete;
|
||||||
|
|
||||||
auto &rom() noexcept {
|
const auto &rom() const noexcept {
|
||||||
return *turbineCtx->rom;
|
return *turbineCtx->rom;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams& = {}) noexcept;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "color.hpp"
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
|
#include "gfx.hpp"
|
||||||
namespace nostalgia::core {
|
#include "initparams.hpp"
|
||||||
|
#include "keelmodule.hpp"
|
||||||
ox::Result<ox::UniquePtr<Context>> init(turbine::Context *tctx, const InitParams& = {}) noexcept;
|
#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 &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, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(tilesheetAddr));
|
oxRequire(ts, static_cast<const ox::MemFS&>(ctx->rom()).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];
|
||||||
@ -139,7 +139,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, 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));
|
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
|
||||||
@ -156,7 +156,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, static_cast<ox::MemFS*>(&ctx->rom())->directAccess(tilesheetAddr));
|
oxRequire(ts, static_cast<const ox::MemFS&>(ctx->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;
|
||||||
@ -164,7 +164,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, 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));
|
oxReturnError(ox::readMC(pal, palStat.size, &target.pal));
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
@ -174,7 +174,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, 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));
|
oxReturnError(ox::readMC(pal, palStat.size, &target));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -183,7 +183,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, 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));
|
oxReturnError(ox::readMC(pal, palStat.size, &target));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
NostalgiaCore PRIVATE
|
NostalgiaCore PRIVATE
|
||||||
context.cpp
|
context.cpp
|
||||||
core.cpp
|
|
||||||
gfx.cpp
|
gfx.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
|
@ -11,4 +11,11 @@ GlContext::~GlContext() noexcept {
|
|||||||
shutdownGfx(this);
|
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 <keel/media.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
|
||||||
|
|
||||||
#include "sceneeditor-imgui.hpp"
|
#include "sceneeditor-imgui.hpp"
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <studio/studio.hpp>
|
#include <studio/studio.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <turbine/context.hpp>
|
||||||
|
|
||||||
#include "sceneeditor.hpp"
|
#include "sceneeditor.hpp"
|
||||||
#include "sceneeditorview.hpp"
|
#include "sceneeditorview.hpp"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <keel/keel.hpp>
|
||||||
|
|
||||||
#include "sceneeditor.hpp"
|
#include "sceneeditor.hpp"
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <studio/studio.hpp>
|
#include <turbine/context.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
|
||||||
#include <nostalgia/scene/scene.hpp>
|
#include <nostalgia/scene/scene.hpp>
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nostalgia/core/core.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
|
|
||||||
#include "sceneeditorview.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) {
|
if (width != m_frameBuffer.width || height != m_frameBuffer.height) {
|
||||||
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, 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});
|
core::gl::drawMainView(m_cctx.get(), {width, height});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <glutils/glutils.hpp>
|
#include <glutils/glutils.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/context.hpp>
|
||||||
#include <nostalgia/scene/scene.hpp>
|
#include <nostalgia/scene/scene.hpp>
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <turbine/turbine.hpp>
|
|
||||||
#include <studio/studio.hpp>
|
#include <studio/studio.hpp>
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user