Squashed 'deps/nostalgia/' changes from 161640fa..a75c4a11

a75c4a11 [nfde] Address CMake warning, remove unwanted logging
347a1657 [sample_project] Update type descriptors
fd64bfae [keel] Fix a use after free, cleanup
aaeec20a [nostalgia/player] Fix build
37030f9c [keel] Cleanup pack tool
462f2bca [nostalgia,olympic] Change macro names to comply with broader conventions
dc72500b [glutils] Change macro names to comply with broader conventions
962fe8bc [ox] Change macro names to comply with broader conventions
305eb626 [studio] Fix build
4754359a [ox/std] Cleanup Vec2
dc07f3d5 [studio] Change FilePicker consturctor to take StringParams
fcdcfd10 [ox/std] Run liccor
b74f6a7a [studio,turbine] Run liccor
ac7e5be1 [ox] Remove OxException
ed910c0b [nostalgia/core/studio/tilesheeteditor] Fix access overflow on out of bounds Fill command
345fb038 [ox] Remove OxError
9881253f [glutils] Cleanup OxError
96d27eec [nostalgia,olympic] Cleanup
28ebe93b [ox/std] Make source_location::current only init if valid
e849e7a3 [ox/std] Add source_location
e6777b0a [cityhash] Add install rule
c488c336 [turbine/glfw] Fix mandatoryRefreshPeriodEnd tracking
003f9720 [turbine/glfw] Move MandatoryRefreshPeriod to config.hpp
d85a10af [nostalgia/core/studio] Cleanup
ff05d860 [turbine/glfw] Replace uninterruptedRefreshes with mandatoryRefreshPeriodEnd
76794037 [turbine] Add init wrapper that takes FS path
c51a45e1 [olympic] Cleanup
a6e24ff2 [ox/std] Add CString type alias
e0ec9e0c [nostalgia,olympic] Move olympic::run to global namespace
9a42a9b9 [nfde] Fix Windows warnings
03a05c51 Merge commit '4ccdfc3a6e5bd501968903a01f7d8141b6f88375'
bd91137d [nostalgia,olympic] Fix pack tool build for Windows
2b7d1294 [nostalgia/core/studio] Fix MSVC build

git-subtree-dir: deps/nostalgia
git-subtree-split: a75c4a11d3c555f4d3bed1ea1f70bb29fe49e99c
This commit is contained in:
2024-12-21 20:13:20 -06:00
parent 4ccdfc3a6e
commit dc96270ca5
199 changed files with 2468 additions and 2156 deletions

View File

@@ -12,6 +12,7 @@ add_library(
)
target_compile_definitions(
StudioAppLib PUBLIC
OLYMPIC_GUI_APP=1
OLYMPIC_LOAD_STUDIO_MODULES=1
OLYMPIC_APP_NAME="Studio"
)

View File

@@ -37,7 +37,7 @@ static ox::Error runApp(
ox::StringViewCR appName,
ox::StringViewCR projectDataDir,
ox::UPtr<ox::FileSystem> &&fs) noexcept {
oxRequireM(ctx, turbine::init(std::move(fs), appName));
OX_REQUIRE_M(ctx, turbine::init(std::move(fs), appName));
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
turbine::setKeyEventHandler(*ctx, keyEventHandler);
turbine::setRefreshWithin(*ctx, 0);
@@ -67,14 +67,10 @@ static ox::Error run(
}
namespace olympic {
ox::Error run(
ox::StringView project,
ox::StringView appName,
ox::StringView projectDataDir,
ox::SpanView<char const*> args) noexcept {
ox::SpanView<ox::CString> args) noexcept {
return studio::run(ox::sfmt("{} {}", project, appName), projectDataDir, args);
}
}

View File

@@ -118,12 +118,12 @@ void NewMenu::drawLastPageButtons(studio::StudioContext &sctx) noexcept {
void NewMenu::finish(studio::StudioContext &sctx) noexcept {
if (m_itemName.len() == 0) {
oxLogError(OxError(1, "New file error: no file name"));
oxLogError(ox::Error(1, "New file error: no file name"));
return;
}
auto const&typeMaker = *m_types[static_cast<std::size_t>(m_selectedType)];
if (sctx.project->exists(typeMaker.itemPath(m_itemName))) {
oxLogError(OxError(1, "New file error: file already exists"));
oxLogError(ox::Error(1, "New file error: file already exists"));
return;
}
auto const [path, err] = typeMaker.write(sctx, m_itemName);

View File

@@ -16,16 +16,16 @@ static ox::Result<ox::UniquePtr<ProjectTreeModel>> buildProjectTreeModel(
ox::StringView path,
ProjectTreeModel *parent) noexcept {
auto const fs = explorer.romFs();
oxRequire(stat, fs->stat(path));
OX_REQUIRE(stat, fs->stat(path));
auto out = ox::make_unique<ProjectTreeModel>(explorer, ox::String(name), parent);
if (stat.fileType == ox::FileType::Directory) {
oxRequireM(children, fs->ls(path));
OX_REQUIRE_M(children, fs->ls(path));
std::sort(children.begin(), children.end());
ox::Vector<ox::UniquePtr<ProjectTreeModel>> outChildren;
for (auto const&childName : children) {
if (childName[0] != '.') {
auto const childPath = ox::sfmt("{}/{}", path, childName);
oxRequireM(child, buildProjectTreeModel(explorer, childName, childPath, out.get()));
OX_REQUIRE_M(child, buildProjectTreeModel(explorer, childName, childPath, out.get()));
outChildren.emplace_back(std::move(child));
}
}
@@ -52,9 +52,9 @@ void ProjectExplorer::setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept {
}
ox::Error ProjectExplorer::refreshProjectTreeModel(ox::StringViewCR) noexcept {
oxRequireM(model, buildProjectTreeModel(*this, "Project", "/", nullptr));
OX_REQUIRE_M(model, buildProjectTreeModel(*this, "Project", "/", nullptr));
setModel(std::move(model));
return OxError(0);
return ox::Error(0);
}
}

View File

@@ -36,12 +36,12 @@ struct StudioConfig {
bool showProjectExplorer = true;
};
oxModelBegin(StudioConfig)
oxModelFieldRename(activeTabItemName, active_tab_item_name)
oxModelFieldRename(projectPath, project_path)
oxModelFieldRename(openFiles, open_files)
oxModelFieldRename(showProjectExplorer, show_project_explorer)
oxModelEnd()
OX_MODEL_BEGIN(StudioConfig)
OX_MODEL_FIELD_RENAME(activeTabItemName, active_tab_item_name)
OX_MODEL_FIELD_RENAME(projectPath, project_path)
OX_MODEL_FIELD_RENAME(openFiles, open_files)
OX_MODEL_FIELD_RENAME(showProjectExplorer, show_project_explorer)
OX_MODEL_END()
StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept:
m_sctx(*this, ctx),
@@ -222,7 +222,7 @@ void StudioUI::drawTabs() noexcept {
m_activeEditor = nullptr;
}
try {
oxThrowError(m_editors.erase(it).moveTo(it));
OX_THROW_ERROR(m_editors.erase(it).moveTo(it));
} catch (ox::Exception const&ex) {
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line);
} catch (std::exception const&ex) {
@@ -323,15 +323,15 @@ void StudioUI::handleKeyInput() noexcept {
ox::Error StudioUI::createOpenProject(ox::StringViewCR path) noexcept {
std::error_code ec;
std::filesystem::create_directories(toStdStringView(path), ec);
oxReturnError(OxError(ec.value() != 0, "Could not create project directory"));
oxReturnError(openProjectPath(path));
OX_RETURN_ERROR(ox::Error(ec.value() != 0, "Could not create project directory"));
OX_RETURN_ERROR(openProjectPath(path));
return m_project->writeTypeStore();
}
ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
oxRequireM(fs, keel::loadRomFs(path.view()));
oxReturnError(keel::setRomFs(keelCtx(m_ctx), std::move(fs)));
oxReturnError(
OX_REQUIRE_M(fs, keel::loadRomFs(path.view()));
OX_RETURN_ERROR(keel::setRomFs(keelCtx(m_ctx), std::move(fs)));
OX_RETURN_ERROR(
ox::make_unique_catch<studio::Project>(keelCtx(m_ctx), std::move(path), m_projectDataDir)
.moveTo(m_project));
auto const sctx = applicationData<studio::StudioContext>(m_ctx);
@@ -354,7 +354,7 @@ ox::Error StudioUI::openFile(ox::StringViewCR path) noexcept {
ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool makeActiveTab) noexcept {
if (!m_project) {
return OxError(1, "No project open to open a file from");
return ox::Error(1, "No project open to open a file from");
}
if (m_openFiles.contains(path)) {
for (auto &e : m_editors) {
@@ -366,7 +366,7 @@ ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool makeActiveTab)
}
return {};
}
oxRequire(ext, studio::fileExt(path));
OX_REQUIRE(ext, studio::fileExt(path));
// create Editor
BaseEditor *editor = nullptr;
auto const err = m_editorMakers.contains(ext) ?