Compare commits
13 Commits
d5b232f5d5
...
de9f842640
Author | SHA1 | Date | |
---|---|---|---|
de9f842640 | |||
200e586768 | |||
f1609519a7 | |||
e452d9db4f | |||
43a87b606e | |||
8acc6244d5 | |||
bd2aeee276 | |||
89fab5cc20 | |||
1c06ea677f | |||
6b948ee069 | |||
72dddcaee5 | |||
7c824e910c | |||
a0c8146396 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
.clangd
|
.clangd
|
||||||
.current_build
|
.current_build
|
||||||
.conanbuild
|
.conanbuild
|
||||||
|
.idea
|
||||||
.mypy_cache
|
.mypy_cache
|
||||||
.stfolder
|
.stfolder
|
||||||
.stignore
|
.stignore
|
||||||
|
@ -15,6 +15,7 @@ probably differ), install the following additional packages:
|
|||||||
* pkg-config
|
* pkg-config
|
||||||
* xorg-dev
|
* xorg-dev
|
||||||
* libgtk-3-dev
|
* libgtk-3-dev
|
||||||
|
* python3-mypy
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
5
deps/ox/src/ox/claw/read.cpp
vendored
5
deps/ox/src/ox/claw/read.cpp
vendored
@ -74,7 +74,10 @@ Result<Buffer> stripClawHeader(const ox::Buffer &buff) noexcept {
|
|||||||
|
|
||||||
Result<ModelObject> readClaw(TypeStore &ts, const char *buff, std::size_t buffSz) noexcept {
|
Result<ModelObject> readClaw(TypeStore &ts, const char *buff, std::size_t buffSz) noexcept {
|
||||||
oxRequire(header, readClawHeader(buff, buffSz));
|
oxRequire(header, readClawHeader(buff, buffSz));
|
||||||
oxRequire(t, ts.getLoad(header.typeName, header.typeVersion, header.typeParams));
|
auto const [t, tdErr] = ts.getLoad(header.typeName, header.typeVersion, header.typeParams);
|
||||||
|
if (tdErr) {
|
||||||
|
return OxError(3, "Could not load type descriptor");
|
||||||
|
}
|
||||||
ModelObject obj;
|
ModelObject obj;
|
||||||
oxReturnError(obj.setType(t));
|
oxReturnError(obj.setType(t));
|
||||||
switch (header.fmt) {
|
switch (header.fmt) {
|
||||||
|
6
deps/ox/src/ox/fs/CMakeLists.txt
vendored
6
deps/ox/src/ox/fs/CMakeLists.txt
vendored
@ -16,12 +16,6 @@ if(NOT MSVC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OX_BARE_METAL)
|
if(NOT OX_BARE_METAL)
|
||||||
if(NOT APPLE AND NOT MSVC AND NOT ${OX_OS_FREEBSD})
|
|
||||||
target_link_libraries(
|
|
||||||
OxFS PUBLIC
|
|
||||||
stdc++fs
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
set_property(
|
set_property(
|
||||||
TARGET
|
TARGET
|
||||||
OxFS
|
OxFS
|
||||||
|
6
deps/ox/src/ox/model/descwrite.hpp
vendored
6
deps/ox/src/ox/model/descwrite.hpp
vendored
@ -219,9 +219,11 @@ template<typename T>
|
|||||||
constexpr Error TypeDescWriter::field(CRStringView name, const T *val) noexcept {
|
constexpr Error TypeDescWriter::field(CRStringView name, const T *val) noexcept {
|
||||||
if (m_type) {
|
if (m_type) {
|
||||||
if constexpr(isVector_v<T> || isArray_v<T>) {
|
if constexpr(isVector_v<T> || isArray_v<T>) {
|
||||||
return field(name, val->data(), 0, detail::buildSubscriptStack(val));
|
typename T::value_type *data = nullptr;
|
||||||
|
return field(name, data, 0, detail::buildSubscriptStack(val));
|
||||||
} else if constexpr(isSmartPtr_v<T>) {
|
} else if constexpr(isSmartPtr_v<T>) {
|
||||||
return field(name, val->get(), 0, detail::buildSubscriptStack(val));
|
typename T::value_type *data = nullptr;
|
||||||
|
return field(name, data, 0, detail::buildSubscriptStack(val));
|
||||||
} else if constexpr(is_pointer_v<T>) {
|
} else if constexpr(is_pointer_v<T>) {
|
||||||
return field(name, val, 0, detail::buildSubscriptStack(val));
|
return field(name, val, 0, detail::buildSubscriptStack(val));
|
||||||
} else {
|
} else {
|
||||||
|
13
deps/ox/src/ox/std/memory.hpp
vendored
13
deps/ox/src/ox/std/memory.hpp
vendored
@ -39,6 +39,7 @@ constexpr T *construct_at(T *p, Args &&...args ) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "error.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ class SharedPtr {
|
|||||||
int *m_refCnt = nullptr;
|
int *m_refCnt = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using value_type = T;
|
||||||
explicit constexpr SharedPtr(T *t = nullptr) noexcept: m_t(t), m_refCnt(new int) {
|
explicit constexpr SharedPtr(T *t = nullptr) noexcept: m_t(t), m_refCnt(new int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +185,7 @@ class UniquePtr {
|
|||||||
T *m_t = nullptr;
|
T *m_t = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using value_type = T;
|
||||||
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,4 +291,14 @@ constexpr auto make_unique(Args&&... args) {
|
|||||||
return UniquePtr<U>(new T(ox::forward<Args>(args)...));
|
return UniquePtr<U>(new T(ox::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename U = T, typename ...Args>
|
||||||
|
[[nodiscard]]
|
||||||
|
constexpr Result<UniquePtr<U>> make_unique_catch(Args&&... args) noexcept {
|
||||||
|
try {
|
||||||
|
return UniquePtr<U>(new T(ox::forward<Args>(args)...));
|
||||||
|
} catch (ox::Exception const&ex) {
|
||||||
|
return ex.toError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,13 @@ All components have a platform indicator next to them:
|
|||||||
|
|
||||||
### GBA
|
### GBA
|
||||||
|
|
||||||
|
The GBA has two major resources for learning about its hardware:
|
||||||
|
|
||||||
|
* [Tonc](https://www.coranac.com/tonc/text/toc.htm) - This is basically a short
|
||||||
|
book on the GBA and low level development.
|
||||||
|
* [GBATEK](https://rust-console.github.io/gbatek-gbaonly/) - This is a more
|
||||||
|
concise resource that mostly tells about memory ranges and registers.
|
||||||
|
|
||||||
#### Graphics
|
#### Graphics
|
||||||
|
|
||||||
* Background Palette: 256 colors
|
* Background Palette: 256 colors
|
||||||
|
45
jenkins/gba/Jenkinsfile
vendored
45
jenkins/gba/Jenkinsfile
vendored
@ -1,45 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent {
|
|
||||||
label 'gba'
|
|
||||||
}
|
|
||||||
stages {
|
|
||||||
stage('Environment') {
|
|
||||||
steps {
|
|
||||||
load 'jenkins/shared/env.gy'
|
|
||||||
sh 'make conan-config'
|
|
||||||
sh 'make conan'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Tools Debug') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-debug'
|
|
||||||
sh 'make install'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build GBA Debug') {
|
|
||||||
steps {
|
|
||||||
sh 'make configure-gba-debug'
|
|
||||||
sh 'make'
|
|
||||||
sh 'make pkg-gba'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Tools Release') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-release'
|
|
||||||
sh 'make install'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build GBA Release') {
|
|
||||||
steps {
|
|
||||||
sh 'make configure-gba'
|
|
||||||
sh 'make'
|
|
||||||
sh 'make pkg-gba'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
post {
|
|
||||||
always {
|
|
||||||
archiveArtifacts artifacts: 'nostalgia.gba', fingerprint: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
47
jenkins/linux/Jenkinsfile
vendored
47
jenkins/linux/Jenkinsfile
vendored
@ -1,47 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent {
|
|
||||||
label 'linux-x86_64'
|
|
||||||
}
|
|
||||||
stages {
|
|
||||||
stage('Environment') {
|
|
||||||
steps {
|
|
||||||
load 'jenkins/shared/env.gy'
|
|
||||||
sh 'make conan-config'
|
|
||||||
sh 'make conan'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Asan') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-asan'
|
|
||||||
sh 'make'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test Asan') {
|
|
||||||
steps {
|
|
||||||
sh 'make test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Debug') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-debug'
|
|
||||||
sh 'make'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test Debug') {
|
|
||||||
steps {
|
|
||||||
sh 'make test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Release') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-release'
|
|
||||||
sh 'make'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test Release') {
|
|
||||||
steps {
|
|
||||||
sh 'make test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
47
jenkins/mac/Jenkinsfile
vendored
47
jenkins/mac/Jenkinsfile
vendored
@ -1,47 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent {
|
|
||||||
label 'mac-x86_64'
|
|
||||||
}
|
|
||||||
stages {
|
|
||||||
stage('Environment') {
|
|
||||||
steps {
|
|
||||||
load 'jenkins/shared/env.gy'
|
|
||||||
sh 'make conan-config'
|
|
||||||
sh 'make conan'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Asan') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-asan'
|
|
||||||
sh 'make'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test Asan') {
|
|
||||||
steps {
|
|
||||||
sh 'make test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Debug') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-debug'
|
|
||||||
sh 'make'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test Debug') {
|
|
||||||
steps {
|
|
||||||
sh 'make test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build Release') {
|
|
||||||
steps {
|
|
||||||
sh 'make purge configure-release'
|
|
||||||
sh 'make'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Test Release') {
|
|
||||||
steps {
|
|
||||||
sh 'make test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
env.OX_NODEBUG = 1
|
|
||||||
env.BUILDCORE_SUPPRESS_CCACHE = 1
|
|
@ -20,6 +20,8 @@ host_env = f'{os}-{arch}'
|
|||||||
# get current build type
|
# get current build type
|
||||||
with open(".current_build", "r") as f:
|
with open(".current_build", "r") as f:
|
||||||
current_build = f.readlines()[0]
|
current_build = f.readlines()[0]
|
||||||
|
if current_build[len(current_build) - 1] == '\n':
|
||||||
|
current_build = current_build[:len(current_build) - 1]
|
||||||
|
|
||||||
project_dir = sys.argv[1]
|
project_dir = sys.argv[1]
|
||||||
project_name = sys.argv[2]
|
project_name = sys.argv[2]
|
||||||
|
@ -147,7 +147,7 @@ void TileSheetEditorModel::deleteTiles(TileSheet::SubSheetIdx const&idx, std::si
|
|||||||
pushCommand(ox::make<DeleteTilesCommand>(m_img, idx, tileIdx, tileCnt));
|
pushCommand(ox::make<DeleteTilesCommand>(m_img, idx, tileIdx, tileCnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetEditorModel::updateSubsheet(TileSheet::SubSheetIdx const&idx, const ox::StringView &name, int cols, int rows) noexcept {
|
ox::Error TileSheetEditorModel::updateSubsheet(TileSheet::SubSheetIdx const&idx, ox::StringView const&name, int cols, int rows) noexcept {
|
||||||
pushCommand(ox::make<UpdateSubSheetCommand>(m_img, idx, ox::String(name), cols, rows));
|
pushCommand(ox::make<UpdateSubSheetCommand>(m_img, idx, ox::String(name), cols, rows));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ void TileSheetEditorModel::ackUpdate() noexcept {
|
|||||||
|
|
||||||
ox::Error TileSheetEditorModel::saveFile() noexcept {
|
ox::Error TileSheetEditorModel::saveFile() noexcept {
|
||||||
const auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
const auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||||
return sctx->project->writeObj(m_path, m_img);
|
return sctx->project->writeObj(m_path, m_img, ox::ClawFormat::Metal);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TileSheetEditorModel::pixelSelected(std::size_t idx) const noexcept {
|
bool TileSheetEditorModel::pixelSelected(std::size_t idx) const noexcept {
|
||||||
|
@ -61,21 +61,21 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
|||||||
|
|
||||||
ox::Error setPalette(ox::StringView path) noexcept;
|
ox::Error setPalette(ox::StringView path) noexcept;
|
||||||
|
|
||||||
void drawCommand(const ox::Point &pt, std::size_t palIdx) noexcept;
|
void drawCommand(ox::Point const&pt, std::size_t palIdx) noexcept;
|
||||||
|
|
||||||
void endDrawCommand() noexcept;
|
void endDrawCommand() noexcept;
|
||||||
|
|
||||||
void addSubsheet(const TileSheet::SubSheetIdx &parentIdx) noexcept;
|
void addSubsheet(TileSheet::SubSheetIdx const&parentIdx) noexcept;
|
||||||
|
|
||||||
void rmSubsheet(const TileSheet::SubSheetIdx &idx) noexcept;
|
void rmSubsheet(TileSheet::SubSheetIdx const&idx) noexcept;
|
||||||
|
|
||||||
void insertTiles(const TileSheet::SubSheetIdx &idx, std::size_t tileIdx, std::size_t tileCnt) noexcept;
|
void insertTiles(TileSheet::SubSheetIdx const&idx, std::size_t tileIdx, std::size_t tileCnt) noexcept;
|
||||||
|
|
||||||
void deleteTiles(const TileSheet::SubSheetIdx &idx, std::size_t tileIdx, std::size_t tileCnt) noexcept;
|
void deleteTiles(TileSheet::SubSheetIdx const&idx, std::size_t tileIdx, std::size_t tileCnt) noexcept;
|
||||||
|
|
||||||
ox::Error updateSubsheet(const TileSheet::SubSheetIdx &idx, const ox::StringView &name, int cols, int rows) noexcept;
|
ox::Error updateSubsheet(TileSheet::SubSheetIdx const&idx, ox::StringView const&name, int cols, int rows) noexcept;
|
||||||
|
|
||||||
void setActiveSubsheet(const TileSheet::SubSheetIdx&) noexcept;
|
void setActiveSubsheet(TileSheet::SubSheetIdx const&) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
const TileSheet::SubSheet *activeSubSheet() const noexcept {
|
const TileSheet::SubSheet *activeSubSheet() const noexcept {
|
||||||
|
@ -125,7 +125,11 @@ ox::Error preloadDir(
|
|||||||
auto const dir = ox::sfmt("{}{}/", path, name);
|
auto const dir = ox::sfmt("{}{}/", path, name);
|
||||||
oxReturnError(preloadDir(ts, romFs, pl, dir));
|
oxReturnError(preloadDir(ts, romFs, pl, dir));
|
||||||
} else {
|
} else {
|
||||||
oxReturnError(preloadObj(ts, romFs, pl, filePath));
|
auto const err = preloadObj(ts, romFs, pl, filePath);
|
||||||
|
if (err) {
|
||||||
|
oxErrf("\033[31;1;1mCould not preload {}:\n\t{}\n", filePath, toStr(err));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
@ -120,7 +120,11 @@ static ox::Error transformClaw(
|
|||||||
auto const dir = ox::sfmt("{}{}/", path, name);
|
auto const dir = ox::sfmt("{}{}/", path, name);
|
||||||
oxReturnError(transformClaw(ctx, ts, dest, dir));
|
oxReturnError(transformClaw(ctx, ts, dest, dir));
|
||||||
} else {
|
} else {
|
||||||
oxReturnError(doTransformations(ctx, ts, dest, filePath));
|
auto const err = doTransformations(ctx, ts, dest, filePath);
|
||||||
|
if (err) {
|
||||||
|
oxErrf("\033[31;1;1mCould not do transformations for {}:\n\t{}\n", filePath, toStr(err));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include <ox/logconn/logconn.hpp>
|
#include <ox/logconn/logconn.hpp>
|
||||||
#include <ox/logconn/def.hpp>
|
|
||||||
#include <ox/std/trace.hpp>
|
#include <ox/std/trace.hpp>
|
||||||
#include <ox/std/uuid.hpp>
|
#include <ox/std/uuid.hpp>
|
||||||
#include <keel/media.hpp>
|
#include <keel/media.hpp>
|
||||||
@ -31,21 +30,19 @@ class StudioUIDrawer: public turbine::gl::Drawer {
|
|||||||
|
|
||||||
static int updateHandler(turbine::Context &ctx) noexcept {
|
static int updateHandler(turbine::Context &ctx) noexcept {
|
||||||
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
||||||
auto ui = dynamic_cast<StudioUI*>(sctx->ui);
|
sctx->ui->update();
|
||||||
ui->update();
|
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept {
|
static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept {
|
||||||
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
||||||
auto ui = dynamic_cast<StudioUI*>(sctx->ui);
|
sctx->ui->handleKeyEvent(key, down);
|
||||||
ui->handleKeyEvent(key, down);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ox::Error runApp(
|
static ox::Error runApp(
|
||||||
ox::CRStringView appName,
|
ox::CRStringView appName,
|
||||||
ox::CRStringView projectDataDir,
|
ox::CRStringView projectDataDir,
|
||||||
ox::UniquePtr<ox::FileSystem> fs) noexcept {
|
ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
||||||
oxRequireM(ctx, turbine::init(std::move(fs), appName));
|
oxRequireM(ctx, turbine::init(std::move(fs), appName));
|
||||||
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
|
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
|
||||||
turbine::setUpdateHandler(*ctx, updateHandler);
|
turbine::setUpdateHandler(*ctx, updateHandler);
|
||||||
|
@ -334,13 +334,15 @@ ox::Error StudioUI::createOpenProject(ox::CRStringView path) noexcept {
|
|||||||
std::filesystem::create_directories(toStdStringView(path), ec);
|
std::filesystem::create_directories(toStdStringView(path), ec);
|
||||||
oxReturnError(OxError(ec.value() != 0, "Could not create project directory"));
|
oxReturnError(OxError(ec.value() != 0, "Could not create project directory"));
|
||||||
oxReturnError(openProjectPath(path));
|
oxReturnError(openProjectPath(path));
|
||||||
return m_project->writeAllTypeDescriptors();
|
return m_project->writeTypeStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::openProjectPath(ox::CRStringView path) noexcept {
|
ox::Error StudioUI::openProjectPath(ox::CRStringView path) noexcept {
|
||||||
oxRequireM(fs, keel::loadRomFs(path));
|
oxRequireM(fs, keel::loadRomFs(path));
|
||||||
oxReturnError(keel::setRomFs(keelCtx(m_ctx), std::move(fs)));
|
oxReturnError(keel::setRomFs(keelCtx(m_ctx), std::move(fs)));
|
||||||
m_project = ox::make_unique<studio::Project>(keelCtx(m_ctx), ox::String(path), m_projectDataDir);
|
oxReturnError(
|
||||||
|
ox::make_unique_catch<studio::Project>(keelCtx(m_ctx), ox::String(path), m_projectDataDir)
|
||||||
|
.moveTo(m_project));
|
||||||
auto const sctx = applicationData<studio::StudioContext>(m_ctx);
|
auto const sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||||
sctx->project = m_project.get();
|
sctx->project = m_project.get();
|
||||||
turbine::setWindowTitle(m_ctx, ox::sfmt("{} - {}", keelCtx(m_ctx).appName, m_project->projectPath()));
|
turbine::setWindowTitle(m_ctx, ox::sfmt("{} - {}", keelCtx(m_ctx).appName, m_project->projectPath()));
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
struct StudioContext {
|
struct StudioContext {
|
||||||
ox::SignalHandler *ui = nullptr;
|
class StudioUI *ui = nullptr;
|
||||||
Project *project = nullptr;
|
Project *project = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class Project {
|
|||||||
ox::HashMap<ox::String, ox::Vector<ox::String>> m_fileExtFileMap;
|
ox::HashMap<ox::String, ox::Vector<ox::String>> m_fileExtFileMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDataDir) noexcept;
|
explicit Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDataDir);
|
||||||
|
|
||||||
ox::Error create() noexcept;
|
ox::Error create() noexcept;
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class Project {
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
ox::Vector<ox::String> const&fileList(ox::CRStringView ext) noexcept;
|
ox::Vector<ox::String> const&fileList(ox::CRStringView ext) noexcept;
|
||||||
|
|
||||||
ox::Error writeAllTypeDescriptors() noexcept;
|
ox::Error writeTypeStore() noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buildFileIndex() noexcept;
|
void buildFileIndex() noexcept;
|
||||||
@ -131,8 +131,8 @@ ox::Error Project::writeObj(ox::CRStringView path, T const&obj, ox::ClawFormat f
|
|||||||
}
|
}
|
||||||
oxRequire(desc, m_typeStore.get<T>());
|
oxRequire(desc, m_typeStore.get<T>());
|
||||||
auto const descExists = m_fs.stat(ox::sfmt("{}/{}", m_typeDescPath, buildTypeId(*desc))).error != 0;
|
auto const descExists = m_fs.stat(ox::sfmt("{}/{}", m_typeDescPath, buildTypeId(*desc))).error != 0;
|
||||||
if (!descExists || ox::defines::Debug) {
|
if (!descExists) {
|
||||||
oxReturnError(writeAllTypeDescriptors());
|
oxReturnError(writeTypeStore());
|
||||||
}
|
}
|
||||||
oxReturnError(keel::setAsset(m_ctx, path, obj));
|
oxReturnError(keel::setAsset(m_ctx, path, obj));
|
||||||
fileUpdated.emit(path);
|
fileUpdated.emit(path);
|
||||||
|
@ -26,7 +26,7 @@ static void generateTypes(ox::TypeStore &ts) noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Project::Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDataDir) noexcept:
|
Project::Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDataDir):
|
||||||
m_ctx(ctx),
|
m_ctx(ctx),
|
||||||
m_path(std::move(path)),
|
m_path(std::move(path)),
|
||||||
m_projectDataDir(projectDataDir),
|
m_projectDataDir(projectDataDir),
|
||||||
@ -35,6 +35,9 @@ Project::Project(keel::Context &ctx, ox::String path, ox::CRStringView projectDa
|
|||||||
m_fs(*m_ctx.rom) {
|
m_fs(*m_ctx.rom) {
|
||||||
oxTracef("studio", "Project: {}", m_path);
|
oxTracef("studio", "Project: {}", m_path);
|
||||||
generateTypes(m_typeStore);
|
generateTypes(m_typeStore);
|
||||||
|
if (ox::defines::Debug) {
|
||||||
|
oxThrowError(writeTypeStore());
|
||||||
|
}
|
||||||
buildFileIndex();
|
buildFileIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +73,7 @@ ox::Vector<ox::String> const&Project::fileList(ox::CRStringView ext) noexcept {
|
|||||||
return m_fileExtFileMap[ext];
|
return m_fileExtFileMap[ext];
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error Project::writeAllTypeDescriptors() noexcept {
|
ox::Error Project::writeTypeStore() noexcept {
|
||||||
// write all descriptors because we don't know which types T depends on
|
// write all descriptors because we don't know which types T depends on
|
||||||
oxReturnError(mkdir(m_typeDescPath));
|
oxReturnError(mkdir(m_typeDescPath));
|
||||||
for (auto const &t: m_typeStore.typeList()) {
|
for (auto const &t: m_typeStore.typeList()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user