From b1b2780eb9dba423482bf7370af8f5cc8a5d68cd Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 3 Feb 2023 21:56:30 -0600 Subject: [PATCH] [ox] GBA fixes --- deps/ox/src/ox/claw/test/tests.cpp | 2 +- deps/ox/src/ox/claw/write.hpp | 7 +++++++ deps/ox/src/ox/mc/write.hpp | 2 +- deps/ox/src/ox/model/desctypes.hpp | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/deps/ox/src/ox/claw/test/tests.cpp b/deps/ox/src/ox/claw/test/tests.cpp index e8909f2e..a3739140 100644 --- a/deps/ox/src/ox/claw/test/tests.cpp +++ b/deps/ox/src/ox/claw/test/tests.cpp @@ -8,7 +8,7 @@ #undef NDEBUG -#include +#include #include #include #include diff --git a/deps/ox/src/ox/claw/write.hpp b/deps/ox/src/ox/claw/write.hpp index b476ecbd..85eab300 100644 --- a/deps/ox/src/ox/claw/write.hpp +++ b/deps/ox/src/ox/claw/write.hpp @@ -93,7 +93,14 @@ Result writeClawHeader(T *t, ClawFormat fmt) noexcept { Result writeClaw(auto *t, ClawFormat fmt = ClawFormat::Metal) { oxRequire(header, detail::writeClawHeader(t, fmt)); +#ifdef OX_USE_STDLIB oxRequire(data, fmt == ClawFormat::Metal ? writeMC(t) : writeOC(t)); +#else + if (fmt != ClawFormat::Metal) { + return OxError(1, "OC is not supported in this build"); + } + oxRequire(data, writeMC(t)); +#endif Buffer out(header.len() + data.size()); memcpy(out.data(), header.data(), header.len()); memcpy(out.data() + header.len(), data.data(), data.size()); diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index baa0314f..d384e7e6 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -342,7 +342,7 @@ constexpr Error MetalClawWriter::field(const char*, T *val, std::size_t len) noe MetalClawWriter writer(m_buff + m_buffIt, m_buffLen - m_buffIt); ModelHandlerInterface handler{&writer}; - handler.setTypeInfo("List", 0, {}, len); + handler.setTypeInfo("List", 0, {}, static_cast(len)); // write the array for (std::size_t i = 0; i < len; i++) { diff --git a/deps/ox/src/ox/model/desctypes.hpp b/deps/ox/src/ox/model/desctypes.hpp index 033059ee..67bbfa45 100644 --- a/deps/ox/src/ox/model/desctypes.hpp +++ b/deps/ox/src/ox/model/desctypes.hpp @@ -19,6 +19,7 @@ #include "optype.hpp" #include "types.hpp" +#include "typenamecatcher.hpp" namespace ox { @@ -26,6 +27,13 @@ using FieldName = String; using TypeParamPack = Vector; +template +constexpr auto buildTypeId() noexcept { + constexpr auto name = requireModelTypeName(); + constexpr auto version = requireModelTypeVersion(); + return ox::sfmt("{};{}", name, version); +} + static constexpr auto buildTypeId(CRStringView name, int version, const TypeParamPack &typeParams = {}) noexcept { String tp;