diff --git a/deps/nostalgia/CMakeLists.txt b/deps/nostalgia/CMakeLists.txt index 289ffb0..acd9885 100644 --- a/deps/nostalgia/CMakeLists.txt +++ b/deps/nostalgia/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.25) set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19 if(BUILDCORE_TARGET STREQUAL "gba") @@ -9,7 +9,7 @@ else() project(nostalgia C CXX) endif() -include(deps/buildcore/base.cmake) +include(deps/oxlib/deps/buildcore/base.cmake) set(OX_ENABLE_TRACEHOOK OFF CACHE BOOL "Generate OxTraceHook shared library for uprobes") @@ -35,10 +35,7 @@ else() set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) endif() -add_subdirectory(deps/ox) -include_directories( - deps/ox/src -) +add_subdirectory(deps/oxlib) add_subdirectory(deps/teagba) if(NOT BUILDCORE_TARGET STREQUAL "gba") @@ -55,7 +52,7 @@ if(NOT BUILDCORE_TARGET STREQUAL "gba") set(GLFW_BUILD_TESTS OFF) set(GLFW_BUILD_DOCS OFF) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(GLFW_BUILD_WAYLAND OFF) + set(GLFW_BUILD_WAYLAND ON) endif() add_subdirectory(deps/glfw) add_subdirectory(deps/glutils) diff --git a/deps/nostalgia/Makefile b/deps/nostalgia/Makefile index aee7394..b89d583 100644 --- a/deps/nostalgia/Makefile +++ b/deps/nostalgia/Makefile @@ -1,7 +1,7 @@ BC_VAR_PROJECT_NAME=nostalgia BC_VAR_PROJECT_NAME_CAP=Nostalgia BC_VAR_DEVENV_ROOT=util -BUILDCORE_PATH=deps/buildcore +BUILDCORE_PATH=deps/oxlib/deps/buildcore include ${BUILDCORE_PATH}/base.mk ifeq ($(BC_VAR_OS),darwin) @@ -13,6 +13,19 @@ else endif PROJECT_PLAYER=./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME_CAP} +.PHONY: git-setup-ox-remote +git-setup-ox-remote: + git remote add -f ox-master git@git.drinkingtea.net:drinkingtea/ox.git + +.PHONY: git-pull-ox +git-pull-ox: + git fetch ox-master master + git subtree pull --prefix deps/oxlib ox-master master --squash + +.PHONY: git-push-ox +git-push-ox: + git subtree push --prefix=deps/oxlib ox-master master + .PHONY: pkg-gba pkg-gba: build-pack build-gba-player ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME_CAP} diff --git a/deps/nostalgia/deps/ox/.gdblogger.json b/deps/nostalgia/deps/ox/.gdblogger.json deleted file mode 100644 index 5ef494d..0000000 --- a/deps/nostalgia/deps/ox/.gdblogger.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "log_functions": [ - { - "function": "ox::trace::gdblogger::captureLogFunc", - "ignore_frames": 3, - "file_var": "file", - "line_var": "line", - "channel_var": "ch", - "msg_var": "msg" - } - ] -} diff --git a/deps/nostalgia/deps/ox/.travis.yml b/deps/nostalgia/deps/ox/.travis.yml deleted file mode 100644 index 3c7d22c..0000000 --- a/deps/nostalgia/deps/ox/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: cpp -sudo: false -dist: trusty -compiler: - - clang - - gcc -addons: - apt: - packages: - - cmake -script: ./scripts/cibuild diff --git a/deps/nostalgia/deps/ox/Makefile b/deps/nostalgia/deps/ox/Makefile deleted file mode 100644 index 53393fc..0000000 --- a/deps/nostalgia/deps/ox/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -OS=$(shell uname | tr [:upper:] [:lower:]) -HOST_ENV=${OS}-$(shell uname -m) -DEVENV=devenv$(shell pwd | sed 's/\//-/g') -DEVENV_IMAGE=wombatant/devenv -ifneq ($(shell which docker 2>&1),) - ifeq ($(shell docker inspect --format="{{.State.Status}}" ${DEVENV} 2>&1),running) - ENV_RUN=docker exec -i -t --user $(shell id -u ${USER}) ${DEVENV} - endif -endif - -all: - ${ENV_RUN} ./scripts/run-make build -preinstall: - ${ENV_RUN} ./scripts/run-make build preinstall -install: - ${ENV_RUN} ./scripts/run-make build install -clean: - ${ENV_RUN} ./scripts/run-make build clean -purge: - ${ENV_RUN} rm -rf build -test: - ${ENV_RUN} ./scripts/run-make build test - -devenv: - docker pull ${DEVENV_IMAGE} - docker run -d -v $(shell pwd):/usr/src/project \ - -e LOCAL_USER_ID=$(shell id -u ${USER}) \ - --name ${DEVENV} -t ${DEVENV_IMAGE} bash -devenv-destroy: - docker rm -f ${DEVENV} -devenv-shell: - ${ENV_RUN} bash - -configure-release: - ${ENV_RUN} rm -rf build/${HOST_ENV}-release - ${ENV_RUN} ./scripts/setup_build ${HOST_ENV} - ${ENV_RUN} rm -f build/current - ${ENV_RUN} ln -s ${HOST_ENV}-release build/current - -configure-debug: - ${ENV_RUN} rm -rf build/${HOST_ENV}-debug - ${ENV_RUN} ./scripts/setup_build ${HOST_ENV} debug - ${ENV_RUN} rm -f build/current - ${ENV_RUN} ln -s ${HOST_ENV}-debug build/current - -configure-asan: - ${ENV_RUN} rm -rf build/${HOST_ENV}-asan - ${ENV_RUN} ./scripts/setup_build ${HOST_ENV} asan - ${ENV_RUN} rm -f build/current - ${ENV_RUN} ln -s ${HOST_ENV}-asan build/current - -configure-windows: - ${ENV_RUN} rm -rf build/windows - ${ENV_RUN} ./scripts/setup_build windows - ${ENV_RUN} rm -f build/current - ${ENV_RUN} ln -s windows build/current - -configure-windows-debug: - ${ENV_RUN} rm -rf build/windows - ${ENV_RUN} ./scripts/setup_build windows debug - ${ENV_RUN} rm -f build/current - ${ENV_RUN} ln -s windows build/current - -configure-gba: - ${ENV_RUN} rm -rf build/gba-release - ${ENV_RUN} ./scripts/setup_build gba - ${ENV_RUN} rm -f build/current - ${ENV_RUN} ln -s gba-release build/current diff --git a/deps/nostalgia/deps/ox/cmake/modules/GBA.cmake b/deps/nostalgia/deps/ox/cmake/modules/GBA.cmake deleted file mode 100644 index 97ea342..0000000 --- a/deps/nostalgia/deps/ox/cmake/modules/GBA.cmake +++ /dev/null @@ -1,24 +0,0 @@ -set(CMAKE_SYSTEM_NAME "Generic") - -set(DEVKITARM $ENV{DEVKITARM}) - -if(NOT DEVKITARM) - message(FATAL_ERROR "DEVKITARM environment variable not set") -endif() - -set(CMAKE_C_COMPILER ${DEVKITARM}/bin/arm-none-eabi-gcc) -set(CMAKE_CXX_COMPILER ${DEVKITARM}/bin/arm-none-eabi-g++) -set(CMAKE_FIND_ROOT_PATH ${DEVKITARM}) -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -set(CMAKE_FIND_LIBRARY_PREFIXES lib) -set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - -set(LINKER_FLAGS "-specs=gba.specs") -add_definitions ( - -DARM7 -) - -include(FindPackageHandleStandardArgs) diff --git a/deps/nostalgia/deps/ox/cmake/modules/Mingw.cmake b/deps/nostalgia/deps/ox/cmake/modules/Mingw.cmake deleted file mode 100644 index bf1d08f..0000000 --- a/deps/nostalgia/deps/ox/cmake/modules/Mingw.cmake +++ /dev/null @@ -1,18 +0,0 @@ -set(CMAKE_SYSTEM_NAME Windows) -set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) - -# cross compilers to use for C and C++ -set(CMAKE_C_COMPILER /usr/bin/${TOOLCHAIN_PREFIX}-gcc) -set(CMAKE_CXX_COMPILER /usr/bin/${TOOLCHAIN_PREFIX}-g++) -set(CMAKE_RC_COMPILER /usr/bin/${TOOLCHAIN_PREFIX}-windres) - -# target environment on the build host system -# set 1st to dir with the cross compiler's C/C++ headers/libs -set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) - -# modify default behavior of FIND_XXX() commands to -# search for headers/libs in the target environment and -# search for programs in the build host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/deps/nostalgia/deps/ox/cmake/modules/address_sanitizer.cmake b/deps/nostalgia/deps/ox/cmake/modules/address_sanitizer.cmake deleted file mode 100644 index f1076b2..0000000 --- a/deps/nostalgia/deps/ox/cmake/modules/address_sanitizer.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# This file belongs Nick Overdijk, and is from https://github.com/NickNick/wubwubcmake -# The MIT License (MIT) -# -# Copyright (c) 2013 Nick Overdijk -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -# the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.option(USE_ASAN "Enable Address Sanitizer, if your compiler supports it" ON) - -option(USE_ASAN "Enable Address Sanitizer, if your compiler supports it" OFF) -if(USE_ASAN) - include(CheckCXXSourceCompiles) - # If the compiler understands -fsanitize=address, add it to the flags (gcc since 4.8 & clang since version 3.2) - set(CMAKE_REQUIRED_FLAGS_BAK "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fsanitize=address") - CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" FLAG_FSANA_SUPPORTED) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_BAK}") - - if(FLAG_FSANA_SUPPORTED) - set(asan_flag "-fsanitize=address") - else(FLAG_FSANA_SUPPORTED) - # Alternatively, try if it understands -faddress-sanitizer (clang until version 3.2) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -faddress-sanitizer") - CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" FLAG_FASAN_SUPPORTED) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_BAK}") - - if(FLAG_FASAN_SUPPORTED) - set(asan_flag "-faddress-sanitizer") - endif(FLAG_FASAN_SUPPORTED) - endif(FLAG_FSANA_SUPPORTED) - - if(FLAG_FSANA_SUPPORTED OR FLAG_FASAN_SUPPORTED) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${asan_flag}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${asan_flag}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${asan_flag}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${asan_flag}") - endif() - -endif(USE_ASAN) diff --git a/deps/nostalgia/deps/ox/scripts/cibuild b/deps/nostalgia/deps/ox/scripts/cibuild deleted file mode 100755 index 236a44c..0000000 --- a/deps/nostalgia/deps/ox/scripts/cibuild +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env bash - -set -e - -make -j release -make -j debug -make -j -make -j test diff --git a/deps/nostalgia/deps/ox/scripts/run-make b/deps/nostalgia/deps/ox/scripts/run-make deleted file mode 100755 index 072865b..0000000 --- a/deps/nostalgia/deps/ox/scripts/run-make +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env bash - -set -e - -for f in $(find $1 -maxdepth 1 -mindepth 1 -type d) -do - cmake --build "$f" --target $2 -- -done diff --git a/deps/nostalgia/deps/ox/scripts/setup_build b/deps/nostalgia/deps/ox/scripts/setup_build deleted file mode 100755 index ee32e3b..0000000 --- a/deps/nostalgia/deps/ox/scripts/setup_build +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env bash - -set -e - -project=$(pwd)/ - -TARGET=$1 -BUILD_TYPE=$2 - -if [[ $TARGET == windows ]]; then - toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/Mingw.cmake" -elif [[ $TARGET == gba ]]; then - toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake -DOX_USE_STDLIB=OFF -DCMAKE_INSTALL_PREFIX=$DEVKITARM" -fi - -if [[ $BUILD_TYPE == asan ]]; then - buildTypeArgs="-DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug" - buildDir="build/${TARGET}-asan" -elif [[ $BUILD_TYPE == debug ]]; then - buildTypeArgs="-DCMAKE_BUILD_TYPE=Debug" - buildDir="build/${TARGET}-debug" -else - buildTypeArgs="-DCMAKE_BUILD_TYPE=Release" - buildDir="build/${TARGET}-release" -fi - -mkdir -p $buildDir -pushd $buildDir -cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -GNinja \ - $buildTypeArgs \ - $toolchain \ - $project -popd diff --git a/deps/nostalgia/deps/ox/src/CMakeLists.txt b/deps/nostalgia/deps/ox/src/CMakeLists.txt deleted file mode 100644 index cf39044..0000000 --- a/deps/nostalgia/deps/ox/src/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(ox) diff --git a/deps/nostalgia/deps/ox/src/ox/event/CMakeLists.txt b/deps/nostalgia/deps/ox/src/ox/event/CMakeLists.txt deleted file mode 100644 index 8f1933a..0000000 --- a/deps/nostalgia/deps/ox/src/ox/event/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -add_library( - OxEvent - signal.cpp -) - -if(NOT MSVC) - target_compile_options(OxEvent PRIVATE -Wsign-conversion) - target_compile_options(OxEvent PRIVATE -Wconversion) -endif() - -if(NOT OX_BARE_METAL) - set_property( - TARGET - OxEvent - PROPERTY - POSITION_INDEPENDENT_CODE ON - ) -endif() - -target_compile_definitions( - OxEvent PUBLIC - $<$:OX_USE_STDLIB> - $<$:OX_NODEBUG> -) - -target_link_libraries( - OxEvent PUBLIC - OxStd -) - -install( - FILES - event.hpp - signal.hpp - DESTINATION - include/ox/event -) - -install(TARGETS OxEvent - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) - -if(OX_RUN_TESTS) - add_subdirectory(test) -endif() diff --git a/deps/nostalgia/deps/ox/src/ox/mc/presenceindicator.hpp b/deps/nostalgia/deps/ox/src/ox/mc/presenceindicator.hpp deleted file mode 100644 index bc6ed04..0000000 --- a/deps/nostalgia/deps/ox/src/ox/mc/presenceindicator.hpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2015 - 2025 gary@drinkingtea.net - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -#pragma once - -#include -#include -#include -#include -#include - -#include "err.hpp" - -namespace ox { - -template -class FieldBitmapReader { - protected: - mutable std::size_t m_mapBlockIdx = ~std::size_t{0}; - mutable uint64_t m_mapBlock = 0; - std::size_t m_mapStart = 0; - Reader &m_reader; - - public: - explicit constexpr FieldBitmapReader(Reader &reader) noexcept; - - constexpr Result get(std::size_t i) const noexcept; - - private: - constexpr ox::Error loadMapBlock(std::size_t id) const noexcept; - -}; - -template -constexpr FieldBitmapReader::FieldBitmapReader(Reader &reader) noexcept: - m_mapStart(reader.tellg()), - m_reader(reader) { -} - -template -constexpr Result FieldBitmapReader::get(std::size_t idx) const noexcept { - constexpr auto blockBits = sizeof(m_mapBlock); - auto const blockIdx = idx / blockBits; - if (m_mapBlockIdx != blockIdx) [[unlikely]] { - OX_RETURN_ERROR(loadMapBlock(blockIdx)); - } - idx %= blockBits; - return (m_mapBlock >> idx) & 1; -} - -template -constexpr ox::Error FieldBitmapReader::loadMapBlock(std::size_t idx) const noexcept { - OX_REQUIRE(g, m_reader.tellg()); - OX_RETURN_ERROR(m_reader.seekg(static_cast(m_mapStart + idx), ox::ios_base::beg)); - ox::Array mapBlock{}; - OX_RETURN_ERROR(m_reader.read(mapBlock.data(), sizeof(m_mapBlock))); - // Warning: narrow-conv - OX_RETURN_ERROR(m_reader.seekg(static_cast(g), ox::ios_base::beg)); - m_mapBlock = 0; - for (auto i = 0ull; auto b : mapBlock) { - m_mapBlock |= static_cast(std::bit_cast(b)) << i; - i += 8; - } - m_mapBlockIdx = idx; - return {}; -} - - -template -class FieldBitmapWriterBase { - protected: - T m_map = nullptr; - std::size_t m_mapLen = 0; - - public: - constexpr FieldBitmapWriterBase(T map, std::size_t maxLen) noexcept; - - constexpr auto setBuffer(T map, std::size_t maxLen) noexcept; - - constexpr Result get(std::size_t i) const noexcept; - - constexpr void setFields(int) noexcept; - - constexpr void setMaxLen(int) noexcept; - - [[nodiscard]] - constexpr int64_t getMaxLen() const noexcept; - -}; - -template -constexpr FieldBitmapWriterBase::FieldBitmapWriterBase(T map, std::size_t maxLen) noexcept { - m_map = map; - m_mapLen = maxLen; -} - -template -constexpr auto FieldBitmapWriterBase::setBuffer(T map, std::size_t maxLen) noexcept { - m_map = map; - m_mapLen = maxLen; -} - -template -constexpr Result FieldBitmapWriterBase::get(std::size_t i) const noexcept { - if (i / 8 < m_mapLen) { - return (m_map[i / 8] >> (i % 8)) & 1; - } else { - return ox::Error(McPresenceMapOverflow); - } -} - -template -constexpr void FieldBitmapWriterBase::setFields(int fields) noexcept { - m_mapLen = static_cast((fields / 8 + 1) - (fields % 8 == 0)); -} - -template -constexpr void FieldBitmapWriterBase::setMaxLen(int maxLen) noexcept { - m_mapLen = static_cast(maxLen); -} - -template -constexpr int64_t FieldBitmapWriterBase::getMaxLen() const noexcept { - return static_cast(m_mapLen); -} - -extern template class FieldBitmapWriterBase; -extern template class FieldBitmapWriterBase; - -class FieldBitmap: public FieldBitmapWriterBase { - - public: - constexpr FieldBitmap(uint8_t *map, std::size_t maxLen) noexcept; - - constexpr Error set(std::size_t i, bool on) noexcept; - -}; - -constexpr FieldBitmap::FieldBitmap(uint8_t *map, std::size_t maxLen) noexcept: - FieldBitmapWriterBase(map, maxLen) { -} - -constexpr Error FieldBitmap::set(std::size_t i, bool on) noexcept { - if (i / 8 < m_mapLen) { -OX_ALLOW_UNSAFE_BUFFERS_BEGIN - if (on) { - m_map[i / 8] |= 1 << (i % 8); - } else { - m_map[i / 8] &= ~static_cast(1 << (i % 8)); - } -OX_ALLOW_UNSAFE_BUFFERS_END - return {}; - } else { - return ox::Error(McPresenceMapOverflow); - } -} - -} diff --git a/deps/nostalgia/deps/ox/src/ox/mc/write.hpp b/deps/nostalgia/deps/ox/src/ox/mc/write.hpp deleted file mode 100644 index 0e03b7f..0000000 --- a/deps/nostalgia/deps/ox/src/ox/mc/write.hpp +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright 2015 - 2025 gary@drinkingtea.net - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "intops.hpp" -#include "err.hpp" -#include "presenceindicator.hpp" -#include "types.hpp" - -namespace ox { - -template -class MetalClawWriter { - - private: - ox::Vector m_presenceMapBuff{}; - FieldBitmap m_fieldPresence; - int m_field = 0; - ox::Optional m_unionIdx; - std::size_t m_writerBeginP{}; - Writer &m_writer; - - public: - constexpr explicit MetalClawWriter(Writer &writer, ox::Optional const&unionIdx = {}) noexcept; - - constexpr ~MetalClawWriter() noexcept = default; - - constexpr Error field(const char*, const int8_t *val) noexcept; - constexpr Error field(const char*, const int16_t *val) noexcept; - constexpr Error field(const char*, const int32_t *val) noexcept; - constexpr Error field(const char*, const int64_t *val) noexcept; - - constexpr Error field(const char*, const uint8_t *val) noexcept; - constexpr Error field(const char*, const uint16_t *val) noexcept; - constexpr Error field(const char*, const uint32_t *val) noexcept; - constexpr Error field(const char*, const uint64_t *val) noexcept; - - constexpr Error field(const char*, const bool *val) noexcept; - - template - constexpr Error field(const char*, const T *val, std::size_t len) noexcept; - - template - constexpr Error field(const char *name, const HashMap *val) noexcept; - - template - constexpr Error field(const char*, const BasicString *val) noexcept; - - template - constexpr Error field(const char*, const IString *val) noexcept; - - constexpr Error fieldCString(const char *name, const char *const*val, std::size_t buffLen) noexcept; - - constexpr Error fieldCString(const char *name, const char **val) noexcept; - - constexpr Error fieldCString(const char *name, const char *const*val) noexcept; - - constexpr Error fieldCString(const char *name, const char *val, std::size_t len) noexcept; - - template - constexpr Error field(const char*, const T *val) noexcept; - - template - constexpr Error field(const char*, UnionView val) noexcept; - - template - constexpr ox::Error setTypeInfo( - const char *name = T::TypeName, - int version = T::TypeVersion, - const Vector& = {}, - std::size_t fields = ModelFieldCount_v) noexcept; - - /** - * stringLength is not implemented in MetalClawWriter - */ - [[nodiscard]] - constexpr auto stringLength(const char*) noexcept { - return 0; - } - - /** - * stringLength is not implemented in MetalClawWriter - */ - [[nodiscard]] - constexpr auto arrayLength(const char*, bool = true) noexcept { - return 0; - } - - [[nodiscard]] - static constexpr auto opType() noexcept { - return OpType::Write; - } - - ox::Error finalize() noexcept; - - private: - constexpr Error appendInteger(Integer_c auto val) noexcept { - bool fieldSet = false; - if (val && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - auto mi = mc::encodeInteger(val); - OX_RETURN_ERROR(m_writer.write(reinterpret_cast(mi.data.data()), mi.length)); - fieldSet = true; - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; - } - -}; - -extern template class ModelHandlerInterface>; -extern template class ModelHandlerInterface>; - -template -constexpr MetalClawWriter::MetalClawWriter(Writer &writer, ox::Optional const&unionIdx) noexcept: - m_fieldPresence(m_presenceMapBuff.data(), m_presenceMapBuff.size()), - m_unionIdx(unionIdx), - m_writerBeginP(writer.tellp()), - m_writer(writer) { -} - -template -constexpr Error MetalClawWriter::field(const char*, const int8_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const int16_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const int32_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const int64_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const uint8_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const uint16_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const uint32_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const uint64_t *val) noexcept { - return appendInteger(*val); -} - -template -constexpr Error MetalClawWriter::field(const char*, const bool *val) noexcept { - if (!m_unionIdx.has_value() || *m_unionIdx == m_field) { - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), *val)); - } - ++m_field; - return {}; -} - -template -template -constexpr Error MetalClawWriter::field(const char*, const BasicString *val) noexcept { - bool fieldSet = false; - if (val->size() && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - // write the length - const auto strLen = mc::encodeInteger(val->size()); - OX_RETURN_ERROR(m_writer.write(reinterpret_cast(strLen.data.data()), strLen.length)); - // write the string - OX_RETURN_ERROR(m_writer.write(val->c_str(), static_cast(val->size()))); - fieldSet = true; - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; -} - -template -template -constexpr Error MetalClawWriter::field(const char *name, const IString *val) noexcept { - return fieldCString(name, val->data(), val->size()); -} - -template -constexpr Error MetalClawWriter::fieldCString(const char*, const char *const*val, std::size_t) noexcept { - bool fieldSet = false; - if (!m_unionIdx.has_value() || *m_unionIdx == m_field) { - OX_ALLOW_UNSAFE_BUFFERS_BEGIN - // this strlen is tolerated because sometimes 0 gets passed to - // the size param, which is a lie - // this code should be cleaned up at some point... - const auto strLen = *val ? ox::strlen(*val) : 0; - OX_ALLOW_UNSAFE_BUFFERS_END - // write the length - const auto strLenBuff = mc::encodeInteger(strLen); - OX_RETURN_ERROR(m_writer.write(reinterpret_cast(strLenBuff.data.data()), strLenBuff.length)); - // write the string - OX_RETURN_ERROR(m_writer.write(*val, static_cast(strLen))); - fieldSet = true; - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; -} - -template -constexpr Error MetalClawWriter::fieldCString(const char *name, const char **val) noexcept { - return fieldCString(name, val, {}); -} - -template -constexpr Error MetalClawWriter::fieldCString(const char *name, const char *const*val) noexcept { - return fieldCString(name, val, {}); -} - -template -constexpr Error MetalClawWriter::fieldCString(const char*, const char *val, std::size_t strLen) noexcept { - bool fieldSet = false; - if (strLen && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - // write the length - const auto strLenBuff = mc::encodeInteger(strLen); - OX_RETURN_ERROR(m_writer.write(reinterpret_cast(strLenBuff.data.data()), strLenBuff.length)); - // write the string - OX_RETURN_ERROR(m_writer.write(val, static_cast(strLen))); - fieldSet = true; - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; -} - -template -template -constexpr Error MetalClawWriter::field(const char*, const T *val) noexcept { - if constexpr(isVector_v || isArray_v) { - return field(nullptr, val->data(), val->size()); - } else { - bool fieldSet = false; - if (val && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - auto const writeIdx = m_writer.tellp(); - MetalClawWriter writer(m_writer); - ModelHandlerInterface> handler{writer}; - OX_RETURN_ERROR(model(&handler, val)); - OX_RETURN_ERROR(writer.finalize()); - fieldSet = writeIdx != m_writer.tellp(); - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; - } -} - -template -template -constexpr Error MetalClawWriter::field(const char*, UnionView val) noexcept { - bool fieldSet = false; - if (val.get() && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - auto const writeIdx = m_writer.tellp(); - MetalClawWriter writer(m_writer, ox::Optional(ox::in_place, val.idx())); - ModelHandlerInterface handler{writer}; - OX_RETURN_ERROR(model(&handler, val.get())); - OX_RETURN_ERROR(writer.finalize()); - fieldSet = writeIdx != m_writer.tellp(); - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; -} - -template -template -constexpr Error MetalClawWriter::field(const char*, const T *val, std::size_t len) noexcept { - bool fieldSet = false; - if (len && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - // write the length - const auto arrLen = mc::encodeInteger(len); - OX_RETURN_ERROR(m_writer.write(reinterpret_cast(arrLen.data.data()), arrLen.length)); - auto const writeIdx = m_writer.tellp(); - MetalClawWriter writer(m_writer); - ModelHandlerInterface handler{writer}; - OX_RETURN_ERROR(handler.template setTypeInfo("List", 0, {}, static_cast(len))); - // write the array - for (std::size_t i = 0; i < len; ++i) { -OX_ALLOW_UNSAFE_BUFFERS_BEGIN - OX_RETURN_ERROR(handler.field("", &val[i])); -OX_ALLOW_UNSAFE_BUFFERS_END - } - OX_RETURN_ERROR(writer.finalize()); - fieldSet = writeIdx != m_writer.tellp(); - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; -} - -template -template -constexpr Error MetalClawWriter::field(const char*, const HashMap *val) noexcept { - const auto &keys = val->keys(); - const auto len = keys.size(); - bool fieldSet = false; - if (len && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { - // write the length - const auto arrLen = mc::encodeInteger(len); - OX_RETURN_ERROR(m_writer.write(reinterpret_cast(arrLen.data.data()), arrLen.length)); - // write map - MetalClawWriter writer(m_writer); - ModelHandlerInterface handler{writer}; - // double len for both key and value - OX_RETURN_ERROR(handler.setTypeInfo("Map", 0, {}, len * 2)); - // this loop body needs to be in a lambda because of the potential alloca call - constexpr auto loopBody = [](auto &handler, auto const&key, auto const&val) -> ox::Error { - const auto keyLen = key.size(); - auto wkey = ox_malloca(keyLen + 1, char, 0); - memcpy(wkey.get(), key.c_str(), keyLen + 1); - OX_RETURN_ERROR(handler.fieldCString("", wkey.get(), keyLen)); - OX_REQUIRE_M(value, val.at(key)); - return handler.field("", value); - }; - // write the array - for (std::size_t i = 0; i < len; ++i) { - auto const&key = keys[i]; - OX_RETURN_ERROR(loopBody(handler, key, *val)); - } - OX_RETURN_ERROR(writer.finalize()); - fieldSet = true; - } - OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); - ++m_field; - return {}; -} - -template -template -constexpr ox::Error MetalClawWriter::setTypeInfo( - const char*, - int, - const Vector&, - std::size_t fields) noexcept { - const auto fieldPresenceLen = (fields - 1) / 8 + 1; - OX_RETURN_ERROR(m_writer.write(nullptr, fieldPresenceLen)); - m_presenceMapBuff.resize(fieldPresenceLen); - m_fieldPresence.setBuffer(m_presenceMapBuff.data(), m_presenceMapBuff.size()); - m_fieldPresence.setFields(static_cast(fields)); - return {}; -} - -template -ox::Error MetalClawWriter::finalize() noexcept { - const auto end = m_writer.tellp(); - OX_RETURN_ERROR(m_writer.seekp(m_writerBeginP)); - OX_RETURN_ERROR(m_writer.write( - reinterpret_cast(m_presenceMapBuff.data()), - m_presenceMapBuff.size())); - OX_RETURN_ERROR(m_writer.seekp(end)); - return {}; -} - -Result writeMC(Writer_c auto &writer, const auto &val) noexcept { - MetalClawWriter mcWriter(writer); - ModelHandlerInterface handler{mcWriter}; - OX_RETURN_ERROR(model(&handler, &val)); - OX_RETURN_ERROR(mcWriter.finalize()); - return {}; -} - -Result writeMC(auto const&val, std::size_t buffReserveSz = 2 * units::KB) noexcept { - Buffer buff(buffReserveSz); - BufferWriter bw(&buff, 0); - OX_RETURN_ERROR(writeMC(bw, val)); - buff.resize(bw.tellp()); - return buff; -} - -Error writeMC(char *buff, std::size_t buffLen, auto const&val, std::size_t *sizeOut = nullptr) noexcept { - CharBuffWriter bw{{buff, buffLen}}; - OX_RETURN_ERROR(writeMC(bw, val)); - if (sizeOut) { - *sizeOut = bw.tellp(); - } - return {}; -} - -} diff --git a/deps/nostalgia/deps/ox/src/ox/model/CMakeLists.txt b/deps/nostalgia/deps/ox/src/ox/model/CMakeLists.txt deleted file mode 100644 index 19687d1..0000000 --- a/deps/nostalgia/deps/ox/src/ox/model/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -add_library( - OxModel - desctypes.cpp - descwrite.cpp - modelvalue.cpp -) - -if(NOT MSVC) - target_compile_options(OxModel PRIVATE -Wconversion) - target_compile_options(OxModel PRIVATE -Wsign-conversion) -endif() - -target_link_libraries( - OxModel PUBLIC - OxStd -) - -if(NOT OX_BARE_METAL) - set_property( - TARGET - OxModel - PROPERTY - POSITION_INDEPENDENT_CODE ON - ) -endif() - -install( - FILES - def.hpp - descread.hpp - desctypes.hpp - descwrite.hpp - optype.hpp - metadata.hpp - model.hpp - modelhandleradaptor.hpp - modelops.hpp - modelvalue.hpp - typenamecatcher.hpp - types.hpp - typestore.hpp - walk.hpp - DESTINATION - include/ox/model -) - -install(TARGETS OxModel - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) - -if(OX_RUN_TESTS) - add_subdirectory(test) -endif() diff --git a/deps/nostalgia/deps/oxlib/.gitea/workflows/build.yaml b/deps/nostalgia/deps/oxlib/.gitea/workflows/build.yaml new file mode 100644 index 0000000..dff266c --- /dev/null +++ b/deps/nostalgia/deps/oxlib/.gitea/workflows/build.yaml @@ -0,0 +1,20 @@ +name: Build +run-name: ${{ gitea.actor }} build and test +on: [push] + +jobs: + build: + runs-on: olympic + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: make purge configure-debug + - run: make build + - run: make test + - run: make purge configure-asan + - run: make build + - run: make test + - run: make purge configure-release + - run: make build + - run: make test + - run: make install diff --git a/deps/nostalgia/deps/ox/.gitignore b/deps/nostalgia/deps/oxlib/.gitignore similarity index 77% rename from deps/nostalgia/deps/ox/.gitignore rename to deps/nostalgia/deps/oxlib/.gitignore index f9d2f1c..1d46627 100644 --- a/deps/nostalgia/deps/ox/.gitignore +++ b/deps/nostalgia/deps/oxlib/.gitignore @@ -3,7 +3,10 @@ build/gba build/*-asan build/*-debug build/*-release +dist +.current_build tags +compile_commands.json conanbuildinfo.cmake conanbuildinfo.txt conaninfo.txt diff --git a/deps/nostalgia/deps/ox/.liccor.yml b/deps/nostalgia/deps/oxlib/.liccor.yml similarity index 100% rename from deps/nostalgia/deps/ox/.liccor.yml rename to deps/nostalgia/deps/oxlib/.liccor.yml diff --git a/deps/nostalgia/deps/ox/CMakeLists.txt b/deps/nostalgia/deps/oxlib/CMakeLists.txt similarity index 95% rename from deps/nostalgia/deps/ox/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/CMakeLists.txt index cb286b0..936ab13 100644 --- a/deps/nostalgia/deps/ox/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/CMakeLists.txt @@ -1,10 +1,10 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.25) set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19 project(Ox CXX) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) -include(address_sanitizer) +include(deps/buildcore/base.cmake) + if(NOT DEFINED OX_RUN_TESTS) set(OX_RUN_TESTS ON) diff --git a/deps/nostalgia/deps/buildcore/LICENSE b/deps/nostalgia/deps/oxlib/LICENSE similarity index 100% rename from deps/nostalgia/deps/buildcore/LICENSE rename to deps/nostalgia/deps/oxlib/LICENSE diff --git a/deps/nostalgia/deps/oxlib/Makefile b/deps/nostalgia/deps/oxlib/Makefile new file mode 100644 index 0000000..8d4193d --- /dev/null +++ b/deps/nostalgia/deps/oxlib/Makefile @@ -0,0 +1,18 @@ +BC_VAR_PROJECT_NAME=ox +BC_VAR_PROJECT_NAME_CAP=Ox +BC_VAR_DEVENV_ROOT=util +BUILDCORE_PATH=deps/buildcore +include ${BUILDCORE_PATH}/base.mk + +.PHONY: git-setup-buildcore-remote +git-setup-buildcore-remote: + git remote add -f buildcore-master git@git.drinkingtea.net:drinkingtea/buildcore.git + +.PHONY: git-pull-buildcore +git-pull-buildcore: + git fetch buildcore-master master + git subtree pull --prefix deps/buildcore buildcore-master master --squash + +.PHONY: git-push-buildcore +git-push-buildcore: + git subtree push --prefix=deps/buildcore buildcore-master master diff --git a/deps/nostalgia/deps/ox/OxConfig.cmake b/deps/nostalgia/deps/oxlib/OxConfig.cmake similarity index 100% rename from deps/nostalgia/deps/ox/OxConfig.cmake rename to deps/nostalgia/deps/oxlib/OxConfig.cmake diff --git a/deps/nostalgia/deps/buildcore/.gitignore b/deps/nostalgia/deps/oxlib/deps/buildcore/.gitignore similarity index 100% rename from deps/nostalgia/deps/buildcore/.gitignore rename to deps/nostalgia/deps/oxlib/deps/buildcore/.gitignore diff --git a/deps/nostalgia/deps/ox/LICENSE b/deps/nostalgia/deps/oxlib/deps/buildcore/LICENSE similarity index 100% rename from deps/nostalgia/deps/ox/LICENSE rename to deps/nostalgia/deps/oxlib/deps/buildcore/LICENSE diff --git a/deps/nostalgia/deps/buildcore/base.cmake b/deps/nostalgia/deps/oxlib/deps/buildcore/base.cmake similarity index 100% rename from deps/nostalgia/deps/buildcore/base.cmake rename to deps/nostalgia/deps/oxlib/deps/buildcore/base.cmake diff --git a/deps/nostalgia/deps/buildcore/base.mk b/deps/nostalgia/deps/oxlib/deps/buildcore/base.mk similarity index 100% rename from deps/nostalgia/deps/buildcore/base.mk rename to deps/nostalgia/deps/oxlib/deps/buildcore/base.mk diff --git a/deps/nostalgia/deps/buildcore/cmake/modules/Mingw.cmake b/deps/nostalgia/deps/oxlib/deps/buildcore/cmake/modules/Mingw.cmake similarity index 100% rename from deps/nostalgia/deps/buildcore/cmake/modules/Mingw.cmake rename to deps/nostalgia/deps/oxlib/deps/buildcore/cmake/modules/Mingw.cmake diff --git a/deps/nostalgia/deps/buildcore/cmake/modules/address_sanitizer.cmake b/deps/nostalgia/deps/oxlib/deps/buildcore/cmake/modules/address_sanitizer.cmake similarity index 100% rename from deps/nostalgia/deps/buildcore/cmake/modules/address_sanitizer.cmake rename to deps/nostalgia/deps/oxlib/deps/buildcore/cmake/modules/address_sanitizer.cmake diff --git a/deps/nostalgia/deps/buildcore/scripts/pybb.py b/deps/nostalgia/deps/oxlib/deps/buildcore/scripts/pybb.py similarity index 100% rename from deps/nostalgia/deps/buildcore/scripts/pybb.py rename to deps/nostalgia/deps/oxlib/deps/buildcore/scripts/pybb.py diff --git a/deps/nostalgia/deps/buildcore/scripts/setup-build.py b/deps/nostalgia/deps/oxlib/deps/buildcore/scripts/setup-build.py similarity index 100% rename from deps/nostalgia/deps/buildcore/scripts/setup-build.py rename to deps/nostalgia/deps/oxlib/deps/buildcore/scripts/setup-build.py diff --git a/deps/nostalgia/deps/buildcore/scripts/util.py b/deps/nostalgia/deps/oxlib/deps/buildcore/scripts/util.py similarity index 100% rename from deps/nostalgia/deps/buildcore/scripts/util.py rename to deps/nostalgia/deps/oxlib/deps/buildcore/scripts/util.py diff --git a/deps/nostalgia/deps/ox/deps/cityhash/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/cityhash/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/cityhash/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/cityhash/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/cityhash/include/cityhash/city.h b/deps/nostalgia/deps/oxlib/deps/cityhash/include/cityhash/city.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/cityhash/include/cityhash/city.h rename to deps/nostalgia/deps/oxlib/deps/cityhash/include/cityhash/city.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.clang-format b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.clang-format similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.clang-format rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.clang-format diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.clang-tidy b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.clang-tidy similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.clang-tidy rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.clang-tidy diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.gitattributes b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.gitattributes similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.gitattributes rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.gitattributes diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.github/ISSUE_TEMPLATE/bug_report.md b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.github/ISSUE_TEMPLATE/bug_report.md rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.github/ISSUE_TEMPLATE/bug_report.md diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.github/ISSUE_TEMPLATE/feature_request.md b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.github/ISSUE_TEMPLATE/feature_request.md rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.gitignore b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.gitignore similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.gitignore rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.gitignore diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis.yml b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis.yml similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis.yml rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis.yml diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/cmake_builder.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/cmake_builder.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/cmake_builder.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/cmake_builder.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/meson_builder.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/meson_builder.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/meson_builder.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/meson_builder.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/run-clang-format.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/run-clang-format.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/run-clang-format.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/run-clang-format.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/run-clang-format.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/run-clang-format.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/run-clang-format.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/run-clang-format.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.before_install.linux.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.before_install.linux.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.before_install.linux.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.before_install.linux.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.before_install.osx.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.before_install.osx.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.before_install.osx.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.before_install.osx.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.install.linux.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.install.linux.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.install.linux.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.install.linux.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.install.osx.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.install.osx.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/.travis_scripts/travis.install.osx.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/.travis_scripts/travis.install.osx.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/AUTHORS b/deps/nostalgia/deps/oxlib/deps/jsoncpp/AUTHORS similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/AUTHORS rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/AUTHORS diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/BUILD.bazel b/deps/nostalgia/deps/oxlib/deps/jsoncpp/BUILD.bazel similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/BUILD.bazel rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/BUILD.bazel diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/CONTRIBUTING.md b/deps/nostalgia/deps/oxlib/deps/jsoncpp/CONTRIBUTING.md similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/CONTRIBUTING.md rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/CONTRIBUTING.md diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/CTestConfig.cmake b/deps/nostalgia/deps/oxlib/deps/jsoncpp/CTestConfig.cmake similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/CTestConfig.cmake rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/CTestConfig.cmake diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/LICENSE b/deps/nostalgia/deps/oxlib/deps/jsoncpp/LICENSE similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/LICENSE rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/LICENSE diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/README.md b/deps/nostalgia/deps/oxlib/deps/jsoncpp/README.md similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/README.md rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/README.md diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/amalgamate.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/amalgamate.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/amalgamate.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/amalgamate.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/appveyor.yml b/deps/nostalgia/deps/oxlib/deps/jsoncpp/appveyor.yml similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/appveyor.yml rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/appveyor.yml diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/cmake/JoinPaths.cmake b/deps/nostalgia/deps/oxlib/deps/jsoncpp/cmake/JoinPaths.cmake similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/cmake/JoinPaths.cmake rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/cmake/JoinPaths.cmake diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/dev.makefile b/deps/nostalgia/deps/oxlib/deps/jsoncpp/dev.makefile similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/dev.makefile rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/dev.makefile diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/__init__.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/__init__.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/__init__.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/__init__.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/agent_vmw7.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/agent_vmw7.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/agent_vmw7.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/agent_vmw7.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/agent_vmxp.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/agent_vmxp.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/agent_vmxp.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/agent_vmxp.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/antglob.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/antglob.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/antglob.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/antglob.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/batchbuild.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/batchbuild.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/batchbuild.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/batchbuild.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/fixeol.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/fixeol.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/fixeol.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/fixeol.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/licenseupdater.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/licenseupdater.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/licenseupdater.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/licenseupdater.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/devtools/tarball.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/tarball.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/devtools/tarball.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/devtools/tarball.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/doxyfile.in b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/doxyfile.in similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/doxyfile.in rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/doxyfile.in diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/footer.html b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/footer.html similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/footer.html rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/footer.html diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/header.html b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/header.html similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/header.html rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/header.html diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/jsoncpp.dox b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/jsoncpp.dox similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/jsoncpp.dox rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/jsoncpp.dox diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/readme.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/readme.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/readme.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/readme.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/roadmap.dox b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/roadmap.dox similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/roadmap.dox rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/roadmap.dox diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doc/web_doxyfile.in b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/web_doxyfile.in similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doc/web_doxyfile.in rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doc/web_doxyfile.in diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/doxybuild.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/doxybuild.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/doxybuild.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/doxybuild.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/README.md b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/README.md similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/README.md rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/README.md diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromStream/errorFormat.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromStream/errorFormat.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromStream/errorFormat.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromStream/errorFormat.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromStream/readFromStream.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromStream/readFromStream.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromStream/readFromStream.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromStream/readFromStream.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromStream/withComment.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromStream/withComment.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromStream/withComment.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromStream/withComment.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromString/readFromString.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromString/readFromString.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/readFromString/readFromString.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/readFromString/readFromString.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/streamWrite/streamWrite.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/streamWrite/streamWrite.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/streamWrite/streamWrite.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/streamWrite/streamWrite.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/example/stringWrite/stringWrite.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/example/stringWrite/stringWrite.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/example/stringWrite/stringWrite.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/example/stringWrite/stringWrite.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/get_version.pl b/deps/nostalgia/deps/oxlib/deps/jsoncpp/get_version.pl similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/get_version.pl rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/get_version.pl diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/PreventInBuildInstalls.cmake b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/PreventInBuildInstalls.cmake similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/PreventInBuildInstalls.cmake rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/PreventInBuildInstalls.cmake diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/PreventInSourceBuilds.cmake b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/PreventInSourceBuilds.cmake similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/PreventInSourceBuilds.cmake rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/PreventInSourceBuilds.cmake diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/allocator.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/allocator.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/allocator.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/allocator.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/assertions.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/assertions.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/assertions.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/assertions.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/config.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/config.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/config.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/config.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/forwards.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/forwards.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/forwards.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/forwards.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/json.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/json.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/json.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/json.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/json_features.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/json_features.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/json_features.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/json_features.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/reader.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/reader.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/reader.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/reader.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/value.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/value.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/value.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/value.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/version.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/version.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/version.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/version.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/include/json/writer.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/writer.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/include/json/writer.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/include/json/writer.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/jsoncpp-namespaced-targets.cmake b/deps/nostalgia/deps/oxlib/deps/jsoncpp/jsoncpp-namespaced-targets.cmake similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/jsoncpp-namespaced-targets.cmake rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/jsoncpp-namespaced-targets.cmake diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/jsoncppConfig.cmake.in b/deps/nostalgia/deps/oxlib/deps/jsoncpp/jsoncppConfig.cmake.in similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/jsoncppConfig.cmake.in rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/jsoncppConfig.cmake.in diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/meson.build b/deps/nostalgia/deps/oxlib/deps/jsoncpp/meson.build similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/meson.build rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/meson.build diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/meson_options.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/meson_options.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/meson_options.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/meson_options.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/pkg-config/jsoncpp.pc.in b/deps/nostalgia/deps/oxlib/deps/jsoncpp/pkg-config/jsoncpp.pc.in similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/pkg-config/jsoncpp.pc.in rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/pkg-config/jsoncpp.pc.in diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/reformat.sh b/deps/nostalgia/deps/oxlib/deps/jsoncpp/reformat.sh similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/reformat.sh rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/reformat.sh diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/jsontestrunner/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/jsontestrunner/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/jsontestrunner/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/jsontestrunner/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/jsontestrunner/main.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/jsontestrunner/main.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/jsontestrunner/main.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/jsontestrunner/main.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_reader.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_reader.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_reader.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_reader.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_tool.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_tool.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_tool.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_tool.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_value.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_value.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_value.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_value.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_valueiterator.inl b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_valueiterator.inl similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_valueiterator.inl rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_valueiterator.inl diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_writer.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_writer.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/lib_json/json_writer.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/lib_json/json_writer.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/CMakeLists.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/fuzz.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/fuzz.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/fuzz.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/fuzz.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/fuzz.dict b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/fuzz.dict similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/fuzz.dict rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/fuzz.dict diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/fuzz.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/fuzz.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/fuzz.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/fuzz.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/jsontest.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/jsontest.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/jsontest.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/jsontest.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/jsontest.h b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/jsontest.h similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/jsontest.h rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/jsontest.h diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/main.cpp b/deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/main.cpp similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/src/test_lib_json/main.cpp rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/src/test_lib_json/main.cpp diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/cleantests.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/cleantests.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/cleantests.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/cleantests.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_invalid_quote.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_invalid_quote.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_invalid_quote.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_invalid_quote.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_array_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_array_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_array_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_array_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_array_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_array_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_array_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_array_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_object_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_object_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_object_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_object_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_stack_limit.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_stack_limit.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/fail_test_stack_limit.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/fail_test_stack_limit.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_06.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_06.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_06.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_06.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_06.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_06.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_06.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_06.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_07.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_07.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_07.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_07.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_07.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_07.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_array_07.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_array_07.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_06.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_06.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_06.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_06.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_06.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_06.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_06.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_06.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_07.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_07.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_07.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_07.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_07.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_07.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_07.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_07.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_08.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_08.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_08.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_08.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_08.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_08.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_08.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_08.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_09.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_09.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_09.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_09.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_09.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_09.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_basic_09.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_basic_09.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_00.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_00.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_00.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_00.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_00.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_00.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_00.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_00.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_comment_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_comment_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_complex_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_complex_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_complex_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_complex_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_complex_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_complex_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_complex_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_complex_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_06_64bits.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_07_64bits.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_integer_08_64bits.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_large_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_large_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_large_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_large_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_large_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_large_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_large_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_large_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_object_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_object_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_preserve_comment_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_06.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_06.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_06.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_06.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_06.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_06.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_06.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_06.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_07.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_07.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_07.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_07.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_07.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_07.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_07.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_07.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_08.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_08.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_08.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_08.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_08.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_08.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_08.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_08.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_09.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_09.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_09.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_09.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_09.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_09.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_09.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_09.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_10.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_10.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_10.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_10.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_10.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_10.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_10.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_10.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_11.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_11.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_11.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_11.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_11.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_11.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_11.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_11.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_12.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_12.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_12.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_12.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_12.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_12.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_real_12.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_real_12.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_01.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_01.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_01.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_01.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_01.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_01.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_01.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_01.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_02.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_02.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_02.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_02.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_02.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_02.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_02.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_02.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_03.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_03.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_03.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_03.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_03.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_03.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_03.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_03.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_04.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_04.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_04.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_04.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_04.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_04.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_04.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_04.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/legacy_test_string_unicode_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/legacy_test_string_unicode_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_array_08.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_array_08.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_array_08.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_array_08.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_array_08.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_array_08.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_array_08.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_array_08.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_object_05.expected b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_object_05.expected similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_object_05.expected rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_object_05.expected diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_object_05.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_object_05.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/data/test_object_05.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/data/test_object_05.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/generate_expected.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/generate_expected.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/generate_expected.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/generate_expected.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail1.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail1.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail1.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail1.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail10.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail10.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail10.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail10.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail11.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail11.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail11.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail11.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail12.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail12.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail12.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail12.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail13.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail13.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail13.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail13.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail14.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail14.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail14.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail14.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail15.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail15.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail15.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail15.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail16.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail16.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail16.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail16.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail17.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail17.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail17.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail17.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail18.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail18.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail18.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail18.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail19.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail19.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail19.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail19.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail2.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail2.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail2.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail2.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail20.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail20.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail20.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail20.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail21.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail21.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail21.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail21.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail22.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail22.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail22.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail22.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail23.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail23.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail23.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail23.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail24.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail24.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail24.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail24.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail25.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail25.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail25.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail25.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail26.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail26.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail26.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail26.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail27.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail27.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail27.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail27.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail28.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail28.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail28.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail28.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail29.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail29.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail29.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail29.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail3.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail3.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail3.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail3.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail30.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail30.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail30.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail30.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail31.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail31.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail31.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail31.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail32.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail32.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail32.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail32.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail33.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail33.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail33.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail33.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail4.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail4.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail4.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail4.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail5.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail5.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail5.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail5.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail6.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail6.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail6.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail6.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail7.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail7.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail7.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail7.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail8.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail8.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail8.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail8.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail9.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail9.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/fail9.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/fail9.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/pass1.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/pass1.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/pass1.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/pass1.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/pass2.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/pass2.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/pass2.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/pass2.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/pass3.json b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/pass3.json similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/pass3.json rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/pass3.json diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/readme.txt b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/readme.txt similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/jsonchecker/readme.txt rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/jsonchecker/readme.txt diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/pyjsontestrunner.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/pyjsontestrunner.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/pyjsontestrunner.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/pyjsontestrunner.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/runjsontests.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/runjsontests.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/runjsontests.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/runjsontests.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/test/rununittests.py b/deps/nostalgia/deps/oxlib/deps/jsoncpp/test/rununittests.py similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/test/rununittests.py rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/test/rununittests.py diff --git a/deps/nostalgia/deps/ox/deps/jsoncpp/version.in b/deps/nostalgia/deps/oxlib/deps/jsoncpp/version.in similarity index 100% rename from deps/nostalgia/deps/ox/deps/jsoncpp/version.in rename to deps/nostalgia/deps/oxlib/deps/jsoncpp/version.in diff --git a/deps/nostalgia/deps/ox/ox-docs.md b/deps/nostalgia/deps/oxlib/ox-docs.md similarity index 100% rename from deps/nostalgia/deps/ox/ox-docs.md rename to deps/nostalgia/deps/oxlib/ox-docs.md diff --git a/deps/nostalgia/deps/ox/src/ox/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/clargs/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/clargs/CMakeLists.txt similarity index 83% rename from deps/nostalgia/deps/ox/src/ox/clargs/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/clargs/CMakeLists.txt index 06c399e..30c7357 100644 --- a/deps/nostalgia/deps/ox/src/ox/clargs/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/clargs/CMakeLists.txt @@ -7,7 +7,7 @@ endif() add_library( OxClArgs - clargs.cpp + src/clargs.cpp ) set_property( @@ -27,11 +27,16 @@ target_link_libraries( OxStd ) +target_include_directories( + OxClArgs PUBLIC + include +) + install( - FILES - clargs.hpp + DIRECTORY + include/ox DESTINATION - include/ox/clargs + include ) install( diff --git a/deps/nostalgia/deps/ox/src/ox/clargs/clargs.hpp b/deps/nostalgia/deps/oxlib/src/clargs/include/ox/clargs/clargs.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/clargs/clargs.hpp rename to deps/nostalgia/deps/oxlib/src/clargs/include/ox/clargs/clargs.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/clargs/clargs.cpp b/deps/nostalgia/deps/oxlib/src/clargs/src/clargs.cpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/clargs/clargs.cpp rename to deps/nostalgia/deps/oxlib/src/clargs/src/clargs.cpp index 1976f25..e779e41 100644 --- a/deps/nostalgia/deps/ox/src/ox/clargs/clargs.cpp +++ b/deps/nostalgia/deps/oxlib/src/clargs/src/clargs.cpp @@ -7,7 +7,7 @@ */ #include -#include "clargs.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/claw/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/claw/CMakeLists.txt similarity index 65% rename from deps/nostalgia/deps/ox/src/ox/claw/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/claw/CMakeLists.txt index 4c13e5b..86eb642 100644 --- a/deps/nostalgia/deps/ox/src/ox/claw/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/claw/CMakeLists.txt @@ -1,8 +1,8 @@ add_library( OxClaw - read.cpp - write.cpp + src/read.cpp + src/write.cpp ) if(NOT MSVC) @@ -27,9 +27,22 @@ target_link_libraries( # ) #endif() -install(TARGETS OxClaw - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +target_include_directories( + OxClaw PUBLIC + include +) + +install( + DIRECTORY + include/ox + DESTINATION + include +) + +install( + TARGETS OxClaw + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib ) if(OX_RUN_TESTS) diff --git a/deps/nostalgia/deps/ox/src/ox/claw/claw.hpp b/deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/claw.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/claw/claw.hpp rename to deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/claw.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/claw/format.hpp b/deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/format.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/claw/format.hpp rename to deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/format.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/claw/read.hpp b/deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/read.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/claw/read.hpp rename to deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/read.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/claw/write.hpp b/deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/write.hpp similarity index 83% rename from deps/nostalgia/deps/ox/src/ox/claw/write.hpp rename to deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/write.hpp index 8a62a1d..e05e9b1 100644 --- a/deps/nostalgia/deps/ox/src/ox/claw/write.hpp +++ b/deps/nostalgia/deps/oxlib/src/claw/include/ox/claw/write.hpp @@ -120,4 +120,24 @@ Result writeClaw( return out; } +Error writeClaw( + auto const &obj, + Writer_c auto &writer, + ClawFormat const fmt = ClawFormat::Metal) noexcept { + OX_RETURN_ERROR(detail::writeClawHeader(writer, &obj, fmt)); +#ifdef OX_USE_STDLIB + if (fmt == ClawFormat::Metal) { + OX_RETURN_ERROR(writeMC(writer, obj)); + } else if (fmt == ClawFormat::Organic) { + OX_RETURN_ERROR(writeOC(writer, obj)); + } +#else + if (fmt != ClawFormat::Metal) { + return ox::Error(1, "OC is not supported in this build"); + } + OX_RETURN_ERROR(writeMC(writer, obj)); +#endif + return {}; +} + } diff --git a/deps/nostalgia/deps/ox/src/ox/claw/read.cpp b/deps/nostalgia/deps/oxlib/src/claw/src/read.cpp similarity index 93% rename from deps/nostalgia/deps/ox/src/ox/claw/read.cpp rename to deps/nostalgia/deps/oxlib/src/claw/src/read.cpp index c5284be..6f94e92 100644 --- a/deps/nostalgia/deps/ox/src/ox/claw/read.cpp +++ b/deps/nostalgia/deps/oxlib/src/claw/src/read.cpp @@ -8,11 +8,11 @@ #include -#include "read.hpp" +#include namespace ox { -ox::Result readClawTypeId(ox::BufferView buff) noexcept { +Result readClawTypeId(BufferView const buff) noexcept { auto buffRaw = buff.data(); auto buffLen = buff.size(); size_t outSz{}; @@ -43,7 +43,7 @@ ox::Result readClawTypeId(ox::BufferView buff) noexcept { return {{buff.data() + fmtSz, outSz - fmtSz - 1}}; } -Result readClawHeader(ox::BufferView buff) noexcept { +Result readClawHeader(BufferView const buff) noexcept { auto buffRaw = buff.data(); auto buffLen = buff.size(); const auto s1End = ox::strchr(buffRaw, ';', buffLen); @@ -87,7 +87,7 @@ Result readClawHeader(ox::BufferView buff) noexcept { return hdr; } -Result stripClawHeader(ox::BufferView buff) noexcept { +Result stripClawHeader(BufferView const buff) noexcept { OX_REQUIRE(header, readClawHeader(buff)); return {{header.data, header.dataSize}}; } diff --git a/deps/nostalgia/deps/ox/src/ox/claw/readclaw.cpp b/deps/nostalgia/deps/oxlib/src/claw/src/readclaw.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/claw/readclaw.cpp rename to deps/nostalgia/deps/oxlib/src/claw/src/readclaw.cpp diff --git a/deps/nostalgia/deps/ox/src/ox/claw/write.cpp b/deps/nostalgia/deps/oxlib/src/claw/src/write.cpp similarity index 94% rename from deps/nostalgia/deps/ox/src/ox/claw/write.cpp rename to deps/nostalgia/deps/oxlib/src/claw/src/write.cpp index c184be2..8785839 100644 --- a/deps/nostalgia/deps/ox/src/ox/claw/write.cpp +++ b/deps/nostalgia/deps/oxlib/src/claw/src/write.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "write.hpp" +#include namespace ox::detail { diff --git a/deps/nostalgia/deps/ox/src/ox/claw/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/claw/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/claw/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/claw/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/claw/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/claw/test/tests.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/claw/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/claw/test/tests.cpp diff --git a/deps/nostalgia/deps/oxlib/src/event/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/event/CMakeLists.txt new file mode 100644 index 0000000..7610c6c --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/event/CMakeLists.txt @@ -0,0 +1,51 @@ +add_library( + OxEvent + src/signal.cpp +) + +if(NOT MSVC) + target_compile_options(OxEvent PRIVATE -Wsign-conversion) + target_compile_options(OxEvent PRIVATE -Wconversion) +endif() + +if(NOT OX_BARE_METAL) + set_property( + TARGET + OxEvent + PROPERTY + POSITION_INDEPENDENT_CODE ON + ) +endif() + +target_compile_definitions( + OxEvent PUBLIC + $<$:OX_USE_STDLIB> + $<$:OX_NODEBUG> +) + +target_link_libraries( + OxEvent PUBLIC + OxStd +) + +target_include_directories( + OxEvent PUBLIC + include +) + +install( + DIRECTORY + include/ox + DESTINATION + include +) + +install( + TARGETS OxEvent + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(OX_RUN_TESTS) + add_subdirectory(test) +endif() diff --git a/deps/nostalgia/deps/ox/src/ox/event/event.hpp b/deps/nostalgia/deps/oxlib/src/event/include/ox/event/event.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/event/event.hpp rename to deps/nostalgia/deps/oxlib/src/event/include/ox/event/event.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/event/signal.hpp b/deps/nostalgia/deps/oxlib/src/event/include/ox/event/signal.hpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/event/signal.hpp rename to deps/nostalgia/deps/oxlib/src/event/include/ox/event/signal.hpp index eb09f00..ad476fa 100644 --- a/deps/nostalgia/deps/ox/src/ox/event/signal.hpp +++ b/deps/nostalgia/deps/oxlib/src/event/include/ox/event/signal.hpp @@ -122,7 +122,7 @@ class Signal { } }; - mutable Vector> m_slots; + mutable Vector> m_slots; public: ~Signal() noexcept; @@ -303,7 +303,7 @@ class Signal { } }; - mutable Vector> m_slots; + mutable Vector> m_slots; public: ~Signal() noexcept; diff --git a/deps/nostalgia/deps/ox/src/ox/event/signal.cpp b/deps/nostalgia/deps/oxlib/src/event/src/signal.cpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/event/signal.cpp rename to deps/nostalgia/deps/oxlib/src/event/src/signal.cpp index a0928f6..69cb12c 100644 --- a/deps/nostalgia/deps/ox/src/ox/event/signal.cpp +++ b/deps/nostalgia/deps/oxlib/src/event/src/signal.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "signal.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/event/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/event/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/event/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/event/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/event/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/event/test/tests.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/event/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/event/test/tests.cpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/fs/CMakeLists.txt similarity index 58% rename from deps/nostalgia/deps/ox/src/ox/fs/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/fs/CMakeLists.txt index 960f7c6..77c346b 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/fs/CMakeLists.txt @@ -5,14 +5,12 @@ endif() add_library( OxFS - ptrarith/nodebuffer.hpp - ptrarith/ptr.hpp - filestore/filestoretemplate.cpp - filesystem/filelocation.cpp - filesystem/pathiterator.cpp - filesystem/directory.cpp - filesystem/filesystem.cpp - filesystem/passthroughfs.cpp + src/filestore/filestoretemplate.cpp + src/filesystem/filelocation.cpp + src/filesystem/pathiterator.cpp + src/filesystem/directory.cpp + src/filesystem/filesystem.cpp + src/filesystem/passthroughfs.cpp ) if(NOT MSVC) @@ -33,10 +31,22 @@ target_link_libraries( OxMetalClaw ) +target_include_directories( + OxFS PUBLIC + include +) + +install( + DIRECTORY + include/ox + DESTINATION + include +) + if(NOT OX_BARE_METAL) add_executable( oxfs-tool - tool.cpp + src/tool.cpp ) target_link_libraries( @@ -52,29 +62,6 @@ if(NOT OX_BARE_METAL) ) endif() -install( - FILES - filestore/filestoretemplate.hpp - DESTINATION - include/ox/fs/filestore -) - -install( - FILES - filesystem/filesystem.hpp - filesystem/pathiterator.hpp - DESTINATION - include/ox/fs/filesystem -) - -install( - FILES - ptrarith/nodebuffer.hpp - ptrarith/ptr.hpp - DESTINATION - include/ox/fs/ptrarith -) - install( TARGETS OxFS diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filestore/filestoretemplate.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filestore/filestoretemplate.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/directory.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/directory.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/directory.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filelocation.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/filelocation.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/filelocation.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/filelocation.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/filesystem.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/filesystem.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/passthroughfs.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/passthroughfs.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/pathiterator.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/pathiterator.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/pathiterator.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/pathiterator.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/types.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/types.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/types.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/filesystem/types.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/fs.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/fs.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/fs.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/fs.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/ptrarith/nodebuffer.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/ptrarith/nodebuffer.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/ptrarith/ptr.hpp b/deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/ptrarith/ptr.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/ptrarith/ptr.hpp rename to deps/nostalgia/deps/oxlib/src/fs/include/ox/fs/ptrarith/ptr.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filestore/filestoretemplate.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/filestore/filestoretemplate.cpp similarity index 88% rename from deps/nostalgia/deps/ox/src/ox/fs/filestore/filestoretemplate.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/filestore/filestoretemplate.cpp index 3e3a638..89e586a 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filestore/filestoretemplate.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/filestore/filestoretemplate.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "filestoretemplate.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/directory.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/directory.cpp similarity index 91% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/directory.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/filesystem/directory.cpp index 648a3f1..9025d40 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/directory.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/directory.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "directory.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filelocation.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/filelocation.cpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/filelocation.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/filesystem/filelocation.cpp index a7b9d71..6ef96d7 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filelocation.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/filelocation.cpp @@ -8,7 +8,7 @@ #include -#include "filelocation.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/filesystem.cpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/filesystem/filesystem.cpp index 07e2c39..da0e084 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/filesystem.cpp @@ -9,7 +9,7 @@ #include #include -#include "filesystem.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/passthroughfs.cpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/filesystem/passthroughfs.cpp index f7cab7d..22489c5 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/passthroughfs.cpp @@ -8,7 +8,7 @@ #include -#include "passthroughfs.hpp" +#include #if defined(OX_HAS_PASSTHROUGHFS) diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/pathiterator.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/pathiterator.cpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/fs/filesystem/pathiterator.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/filesystem/pathiterator.cpp index 39cf99a..d6205f8 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/pathiterator.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/filesystem/pathiterator.cpp @@ -9,7 +9,7 @@ #include #include #include -#include "pathiterator.hpp" +#include OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage) diff --git a/deps/nostalgia/deps/ox/src/ox/fs/tool.cpp b/deps/nostalgia/deps/oxlib/src/fs/src/tool.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/fs/tool.cpp rename to deps/nostalgia/deps/oxlib/src/fs/src/tool.cpp index af66735..634562f 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/tool.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/src/tool.cpp @@ -34,7 +34,7 @@ static ox::Result loadFsBuff(const char *path) noexcept { } } -static ox::Result> loadFs(const char *path) noexcept { +static ox::Result> loadFs(const char *path) noexcept { OX_REQUIRE(buff, loadFsBuff(path)); return {ox::make_unique(buff.data, buff.size)}; } diff --git a/deps/nostalgia/deps/ox/src/ox/fs/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/fs/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/fs/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/fs/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/fs/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/fs/test/tests.cpp similarity index 91% rename from deps/nostalgia/deps/ox/src/ox/fs/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/fs/test/tests.cpp index cd5b038..e83e883 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/test/tests.cpp +++ b/deps/nostalgia/deps/oxlib/src/fs/test/tests.cpp @@ -38,17 +38,6 @@ const std::map> tests = auto a1 = buffer->malloc(sizeof(String)).value; auto a2 = buffer->malloc(sizeof(String)).value; oxAssert(a1.valid(), "Allocation 1 failed."); - oxAssert(a2.valid(), "Allocation 2 failed."); - auto s1Buff = buffer->dataOf(a1); - auto s2Buff = buffer->dataOf(a2); - oxAssert(s1Buff.valid(), "s1 allocation 1 failed."); - oxAssert(s2Buff.valid(), "s2 allocation 2 failed."); - auto &s1 = *new (s1Buff) String("asdf"); - auto &s2 = *new (s2Buff) String("aoeu"); - oxTrace("test") << "s1: " << s1.c_str(); - oxTrace("test") << "s2: " << s2.c_str(); - oxAssert(s1 == "asdf", "Allocation 1 not as expected."); - oxAssert(s2 == "aoeu", "Allocation 2 not as expected."); oxAssert(buffer->free(a1), "Free failed."); oxAssert(buffer->free(a2), "Free failed."); oxAssert(buffer->setSize(buffer->size() - buffer->available()), "Resize failed."); @@ -175,8 +164,8 @@ const std::map> tests = auto list = new (ox_alloca(buffLen)) ox::ptrarith::NodeBuffer>(buffLen); oxAssert(ox::FileStore32::format(list, buffLen), "FileStore::format failed."); ox::FileStore32 fileStore(list, buffLen); - oxAssert(fileStore.write(4, const_cast(str1), str1Len, 1), "FileStore::write 1 failed."); - oxAssert(fileStore.write(5, const_cast(str2), str2Len, 1), "FileStore::write 2 failed."); + oxAssert(fileStore.write(4, str1, str1Len, 1), "FileStore::write 1 failed."); + oxAssert(fileStore.write(5, str2, str2Len, 1), "FileStore::write 2 failed."); char str1Read[str1Len]; size_t str1ReadSize = 0; diff --git a/deps/nostalgia/deps/ox/src/ox/logconn/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/logconn/CMakeLists.txt similarity index 81% rename from deps/nostalgia/deps/ox/src/ox/logconn/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/logconn/CMakeLists.txt index ad218cd..7817a77 100644 --- a/deps/nostalgia/deps/ox/src/ox/logconn/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/logconn/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) add_library( OxLogConn - logconn.cpp + src/logconn.cpp ) set_property( @@ -24,12 +24,16 @@ target_link_libraries( $<$:ws2_32> ) +target_include_directories( + OxLogConn PUBLIC + include +) + install( - FILES - circularbuff.hpp - logconn.hpp + DIRECTORY + include/ox DESTINATION - include/ox/logconn + include ) install( diff --git a/deps/nostalgia/deps/ox/src/ox/logconn/circularbuff.hpp b/deps/nostalgia/deps/oxlib/src/logconn/include/ox/logconn/circularbuff.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/logconn/circularbuff.hpp rename to deps/nostalgia/deps/oxlib/src/logconn/include/ox/logconn/circularbuff.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/logconn/def.hpp b/deps/nostalgia/deps/oxlib/src/logconn/include/ox/logconn/def.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/logconn/def.hpp rename to deps/nostalgia/deps/oxlib/src/logconn/include/ox/logconn/def.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/logconn/logconn.hpp b/deps/nostalgia/deps/oxlib/src/logconn/include/ox/logconn/logconn.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/logconn/logconn.hpp rename to deps/nostalgia/deps/oxlib/src/logconn/include/ox/logconn/logconn.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/logconn/logconn.cpp b/deps/nostalgia/deps/oxlib/src/logconn/src/logconn.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/logconn/logconn.cpp rename to deps/nostalgia/deps/oxlib/src/logconn/src/logconn.cpp index d101e61..2832124 100644 --- a/deps/nostalgia/deps/ox/src/ox/logconn/logconn.cpp +++ b/deps/nostalgia/deps/oxlib/src/logconn/src/logconn.cpp @@ -6,7 +6,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifdef OX_USE_STDLIB +#include + +#ifndef OX_OS_BareMetal #include #ifndef _WIN32 @@ -23,7 +25,7 @@ #endif -#include "logconn.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/mc/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/mc/CMakeLists.txt similarity index 62% rename from deps/nostalgia/deps/ox/src/ox/mc/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/mc/CMakeLists.txt index 578028a..6c1860e 100644 --- a/deps/nostalgia/deps/ox/src/ox/mc/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/mc/CMakeLists.txt @@ -1,8 +1,7 @@ add_library( OxMetalClaw - presenceindicator.cpp - read.cpp - write.cpp + src/read.cpp + src/write.cpp ) if(NOT MSVC) @@ -25,22 +24,22 @@ if(NOT OX_BARE_METAL) ) endif() -install( - FILES - intops.hpp - err.hpp - mc.hpp - presenceindicator.hpp - read.hpp - types.hpp - write.hpp - DESTINATION - include/ox/mc +target_include_directories( + OxMetalClaw PUBLIC + include ) -install(TARGETS OxMetalClaw - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +install( + DIRECTORY + include/ox + DESTINATION + include +) + +install( + TARGETS OxMetalClaw + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib ) if(OX_RUN_TESTS) diff --git a/deps/nostalgia/deps/ox/src/ox/mc/err.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/err.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/mc/err.hpp rename to deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/err.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/mc/intops.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/intops.hpp similarity index 70% rename from deps/nostalgia/deps/ox/src/ox/mc/intops.hpp rename to deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/intops.hpp index d4092bb..752fb49 100644 --- a/deps/nostalgia/deps/ox/src/ox/mc/intops.hpp +++ b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/intops.hpp @@ -18,25 +18,25 @@ namespace ox::mc { -template +template static constexpr auto Bits = sizeof(T) << 3; /** * Returns highest bit other than possible signed bit. * Bit numbering starts at 0. */ -template +template [[nodiscard]] -constexpr std::size_t highestBit(I val) noexcept { +constexpr size_t highestBit(I const val) noexcept { unsigned shiftStart = sizeof(I) * 8 - 1; - // find most significant non-sign indicator bit - std::size_t highestBit = 0; + // find the most significant non-sign indicator bit + size_t highestBit = 0; // start at one bit lower if signed if constexpr(is_signed_v) { --shiftStart; } for (auto i = shiftStart; i > 0; --i) { - const auto bitValue = (val >> i) & 1; + auto const bitValue = (val >> i) & 1; if (bitValue) { highestBit = i; break; @@ -45,7 +45,7 @@ constexpr std::size_t highestBit(I val) noexcept { return highestBit; } -static_assert(highestBit(int8_t(0b10000000)) == 0); +static_assert(highestBit(static_cast(0b10000000)) == 0); static_assert(highestBit(~static_cast(-1)) == 0); static_assert(highestBit(~static_cast(-2)) == 0); static_assert(highestBit(~static_cast(-3)) == 1); @@ -53,42 +53,39 @@ static_assert(highestBit(1) == 0); static_assert(highestBit(2) == 1); static_assert(highestBit(4) == 2); static_assert(highestBit(8) == 3); -static_assert(highestBit(uint64_t(1) << 31) == 31); -static_assert(highestBit(uint64_t(1) << 63) == 63); +static_assert(highestBit(static_cast(1) << 31) == 31); +static_assert(highestBit(static_cast(1) << 63) == 63); struct McInt { - ox::Array data{}; + Array data{}; // length of integer in bytes - std::size_t length = 0; + size_t length = 0; }; -template +template [[nodiscard]] -constexpr McInt encodeInteger(I pInput) noexcept { - auto const input = ox::ResizedInt_t{pInput}; +constexpr McInt encodeInteger(I const pInput) noexcept { + auto const input = ResizedInt_t{pInput}; McInt out; - const auto inputNegative = is_signed_v && input < 0; - // move input to uint64_t to allow consistent bit manipulation, and to avoid + auto const inputNegative = is_signed_v && input < 0; + // move input to uint64_t to allow consistent bit manipulation and to avoid // overflow concerns - uint64_t val = 0; - OX_ALLOW_UNSAFE_BUFFERS_BEGIN - ox::memcpy(&val, &input, sizeof(input)); - OX_ALLOW_UNSAFE_BUFFERS_END + auto const val = std::bit_cast(input); if (val) { // bits needed to represent number factoring in space possibly // needed for signed bit - const auto highBit = inputNegative ? highestBit(~val) : highestBit(val); - const auto bits = highBit + 1 + (is_signed_v ? 1 : 0); + auto const highBit = inputNegative ? highestBit(~val) : highestBit(val); + auto const bits = highBit + 1 + (is_signed_v ? 1 : 0); // bytes needed to store value - std::size_t bytes = bits / 8 + (bits % 8 != 0); - const auto bitsAvailable = bytes * 8; // bits available to integer value - const auto bitsNeeded = bits + bytes; + size_t bytes = bits / 8 + (bits % 8 != 0); + auto const bitsAvailable = bytes * 8; // bits available to integer value + auto const bitsNeeded = bits + bytes; // factor in bits needed for bytesIndicator (does not affect bytesIndicator) // bits for integer + bits needed to represent bytes > bits available if (bitsNeeded > bitsAvailable && bytes != 9) { ++bytes; } - const auto bytesIndicator = onMask(bytes - 1); + auto const bytesIndicator = onMask(bytes - 1); // ensure we are copying from little endian representation LittleEndian leVal = val; if (inputNegative) { @@ -103,9 +100,9 @@ constexpr McInt encodeInteger(I pInput) noexcept { out.data[1] |= 0b1000'0000; } } else { - const auto valBits = bytes * 8; - uint64_t negBit = inputNegative ? 1 : 0; - auto intermediate = + auto const valBits = bytes * 8; + uint64_t const negBit = inputNegative ? 1 : 0; + auto const intermediate = static_cast(leVal.raw() | (negBit << (valBits - 1))) << bytes | static_cast(bytesIndicator); OX_ALLOW_UNSAFE_BUFFERS_BEGIN @@ -122,8 +119,8 @@ constexpr McInt encodeInteger(I pInput) noexcept { * length integer. */ [[nodiscard]] -constexpr std::size_t countBytes(unsigned b) noexcept { - std::size_t i = 0; +constexpr size_t countBytes(unsigned const b) noexcept { + size_t i = 0; while ((b >> i) & 1) ++i; return i + 1; } @@ -138,12 +135,12 @@ static_assert(countBytes(0b0011'1111) == 7); static_assert(countBytes(0b0111'1111) == 8); static_assert(countBytes(0b1111'1111) == 9); -template -constexpr Result decodeInteger(Reader_c auto&rdr, std::size_t &bytesRead) noexcept { +template +constexpr Result decodeInteger(Reader_c auto &rdr, size_t &bytesRead) noexcept { uint8_t firstByte = 0; OX_RETURN_ERROR(rdr.read(&firstByte, 1)); OX_RETURN_ERROR(rdr.seekg(-1, ox::ios_base::cur)); - const auto bytes = countBytes(firstByte); + auto const bytes = countBytes(firstByte); if (bytes == 9) { bytesRead = bytes; I out = 0; @@ -157,20 +154,20 @@ constexpr Result decodeInteger(Reader_c auto&rdr, std::size_t &bytesRead) noe decoded >>= bytes; // move sign bit if constexpr(is_signed_v) { - const auto negBit = bytes * 8 - bytes - 1; + auto const negBit = bytes * 8 - bytes - 1; // move sign - const auto negative = (decoded >> negBit) == 1; + auto const negative = (decoded >> negBit) == 1; if (negative) { // fill in all bits between encoded sign and real sign with 1s // split it up because the 32-bit ARM can't shift more than 32 bits - ox::Array d = {}; + Array d = {}; //d[0] = decoded & 0xffff'ffff; //d[1] = decoded >> 32; OX_ALLOW_UNSAFE_BUFFERS_BEGIN ox::memcpy(&d[0], &decoded, sizeof(decoded)); OX_ALLOW_UNSAFE_BUFFERS_END auto bit = negBit; - for (; bit < ox::min(Bits, 32); ++bit) { + for (; bit < ox::min(Bits, 32); ++bit) { d[0] |= 1 << bit; } bit -= 32; @@ -179,7 +176,7 @@ constexpr Result decodeInteger(Reader_c auto&rdr, std::size_t &bytesRead) noe } I out = 0; if constexpr(ox::defines::BigEndian) { - const auto d0Tmp = d[0]; + auto const d0Tmp = d[0]; d[0] = d[1]; d[1] = d0Tmp; } @@ -192,9 +189,9 @@ constexpr Result decodeInteger(Reader_c auto&rdr, std::size_t &bytesRead) noe return static_cast(decoded); } -template -Result decodeInteger(McInt m) noexcept { - std::size_t bytesRead{}; +template +Result decodeInteger(McInt const &m) noexcept { + size_t bytesRead{}; BufferReader br({reinterpret_cast(m.data.data()), 9}); return decodeInteger(br, bytesRead); } diff --git a/deps/nostalgia/deps/ox/src/ox/mc/mc.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/mc.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/mc/mc.hpp rename to deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/mc.hpp diff --git a/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/presenceindicator.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/presenceindicator.hpp new file mode 100644 index 0000000..7d5e8d5 --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/presenceindicator.hpp @@ -0,0 +1,122 @@ +/* + * Copyright 2015 - 2025 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "err.hpp" + +namespace ox { + +template +class FieldBitmapReader { + protected: + mutable size_t m_mapBlockIdx = ~size_t{}; + mutable uint64_t m_mapBlock{}; + size_t m_mapStart{}; + Reader &m_reader; + + public: + explicit constexpr FieldBitmapReader(Reader &reader) noexcept: + m_mapStart(reader.tellg()), + m_reader(reader) { + } + + constexpr Result get(size_t idx) const noexcept { + constexpr auto blockBits = sizeof(m_mapBlock); + auto const blockIdx = idx / blockBits; + if (m_mapBlockIdx != blockIdx) [[unlikely]] { + OX_RETURN_ERROR(loadMapBlock(blockIdx)); + } + idx %= blockBits; + return (m_mapBlock >> idx) & 1; + } + + private: + constexpr Error loadMapBlock(size_t const idx) const noexcept { + OX_REQUIRE(g, m_reader.tellg()); + OX_RETURN_ERROR(m_reader.seekg(static_cast(m_mapStart + idx), ox::ios_base::beg)); + Array mapBlock{}; + OX_RETURN_ERROR(m_reader.read(mapBlock.data(), sizeof(m_mapBlock))); + // Warning: narrow-conv + OX_RETURN_ERROR(m_reader.seekg(static_cast(g), ox::ios_base::beg)); + m_mapBlock = 0; + for (uint64_t i{}; auto b : mapBlock) { + m_mapBlock |= static_cast(std::bit_cast(b)) << i; + i += 8; + } + m_mapBlockIdx = idx; + return {}; + } + +}; + + +class FieldBitmapWriter { + protected: + Span m_map; + size_t m_mapLen{}; + + public: + explicit constexpr FieldBitmapWriter(Span const &map) noexcept: + m_map(map), + m_mapLen(m_map.size()) { + } + + constexpr auto setBuffer(Span const &map) noexcept { + m_map = map; + m_mapLen = map.size(); + } + + constexpr Result get(size_t const i) const noexcept { + if (i / 8 < m_mapLen) { + return (std::bit_cast(m_map[i / 8]) >> (i % 8)) & 1; + } + return Error{McPresenceMapOverflow}; + } + + constexpr Error setFields(int const fields) noexcept { + m_mapLen = static_cast((fields / 8 + 1) - (fields % 8 == 0)); + if (m_mapLen > m_map.size()) [[unlikely]] { + return Error{McPresenceMapOverflow}; + } + return {}; + } + + constexpr void setMaxLen(int const maxLen) noexcept { + m_mapLen = static_cast(maxLen); + } + + constexpr int64_t getMaxLen() const noexcept { + return static_cast(m_mapLen); + } + + constexpr Error set(size_t const i, bool const on) noexcept { + if (i / 8 < m_mapLen) { + char &actual = m_map[i / 8]; + uint8_t v = std::bit_cast(actual); + if (on) { + v |= 1 << (i % 8); + } else { + v &= ~static_cast(1 << (i % 8)); + } + actual = std::bit_cast(v); + return {}; + } + return Error{McPresenceMapOverflow}; + } + +}; + +} diff --git a/deps/nostalgia/deps/ox/src/ox/mc/read.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/read.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/mc/read.hpp rename to deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/read.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/mc/types.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/types.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/mc/types.hpp rename to deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/types.hpp diff --git a/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/write.hpp b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/write.hpp new file mode 100644 index 0000000..e8b92f1 --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/mc/include/ox/mc/write.hpp @@ -0,0 +1,358 @@ +/* + * Copyright 2015 - 2025 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "intops.hpp" +#include "err.hpp" +#include "presenceindicator.hpp" +#include "types.hpp" + +namespace ox { + +template +class MetalClawWriter: public ModelHandlerBase, OpType::Write> { + + private: + Vector m_presenceMapBuff{}; + FieldBitmapWriter m_fieldPresence{m_presenceMapBuff}; + int m_field{}; + Optional m_unionIdx; + size_t m_writerBeginP{}; + Writer &m_writer; + + public: + constexpr explicit MetalClawWriter(Writer &writer, Optional const &unionIdx = {}) noexcept; + + constexpr ~MetalClawWriter() noexcept = default; + + constexpr Error field(CString, Integer_c auto const *val) noexcept; + + constexpr Error field(CString, bool const *val) noexcept; + + template + constexpr Error field(CString, T const *val, size_t len) noexcept; + + template + constexpr Error field(CString name, HashMap const *val) noexcept; + + template + constexpr Error field(CString, BasicString const *val) noexcept; + + template + constexpr Error field(CString, IString const *val) noexcept; + + constexpr Error fieldCString(CString name, CString const*val, size_t buffLen) noexcept; + + constexpr Error fieldCString(CString name, CString *val) noexcept; + + constexpr Error fieldCString(CString name, CString const*val) noexcept; + + constexpr Error fieldCString(CString name, CString val, size_t strLen) noexcept; + + template + constexpr Error field(CString, T const *val) noexcept; + + template + constexpr Error field(CString, UnionView val) noexcept; + + template + constexpr Error setTypeInfo( + CString name = T::TypeName, + int version = T::TypeVersion, + Vector const& = {}, + size_t fields = ModelFieldCount_v) noexcept; + + /** + * stringLength is not implemented in MetalClawWriter + */ + [[nodiscard]] + constexpr auto stringLength(CString) noexcept { + return 0; + } + + /** + * stringLength is not implemented in MetalClawWriter + */ + [[nodiscard]] + constexpr auto arrayLength(CString, bool = true) noexcept { + return 0; + } + + constexpr Error finalize() noexcept; + + private: + constexpr Error appendInteger(Integer_c auto val) noexcept { + bool fieldSet = false; + if (val && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + auto mi = mc::encodeInteger(val); + OX_RETURN_ERROR(m_writer.write(reinterpret_cast(mi.data.data()), mi.length)); + fieldSet = true; + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; + } + +}; + +extern template class ModelHandlerInterface>; +extern template class ModelHandlerInterface>; + +template +constexpr MetalClawWriter::MetalClawWriter(Writer &writer, Optional const &unionIdx) noexcept: + m_unionIdx(unionIdx), + m_writerBeginP(writer.tellp()), + m_writer(writer) { +} + +template +constexpr Error MetalClawWriter::field(CString, Integer_c auto const *val) noexcept { + return appendInteger(*val); +} + +template +constexpr Error MetalClawWriter::field(CString, bool const *val) noexcept { + if (!m_unionIdx.has_value() || *m_unionIdx == m_field) { + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), *val)); + } + ++m_field; + return {}; +} + +template +template +constexpr Error MetalClawWriter::field(CString, BasicString const *val) noexcept { + bool fieldSet = false; + if (val->size() && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + // write the length + auto const strLen = mc::encodeInteger(val->size()); + OX_RETURN_ERROR(m_writer.write(reinterpret_cast(strLen.data.data()), strLen.length)); + // write the string + OX_RETURN_ERROR(m_writer.write(val->c_str(), static_cast(val->size()))); + fieldSet = true; + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; +} + +template +template +constexpr Error MetalClawWriter::field(CString name, IString const *val) noexcept { + return fieldCString(name, val->data(), val->size()); +} + +template +constexpr Error MetalClawWriter::fieldCString(CString, CString const *val, size_t) noexcept { + bool fieldSet = false; + if (!m_unionIdx.has_value() || *m_unionIdx == m_field) { + OX_ALLOW_UNSAFE_BUFFERS_BEGIN + // this strlen is tolerated because sometimes 0 gets passed to + // the size param, which is a lie + // this code should be cleaned up at some point... + auto const strLen = *val ? ox::strlen(*val) : 0; + OX_ALLOW_UNSAFE_BUFFERS_END + // write the length + auto const strLenBuff = mc::encodeInteger(strLen); + OX_RETURN_ERROR(m_writer.write(reinterpret_cast(strLenBuff.data.data()), strLenBuff.length)); + // write the string + OX_RETURN_ERROR(m_writer.write(*val, static_cast(strLen))); + fieldSet = true; + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; +} + +template +constexpr Error MetalClawWriter::fieldCString(CString const name, CString *val) noexcept { + return fieldCString(name, val, {}); +} + +template +constexpr Error MetalClawWriter::fieldCString(CString const name, CString const *val) noexcept { + return fieldCString(name, val, {}); +} + +template +constexpr Error MetalClawWriter::fieldCString(CString, CString const val, size_t const strLen) noexcept { + bool fieldSet = false; + if (strLen && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + // write the length + auto const strLenBuff = mc::encodeInteger(strLen); + OX_RETURN_ERROR(m_writer.write(reinterpret_cast(strLenBuff.data.data()), strLenBuff.length)); + // write the string + OX_RETURN_ERROR(m_writer.write(val, static_cast(strLen))); + fieldSet = true; + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; +} + +template +template +constexpr Error MetalClawWriter::field(CString, T const *val) noexcept { + if constexpr(isVector_v || isArray_v) { + return field(nullptr, val->data(), val->size()); + } else { + bool fieldSet = false; + if (val && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + auto const writeIdx = m_writer.tellp(); + MetalClawWriter writer(m_writer); + OX_RETURN_ERROR(model(writer.interface(), val)); + OX_RETURN_ERROR(writer.finalize()); + fieldSet = writeIdx != m_writer.tellp(); + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; + } +} + +template +template +constexpr Error MetalClawWriter::field(CString, UnionView val) noexcept { + bool fieldSet = false; + if (val.get() && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + auto const writeIdx = m_writer.tellp(); + MetalClawWriter writer(m_writer, Optional(in_place, val.idx())); + OX_RETURN_ERROR(model(writer.interface(), val.get())); + OX_RETURN_ERROR(writer.finalize()); + fieldSet = writeIdx != m_writer.tellp(); + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; +} + +template +template +constexpr Error MetalClawWriter::field(CString, T const *val, size_t const len) noexcept { + bool fieldSet = false; + if (len && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + // write the length + auto const arrLen = mc::encodeInteger(len); + OX_RETURN_ERROR(m_writer.write(reinterpret_cast(arrLen.data.data()), arrLen.length)); + auto const writeIdx = m_writer.tellp(); + MetalClawWriter writer(m_writer); + OX_RETURN_ERROR(writer.interface()->template setTypeInfo("List", 0, {}, static_cast(len))); + // write the array + for (size_t i{}; i < len; ++i) { +OX_ALLOW_UNSAFE_BUFFERS_BEGIN + OX_RETURN_ERROR(writer.interface()->field("", &val[i])); +OX_ALLOW_UNSAFE_BUFFERS_END + } + OX_RETURN_ERROR(writer.finalize()); + fieldSet = writeIdx != m_writer.tellp(); + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; +} + +template +template +constexpr Error MetalClawWriter::field(CString, HashMap const *val) noexcept { + auto const &keys = val->keys(); + auto const len = keys.size(); + bool fieldSet = false; + if (len && (!m_unionIdx.has_value() || *m_unionIdx == m_field)) { + // write the length + auto const arrLen = mc::encodeInteger(len); + OX_RETURN_ERROR(m_writer.write(reinterpret_cast(arrLen.data.data()), arrLen.length)); + // write map + MetalClawWriter writer(m_writer); + // double len for both key and value + OX_RETURN_ERROR(writer.interface()->setTypeInfo("Map", 0, {}, len * 2)); + // this loop body needs to be in a lambda because of the potential alloca call + constexpr auto loopBody = [](auto &handler, auto const &key, auto const &val) -> Error { + auto const keyLen = key.size(); + auto wkey = ox_malloca(keyLen + 1, char, 0); + memcpy(wkey.get(), key.c_str(), keyLen + 1); + OX_RETURN_ERROR(handler.fieldCString("", wkey.get(), keyLen)); + OX_REQUIRE_M(value, val.at(key)); + return handler.field("", value); + }; + // write the array + for (size_t i{}; i < len; ++i) { + auto const &key = keys[i]; + OX_RETURN_ERROR(loopBody(*writer.interface(), key, *val)); + } + OX_RETURN_ERROR(writer.finalize()); + fieldSet = true; + } + OX_RETURN_ERROR(m_fieldPresence.set(static_cast(m_field), fieldSet)); + ++m_field; + return {}; +} + +template +template +constexpr Error MetalClawWriter::setTypeInfo( + CString, + int, + Vector const&, + size_t const fields) noexcept { + auto const fieldPresenceLen = (fields - 1) / 8 + 1; + OX_RETURN_ERROR(m_writer.write(nullptr, fieldPresenceLen)); + m_presenceMapBuff.resize(fieldPresenceLen); + m_fieldPresence.setBuffer(m_presenceMapBuff); + return m_fieldPresence.setFields(static_cast(fields)); +} + +template +constexpr Error MetalClawWriter::finalize() noexcept { + auto const end = m_writer.tellp(); + OX_RETURN_ERROR(m_writer.seekp(m_writerBeginP)); + OX_RETURN_ERROR(m_writer.write( + m_presenceMapBuff.data(), + m_presenceMapBuff.size())); + OX_RETURN_ERROR(m_writer.seekp(end)); + return {}; +} + +Result writeMC(Writer_c auto &writer, auto const &val) noexcept { + MetalClawWriter mcWriter(writer); + OX_RETURN_ERROR(model(mcWriter.interface(), &val)); + OX_RETURN_ERROR(mcWriter.finalize()); + return {}; +} + +Result writeMC(auto const &val, size_t const buffReserveSz = 2 * units::KB) noexcept { + Buffer buff(buffReserveSz); + BufferWriter bw(&buff, 0); + OX_RETURN_ERROR(writeMC(bw, val)); + buff.resize(bw.tellp()); + return buff; +} + +Error writeMC(char *buff, size_t const buffLen, auto const &val, size_t *sizeOut = nullptr) noexcept { + CharBuffWriter bw{{buff, buffLen}}; + OX_RETURN_ERROR(writeMC(bw, val)); + if (sizeOut) { + *sizeOut = bw.tellp(); + } + return {}; +} + +} diff --git a/deps/nostalgia/deps/ox/src/ox/mc/read.cpp b/deps/nostalgia/deps/oxlib/src/mc/src/read.cpp similarity index 94% rename from deps/nostalgia/deps/ox/src/ox/mc/read.cpp rename to deps/nostalgia/deps/oxlib/src/mc/src/read.cpp index de3e603..8a77c0e 100644 --- a/deps/nostalgia/deps/ox/src/ox/mc/read.cpp +++ b/deps/nostalgia/deps/oxlib/src/mc/src/read.cpp @@ -10,7 +10,7 @@ #include #include -#include "read.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/mc/write.cpp b/deps/nostalgia/deps/oxlib/src/mc/src/write.cpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/mc/write.cpp rename to deps/nostalgia/deps/oxlib/src/mc/src/write.cpp index 80dea56..cc5fd9d 100644 --- a/deps/nostalgia/deps/ox/src/ox/mc/write.cpp +++ b/deps/nostalgia/deps/oxlib/src/mc/src/write.cpp @@ -11,7 +11,7 @@ #include #include -#include "write.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/mc/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/mc/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/mc/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/mc/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/mc/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/mc/test/tests.cpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/mc/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/mc/test/tests.cpp index 0f975a9..9b90513 100644 --- a/deps/nostalgia/deps/ox/src/ox/mc/test/tests.cpp +++ b/deps/nostalgia/deps/oxlib/src/mc/test/tests.cpp @@ -43,14 +43,14 @@ struct TestStruct { int32_t Int6 = 0; int32_t Int7 = 0; int32_t Int8 = 0; - int unionIdx = 1; + int32_t unionIdx = 1; TestUnion Union; ox::String String; ox::IString<32> IString = ""; uint32_t List[4] = {0, 0, 0, 0}; ox::Vector Vector = {1, 2, 3, 4, 5}; ox::Vector Vector2 = {1, 2, 3, 4, 5}; - ox::HashMap Map; + ox::HashMap Map; TestStructNest EmptyStruct; TestStructNest Struct; constexpr ~TestStruct() noexcept { @@ -204,7 +204,8 @@ std::map tests = { std::cout << "val.length: " << val.length << '\n'; return ox::Error(1); } - ox::LittleEndian decoded = *reinterpret_cast(&val.data[1]); + ox::LittleEndian decoded; + ox::memcpy(&decoded, &val.data[1], sizeof(decoded)); if (expected != decoded) { std::cout << "decoded: " << decoded << ", expected: " << expected << '\n'; return ox::Error(1); @@ -370,7 +371,7 @@ std::map tests = { const auto [type, typeErr] = ox::buildTypeDef(typeStore, testIn); oxAssert(typeErr, "Descriptor write failed"); ox::BufferReader br({dataBuff, dataBuffLen}); - OX_RETURN_ERROR(ox::walkModel(type, br, + return ox::walkModel(type, br, [](const ox::Vector&, const ox::Vector&, const ox::DescriptorField &f, ox::MetalClawReader *rdr) -> ox::Error { //std::cout << f.fieldName.c_str() << '\n'; auto fieldName = f.fieldName.c_str(); @@ -455,8 +456,7 @@ std::map tests = { } return ox::Error(0); } - )); - return ox::Error(0); + ); } }, } diff --git a/deps/nostalgia/deps/oxlib/src/model/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/model/CMakeLists.txt new file mode 100644 index 0000000..a3fc725 --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/model/CMakeLists.txt @@ -0,0 +1,45 @@ +add_library( + OxModel + src/desctypes.cpp + src/descwrite.cpp + src/modelvalue.cpp +) + +if(NOT MSVC) + target_compile_options(OxModel PRIVATE -Wconversion) + target_compile_options(OxModel PRIVATE -Wsign-conversion) +endif() + +target_link_libraries( + OxModel PUBLIC + OxStd +) + +if(NOT OX_BARE_METAL) + set_property( + TARGET + OxModel + PROPERTY + POSITION_INDEPENDENT_CODE ON + ) +endif() + +target_link_libraries( + OxModel PUBLIC + OxStd +) + +target_include_directories( + OxModel PUBLIC + include +) + +install( + TARGETS OxModel + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(OX_RUN_TESTS) + add_subdirectory(test) +endif() diff --git a/deps/nostalgia/deps/ox/src/ox/model/definition-language.txt b/deps/nostalgia/deps/oxlib/src/model/definition-language.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/definition-language.txt rename to deps/nostalgia/deps/oxlib/src/model/definition-language.txt diff --git a/deps/nostalgia/deps/ox/src/ox/model/def.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/def.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/def.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/def.hpp diff --git a/deps/nostalgia/deps/oxlib/src/model/include/ox/model/definition-language.txt b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/definition-language.txt new file mode 100644 index 0000000..70a4080 --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/definition-language.txt @@ -0,0 +1,7 @@ + : + : | + : + : | + : + : <0: single> | <1: list> + : diff --git a/deps/nostalgia/deps/ox/src/ox/model/descread.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/descread.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/descread.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/descread.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/desctypes.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/desctypes.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/desctypes.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/desctypes.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/descwrite.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/descwrite.hpp similarity index 81% rename from deps/nostalgia/deps/ox/src/ox/model/descwrite.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/descwrite.hpp index 1bd5c09..12d6729 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/descwrite.hpp +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/descwrite.hpp @@ -51,7 +51,7 @@ constexpr auto buildSubscriptStack(const T**, SubscriptStack *s) noexcept { } template -constexpr auto buildSubscriptStack(const UniquePtr*, SubscriptStack *s) noexcept { +constexpr auto buildSubscriptStack(const UPtr*, SubscriptStack *s) noexcept { s->push_back({.subscriptType = Subscript::SubscriptType::Ptr}); } @@ -126,22 +126,7 @@ class TypeDescWriter { private: [[nodiscard]] - constexpr const DescriptorType *type(const int8_t *val) const noexcept; - [[nodiscard]] - constexpr const DescriptorType *type(const int16_t *val) const noexcept; - [[nodiscard]] - constexpr const DescriptorType *type(const int32_t *val) const noexcept; - [[nodiscard]] - constexpr const DescriptorType *type(const int64_t *val) const noexcept; - - [[nodiscard]] - constexpr const DescriptorType *type(const uint8_t *val) const noexcept; - [[nodiscard]] - constexpr const DescriptorType *type(const uint16_t *val) const noexcept; - [[nodiscard]] - constexpr const DescriptorType *type(const uint32_t *val) const noexcept; - [[nodiscard]] - constexpr const DescriptorType *type(const uint64_t *val) const noexcept; + constexpr const DescriptorType *type(const Integer_c auto *val) const noexcept; [[nodiscard]] constexpr const DescriptorType *type(const bool *val) const noexcept; @@ -295,52 +280,26 @@ constexpr const DescriptorType *TypeDescWriter::type(UnionView val) const noe return t; } -constexpr const DescriptorType *TypeDescWriter::type(const int8_t*) const noexcept { - constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 1; - return getType(types::Int8, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const int16_t*) const noexcept { - constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 2; - return getType(types::Int16, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const int32_t*) const noexcept { - constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 4; - return getType(types::Int32, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const int64_t*) const noexcept { - constexpr auto PT = PrimitiveType::SignedInteger; - constexpr auto Bytes = 8; - return getType(types::Int64, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const uint8_t*) const noexcept { - constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 1; - return getType(types::Uint8, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const uint16_t*) const noexcept { - constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 2; - return getType(types::Uint16, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const uint32_t*) const noexcept { - constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 4; - return getType(types::Uint32, 0, PT, Bytes); -} - -constexpr const DescriptorType *TypeDescWriter::type(const uint64_t*) const noexcept { - constexpr auto PT = PrimitiveType::UnsignedInteger; - constexpr auto Bytes = 8; - return getType(types::Uint64, 0, PT, Bytes); +constexpr const DescriptorType *TypeDescWriter::type(Integer_c auto const *val) const noexcept { + constexpr auto isSigned = ox::is_signed_v; + constexpr auto PT = isSigned ? + PrimitiveType::SignedInteger : + PrimitiveType::UnsignedInteger; + constexpr auto sz = sizeof(*val); + constexpr auto bytes = sizeof(*val); + return getType([] { + switch (sz) { + case 1: + return isSigned ? types::Int8 : types::Uint8; + case 2: + return isSigned ? types::Int16 : types::Uint16; + case 4: + return isSigned ? types::Int32 : types::Uint32; + case 8: + return isSigned ? types::Int64 : types::Uint64; + } + return types::Int32; + }(), 0, PT, bytes); } constexpr const DescriptorType *TypeDescWriter::type(const bool*) const noexcept { diff --git a/deps/nostalgia/deps/ox/src/ox/model/fieldcounter.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/fieldcounter.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/fieldcounter.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/fieldcounter.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/metadata.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/metadata.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/metadata.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/metadata.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/model.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/model.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/model.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/model.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/modelhandleradaptor.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelhandleradaptor.hpp similarity index 73% rename from deps/nostalgia/deps/ox/src/ox/model/modelhandleradaptor.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelhandleradaptor.hpp index 4589f5b..3311f98 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/modelhandleradaptor.hpp +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelhandleradaptor.hpp @@ -25,28 +25,28 @@ class ModelHandlerInterface { template constexpr ox::Error setTypeInfo( - const char* name = T::TypeName, + CString name = T::TypeName, int version = T::TypeVersion, - const Vector& typeParams = {}) noexcept { + Vector const &typeParams = {}) noexcept { return m_handler.template setTypeInfo(name, version, typeParams, ModelFieldCount_v); } template constexpr ox::Error setTypeInfo( - const char *name, + CString name, int version, - const Vector& typeParams, - std::size_t fields) noexcept { + Vector const &typeParams, + size_t fields) noexcept { return m_handler.template setTypeInfo(name, version, typeParams, fields); } - template - constexpr Error fieldCString(const char *name, char val[len]) noexcept { + template + constexpr Error fieldCString(CString name, char val[len]) noexcept { return m_handler.fieldCString(name, &val[0], len); } - template - constexpr Error fieldCString(const char *name, const char val[len]) noexcept requires(opType_v != OpType::Read) { + template + constexpr Error fieldCString(CString name, char const val[len]) noexcept requires(opType_v != OpType::Read) { if constexpr(opType_v != OpType::Read) { return m_handler.fieldCString(name, &val[0], len); } else { @@ -54,11 +54,11 @@ class ModelHandlerInterface { } } - constexpr Error fieldCString(const char *name, char **val) noexcept { + constexpr Error fieldCString(CString name, char **val) noexcept { return m_handler.fieldCString(name, val); } - constexpr Error fieldCString(const char *name, const char *const*val) noexcept requires(opType_v != OpType::Read) { + constexpr Error fieldCString(CString name, char const *const*val) noexcept requires(opType_v != OpType::Read) { // this check looks pointless, but it's to address a Clang bug if constexpr(opType_v != OpType::Read) { return m_handler.fieldCString(name, val); @@ -67,7 +67,7 @@ class ModelHandlerInterface { } } - constexpr Error fieldCString(const char *name, const char **val) noexcept requires(opType_v != OpType::Read) { + constexpr Error fieldCString(CString name, char const **val) noexcept requires(opType_v != OpType::Read) { // this check looks pointless, but it's to address a Clang bug if constexpr(opType_v != OpType::Read) { return m_handler.fieldCString(name, val); @@ -76,11 +76,11 @@ class ModelHandlerInterface { } } - constexpr Error fieldCString(const char *name, char **val, std::size_t buffLen) noexcept { + constexpr Error fieldCString(CString name, char **val, size_t buffLen) noexcept { return m_handler.fieldCString(name, val, buffLen); } - constexpr Error fieldCString(const char *name, const char **val, std::size_t buffLen) noexcept requires(opType_v != OpType::Read) { + constexpr Error fieldCString(CString name, char const **val, size_t buffLen) noexcept requires(opType_v != OpType::Read) { // this check looks pointless, but it's to address a Clang bug if constexpr(opType_v != OpType::Read) { return m_handler.fieldCString(name, val, buffLen); @@ -89,11 +89,11 @@ class ModelHandlerInterface { } } - constexpr Error fieldCString(const char *name, char *val, std::size_t buffLen) noexcept { + constexpr Error fieldCString(CString name, char *val, size_t buffLen) noexcept { return m_handler.fieldCString(name, val, buffLen); } - constexpr Error fieldModelValue(const char *name, CommonPtrWith auto *v) noexcept { + constexpr Error fieldModelValue(char const *name, CommonPtrWith auto *v) noexcept { switch (v->type()) { case ModelValue::Type::Undefined: break; @@ -123,10 +123,10 @@ class ModelHandlerInterface { { auto &u = v->template get(); if constexpr(opType_v == OpType::Read) { - u.setActiveField(m_handler.whichFieldPresent(name, u)); + u.setActiveField(whichFieldPresent(m_handler, name, u)); return m_handler.field(name, UnionView(&u, u.unionIdx())); } else { - return m_handler.field(name, UnionView(&u, u.unionIdx())); + return m_handler.field(name, UnionView(&u, u.unionIdx())); } } case ModelValue::Type::Vector: @@ -141,12 +141,12 @@ class ModelHandlerInterface { // array handler, with callback to allow handling individual elements template - constexpr Error field(const char *name, Callback cb) noexcept { + constexpr Error field(CString name, Callback cb) noexcept { return m_handler.template field(name, cb); } template - constexpr Error field(const char *name, const T *v) noexcept { + constexpr Error field(CString name, const T *v) noexcept { if constexpr(ox::is_same_v) { return fieldModelValue(name, v); } else { @@ -155,7 +155,7 @@ class ModelHandlerInterface { } template - constexpr Error field(const char *name, T *v) noexcept { + constexpr Error field(CString name, T *v) noexcept { if constexpr(ox::is_same_v) { return fieldModelValue(name, v); } else { @@ -164,11 +164,11 @@ class ModelHandlerInterface { } template - constexpr Error field(const char *name, UnionView val) noexcept { + constexpr Error field(CString name, UnionView val) noexcept { return m_handler.field(name, val); } - constexpr Error field(const char *name, auto *val, std::size_t len) noexcept { + constexpr Error field(CString name, auto *val, size_t len) noexcept { return m_handler.field(name, val, len); } @@ -178,7 +178,7 @@ class ModelHandlerInterface { * @param pass indicates that the parsing should iterate past the array length */ [[nodiscard]] - constexpr auto arrayLength(const char *name, bool pass = true) noexcept { + constexpr auto arrayLength(CString name, bool pass = true) noexcept { return m_handler.arrayLength(name, pass); } @@ -186,7 +186,7 @@ class ModelHandlerInterface { * Reads an string length from the current location in the buffer. */ [[nodiscard]] - constexpr auto stringLength(const char *name) noexcept { + constexpr auto stringLength(CString name) noexcept { return m_handler.stringLength(name); } @@ -199,6 +199,20 @@ class ModelHandlerInterface { constexpr auto handler() noexcept { return m_handler; } + + private: + template + static constexpr int whichFieldPresent(H &h, CString name, ModelUnion const &u) noexcept + requires(H::opType() == OpType::Read) { + return h.whichFieldPresent(name, u); + } + + template + static constexpr int whichFieldPresent(H&, CString, ModelUnion const&) noexcept + requires(H::opType() != OpType::Read) { + return 0; + } + }; template diff --git a/deps/nostalgia/deps/ox/src/ox/model/modelops.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelops.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/modelops.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelops.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/modelvalue.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelvalue.hpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/model/modelvalue.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelvalue.hpp index 251ac40..5b22936 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/modelvalue.hpp +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/modelvalue.hpp @@ -200,8 +200,6 @@ class ModelValue { template constexpr Error set(T &&v) noexcept; - constexpr ModelValue &operator=(ModelValue &val) noexcept; - constexpr ModelValue &operator=(const ModelValue &val) noexcept; constexpr ModelValue &operator=(ModelValue &&val) noexcept; @@ -521,7 +519,7 @@ class ModelObject { protected: OX_MODEL_FRIEND(ModelObject); friend ModelValue; - Vector> m_fieldsOrder; + Vector> m_fieldsOrder; HashMap m_fields; const DescriptorType *m_type = nullptr; @@ -694,7 +692,7 @@ class ModelUnion { }; friend constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept; friend ModelValue; - Vector> m_fieldsOrder; + Vector> m_fieldsOrder; HashMap m_fields; const DescriptorType *m_type = nullptr; int m_unionIdx = -1; @@ -720,14 +718,14 @@ class ModelUnion { m_unionIdx = other.m_unionIdx; } - static constexpr Result> make(const DescriptorType *type) noexcept { - UniquePtr out(new ModelUnion); + static constexpr Result> make(const DescriptorType *type) noexcept { + UPtr out(new ModelUnion); OX_RETURN_ERROR(out->setType(type)); return out; } - static constexpr Result> make(const ModelUnion &other) noexcept { - return UniquePtr(new ModelUnion(other)); + static constexpr Result> make(const ModelUnion &other) noexcept { + return UPtr(new ModelUnion(other)); } constexpr ox::Result at(StringView const&k) noexcept { @@ -1176,7 +1174,7 @@ template constexpr Error ModelValue::set(const T &v) noexcept { constexpr auto type = getType(); if (m_type != type) [[unlikely]] { - return ox::Error(1, "type mismatch"); + return Error(1, "type mismatch"); } auto &value = getValue(*this); if constexpr(type == Type::Vector || type == Type::Object || @@ -1202,10 +1200,6 @@ constexpr Error ModelValue::set(T &&v) noexcept { return {}; } -constexpr ModelValue &ModelValue::operator=(ModelValue &other) noexcept { - return this->operator=(const_cast(other)); -} - constexpr ModelValue &ModelValue::operator=(const ModelValue &other) noexcept { if (this == &other) [[unlikely]] { return *this; diff --git a/deps/nostalgia/deps/ox/src/ox/model/optype.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/optype.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/optype.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/optype.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/typenamecatcher.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/typenamecatcher.hpp similarity index 57% rename from deps/nostalgia/deps/ox/src/ox/model/typenamecatcher.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/typenamecatcher.hpp index 4c5cd77..70357a7 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/typenamecatcher.hpp +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/typenamecatcher.hpp @@ -17,76 +17,34 @@ namespace ox { -struct TypeNameCatcher { - - const char *name = ""; - int version = 0; - - constexpr TypeNameCatcher() noexcept = default; - - template - constexpr ox::Error setTypeInfo( - const char *n = T::TypeName, - int v = T::TypeVersion, - const Vector& = {}, - std::size_t = ModelFieldCount_v) noexcept { - this->name = n; - this->version = v; - return {}; - } - - - template - constexpr Error field(const char*, T*, std::size_t) noexcept { - return {}; - } - - template - constexpr Error field(const char*, T) noexcept { - return {}; - } - - template - constexpr Error fieldCString(Args&&...) noexcept { - return {}; - } - - static constexpr auto opType() noexcept { - return OpType::Reflect; - } - -}; - struct TypeInfoCatcher { - const char *name = ""; + CString name = ""; int version = 0; - constexpr TypeInfoCatcher() noexcept = default; - template - constexpr ox::Error setTypeInfo( - const char *n = T::TypeName, - int v = T::TypeVersion, - const Vector& = {}, - std::size_t = 0) noexcept { + constexpr Error setTypeInfo( + CString const n = T::TypeName, + int const v = T::TypeVersion, + Vector const& = {}, + size_t = 0) noexcept { this->name = n; this->version = v; return {}; } template - constexpr Error field(const char*, T*, std::size_t) noexcept { + constexpr Error field(CString, T*, size_t) noexcept { return {}; } template - constexpr Error field(const char*, T) noexcept { + constexpr Error field(CString, T const&) noexcept { return {}; } template - constexpr Error fieldCString(const char*, T) noexcept { + constexpr Error fieldCString(CString, T const&) noexcept { return {}; } @@ -125,14 +83,14 @@ consteval int requireModelTypeVersion() noexcept { template [[nodiscard]] constexpr Str getModelTypeName(T *val) noexcept { - TypeNameCatcher nc; + TypeInfoCatcher nc; std::ignore = model(&nc, val); return nc.name; } template [[nodiscard]] -constexpr Str getModelTypeName() noexcept { +consteval Str getModelTypeName() noexcept { std::allocator a; auto t = a.allocate(1); auto out = getModelTypeName(t); @@ -140,15 +98,15 @@ constexpr Str getModelTypeName() noexcept { return out; } -template +template [[nodiscard]] consteval auto requireModelTypeName() noexcept { constexpr auto name = getModelTypeName(); - static_assert(ox::StringView{name}.size(), "Type lacks required TypeName"); + static_assert(StringView{name}.size(), "Type lacks required TypeName"); return name; } -template +template constexpr auto ModelTypeName_v = requireModelTypeName(); template @@ -156,10 +114,10 @@ constexpr auto ModelTypeVersion_v = requireModelTypeVersion(); template constexpr auto ModelTypeId_v = [] { - constexpr auto name = ModelTypeName_v; + constexpr auto name = ModelTypeName_v; constexpr auto version = ModelTypeVersion_v; - constexpr auto versionStr = ox::sfmt>("{}", version); - return ox::sfmt>("{};{}", name, versionStr); + constexpr auto versionStr = ox::sfmt>("{}", version); + return ox::sfmt>("{};{}", name, versionStr); }(); } diff --git a/deps/nostalgia/deps/ox/src/ox/model/types.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/types.hpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/model/types.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/types.hpp index 2256930..07f131f 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/types.hpp +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/types.hpp @@ -161,7 +161,7 @@ template constexpr bool isSmartPtr_v = false; template -constexpr bool isSmartPtr_v<::ox::UniquePtr> = true; +constexpr bool isSmartPtr_v<::ox::UPtr> = true; #if __has_include() template diff --git a/deps/nostalgia/deps/ox/src/ox/model/typestore.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/typestore.hpp similarity index 90% rename from deps/nostalgia/deps/ox/src/ox/model/typestore.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/typestore.hpp index 3646c3b..3c0baf7 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/typestore.hpp +++ b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/typestore.hpp @@ -21,7 +21,7 @@ namespace ox { class TypeStore { private: - HashMap> m_cache; + HashMap> m_cache; public: constexpr TypeStore() noexcept = default; @@ -86,12 +86,12 @@ class TypeStore { return getLoad(typeName, typeVersion); } - constexpr void set(const auto &typeId, UniquePtr dt) noexcept { + constexpr void set(const auto &typeId, UPtr dt) noexcept { m_cache[typeId] = std::move(dt); } constexpr void set(const auto &typeId, DescriptorType *dt) noexcept { - m_cache[typeId] = UniquePtr(dt); + m_cache[typeId] = UPtr(dt); } [[nodiscard]] @@ -105,11 +105,11 @@ class TypeStore { } protected: - virtual Result> loadDescriptor(ox::StringView) noexcept { + virtual Result> loadDescriptor(ox::StringView) noexcept { return ox::Error(1); } - Result> loadDescriptor(ox::StringViewCR name, int version, + Result> loadDescriptor(ox::StringViewCR name, int version, const ox::TypeParamPack &typeParams) noexcept { const auto typeId = buildTypeId(name, version, typeParams); return loadDescriptor(typeId); diff --git a/deps/nostalgia/deps/ox/src/ox/model/walk.hpp b/deps/nostalgia/deps/oxlib/src/model/include/ox/model/walk.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/walk.hpp rename to deps/nostalgia/deps/oxlib/src/model/include/ox/model/walk.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/model/desctypes.cpp b/deps/nostalgia/deps/oxlib/src/model/src/desctypes.cpp similarity index 89% rename from deps/nostalgia/deps/ox/src/ox/model/desctypes.cpp rename to deps/nostalgia/deps/oxlib/src/model/src/desctypes.cpp index f04b906..5f91325 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/desctypes.cpp +++ b/deps/nostalgia/deps/oxlib/src/model/src/desctypes.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "desctypes.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/model/descwrite.cpp b/deps/nostalgia/deps/oxlib/src/model/src/descwrite.cpp similarity index 97% rename from deps/nostalgia/deps/ox/src/ox/model/descwrite.cpp rename to deps/nostalgia/deps/oxlib/src/model/src/descwrite.cpp index 9421d51..fcba2b5 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/descwrite.cpp +++ b/deps/nostalgia/deps/oxlib/src/model/src/descwrite.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "descwrite.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/model/modelvalue.cpp b/deps/nostalgia/deps/oxlib/src/model/src/modelvalue.cpp similarity index 76% rename from deps/nostalgia/deps/ox/src/ox/model/modelvalue.cpp rename to deps/nostalgia/deps/oxlib/src/model/src/modelvalue.cpp index 97829e5..759c356 100644 --- a/deps/nostalgia/deps/ox/src/ox/model/modelvalue.cpp +++ b/deps/nostalgia/deps/oxlib/src/model/src/modelvalue.cpp @@ -6,19 +6,21 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "modelvalue.hpp" +#include + +#include namespace ox { -static_assert([]() -> ox::Error { - ox::ModelValue v; +static_assert([]() -> Error { + ModelValue v; OX_RETURN_ERROR(v.setType()); if (v.type() != ModelValue::Type::SignedInteger32) { - return ox::Error(1, "type is wrong"); + return Error(1, "type is wrong"); } //oxReturnError(v.set(5)); return {}; -}() == ox::Error{}); +}() == Error{}); // a dummy function to prevent linker errors in a library that has no other symbols void modelDummyFunc() noexcept {} diff --git a/deps/nostalgia/deps/ox/src/ox/model/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/model/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/model/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/model/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/model/test/tests.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/model/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/model/test/tests.cpp diff --git a/deps/nostalgia/deps/ox/src/ox/oc/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/oc/CMakeLists.txt similarity index 70% rename from deps/nostalgia/deps/ox/src/ox/oc/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/oc/CMakeLists.txt index 96d3d99..3f9352e 100644 --- a/deps/nostalgia/deps/ox/src/ox/oc/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/oc/CMakeLists.txt @@ -1,7 +1,7 @@ add_library( OxOrganicClaw - read.cpp - write.cpp + src/read.cpp + src/write.cpp ) if(NOT MSVC) @@ -27,18 +27,22 @@ set_property( POSITION_INDEPENDENT_CODE ON ) -install( - FILES - oc.hpp - read.hpp - write.hpp - DESTINATION - include/ox/oc +target_include_directories( + OxOrganicClaw PUBLIC + include ) -install(TARGETS OxOrganicClaw - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +install( + DIRECTORY + include/ox + DESTINATION + include +) + +install( + TARGETS OxOrganicClaw + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib ) if(OX_RUN_TESTS) diff --git a/deps/nostalgia/deps/ox/src/ox/oc/oc.hpp b/deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/oc.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/oc/oc.hpp rename to deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/oc.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/oc/read.hpp b/deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/read.hpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/oc/read.hpp rename to deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/read.hpp index 973bcda..ac29b8b 100644 --- a/deps/nostalgia/deps/ox/src/ox/oc/read.hpp +++ b/deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/read.hpp @@ -282,7 +282,7 @@ Error readOC(BufferView const buff, auto &val) noexcept { try { Json::Value doc; Json::CharReaderBuilder parserBuilder; - auto parser = UniquePtr(parserBuilder.newCharReader()); + auto const parser = UPtr(parserBuilder.newCharReader()); OX_ALLOW_UNSAFE_BUFFERS_BEGIN if (!parser->parse(buff.data(), buff.data() + buff.size(), &doc, nullptr)) { OX_ALLOW_UNSAFE_BUFFERS_END diff --git a/deps/nostalgia/deps/ox/src/ox/oc/write.hpp b/deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/write.hpp similarity index 76% rename from deps/nostalgia/deps/ox/src/ox/oc/write.hpp rename to deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/write.hpp index 1f22db2..cf405b9 100644 --- a/deps/nostalgia/deps/ox/src/ox/oc/write.hpp +++ b/deps/nostalgia/deps/oxlib/src/oc/include/ox/oc/write.hpp @@ -28,6 +28,7 @@ namespace ox { class OrganicClawWriter { + friend Error writeOC(Writer_c auto &writer, auto const &val) noexcept; friend Result writeOC(const auto &val) noexcept; friend Result writeOCString(const auto &val) noexcept; @@ -41,7 +42,7 @@ class OrganicClawWriter { explicit OrganicClawWriter(Json::Value json, int unionIdx = -1) noexcept; - Error field(const char *key, int8_t const *val) noexcept { + Error field(CString const key, int8_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { value(key) = *val; } @@ -49,7 +50,7 @@ class OrganicClawWriter { return {}; } - Error field(const char *key, int16_t const *val) noexcept { + Error field(CString const key, int16_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { value(key) = *val; } @@ -57,15 +58,15 @@ class OrganicClawWriter { return {}; } - Error field(const char *key, int32_t const *val) noexcept { + Error field(CString const key, int32_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { - value(key) = *val; + value(key) = static_cast(*val); } ++m_fieldIt; return {}; } - Error field(const char *key, int64_t const *val) noexcept { + Error field(CString const key, int64_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { value(key) = *val; } @@ -74,7 +75,7 @@ class OrganicClawWriter { } - Error field(const char *key, uint8_t const *val) noexcept { + Error field(CString const key, uint8_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { value(key) = *val; } @@ -82,7 +83,7 @@ class OrganicClawWriter { return {}; } - Error field(const char *key, uint16_t const *val) noexcept { + Error field(CString const key, uint16_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { value(key) = *val; } @@ -90,15 +91,15 @@ class OrganicClawWriter { return {}; } - Error field(const char *key, uint32_t const *val) noexcept { + Error field(CString const key, uint32_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { - value(key) = *val; + value(key) = static_cast(*val); } ++m_fieldIt; return {}; } - Error field(const char *key, uint64_t const *val) noexcept { + Error field(CString const key, uint64_t const *val) noexcept { if (targetValid() && (*val || m_json.isArray())) { value(key) = *val; } @@ -154,17 +155,17 @@ class OrganicClawWriter { return {}; } - Error fieldCString(const char*, const char *const *val, int len) noexcept; + Error fieldCString(CString, CString const *val, int len) noexcept; - Error fieldCString(const char *name, const char *const*val) noexcept; + Error fieldCString(CString name, CString const*val) noexcept; - Error field(const char *key, UUID const *uuid) noexcept; + Error field(CString key, UUID const *uuid) noexcept; template - Error field(const char*, T const *val, size_t len) noexcept; + Error field(CString, T const *val, size_t len) noexcept; template - Error field(const char*, T const *val) noexcept; + Error field(CString, T const *val) noexcept; template constexpr Error setTypeInfo( @@ -194,12 +195,12 @@ class OrganicClawWriter { } [[nodiscard]] - Json::Value &value(const char *key) noexcept; + Json::Value &value(CString key) noexcept; }; template -Error OrganicClawWriter::field(const char *key, T const *val, size_t const len) noexcept { +Error OrganicClawWriter::field(CString key, T const *val, size_t const len) noexcept { if (targetValid() && len) { OrganicClawWriter w((Json::Value(Json::arrayValue))); ModelHandlerInterface handler{w}; @@ -215,15 +216,15 @@ OX_ALLOW_UNSAFE_BUFFERS_END } template -Error OrganicClawWriter::field(const char *key, T const *val) noexcept { +Error OrganicClawWriter::field(CString key, T const *val) noexcept { if constexpr(is_integer_v) { if (targetValid() && (*val || m_json.isArray())) { // the int type needs to be normalized because jsoncpp doesn't // factor in every permutation unsigned long, etc. if constexpr(is_signed_v) { - value(key) = static_cast>(*val); + value(key) = static_cast(*val); } else { - value(key) = static_cast>(*val); + value(key) = static_cast(*val); } } } else if constexpr(isVector_v || isArray_v) { @@ -241,7 +242,7 @@ Error OrganicClawWriter::field(const char *key, T const *val) noexcept { } template -Error OrganicClawWriter::field(const char *key, UnionView val) noexcept { +Error OrganicClawWriter::field(CString key, UnionView val) noexcept { if (targetValid()) { OrganicClawWriter w(val.idx()); ModelHandlerInterface handler{w}; @@ -254,9 +255,19 @@ Error OrganicClawWriter::field(const char *key, UnionView val) noexcep 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 writeOC(auto const &val) noexcept { OrganicClawWriter writer; - ModelHandlerInterface handler(writer); + ModelHandlerInterface handler(writer); OX_RETURN_ERROR(model(&handler, &val)); Json::StreamWriterBuilder const jsonBuilder; auto const str = Json::writeString(jsonBuilder, writer.m_json); @@ -270,7 +281,7 @@ Result writeOC(auto const &val) noexcept { Result writeOCString(auto const &val) noexcept { OrganicClawWriter writer; - ModelHandlerInterface handler(writer); + ModelHandlerInterface handler(writer); OX_RETURN_ERROR(model(&handler, &val)); Json::StreamWriterBuilder const jsonBuilder; auto const str = Json::writeString(jsonBuilder, writer.m_json); diff --git a/deps/nostalgia/deps/ox/src/ox/oc/read.cpp b/deps/nostalgia/deps/oxlib/src/oc/src/read.cpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/oc/read.cpp rename to deps/nostalgia/deps/oxlib/src/oc/src/read.cpp index d20749f..e6d6c7d 100644 --- a/deps/nostalgia/deps/ox/src/ox/oc/read.cpp +++ b/deps/nostalgia/deps/oxlib/src/oc/src/read.cpp @@ -9,7 +9,7 @@ #include #include -#include "read.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/oc/write.cpp b/deps/nostalgia/deps/oxlib/src/oc/src/write.cpp similarity index 97% rename from deps/nostalgia/deps/ox/src/ox/oc/write.cpp rename to deps/nostalgia/deps/oxlib/src/oc/src/write.cpp index 618b930..189d747 100644 --- a/deps/nostalgia/deps/ox/src/ox/oc/write.cpp +++ b/deps/nostalgia/deps/oxlib/src/oc/src/write.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "write.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/oc/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/oc/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/oc/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/oc/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/oc/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/oc/test/tests.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/oc/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/oc/test/tests.cpp diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/preloader/CMakeLists.txt similarity index 73% rename from deps/nostalgia/deps/ox/src/ox/preloader/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/preloader/CMakeLists.txt index 3c98acd..757b91f 100644 --- a/deps/nostalgia/deps/ox/src/ox/preloader/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/preloader/CMakeLists.txt @@ -1,7 +1,7 @@ add_library( OxPreloader - preloader.cpp + src/preloader.cpp ) if(NOT MSVC) @@ -16,14 +16,16 @@ target_link_libraries( OxStd ) +target_include_directories( + OxPreloader PUBLIC + include +) + install( - FILES - alignmentcatcher.hpp - platspecs.hpp - preloader.hpp - unionsizecatcher.hpp + DIRECTORY + include/ox DESTINATION - include/nostalgia/preloader + include ) install( diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/alignmentcatcher.hpp b/deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/alignmentcatcher.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/preloader/alignmentcatcher.hpp rename to deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/alignmentcatcher.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/platspecs.hpp b/deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/platspecs.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/preloader/platspecs.hpp rename to deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/platspecs.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/preloader.hpp b/deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/preloader.hpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/preloader/preloader.hpp rename to deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/preloader.hpp index 29e8093..9fd30a6 100644 --- a/deps/nostalgia/deps/ox/src/ox/preloader/preloader.hpp +++ b/deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/preloader.hpp @@ -74,7 +74,7 @@ class Preloader: public ModelHandlerBase, OpType::Reflect> { const Preloader &operator=(const Preloader &src) = delete; const Preloader &operator=(Preloader &&src) = delete; - constexpr static ox::Result> make(ox::ios_base::seekdir anchor = ox::ios_base::cur, + constexpr static ox::Result> make(ox::ios_base::seekdir anchor = ox::ios_base::cur, std::size_t sz = 0) noexcept; template @@ -141,9 +141,9 @@ class Preloader: public ModelHandlerBase, OpType::Reflect> { }; template -constexpr ox::Result>> +constexpr ox::Result>> Preloader::make(ox::ios_base::seekdir anchor, std::size_t sz) noexcept { - auto p = ox::UniquePtr(new Preloader); + auto p = ox::UPtr(new Preloader); if (const auto err = p->m_writer.seekp(0, anchor)) { return {std::move(p), err}; } diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/sizecatcher.hpp b/deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/sizecatcher.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/preloader/sizecatcher.hpp rename to deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/sizecatcher.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/unionsizecatcher.hpp b/deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/unionsizecatcher.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/preloader/unionsizecatcher.hpp rename to deps/nostalgia/deps/oxlib/src/preloader/include/ox/preloader/unionsizecatcher.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/preloader/preloader.cpp b/deps/nostalgia/deps/oxlib/src/preloader/src/preloader.cpp similarity index 89% rename from deps/nostalgia/deps/ox/src/ox/preloader/preloader.cpp rename to deps/nostalgia/deps/oxlib/src/preloader/src/preloader.cpp index 732df29..b428bb5 100644 --- a/deps/nostalgia/deps/ox/src/ox/preloader/preloader.cpp +++ b/deps/nostalgia/deps/oxlib/src/preloader/src/preloader.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "preloader.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/std/CMakeLists.txt similarity index 51% rename from deps/nostalgia/deps/ox/src/ox/std/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/std/CMakeLists.txt index 67de0f9..d6dcd42 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/CMakeLists.txt +++ b/deps/nostalgia/deps/oxlib/src/std/CMakeLists.txt @@ -7,12 +7,12 @@ endif() if(OX_USE_STDLIB AND OX_ENABLE_TRACEHOOK) add_library( OxTraceHook SHARED - tracehook.cpp + src/tracehook.cpp ) else() add_library( OxTraceHook - tracehook.cpp + src/tracehook.cpp ) endif() @@ -25,27 +25,28 @@ target_compile_definitions( add_library( OxStd - assert.cpp - bit.cpp - buffer.cpp - buildinfo.cpp - byteswap.cpp - concepts.cpp - fmt.cpp - heapmgr.cpp - math.cpp - memops.cpp - random.cpp - reader.cpp - substitutes.cpp - stacktrace.cpp - string.cpp - stringview.cpp - strops.cpp - trace.cpp - typetraits.cpp - uuid.cpp - vec.cpp + src/assert.cpp + src/bit.cpp + src/buffer.cpp + src/buildinfo.cpp + src/byteswap.cpp + src/concepts.cpp + src/fmt.cpp + src/heapmgr.cpp + src/istreamreader.cpp + src/math.cpp + src/memops.cpp + src/random.cpp + src/reader.cpp + src/substitutes.cpp + src/stacktrace.cpp + src/string.cpp + src/stringview.cpp + src/strops.cpp + src/trace.cpp + src/typetraits.cpp + src/uuid.cpp + src/vec.cpp ) if(NOT MSVC) @@ -77,10 +78,10 @@ target_compile_definitions( $<$:OX_NODEBUG> ) -if(NOT WIN32) +if(NOT WIN32 AND NOT OX_BARE_METAL) target_link_libraries( OxStd PUBLIC - $<$:$<$:dl>> + dl ) endif() target_link_libraries( @@ -90,69 +91,27 @@ target_link_libraries( CityHash ) -install( - FILES - algorithm.hpp - array.hpp - assert.hpp - bit.hpp - bounds.hpp - istring.hpp - buffer.hpp - buildinfo.hpp - byteswap.hpp - concepts.hpp - conv.hpp - def.hpp - defer.hpp - defines.hpp - error.hpp - fmt.hpp - hardware.hpp - hash.hpp - hashmap.hpp - heapmgr.hpp - ignore.hpp - iterator.hpp - math.hpp - maybeview.hpp - memops.hpp - memory.hpp - new.hpp - optional.hpp - pair.hpp - point.hpp - random.hpp - ranges.hpp - serialize.hpp - size.hpp - smallmap.hpp - stacktrace.hpp - std.hpp - stddef.hpp - string.hpp - stringliteral.hpp - stringview.hpp - strongint.hpp - strconv.hpp - stringparam.hpp - strops.hpp - trace.hpp - typeinfo.hpp - types.hpp - typetraits.hpp - units.hpp - uuid.hpp - vec.hpp - vector.hpp - writer.hpp - DESTINATION - include/ox/std +target_include_directories( + OxStd PUBLIC + include ) -install(TARGETS OxStd OxTraceHook - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +target_include_directories( + OxTraceHook PUBLIC + include +) + +install( + DIRECTORY + include/ox + DESTINATION + include +) + +install( + TARGETS OxStd OxTraceHook + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib ) if(OX_RUN_TESTS) diff --git a/deps/nostalgia/deps/ox/src/ox/std/algorithm.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/algorithm.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/algorithm.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/algorithm.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/anyptr.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/anyptr.hpp similarity index 53% rename from deps/nostalgia/deps/ox/src/ox/std/anyptr.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/anyptr.hpp index 36a6ac9..42c2a9f 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/anyptr.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/anyptr.hpp @@ -22,7 +22,7 @@ class AnyPtrT { private: struct WrapBase { virtual constexpr ~WrapBase() = default; - virtual constexpr WrapBase *copyTo(ox::Span s) noexcept = 0; + virtual constexpr WrapBase *copyTo(Span s) const noexcept = 0; virtual constexpr operator bool() const noexcept = 0; virtual void free() noexcept = 0; }; @@ -32,7 +32,7 @@ class AnyPtrT { T *data{}; explicit constexpr Wrap(T *pData) noexcept: data(pData) { } - constexpr WrapBase *copyTo(ox::Span s) noexcept override { + constexpr WrapBase *copyTo(Span s) const noexcept override { oxAssert(s.size() >= sizeof(Wrap), "too small buffer"); if (std::is_constant_evaluated()) { return new Wrap(data); @@ -49,8 +49,10 @@ class AnyPtrT { } }; - WrapBase *m_wrapPtr{}; - ox::Array)> m_wrapData; + union { + WrapBase *m_wrapPtr{}; + AllocAlias> m_wrapData; + } m_data; public: constexpr AnyPtrT() noexcept = default; @@ -58,25 +60,25 @@ class AnyPtrT { template constexpr AnyPtrT(T *ptr) noexcept { if (std::is_constant_evaluated()) { - m_wrapPtr = new Wrap(ptr); + setWrapPtr(new Wrap(ptr)); } else { - m_wrapPtr = new(m_wrapData.data()) Wrap(ptr); + new(m_data.m_wrapData.data()) Wrap(ptr); } } - constexpr AnyPtrT(AnyPtrT const&other) noexcept requires(!unique) { + constexpr AnyPtrT(AnyPtrT const &other) noexcept requires(!unique) { if (other) { - m_wrapPtr = other.m_wrapPtr->copyTo(m_wrapData); + setWrapPtr(other.getWrapPtr()->copyTo(m_data.m_wrapData.buff)); } } constexpr AnyPtrT(AnyPtrT &&other) noexcept { if (other) { - m_wrapPtr = other.m_wrapPtr->copyTo(m_wrapData); + setWrapPtr(other.getWrapPtr()->copyTo(m_data.m_wrapData.buff)); if (std::is_constant_evaluated()) { - ox::safeDelete(m_wrapPtr); + ox::safeDelete(m_data.m_wrapPtr); } - other.m_wrapPtr = {}; + m_data.m_wrapData = {}; } } @@ -85,7 +87,7 @@ class AnyPtrT { free(); } if (std::is_constant_evaluated()) { - ox::safeDelete(m_wrapPtr); + ox::safeDelete(m_data.m_wrapPtr); } } @@ -94,25 +96,31 @@ class AnyPtrT { if constexpr(unique) { free(); } else if (std::is_constant_evaluated()) { - ox::safeDelete(m_wrapPtr); + ox::safeDelete(m_data.m_wrapPtr); } if (std::is_constant_evaluated()) { - m_wrapPtr = new Wrap(ptr); + setWrapPtr(new Wrap(ptr)); } else { - m_wrapPtr = new(m_wrapData.data()) Wrap(ptr); + new(m_data.m_wrapData.data()) Wrap(ptr); } return *this; } - constexpr AnyPtrT &operator=(AnyPtrT const&ptr) noexcept requires(!unique) { + constexpr AnyPtrT &operator=(AnyPtrT const &ptr) noexcept requires(!unique) { if (this != &ptr) { if (std::is_constant_evaluated()) { - ox::safeDelete(m_wrapPtr); + ox::safeDelete(m_data.m_wrapPtr); } - if (ptr) { - m_wrapPtr = ptr.m_wrapPtr->copyTo(m_wrapData); + if (std::is_constant_evaluated()) { + if (ptr) { + ptr.getWrapPtr()->copyTo(m_data.m_wrapData.buff); + } } else { - m_wrapPtr = nullptr; + if (ptr) { + setWrapPtr(ptr.getWrapPtr()->copyTo(m_data.m_wrapData.buff)); + } else { + setWrapPtr(nullptr); + } } } return *this; @@ -123,43 +131,65 @@ class AnyPtrT { if constexpr(unique) { free(); } else if (std::is_constant_evaluated()) { - ox::safeDelete(m_wrapPtr); + ox::safeDelete(m_data.m_wrapPtr); } if (ptr) { - m_wrapPtr = ptr.m_wrapPtr->copyTo(m_wrapData); + setWrapPtr(ptr.getWrapPtr()->copyTo(m_data.m_wrapData.buff)); if (std::is_constant_evaluated()) { - ox::safeDelete(ptr.m_wrapPtr); - ptr.m_wrapPtr = nullptr; + ox::safeDelete(ptr.m_data.m_wrapPtr); + setWrapPtr(nullptr); } } else { - m_wrapPtr = nullptr; + m_data = {}; } } return *this; } constexpr operator bool() const noexcept { - return m_wrapPtr && *m_wrapPtr; + return getWrapPtr() && *getWrapPtr(); } constexpr void free() noexcept { - if (m_wrapPtr) { - m_wrapPtr->free(); + if (auto p = getWrapPtr()) { + p->free(); } if (std::is_constant_evaluated()) { - ox::safeDelete(m_wrapPtr); + ox::safeDelete(m_data.m_wrapPtr); } - m_wrapPtr = nullptr; + m_data.m_wrapData = {}; } template [[nodiscard]] constexpr T *get() const noexcept { -#ifdef OX_BARE_METAL - return static_cast*>(m_wrapPtr)->data; -#else - return dynamic_cast*>(m_wrapPtr)->data; -#endif + if constexpr(defines::HasRTTI) { + return dynamic_cast const*>(getWrapPtr())->data; + } + return static_cast const*>(getWrapPtr())->data; + } + + private: + constexpr void setWrapPtr(WrapBase *ptr) noexcept { + if (std::is_constant_evaluated()) { + m_data.m_wrapPtr = ptr; + } + } + + constexpr WrapBase *getWrapPtr() noexcept { + if (std::is_constant_evaluated()) { + return m_data.m_wrapPtr; + } else { + return std::launder(reinterpret_cast(m_data.m_wrapData.data())); + } + } + + constexpr WrapBase const *getWrapPtr() const noexcept { + if (std::is_constant_evaluated()) { + return m_data.m_wrapPtr; + } else { + return std::launder(reinterpret_cast(m_data.m_wrapData.data())); + } } }; diff --git a/deps/nostalgia/deps/ox/src/ox/std/array.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/array.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/array.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/array.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/assert.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/assert.hpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/std/assert.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/assert.hpp index b531ff4..7300fed 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/assert.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/assert.hpp @@ -8,10 +8,6 @@ #pragma once -#if defined(OX_USE_STDLIB) -#include -#endif - #include "def.hpp" #include "defines.hpp" #include "error.hpp" diff --git a/deps/nostalgia/deps/ox/src/ox/std/basestringview.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/basestringview.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/basestringview.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/basestringview.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/bit.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/bit.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/bit.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/bit.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/bounds.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/bounds.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/bounds.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/bounds.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/buffer.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/buffer.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/buffer.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/buffer.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/buildinfo.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/buildinfo.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/buildinfo.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/buildinfo.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/byteswap.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/byteswap.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/byteswap.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/byteswap.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/concepts.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/concepts.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/concepts.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/concepts.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/conv.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/conv.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/conv.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/conv.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/cstringview.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/cstringview.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/cstringview.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/cstringview.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/cstrops.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/cstrops.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/cstrops.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/cstrops.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/def.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/def.hpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/std/def.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/def.hpp index 9af2bf4..aa11200 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/def.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/def.hpp @@ -63,6 +63,7 @@ constexpr void oxAssert(const ox::Error&, const char*) noexcept {} #if defined(_MSC_VER) #define ox_alloca(size) _alloca(size) #elif OX_USE_STDLIB +#include #define ox_alloca(size) alloca(size) #else #define ox_alloca(size) __builtin_alloca(size) diff --git a/deps/nostalgia/deps/ox/src/ox/std/defer.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/defer.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/defer.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/defer.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/defines.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/defines.hpp similarity index 94% rename from deps/nostalgia/deps/ox/src/ox/std/defines.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/defines.hpp index 63d75b0..04eeb25 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/defines.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/defines.hpp @@ -53,6 +53,12 @@ constexpr auto NDebug = true; constexpr auto NDebug = false; #endif +#if defined(OX_BARE_METAL) +constexpr auto HasRTTI = false; +#else +constexpr auto HasRTTI = true; +#endif + #if defined(__BIG_ENDIAN__) constexpr auto BigEndian = true; constexpr auto LittleEndian = false; diff --git a/deps/nostalgia/deps/oxlib/src/std/include/ox/std/errhandling.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/errhandling.hpp new file mode 100644 index 0000000..30dda7b --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/errhandling.hpp @@ -0,0 +1,67 @@ +/* +* Copyright 2015 - 2025 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include +#include + +namespace ox { + +template +constexpr Error call(F const &f, Args&&... args) noexcept { + try { + f(ox::forward(args)...); + return {}; + } catch (Exception const &e) { + return e.toError(); + } catch (...) { + return Error{1, "unknown exception"}; + } +} + +template +constexpr Error call(T &receiver, Method methodPtr, Args&&... args) noexcept { + try { + (receiver.*methodPtr)(ox::forward(args)...); + return {}; + } catch (Exception const &e) { + return e.toError(); + } catch (...) { + return Error{1, "unknown exception"}; + } +} + +template +constexpr void logCatch(F const &f, Args&&... args) noexcept { + try { + f(ox::forward(args)...); + } catch (Exception const &e) { + oxErrf("Caught exception: {} ({}:{})\n", e.what(), e.src.file_name(), e.src.line()); + } catch (std::exception const &e) { + oxErrf("Caught exception: {}\n", e.what()); + } catch (...) { + oxErr("Caught unknown exception\n"); + } +} + +template +constexpr void logCatch(T &receiver, Method methodPtr, Args&&... args) noexcept { + try { + (receiver.*methodPtr)(ox::forward(args)...); + } catch (Exception const &e) { + oxErrf("Caught exception: {} ({}:{})\n", e.what(), e.src.file_name(), e.src.line()); + } catch (std::exception const &e) { + oxErrf("Caught exception: {}\n", e.what()); + } catch (...) { + oxErr("Caught unknown exception\n"); + } +} + +} diff --git a/deps/nostalgia/deps/ox/src/ox/std/error.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/error.hpp similarity index 83% rename from deps/nostalgia/deps/ox/src/ox/std/error.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/error.hpp index 1826931..bc5266f 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/error.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/error.hpp @@ -37,7 +37,7 @@ using ErrorCode = uint16_t; struct [[nodiscard]] Error { std::source_location src; - ox::CString msg = nullptr; + CString msg = nullptr; ErrorCode errCode = 0; constexpr Error() noexcept = default; @@ -51,7 +51,7 @@ struct [[nodiscard]] Error { explicit constexpr Error( ErrorCode const errCode, - ox::CString msg, + CString const msg, std::source_location const &src = std::source_location::current()) noexcept: src{src}, msg{msg}, @@ -62,6 +62,26 @@ struct [[nodiscard]] Error { return errCode; } + /** + * Checks the Error to see if is not OK, and throws the Error as an ox::Exception if not. + */ + constexpr void checkThrow() const; + + constexpr Error reoriginate( + ErrorCode const pErrCode, + CString const pMsg = nullptr, + std::source_location const &pSrc = std::source_location::current()) const noexcept { + if (errCode) { + return Error{pErrCode, pMsg, pSrc}; + } + return Error{}; + } + + constexpr Error reoriginate( + std::source_location const &pSrc = std::source_location::current()) const noexcept { + return Error{errCode, msg, pSrc}; + } + }; [[nodiscard]] @@ -77,7 +97,7 @@ constexpr auto toStr(Error const &err) noexcept { struct Exception: public std::exception { std::source_location src; - ox::CString msg = nullptr; + CString msg = nullptr; ErrorCode errCode = 0; explicit Exception( @@ -88,7 +108,7 @@ struct Exception: public std::exception { explicit Exception( ErrorCode const errCode, - ox::CString msg, + CString const msg, std::source_location const &src = std::source_location::current()) noexcept: src{src}, msg{msg}, @@ -109,16 +129,24 @@ struct Exception: public std::exception { } }; + +constexpr void Error::checkThrow() const { + if (errCode) [[unlikely]] { + throw Exception{*this}; + } +} + + [[noreturn]] void panic( Error const &err, - char const *panicMsg, + CString panicMsg, std::source_location const &src = std::source_location::current()) noexcept; template struct [[nodiscard]] Result { - using type = typename remove_reference::type; + using type = remove_reference_t; T value; Error error; @@ -209,7 +237,7 @@ struct [[nodiscard]] Result { [[nodiscard]] constexpr T &unwrapThrow() & { if (error) { - throw ox::Exception(error); + throw Exception(error); } return value; } @@ -217,7 +245,7 @@ struct [[nodiscard]] Result { [[nodiscard]] constexpr T &&unwrapThrow() && { if (error) { - throw ox::Exception(error); + throw Exception(error); } return std::move(value); } @@ -317,6 +345,21 @@ struct [[nodiscard]] Result { return *this; } + constexpr Result reoriginate( + ErrorCode const pErrCode, + CString const pMsg = nullptr, + std::source_location const &pSrc = std::source_location::current()) const && noexcept { + if (error) { + return {std::move(value), Error{pErrCode, pMsg, pSrc}}; + } + return {std::move(value)}; + } + + constexpr Result reoriginate( + std::source_location const &pSrc = std::source_location::current()) const && noexcept { + return {std::move(value), Error{error.errCode, error.msg, pSrc}}; + } + }; namespace detail { diff --git a/deps/nostalgia/deps/ox/src/ox/std/fmt.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/fmt.hpp similarity index 67% rename from deps/nostalgia/deps/ox/src/ox/std/fmt.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/fmt.hpp index 1cde475..41d7077 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/fmt.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/fmt.hpp @@ -31,27 +31,27 @@ namespace ox { namespace detail { template -constexpr StringView toStringView(const StringView &s) noexcept { +constexpr StringView toStringView(StringViewCR s) noexcept { return s; } template -constexpr StringView toStringView(const char *s) noexcept { +constexpr StringView toStringView(CString const s) noexcept { return s; } template -constexpr StringView toStringView(const IString &s) noexcept { +constexpr StringView toStringView(IString const &s) noexcept { return s; } template -constexpr StringView toStringView(ox::StringLiteral s) noexcept { +constexpr StringView toStringView(StringLiteral const &s) noexcept { return s; } template -constexpr StringView toStringView(const BasicString &s) noexcept { +constexpr StringView toStringView(BasicString const &s) noexcept { return s; } @@ -62,20 +62,20 @@ constexpr #else inline #endif -StringView toStringView(const std::string &s) noexcept { +StringView toStringView(std::string const &s) noexcept { return s.c_str(); } #endif #if __has_include() template -inline StringView toStringView(const QString &s) noexcept { +inline StringView toStringView(QString const &s) noexcept { return s.toUtf8().data(); } #endif template -constexpr StringView toStringView(const auto&) noexcept requires(force) { +constexpr StringView toStringView(auto const&) noexcept requires(force) { return ""; } @@ -83,10 +83,10 @@ class FmtArg { private: static constexpr auto DataSz = 23; - ox::Array dataStr{}; + Array dataStr{}; template - constexpr StringView sv(const T &v, ox::Span dataStr) noexcept { + constexpr StringView sv(T const &v, Span dataStr) noexcept { if constexpr(is_bool_v) { return v ? "true" : "false"; } else if constexpr(is_integer_v) { @@ -99,25 +99,25 @@ class FmtArg { } public: - const StringView out = nullptr; + StringView const out; template - constexpr FmtArg(const T &v) noexcept: out(sv(v, dataStr)) { + constexpr FmtArg(T const &v) noexcept: out(sv(v, dataStr)) { } }; [[nodiscard]] -constexpr uint64_t argCount(StringView str) noexcept { +constexpr uint64_t argCount(StringViewCR str) noexcept { uint64_t cnt = 0; - const auto prev = [str](std::size_t i) -> char { + auto const prev = [str](std::size_t i) -> char { if (i > 0) { return str[i - 1]; } else { return '\0'; } }; - const auto next = [str](std::size_t i) -> char { + auto const next = [str](std::size_t i) -> char { if (i < str.bytes() - 1) { return str[i + 1]; } else { @@ -133,14 +133,14 @@ constexpr uint64_t argCount(StringView str) noexcept { } struct FmtSegment { - const char *str = nullptr; - unsigned length = 0; + CString str{}; + unsigned length{}; - constexpr bool operator==(const FmtSegment &o) const noexcept { + constexpr bool operator==(FmtSegment const &o) const noexcept { return length == o.length && ox::strncmp(str, o.str, length) == 0; } - constexpr bool operator!=(const FmtSegment &o) const noexcept { + constexpr bool operator!=(FmtSegment const &o) const noexcept { return length != o.length || ox::strncmp(str, o.str, length) != 0; } }; @@ -148,9 +148,9 @@ struct FmtSegment { template struct Fmt { static constexpr std::size_t size = sz; - ox::Array segments; + Array segments; - constexpr bool operator==(const Fmt &o) const noexcept { + constexpr bool operator==(Fmt const &o) const noexcept { for (std::size_t i = 0; i < sz; ++i) { if (segments[i] != o.segments[i]) { return false; @@ -162,16 +162,16 @@ struct Fmt { template [[nodiscard]] -constexpr Fmt fmtSegments(StringView fmt) noexcept { +constexpr Fmt fmtSegments(StringViewCR fmt) noexcept { Fmt out; - const auto prev = [fmt](std::size_t i) -> char { + auto const prev = [fmt](std::size_t const i) -> char { if (i > 0) { return fmt[i - 1]; } else { return '\0'; } }; - const auto next = [fmt](std::size_t i) -> char { + auto const next = [fmt](std::size_t const i) -> char { if (i < fmt.bytes() - 1) { return fmt[i + 1]; } else { @@ -197,23 +197,23 @@ constexpr Fmt fmtSegments(StringView fmt) noexcept { template [[nodiscard]] -constexpr StringType sfmt(StringView fmt, Args&&... args) noexcept { +constexpr StringType sfmt(StringViewCR fmt, Args&&... args) noexcept { assert(ox::detail::argCount(fmt) == sizeof...(args)); StringType out; - const auto fmtSegments = ox::detail::fmtSegments(fmt); - const auto &firstSegment = fmtSegments.segments[0]; + auto const fmtSegments = detail::fmtSegments(fmt); + auto const &firstSegment = fmtSegments.segments[0]; std::ignore = out.append(firstSegment.str, firstSegment.length); - const detail::FmtArg elements[sizeof...(args)] = {args...}; + detail::FmtArg const elements[sizeof...(args)] = {args...}; for (size_t i = 0; i < fmtSegments.size - 1; ++i) { std::ignore = out.append(elements[i].out); - const auto &s = fmtSegments.segments[i + 1]; + auto const &s = fmtSegments.segments[i + 1]; std::ignore = out.append(s.str, s.length); } return out; } template -constexpr Result join(auto const&d, auto const&list) { +constexpr Result join(auto const &d, auto const &list) { if (!list.size()) { return T(""); } diff --git a/deps/nostalgia/deps/ox/src/ox/std/hardware.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/hardware.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/hardware.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/hardware.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/hash.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/hash.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/hash.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/hash.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/hashmap.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/hashmap.hpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/std/hashmap.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/hashmap.hpp index 14a5392..38bbab1 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/hashmap.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/hashmap.hpp @@ -106,9 +106,12 @@ constexpr bool HashMap::operator==(HashMap const &other) const { if (m_keys != other.m_keys) { return false; } - for (int i = 0; i < m_keys.size(); ++i) { - auto &k = m_keys[i]; - if (at(k) != other.at(k)) { + for (auto &k : m_keys) { + auto const a = at(k).value; + auto const b = other.at(k).value; + if ( + a != b && // handle one being null and other not + (a && b && *a != *b)) { return false; } } @@ -196,7 +199,7 @@ constexpr std::size_t HashMap::size() const noexcept { } template -constexpr Vector const&HashMap::keys() const noexcept { +constexpr Vector const &HashMap::keys() const noexcept { return m_keys; } @@ -205,8 +208,8 @@ constexpr Vector HashMap::values() const noexcept { Vector out; out.reserve(m_keys.size()); for (auto const &p : m_pairs) { - if (out) { - out.emplace_back(p->value); + if (p) { + out.emplace_back(*p->value); } } return out; diff --git a/deps/nostalgia/deps/ox/src/ox/std/heapmgr.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/heapmgr.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/heapmgr.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/heapmgr.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/ignore.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/ignore.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/ignore.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/ignore.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/initializerlist.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/initializerlist.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/initializerlist.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/initializerlist.hpp diff --git a/deps/nostalgia/deps/oxlib/src/std/include/ox/std/istreamreader.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/istreamreader.hpp new file mode 100644 index 0000000..3980d04 --- /dev/null +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/istreamreader.hpp @@ -0,0 +1,33 @@ +/* + * Copyright 2015 - 2025 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#ifdef OX_USE_STDLIB +#include +#endif + +#include "reader.hpp" + +namespace ox { + +#ifdef OX_USE_STDLIB +class StreamReader: public Reader_v { + private: + std::istream &m_strm; + public: + constexpr explicit StreamReader(std::istream &stream) noexcept: m_strm(stream) {} + Result peek() const noexcept override; + Result read(char *v, size_t cnt) noexcept override; + Error seekg(size_t p) noexcept override; + Error seekg(int64_t p, ios_base::seekdir sd) noexcept override; + Result tellg() noexcept override; +}; +#endif + +} diff --git a/deps/nostalgia/deps/ox/src/ox/std/istring.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/istring.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/istring.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/istring.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/iterator.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/iterator.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/iterator.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/iterator.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/math.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/math.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/math.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/math.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/maybeview.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/maybeview.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/maybeview.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/maybeview.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/memops.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/memops.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/memops.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/memops.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/memory.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/memory.hpp similarity index 77% rename from deps/nostalgia/deps/ox/src/ox/std/memory.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/memory.hpp index f145d9a..308d8ca 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/memory.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/memory.hpp @@ -179,26 +179,26 @@ constexpr bool operator!=(std::nullptr_t, const SharedPtr &p2) noexcept { template -class UniquePtr { +class UPtr { private: T *m_t = nullptr; public: using value_type = T; - explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) { + explicit constexpr UPtr(T *t = nullptr) noexcept: m_t(t) { } - constexpr UniquePtr(UniquePtr&) = delete; + constexpr UPtr(UPtr&) = delete; - constexpr UniquePtr(const UniquePtr&) = delete; + constexpr UPtr(const UPtr&) = delete; template - constexpr UniquePtr(UniquePtr &&other) noexcept { + constexpr UPtr(UPtr &&other) noexcept { m_t = other.release(); } - constexpr ~UniquePtr() { + constexpr ~UPtr() { Deleter()(m_t); } @@ -213,24 +213,24 @@ class UniquePtr { return m_t; } - constexpr void reset(UniquePtr &&other = UniquePtr()) { + constexpr void reset(UPtr &&other = UPtr()) { auto t = m_t; m_t = other.release(); Deleter()(t); } - constexpr UniquePtr &operator=(UniquePtr const&other) = delete; + constexpr UPtr &operator=(UPtr const&other) = delete; template - constexpr UniquePtr &operator=(UniquePtr const&other) = delete; + constexpr UPtr &operator=(UPtr const&other) = delete; - constexpr UniquePtr &operator=(UniquePtr &&other) noexcept { + constexpr UPtr &operator=(UPtr &&other) noexcept { reset(std::move(other)); return *this; } template - constexpr UniquePtr &operator=(UniquePtr &&other) noexcept { + constexpr UPtr &operator=(UPtr &&other) noexcept { reset(std::move(other)); return *this; } @@ -249,37 +249,34 @@ class UniquePtr { }; -template -using UPtr = UniquePtr; - template -constexpr bool operator==(const UniquePtr &p1, const UniquePtr &p2) noexcept { +constexpr bool operator==(const UPtr &p1, const UPtr &p2) noexcept { return p1.get() == p2.get(); } template -constexpr bool operator==(const UniquePtr &p1, std::nullptr_t) noexcept { +constexpr bool operator==(const UPtr &p1, std::nullptr_t) noexcept { return p1.get() == nullptr; } template -constexpr bool operator==(std::nullptr_t, const UniquePtr &p2) noexcept { +constexpr bool operator==(std::nullptr_t, const UPtr &p2) noexcept { return p2.get() == nullptr; } template -constexpr bool operator!=(const UniquePtr &p1, const UniquePtr &p2) noexcept { +constexpr bool operator!=(const UPtr &p1, const UPtr &p2) noexcept { return p1.get() != p2.get(); } template -constexpr bool operator!=(const UniquePtr &p1, std::nullptr_t) noexcept { +constexpr bool operator!=(const UPtr &p1, std::nullptr_t) noexcept { return !p1.get(); } template -constexpr bool operator!=(std::nullptr_t, const UniquePtr &p2) noexcept { +constexpr bool operator!=(std::nullptr_t, const UPtr &p2) noexcept { return !p2.get(); } @@ -287,14 +284,14 @@ constexpr bool operator!=(std::nullptr_t, const UniquePtr &p2) noexcept { template [[nodiscard]] constexpr auto make_unique(Args&&... args) { - return UniquePtr(new T(ox::forward(args)...)); + return UPtr(new T(ox::forward(args)...)); } template [[nodiscard]] -constexpr Result> make_unique_catch(Args&&... args) noexcept { +constexpr Result> make_unique_catch(Args&&... args) noexcept { try { - return UniquePtr(new T(ox::forward(args)...)); + return UPtr(new T(ox::forward(args)...)); } catch (ox::Exception const&ex) { return ex.toError(); } diff --git a/deps/nostalgia/deps/ox/src/ox/std/new.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/new.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/new.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/new.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/optional.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/optional.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/optional.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/optional.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/pair.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/pair.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/pair.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/pair.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/point.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/point.hpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/std/point.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/point.hpp index 0d99d05..d6e60a1 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/point.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/point.hpp @@ -8,7 +8,7 @@ #pragma once -#include +#include #include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/random.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/random.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/random.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/random.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/range.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/range.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/range.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/range.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/ranges.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/ranges.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/ranges.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/ranges.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/reader.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/reader.hpp similarity index 78% rename from deps/nostalgia/deps/ox/src/ox/std/reader.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/reader.hpp index 5a6a1cd..8f4e13f 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/reader.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/reader.hpp @@ -8,10 +8,6 @@ #pragma once -#ifdef OX_USE_STDLIB -#include -#endif - #include "concepts.hpp" #include "error.hpp" #include "types.hpp" @@ -63,18 +59,4 @@ class ReaderT: public Reader_v { } }; -#ifdef OX_USE_STDLIB -class StreamReader: public Reader_v { - private: - std::istream &m_strm; - public: - constexpr explicit StreamReader(std::istream &stream) noexcept: m_strm(stream) {} - ox::Result peek() const noexcept override; - ox::Result read(char *v, std::size_t cnt) noexcept override; - ox::Error seekg(std::size_t p) noexcept override; - ox::Error seekg(int64_t p, ios_base::seekdir sd) noexcept override; - ox::Result tellg() noexcept override; -}; -#endif - } diff --git a/deps/nostalgia/deps/ox/src/ox/std/realstd.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/realstd.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/realstd.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/realstd.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/serialize.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/serialize.hpp similarity index 63% rename from deps/nostalgia/deps/ox/src/ox/std/serialize.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/serialize.hpp index 0690171..85b9621 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/serialize.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/serialize.hpp @@ -18,7 +18,7 @@ namespace ox { template struct VectorMemMap { - const std::size_t smallVecSize = 0; // not a map value + size_t const smallVecSize = 0; // not a map value typename PlatSpec::size_t size = 0; typename PlatSpec::size_t cap = 0; typename PlatSpec::PtrType items = 0; @@ -26,11 +26,11 @@ struct VectorMemMap { template [[nodiscard]] -constexpr auto sizeOf(const VectorMemMap *t) noexcept { - constexpr auto padding = [](std::size_t size, std::size_t al) { +constexpr auto sizeOf(VectorMemMap const *t) noexcept { + constexpr auto padding = [](size_t const size, size_t const al) { return size % al; }; - std::size_t size = 0; + size_t size = 0; if (t->smallVecSize) { size += t->smallVecSize; size += padding(size, PlatSpec::alignOf(t->size)); @@ -43,17 +43,17 @@ constexpr auto sizeOf(const VectorMemMap *t) noexcept { return size; } -template +template [[nodiscard]] -constexpr auto alignOf(const VectorMemMap&) noexcept { - const typename PlatSpec::size_t i = 0; +constexpr auto alignOf(VectorMemMap const&) noexcept { + typename PlatSpec::size_t const i = 0; return PlatSpec::alignOf(i); } template -constexpr ox::Error pad(Writer_c auto &w, const T *v) noexcept { - const auto a = PlatSpec::alignOf(*v); - const auto excess = w.tellp() % a; +constexpr Error pad(Writer_c auto &w, T const *v) noexcept { + auto const a = PlatSpec::alignOf(*v); + auto const excess = w.tellp() % a; if (excess) { return w.write(nullptr, a - excess); } else { @@ -62,7 +62,7 @@ constexpr ox::Error pad(Writer_c auto &w, const T *v) noexcept { } template -constexpr ox::Error serialize(Writer_c auto &w, const VectorMemMap &vm) noexcept { +constexpr Error serialize(Writer_c auto &w, VectorMemMap const &vm) noexcept { OX_RETURN_ERROR(w.write(nullptr, vm.smallVecSize)); OX_RETURN_ERROR(serialize(w, PlatSpec::correctEndianness(vm.size))); OX_RETURN_ERROR(serialize(w, PlatSpec::correctEndianness(vm.cap))); @@ -70,21 +70,20 @@ constexpr ox::Error serialize(Writer_c auto &w, const VectorMemMap &vm return {}; } -template -constexpr ox::Error serialize(Writer_c auto &w, T val) noexcept requires(is_integer_v) { - ox::Array tmp; - for (auto i = 0u; i < sizeof(T); ++i) { +constexpr Error serialize(Writer_c auto &w, Integral_c auto val) noexcept { + Array tmp; + for (auto i = 0u; i < sizeof(val); ++i) { tmp[i] = static_cast((val >> i * 8) & 255); } return w.write(tmp.data(), tmp.size()); -}; +} template -constexpr ox::Result> serialize(const T &in) noexcept { - ox::Array out = {}; +constexpr Result> serialize(T const &in) noexcept { + Array out = {}; CharBuffWriter w(out); OX_RETURN_ERROR(serialize(w, in)); return out; -}; +} } diff --git a/deps/nostalgia/deps/ox/src/ox/std/size.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/size.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/size.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/size.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/smallmap.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/smallmap.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/smallmap.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/smallmap.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/source_location.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/source_location.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/source_location.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/source_location.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/span.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/span.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/span.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/span.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/stacktrace.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/stacktrace.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/stacktrace.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/stacktrace.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/std.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/std.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/std.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/std.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/stddef.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/stddef.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/stddef.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/stddef.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/strconv.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/strconv.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/strconv.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/strconv.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/string.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/string.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/string.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/string.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/stringliteral.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/stringliteral.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/stringliteral.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/stringliteral.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/stringparam.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/stringparam.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/stringparam.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/stringparam.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/stringview.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/stringview.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/stringview.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/stringview.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/strongint.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/strongint.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/strongint.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/strongint.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/strops.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/strops.hpp similarity index 89% rename from deps/nostalgia/deps/ox/src/ox/std/strops.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/strops.hpp index 86251f4..9f94378 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/strops.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/strops.hpp @@ -36,6 +36,27 @@ constexpr StringView substr(StringViewCR str, std::size_t const start, std::size return {}; } +[[nodiscard]] +constexpr char toUpper(char const c) noexcept { + return c & static_cast(0b1101'1111); +} + +[[nodiscard]] +constexpr int caseInsensitiveStrCmp(StringViewCR a, StringViewCR b) noexcept { + auto const sz = ox::min(a.size(), b.size()); + for (size_t i{}; i < sz; ++i) { + auto const ac = toUpper(a[i]); + auto const bc = toUpper(b[i]); + if (ac < bc) { + return -1; + } + if (ac > bc) { + return 1; + } + } + return 0; +} + [[nodiscard]] constexpr bool beginsWith(StringViewCR base, char const beginning) noexcept { return base.size() && base[0] == beginning; diff --git a/deps/nostalgia/deps/ox/src/ox/std/trace.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/trace.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/trace.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/trace.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/typeinfo.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/typeinfo.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/typeinfo.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/typeinfo.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/types.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/types.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/types.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/types.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/typetraits.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/typetraits.hpp similarity index 63% rename from deps/nostalgia/deps/ox/src/ox/std/typetraits.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/typetraits.hpp index c4368e8..ddf9bd7 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/typetraits.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/typetraits.hpp @@ -34,6 +34,41 @@ inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T); namespace ox { +template +struct remove_cv { + using type = T; +}; + +template +struct remove_cv { + using type = T; +}; + +template +struct remove_cv { + using type = T; +}; + +template +struct remove_cv { + using type = T; +}; + + +template +struct remove_const { + using type = T; +}; + +template +struct remove_const { + using type = T; +}; + +template +using remove_const_t = typename remove_const::type; + + template struct integral_constant { @@ -68,32 +103,33 @@ constexpr bool is_const_v = true; // is_integral ///////////////////////////////////////////////////////////////// template struct is_integral: false_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral : true_type {}; -template<> struct is_integral: true_type {}; // some of these need to be done with the actual language syntax because no one // can agree on what an (u)int64_t is... -template<> struct is_integral: true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral: true_type {}; -template<> struct is_integral: true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; + +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; template<> struct is_integral: true_type {}; template @@ -103,22 +139,29 @@ constexpr bool is_integral_v = is_integral::value; // is_integer ///////////////////////////////////////////////////////////////// template struct is_integer: false_type {}; -template<> struct is_integer : true_type {}; -template<> struct is_integer : true_type {}; -template<> struct is_integer : true_type {}; -template<> struct is_integer: true_type {}; -template<> struct is_integer : true_type {}; -template<> struct is_integer: true_type {}; - -// some of these need to be done with the actual language syntax because no one -// can agree on what an (u)int64_t is... -template<> struct is_integer: true_type {}; -template<> struct is_integer: true_type {}; -template<> struct is_integer: true_type {}; -template<> struct is_integer: true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; +template<> struct is_integer : true_type {}; template -constexpr bool is_integer_v = is_integral::value; +constexpr bool is_integer_v = is_integer::value; template concept Integer_c = is_integer::value; @@ -223,6 +266,9 @@ struct remove_pointer { using type = T; }; +template +using remove_pointer_t = typename remove_pointer::type; + template struct remove_reference { @@ -261,39 +307,23 @@ template constexpr bool is_move_constructible_v = detail::is_move_constructible(0); +namespace detail { template -struct remove_cv { - using type = T; -}; +T const &declvalCopy(); + +template()))> +constexpr bool is_copy_constructible(int) { + return true; +} template -struct remove_cv { - using type = T; -}; +constexpr bool is_copy_constructible(bool) { + return false; +} +} -template -struct remove_cv { - using type = T; -}; - -template -struct remove_cv { - using type = T; -}; - - -template -struct remove_const { - using type = T; -}; - -template -struct remove_const { - using type = T; -}; - -template -using remove_const_t = typename remove_const::type; +template +constexpr bool is_copy_constructible_v = detail::is_copy_constructible(0); // is String? diff --git a/deps/nostalgia/deps/ox/src/ox/std/units.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/units.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/units.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/units.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/utility.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/utility.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/utility.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/utility.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/uuid.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/uuid.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/uuid.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/uuid.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/vec.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/vec.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/vec.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/vec.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/vector.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/vector.hpp similarity index 62% rename from deps/nostalgia/deps/ox/src/ox/std/vector.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/vector.hpp index 1973ef7..4d557bf 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/vector.hpp +++ b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/vector.hpp @@ -26,7 +26,7 @@ namespace ox { namespace detail { -template +template struct VectorAllocator { static_assert(sizeof(AllocAlias) == sizeof(T)); static_assert(alignof(AllocAlias) == alignof(T)); @@ -37,7 +37,7 @@ struct VectorAllocator { constexpr VectorAllocator(VectorAllocator const&) noexcept = default; constexpr VectorAllocator(VectorAllocator&&) noexcept = default; - constexpr void allocate(T **items, std::size_t const cap) noexcept { + constexpr void allocate(T **items, size_t const cap) noexcept { // small vector optimization cannot be done it constexpr, but it doesn't really matter in constexpr if (std::is_constant_evaluated() || cap > Size) { *items = Allocator{}.allocate(cap); @@ -49,11 +49,15 @@ struct VectorAllocator { constexpr void moveConstructItemsFrom( T **items, VectorAllocator *src, - std::size_t const count, - std::size_t const cap) noexcept { + size_t const count, + size_t const cap) noexcept { // this totally idiotic redundant check (&& count <= Size) is required to address a bug in devkitARM, // try removing it later 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()) { for (auto i = 0u; i < count; ++i) { auto const srcItem = std::launder(reinterpret_cast(&src->m_data[i])); @@ -72,10 +76,13 @@ struct VectorAllocator { *items = reinterpret_cast(m_data.data()); } } +#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop +#endif } } - constexpr void deallocate(T *const items, std::size_t const cap) noexcept { + constexpr void deallocate(T *const items, size_t const cap) noexcept { // small vector optimization cannot be done it constexpr, but it doesn't really matter in constexpr if (std::is_constant_evaluated()) { if (items) { @@ -97,7 +104,7 @@ struct VectorAllocator { constexpr VectorAllocator(VectorAllocator const&) noexcept = default; constexpr VectorAllocator(VectorAllocator&&) noexcept = default; - constexpr void allocate(T **items, std::size_t const cap) noexcept { + constexpr void allocate(T **items, size_t const cap) noexcept { *items = Allocator{}.allocate(cap); } @@ -105,15 +112,15 @@ struct VectorAllocator { constexpr void moveConstructItemsFrom( T**, VectorAllocator*, - std::size_t const, - std::size_t const) noexcept { + size_t const, + size_t const) noexcept { } [[maybe_unused]] - constexpr void moveItemsFrom(T**, VectorAllocator*, std::size_t const, std::size_t const) noexcept { + constexpr void moveItemsFrom(T**, VectorAllocator*, size_t const, size_t const) noexcept { } - constexpr void deallocate(T *const items, std::size_t const cap) noexcept { + constexpr void deallocate(T *const items, size_t const cap) noexcept { if (items) { Allocator{}.deallocate(items, cap); } @@ -123,12 +130,12 @@ struct VectorAllocator { } -template> +template> class Vector: detail::VectorAllocator { public: using value_type = T; - using size_type = std::size_t; + using size_type = size_t; template using iterator = SpanIterator; @@ -136,18 +143,18 @@ class Vector: detail::VectorAllocator { private: static constexpr auto initialCap = SmallVectorSize > 0 ? SmallVectorSize : 50; static constexpr auto useNoexcept = ox::is_integral_v || ox::is_pointer_v; - std::size_t m_size = 0; - std::size_t m_cap = 0; + size_t m_size = 0; + size_t m_cap = 0; T *m_items = nullptr; public: constexpr Vector() noexcept = default; - explicit constexpr Vector(std::size_t size) noexcept; + explicit constexpr Vector(size_t size) noexcept; constexpr Vector(std::initializer_list list) noexcept; - constexpr Vector(const Vector &other) noexcept(useNoexcept); + constexpr Vector(Vector const &other) noexcept(useNoexcept); constexpr Vector(Vector &&other) noexcept; @@ -162,23 +169,23 @@ class Vector: detail::VectorAllocator { } [[nodiscard]] - constexpr iterator begin() const noexcept { - return iterator(m_items, 0, m_size); + constexpr iterator begin() const noexcept { + return iterator(m_items, 0, m_size); } [[nodiscard]] - constexpr iterator end() const noexcept { - return iterator(m_items, m_size, m_size); + constexpr iterator end() const noexcept { + return iterator(m_items, m_size, m_size); } [[nodiscard]] - constexpr iterator cbegin() const noexcept { - return iterator(m_items, 0, m_size); + constexpr iterator cbegin() const noexcept { + return iterator(m_items, 0, m_size); } [[nodiscard]] - constexpr iterator cend() const noexcept { - return iterator(m_items, m_size, m_size); + constexpr iterator cend() const noexcept { + return iterator(m_items, m_size, m_size); } [[nodiscard]] @@ -192,36 +199,36 @@ class Vector: detail::VectorAllocator { } [[nodiscard]] - constexpr iterator crbegin() const noexcept { - return iterator(m_items, m_size - 1, m_size); + constexpr iterator crbegin() const noexcept { + return iterator(m_items, m_size - 1, m_size); } [[nodiscard]] - constexpr iterator crend() const noexcept { - return iterator(m_items, MaxValue, m_size); + constexpr iterator crend() const noexcept { + return iterator(m_items, MaxValue, m_size); } [[nodiscard]] - constexpr iterator rbegin() const noexcept { - return iterator(m_items, m_size - 1, m_size); + constexpr iterator rbegin() const noexcept { + return iterator(m_items, m_size - 1, m_size); } [[nodiscard]] - constexpr iterator rend() const noexcept { - return iterator(m_items, MaxValue, m_size); + constexpr iterator rend() const noexcept { + return iterator(m_items, MaxValue, m_size); } - constexpr bool operator==(const Vector &other) const noexcept(useNoexcept); + constexpr bool operator==(Vector const &other) const noexcept(useNoexcept); - constexpr Vector &operator=(const Vector &other) noexcept(useNoexcept); + constexpr Vector &operator=(Vector const &other) noexcept(useNoexcept); constexpr Vector &operator=(Vector &&other) noexcept; [[nodiscard]] - constexpr T &operator[](std::size_t i) noexcept; + constexpr T &operator[](size_t i) noexcept; [[nodiscard]] - constexpr const T &operator[](std::size_t i) const noexcept; + constexpr T const &operator[](size_t i) const noexcept; [[nodiscard]] constexpr Result at(size_t i) noexcept; @@ -233,28 +240,28 @@ class Vector: detail::VectorAllocator { constexpr Result front() noexcept; [[nodiscard]] - constexpr Result front() const noexcept; + constexpr Result front() const noexcept; [[nodiscard]] constexpr Result back() noexcept; [[nodiscard]] - constexpr Result back() const noexcept; + constexpr Result back() const noexcept; [[nodiscard]] - constexpr std::size_t capacity() const noexcept; + constexpr size_t capacity() const noexcept; [[nodiscard]] - constexpr std::size_t size() const noexcept; + constexpr size_t size() const noexcept; [[nodiscard]] constexpr bool empty() const noexcept; constexpr void clear() noexcept(useNoexcept); - constexpr void resize(std::size_t size) noexcept(useNoexcept); + constexpr void resize(size_t size) noexcept(useNoexcept); - constexpr void reserveResize(std::size_t size) noexcept(useNoexcept); + constexpr void reserveResize(size_t size) noexcept(useNoexcept); [[nodiscard]] constexpr T *data() noexcept { @@ -262,7 +269,7 @@ class Vector: detail::VectorAllocator { } [[nodiscard]] - constexpr const T *data() const noexcept { + constexpr T const *data() const noexcept { return m_items; } @@ -270,12 +277,12 @@ class Vector: detail::VectorAllocator { constexpr bool contains(MaybeView_t const&) const noexcept; constexpr iterator insert( - std::size_t pos, std::size_t cnt, T const &val) noexcept(useNoexcept); + size_t pos, size_t cnt, T const &val) noexcept(useNoexcept); - constexpr iterator insert(std::size_t pos, T val) noexcept(useNoexcept); + constexpr iterator insert(size_t pos, T val) noexcept(useNoexcept); template - constexpr iterator emplace(std::size_t pos, Args&&... args) noexcept(useNoexcept); + constexpr iterator emplace(size_t pos, Args&&... args) noexcept(useNoexcept); template constexpr T &emplace_back(Args&&... args) noexcept(useNoexcept); @@ -291,14 +298,14 @@ class Vector: detail::VectorAllocator { * @param pos iterator at the point to remove * @return Error if index is out of bounds */ - constexpr Result> erase(const iterator<> &pos) noexcept(useNoexcept); + constexpr Result> erase(iterator<> const &pos) noexcept(useNoexcept); /** * Removes an item from the Vector. * @param pos position of item to remove * @return Error if index is out of bounds */ - constexpr Result> erase(std::size_t pos) noexcept(useNoexcept); + constexpr Result> erase(size_t pos) noexcept(useNoexcept); /** * Moves the last item in the Vector to position pos and decrements the @@ -306,59 +313,62 @@ class Vector: detail::VectorAllocator { * @param pos position of item to remove * @return Error if index is out of bounds */ - constexpr Error unordered_erase(std::size_t pos) noexcept(useNoexcept); + constexpr Error unordered_erase(size_t pos) noexcept(useNoexcept); constexpr Error remove(MaybeView_t const &val); - constexpr void reserve(std::size_t cap) noexcept(useNoexcept); + constexpr void reserve(size_t cap) noexcept(useNoexcept); constexpr void shrink_to_fit() noexcept(useNoexcept); private: constexpr void reserveInsert( - std::size_t cap, std::size_t pos, std::size_t offset = 1) noexcept(useNoexcept); + size_t cap, size_t pos, size_t offset = 1) noexcept(useNoexcept); }; -template +template using VectorIt = typename Vector::template iterator; -template +template constexpr VectorIt operator+( - std::size_t n, - const VectorIt &a) { + size_t n, + VectorIt const &a) { return a + n; } -template -constexpr Vector::Vector(std::size_t size) noexcept { +template +constexpr Vector::Vector(size_t const size) noexcept { m_size = size; m_cap = m_size; this->allocate(&m_items, m_cap); - for (std::size_t i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { std::construct_at(&m_items[i]); } } -template +template constexpr Vector::Vector(std::initializer_list list) noexcept { - reserve(list.size()); - for (auto &item : list) { - emplace_back(std::move(item)); + m_size = list.size(); + m_cap = m_size; + this->allocate(&m_items, m_cap); + for (size_t i{}; auto &item : list) { + std::construct_at(&m_items[i], std::move(item)); + ++i; } } -template -constexpr Vector::Vector(const Vector &other) noexcept(useNoexcept) { +template +constexpr Vector::Vector(Vector const &other) noexcept(useNoexcept) { m_size = other.m_size; m_cap = other.m_cap; this->allocate(&m_items, other.m_cap); - for (std::size_t i = 0; i < m_size; ++i) { + for (size_t i = 0; i < m_size; ++i) { std::construct_at(&m_items[i], other.m_items[i]); } } -template +template constexpr Vector::Vector(Vector &&other) noexcept { m_size = other.m_size; m_cap = other.m_cap; @@ -369,20 +379,20 @@ constexpr Vector::Vector(Vector &&other) noexcept other.m_items = nullptr; } -template +template constexpr Vector::~Vector() { clear(); this->deallocate(m_items, m_cap); m_items = nullptr; } -template +template constexpr bool Vector::operator==( - const Vector &other) const noexcept(useNoexcept) { + Vector const &other) const noexcept(useNoexcept) { if (m_size != other.m_size) { return false; } - for (std::size_t i = 0; i < m_size; i++) { + for (size_t i = 0; i < m_size; i++) { if (!(m_items[i] == other.m_items[i])) { return false; } @@ -390,9 +400,9 @@ constexpr bool Vector::operator==( return true; } -template +template constexpr Vector &Vector::operator=( - const Vector &other) noexcept(useNoexcept) { + Vector const &other) noexcept(useNoexcept) { if (this != &other) { clear(); this->deallocate(m_items, m_cap); @@ -400,14 +410,14 @@ constexpr Vector &Vectorallocate(&m_items, other.m_cap); - for (std::size_t i = 0; i < m_size; i++) { + for (size_t i = 0; i < m_size; i++) { std::construct_at(&m_items[i], other.m_items[i]); } } return *this; } -template +template constexpr Vector &Vector::operator=( Vector &&other) noexcept { if (this != &other) { @@ -424,35 +434,35 @@ constexpr Vector &Vector -constexpr T &Vector::operator[](std::size_t i) noexcept { +template +constexpr T &Vector::operator[](size_t const i) noexcept { boundsCheck(i, size(), "Vector access overflow"); return m_items[i]; } -template -constexpr const T &Vector::operator[](std::size_t i) const noexcept { +template +constexpr T const &Vector::operator[](size_t const i) const noexcept { boundsCheck(i, size(), "Vector access overflow"); return m_items[i]; } -template -constexpr Result Vector::at(size_t i) noexcept { +template +constexpr Result Vector::at(size_t const i) noexcept { if (i < size()) [[likely]] { return &operator[](i); } return ox::Error(1, "Vector: Invalid index"); } -template -constexpr Result Vector::at(size_t i) const noexcept { +template +constexpr Result Vector::at(size_t const i) const noexcept { if (i < size()) [[likely]] { return &operator[](i); } return ox::Error(1, "Vector: Invalid index"); } -template +template constexpr Result Vector::front() noexcept { if (!m_size) { return {nullptr, ox::Error(1)}; @@ -460,15 +470,15 @@ constexpr Result Vector::front() noexcept { return &m_items[0]; } -template -constexpr Result Vector::front() const noexcept { +template +constexpr Result Vector::front() const noexcept { if (!m_size) { return {nullptr, ox::Error(1)}; } return &m_items[0]; } -template +template constexpr Result Vector::back() noexcept { if (!m_size) { return {nullptr, ox::Error(1)}; @@ -476,65 +486,65 @@ constexpr Result Vector::back() noexcept { return &m_items[m_size - 1]; } -template -constexpr Result Vector::back() const noexcept { +template +constexpr Result Vector::back() const noexcept { if (!m_size) { return {nullptr, ox::Error(1)}; } return &m_items[m_size - 1]; } -template -constexpr std::size_t Vector::capacity() const noexcept { +template +constexpr size_t Vector::capacity() const noexcept { return m_cap; } -template -constexpr std::size_t Vector::size() const noexcept { +template +constexpr size_t Vector::size() const noexcept { return m_size; } -template +template constexpr bool Vector::empty() const noexcept { return !m_size; } -template +template constexpr void Vector::clear() noexcept(useNoexcept) { if constexpr(is_class()) { - for (std::size_t i = 0; i < m_size; ++i) { + for (size_t i = 0; i < m_size; ++i) { m_items[i].~T(); } } m_size = 0; } -template -constexpr void Vector::resize(std::size_t size) noexcept(useNoexcept) { +template +constexpr void Vector::resize(size_t const size) noexcept(useNoexcept) { if (m_cap < size) { reserve(size * 2); } if (m_size < size) { - for (std::size_t i = m_size; i < size; i++) { + for (size_t i = m_size; i < size; i++) { std::construct_at(&m_items[i]); } } else { - for (std::size_t i = size; i < m_size; i++) { + for (size_t i = size; i < m_size; i++) { m_items[i].~T(); } } m_size = size; } -template -constexpr void Vector::reserveResize(std::size_t const size) noexcept(useNoexcept) { +template +constexpr void Vector::reserveResize(size_t const size) noexcept(useNoexcept) { reserve(size); resize(size); } -template +template constexpr bool Vector::contains(MaybeView_t const &v) const noexcept { - for (std::size_t i = 0; i < m_size; ++i) { + for (size_t i = 0; i < m_size; ++i) { if (m_items[i] == v) { return true; } @@ -542,10 +552,10 @@ constexpr bool Vector::contains(MaybeView_t co return false; } -template +template constexpr typename Vector::template iterator Vector::insert( - std::size_t pos, std::size_t cnt, T const &val) noexcept(useNoexcept) { + size_t const pos, size_t const cnt, T const &val) noexcept(useNoexcept) { if (m_size + cnt > m_cap) { reserveInsert(m_cap ? m_size + cnt : initialCap, pos, cnt); } @@ -565,9 +575,9 @@ Vector::insert( return begin() + pos; } -template +template constexpr typename Vector::template iterator -Vector::insert(std::size_t pos, T val) noexcept(useNoexcept) { +Vector::insert(size_t pos, T val) noexcept(useNoexcept) { if (m_size == m_cap) { reserveInsert(m_cap ? m_cap * 2 : initialCap, pos); } @@ -583,10 +593,10 @@ Vector::insert(std::size_t pos, T val) noexcept(u return begin() + pos; } -template +template template constexpr typename Vector::template iterator -Vector::emplace(std::size_t pos, Args&&... args) noexcept(useNoexcept) { +Vector::emplace(size_t pos, Args&&... args) noexcept(useNoexcept) { if (m_size == m_cap) { reserveInsert(m_cap ? m_cap * 2 : initialCap, pos); if (pos < m_size) { @@ -606,7 +616,7 @@ Vector::emplace(std::size_t pos, Args&&... args) return begin() + pos; } -template +template template constexpr T &Vector::emplace_back(Args&&... args) noexcept(useNoexcept) { if (m_size == m_cap) { @@ -617,7 +627,7 @@ constexpr T &Vector::emplace_back(Args&&... args) return *out; } -template +template constexpr void Vector::push_back(T const &item) noexcept(useNoexcept) { if (m_size == m_cap) { reserve(m_cap ? m_cap * 2 : initialCap); @@ -626,7 +636,7 @@ constexpr void Vector::push_back(T const &item) n ++m_size; } -template +template constexpr void Vector::push_back(T &&item) noexcept(useNoexcept) { if (m_size == m_cap) { reserve(m_cap ? m_cap * 2 : initialCap); @@ -635,21 +645,21 @@ constexpr void Vector::push_back(T &&item) noexce ++m_size; } -template +template constexpr void Vector::pop_back() noexcept(useNoexcept) { --m_size; m_items[m_size].~T(); } -template +template constexpr Result::template iterator> -Vector::erase(const iterator<> &pos) noexcept(useNoexcept) { +Vector::erase(iterator<> const &pos) noexcept(useNoexcept) { return erase(pos.offset()); } -template +template constexpr Result::template iterator> -Vector::erase(std::size_t pos) noexcept(useNoexcept) { +Vector::erase(size_t pos) noexcept(useNoexcept) { if (pos >= m_size) { return ox::Error(1, "Vector::erase failed: pos is greater than Vector size"); } @@ -661,8 +671,8 @@ Vector::erase(std::size_t pos) noexcept(useNoexce return begin() + pos; } -template -constexpr Error Vector::unordered_erase(std::size_t pos) +template +constexpr Error Vector::unordered_erase(size_t pos) noexcept(useNoexcept) { if (pos >= m_size) { return ox::Error(1); @@ -673,7 +683,7 @@ constexpr Error Vector::unordered_erase(std::size return {}; } -template +template constexpr ox::Error Vector::remove(MaybeView_t const &val) { for (size_t i{}; auto const &v : *this) { if (v == val) { @@ -684,18 +694,18 @@ constexpr ox::Error Vector::remove(MaybeView_t return ox::Error{1, "element not found"}; } -template -constexpr void Vector::reserve(std::size_t cap) noexcept(useNoexcept) { +template +constexpr void Vector::reserve(size_t cap) noexcept(useNoexcept) { if (cap <= m_cap) { return; } - const auto oldItems = m_items; - const auto oldCap = m_cap; + auto const oldItems = m_items; + auto const oldCap = m_cap; m_cap = cap; this->allocate(&m_items, cap); if (oldItems) { // move over old items - const auto itRange = ox::min(cap, m_size); - for (std::size_t i = 0; i < itRange; ++i) { + auto const itRange = ox::min(cap, m_size); + for (size_t i = 0; i < itRange; ++i) { std::construct_at(&m_items[i], std::move(oldItems[i])); oldItems[i].~T(); } @@ -703,17 +713,17 @@ constexpr void Vector::reserve(std::size_t cap) n } } -template +template constexpr void Vector::shrink_to_fit() noexcept(useNoexcept) { if (m_size == m_cap) { return; } - const auto oldItems = m_items; - const auto oldCap = m_cap; + auto const oldItems = m_items; + auto const oldCap = m_cap; m_cap = m_size; this->allocate(&m_items, m_size); if (oldItems) { // move over old items - for (std::size_t i = 0; i < m_size; ++i) { + for (size_t i = 0; i < m_size; ++i) { std::construct_at(&m_items[i], std::move(oldItems[i])); oldItems[i].~T(); } @@ -721,26 +731,26 @@ constexpr void Vector::shrink_to_fit() noexcept(u } } -template +template constexpr void Vector::reserveInsert( - std::size_t cap, - std::size_t pos, - std::size_t offset) noexcept(useNoexcept) { + size_t cap, + size_t pos, + size_t offset) noexcept(useNoexcept) { if (cap <= m_cap) { return; } - const auto oldItems = m_items; - const auto oldCap = m_cap; + auto const oldItems = m_items; + auto const oldCap = m_cap; m_cap = cap; this->allocate(&m_items, cap); if (oldItems) { // move over old items auto itRange = ox::min(m_size, pos); - for (std::size_t i = 0; i < itRange; ++i) { + for (size_t i = 0; i < itRange; ++i) { std::construct_at(&m_items[i], std::move(oldItems[i])); oldItems[i].~T(); } itRange = m_size; - for (std::size_t i = pos; i < itRange; ++i) { + for (size_t i = pos; i < itRange; ++i) { std::construct_at(&m_items[i + offset], std::move(oldItems[i])); oldItems[i].~T(); } @@ -751,8 +761,8 @@ constexpr void Vector::reserveInsert( template [[nodiscard]] -constexpr auto alignOf(const Vector&) noexcept { - const typename PlatSpec::size_t i = 0; +constexpr auto alignOf(Vector const&) noexcept { + typename PlatSpec::size_t const i = 0; return PlatSpec::alignOf(i); } diff --git a/deps/nostalgia/deps/ox/src/ox/std/writer.hpp b/deps/nostalgia/deps/oxlib/src/std/include/ox/std/writer.hpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/writer.hpp rename to deps/nostalgia/deps/oxlib/src/std/include/ox/std/writer.hpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/assert.cpp b/deps/nostalgia/deps/oxlib/src/std/src/assert.cpp similarity index 94% rename from deps/nostalgia/deps/ox/src/ox/std/assert.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/assert.cpp index d63a796..0d5ee7f 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/assert.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/assert.cpp @@ -6,12 +6,12 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "fmt.hpp" -#include "realstd.hpp" -#include "stacktrace.hpp" -#include "trace.hpp" +#include +#include +#include +#include -#include "assert.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/bit.cpp b/deps/nostalgia/deps/oxlib/src/std/src/bit.cpp similarity index 97% rename from deps/nostalgia/deps/ox/src/ox/std/bit.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/bit.cpp index 24600af..1d15a67 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/bit.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/bit.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "bit.hpp" +#include static_assert(ox::onMask(1) == 0b0001); static_assert(ox::onMask(2) == 0b0011); diff --git a/deps/nostalgia/deps/ox/src/ox/std/buffer.cpp b/deps/nostalgia/deps/oxlib/src/std/src/buffer.cpp similarity index 88% rename from deps/nostalgia/deps/ox/src/ox/std/buffer.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/buffer.cpp index b15548c..9794ced 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/buffer.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/buffer.cpp @@ -6,8 +6,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "error.hpp" -#include "buffer.hpp" +#include +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/buildinfo.cpp b/deps/nostalgia/deps/oxlib/src/std/src/buildinfo.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/buildinfo.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/buildinfo.cpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/byteswap.cpp b/deps/nostalgia/deps/oxlib/src/std/src/byteswap.cpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/std/byteswap.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/byteswap.cpp index 85963cb..f4141e3 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/byteswap.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/byteswap.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "byteswap.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/concepts.cpp b/deps/nostalgia/deps/oxlib/src/std/src/concepts.cpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/std/concepts.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/concepts.cpp index e6314cf..8ed9498 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/concepts.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/concepts.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "concepts.hpp" +#include namespace ox::detail::test { @@ -20,4 +20,4 @@ static_assert(ok(static_cast(nullptr))); static_assert(!ok(static_cast(nullptr))); static_assert(!ok(static_cast(nullptr))); -} \ No newline at end of file +} diff --git a/deps/nostalgia/deps/ox/src/ox/std/fmt.cpp b/deps/nostalgia/deps/oxlib/src/std/src/fmt.cpp similarity index 98% rename from deps/nostalgia/deps/ox/src/ox/std/fmt.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/fmt.cpp index 7abf8c8..0d7b8c4 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/fmt.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/fmt.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "fmt.hpp" +#include namespace ox::detail { diff --git a/deps/nostalgia/deps/ox/src/ox/std/heapmgr.cpp b/deps/nostalgia/deps/oxlib/src/std/src/heapmgr.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/std/heapmgr.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/heapmgr.cpp index 90e9f19..a84a9cb 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/heapmgr.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/heapmgr.cpp @@ -6,10 +6,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "assert.hpp" -#include "bit.hpp" -#include "def.hpp" -#include "heapmgr.hpp" +#include +#include +#include +#include OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage) diff --git a/deps/nostalgia/deps/ox/src/ox/std/reader.cpp b/deps/nostalgia/deps/oxlib/src/std/src/istreamreader.cpp similarity index 75% rename from deps/nostalgia/deps/ox/src/ox/std/reader.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/istreamreader.cpp index 13acc66..b1988ac 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/reader.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/istreamreader.cpp @@ -10,8 +10,9 @@ #ifdef OX_USE_STDLIB #include -#include "array.hpp" -#include "reader.hpp" +#include +#include +#include namespace ox { @@ -28,7 +29,7 @@ constexpr std::ios_base::seekdir sdMap(ox::ios_base::seekdir in) noexcept { return std::ios_base::beg; } -ox::Result StreamReader::peek() const noexcept { +Result StreamReader::peek() const noexcept { try { if (m_strm.eof()) { return Error{1, "EOF"}; @@ -44,11 +45,11 @@ ox::Result StreamReader::peek() const noexcept { } } -ox::Result StreamReader::read(char *v, std::size_t cnt) noexcept { +Result StreamReader::read(char *v, size_t cnt) noexcept { return static_cast(m_strm.read(v, static_cast(cnt)).gcount()); } -ox::Error StreamReader::seekg(std::size_t p) noexcept { +Error StreamReader::seekg(size_t p) noexcept { try { m_strm.seekg(static_cast(p), std::ios_base::cur); } catch (std::exception const&) { @@ -57,7 +58,7 @@ ox::Error StreamReader::seekg(std::size_t p) noexcept { return {}; } -ox::Error StreamReader::seekg(int64_t p, ios_base::seekdir sd) noexcept { +Error StreamReader::seekg(int64_t p, ios_base::seekdir sd) noexcept { try { m_strm.seekg(p, sdMap(sd)); } catch (std::exception const&) { @@ -66,9 +67,9 @@ ox::Error StreamReader::seekg(int64_t p, ios_base::seekdir sd) noexcept { return {}; } -ox::Result StreamReader::tellg() noexcept { +Result StreamReader::tellg() noexcept { const auto sz = m_strm.tellg(); - return {static_cast(sz), ox::Error(sz == -1)}; + return {static_cast(sz), ox::Error(sz == -1)}; } } diff --git a/deps/nostalgia/deps/ox/src/ox/std/math.cpp b/deps/nostalgia/deps/oxlib/src/std/src/math.cpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/std/math.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/math.cpp index 962bbed..2816eb5 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/math.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/math.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "math.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/memops.cpp b/deps/nostalgia/deps/oxlib/src/std/src/memops.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/std/memops.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/memops.cpp index 06b9ad5..22e33dc 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/memops.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/memops.cpp @@ -6,9 +6,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "defines.hpp" -#include "types.hpp" -#include "memops.hpp" +#include +#include +#include OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage) diff --git a/deps/nostalgia/deps/ox/src/ox/std/random.cpp b/deps/nostalgia/deps/oxlib/src/std/src/random.cpp similarity index 83% rename from deps/nostalgia/deps/ox/src/ox/std/random.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/random.cpp index 53c27d3..0b4204f 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/random.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/random.cpp @@ -6,8 +6,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "bit.hpp" -#include "random.hpp" +#include +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/mc/presenceindicator.cpp b/deps/nostalgia/deps/oxlib/src/std/src/reader.cpp similarity index 59% rename from deps/nostalgia/deps/ox/src/ox/mc/presenceindicator.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/reader.cpp index c5055f4..5f6be8c 100644 --- a/deps/nostalgia/deps/ox/src/ox/mc/presenceindicator.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/reader.cpp @@ -5,13 +5,3 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "err.hpp" -#include "presenceindicator.hpp" - -namespace ox { - -template class FieldBitmapWriterBase; -template class FieldBitmapWriterBase; - -} diff --git a/deps/nostalgia/deps/ox/src/ox/std/stacktrace.cpp b/deps/nostalgia/deps/oxlib/src/std/src/stacktrace.cpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/std/stacktrace.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/stacktrace.cpp index ae4d3d1..436b215 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/stacktrace.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/stacktrace.cpp @@ -18,11 +18,11 @@ #endif #endif -#include "def.hpp" -#include "defines.hpp" -#include "string.hpp" -#include "trace.hpp" -#include "vector.hpp" +#include +#include +#include +#include +#include OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage) diff --git a/deps/nostalgia/deps/ox/src/ox/std/string.cpp b/deps/nostalgia/deps/oxlib/src/std/src/string.cpp similarity index 95% rename from deps/nostalgia/deps/ox/src/ox/std/string.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/string.cpp index ff43e3c..8563932 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/string.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/string.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "string.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/stringview.cpp b/deps/nostalgia/deps/oxlib/src/std/src/stringview.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/std/stringview.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/stringview.cpp index b71f116..8eb5232 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/stringview.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/stringview.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "stringview.hpp" +#include static_assert(ox::StringView("Read").bytes() == 4); static_assert(ox::StringView("Read") == ox::StringView("Read")); diff --git a/deps/nostalgia/deps/ox/src/ox/std/strops.cpp b/deps/nostalgia/deps/oxlib/src/std/src/strops.cpp similarity index 63% rename from deps/nostalgia/deps/ox/src/ox/std/strops.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/strops.cpp index a6b7f75..41e87fd 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/strops.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/strops.cpp @@ -6,10 +6,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "def.hpp" -#include "strops.hpp" +#include +#include +#include -OX_ALLOW_UNSAFE_BUFFERS_BEGIN static_assert(ox::strcmp("asdf", "hijk") < 0, "asdf < hijk"); static_assert(ox::strcmp("hijk", "asdf") > 0, "hijk > asdf"); @@ -19,30 +19,29 @@ static_assert(ox::strcmp("resize", "resize") == 0, "resize == resize"); static_assert(ox::strcmp("", "") == 0, "\"\" == \"\""); static_assert([] { - auto testStr = "asdf"; -OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage) - return ox::strchr(testStr, 0, 4) == &testStr[4]; -OX_CLANG_NOWARN_END + auto constexpr testStr = ox::Span{"asdf"}; +OX_ALLOW_UNSAFE_BUFFERS_BEGIN + return ox::strchr(testStr.data(), 0, 4) == &testStr[4]; +OX_ALLOW_UNSAFE_BUFFERS_END }(), "ox::strchr 0"); static_assert([] { - int retval = 0; - auto testStr = "aaaa"; + auto constexpr testStr = "aaaa"; // test the const and non-const versions of ox::lastIndexOf - retval |= !(ox::lastIndexOf(const_cast(testStr), 'a', ox::strlen(testStr)) == 3); - retval |= !(ox::lastIndexOf(testStr, 'a', ox::strlen(testStr)) == 3); - return retval == 0; +OX_ALLOW_UNSAFE_BUFFERS_BEGIN + return ox::lastIndexOf(testStr, 'a', ox::strlen(testStr)) == 3; +OX_ALLOW_UNSAFE_BUFFERS_END }(), "ox::lastIndexOf aaaa a"); #ifndef OX_USE_STDLIB extern "C" -std::size_t strlen(const char *str) { - std::size_t len = 0; - for (; str[len]; len++); +size_t strlen(const char *str) { + size_t len{}; +OX_ALLOW_UNSAFE_BUFFERS_BEGIN + while (str[len]) { ++len; } +OX_ALLOW_UNSAFE_BUFFERS_END return len; } #endif - -OX_ALLOW_UNSAFE_BUFFERS_END \ No newline at end of file diff --git a/deps/nostalgia/deps/ox/src/ox/std/substitutes.cpp b/deps/nostalgia/deps/oxlib/src/std/src/substitutes.cpp similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/substitutes.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/substitutes.cpp diff --git a/deps/nostalgia/deps/ox/src/ox/std/trace.cpp b/deps/nostalgia/deps/oxlib/src/std/src/trace.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/std/trace.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/trace.cpp index bb43e4b..d360c7d 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/trace.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/trace.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "trace.hpp" +#include namespace ox::trace { diff --git a/deps/nostalgia/deps/ox/src/ox/std/tracehook.cpp b/deps/nostalgia/deps/oxlib/src/std/src/tracehook.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/std/tracehook.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/tracehook.cpp index ec0ea74..77d5e70 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/tracehook.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/tracehook.cpp @@ -14,11 +14,11 @@ static const auto OxPrintTrace = std::getenv("OXTRACE") != nullptr; #endif -#include "strops.hpp" +#include -#include "math.hpp" -#include "stringview.hpp" -#include "types.hpp" +#include +#include +#include #define REG_MGBA_DEBUG_ENABLE *reinterpret_cast(0x4FFF780) #define REG_MGBA_DEBUG_FLAGS *reinterpret_cast(0x4FFF700) diff --git a/deps/nostalgia/deps/ox/src/ox/std/typetraits.cpp b/deps/nostalgia/deps/oxlib/src/std/src/typetraits.cpp similarity index 96% rename from deps/nostalgia/deps/ox/src/ox/std/typetraits.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/typetraits.cpp index 2db4639..d8c4788 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/typetraits.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/typetraits.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "typetraits.hpp" +#include namespace ox { @@ -22,4 +22,4 @@ static_assert(is_move_constructible_v>); static_assert(!is_move_constructible_v>); static_assert(is_move_constructible_v>); -} \ No newline at end of file +} diff --git a/deps/nostalgia/deps/ox/src/ox/std/uuid.cpp b/deps/nostalgia/deps/oxlib/src/std/src/uuid.cpp similarity index 97% rename from deps/nostalgia/deps/ox/src/ox/std/uuid.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/uuid.cpp index 595a80c..18859f7 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/uuid.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/uuid.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "uuid.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/vec.cpp b/deps/nostalgia/deps/oxlib/src/std/src/vec.cpp similarity index 93% rename from deps/nostalgia/deps/ox/src/ox/std/vec.cpp rename to deps/nostalgia/deps/oxlib/src/std/src/vec.cpp index e482585..da7bd7e 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/vec.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/src/vec.cpp @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "vec.hpp" +#include namespace ox { diff --git a/deps/nostalgia/deps/ox/src/ox/std/test/CMakeLists.txt b/deps/nostalgia/deps/oxlib/src/std/test/CMakeLists.txt similarity index 100% rename from deps/nostalgia/deps/ox/src/ox/std/test/CMakeLists.txt rename to deps/nostalgia/deps/oxlib/src/std/test/CMakeLists.txt diff --git a/deps/nostalgia/deps/ox/src/ox/std/test/tests.cpp b/deps/nostalgia/deps/oxlib/src/std/test/tests.cpp similarity index 99% rename from deps/nostalgia/deps/ox/src/ox/std/test/tests.cpp rename to deps/nostalgia/deps/oxlib/src/std/test/tests.cpp index 0093c89..14c6cba 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/test/tests.cpp +++ b/deps/nostalgia/deps/oxlib/src/std/test/tests.cpp @@ -43,7 +43,7 @@ uint64_t timeMapStrToUuid(int const elemCnt, int const lookups, uint64_t seed = // start auto const startTime = steadyNowMs(); for (int i = 0; i < lookups; ++i) { - auto const &k = keys[rand.gen() % keys.size()]; + auto const &k = keys[static_cast(rand.gen() % keys.size())]; map[k]; ox::expect(map[k], ox::UUID::fromString(k).unwrap()); } @@ -65,7 +65,7 @@ uint64_t timeMapUuidToStr(int const elemCnt, int const lookups, uint64_t seed = // start auto const startTime = steadyNowMs(); for (int i = 0; i < lookups; ++i) { - auto const &k = keys[rand.gen() % keys.size()]; + auto const &k = keys[static_cast(rand.gen() % keys.size())]; ox::expect(map[k], k.toString()); } return steadyNowMs() - startTime; diff --git a/deps/nostalgia/developer-handbook.md b/deps/nostalgia/developer-handbook.md index f3d7e11..a7ef2c2 100644 --- a/deps/nostalgia/developer-handbook.md +++ b/deps/nostalgia/developer-handbook.md @@ -44,8 +44,7 @@ All components have a platform indicator next to them: * gba - GBA implementation (PG) * glfw - GLFW implementation (P-) * deps - project dependencies - * Ox - Library of things useful for portable bare metal and userland code. - Not really that external... (PG) + * Ox - Library of things useful for portable bare metal and userland code. (PG) * GlUtils - OpenGL helpers (P-) * teagba - GBA assembly startup code (mostly pulled from devkitPro under MPL 2.0), and custom GBA hardware interop code (-G) @@ -158,13 +157,13 @@ classes in question. ## Project Systems Olympic builds on Ox as its standard-ish library. -Please read the [Ox documentation](deps/ox/ox-docs.md). +Please read the [Ox documentation](deps/oxlib/ox-docs.md). The Ox way of doing things is the Olympic way of doing things. ### Error Handling Instead of throwing exceptions, generally try to use -[ox::Error](deps/ox/ox-docs.md#error-handling) for error reporting. +[ox::Error](deps/oxlib/ox-docs.md#error-handling) for error reporting. Exceptions may be used where errors-as-values will not work, but catch them and convert them to ```ox::Error``` as soon as possible. @@ -181,7 +180,7 @@ Similarly, all studio file I/O should go thorough ```ox::FileSystem``` abstracts away differences between conventional storage devices and ROM. -Olympic files are generally just [Claw objects](deps/ox/ox-docs.md#serialization). +Olympic files are generally just [Claw objects](deps/oxlib/ox-docs.md#serialization). #### Keel diff --git a/deps/nostalgia/release-notes.md b/deps/nostalgia/release-notes.md index 41b4281..849bde7 100644 --- a/deps/nostalgia/release-notes.md +++ b/deps/nostalgia/release-notes.md @@ -1,3 +1,8 @@ +# NEXT + +* Add HiDPI support +* Add Get Info file dialog option in project explorer + # d2025.07.0 * Add sub-command for exporting TileSheets as PNG files. diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp index 737837f..01b2267 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp @@ -13,79 +13,66 @@ namespace nostalgia::gfx { -static class: public keel::Module { - public: - [[nodiscard]] - ox::String id() const noexcept override { - return ox::String{"net.drinkingtea.nostalgia.gfx"}; - } +static struct: keel::Module { - [[nodiscard]] - ox::Vector types() const noexcept final { - return { - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - keel::generateTypeDesc, - }; - } + [[nodiscard]] + ox::String id() const noexcept override { + return ox::String{"net.drinkingtea.nostalgia.gfx"}; + } - [[nodiscard]] - ox::Vector converters() const noexcept final { - return { - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - keel::Converter::make(), - }; - } + [[nodiscard]] + ox::Vector types() const noexcept final { + return { + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + keel::generateTypeDesc, + }; + } - [[nodiscard]] - ox::Vector packTransforms() const noexcept final { - return { - // convert tilesheets to CompactTileSheets - [](keel::Context &ctx, ox::Buffer &buff, ox::StringViewCR typeId) -> ox::Result { - if (typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v) { - OX_RETURN_ERROR(keel::convertBuffToBuff( - ctx, buff, ox::ClawFormat::Metal).moveTo(buff)); - return true; - } - return false; - }, - [](keel::Context &ctx, ox::Buffer &buff, ox::StringViewCR typeId) -> ox::Result { - if (typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v || - typeId == ox::ModelTypeId_v) { - OX_RETURN_ERROR(keel::convertBuffToBuff( - ctx, buff, ox::ClawFormat::Metal).moveTo(buff)); - return true; - } - return false; - }, - }; - } + [[nodiscard]] + ox::Vector converters() const noexcept final { + return { + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + keel::Converter::make(), + }; + } + + [[nodiscard]] + ox::Vector packTransforms() const noexcept final { + return { + // convert tilesheets to CompactTileSheets + keel::transformRule, + keel::transformRule, + keel::transformRule, + keel::transformRule, + keel::transformRule, + // convert palettes to CompactPalettes + keel::transformRule, + keel::transformRule, + keel::transformRule, + keel::transformRule, + keel::transformRule, + keel::transformRule, + }; + } } const mod; diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/typeconv.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/typeconv.cpp index 3b179dd..b0cc83c 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/typeconv.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/keel/typeconv.cpp @@ -109,8 +109,8 @@ static void convertSubsheet( dst.rows = src.rows; dst.pixels = std::move(src.pixels); ++idIt; - dst.subsheets.resize(src.subsheets.size()); - for (auto i = 0u; i < src.subsheets.size(); ++i) { + dst.subsheets.reserveResize(src.subsheets.size()); + for (size_t i{}; i < src.subsheets.size(); ++i) { convertSubsheet(src.subsheets[i], dst.subsheets[i], idIt); } } @@ -136,8 +136,8 @@ static void convertSubsheet( dst.rows = src.rows; dst.pixels = std::move(src.pixels); ++idIt; - dst.subsheets.resize(src.subsheets.size()); - for (auto i = 0u; i < src.subsheets.size(); ++i) { + dst.subsheets.reserveResize(src.subsheets.size()); + for (size_t i{}; i < src.subsheets.size(); ++i) { convertSubsheet(src.subsheets[i], dst.subsheets[i], idIt); } } @@ -173,8 +173,8 @@ static void convertSubsheet( } else { dst.pixels = std::move(src.pixels); } - dst.subsheets.resize(src.subsheets.size()); - for (auto i = 0u; i < src.subsheets.size(); ++i) { + dst.subsheets.reserveResize(src.subsheets.size()); + for (size_t i{}; i < src.subsheets.size(); ++i) { convertSubsheet(bpp, src.subsheets[i], dst.subsheets[i]); } } diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp index 9fad4bb..f2046ee 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addcolorcommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp index 01f659d..4b5fd7c 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/addpagecommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp index 8b5eec2..be00d26 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/applycolorallpagescommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp index 7765e27..35239df 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/duplicatepagecommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp index d1d8f21..57d503a 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movecolorcommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movepagecommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movepagecommand.hpp index 0b42161..ed58df8 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movepagecommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/movepagecommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp index d94e021..48737e0 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removecolorcommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp index bd4264b..9e8b6d8 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/removepagecommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp index fbc520e..4c33cee 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/renamepagecommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp index 6b7b63c..d4e0731 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorcommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp index c5dac8c..3365152 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/updatecolorinfocommand.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include #include diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp index d113814..c4731fc 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -45,11 +45,11 @@ OX_MODEL_BEGIN(PageDragDrop) OX_MODEL_FIELD(page) OX_MODEL_END() -void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept { +void PaletteEditorImGui::PageRenameDialog::draw() noexcept { if (!m_show) { return; } - if (ig::BeginPopup(tctx, "Rename Page", m_show)) { + if (ig::BeginPopup("Rename Page", m_show)) { if (ImGui::IsWindowAppearing()) { ImGui::SetKeyboardFocusHere(); } @@ -71,26 +71,26 @@ void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept PaletteEditorImGui::PaletteEditorImGui(studio::Context &sctx, ox::StringParam path): Editor(sctx, std::move(path)), m_sctx(sctx), - m_tctx(sctx.tctx), m_pal(m_sctx.project->loadObj(itemPath()).unwrapThrow()) { undoStack()->changeTriggered.connect(this, &PaletteEditorImGui::handleCommand); m_pageRenameDlg.inputSubmitted.connect(this, &PaletteEditorImGui::renamePage); } void PaletteEditorImGui::draw(studio::Context&) noexcept { + auto const scale = ig::dpiScale(); auto const paneSize = ImGui::GetContentRegionAvail(); { - ImGui::BeginChild("Pages", {280, paneSize.y}, true); + ImGui::BeginChild("Pages", {scale * 280, paneSize.y}, true); drawPagesEditor(); ImGui::EndChild(); } ImGui::SameLine(); { - ImGui::BeginChild("Colors", {-1, paneSize.y}, true); + ImGui::BeginChild("Colors", {scale * -1, paneSize.y}, true); drawColorsEditor(); ImGui::EndChild(); } - m_pageRenameDlg.draw(m_tctx); + m_pageRenameDlg.draw(); } ox::Error PaletteEditorImGui::saveItem() noexcept { @@ -165,7 +165,7 @@ void PaletteEditorImGui::drawColorsEditor() noexcept { static constexpr auto toolbarHeight = 40; { auto constexpr sz = ImVec2{70, 24}; - if (ImGui::Button("Add", sz)) { + if (ig::PushButton("Add", sz)) { auto const colorSz = colorCnt(m_pal, m_page); constexpr Color16 c = 0; std::ignore = pushCommand(m_pal, c, colorSz); @@ -173,7 +173,7 @@ void PaletteEditorImGui::drawColorsEditor() noexcept { ImGui::SameLine(); ImGui::BeginDisabled(m_selectedColorRow >= colorCnt(m_pal, m_page)); { - if (ImGui::Button("Remove", sz)) { + if (ig::PushButton("Remove", sz)) { std::ignore = pushCommand(m_pal, m_selectedColorRow); m_selectedColorRow = ox::min(colorCnt(m_pal, m_page) - 1, m_selectedColorRow); colorEditor = m_selectedColorRow < colorCnt(m_pal, m_page); @@ -183,17 +183,18 @@ void PaletteEditorImGui::drawColorsEditor() noexcept { } auto const tblWidth = (colorsSz.x - static_cast(colorEditorWidth) - 8.f) * static_cast(colorEditor); + auto const scale = ig::dpiScale(); ImGui::BeginTable( "Colors", 6, tableFlags, - {tblWidth, colorsSz.y - (toolbarHeight + 5)}); + {tblWidth * scale, colorsSz.y - (toolbarHeight + 5) * scale}); { - ImGui::TableSetupColumn("Idx", ImGuiTableColumnFlags_WidthFixed, 25); - ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 100); - ImGui::TableSetupColumn("Red", ImGuiTableColumnFlags_WidthFixed, 40); - ImGui::TableSetupColumn("Green", ImGuiTableColumnFlags_WidthFixed, 40); - ImGui::TableSetupColumn("Blue", ImGuiTableColumnFlags_WidthFixed, 40); + ImGui::TableSetupColumn("Idx", ImGuiTableColumnFlags_WidthFixed, 25 * scale); + ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 100 * scale); + ImGui::TableSetupColumn("Red", ImGuiTableColumnFlags_WidthFixed, 40 * scale); + ImGui::TableSetupColumn("Green", ImGuiTableColumnFlags_WidthFixed, 40 * scale); + ImGui::TableSetupColumn("Blue", ImGuiTableColumnFlags_WidthFixed, 40 * scale); ImGui::TableSetupColumn("Preview", ImGuiTableColumnFlags_NoHide); ImGui::TableHeadersRow(); if (m_page < m_pal.pages.size()) { @@ -236,10 +237,11 @@ void PaletteEditorImGui::drawColorsEditor() noexcept { } void PaletteEditorImGui::drawPagesEditor() noexcept { + auto const scale = ig::dpiScale(); constexpr auto tableFlags = ImGuiTableFlags_RowBg; auto const paneSz = ImGui::GetContentRegionAvail(); constexpr auto toolbarHeight = 40; - auto const btnSz = ImVec2{paneSz.x / 4 - 5.5f, 24}; + auto const btnSz = ImVec2{paneSz.x / 4 - 5.5f * scale, 24 * scale}; if (ImGui::Button("Add", btnSz)) { if (m_pal.pages.empty()) { std::ignore = pushCommand(m_pal); @@ -265,7 +267,7 @@ void PaletteEditorImGui::drawPagesEditor() noexcept { "PageSelect", 2, tableFlags, - {paneSz.x, paneSz.y - (toolbarHeight + 5)}); + {paneSz.x, paneSz.y - (toolbarHeight + 5) * scale}); { ImGui::TableSetupColumn("Page", ImGuiTableColumnFlags_WidthFixed, 60); ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 200); diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp index 0d167c3..62f4090 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -29,10 +29,9 @@ class PaletteEditorImGui: public studio::Editor { } [[nodiscard]] constexpr bool isOpen() const noexcept { return m_show; } - void draw(turbine::Context &tctx) noexcept; + void draw() noexcept; } m_pageRenameDlg; studio::Context &m_sctx; - turbine::Context &m_tctx; Palette m_pal; size_t m_selectedColorRow = 0; size_t m_page = 0; diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/subcommands/export-tilesheet/export-tilesheet.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/subcommands/export-tilesheet/export-tilesheet.cpp index 1f26e24..000c436 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/subcommands/export-tilesheet/export-tilesheet.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/subcommands/export-tilesheet/export-tilesheet.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -14,10 +15,6 @@ #include "export-tilesheet.hpp" -#include "nostalgia/gfx/tilesheet.hpp" -#include "studio/context.hpp" - - namespace nostalgia::gfx { static ox::Vector normalizePixelSizes( diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp index f0acb7f..0337944 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp @@ -6,13 +6,14 @@ namespace nostalgia::gfx { -TileSheetClipboard::Pixel::Pixel(uint16_t pColorIdx, ox::Point pPt) noexcept { - colorIdx = pColorIdx; - pt = pPt; -} +TileSheetClipboard::Pixel::Pixel( + uint8_t const pColorIdx, + ox::Point const pPt) noexcept: + colorIdx(pColorIdx), + pt(pPt) {} -void TileSheetClipboard::addPixel(ox::Point const&pt, uint16_t colorIdx) noexcept { +void TileSheetClipboard::addPixel(ox::Point const &pt, uint8_t colorIdx) noexcept { m_pixels.emplace_back(colorIdx, pt); } @@ -22,43 +23,37 @@ const ox::Vector &TileSheetClipboard::pixels() const CutPasteCommand::CutPasteCommand( - CommandId commandId, + CommandId const commandId, TileSheet &img, TileSheet::SubSheetIdx subSheetIdx, - ox::Point const&dstStart, + ox::Point const &dstStart, ox::Point dstEnd, - TileSheetClipboard const&cb): + TileSheetClipboard const &cb): m_commandId(commandId), m_img(img), m_subSheetIdx(std::move(subSheetIdx)) { - auto const&ss = getSubSheet(m_img, m_subSheetIdx); + auto const &ss = getSubSheet(m_img, m_subSheetIdx); if (dstStart.x >= ss.columns * TileWidth || dstStart.y >= ss.rows * TileHeight) { throw ox::Exception{1, "paste starts beyond the bounds of target"}; } dstEnd.x = std::min(ss.columns * TileWidth - 1, dstEnd.x); dstEnd.y = std::min(ss.rows * TileHeight - 1, dstEnd.y); - for (auto const&p : cb.pixels()) { + for (auto const &p : cb.pixels()) { auto const dstPt = p.pt + dstStart; if (dstPt.x <= dstEnd.x && dstPt.y <= dstEnd.y) { auto const idx = gfx::idx(ss, dstPt); - m_changes.emplace_back(static_cast(idx), p.colorIdx, getPixel(ss, idx)); + m_changes.emplace_back(static_cast(idx), p.colorIdx); } } } ox::Error CutPasteCommand::redo() noexcept { - auto &subsheet = getSubSheet(m_img, m_subSheetIdx); - for (auto const &c : m_changes) { - subsheet.pixels[c.idx] = static_cast(c.newPalIdx); - } + swap(); return {}; } ox::Error CutPasteCommand::undo() noexcept { - auto &subsheet = getSubSheet(m_img, m_subSheetIdx); - for (auto const &c : m_changes) { - subsheet.pixels[c.idx] = static_cast(c.oldPalIdx); - } + swap(); return {}; } @@ -66,8 +61,15 @@ int CutPasteCommand::commandId() const noexcept { return static_cast(m_commandId); } -TileSheet::SubSheetIdx const&CutPasteCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &CutPasteCommand::subsheetIdx() const noexcept { return m_subSheetIdx; } +void CutPasteCommand::swap() noexcept { + auto &subsheet = getSubSheet(m_img, m_subSheetIdx); + for (auto &c : m_changes) { + std::swap(subsheet.pixels[c.idx], c.palIdx); + } +} + } diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp index 2514614..2bd767c 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp @@ -22,15 +22,15 @@ class TileSheetClipboard: public turbine::ClipboardObject { struct Pixel { static constexpr auto TypeName = "net.drinkingtea.nostalgia.gfx.studio.TileSheetClipboard.Pixel"; static constexpr auto TypeVersion = 1; - uint16_t colorIdx = 0; + uint8_t colorIdx = 0; ox::Point pt; - Pixel(uint16_t pColorIdx, ox::Point pPt) noexcept; + Pixel(uint8_t pColorIdx, ox::Point pPt) noexcept; }; protected: ox::Vector m_pixels; public: - void addPixel(ox::Point const &pt, uint16_t colorIdx) noexcept; + void addPixel(ox::Point const &pt, uint8_t colorIdx) noexcept; [[nodiscard]] ox::Vector const &pixels() const noexcept; @@ -49,12 +49,10 @@ class CutPasteCommand: public TileSheetCommand { private: struct Change { uint32_t idx = 0; - uint16_t newPalIdx = 0; - uint16_t oldPalIdx = 0; - constexpr Change(uint32_t pIdx, uint16_t pNewPalIdx, uint16_t pOldPalIdx) noexcept { + uint8_t palIdx = 0; + constexpr Change(uint32_t const pIdx, uint8_t const pPalIdx) noexcept { idx = pIdx; - newPalIdx = pNewPalIdx; - oldPalIdx = pOldPalIdx; + palIdx = pPalIdx; } }; CommandId m_commandId; @@ -81,6 +79,9 @@ class CutPasteCommand: public TileSheetCommand { [[nodiscard]] TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; + private: + void swap() noexcept; + }; } diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index 40c4a11..5e42777 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -23,7 +23,7 @@ struct SubSheetRef { TileSheet::SubSheetIdx subsheet{}; }; -OX_MODEL_BEGIN(SubSheetRef) +static OX_MODEL_BEGIN(SubSheetRef) OX_MODEL_FIELD(subsheet) OX_MODEL_END() @@ -33,7 +33,7 @@ struct TileSheetEditorConfig { TileSheet::SubSheetIdx activeSubsheet{}; }; -OX_MODEL_BEGIN(TileSheetEditorConfig) +static OX_MODEL_BEGIN(TileSheetEditorConfig) OX_MODEL_FIELD_RENAME(activeSubsheet, active_subsheet) OX_MODEL_END() @@ -149,27 +149,30 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept { if (ImGui::IsKeyDown(ImGuiKey_ModCtrl) && !m_palPathFocused) { if (ImGui::IsKeyPressed(ImGuiKey_A)) { auto const &img = m_model.activeSubSheet(); - m_model.setSelection({{}, {img.columns * TileWidth - 1, img.rows * TileHeight - 1}}); + m_model.setSelection({ + {}, + {img.columns * TileWidth - 1, img.rows * TileHeight - 1}}); } else if (ImGui::IsKeyPressed(ImGuiKey_G)) { m_model.clearSelection(); } } } + auto const scale = ig::dpiScale(); auto const paneSize = ImGui::GetContentRegionAvail(); - auto const tileSheetParentSize = ImVec2{paneSize.x - s_palViewWidth, paneSize.y}; - auto const fbSize = ox::Vec2{tileSheetParentSize.x - 16, tileSheetParentSize.y - 16}; + auto const tileSheetParentSize = ImVec2{paneSize.x - s_palViewWidth * scale, paneSize.y}; + auto const fbSize = ox::Vec2{tileSheetParentSize.x - 16 * scale, tileSheetParentSize.y - 16 * scale}; ImGui::BeginChild("TileSheetView", tileSheetParentSize, true); { drawTileSheet(fbSize); } ImGui::EndChild(); ImGui::SameLine(); - ImGui::BeginChild("Controls", {s_palViewWidth - 8, paneSize.y}, true); + ImGui::BeginChild("Controls", {(s_palViewWidth - 8) * scale, paneSize.y}, true); { auto const controlsSize = ImGui::GetContentRegionAvail(); - ImGui::BeginChild("ToolBox", {0, 32}, true); + ImGui::BeginChild("ToolBox", {0, 32 * scale}, true); { - auto const btnSz = ImVec2{45, 14}; + auto const btnSz = ImVec2{45 * scale, 14 * scale}; if (ImGui::Selectable("Select", m_tool == TileSheetTool::Select, 0, btnSz)) { m_tool = TileSheetTool::Select; } @@ -193,7 +196,7 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept { //ig::ComboBox("##Operations", ox::Array{"Operations"}, i); } ImGui::EndChild(); - ImGui::BeginChild("OperationsBox", {0, 35}, ImGuiWindowFlags_NoTitleBar); + ImGui::BeginChild("OperationsBox", {0, 35 * scale}, ImGuiWindowFlags_NoTitleBar); { if (ImGui::BeginCombo("##Operations", "Operations", 0)) { if (ImGui::Selectable("Flip X", false)) { @@ -214,17 +217,17 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept { } } ImGui::EndChild(); - auto const ySize = controlsSize.y - (38 + ig::BtnSz.y + 21); + auto const ySize = controlsSize.y - (38 + ig::BtnSz.y + 21) * scale; // draw palette/color picker - ImGui::BeginChild("Palette", {s_palViewWidth - 24, ySize / 2.f}, true); + ImGui::BeginChild("Palette", {(s_palViewWidth - 24) * scale, ySize / 2.f}, true); { drawPaletteMenu(); } ImGui::EndChild(); - ImGui::BeginChild("SubSheets", {s_palViewWidth - 24, ySize / 2.f}, true); + ImGui::BeginChild("SubSheets", {(s_palViewWidth - 24) * scale, ySize / 2.f}, true); { - static constexpr auto btnHeight = ig::BtnSz.y; - auto constexpr btnSize = ImVec2{btnHeight, btnHeight}; + auto constexpr btnHeight = ig::BtnSz.y; + auto const btnSize = ImVec2{btnHeight, btnHeight}; if (ig::PushButton("+", btnSize)) { auto insertOnIdx = m_model.activeSubSheetIdx(); auto const &parent = m_model.activeSubSheet(); @@ -247,16 +250,16 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept { if (ig::PushButton("Export")) { m_exportMenu.show(); } - TileSheet::SubSheetIdx path; static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_ScrollY; if (ImGui::BeginTable("Subsheets", 4, flags)) { + TileSheet::SubSheetIdx path; ImGui::TableSetupColumn("Subsheet", ImGuiTableColumnFlags_NoHide); - ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed, 25); - ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50); - ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50); + ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed, 25 * scale); + ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50 * scale); + ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50 * scale); ImGui::TableHeadersRow(); drawSubsheetSelector(m_view.img().subsheet, path); ImGui::EndTable(); @@ -265,8 +268,8 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept { ImGui::EndChild(); } ImGui::EndChild(); - m_subsheetEditor.draw(m_tctx); - m_exportMenu.draw(m_tctx); + m_subsheetEditor.draw(); + m_exportMenu.draw(); if (auto pal = m_palPicker.draw(m_sctx)) { if (*pal != m_model.palPath()) { oxLogError(m_model.setPalette(*pal)); @@ -445,10 +448,11 @@ void TileSheetEditorImGui::drawTileSheet(ox::Vec2 const &fbSize) noexcept { void TileSheetEditorImGui::drawPaletteMenu() noexcept { ig::IDStackItem const idStackItem{"PaletteMenu"}; - auto constexpr comboWidthSub = 62; + auto const scale = ig::dpiScale(); + auto const comboWidthSub = 62 * scale; ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - comboWidthSub); - auto constexpr palTags = ImGuiInputTextFlags_ReadOnly; - if (ig::InputTextWithHint("##Palette", "Path to Palette", m_model.palPath(), palTags)) { + auto constexpr palFlags = ImGuiInputTextFlags_ReadOnly; + if (ig::InputTextWithHint("##Palette", "Path to Palette", m_model.palPath(), palFlags)) { oxLogError(m_model.setPalette(m_model.palPath())); } m_palPathFocused = ImGui::IsItemFocused(); @@ -556,7 +560,7 @@ void TileSheetEditorImGui::SubSheetEditor::show(ox::StringViewCR name, int const m_rows = rows; } -void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept { +void TileSheetEditorImGui::SubSheetEditor::draw() noexcept { constexpr auto popupName = "Edit Subsheet"; if (!m_show) { return; @@ -565,13 +569,13 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept auto constexpr popupWidth = 235.f; auto const popupHeight = modSize ? 130.f : 85.f; auto const popupSz = ImVec2{popupWidth, popupHeight}; - if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) { + if (ig::BeginPopup(popupName, m_show, popupSz)) { ig::InputText("Name", m_name); if (modSize) { ImGui::InputInt("Columns", &m_cols); ImGui::InputInt("Rows", &m_rows); } - if (ig::PopupControlsOkCancel(popupWidth, m_show) == ig::PopupResponse::OK) { + if (ig::PopupControlsOkCancel(m_show) == ig::PopupResponse::OK) { inputSubmitted.emit(m_name, m_cols, m_rows); } ImGui::EndPopup(); @@ -588,18 +592,18 @@ void TileSheetEditorImGui::ExportMenu::show() noexcept { m_scale = 5; } -void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &tctx) noexcept { +void TileSheetEditorImGui::ExportMenu::draw() noexcept { constexpr auto popupName = "Export Tile Sheet"; if (!m_show) { return; } - constexpr auto popupWidth = 235.f; - constexpr auto popupHeight = 85.f; - constexpr auto popupSz = ImVec2{popupWidth, popupHeight}; - if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) { + auto constexpr popupWidth = 235.f; + auto constexpr popupHeight = 85.f; + auto constexpr popupSz = ImVec2{popupWidth, popupHeight}; + if (ig::BeginPopup(popupName, m_show, popupSz)) { ImGui::InputInt("Scale", &m_scale); m_scale = ox::clamp(m_scale, 1, 135); - if (ig::PopupControlsOkCancel(popupWidth, m_show) == ig::PopupResponse::OK) { + if (ig::PopupControlsOkCancel(m_show) == ig::PopupResponse::OK) { inputSubmitted.emit(m_scale); } ImGui::EndPopup(); diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp index b941df3..d02959f 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp @@ -27,7 +27,7 @@ class TileSheetEditorImGui: public studio::Editor { public: ox::Signal inputSubmitted; void show(ox::StringViewCR name, int cols, int rows) noexcept; - void draw(turbine::Context &tctx) noexcept; + void draw() noexcept; void close() noexcept; [[nodiscard]] constexpr bool isOpen() const noexcept { return m_show; } @@ -39,7 +39,7 @@ class TileSheetEditorImGui: public studio::Editor { public: ox::Signal inputSubmitted; void show() noexcept; - void draw(turbine::Context &tctx) noexcept; + void draw() noexcept; void close() noexcept; [[nodiscard]] constexpr bool isOpen() const noexcept { return m_show; } diff --git a/deps/nostalgia/src/olympic/applib/applib.cpp b/deps/nostalgia/src/olympic/applib/applib.cpp index b3ac97a..ba09918 100644 --- a/deps/nostalgia/src/olympic/applib/applib.cpp +++ b/deps/nostalgia/src/olympic/applib/applib.cpp @@ -9,6 +9,10 @@ #define OLYMPIC_PROJECT_NAME "OlympicProject" #endif +#ifndef OLYMPIC_APP_ID +#define OLYMPIC_APP_ID "AppID" +#endif + #ifndef OLYMPIC_APP_NAME #define OLYMPIC_APP_NAME "App" #endif diff --git a/deps/nostalgia/src/olympic/keel/include/keel/asset.hpp b/deps/nostalgia/src/olympic/keel/include/keel/asset.hpp index eccdf4b..3283de7 100644 --- a/deps/nostalgia/src/olympic/keel/include/keel/asset.hpp +++ b/deps/nostalgia/src/olympic/keel/include/keel/asset.hpp @@ -17,14 +17,14 @@ ox::Result readUuidHeader(ox::BufferView const &buff) noexcept; ox::Result regenerateUuidHeader(ox::Buffer &buff) noexcept; -ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const &uuid) noexcept { +constexpr ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const &uuid) noexcept { OX_RETURN_ERROR(write(writer, "K1;")); OX_RETURN_ERROR(uuid.toString(writer)); return writer.put(';'); } template -ox::Result readAsset(ox::BufferView buff) noexcept { +constexpr ox::Result readAsset(ox::BufferView buff) noexcept { auto const err = readUuidHeader(buff).error; if (!err) { buff += K1HdrSz; // the size of K1 headers diff --git a/deps/nostalgia/src/olympic/keel/include/keel/media.hpp b/deps/nostalgia/src/olympic/keel/include/keel/media.hpp index e53bcef..7b07242 100644 --- a/deps/nostalgia/src/olympic/keel/include/keel/media.hpp +++ b/deps/nostalgia/src/olympic/keel/include/keel/media.hpp @@ -189,8 +189,4 @@ ox::Error setRomFs(Context &ctx, ox::UPtr &&fs) noexcept; ox::Result> loadRomFs(ox::StringViewCR path) noexcept; -ox::Result loadRom(ox::StringViewCR path = "") noexcept; - -void unloadRom(char*) noexcept; - } diff --git a/deps/nostalgia/src/olympic/keel/include/keel/module.hpp b/deps/nostalgia/src/olympic/keel/include/keel/module.hpp index 0053e80..746b643 100644 --- a/deps/nostalgia/src/olympic/keel/include/keel/module.hpp +++ b/deps/nostalgia/src/olympic/keel/include/keel/module.hpp @@ -37,9 +37,11 @@ class Module { virtual ox::Vector packTransforms() const noexcept; }; -void registerModule(Module const*mod) noexcept; +void registerModule(Module const &mod) noexcept; + +void registerModule(Module const *mod) noexcept; [[nodiscard]] -ox::Vector const &modules() noexcept; +ox::Vector const &modules() noexcept; } diff --git a/deps/nostalgia/src/olympic/keel/include/keel/typeconv.hpp b/deps/nostalgia/src/olympic/keel/include/keel/typeconv.hpp index df3232f..33282b4 100644 --- a/deps/nostalgia/src/olympic/keel/include/keel/typeconv.hpp +++ b/deps/nostalgia/src/olympic/keel/include/keel/typeconv.hpp @@ -19,7 +19,7 @@ class Wrap { public: virtual ~Wrap() = default; [[nodiscard]] - virtual ox::CStringView typeName() const noexcept = 0; + virtual ox::StringLiteral typeName() const noexcept = 0; [[nodiscard]] virtual int typeVersion() const noexcept = 0; [[nodiscard]] @@ -48,7 +48,7 @@ class WrapRef final: public WrapT { constexpr explicit WrapRef(T &obj): m_obj{obj} {} [[nodiscard]] - ox::CStringView typeName() const noexcept override { + ox::StringLiteral typeName() const noexcept override { return ox::ModelTypeName_v; } @@ -77,7 +77,7 @@ class WrapInline final: public WrapT { } [[nodiscard]] - ox::CStringView typeName() const noexcept override { + ox::StringLiteral typeName() const noexcept override { return ox::ModelTypeName_v; } @@ -108,7 +108,7 @@ class BaseConverter { constexpr virtual ~BaseConverter() noexcept = default; [[nodiscard]] - constexpr virtual ox::StringView srcTypeName() const noexcept = 0; + constexpr virtual ox::StringLiteral srcTypeName() const noexcept = 0; [[nodiscard]] constexpr virtual int srcTypeVersion() const noexcept = 0; @@ -154,7 +154,7 @@ class ConverterFunc final: public BaseConverter { using DstType = typename decltype(extractParams(Func))::Dst; [[nodiscard]] - constexpr ox::StringView srcTypeName() const noexcept override { + constexpr ox::StringLiteral srcTypeName() const noexcept override { return ox::ModelTypeName_v; } @@ -253,19 +253,22 @@ template ox::Result convertObjToObj( Context &ctx, auto &src) noexcept { - OX_REQUIRE_M(out, convert(ctx, WrapRef{src}, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); + OX_REQUIRE_M(out, + convert(ctx, WrapRef{src}, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); return std::move(wrapCast(*out)); } template ox::Result convert(Context &ctx, ox::BufferView const &src) noexcept { - OX_REQUIRE(out, convert(ctx, src, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); + OX_REQUIRE(out, + convert(ctx, src, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); return std::move(wrapCast(*out)); } template ox::Error convert(Context &ctx, ox::BufferView const &buff, DstType &outObj) noexcept { - OX_REQUIRE(out, convert(ctx, buff, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); + OX_REQUIRE(out, + convert(ctx, buff, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); outObj = std::move(wrapCast(*out)); return {}; } @@ -280,7 +283,8 @@ ox::Error convertObjToObj(Context &ctx, auto &src, DstType &outObj) noexcept { template ox::Result convertBuffToBuff( Context &ctx, ox::BufferView const &src, ox::ClawFormat const fmt) noexcept { - OX_REQUIRE(out, convert(ctx, src, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); + OX_REQUIRE(out, + convert(ctx, src, ox::ModelTypeName_v, ox::ModelTypeVersion_v)); return ox::writeClaw(wrapCast(*out), fmt); } diff --git a/deps/nostalgia/src/olympic/keel/src/media.cpp b/deps/nostalgia/src/olympic/keel/src/media.cpp index a8f44ef..c5fd283 100644 --- a/deps/nostalgia/src/olympic/keel/src/media.cpp +++ b/deps/nostalgia/src/olympic/keel/src/media.cpp @@ -12,7 +12,7 @@ namespace keel { -ox::Result loadRom(ox::StringViewCR path) noexcept { +static ox::Result 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); @@ -33,8 +33,8 @@ ox::Result loadRom(ox::StringViewCR path) noexcept { } } -void unloadRom(char *rom) noexcept { - ox::safeDelete(rom); +static void unloadRom(char *rom) noexcept { + ox::safeDeleteArray(rom); } static void clearUuidMap(Context &ctx) noexcept { @@ -212,7 +212,7 @@ static ox::Error buildUuidMap(Context&, DuplicateSet*) noexcept { return {}; } -ox::Result loadRom(ox::StringViewCR) noexcept { +static ox::Result loadRom(ox::StringViewCR) noexcept { // put the header in the wrong order to prevent mistaking this code for the // media section constexpr auto headerP2 = "R_______________"; @@ -229,7 +229,7 @@ ox::Result loadRom(ox::StringViewCR) noexcept { return ox::Error(1); } -void unloadRom(char*) noexcept { +static void unloadRom(char*) noexcept { } ox::Result getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept { diff --git a/deps/nostalgia/src/olympic/keel/src/module.cpp b/deps/nostalgia/src/olympic/keel/src/module.cpp index d66828a..4784317 100644 --- a/deps/nostalgia/src/olympic/keel/src/module.cpp +++ b/deps/nostalgia/src/olympic/keel/src/module.cpp @@ -8,9 +8,13 @@ namespace keel { static ox::Vector mods; +void registerModule(Module const &mod) noexcept { + mods.emplace_back(&mod); +} + void registerModule(Module const *mod) noexcept { if (mod) { - mods.emplace_back(mod); + registerModule(*mod); } } diff --git a/deps/nostalgia/src/olympic/keel/src/pack.cpp b/deps/nostalgia/src/olympic/keel/src/pack.cpp index 0ae68c1..3bb780d 100644 --- a/deps/nostalgia/src/olympic/keel/src/pack.cpp +++ b/deps/nostalgia/src/olympic/keel/src/pack.cpp @@ -38,8 +38,9 @@ static ox::Error pathToInode( auto const uuid = ox::substr(path, 7); OX_RETURN_ERROR(keel::uuidToPath(ctx, uuid).to().moveTo(path)); } - auto const s = dest.stat(path); - auto const inode = s.ok() ? s.value.inode : 0; + auto const inode = dest.stat(path) + .or_value({.inode = 0}) + .inode; OX_RETURN_ERROR(typeVal->set(static_cast(ox::FileAddressType::Inode))); oxOutf("\tpath to inode: {} => {}\n", path, inode); return data.set(2, inode); @@ -49,6 +50,7 @@ static ox::Error transformFileAddressesObj( Context &ctx, ox::FileSystem const &dest, ox::ModelObject &obj) noexcept; + static ox::Error transformFileAddressesVec( Context &ctx, ox::FileSystem const &dest, @@ -58,14 +60,18 @@ static ox::Error transformFileAddresses( Context &ctx, ox::FileSystem const &dest, ox::ModelValue &v) noexcept { - if (v.type() == ox::ModelValue::Type::Object) { - auto &obj = v.get(); - return transformFileAddressesObj(ctx, dest, obj); - } else if (v.type() == ox::ModelValue::Type::Vector) { - auto &vec = v.get(); - return transformFileAddressesVec(ctx, dest, vec); + switch (v.type()) { + case ox::ModelValue::Type::Object: { + auto &obj = v.get(); + return transformFileAddressesObj(ctx, dest, obj); + } + case ox::ModelValue::Type::Vector: { + auto &vec = v.get(); + return transformFileAddressesVec(ctx, dest, vec); + } + default: + return {}; } - return {}; } static ox::Error transformFileAddressesVec( diff --git a/deps/nostalgia/src/olympic/studio/applib/src/CMakeLists.txt b/deps/nostalgia/src/olympic/studio/applib/src/CMakeLists.txt index 555550e..fd0a6f3 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/CMakeLists.txt +++ b/deps/nostalgia/src/olympic/studio/applib/src/CMakeLists.txt @@ -6,6 +6,7 @@ add_library( font.cpp popups/about.cpp popups/deleteconfirmation.cpp + popups/fileinfo.cpp popups/makecopy.cpp popups/newdir.cpp popups/newmenu.cpp @@ -19,6 +20,7 @@ target_compile_definitions( OLYMPIC_GUI_APP=1 OLYMPIC_LOAD_STUDIO_MODULES=1 OLYMPIC_APP_NAME="Studio" + OLYMPIC_APP_ID="net.drinkingtea.nostalgia.NostalgiaStudio" ) target_link_libraries( StudioAppLib PUBLIC @@ -46,3 +48,5 @@ install( LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) + +add_subdirectory(subcommands) \ No newline at end of file diff --git a/deps/nostalgia/src/olympic/studio/applib/src/app.cpp b/deps/nostalgia/src/olympic/studio/applib/src/app.cpp index 186d84f..befaf11 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/app.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/app.cpp @@ -14,24 +14,69 @@ #include #include +#include "subcommands/change-format/change-format.hpp" + +#include "configfile.hpp" +#include "font.hpp" #include "studioui.hpp" namespace studio { +static ox::Error convertStudioConfigV1ToStudioConfigV2( + keel::Context&, + StudioConfigV1 &src, + StudioConfigV2 &dst) noexcept { + dst.projects.emplace_back(StudioConfigV2::ProjectConfig{ + .projectPath = std::move(src.projectPath), + .activeTabItemName = std::move(src.activeTabItemName), + .openFiles = std::move(src.openFiles), + }); + dst.showProjectExplorer = src.showProjectExplorer; + return {}; +} + +static struct: Module { + ox::String id() const noexcept final { + return ox::String{"net.drinkingtea.studio"}; + } + + ox::Vector commands() const final { + return { + { + "change-format", + cmdChangeFormat, + } + }; + } +} constexpr mod; + +static struct: keel::Module { + ox::String id() const noexcept override { + return ox::String{"net.drinkingtea.studio"}; + } + + ox::Vector converters() const noexcept override { + return { + keel::Converter::make(), + }; + } +} constexpr kmod; + + class StudioUIDrawer: public turbine::gl::Drawer { private: StudioUI &m_ui; public: explicit StudioUIDrawer(StudioUI &ui) noexcept: m_ui(ui) { } - protected: + void draw(turbine::Context&) noexcept final { m_ui.draw(); } }; -static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept { - auto const sctx = turbine::applicationData(ctx); +static void keyEventHandler(turbine::Context &ctx, turbine::Key const key, bool const down) noexcept { + auto const sctx = turbine::applicationData(ctx); sctx->ui.handleKeyEvent(key, down); } @@ -47,7 +92,9 @@ static ox::Error runStudio( ox::StringViewCR appName, ox::StringViewCR projectDataDir, ox::UPtr &&fs) noexcept { - OX_REQUIRE_M(ctx, turbine::init(std::move(fs), appName)); + OX_REQUIRE_M( + ctx, + turbine::init(std::move(fs), appName, "net.drinkingtea.nostalgia.NostalgiaStudio")); oxLogError(turbine::setWindowIcon(*ctx, WindowIcons())); turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName); turbine::setKeyEventHandler(*ctx, keyEventHandler); @@ -65,6 +112,8 @@ static ox::Error run( ox::StringViewCR appName, ox::StringViewCR projectDataDir, ox::SpanView const &args) { + keel::registerModule(kmod); + registerModule(&mod); // seed UUID generator auto const time = std::time(nullptr); ox::UUID::seedGenerator({ @@ -83,7 +132,7 @@ static ox::Error run( if (m->id() == moduleId) { for (auto const &c : m->commands()) { if (c.name == subCmd) { - auto kctx = keel::init( + auto const kctx = keel::init( ox::make_unique(projectDir), c.name); if (kctx.error) { diff --git a/deps/nostalgia/src/olympic/studio/applib/src/configfile.hpp b/deps/nostalgia/src/olympic/studio/applib/src/configfile.hpp new file mode 100644 index 0000000..c1e193b --- /dev/null +++ b/deps/nostalgia/src/olympic/studio/applib/src/configfile.hpp @@ -0,0 +1,68 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +#include +#include + +#include + +namespace studio { + +struct StudioConfigV1 { + static constexpr auto TypeName = "net.drinkingtea.studio.StudioConfig"; + static constexpr auto TypeVersion = 1; + ox::String projectPath; + ox::String activeTabItemName; + ox::Vector openFiles; + bool showProjectExplorer = true; +}; + +OX_MODEL_BEGIN(StudioConfigV1) + 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() + + +struct StudioConfigV2 { + static constexpr auto TypeName = "net.drinkingtea.studio.StudioConfig"; + static constexpr auto TypeVersion = 2; + struct ProjectConfig { + static constexpr auto TypeName = "net.drinkingtea.studio.ProjectConfig"; + static constexpr auto TypeVersion = 2; + ox::String projectPath; + ox::String activeTabItemName; + ox::Vector openFiles; + }; + ox::Vector projects; + bool showProjectExplorer = true; + + [[nodiscard]] + constexpr ProjectConfig const *project() const { + return projects.empty() ? nullptr : &projects[0]; + } + + [[nodiscard]] + constexpr ProjectConfig *project() { + return projects.empty() ? nullptr : &projects[0]; + } +}; + +OX_MODEL_BEGIN(StudioConfigV2::ProjectConfig) + 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_END() + +OX_MODEL_BEGIN(StudioConfigV2) + OX_MODEL_FIELD(projects) + OX_MODEL_FIELD_RENAME(showProjectExplorer, show_project_explorer) +OX_MODEL_END() + +using StudioConfig = StudioConfigV2; + +} diff --git a/deps/nostalgia/src/olympic/studio/applib/src/popups/about.cpp b/deps/nostalgia/src/olympic/studio/applib/src/popups/about.cpp index a1eb89a..cc3d946 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/popups/about.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/popups/about.cpp @@ -22,7 +22,7 @@ AboutPopup::AboutPopup(turbine::Context &ctx) noexcept: #endif } -void AboutPopup::draw(Context &sctx) noexcept { +void AboutPopup::draw(Context&) noexcept { if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { close(); return; @@ -37,12 +37,12 @@ void AboutPopup::draw(Context &sctx) noexcept { case Stage::Open: { constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; - ig::centerNextWindow(sctx.tctx); + ig::centerNextWindow(); auto open = true; if (ImGui::BeginPopupModal("About", &open, modalFlags)) { ImGui::Text("%s\n\nBuild date: %s", m_text.c_str(), __DATE__); ImGui::NewLine(); - ImGui::Dummy({148.0f, 0.0f}); + ig::Dummy({148.0f, 0.0f}); ImGui::SameLine(); if (ig::PushButton("Close")) { ImGui::CloseCurrentPopup(); diff --git a/deps/nostalgia/src/olympic/studio/applib/src/popups/fileinfo.cpp b/deps/nostalgia/src/olympic/studio/applib/src/popups/fileinfo.cpp new file mode 100644 index 0000000..b13fc23 --- /dev/null +++ b/deps/nostalgia/src/olympic/studio/applib/src/popups/fileinfo.cpp @@ -0,0 +1,127 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#include "fileinfo.hpp" + +namespace studio { + +FileInfo::FileInfo(Context &sctx) noexcept: + Popup("File Info"), + m_sctx(sctx) {} + +ox::Error FileInfo::open(ox::StringParam filePath) noexcept { + m_filePath = std::move(filePath); + auto &fs = m_sctx.project->romFs(); + OX_REQUIRE(fileBuff, fs.read(m_filePath)); + auto [hdr, err] = keel::readAssetHeader(fileBuff); + if (!err) { + m_fileInfo.emplace(Info{ + .assetId = hdr.uuid.toString(), + .typeName = std::move(hdr.clawHdr.typeName), + .typeVersion = hdr.clawHdr.typeVersion, + .format = [&hdr] { + switch (hdr.clawHdr.fmt) { + case ox::ClawFormat::Metal: + return ox::StringLiteral{"Metal Claw"}; + case ox::ClawFormat::Organic: + return ox::StringLiteral{"Organic Claw"}; + default: + return ox::StringLiteral{"Other"}; + } + }(), + .dataSize = hdr.clawHdr.dataSize, + }); + } + Popup::open(); + return {}; +} + +void FileInfo::draw(Context&) noexcept { + if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { + close(); + return; + } + switch (m_stage) { + case Stage::Closed: + break; + case Stage::Opening: + ImGui::OpenPopup(m_title.c_str()); + m_stage = Stage::Open; + [[fallthrough]]; + case Stage::Open: { + constexpr auto modalFlags = + ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; + ig::centerNextWindow(); + auto open = true; + if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) { + drawTable(); + switch (auto const r = ig::PopupControlsOk(m_open, "Close")) { + case ig::PopupResponse::None: + break; + case ig::PopupResponse::OK: + response.emit(r); + m_fileInfo.reset(); + m_filePath = ox::String{}; + close(); + break; + case ig::PopupResponse::Cancel: + break; + } + ImGui::EndPopup(); + } + if (!open) { + m_stage = Stage::Closed; + } + break; + } + } +} + +void FileInfo::drawTable() const noexcept { + auto const scale = ig::dpiScale(); + ig::IDStackItem const idStackItem{"FileInfo"}; + ImGui::Text("%s", m_filePath.c_str()); + if (m_fileInfo && ImGui::BeginTable( + "Table", 2, + ImGuiTableFlags_Borders | + ImGuiTableFlags_RowBg)) { + ImGui::TableSetupColumn("Field", ImGuiTableColumnFlags_WidthFixed, 70 * scale); + ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_NoHide); + // asset id + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("Asset ID:"); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%s", m_fileInfo->assetId.c_str()); + // typeName + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("Type Name:"); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%s", m_fileInfo->typeName.c_str()); + // typeVersion + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("Type Version:"); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%d", m_fileInfo->typeVersion); + // format + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("Format:"); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%s", m_fileInfo->format.c_str()); + // size + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("Data Size:"); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%lluB", m_fileInfo->dataSize); + ImGui::EndTable(); + } else { + ImGui::Text("No information available"); + } +} + +} diff --git a/deps/nostalgia/src/olympic/studio/applib/src/popups/fileinfo.hpp b/deps/nostalgia/src/olympic/studio/applib/src/popups/fileinfo.hpp new file mode 100644 index 0000000..b813e0f --- /dev/null +++ b/deps/nostalgia/src/olympic/studio/applib/src/popups/fileinfo.hpp @@ -0,0 +1,40 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +#include + +#include +#include + +namespace studio { + +class FileInfo: public ig::Popup { + private: + Context &m_sctx; + ox::String m_filePath; + struct Info { + ox::UUIDStr assetId; + ox::String typeName; + int typeVersion{}; + ox::StringLiteral format; + // use manual sizing to work with %ull + unsigned long long dataSize{}; + }; + ox::Optional m_fileInfo; + + public: + explicit FileInfo(Context &sctx) noexcept; + + ox::Error open(ox::StringParam filePath) noexcept; + + void draw(Context &sctx) noexcept override; + + private: + void drawTable() const noexcept; + +}; + +} \ No newline at end of file diff --git a/deps/nostalgia/src/olympic/studio/applib/src/popups/makecopy.cpp b/deps/nostalgia/src/olympic/studio/applib/src/popups/makecopy.cpp index fa99817..266d84e 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/popups/makecopy.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/popups/makecopy.cpp @@ -37,9 +37,10 @@ void MakeCopyPopup::draw(Context &ctx) noexcept { m_stage = Stage::Open; m_open = true; [[fallthrough]]; - case Stage::Open: - ig::centerNextWindow(ctx.tctx); - ImGui::SetNextWindowSize({250, 0}); + case Stage::Open: { + auto const scale = ig::dpiScale(); + ig::centerNextWindow(); + ImGui::SetNextWindowSize({250 * scale, 0}); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | @@ -67,6 +68,7 @@ void MakeCopyPopup::draw(Context &ctx) noexcept { ImGui::EndPopup(); } break; + } } } diff --git a/deps/nostalgia/src/olympic/studio/applib/src/popups/newmenu.cpp b/deps/nostalgia/src/olympic/studio/applib/src/popups/newmenu.cpp index 9e6d68d..f0189e6 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/popups/newmenu.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/popups/newmenu.cpp @@ -134,9 +134,10 @@ void NewMenu::drawNewItemPath(Context &sctx) noexcept { } void NewMenu::drawButtons(Stage const next) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); - constexpr ImVec2 btnSz{60, 20}; + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); + ImVec2 const btnSz{60 * scale, ig::BtnSz.y * scale}; if (ImGui::Button("Back", btnSz)) { if (auto const p = m_prev.back(); p.ok()) { m_stage = *p.value; @@ -156,9 +157,10 @@ void NewMenu::drawButtons(Stage const next) noexcept { } void NewMenu::drawFirstPageButtons(Stage const next) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 130); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); - constexpr ImVec2 btnSz{60, 20}; + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 130 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); + ImVec2 const btnSz{60 * scale, ig::BtnSz.y * scale}; if (ImGui::Button("Next", btnSz)) { m_prev.emplace_back(m_stage); m_stage = next; @@ -171,9 +173,10 @@ void NewMenu::drawFirstPageButtons(Stage const next) noexcept { } void NewMenu::drawLastPageButtons(Context &sctx) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); - constexpr ImVec2 btnSz{60, 20}; + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); + ImVec2 const btnSz{60 * scale, ig::BtnSz.y * scale}; if (ImGui::Button("Back", btnSz)) { if (auto const p = m_prev.back(); p.ok()) { m_stage = *p.value; diff --git a/deps/nostalgia/src/olympic/studio/applib/src/popups/newproject.cpp b/deps/nostalgia/src/olympic/studio/applib/src/popups/newproject.cpp index 2e2038a..1853e12 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/popups/newproject.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/popups/newproject.cpp @@ -65,8 +65,9 @@ void NewProject::drawNewProjectName(Context &sctx) noexcept { } void NewProject::drawLastPageButtons(Context&) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 110); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22); + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 110 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); if (ig::PushButton("Finish")) { finish(); } diff --git a/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.cpp b/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.cpp index 6eb9074..c289007 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.cpp @@ -36,6 +36,13 @@ void ProjectExplorer::dirMoved(ox::StringViewCR src, ox::StringViewCR dst) const void ProjectExplorer::fileContextMenu(ox::StringViewCR path) const noexcept { if (ImGui::BeginPopupContextItem("FileMenu", ImGuiPopupFlags_MouseButtonRight)) { + if (ImGui::MenuItem("Open")) { + fileChosen.emit(path); + } + if (ImGui::MenuItem("Get Info")) { + getInfo.emit(path); + } + ImGui::Separator(); if (ImGui::MenuItem("Delete")) { deleteItem.emit(path); } diff --git a/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.hpp b/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.hpp index 74bcaef..e749880 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.hpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/projectexplorer.hpp @@ -21,6 +21,7 @@ class ProjectExplorer final: public FileExplorer { ox::Signal deleteItem; ox::Signal renameItem; ox::Signal makeCopy; + ox::Signal getInfo; ox::Signal moveDir; ox::Signal moveItem; diff --git a/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp b/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp index 3b91045..7daffd5 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp @@ -43,7 +43,7 @@ ox::Vector const &modules() noexcept { return g_modules; } -void registerModule(Module const*mod) noexcept { +void registerModule(Module const *mod) noexcept { if (mod) { g_modules.emplace_back(mod); } @@ -121,19 +121,7 @@ using StudioConfig = StudioConfigV2; StudioUI::StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexcept: m_sctx{*this, tctx}, m_projectDataDir{std::move(projectDataDir)} { - { - ImFontConfig fontCfg; - fontCfg.FontDataOwnedByAtlas = false; - auto const &io = ImGui::GetIO(); - auto const font = files::RobotoMedium_ttf(); - // const_cast is needed because this data is definitely const, - // but AddFontFromMemoryTTF requires a mutable buffer. - // However, setting fontCfg.FontDataOwnedByAtlas ensures - // that it will still be treated as const. - // ImGui documentation recognizes that this is a bad design, - // and hopefully it will change at some point. - io.Fonts->AddFontFromMemoryTTF(const_cast(font.data()), static_cast(font.size()), 13, &fontCfg); - } + loadFont(); auto &kctx = keelCtx(m_tctx); kctx.converters.emplace_back(keel::Converter::make()); oxLogError(headerizeConfigFile(kctx)); @@ -146,6 +134,7 @@ StudioUI::StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexc m_projectExplorer.addDir.connect(this, &StudioUI::addDir); m_projectExplorer.addItem.connect(this, &StudioUI::addFile); m_projectExplorer.deleteItem.connect(this, &StudioUI::deleteFile); + m_projectExplorer.getInfo.connect(this, &StudioUI::getFileInfo); m_projectExplorer.renameItem.connect(this, &StudioUI::renameFile); m_projectExplorer.makeCopy.connect(this, &StudioUI::makeCopyDlg); m_projectExplorer.moveDir.connect(this, &StudioUI::queueDirMove); @@ -196,6 +185,12 @@ void StudioUI::handleNavigationChange(ox::StringParam path, ox::StringParam navA } void StudioUI::draw() noexcept { + if (turbine::isWayland() || ox::defines::OS == ox::OS::Darwin) { + ig::setDpiScale(1.f); + } else { + loadFont(); + ig::setDpiScale(ImGui::GetWindowDpiScale()); + } glutils::clearScreen(); drawMenu(); auto const &viewport = *ImGui::GetMainViewport(); @@ -214,7 +209,7 @@ void StudioUI::draw() noexcept { ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy); if (m_showProjectExplorer) { auto const v = ImGui::GetContentRegionAvail(); - m_projectExplorer.draw(m_sctx, {300, v.y}); + m_projectExplorer.draw(m_sctx, {300 * ig::dpiScale(), v.y}); ImGui::SameLine(); } drawTabBar(); @@ -228,6 +223,29 @@ void StudioUI::draw() noexcept { procFileMoves(); } +void StudioUI::loadFont() noexcept { + auto const scale = turbine::isWayland() || ox::defines::OS == ox::OS::Darwin ? + 1.f : turbine::scale(m_tctx); + if (m_fontScale != scale) { + m_fontScale = scale; + ImFontConfig fontCfg; + fontCfg.FontDataOwnedByAtlas = false; + auto const &io = ImGui::GetIO(); + auto const font = files::RobotoMedium_ttf(); + // const_cast is needed because this data is definitely const, + // but AddFontFromMemoryTTF requires a mutable buffer. + // However, setting fontCfg.FontDataOwnedByAtlas ensures + // that it will still be treated as const. + // ImGui documentation recognizes that this is a bad design, + // and hopefully it will change at some point. + io.Fonts->AddFontFromMemoryTTF( + const_cast(font.data()), + static_cast(font.size()), + 13 * scale, + &fontCfg); + } +} + bool StudioUI::handleShutdown() noexcept { auto const out = ox::all_of(m_editors.begin(), m_editors.end(), [](ox::UPtr const &e) { return !e->unsavedChanges(); @@ -569,6 +587,10 @@ ox::Error StudioUI::deleteFile(ox::StringViewCR path) noexcept { return {}; } +ox::Error StudioUI::getFileInfo(ox::StringViewCR path) noexcept { + return m_fileInfo.open(path); +} + ox::Error StudioUI::renameFile(ox::StringViewCR path) noexcept { return m_renameFile.openPath(path); } diff --git a/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp b/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp index dc75878..de35897 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp @@ -21,6 +21,7 @@ #include "popups/newmenu.hpp" #include "popups/newproject.hpp" #include "projectexplorer.hpp" +#include "popups/fileinfo.hpp" #include "popups/renamefile.hpp" namespace studio { @@ -48,6 +49,7 @@ class StudioUI final: public ox::SignalHandler { NewMenu m_newMenu{keelCtx(m_tctx)}; AboutPopup m_aboutPopup{m_tctx}; DeleteConfirmation m_deleteConfirmation; + FileInfo m_fileInfo{m_sctx}; NewDir m_newDirDialog; ig::QuestionPopup m_closeFileConfirm{"Close File?", "This file has unsaved changes. Close?"}; ig::QuestionPopup m_closeAppConfirm{ @@ -62,10 +64,11 @@ class StudioUI final: public ox::SignalHandler { ig::QuestionPopup dlg{"Remove From Recents?", "Unable to load project. Remove from recent projects?"}; size_t idx{}; } m_removeRecentProject; - ox::Array const m_widgets { + ox::Array const m_widgets { &m_closeFileConfirm, &m_closeAppConfirm, &m_copyFilePopup, + &m_fileInfo, &m_newMenu, &m_newProject, &m_aboutPopup, @@ -81,6 +84,7 @@ class StudioUI final: public ox::SignalHandler { ox::String args; }; ox::Optional m_navAction; + float m_fontScale{}; public: explicit StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexcept; @@ -102,6 +106,8 @@ class StudioUI final: public ox::SignalHandler { void draw() noexcept; private: + void loadFont() noexcept; + void drawMenu() noexcept; void drawTabBar() noexcept; @@ -130,6 +136,8 @@ class StudioUI final: public ox::SignalHandler { ox::Error deleteFile(ox::StringViewCR path) noexcept; + ox::Error getFileInfo(ox::StringViewCR path) noexcept; + ox::Error renameFile(ox::StringViewCR path) noexcept; ox::Error handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR newPath, ox::UUID const &id) noexcept; diff --git a/deps/nostalgia/src/olympic/studio/applib/src/subcommands/CMakeLists.txt b/deps/nostalgia/src/olympic/studio/applib/src/subcommands/CMakeLists.txt new file mode 100644 index 0000000..737afc3 --- /dev/null +++ b/deps/nostalgia/src/olympic/studio/applib/src/subcommands/CMakeLists.txt @@ -0,0 +1,10 @@ + +target_sources( + StudioAppLib PRIVATE + change-format/change-format.cpp +) + +target_link_libraries( + StudioAppLib PUBLIC + OxClArgs +) \ No newline at end of file diff --git a/deps/nostalgia/src/olympic/studio/applib/src/subcommands/change-format/change-format.cpp b/deps/nostalgia/src/olympic/studio/applib/src/subcommands/change-format/change-format.cpp new file mode 100644 index 0000000..2f384d2 --- /dev/null +++ b/deps/nostalgia/src/olympic/studio/applib/src/subcommands/change-format/change-format.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2016 - 2026 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#include +#include + +#include + +#include "change-format.hpp" + +namespace studio { + +static ox::Error convertFile( + ox::FileSystem &fs, + ox::TypeStore &ts, + ox::StringViewCR path, + ox::ClawFormat const fmt) noexcept { + OX_REQUIRE_M(buff, fs.read(path).reoriginate(1, "unable to read file")); + OX_REQUIRE(uuid, keel::readUuidHeader(buff)); + OX_REQUIRE(obj, keel::readAsset(ts, buff).reoriginate(1, "unable to parse file")); + buff.clear(); + ox::BufferWriter writer{&buff}; + OX_RETURN_ERROR(keel::writeUuidHeader(writer, uuid)); + OX_RETURN_ERROR(ox::writeClaw(obj, writer, fmt)); + if (fmt == ox::ClawFormat::Organic) { + *buff.back().value = '\n'; + } + OX_RETURN_ERROR(fs.write(path, buff).reoriginate(1, "unable to write file")); + return {}; +} + +static void printUsage() noexcept { + oxErr("usage: change-format {mc,oc} [files...]\n"); +} + +[[nodiscard]] +static constexpr ox::Result getFmt(ox::StringViewCR fmtStr) noexcept { + if (caseInsensitiveStrCmp(fmtStr, "mc") == 0) { + return ox::ClawFormat::Metal; + } else if (caseInsensitiveStrCmp(fmtStr, "oc") == 0) { + return ox::ClawFormat::Organic; + } + return ox::Error{1, "invalid format"}; +} + +ox::Error cmdChangeFormat(Project &project, ox::SpanView const args) noexcept { + if (args.size() < 2) { + printUsage(); + return ox::Error{1, "invalid input"}; + } + auto const [fmt, fmtErr] = getFmt(args[0]); + if (fmtErr) { + printUsage(); + } + auto &fs = project.romFs(); + auto &ts = project.typeStore(); + for (auto const &file : args + 1) { + auto const err = convertFile(fs, ts, file, fmt); + if (err) { + oxErrf("Failed to convert {}: {}\n", file, err.msg); + } + } + return {}; +} + +} diff --git a/deps/nostalgia/src/olympic/studio/applib/src/subcommands/change-format/change-format.hpp b/deps/nostalgia/src/olympic/studio/applib/src/subcommands/change-format/change-format.hpp new file mode 100644 index 0000000..2f1aa93 --- /dev/null +++ b/deps/nostalgia/src/olympic/studio/applib/src/subcommands/change-format/change-format.hpp @@ -0,0 +1,13 @@ +/* + * Copyright 2016 - 2026 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +#include + +namespace studio { + +ox::Error cmdChangeFormat(Project &project, ox::SpanView args) noexcept; + +} \ No newline at end of file diff --git a/deps/nostalgia/src/olympic/studio/modlib/include/studio/imguiutil.hpp b/deps/nostalgia/src/olympic/studio/modlib/include/studio/imguiutil.hpp index 533da23..d1fbc0e 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/include/studio/imguiutil.hpp +++ b/deps/nostalgia/src/olympic/studio/modlib/include/studio/imguiutil.hpp @@ -9,15 +9,28 @@ #include #include +#include +#include +#include -#include -#include #include +namespace turbine { +class Context; +} + +namespace studio { +struct Context; +} + namespace studio::ig { inline constexpr auto BtnSz = ImVec2{52, 22}; +void setDpiScale(float scale) noexcept; + +[[nodiscard]] +float dpiScale() noexcept; constexpr ImTextureID toImTextureID(ox::Unsigned_c auto id) noexcept requires(sizeof(id) <= sizeof(ox::Uint)) { @@ -31,18 +44,18 @@ ox::Result getDragDropPayload(ox::CStringViewCR name) noexcept { return ox::Error(1, "No drag/drop payload"); } return ox::readClaw({ - std::launder(reinterpret_cast(payload->Data)), + static_cast(payload->Data), static_cast(payload->DataSize)}); } template ox::Result getDragDropPayload() noexcept { - auto const payload = ImGui::AcceptDragDropPayload(ox::ModelTypeName_v); + auto const payload = ImGui::AcceptDragDropPayload(ox::ModelTypeName_v.c_str()); if (!payload) { return ox::Error(1, "No drag/drop payload"); } return ox::readClaw({ - reinterpret_cast(payload->Data), + static_cast(payload->Data), static_cast(payload->DataSize)}); } @@ -55,7 +68,7 @@ ox::Error setDragDropPayload(ox::CStringViewCR name, auto const &obj) noexcept { template ox::Error setDragDropPayload(T const &obj) noexcept { OX_REQUIRE(buff, ox::writeClaw(obj, ox::ClawFormat::Metal)); - ImGui::SetDragDropPayload(ox::ModelTypeName_v, buff.data(), buff.size()); + ImGui::SetDragDropPayload(ox::ModelTypeName_v.c_str(), buff.data(), buff.size()); return {}; } @@ -64,8 +77,8 @@ class DragDropSource { private: bool const m_active{}; public: - DragDropSource(ImGuiDragDropFlags const flags = 0) noexcept: - m_active(ImGui::BeginDragDropSource(flags)) { + explicit DragDropSource(ImGuiDragDropFlags const flags = 0) noexcept: + m_active{ImGui::BeginDragDropSource(flags)} { } ~DragDropSource() noexcept { if (m_active) { @@ -124,7 +137,7 @@ auto dragDropTarget(auto const &cb) noexcept { class ChildStackItem { public: - explicit ChildStackItem(ox::CStringViewCR id, ImVec2 const &sz = {}) noexcept; + explicit ChildStackItem(ox::CStringViewCR id, ImVec2 sz = {}) noexcept; ~ChildStackItem() noexcept; }; @@ -144,7 +157,12 @@ class IndentStackItem { ~IndentStackItem() noexcept; }; -void centerNextWindow(turbine::Context &ctx) noexcept; +void centerNextWindow() noexcept; + +inline void Dummy(ImVec2 const &sz) noexcept { + auto const scale = dpiScale(); + ImGui::Dummy({sz.x * scale, sz.y * scale}); +} bool PushButton(ox::CStringViewCR lbl, ImVec2 const &btnSz = BtnSz) noexcept; @@ -164,10 +182,10 @@ TextInput> InputText( ox::StringViewCR currentText, ImGuiInputTextFlags const flags = 0, ImGuiInputTextCallback const callback = nullptr, - void *user_data = nullptr) noexcept { + void *const userData = nullptr) noexcept { TextInput> out = {.text = currentText}; out.changed = ImGui::InputText( - label.c_str(), out.text.data(), MaxChars + 1, flags, callback, user_data); + label.c_str(), out.text.data(), MaxChars + 1, flags, callback, userData); if (out.changed) { OX_ALLOW_UNSAFE_BUFFERS_BEGIN std::ignore = out.text.unsafeResize(ox::strlen(out.text.c_str())); @@ -183,10 +201,10 @@ TextInput> InputTextWithHint( ox::StringViewCR currentText, ImGuiInputTextFlags const flags = 0, ImGuiInputTextCallback const callback = nullptr, - void *user_data = nullptr) noexcept { + void *userData = nullptr) noexcept { TextInput> out = {.text = currentText}; out.changed = ImGui::InputTextWithHint( - label.c_str(), hint.c_str(), out.text.data(), MaxChars + 1, flags, callback, user_data); + label.c_str(), hint.c_str(), out.text.data(), MaxChars + 1, flags, callback, userData); if (out.changed) { OX_ALLOW_UNSAFE_BUFFERS_BEGIN std::ignore = out.text.unsafeResize(ox::strlen(out.text.c_str())); @@ -201,9 +219,9 @@ bool InputText( ox::IString &text, ImGuiInputTextFlags const flags = 0, ImGuiInputTextCallback const callback = nullptr, - void *user_data = nullptr) noexcept { + void *userData = nullptr) noexcept { auto const out = ImGui::InputText( - label.c_str(), text.data(), StrCap + 1, flags, callback, user_data); + label.c_str(), text.data(), StrCap + 1, flags, callback, userData); if (out) { OX_ALLOW_UNSAFE_BUFFERS_BEGIN std::ignore = text.unsafeResize(ox::strlen(text.c_str())); @@ -234,7 +252,7 @@ PopupResponse PopupControlsOk( ox::CStringViewCR ok); [[nodiscard]] -bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 const &sz = {285, 0}); +bool BeginPopup(ox::CStringViewCR popupName, bool &show, ImVec2 sz = {285, 0}); /** * @@ -281,7 +299,7 @@ bool ListBox( std::function const &f, size_t strCnt, size_t &selIdx, - ImVec2 const &sz = {0, 0}) noexcept; + ImVec2 sz = {0, 0}) noexcept; /** * diff --git a/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp b/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp index aa56bb0..a9b8d08 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp +++ b/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp @@ -122,6 +122,16 @@ class Project: public ox::SignalHandler { ox::Error writeTypeStore() noexcept; + [[nodiscard]] + constexpr ox::TypeStore &typeStore() noexcept { + return m_typeStore; + } + + [[nodiscard]] + constexpr ox::TypeStore const &typeStore() const noexcept { + return m_typeStore; + } + private: void buildFileIndex() noexcept; @@ -155,7 +165,7 @@ template ox::Error Project::writeObj(ox::StringViewCR path, T const &obj, ox::ClawFormat fmt) noexcept { OX_REQUIRE_M(buff, ox::writeClaw(obj, fmt)); if (fmt == ox::ClawFormat::Organic) { - buff.pop_back(); + *buff.back().value = '\n'; } // write to FS OX_RETURN_ERROR(mkdir(parentDir(path))); diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/filepickerpopup.cpp b/deps/nostalgia/src/olympic/studio/modlib/src/filepickerpopup.cpp index c965c0e..df868a5 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/filepickerpopup.cpp +++ b/deps/nostalgia/src/olympic/studio/modlib/src/filepickerpopup.cpp @@ -2,6 +2,8 @@ * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. */ +#include + #include #include @@ -83,9 +85,10 @@ ox::Optional FilePickerPopup::draw(Context &ctx) noexcept { if (!m_open) { return out; } - if (ig::BeginPopup(ctx.tctx, m_name, m_open, {380, 340})) { + auto const scale = turbine::scale(ctx.tctx); + if (ig::BeginPopup(m_name, m_open, {380, 340})) { auto const vp = ImGui::GetContentRegionAvail(); - m_explorer.draw(ctx, {vp.x, vp.y - 30}); + m_explorer.draw(ctx, {vp.x, vp.y - 30 * scale}); if (ig::PopupControlsOkCancel(m_open) == ig::PopupResponse::OK || m_explorer.opened) { out = handlePick(); } diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/imguiutil.cpp b/deps/nostalgia/src/olympic/studio/modlib/src/imguiutil.cpp index bbff762..48e4a6a 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/imguiutil.cpp +++ b/deps/nostalgia/src/olympic/studio/modlib/src/imguiutil.cpp @@ -10,7 +10,25 @@ namespace studio::ig { -ChildStackItem::ChildStackItem(ox::CStringViewCR id, ImVec2 const &sz) noexcept { +static constexpr void scaleSz(ImVec2 &sz) noexcept { + auto const scale = dpiScale(); + sz.x *= scale; + sz.y *= scale; +} + +static thread_local float g_dpiScale = 1.f; + +void setDpiScale(float const scale) noexcept { + g_dpiScale = scale; +} + +[[nodiscard]] +float dpiScale() noexcept { + return g_dpiScale; +} + +ChildStackItem::ChildStackItem(ox::CStringViewCR id, ImVec2 sz) noexcept { + scaleSz(sz); ImGui::BeginChild(id.c_str(), sz); } @@ -33,7 +51,7 @@ IDStackItem::~IDStackItem() noexcept { } -IndentStackItem::IndentStackItem(float indent) noexcept: m_indent(indent) { +IndentStackItem::IndentStackItem(float id) noexcept: m_indent(id) { ImGui::Indent(m_indent); } @@ -42,16 +60,18 @@ IndentStackItem::~IndentStackItem() noexcept { } -void centerNextWindow(turbine::Context &ctx) noexcept { - auto const sz = turbine::getScreenSize(ctx); - auto const screenW = static_cast(sz.width); - auto const screenH = static_cast(sz.height); - auto const mod = ImGui::GetWindowDpiScale() * 2; - ImGui::SetNextWindowPos(ImVec2(screenW / mod, screenH / mod), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); +void centerNextWindow() noexcept { + auto const &io = ImGui::GetIO(); + auto const sz = io.DisplaySize; + ImGui::SetNextWindowPos( + {sz.x * 0.5f, sz.y * 0.5f}, + ImGuiCond_Always, + {0.5f, 0.5f}); } bool PushButton(ox::CStringViewCR lbl, ImVec2 const &btnSz) noexcept { - return ImGui::Button(lbl.c_str(), btnSz); + auto const scale = dpiScale(); + return ImGui::Button(lbl.c_str(), {btnSz.x * scale, btnSz.y * scale}); } PopupResponse PopupControlsOkCancel( @@ -60,9 +80,10 @@ PopupResponse PopupControlsOkCancel( ox::CStringViewCR ok, ox::CStringViewCR cancel) { auto out = PopupResponse::None; - constexpr auto btnSz = ImVec2{50, BtnSz.y}; + auto const scale = dpiScale(); + auto const btnSz = ImVec2{50 * scale, BtnSz.y * scale}; ImGui::Separator(); - ImGui::SetCursorPosX(popupWidth - 118); + ImGui::SetCursorPosX(popupWidth - 118 * scale); if (ImGui::Button(ok.c_str(), btnSz)) { popupOpen = false; out = PopupResponse::OK; @@ -79,16 +100,18 @@ PopupResponse PopupControlsOkCancel( bool &popupOpen, ox::CStringViewCR ok, ox::CStringViewCR cancel) { - return PopupControlsOkCancel(ImGui::GetContentRegionAvail().x + 17, popupOpen, ok, cancel); + auto const scale = dpiScale(); + return PopupControlsOkCancel(ImGui::GetContentRegionAvail().x + 17 * scale, popupOpen, ok, cancel); } PopupResponse PopupControlsOk( bool &popupOpen, ox::CStringViewCR ok) { + auto const scale = dpiScale(); auto out = PopupResponse::None; - constexpr auto btnSz = ImVec2{50, BtnSz.y}; + auto const btnSz = ImVec2{50 * scale, BtnSz.y * scale}; ImGui::Separator(); - ImGui::SetCursorPosX(ImGui::GetContentRegionAvail().x - 42); + ImGui::SetCursorPosX(ImGui::GetContentRegionAvail().x - 42 * scale); if (ImGui::Button(ok.c_str(), btnSz)) { popupOpen = false; out = PopupResponse::OK; @@ -101,23 +124,24 @@ PopupResponse PopupControlsOk( return out; } -bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 const &sz) { +bool BeginPopup(ox::CStringViewCR popupName, bool &show, ImVec2 sz) { + scaleSz(sz); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; - centerNextWindow(ctx); + centerNextWindow(); ImGui::OpenPopup(popupName.c_str()); ImGui::SetNextWindowSize(sz); return ImGui::BeginPopupModal(popupName.c_str(), &show, modalFlags); } bool ComboBox( - ox::CStringView const &lbl, + ox::CStringViewCR lbl, ox::SpanView const list, size_t &selectedIdx) noexcept { bool out{}; auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : ""; if (ImGui::BeginCombo(lbl.c_str(), first, 0)) { for (auto i = 0u; i < list.size(); ++i) { - auto const selected = (selectedIdx == i); + auto const selected = selectedIdx == i; if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) { selectedIdx = i; out = true; @@ -129,14 +153,14 @@ bool ComboBox( } bool ComboBox( - ox::CStringView const &lbl, + ox::CStringViewCR lbl, ox::Span const list, size_t &selectedIdx) noexcept { bool out{}; auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : ""; if (ImGui::BeginCombo(lbl.c_str(), first, 0)) { for (auto i = 0u; i < list.size(); ++i) { - auto const selected = (selectedIdx == i); + auto const selected = selectedIdx == i; if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) { selectedIdx = i; out = true; @@ -181,12 +205,14 @@ bool ListBox( std::function const &f, size_t const strCnt, size_t &selIdx, - ImVec2 const &sz) noexcept { + ImVec2 sz) noexcept { + auto const scale = dpiScale(); + sz = {sz.x * scale, sz.y * scale}; auto out = false; if (ImGui::BeginListBox(name.c_str(), sz)) { for (size_t i = 0; i < strCnt; ++i) { - auto str = f(i); - ig::IDStackItem const idStackItem2(static_cast(i)); + auto const str = f(i); + IDStackItem const idStackItem2(static_cast(i)); if (ImGui::Selectable(str.c_str(), selIdx == i)) { if (i != selIdx) { selIdx = i; @@ -200,13 +226,13 @@ bool ListBox( } bool ListBox(ox::CStringViewCR name, ox::SpanView const &list, size_t &selIdx) noexcept { - return ListBox(name, [list](size_t i) -> ox::CStringView { + return ListBox(name, [list](size_t const i) -> ox::CStringView { return list[i]; }, list.size(), selIdx); } bool ListBox(ox::CStringViewCR name, ox::SpanView const &list, size_t &selIdx) noexcept { - return ListBox(name, [list](size_t i) -> ox::CStringView { + return ListBox(name, [list](size_t const i) -> ox::CStringView { return list[i]; }, list.size(), selIdx); } @@ -229,7 +255,7 @@ void FilePicker::draw() noexcept { } auto constexpr popupSz = ImVec2{450.f, 0}; IDStackItem const idStackItem(m_title); - if (BeginPopup(m_sctx.tctx, m_title, m_show, popupSz)) { + if (BeginPopup(m_title, m_show, popupSz)) { auto const &list = m_sctx.project->fileList(m_fileExt); size_t selIdx{}; ComboBox(m_title, list, selIdx); @@ -284,7 +310,7 @@ void QuestionPopup::draw(Context &ctx) noexcept { turbine::requireRefreshFor(ctx.tctx, 1000); [[fallthrough]]; case Stage::Open: - centerNextWindow(ctx.tctx); + centerNextWindow(); ImGui::SetNextWindowSize({}); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) { @@ -319,7 +345,7 @@ void MessagePopup::show(ox::StringParam msg) noexcept { open(); } -void MessagePopup::draw(Context &ctx) noexcept { +void MessagePopup::draw(Context&) noexcept { switch (m_stage) { case Stage::Closed: break; @@ -329,7 +355,7 @@ void MessagePopup::draw(Context &ctx) noexcept { m_open = true; [[fallthrough]]; case Stage::Open: - centerNextWindow(ctx.tctx); + centerNextWindow(); ImGui::SetNextWindowSize({}); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) { diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/popup.cpp b/deps/nostalgia/src/olympic/studio/modlib/src/popup.cpp index 8868a56..0221c42 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/popup.cpp +++ b/deps/nostalgia/src/olympic/studio/modlib/src/popup.cpp @@ -7,9 +7,9 @@ namespace studio { -void Popup::drawWindow(turbine::Context &ctx, bool &open, std::function const &drawContents) { - ig::centerNextWindow(ctx); - ImGui::SetNextWindowSize(static_cast(m_size)); +void Popup::drawWindow(turbine::Context&, bool &open, std::function const &drawContents) { + ig::centerNextWindow(); + ImGui::SetNextWindowSize(static_cast(m_size * ig::dpiScale())); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) { drawContents(); diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp b/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp index 7312225..3e4658d 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp +++ b/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp @@ -14,13 +14,15 @@ namespace studio { static_assert(fileExt("main.c").value == "c"); +static_assert(fileExt("main.cc").value == "cc"); +static_assert(fileExt("main.cpp").value == "cpp"); static_assert(fileExt("a.b.c").value == "c"); static_assert(parentDir("/a/b/c") == "/a/b"); static_assert(parentDir("/a/b/c/") == "/a/b"); static void generateTypes(ox::TypeStore &ts) noexcept { for (auto const mod : keel::modules()) { - for (auto gen : mod->types()) { + for (auto const gen : mod->types()) { oxLogError(gen(ts)); } } diff --git a/deps/nostalgia/src/olympic/turbine/include/turbine/turbine.hpp b/deps/nostalgia/src/olympic/turbine/include/turbine/turbine.hpp index ed98b85..2835dfc 100644 --- a/deps/nostalgia/src/olympic/turbine/include/turbine/turbine.hpp +++ b/deps/nostalgia/src/olympic/turbine/include/turbine/turbine.hpp @@ -11,7 +11,6 @@ #include "gfx.hpp" namespace turbine { - class Context; using TimeMs = uint64_t; @@ -91,9 +90,15 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept; [[nodiscard]] bool buttonDown(Context const &ctx, Key) noexcept; -ox::Result> init(ox::UPtr &&fs, ox::StringViewCR appName) noexcept; +ox::Result> init( + ox::UPtr &&fs, + ox::StringViewCR appName, + ox::StringViewCR appId = {}) noexcept; -ox::Result> init(ox::StringViewCR fsPath, ox::StringViewCR appName) noexcept; +ox::Result> init( + ox::StringViewCR fsPath, + ox::StringViewCR appName, + ox::StringViewCR appId = {}) noexcept; ox::Error run(Context &ctx) noexcept; @@ -112,4 +117,10 @@ void setShutdownHandler(Context &ctx, ShutdownHandler handler) noexcept; // sleep time is a minimum of ~16 milliseconds. void setUpdateHandler(Context &ctx, UpdateHandler) noexcept; +[[nodiscard]] +float scale(Context const &ctx) noexcept; + +[[nodiscard]] +bool isWayland() noexcept; + } diff --git a/deps/nostalgia/src/olympic/turbine/src/gba/turbine.cpp b/deps/nostalgia/src/olympic/turbine/src/gba/turbine.cpp index e8706d0..e2fe166 100644 --- a/deps/nostalgia/src/olympic/turbine/src/gba/turbine.cpp +++ b/deps/nostalgia/src/olympic/turbine/src/gba/turbine.cpp @@ -95,7 +95,7 @@ ox::Error setWindowBounds(Context&, ox::Bounds const&) noexcept { } ox::Result> init( - ox::UPtr &&fs, ox::StringViewCR appName) noexcept { + ox::UPtr &&fs, ox::StringViewCR appName, ox::StringViewCR) noexcept { auto ctx = ox::make_unique(); OX_RETURN_ERROR(keel::init(ctx->keelCtx, std::move(fs), appName)); #ifdef OX_BARE_METAL @@ -139,4 +139,12 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept { return ctx.keyEventHandler; } +float scale(Context const&) noexcept { + return 1; +} + +bool isWayland() noexcept { + return false; +} + } diff --git a/deps/nostalgia/src/olympic/turbine/src/glfw/context.hpp b/deps/nostalgia/src/olympic/turbine/src/glfw/context.hpp index 4490946..943ac45 100644 --- a/deps/nostalgia/src/olympic/turbine/src/glfw/context.hpp +++ b/deps/nostalgia/src/olympic/turbine/src/glfw/context.hpp @@ -32,6 +32,7 @@ class Context { uint64_t draws = 0; bool running{}; ShutdownHandler shutdownHandler{}; + float scale{}; Context() noexcept = default; diff --git a/deps/nostalgia/src/olympic/turbine/src/glfw/turbine.cpp b/deps/nostalgia/src/olympic/turbine/src/glfw/turbine.cpp index cc4b1ba..9aaf350 100644 --- a/deps/nostalgia/src/olympic/turbine/src/glfw/turbine.cpp +++ b/deps/nostalgia/src/olympic/turbine/src/glfw/turbine.cpp @@ -330,7 +330,9 @@ static void handleGlfwWindowCloseEvent(GLFWwindow *window) noexcept { } ox::Result> init( - ox::UPtr &&fs, ox::StringViewCR appName) noexcept { + ox::UPtr &&fs, + ox::StringViewCR appName, + ox::StringViewCR appId) noexcept { auto ctx = ox::make_unique(); OX_RETURN_ERROR(keel::init(ctx->keelCtx, std::move(fs), appName)); using namespace std::chrono; @@ -339,12 +341,20 @@ ox::Result> init( setMandatoryRefreshPeriod(*ctx, ticksMs(*ctx) + config::MandatoryRefreshPeriod); // init GLFW context glfwInit(); + glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); glfwSetErrorCallback(handleGlfwError); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); + { + auto appIdCstr = ox_malloca(appId.bytes() + 1, char); + OX_ALLOW_UNSAFE_BUFFERS_BEGIN + ox::strncpy(appIdCstr.get(), appId.data(), appId.bytes()); + OX_ALLOW_UNSAFE_BUFFERS_END + glfwWindowHintString(GLFW_WAYLAND_APP_ID, appIdCstr.get()); + } constexpr auto Scale = 5; ctx->window = glfwCreateWindow( 240 * Scale, 160 * Scale, ctx->keelCtx.appName.c_str(), nullptr, nullptr); @@ -373,6 +383,13 @@ ox::Result> init( ImGui_ImplOpenGL3_Init(); io.IniFilename = nullptr; themeImgui(); + float xscale{}, yscale{}; + glfwGetWindowContentScale(ctx->window, &xscale, &yscale); + ctx->scale = isWayland() || ox::defines::OS == ox::OS::Darwin ? + 1.f : ox::max(xscale, yscale); + io.DisplayFramebufferScale = ImVec2{ctx->scale, ctx->scale}; + auto &style = ImGui::GetStyle(); + style.ScaleAllSizes(ctx->scale); #endif return ctx; } @@ -471,4 +488,12 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept { return ctx.keyEventHandler; } +float scale(Context const &ctx) noexcept { + return ctx.scale; +} + +bool isWayland() noexcept { + return glfwGetPlatform() == GLFW_PLATFORM_WAYLAND; +} + } diff --git a/deps/nostalgia/src/olympic/turbine/src/turbine.cpp b/deps/nostalgia/src/olympic/turbine/src/turbine.cpp index 4390159..2b15453 100644 --- a/deps/nostalgia/src/olympic/turbine/src/turbine.cpp +++ b/deps/nostalgia/src/olympic/turbine/src/turbine.cpp @@ -8,9 +8,12 @@ namespace turbine { -ox::Result> init(ox::StringViewCR fsPath, ox::StringViewCR appName) noexcept { +ox::Result> init( + ox::StringViewCR fsPath, + ox::StringViewCR appName, + ox::StringViewCR appId) noexcept { OX_REQUIRE_M(fs, keel::loadRomFs(fsPath)); - return init(std::move(fs), appName); + return init(std::move(fs), appName, appId); } } \ No newline at end of file diff --git a/deps/nostalgia/util/scripts/pkg-gba.py b/deps/nostalgia/util/scripts/pkg-gba.py index 98dfc99..614faab 100755 --- a/deps/nostalgia/util/scripts/pkg-gba.py +++ b/deps/nostalgia/util/scripts/pkg-gba.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 # -# Copyright 2016 - 2023 gary@drinkingtea.net +# Copyright 2016 - 2026 gary@drinkingtea.net # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this @@ -21,11 +21,11 @@ def run(args: list[str]): if subprocess.run(args).returncode != 0: sys.exit(1) -# get current build type +# get the current build type with open(".current_build", "r") as f: current_build = f.readlines()[0] -if current_build[len(current_build) - 1] == '\n': - current_build = current_build[:len(current_build) - 1] +if current_build[-1] == '\n': + current_build = current_build[:-1] project_dir = sys.argv[1] project_name = sys.argv[2]