From e0381cd98aec34f887ec14fd0de28cf994f35ade Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 30 Nov 2022 20:49:13 -0600 Subject: [PATCH] [ox/preloader] Remove unused files --- deps/ox/src/ox/preloader/CMakeLists.txt | 2 -- deps/ox/src/ox/preloader/preload.cpp | 33 ------------------------- deps/ox/src/ox/preloader/preload.hpp | 21 ---------------- deps/ox/src/ox/preloader/preloader.cpp | 24 ------------------ deps/ox/src/ox/preloader/preloader.hpp | 1 + 5 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 deps/ox/src/ox/preloader/preload.cpp delete mode 100644 deps/ox/src/ox/preloader/preload.hpp diff --git a/deps/ox/src/ox/preloader/CMakeLists.txt b/deps/ox/src/ox/preloader/CMakeLists.txt index df43cfcf..bfd3332f 100644 --- a/deps/ox/src/ox/preloader/CMakeLists.txt +++ b/deps/ox/src/ox/preloader/CMakeLists.txt @@ -1,7 +1,6 @@ add_library( OxPreloader - preload.cpp preloader.cpp ) @@ -16,7 +15,6 @@ install( FILES alignmentcatcher.hpp platspecs.hpp - preload.hpp preloader.hpp unionsizecatcher.hpp DESTINATION diff --git a/deps/ox/src/ox/preloader/preload.cpp b/deps/ox/src/ox/preloader/preload.cpp deleted file mode 100644 index 17f20174..00000000 --- a/deps/ox/src/ox/preloader/preload.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. - */ - -#include - -#include "preload.hpp" - -namespace ox { - -static ox::Error buildPreloadBuffer(ox::Buffer *buff, std::size_t buffStart, ox::FileSystem *fs, - ox::TypeStore *ts, const char *path) noexcept { - oxRequire(files, fs->ls(path)); - for (const auto &f : files) { - oxRequire(stat, fs->stat(f)); - if (stat.fileType == ox::FileType::NormalFile) { - oxRequire(fileBuff, fs->read(path)); - oxRequire(obj, ox::readClaw(ts, fileBuff)); - } else if (stat.fileType == ox::FileType::Directory) { - const auto childPath = ox::sfmt("{}/{}", path, f); - oxReturnError(buildPreloadBuffer(buff, buffStart, fs, ts, childPath.c_str())); - } - } - return {}; -} - -ox::Result buildPreloadBuffer(std::size_t buffStart, ox::FileSystem *fs, ox::TypeStore *ts) noexcept { - ox::Buffer buff; - oxReturnError(buildPreloadBuffer(&buff, buffStart, fs, ts, "/")); - return buff; -} - -} \ No newline at end of file diff --git a/deps/ox/src/ox/preloader/preload.hpp b/deps/ox/src/ox/preloader/preload.hpp deleted file mode 100644 index 9142899f..00000000 --- a/deps/ox/src/ox/preloader/preload.hpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. - */ - -#pragma once - -#include -#include - -namespace ox { - -/** - * - * @param buffStart where the preload buffer will start in ROM - * @param fs an ox::FileSystem containing the contents to be preloaded - * @return preload buffer or error - */ -[[maybe_unused]] -ox::Result buildPreloadBuffer(std::size_t buffStart, ox::FileSystem *fs) noexcept; - -} \ No newline at end of file diff --git a/deps/ox/src/ox/preloader/preloader.cpp b/deps/ox/src/ox/preloader/preloader.cpp index a5bb1334..b7d1d578 100644 --- a/deps/ox/src/ox/preloader/preloader.cpp +++ b/deps/ox/src/ox/preloader/preloader.cpp @@ -2,32 +2,8 @@ * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include - -#include "platspecs.hpp" #include "preloader.hpp" namespace ox { -struct TestType { - static constexpr auto TypeName = "net.drinkingtea.nostalgia.preloader.TestType"; - static constexpr auto TypeVersion = 1; - uint32_t field1 = 0; - uint32_t *field2 = nullptr; - ox::Vector field3; -}; - -oxModelBegin(TestType) - oxModelField(field1) - oxModelField(field2) - oxModelField(field3) -oxModelEnd() - -constexpr ox::Error asdf() noexcept { - const TestType t; - return preload(&t).error; -} - -//static_assert(asdf().errCode == 0); - } diff --git a/deps/ox/src/ox/preloader/preloader.hpp b/deps/ox/src/ox/preloader/preloader.hpp index 4ebb8537..9ecae890 100644 --- a/deps/ox/src/ox/preloader/preloader.hpp +++ b/deps/ox/src/ox/preloader/preloader.hpp @@ -213,6 +213,7 @@ constexpr ox::Error Preloader::offsetPtrs(std::size_t offset) noexcept oxReturnError(m_writer.seekp(p.loc)); oxReturnError(ox::serialize(&m_writer, PlatSpec::correctEndianness(p.value + offset))); } + oxReturnError(m_writer.seekp(0, ox::ios_base::end)); return {}; }