Compare commits
1 Commits
master
..
59dbfe0db1
| Author | SHA1 | Date | |
|---|---|---|---|
| 59dbfe0db1 |
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.19)
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19
|
set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19
|
||||||
|
|
||||||
if(BUILDCORE_TARGET STREQUAL "gba")
|
if(BUILDCORE_TARGET STREQUAL "gba")
|
||||||
@@ -52,7 +52,7 @@ if(NOT BUILDCORE_TARGET STREQUAL "gba")
|
|||||||
set(GLFW_BUILD_TESTS OFF)
|
set(GLFW_BUILD_TESTS OFF)
|
||||||
set(GLFW_BUILD_DOCS OFF)
|
set(GLFW_BUILD_DOCS OFF)
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
set(GLFW_BUILD_WAYLAND ON)
|
set(GLFW_BUILD_WAYLAND OFF)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(deps/glfw)
|
add_subdirectory(deps/glfw)
|
||||||
add_subdirectory(deps/glutils)
|
add_subdirectory(deps/glutils)
|
||||||
|
|||||||
+2
-1
@@ -129,7 +129,8 @@ Error writeClaw(
|
|||||||
if (fmt == ClawFormat::Metal) {
|
if (fmt == ClawFormat::Metal) {
|
||||||
OX_RETURN_ERROR(writeMC(writer, obj));
|
OX_RETURN_ERROR(writeMC(writer, obj));
|
||||||
} else if (fmt == ClawFormat::Organic) {
|
} else if (fmt == ClawFormat::Organic) {
|
||||||
OX_RETURN_ERROR(writeOC(writer, obj));
|
OX_REQUIRE(data, writeOC(obj));
|
||||||
|
OX_RETURN_ERROR(writer.write(data.data(), data.size()));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (fmt != ClawFormat::Metal) {
|
if (fmt != ClawFormat::Metal) {
|
||||||
|
|||||||
+2
-13
@@ -28,7 +28,6 @@ namespace ox {
|
|||||||
|
|
||||||
class OrganicClawWriter {
|
class OrganicClawWriter {
|
||||||
|
|
||||||
friend Error writeOC(Writer_c auto &writer, auto const &val) noexcept;
|
|
||||||
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
||||||
friend Result<String> writeOCString(const auto &val) noexcept;
|
friend Result<String> writeOCString(const auto &val) noexcept;
|
||||||
|
|
||||||
@@ -255,19 +254,9 @@ Error OrganicClawWriter::field(CString key, UnionView<U, force> val) noexcept {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Error writeOC(Writer_c auto &writer, auto const &val) noexcept {
|
|
||||||
OrganicClawWriter ocWriter;
|
|
||||||
ModelHandlerInterface handler(ocWriter);
|
|
||||||
OX_RETURN_ERROR(model(&handler, &val));
|
|
||||||
Json::StreamWriterBuilder const jsonBuilder;
|
|
||||||
auto const str = Json::writeString(jsonBuilder, ocWriter.m_json);
|
|
||||||
OX_RETURN_ERROR(writer.write(str.data(), str.size()));
|
|
||||||
return writer.put('\0');
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<Buffer> writeOC(auto const &val) noexcept {
|
Result<Buffer> writeOC(auto const &val) noexcept {
|
||||||
OrganicClawWriter writer;
|
OrganicClawWriter writer;
|
||||||
ModelHandlerInterface handler(writer);
|
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler(writer);
|
||||||
OX_RETURN_ERROR(model(&handler, &val));
|
OX_RETURN_ERROR(model(&handler, &val));
|
||||||
Json::StreamWriterBuilder const jsonBuilder;
|
Json::StreamWriterBuilder const jsonBuilder;
|
||||||
auto const str = Json::writeString(jsonBuilder, writer.m_json);
|
auto const str = Json::writeString(jsonBuilder, writer.m_json);
|
||||||
@@ -281,7 +270,7 @@ Result<Buffer> writeOC(auto const &val) noexcept {
|
|||||||
|
|
||||||
Result<String> writeOCString(auto const &val) noexcept {
|
Result<String> writeOCString(auto const &val) noexcept {
|
||||||
OrganicClawWriter writer;
|
OrganicClawWriter writer;
|
||||||
ModelHandlerInterface handler(writer);
|
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler(writer);
|
||||||
OX_RETURN_ERROR(model(&handler, &val));
|
OX_RETURN_ERROR(model(&handler, &val));
|
||||||
Json::StreamWriterBuilder const jsonBuilder;
|
Json::StreamWriterBuilder const jsonBuilder;
|
||||||
auto const str = Json::writeString(jsonBuilder, writer.m_json);
|
auto const str = Json::writeString(jsonBuilder, writer.m_json);
|
||||||
|
|||||||
+1
-1
@@ -352,7 +352,7 @@ struct [[nodiscard]] Result {
|
|||||||
if (error) {
|
if (error) {
|
||||||
return {std::move(value), Error{pErrCode, pMsg, pSrc}};
|
return {std::move(value), Error{pErrCode, pMsg, pSrc}};
|
||||||
}
|
}
|
||||||
return {std::move(value)};
|
return Error{};
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Result reoriginate(
|
constexpr Result reoriginate(
|
||||||
|
|||||||
+2
-2
@@ -38,11 +38,11 @@ constexpr StringView substr(StringViewCR str, std::size_t const start, std::size
|
|||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr char toUpper(char const c) noexcept {
|
constexpr char toUpper(char const c) noexcept {
|
||||||
return c & static_cast<char>(0b1101'1111);
|
return c & 0b1101'1111;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr int caseInsensitiveStrCmp(StringViewCR a, StringViewCR b) noexcept {
|
constexpr int caseInsensitiveEquals(ox::StringViewCR a, ox::StringViewCR b) noexcept {
|
||||||
auto const sz = ox::min(a.size(), b.size());
|
auto const sz = ox::min(a.size(), b.size());
|
||||||
for (size_t i{}; i < sz; ++i) {
|
for (size_t i{}; i < sz; ++i) {
|
||||||
auto const ac = toUpper(a[i]);
|
auto const ac = toUpper(a[i]);
|
||||||
|
|||||||
@@ -54,10 +54,6 @@ struct VectorAllocator {
|
|||||||
// this totally idiotic redundant check (&& count <= Size) is required to address a bug in devkitARM,
|
// this totally idiotic redundant check (&& count <= Size) is required to address a bug in devkitARM,
|
||||||
// try removing it later
|
// try removing it later
|
||||||
if (!std::is_constant_evaluated()) {
|
if (!std::is_constant_evaluated()) {
|
||||||
#if defined(__GNUC__) && !defined(__clang__)
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-overflow="
|
|
||||||
#endif
|
|
||||||
if (cap <= m_data.size() && count <= m_data.size()) {
|
if (cap <= m_data.size() && count <= m_data.size()) {
|
||||||
for (auto i = 0u; i < count; ++i) {
|
for (auto i = 0u; i < count; ++i) {
|
||||||
auto const srcItem = std::launder(reinterpret_cast<T*>(&src->m_data[i]));
|
auto const srcItem = std::launder(reinterpret_cast<T*>(&src->m_data[i]));
|
||||||
@@ -69,9 +65,6 @@ struct VectorAllocator {
|
|||||||
*items = reinterpret_cast<T*>(m_data.data());
|
*items = reinterpret_cast<T*>(m_data.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(__GNUC__) && !defined(__clang__)
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
|
#include <studio/context.hpp>
|
||||||
|
|
||||||
#include "clawviewer.hpp"
|
#include "clawviewer.hpp"
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ static ox::Error convertFile(
|
|||||||
OX_REQUIRE(uuid, keel::readUuidHeader(buff));
|
OX_REQUIRE(uuid, keel::readUuidHeader(buff));
|
||||||
OX_REQUIRE(obj, keel::readAsset(ts, buff).reoriginate(1, "unable to parse file"));
|
OX_REQUIRE(obj, keel::readAsset(ts, buff).reoriginate(1, "unable to parse file"));
|
||||||
buff.clear();
|
buff.clear();
|
||||||
ox::BufferWriter writer{&buff};
|
ox::BufferWriter wrtr{&buff};
|
||||||
OX_RETURN_ERROR(keel::writeUuidHeader(writer, uuid));
|
OX_RETURN_ERROR(keel::writeUuidHeader(wrtr, uuid));
|
||||||
OX_RETURN_ERROR(ox::writeClaw(obj, writer, fmt));
|
OX_RETURN_ERROR(ox::writeClaw(obj, wrtr, fmt));
|
||||||
if (fmt == ox::ClawFormat::Organic) {
|
if (fmt == ox::ClawFormat::Organic) {
|
||||||
*buff.back().value = '\n';
|
*buff.back().value = '\n';
|
||||||
}
|
}
|
||||||
|
OX_RETURN_ERROR(wrtr.write(buff.data(), buff.size()));
|
||||||
OX_RETURN_ERROR(fs.write(path, buff).reoriginate(1, "unable to write file"));
|
OX_RETURN_ERROR(fs.write(path, buff).reoriginate(1, "unable to write file"));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -36,9 +37,9 @@ static void printUsage() noexcept {
|
|||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static constexpr ox::Result<ox::ClawFormat> getFmt(ox::StringViewCR fmtStr) noexcept {
|
static constexpr ox::Result<ox::ClawFormat> getFmt(ox::StringViewCR fmtStr) noexcept {
|
||||||
if (caseInsensitiveStrCmp(fmtStr, "mc") == 0) {
|
if (caseInsensitiveEquals(fmtStr, "mc") == 0) {
|
||||||
return ox::ClawFormat::Metal;
|
return ox::ClawFormat::Metal;
|
||||||
} else if (caseInsensitiveStrCmp(fmtStr, "oc") == 0) {
|
} else if (caseInsensitiveEquals(fmtStr, "oc") == 0) {
|
||||||
return ox::ClawFormat::Organic;
|
return ox::ClawFormat::Organic;
|
||||||
}
|
}
|
||||||
return ox::Error{1, "invalid format"};
|
return ox::Error{1, "invalid format"};
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <studio/project.hpp>
|
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
ox::Error cmdChangeFormat(Project &project, ox::SpanView<ox::CString> args) noexcept;
|
ox::Error cmdChangeFormat(Project &project, ox::SpanView<ox::CString> args) noexcept;
|
||||||
|
|||||||
Reference in New Issue
Block a user