Compare commits
2 Commits
5dd3b678ae
...
2887fa7819
Author | SHA1 | Date | |
---|---|---|---|
2887fa7819 | |||
8c7f6ffafc |
2
deps/ox/src/ox/fs/filesystem/filesystem.cpp
vendored
2
deps/ox/src/ox/fs/filesystem/filesystem.cpp
vendored
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace ox {
|
||||
|
||||
Result<const char*> MemFS::directAccess(const FileAddress &addr) noexcept {
|
||||
Result<const char*> MemFS::directAccess(const FileAddress &addr) const noexcept {
|
||||
switch (addr.type()) {
|
||||
case FileAddressType::Inode:
|
||||
return directAccess(addr.getInode().value);
|
||||
|
18
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
18
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@@ -126,20 +126,20 @@ class FileSystem {
|
||||
|
||||
class MemFS: public FileSystem {
|
||||
public:
|
||||
Result<const char*> directAccess(const FileAddress &addr) noexcept;
|
||||
Result<const char*> directAccess(const FileAddress &addr) const noexcept;
|
||||
|
||||
inline Result<const char*> directAccess(CRStringView path) noexcept {
|
||||
inline Result<const char*> directAccess(CRStringView path) const noexcept {
|
||||
return directAccessPath(path);
|
||||
}
|
||||
|
||||
inline Result<const char*> directAccess(uint64_t inode) noexcept {
|
||||
inline Result<const char*> directAccess(uint64_t inode) const noexcept {
|
||||
return directAccessInode(inode);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Result<const char*> directAccessPath(CRStringView path) noexcept = 0;
|
||||
virtual Result<const char*> directAccessPath(CRStringView path) const noexcept = 0;
|
||||
|
||||
virtual Result<const char*> directAccessInode(uint64_t inode) noexcept = 0;
|
||||
virtual Result<const char*> directAccessInode(uint64_t inode) const noexcept = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -177,13 +177,13 @@ class FileSystemTemplate: public MemFS {
|
||||
|
||||
Error readFilePath(CRStringView path, void *buffer, std::size_t buffSize) noexcept override;
|
||||
|
||||
Result<const char*> directAccessPath(CRStringView) noexcept override;
|
||||
Result<const char*> directAccessPath(CRStringView) const noexcept override;
|
||||
|
||||
Error readFileInode(uint64_t inode, void *buffer, std::size_t size) noexcept override;
|
||||
|
||||
Error readFileInodeRange(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) noexcept override;
|
||||
|
||||
Result<const char*> directAccessInode(uint64_t) noexcept override;
|
||||
Result<const char*> directAccessInode(uint64_t) const noexcept override;
|
||||
|
||||
Result<Vector<String>> ls(CRStringView dir) const noexcept override;
|
||||
|
||||
@@ -302,7 +302,7 @@ Error FileSystemTemplate<FileStore, Directory>::readFilePath(CRStringView path,
|
||||
}
|
||||
|
||||
template<typename FileStore, typename Directory>
|
||||
Result<const char*> FileSystemTemplate<FileStore, Directory>::directAccessPath(CRStringView path) noexcept {
|
||||
Result<const char*> FileSystemTemplate<FileStore, Directory>::directAccessPath(CRStringView path) const noexcept {
|
||||
oxRequire(fd, fileSystemData());
|
||||
Directory rootDir(m_fs, fd.rootDirInode);
|
||||
oxRequire(inode, rootDir.find(path));
|
||||
@@ -324,7 +324,7 @@ Error FileSystemTemplate<FileStore, Directory>::readFileInodeRange(uint64_t inod
|
||||
}
|
||||
|
||||
template<typename FileStore, typename Directory>
|
||||
Result<const char*> FileSystemTemplate<FileStore, Directory>::directAccessInode(uint64_t inode) noexcept {
|
||||
Result<const char*> FileSystemTemplate<FileStore, Directory>::directAccessInode(uint64_t inode) const noexcept {
|
||||
auto data = m_fs.read(inode);
|
||||
if (!data.valid()) {
|
||||
return OxError(1, "Data not valid");
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user