[olympic,nostalgia] Update Result copyTo and moveTo calls to take refs

This commit is contained in:
Gary Talent 2023-12-14 22:26:55 -06:00
parent d31938ba4f
commit cdc7428eb6
12 changed files with 17 additions and 17 deletions

View File

@ -60,7 +60,7 @@ class KeelModule: public keel::Module {
typeId == ox::buildTypeId<TileSheetV2>() || typeId == ox::buildTypeId<TileSheetV2>() ||
typeId == ox::buildTypeId<TileSheet>()) { typeId == ox::buildTypeId<TileSheet>()) {
oxReturnError(keel::convertBuffToBuff<core::CompactTileSheet>( oxReturnError(keel::convertBuffToBuff<core::CompactTileSheet>(
ctx, buff, ox::ClawFormat::Metal).moveTo(&buff)); ctx, buff, ox::ClawFormat::Metal).moveTo(buff));
} }
return {}; return {};
}, },

View File

@ -364,9 +364,9 @@ ox::Error initGfx(
const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion); const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion);
const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion); const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion);
const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, gl::GlslVersion); const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, gl::GlslVersion);
oxReturnError(glutils::buildShaderProgram(bgVshad, bgFshad).moveTo(&ctx.bgShader)); oxReturnError(glutils::buildShaderProgram(bgVshad, bgFshad).moveTo(ctx.bgShader));
oxReturnError( oxReturnError(
glutils::buildShaderProgram(spriteVshad, spriteFshad).moveTo(&ctx.spriteShader)); glutils::buildShaderProgram(spriteVshad, spriteFshad).moveTo(ctx.spriteShader));
for (auto &bg : ctx.cbbs) { for (auto &bg : ctx.cbbs) {
initBackgroundBufferset(ctx.bgShader, bg); initBackgroundBufferset(ctx.bgShader, bg);
} }

View File

@ -217,7 +217,7 @@ ox::Error TileSheetEditorModel::markUpdatedCmdId(const studio::UndoCommand *cmd)
m_updated = true; m_updated = true;
const auto cmdId = cmd->commandId(); const auto cmdId = cmd->commandId();
if (static_cast<CommandId>(cmdId) == CommandId::PaletteChange) { if (static_cast<CommandId>(cmdId) == CommandId::PaletteChange) {
oxReturnError(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).moveTo(&m_pal)); oxReturnError(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).moveTo(m_pal));
paletteChanged.emit(); paletteChanged.emit();
} }
auto tsCmd = dynamic_cast<const TileSheetCommand*>(cmd); auto tsCmd = dynamic_cast<const TileSheetCommand*>(cmd);

View File

@ -18,7 +18,7 @@ ox::Error TileSheetGrid::buildShader() noexcept {
const auto pixelLineVshad = ox::sfmt(VShad, gl::GlslVersion); const auto pixelLineVshad = ox::sfmt(VShad, gl::GlslVersion);
const auto pixelLineFshad = ox::sfmt(FShad, gl::GlslVersion); const auto pixelLineFshad = ox::sfmt(FShad, gl::GlslVersion);
const auto pixelLineGshad = ox::sfmt(GShad, gl::GlslVersion); const auto pixelLineGshad = ox::sfmt(GShad, gl::GlslVersion);
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader); return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(m_shader);
} }
void TileSheetGrid::draw(bool update, ox::Vec2 const&scroll) noexcept { void TileSheetGrid::draw(bool update, ox::Vec2 const&scroll) noexcept {

View File

@ -19,7 +19,7 @@ void TileSheetPixels::setPixelSizeMod(float sm) noexcept {
ox::Error TileSheetPixels::buildShader() noexcept { ox::Error TileSheetPixels::buildShader() noexcept {
const auto Vshad = ox::sfmt(VShad, gl::GlslVersion); const auto Vshad = ox::sfmt(VShad, gl::GlslVersion);
const auto Fshad = ox::sfmt(FShad, gl::GlslVersion); const auto Fshad = ox::sfmt(FShad, gl::GlslVersion);
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader); return glutils::buildShaderProgram(Vshad, Fshad).moveTo(m_shader);
} }
void TileSheetPixels::draw(bool update, ox::Vec2 const&scroll) noexcept { void TileSheetPixels::draw(bool update, ox::Vec2 const&scroll) noexcept {

View File

@ -67,7 +67,7 @@ ox::Result<keel::AssetRef<T>> readObjFile(
if (err) { if (err) {
oxRequire(buff, ctx.rom->read(path)); oxRequire(buff, ctx.rom->read(path));
oxRequire(obj, readConvert(ctx, buff)); oxRequire(obj, readConvert(ctx, buff));
oxReturnError(ctx.assetManager.setAsset(assetId, obj).moveTo(&cached)); oxReturnError(ctx.assetManager.setAsset(assetId, obj).moveTo(cached));
} }
return cached; return cached;
} }

View File

@ -98,10 +98,10 @@ ox::Error preloadObj(
oxReturnError(pl.endAlloc()); oxReturnError(pl.endAlloc());
oxReturnError(err); oxReturnError(err);
const keel::PreloadPtr p{.preloadAddr = static_cast<uint32_t>(a)}; const keel::PreloadPtr p{.preloadAddr = static_cast<uint32_t>(a)};
oxReturnError(ox::writeMC(p).moveTo(&buff)); oxReturnError(ox::writeMC(p).moveTo(buff));
} else { } else {
// strip the Claw header (it is not needed after preloading) and write back out to dest fs // strip the Claw header (it is not needed after preloading) and write back out to dest fs
oxReturnError(ox::writeMC(obj).moveTo(&buff)); oxReturnError(ox::writeMC(obj).moveTo(buff));
} }
oxReturnError(romFs.write(path, buff.data(), buff.size())); oxReturnError(romFs.write(path, buff.data(), buff.size()));
return {}; return {};

View File

@ -183,7 +183,7 @@ auto transformRule(keel::Context &ctx, ox::Buffer &buff) noexcept -> ox::Error {
const auto typeId = ox::buildTypeId( const auto typeId = ox::buildTypeId(
hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, hdr.clawHdr.typeParams); hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, hdr.clawHdr.typeParams);
if (typeId == ox::buildTypeId<From>()) { if (typeId == ox::buildTypeId<From>()) {
oxReturnError(keel::convertBuffToBuff<To>(ctx, buff, fmt).moveTo(&buff)); oxReturnError(keel::convertBuffToBuff<To>(ctx, buff, fmt).moveTo(buff));
} }
return {}; return {};
}; };

View File

@ -31,11 +31,11 @@ ox::Result<ox::ModelObject> readAsset(ox::TypeStore *ts, ox::Buffer const&buff)
ox::Result<AssetHdr> readAssetHeader(const char *buff, std::size_t buffLen) noexcept { ox::Result<AssetHdr> readAssetHeader(const char *buff, std::size_t buffLen) noexcept {
AssetHdr out; AssetHdr out;
const auto err = readUuidHeader(buff, buffLen).moveTo(&out.uuid); const auto err = readUuidHeader(buff, buffLen).moveTo(out.uuid);
const auto offset = err ? 0u : K1HdrSz; const auto offset = err ? 0u : K1HdrSz;
buff = buff + offset; buff = buff + offset;
buffLen = buffLen - offset; buffLen = buffLen - offset;
oxReturnError(ox::readClawHeader(buff, buffLen).moveTo(&out.clawHdr)); oxReturnError(ox::readClawHeader(buff, buffLen).moveTo(out.clawHdr));
return out; return out;
} }

View File

@ -30,7 +30,7 @@ static ox::Error pathToInode(
} }
if (beginsWith(path, "uuid://")) { if (beginsWith(path, "uuid://")) {
const auto uuid = substr<ox::StringView>(path, 7); const auto uuid = substr<ox::StringView>(path, 7);
oxReturnError(keel::uuidToPath(ctx, uuid).moveTo(&path)); oxReturnError(keel::uuidToPath(ctx, uuid).moveTo(path));
} }
oxRequire(s, dest.stat(path)); oxRequire(s, dest.stat(path));
oxReturnError(o["type"].set(static_cast<int8_t>(ox::FileAddressType::Inode))); oxReturnError(o["type"].set(static_cast<int8_t>(ox::FileAddressType::Inode)));
@ -97,7 +97,7 @@ static ox::Error doTransformations(
// transform FileAddresses // transform FileAddresses
oxRequireM(obj, keel::readAsset(&ts, buff)); oxRequireM(obj, keel::readAsset(&ts, buff));
oxReturnError(transformFileAddressesObj(ctx, dest, obj)); oxReturnError(transformFileAddressesObj(ctx, dest, obj));
oxReturnError(ox::writeClaw(obj).moveTo(&buff)); oxReturnError(ox::writeClaw(obj).moveTo(buff));
// write file to dest // write file to dest
oxReturnError(dest.write(s.inode, buff)); oxReturnError(dest.write(s.inode, buff));
return {}; return {};

View File

@ -257,7 +257,7 @@ void StudioUI::drawTabs() noexcept {
m_activeEditor = nullptr; m_activeEditor = nullptr;
} }
try { try {
oxThrowError(m_editors.erase(it).moveTo(&it)); oxThrowError(m_editors.erase(it).moveTo(it));
} catch (const ox::Exception &ex) { } catch (const ox::Exception &ex) {
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line); oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line);
} catch (const std::exception &ex) { } catch (const std::exception &ex) {
@ -363,7 +363,7 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab)
} }
editor = ox::make<ClawEditor>(path, std::move(obj)); editor = ox::make<ClawEditor>(path, std::move(obj));
} else { } else {
const auto err = m_editorMakers[ext](path).moveTo(&editor); const auto err = m_editorMakers[ext](path).moveTo(editor);
if (err) { if (err) {
if constexpr(!ox::defines::Debug) { if constexpr(!ox::defines::Debug) {
oxErrf("Could not open Editor: {}\n", toStr(err)); oxErrf("Could not open Editor: {}\n", toStr(err));

View File

@ -60,7 +60,7 @@ ox::Result<ContextUPtr> init(
auto ctx = ox::make_unique<Context>(); auto ctx = ox::make_unique<Context>();
oxReturnError(keel::init(ctx->keelCtx, std::move(fs), appName)); oxReturnError(keel::init(ctx->keelCtx, std::move(fs), appName));
#ifdef OX_BARE_METAL #ifdef OX_BARE_METAL
oxReturnError(findPreloadSection().moveTo(&ctx->keelCtx.preloadSectionOffset)); oxReturnError(findPreloadSection().moveTo(ctx->keelCtx.preloadSectionOffset));
#endif #endif
oxReturnError(initGfx(*ctx)); oxReturnError(initGfx(*ctx));
initTimer(); initTimer();