[nostalgia,olympic] Cleanup
This commit is contained in:
parent
28ebe93b77
commit
96d27eecd1
@ -96,7 +96,7 @@ constexpr void repair(TileSheetV2::SubSheet &ss, int bpp) noexcept {
|
||||
|
||||
constexpr ox::Error repair(TileSheetV2 &ts) noexcept {
|
||||
if (ts.bpp != 4 && ts.bpp != 8) {
|
||||
return OxError(1, "Unable to repair TileSheet");
|
||||
return ox::Error(1, "Unable to repair TileSheet");
|
||||
}
|
||||
repair(ts.subsheet, ts.bpp);
|
||||
return {};
|
||||
@ -166,7 +166,7 @@ constexpr void repair(TileSheetV3::SubSheet &ss, int bpp) noexcept {
|
||||
|
||||
constexpr ox::Error repair(TileSheetV3 &ts) noexcept {
|
||||
if (ts.bpp != 4 && ts.bpp != 8) {
|
||||
return OxError(1, "Unable to repair TileSheet");
|
||||
return ox::Error(1, "Unable to repair TileSheet");
|
||||
}
|
||||
repair(ts.subsheet, ts.bpp);
|
||||
return {};
|
||||
@ -254,7 +254,7 @@ constexpr void repair(TileSheetV4::SubSheet &ss, int bpp) noexcept {
|
||||
|
||||
constexpr ox::Error repair(TileSheetV4 &ts) noexcept {
|
||||
if (ts.bpp != 4 && ts.bpp != 8) {
|
||||
return OxError(1, "Unable to repair TileSheet");
|
||||
return ox::Error(1, "Unable to repair TileSheet");
|
||||
}
|
||||
repair(ts.subsheet, ts.bpp);
|
||||
return {};
|
||||
|
@ -72,7 +72,7 @@ static ox::Error loadTileSheetSet(
|
||||
for (auto const&entry : set.entries) {
|
||||
oxRequire(ts, keel::readObj<CompactTileSheet>(keelCtx(ctx), entry.tilesheet));
|
||||
if (set.bpp != ts->bpp && ts->bpp == 8) {
|
||||
return OxError(1, "cannot load an 8 BPP tilesheet into a 4 BPP CBB");
|
||||
return ox::Error(1, "cannot load an 8 BPP tilesheet into a 4 BPP CBB");
|
||||
}
|
||||
for (auto const&s : entry.sections) {
|
||||
auto const cnt = (static_cast<size_t>(s.tiles) * PixelsPerTile) >> bppMod;
|
||||
|
@ -81,9 +81,9 @@ static class: public keel::Module {
|
||||
[](keel::Context &ctx, ox::Buffer &buff, ox::StringView typeId) -> ox::Result<bool> {
|
||||
if (typeId == ox::ModelTypeId_v<NostalgiaPalette> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV1> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV2> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV3> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV4>) {
|
||||
typeId == ox::ModelTypeId_v<PaletteV2> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV3> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV4>) {
|
||||
oxReturnError(keel::convertBuffToBuff<CompactPalette>(
|
||||
ctx, buff, ox::ClawFormat::Metal).moveTo(buff));
|
||||
return true;
|
||||
|
@ -586,7 +586,7 @@ ox::Error loadBgTileSheet(
|
||||
auto const srcPxIdx = srcTileIdx * PixelsPerTile;
|
||||
auto const dstPxIdx = dstTileIdx * PixelsPerTile;
|
||||
if (dstPxIdx + pxlCnt >= cbbPxls.size()) {
|
||||
return OxError(1, "video mem dst overflow");
|
||||
return ox::Error(1, "video mem dst overflow");
|
||||
}
|
||||
auto const dst = ox::Span{cbbPxls} + dstPxIdx;
|
||||
copyPixels(ts, dst, srcPxIdx, pxlCnt);
|
||||
|
@ -76,7 +76,7 @@ static ox::Error toPngFile(
|
||||
c = color32(color(pal, page, c)) | static_cast<Color32>(0XFF << 24);
|
||||
}
|
||||
constexpr auto fmt = LCT_RGBA;
|
||||
return OxError(static_cast<ox::ErrorCode>(
|
||||
return ox::Error(static_cast<ox::ErrorCode>(
|
||||
lodepng_encode_file(
|
||||
path.c_str(),
|
||||
reinterpret_cast<uint8_t const*>(pixels.data()),
|
||||
|
@ -144,7 +144,7 @@ static ox::Error setPixelCount(ox::Vector<uint8_t> &pixels, int8_t pBpp, std::si
|
||||
sz = cnt;
|
||||
break;
|
||||
default:
|
||||
return OxError(1, "Invalid pBpp used for TileSheet::SubSheet::setPixelCount");
|
||||
return ox::Error(1, "Invalid pBpp used for TileSheet::SubSheet::setPixelCount");
|
||||
}
|
||||
pixels.reserve(sz);
|
||||
pixels.resize(sz);
|
||||
@ -187,7 +187,7 @@ ox::Result<ox::StringView> getNameFor(TileSheet::SubSheet const&ss, SubSheetId p
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return OxError(1, "SubSheet not found");
|
||||
return ox::Error(1, "SubSheet not found");
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +256,7 @@ ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept
|
||||
parent.subsheets.emplace_back(++ts.idIt, "Subsheet 0", parent.columns, parent.rows, ts.bpp);
|
||||
parent.subsheets.emplace_back(++ts.idIt, "Subsheet 1", 1, 1, ts.bpp);
|
||||
}
|
||||
return OxError(0);
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
ox::Error rmSubSheet(
|
||||
@ -345,7 +345,7 @@ static ox::Result<SubSheetId> getIdFor(
|
||||
return getIdFor(ss, pNamePath, pIt + 1);
|
||||
}
|
||||
}
|
||||
return OxError(1, "SubSheet not found");
|
||||
return ox::Error(1, "SubSheet not found");
|
||||
}
|
||||
|
||||
ox::Result<SubSheetId> getIdFor(TileSheet const&ts, ox::StringViewCR path) noexcept {
|
||||
@ -363,7 +363,7 @@ static ox::Result<unsigned> getTileOffset(
|
||||
unsigned pCurrentTotal = 0) noexcept {
|
||||
// pIt == pNamePath.size() - 1 &&
|
||||
if (ss.name != pNamePath[pIt]) {
|
||||
return OxError(2, "Wrong branch");
|
||||
return ox::Error(2, "Wrong branch");
|
||||
}
|
||||
if (pIt == pNamePath.size() - 1) {
|
||||
return pCurrentTotal;
|
||||
@ -376,7 +376,7 @@ static ox::Result<unsigned> getTileOffset(
|
||||
}
|
||||
pCurrentTotal += pixelCnt(sub, pBpp) / PixelsPerTile;
|
||||
}
|
||||
return OxError(1, "SubSheet not found");
|
||||
return ox::Error(1, "SubSheet not found");
|
||||
}
|
||||
|
||||
ox::Result<unsigned> getTileOffset(TileSheet const&ts, ox::StringViewCR pNamePath) noexcept {
|
||||
|
@ -14,7 +14,7 @@ Scene::Scene(SceneStatic const&sceneStatic) noexcept:
|
||||
|
||||
ox::Error Scene::setupDisplay(core::Context &ctx) const noexcept {
|
||||
if (m_sceneStatic.palettes.empty()) {
|
||||
return OxError(1, "Scene has no palettes");
|
||||
return ox::Error(1, "Scene has no palettes");
|
||||
}
|
||||
auto const&palette = m_sceneStatic.palettes[0];
|
||||
oxReturnError(core::loadBgTileSheet(ctx, 0, m_sceneStatic.tilesheet));
|
||||
|
@ -163,7 +163,7 @@ ox::Error run(
|
||||
[[maybe_unused]] ox::StringView projectDataDir,
|
||||
ox::SpanView<char const*> args) noexcept {
|
||||
if (args.size() < 2) {
|
||||
return OxError(1, "Please provide path to project directory or OxFS file.");
|
||||
return ox::Error(1, "Please provide path to project directory or OxFS file.");
|
||||
}
|
||||
auto const path = args[1];
|
||||
oxRequireM(fs, keel::loadRomFs(path));
|
||||
|
@ -155,7 +155,7 @@ class AssetRef: public ox::SignalHandler {
|
||||
private:
|
||||
constexpr ox::Error emitUpdated() const noexcept {
|
||||
updated.emit();
|
||||
return OxError(0);
|
||||
return ox::Error(0);
|
||||
}
|
||||
};
|
||||
|
||||
@ -207,7 +207,7 @@ class AssetManager {
|
||||
ox::Result<AssetRef<T>> getAsset(ox::StringView const assetId) const noexcept {
|
||||
oxRequire(out, m_cache.at(assetId));
|
||||
if (!out || !*out) {
|
||||
return OxError(1, "asset is null");
|
||||
return ox::Error(1, "asset is null");
|
||||
}
|
||||
return AssetRef<T>(out->get());
|
||||
}
|
||||
@ -256,7 +256,7 @@ class AssetManager {
|
||||
auto &am = m_assetTypeManagers[typeId];
|
||||
auto const out = dynamic_cast<AssetTypeManager<T>*>(am.get());
|
||||
if (!out) {
|
||||
return OxError(1, "no AssetTypeManager for type");
|
||||
return ox::Error(1, "no AssetTypeManager for type");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ ox::Result<keel::AssetRef<T>> readObjNoCache(
|
||||
oxRequire(addr, getPreloadAddr(ctx, assetId));
|
||||
return keel::AssetRef<T>(std::bit_cast<T const*>(uintptr_t{addr}));
|
||||
} else {
|
||||
return OxError(1);
|
||||
return ox::Error(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ ox::Result<keel::AssetRef<T>> readObj(
|
||||
oxRequire(addr, getPreloadAddr(ctx, file));
|
||||
return keel::AssetRef<T>(std::bit_cast<T const*>(uintptr_t{addr}));
|
||||
} else {
|
||||
return OxError(1);
|
||||
return ox::Error(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ constexpr bool valid(auto const&) noexcept {
|
||||
}
|
||||
|
||||
constexpr ox::Error repair(auto const&) noexcept {
|
||||
return OxError(1, "No repair function for this type");
|
||||
return ox::Error(1, "No repair function for this type");
|
||||
}
|
||||
|
||||
constexpr ox::Error ensureValid(auto &o) noexcept {
|
||||
|
@ -8,11 +8,11 @@ namespace keel {
|
||||
|
||||
ox::Result<ox::UUID> readUuidHeader(ox::BufferView buff) noexcept {
|
||||
if (buff.size() < K1HdrSz) [[unlikely]] {
|
||||
return OxError(1, "Insufficient data to contain complete Keel header");
|
||||
return ox::Error(1, "Insufficient data to contain complete Keel header");
|
||||
}
|
||||
constexpr ox::StringView k1Hdr = "K1;";
|
||||
if (k1Hdr != ox::StringView(buff.data(), k1Hdr.bytes())) [[unlikely]] {
|
||||
return OxError(2, "No Keel asset header data");
|
||||
return ox::Error(2, "No Keel asset header data");
|
||||
}
|
||||
return ox::UUID::fromString(ox::StringView(&buff[k1Hdr.bytes()], 36));
|
||||
}
|
||||
@ -30,7 +30,7 @@ ox::Result<ox::StringView> readAssetTypeId(ox::BufferView buff) noexcept {
|
||||
const auto err = readUuidHeader(buff).error;
|
||||
const auto offset = err ? 0u : K1HdrSz;
|
||||
if (offset >= buff.size()) [[unlikely]] {
|
||||
return OxError(1, "Buffer too small for expected data");
|
||||
return ox::Error(1, "Buffer too small for expected data");
|
||||
}
|
||||
return ox::readClawTypeId(buff + offset);
|
||||
}
|
||||
@ -40,7 +40,7 @@ ox::Result<AssetHdr> readAssetHeader(ox::BufferView buff) noexcept {
|
||||
const auto err = readUuidHeader(buff).moveTo(out.value.uuid);
|
||||
const auto offset = err ? 0u : K1HdrSz;
|
||||
if (offset >= buff.size()) [[unlikely]] {
|
||||
return OxError(1, "Buffer too small for expected data");
|
||||
return ox::Error(1, "Buffer too small for expected data");
|
||||
}
|
||||
buff += offset;
|
||||
oxReturnError(ox::readClawHeader(buff).moveTo(out.value.clawHdr));
|
||||
|
@ -16,7 +16,7 @@ ox::Result<char*> loadRom(ox::StringViewCR path) noexcept {
|
||||
std::ifstream file(std::string(toStdStringView(path)), std::ios::binary | std::ios::ate);
|
||||
if (!file.good()) {
|
||||
oxErrorf("Could not find ROM file: {}", path);
|
||||
return OxError(1, "Could not find ROM file");
|
||||
return ox::Error(1, "Could not find ROM file");
|
||||
}
|
||||
try {
|
||||
auto const size = file.tellg();
|
||||
@ -26,10 +26,10 @@ ox::Result<char*> loadRom(ox::StringViewCR path) noexcept {
|
||||
return buff;
|
||||
} catch (std::ios_base::failure const&e) {
|
||||
oxErrorf("Could not read ROM file due to file IO failure: {}", e.what());
|
||||
return OxError(2, "Could not read ROM file");
|
||||
return ox::Error(2, "Could not read ROM file");
|
||||
} catch (std::bad_alloc const&e) {
|
||||
oxErrorf("Could not read ROM file due to new failure: {}", e.what());
|
||||
return OxError(2, "Could not allocate memory for ROM file");
|
||||
return ox::Error(2, "Could not allocate memory for ROM file");
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ static ox::Error buildUuidMap(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
|
||||
ox::Error buildUuidMap(Context &ctx) noexcept {
|
||||
if (!ctx.rom) {
|
||||
return OxError(1, "No ROM FS");
|
||||
return ox::Error(1, "No ROM FS");
|
||||
}
|
||||
return buildUuidMap(ctx, "");
|
||||
}
|
||||
@ -79,7 +79,7 @@ ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
oxRequire(out, ctx.pathToUuid.at(path));
|
||||
return *out;
|
||||
#else
|
||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ ox::Result<ox::CStringView> getPath(Context &ctx, ox::FileAddress const&fileAddr
|
||||
oxRequireM(out, ctx.uuidToPath.at(uuid));
|
||||
return ox::CStringView{*out};
|
||||
#else
|
||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||
#endif
|
||||
} else {
|
||||
return ox::CStringView{path};
|
||||
@ -119,7 +119,7 @@ ox::Result<ox::CStringView> getPath(Context &ctx, ox::CStringView fileId) noexce
|
||||
oxRequireM(out, ctx.uuidToPath.at(uuid));
|
||||
return ox::CStringView{*out};
|
||||
#else
|
||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||
#endif
|
||||
} else {
|
||||
return ox::CStringView{fileId};
|
||||
@ -132,7 +132,7 @@ ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringView uuid) noe
|
||||
oxRequireM(out, ctx.uuidToPath.at(uuid));
|
||||
return ox::CStringView(*out);
|
||||
#else
|
||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::StringViewCR uuid) noex
|
||||
oxRequireM(out, ctx.uuidToPath.at(uuid));
|
||||
return ox::CStringView(*out);
|
||||
#else
|
||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::UUID const&uuid) noexce
|
||||
oxRequireM(out, ctx.uuidToPath.at(uuid.toString()));
|
||||
return ox::CStringView(*out);
|
||||
#else
|
||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ ox::Result<char*> loadRom(ox::StringViewCR) noexcept {
|
||||
return current + headerLen;
|
||||
}
|
||||
}
|
||||
return OxError(1);
|
||||
return ox::Error(1);
|
||||
}
|
||||
|
||||
void unloadRom(char*) noexcept {
|
||||
@ -223,7 +223,7 @@ ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::FileAddress const
|
||||
}
|
||||
|
||||
ox::Error reloadAsset(keel::Context&, ox::StringView) noexcept {
|
||||
return OxError(1, "reloadAsset is unsupported on this platform");
|
||||
return ox::Error(1, "reloadAsset is unsupported on this platform");
|
||||
}
|
||||
|
||||
}
|
||||
@ -247,7 +247,7 @@ ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexc
|
||||
#ifdef OX_HAS_PASSTHROUGHFS
|
||||
return {ox::make_unique<ox::PassThroughFS>(path)};
|
||||
#else
|
||||
return OxError(2);
|
||||
return ox::Error(2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ static ox::Error writeFileBuff(ox::StringView path, ox::BufferView const buff) n
|
||||
std::ofstream f(std::string(toStdStringView(path)), std::ios::binary);
|
||||
f.write(buff.data(), static_cast<intptr_t>(buff.size()));
|
||||
} catch (std::fstream::failure const&) {
|
||||
return OxError(2, "failed to write file");
|
||||
return ox::Error(2, "failed to write file");
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@ -26,7 +26,7 @@ static ox::Result<ox::Buffer> readFileBuff(ox::StringView path) noexcept {
|
||||
std::ifstream file(std::string(toStdStringView(path)), std::ios::binary | std::ios::ate);
|
||||
if (!file.good()) {
|
||||
oxErrorf("Could not find OxFS file: {}", path);
|
||||
return OxError(1, "Could not find OxFS file");
|
||||
return ox::Error(1, "Could not find OxFS file");
|
||||
}
|
||||
try {
|
||||
auto const size = static_cast<std::size_t>(file.tellg());
|
||||
@ -36,7 +36,7 @@ static ox::Result<ox::Buffer> readFileBuff(ox::StringView path) noexcept {
|
||||
return buff;
|
||||
} catch (std::ios_base::failure const&e) {
|
||||
oxErrorf("Could not read OxFS file: {}", e.what());
|
||||
return OxError(2, "Could not read OxFS file");
|
||||
return ox::Error(2, "Could not read OxFS file");
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +88,11 @@ static ox::Error run(ox::SpanView<char const*> argv, ox::StringView projectDataD
|
||||
auto const argManifest = args.getString("manifest", "");
|
||||
if (argSrc == "") {
|
||||
oxErr("\033[31;1;1merror:\033[0m must specify a source directory\n");
|
||||
return OxError(1, "must specify a source directory");
|
||||
return ox::Error(1, "must specify a source directory");
|
||||
}
|
||||
if (argRomBin == "") {
|
||||
oxErr("\033[31;1;1merror:\033[0m must specify a path for ROM file\n");
|
||||
return OxError(1, "must specify a path for preload file");
|
||||
return ox::Error(1, "must specify a path for preload file");
|
||||
}
|
||||
return pack(argSrc, argRomBin, argManifest, projectDataDir);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ static ox::Result<BaseConverter const*> findConverter(
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return OxError(1, "Could not find converter");
|
||||
return ox::Error(1, "Could not find converter");
|
||||
};
|
||||
|
||||
static ox::Result<ox::UPtr<Wrap>> convert(
|
||||
@ -47,7 +47,7 @@ static ox::Result<ox::UPtr<Wrap>> convert(
|
||||
return subConverter->convertPtrToPtr(ctx, *intermediate);
|
||||
}
|
||||
}
|
||||
return OxError(1, "Could not convert between types");
|
||||
return ox::Error(1, "Could not convert between types");
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<Wrap>> convert(
|
||||
|
@ -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);
|
||||
|
@ -54,7 +54,7 @@ void ProjectExplorer::setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept {
|
||||
ox::Error ProjectExplorer::refreshProjectTreeModel(ox::StringViewCR) noexcept {
|
||||
oxRequireM(model, buildProjectTreeModel(*this, "Project", "/", nullptr));
|
||||
setModel(std::move(model));
|
||||
return OxError(0);
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ 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(ox::Error(ec.value() != 0, "Could not create project directory"));
|
||||
oxReturnError(openProjectPath(path));
|
||||
return m_project->writeTypeStore();
|
||||
}
|
||||
@ -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) {
|
||||
|
@ -64,7 +64,7 @@ ox::Error writeConfig(keel::Context &ctx, ox::StringViewCR name, T const&data) n
|
||||
*buff.back().value = '\n';
|
||||
if (auto const err = fs.write(path, buff.data(), buff.size())) {
|
||||
//oxErrf("Could not read config file: {} - {}\n", path, toStr(err));
|
||||
return OxError(2, "Could not read config file");
|
||||
return ox::Error(2, "Could not read config file");
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ template<typename T>
|
||||
ox::Result<T> getDragDropPayload(ox::CStringView name) noexcept {
|
||||
auto const payload = ImGui::AcceptDragDropPayload(name.c_str());
|
||||
if (!payload) {
|
||||
return OxError(1, "No drag/drop payload");
|
||||
return ox::Error(1, "No drag/drop payload");
|
||||
}
|
||||
return ox::readClaw<T>({
|
||||
reinterpret_cast<char const*>(payload->Data),
|
||||
|
@ -31,7 +31,7 @@ enum class ProjectEvent {
|
||||
constexpr ox::Result<ox::StringView> fileExt(ox::StringViewCR path) noexcept {
|
||||
auto const extStart = ox::find(path.crbegin(), path.crend(), '.').offset();
|
||||
if (!extStart) {
|
||||
return OxError(1, "file path does not have valid extension");
|
||||
return ox::Error(1, "file path does not have valid extension");
|
||||
}
|
||||
return substr(path, extStart + 1);
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return out;
|
||||
}
|
||||
case NFD_CANCEL:
|
||||
return OxError(1, "Operation cancelled");
|
||||
return ox::Error(1, "Operation cancelled");
|
||||
default:
|
||||
return OxError(2, NFD::GetError());
|
||||
return ox::Error(2, NFD::GetError());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ Project::Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDa
|
||||
ox::Error Project::create() noexcept {
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directory(m_path.toStdString(), ec);
|
||||
return OxError(static_cast<ox::ErrorCode>(ec.value()), "PassThroughFS: mkdir failed");
|
||||
return ox::Error(static_cast<ox::ErrorCode>(ec.value()), "PassThroughFS: mkdir failed");
|
||||
}
|
||||
|
||||
ox::String const&Project::projectPath() const noexcept {
|
||||
@ -62,7 +62,7 @@ ox::Error Project::mkdir(ox::StringViewCR path) const noexcept {
|
||||
fileUpdated.emit(path, {});
|
||||
}
|
||||
return stat.fileType == ox::FileType::Directory ?
|
||||
ox::Error{} : OxError(1, "path exists as normal file");
|
||||
ox::Error{} : ox::Error(1, "path exists as normal file");
|
||||
}
|
||||
|
||||
ox::Result<ox::FileStat> Project::stat(ox::StringViewCR path) const noexcept {
|
||||
|
@ -44,7 +44,7 @@ ox::Bounds getWindowBounds(Context&) noexcept {
|
||||
}
|
||||
|
||||
ox::Error setWindowBounds(Context&, ox::Bounds const&) noexcept {
|
||||
return OxError(1, "setWindowBounds not supported on GBA");
|
||||
return ox::Error(1, "setWindowBounds not supported on GBA");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
}
|
||||
}
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return OxError(1);
|
||||
return ox::Error(1);
|
||||
}
|
||||
|
||||
ox::Result<ContextUPtr> init(
|
||||
|
@ -30,7 +30,7 @@ ox::Result<BaseClipboardObject*> getClipboardData(Context &ctx, ox::StringView t
|
||||
if (ctx.clipboard && ctx.clipboard->typeId() == typeId) {
|
||||
return ctx.clipboard.get();
|
||||
}
|
||||
return OxError(1);
|
||||
return ox::Error(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ ox::Error initGfx(Context &ctx) noexcept {
|
||||
ctx.window = glfwCreateWindow(240 * Scale, 160 * Scale, ctx.keelCtx.appName.c_str(), nullptr, nullptr);
|
||||
//ctx.window = glfwCreateWindow(876, 743, ctx.keelCtx.appName.c_str(), nullptr, nullptr);
|
||||
if (ctx.window == nullptr) {
|
||||
return OxError(1, "Could not open GLFW window");
|
||||
return ox::Error(1, "Could not open GLFW window");
|
||||
}
|
||||
glfwSetCursorPosCallback(ctx.window, handleGlfwCursorPosEvent);
|
||||
glfwSetMouseButtonCallback(ctx.window, handleGlfwMouseButtonEvent);
|
||||
@ -212,7 +212,7 @@ ox::Error initGfx(Context &ctx) noexcept {
|
||||
glfwSetWindowUserPointer(ctx.window, &ctx);
|
||||
glfwMakeContextCurrent(ctx.window);
|
||||
if (!gladLoadGLES2Loader(reinterpret_cast<GLADloadproc>(glfwGetProcAddress))) {
|
||||
return OxError(2, "Could not init Glad");
|
||||
return ox::Error(2, "Could not init Glad");
|
||||
}
|
||||
#if TURBINE_USE_IMGUI
|
||||
IMGUI_CHECKVERSION();
|
||||
|
Loading…
Reference in New Issue
Block a user