diff --git a/src/nostalgia/studio/CMakeLists.txt b/src/nostalgia/studio/CMakeLists.txt index 1c5520a1..d8c305f6 100644 --- a/src/nostalgia/studio/CMakeLists.txt +++ b/src/nostalgia/studio/CMakeLists.txt @@ -16,6 +16,7 @@ add_executable( target_link_libraries( nostalgia-studio QDarkStyle + OxClArgs NostalgiaCore-Studio NostalgiaStudio NostalgiaPack diff --git a/src/nostalgia/tools/CMakeLists.txt b/src/nostalgia/tools/CMakeLists.txt index f3f080dd..93a5895c 100644 --- a/src/nostalgia/tools/CMakeLists.txt +++ b/src/nostalgia/tools/CMakeLists.txt @@ -2,6 +2,7 @@ add_executable(nost-pack pack.cpp) target_link_libraries( nost-pack + OxClArgs NostalgiaPack ) diff --git a/src/nostalgia/tools/pack.cpp b/src/nostalgia/tools/pack.cpp index 46b979cb..79e0b4a5 100644 --- a/src/nostalgia/tools/pack.cpp +++ b/src/nostalgia/tools/pack.cpp @@ -51,7 +51,7 @@ static ox::Error run(const ox::ClArgs &args) noexcept { } int main(int argc, const char **args) { - auto err = run(ox::ClArgs(argc, args)); + const auto err = run(ox::ClArgs(argc, args)); oxAssert(err, "pack failed"); return static_cast(err); } diff --git a/src/nostalgia/tools/pack/CMakeLists.txt b/src/nostalgia/tools/pack/CMakeLists.txt index 48b67347..73bb89e5 100644 --- a/src/nostalgia/tools/pack/CMakeLists.txt +++ b/src/nostalgia/tools/pack/CMakeLists.txt @@ -6,10 +6,8 @@ add_library( target_link_libraries( NostalgiaPack PUBLIC - OxClArgs OxClaw OxFS - OxStd NostalgiaCommon NostalgiaCore ) diff --git a/src/nostalgia/tools/pack/pack.cpp b/src/nostalgia/tools/pack/pack.cpp index 994f00e6..898273c5 100644 --- a/src/nostalgia/tools/pack/pack.cpp +++ b/src/nostalgia/tools/pack/pack.cpp @@ -19,15 +19,15 @@ namespace nostalgia { * @return error * stub for now */ -static ox::Error pathToInode(ox::Vector*) noexcept { +static ox::Error pathToInode(ox::Buffer*) noexcept { return OxError(0); } // just strip header for now... -static ox::Error toMetalClaw(ox::Vector *buff) noexcept { +static ox::Error toMetalClaw(ox::Buffer *buff) noexcept { oxRequire(mc, ox::stripClawHeader(ox::bit_cast(buff->data()), buff->size())); buff->resize(mc.size()); - ox_memcpy(buff->data(), mc.data(), mc.size()); + memcpy(buff->data(), mc.data(), mc.size()); return OxError(0); } @@ -47,7 +47,7 @@ static ox::Error transformClaw(ox::FileSystem *dest, const ox::String &path) noe // do transforms if (name.endsWith(".ng") || name.endsWith(".npal")) { // load file - ox::Vector buff(stat.size); + ox::Buffer buff(stat.size); oxReturnError(dest->read(filePath.c_str(), buff.data(), buff.size())); // do transformations oxReturnError(pathToInode(&buff)); @@ -60,15 +60,15 @@ static ox::Error transformClaw(ox::FileSystem *dest, const ox::String &path) noe return OxError(0); } -static ox::Error verifyFile(ox::FileSystem *fs, const ox::String &path, const ox::Vector &expected) noexcept { - ox::Vector buff(expected.size()); +static ox::Error verifyFile(ox::FileSystem *fs, const ox::String &path, const ox::Buffer &expected) noexcept { + ox::Buffer buff(expected.size()); oxReturnError(fs->read(path.c_str(), buff.data(), buff.size())); return OxError(buff == expected ? 0 : 1); } struct VerificationPair { ox::String path; - ox::Vector buff; + ox::Buffer buff; }; static ox::Error copy(ox::FileSystem *src, ox::FileSystem *dest, const ox::String &path) noexcept { @@ -87,15 +87,14 @@ static ox::Error copy(ox::FileSystem *src, ox::FileSystem *dest, const ox::Strin oxReturnError(dest->mkdir(currentFile.c_str(), true)); oxReturnError(copy(src, dest, currentFile + '/')); } else { - ox::Vector buff; + ox::Buffer buff(stat.size); // load file - buff.resize(stat.size); oxReturnError(src->read(currentFile.c_str(), buff.data(), buff.size())); // write file to dest oxOutf("writing {}\n", currentFile); oxReturnError(dest->write(currentFile.c_str(), buff.data(), buff.size())); oxReturnError(verifyFile(dest, currentFile, buff)); - verificationPairs.push_back({currentFile, buff}); + verificationPairs.emplace_back(currentFile, buff); } } // verify all at once in addition to right after the files are written