Merge commit '22e6299e90e85cb2b5ee814ebf2324b1a74d7091'

This commit is contained in:
2024-04-24 23:12:54 -05:00
184 changed files with 1262 additions and 418 deletions

View File

@ -28,11 +28,11 @@ void panic(const char *file, int line, const char *panicMsg, ox::Error const&err
ox::heapmgr::initHeap(HEAP_BEGIN, HEAP_END);
auto tctx = turbine::init(keel::loadRomFs("").unwrap(), "Nostalgia").unwrap();
auto ctx = init(*tctx).unwrap();
oxIgnoreError(initGfx(*ctx, {}));
oxIgnoreError(initConsole(*ctx));
std::ignore = initGfx(*ctx, {});
std::ignore = initConsole(*ctx);
setBgStatus(*ctx, 0, true);
clearBg(*ctx, 0);
ox::BString<23> serr = "Error code: ";
ox::IString<23> serr = "Error code: ";
serr += static_cast<int64_t>(err);
puts(*ctx, 32 + 1, 1, "SADNESS...");
puts(*ctx, 32 + 1, 4, "UNEXPECTED STATE:");

View File

@ -19,7 +19,7 @@ void AddPageCommand::redo() noexcept {
}
void AddPageCommand::undo() noexcept {
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_pal.pages.size() - 1)));
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_pal.pages.size() - 1));
}
@ -43,7 +43,7 @@ void DuplicatePageCommand::redo() noexcept {
void DuplicatePageCommand::undo() noexcept {
m_page = std::move(m_pal.pages[m_dstIdx]);
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_dstIdx)));
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_dstIdx));
}
size_t DuplicatePageCommand::insertIdx() const noexcept {
@ -62,7 +62,7 @@ int RemovePageCommand::commandId() const noexcept {
void RemovePageCommand::redo() noexcept {
m_page = std::move(m_pal.pages[m_idx]);
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_idx)));
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_idx));
}
void RemovePageCommand::undo() noexcept {
@ -86,7 +86,7 @@ void AddColorCommand::redo() noexcept {
}
void AddColorCommand::undo() noexcept {
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx)));
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx));
}
@ -102,7 +102,7 @@ int RemoveColorCommand::commandId() const noexcept {
}
void RemoveColorCommand::redo() noexcept {
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx)));
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx));
}
void RemoveColorCommand::undo() noexcept {
@ -171,8 +171,8 @@ void MoveColorCommand::undo() noexcept {
void MoveColorCommand::moveColor(int idx, int offset) noexcept {
const auto c = m_pal->pages[m_page][static_cast<std::size_t>(idx)];
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(idx)));
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(idx));
m_pal->pages[m_page].insert(static_cast<std::size_t>(idx + offset), c);
}
}
}

View File

@ -11,7 +11,7 @@
namespace nostalgia::core {
class StudioModule: public studio::Module {
static class: public studio::Module {
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept final {
return {
studio::editorMaker<TileSheetEditorImGui>(ctx, FileExt_ng),
@ -25,9 +25,8 @@ class StudioModule: public studio::Module {
out.emplace_back(ox::make<studio::ItemMakerT<core::Palette>>("Palette", "Palettes", FileExt_npal));
return out;
}
};
} mod;
static StudioModule mod;
const studio::Module *studioModule() noexcept {
return &mod;
}

View File

@ -13,7 +13,7 @@ core::PaletteChangeCommand::PaletteChangeCommand(
m_img(img),
m_idx(std::move(idx)),
m_oldPalette(m_img.defaultPalette),
m_newPalette(ox::FileAddress(ox::sfmt<ox::BString<43>>("uuid://{}", newPalette))) {
m_newPalette(ox::FileAddress(ox::sfmt<ox::IString<43>>("uuid://{}", newPalette))) {
}
void PaletteChangeCommand::redo() noexcept {

View File

@ -81,7 +81,7 @@ TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::CRSt
m_tctx(m_sctx.tctx),
m_view(m_sctx, path, *undoStack()),
m_model(m_view.model()) {
oxIgnoreError(setPaletteSelection());
std::ignore = setPaletteSelection();
// connect signal/slots
undoStack()->changeTriggered.connect(this, &TileSheetEditorImGui::markUnsavedChanges);
m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
@ -440,7 +440,7 @@ void TileSheetEditorImGui::drawPaletteSelector() noexcept {
ImGui::PushID(static_cast<int>(i));
// Column: color idx
ImGui::TableNextColumn();
auto const label = ox::BString<8>() + (i + 1);
auto const label = ox::IString<8>() + (i + 1);
auto const rowSelected = i == m_view.palIdx();
if (ImGui::Selectable(label.c_str(), rowSelected, ImGuiSelectableFlags_SpanAllColumns)) {
m_view.setPalIdx(i);

View File

@ -28,7 +28,7 @@ class TileSheetEditorImGui: public studio::Editor {
private:
class SubSheetEditor {
private:
ox::BString<100> m_name;
ox::IString<100> m_name;
int m_cols = 0;
int m_rows = 0;
bool m_show = false;

View File

@ -10,7 +10,7 @@
namespace nostalgia::scene {
class SceneModule: public keel::Module {
static class: public keel::Module {
private:
SceneDocToSceneStaticConverter m_sceneDocToSceneStaticConverter;
@ -42,9 +42,8 @@ class SceneModule: public keel::Module {
};
}
};
} mod;
static const SceneModule mod;
const keel::Module *keelModule() noexcept {
return &mod;
}

View File

@ -10,7 +10,7 @@ namespace nostalgia::scene {
constexpr ox::StringLiteral FileExt_nscn("nscn");
class StudioModule: public studio::Module {
static class: public studio::Module {
public:
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept override {
return {
@ -21,9 +21,8 @@ class StudioModule: public studio::Module {
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
return out;
}
};
} mod;
static StudioModule const mod;
const studio::Module *studioModule() noexcept {
return &mod;
}

View File

@ -117,7 +117,7 @@ class AssetRef: public ox::SignalHandler {
}
if (m_ctr) {
m_ctr->decRefs();
oxIgnoreError(m_ctr->updated.disconnectObject(this));
std::ignore = m_ctr->updated.disconnectObject(this);
}
m_ctr = h.m_ctr;
if (m_ctr) {
@ -133,11 +133,11 @@ class AssetRef: public ox::SignalHandler {
}
if (m_ctr) {
m_ctr->decRefs();
oxIgnoreError(m_ctr->updated.disconnectObject(this));
std::ignore = m_ctr->updated.disconnectObject(this);
}
m_ctr = h.m_ctr;
if (m_ctr) {
oxIgnoreError(m_ctr->updated.disconnectObject(&h));
std::ignore = m_ctr->updated.disconnectObject(&h);
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
}
h.m_ctr = nullptr;

View File

@ -11,7 +11,7 @@ ox::Error init(
ox::UPtr<ox::FileSystem> &&fs,
ox::CRStringView appName) noexcept {
ctx.appName = appName;
oxIgnoreError(setRomFs(ctx, std::move(fs)));
std::ignore = setRomFs(ctx, std::move(fs));
#ifndef OX_BARE_METAL
auto const&mods = modules();
for (auto &mod : mods) {

View File

@ -28,7 +28,7 @@ class NewMenu: public studio::Popup {
private:
Stage m_stage = Stage::Closed;
ox::String m_typeName;
ox::BString<255> m_itemName;
ox::IString<255> m_itemName;
ox::Vector<ox::UniquePtr<studio::ItemMaker>> m_types;
int m_selectedType = 0;
bool m_open = false;

View File

@ -28,7 +28,7 @@ class NewProject: public studio::Popup {
Stage m_stage = Stage::Closed;
ox::String const m_projectDataDir;
ox::String m_projectPath;
ox::BString<255> m_projectName;
ox::IString<255> m_projectName;
ox::Vector<ox::UniquePtr<studio::ItemMaker>> m_types;
bool m_open = false;

View File

@ -417,10 +417,10 @@ ox::Error StudioUI::closeFile(ox::CRStringView path) noexcept {
if (!m_openFiles.contains(path)) {
return {};
}
oxIgnoreError(m_openFiles.erase(std::remove(m_openFiles.begin(), m_openFiles.end(), path)));
std::ignore = m_openFiles.erase(std::remove(m_openFiles.begin(), m_openFiles.end(), path));
// save to config
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig *config) {
oxIgnoreError(config->openFiles.erase(std::remove(config->openFiles.begin(), config->openFiles.end(), path)));
std::ignore = config->openFiles.erase(std::remove(config->openFiles.begin(), config->openFiles.end(), path));
});
return {};
}

View File

@ -24,7 +24,7 @@ static ox::Result<ox::String> toResult(nfdresult_t r, NFD::UniquePathN const&pat
ox::String out;
for (auto i = 0u; path.get()[i]; ++i) {
auto const c = static_cast<char>(path.get()[i]);
oxIgnoreError(out.append(&c, 1));
std::ignore = out.append(&c, 1);
}
return out;
}

View File

@ -9,13 +9,13 @@
namespace studio {
void TaskRunner::update(turbine::Context &ctx) noexcept {
oxIgnoreError(m_tasks.erase(std::remove_if(m_tasks.begin(), m_tasks.end(), [&](ox::UPtr<studio::Task> &t) {
std::ignore = m_tasks.erase(std::remove_if(m_tasks.begin(), m_tasks.end(), [&](ox::UPtr<studio::Task> &t) {
auto const done = t->update(ctx) == TaskState::Done;
if (done) {
t->finished.emit();
}
return done;
})));
}));
}
void TaskRunner::add(Task &task) noexcept {

View File

@ -12,7 +12,7 @@ bool UndoCommand::mergeWith(UndoCommand const*) noexcept {
void UndoStack::push(ox::UPtr<UndoCommand> &&cmd) noexcept {
for (auto const i = m_stackIdx; i < m_stack.size();) {
oxIgnoreError(m_stack.erase(i));
std::ignore = m_stack.erase(i);
}
cmd->redo();
redoTriggered.emit(cmd.get());

View File

@ -22,7 +22,7 @@ void addDrawer(Context &ctx, Drawer *cd) noexcept {
void removeDrawer(Context &ctx, Drawer *cd) noexcept {
for (auto i = 0u; i < ctx.drawers.size(); ++i) {
if (ctx.drawers[i] == cd) {
oxIgnoreError(ctx.drawers.erase(i));
std::ignore = ctx.drawers.erase(i);
break;
}
}