From 0a809037ace34b4a33abba48bebbbe486b861726 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 22 Oct 2019 23:47:58 -0500 Subject: [PATCH] [nostalgia/core/studio] Move imgconv to Core Studio --- src/nostalgia/core/studio/CMakeLists.txt | 16 +++++++-------- .../{tools/pack => core/studio}/imgconv.cpp | 0 .../{tools/pack => core/studio}/imgconv.hpp | 0 .../core/studio/import_tilesheet_wizard.cpp | 2 +- src/nostalgia/tools/pack/CMakeLists.txt | 1 - src/nostalgia/tools/pack/pack.cpp | 20 ++++--------------- 6 files changed, 12 insertions(+), 27 deletions(-) rename src/nostalgia/{tools/pack => core/studio}/imgconv.cpp (100%) rename src/nostalgia/{tools/pack => core/studio}/imgconv.hpp (100%) diff --git a/src/nostalgia/core/studio/CMakeLists.txt b/src/nostalgia/core/studio/CMakeLists.txt index cc233047..570c56e2 100644 --- a/src/nostalgia/core/studio/CMakeLists.txt +++ b/src/nostalgia/core/studio/CMakeLists.txt @@ -1,19 +1,17 @@ -if(NOSTALGIA_BUILD_TYPE STREQUAL "Native") - add_library( - NostalgiaCore-Studio SHARED - import_tilesheet_wizard.cpp - new_tilesheet_wizard.cpp - plugin.cpp - ) -endif() +add_library( + NostalgiaCore-Studio SHARED + imgconv.cpp + import_tilesheet_wizard.cpp + new_tilesheet_wizard.cpp + plugin.cpp +) target_link_libraries( NostalgiaCore-Studio Qt5::Core Qt5::Widgets NostalgiaStudio - NostalgiaPack OxFS OxStd ) diff --git a/src/nostalgia/tools/pack/imgconv.cpp b/src/nostalgia/core/studio/imgconv.cpp similarity index 100% rename from src/nostalgia/tools/pack/imgconv.cpp rename to src/nostalgia/core/studio/imgconv.cpp diff --git a/src/nostalgia/tools/pack/imgconv.hpp b/src/nostalgia/core/studio/imgconv.hpp similarity index 100% rename from src/nostalgia/tools/pack/imgconv.hpp rename to src/nostalgia/core/studio/imgconv.hpp diff --git a/src/nostalgia/core/studio/import_tilesheet_wizard.cpp b/src/nostalgia/core/studio/import_tilesheet_wizard.cpp index d448b9f1..d04c3059 100644 --- a/src/nostalgia/core/studio/import_tilesheet_wizard.cpp +++ b/src/nostalgia/core/studio/import_tilesheet_wizard.cpp @@ -11,8 +11,8 @@ #include #include -#include +#include "imgconv.hpp" #include "import_tilesheet_wizard.hpp" namespace nostalgia::core { diff --git a/src/nostalgia/tools/pack/CMakeLists.txt b/src/nostalgia/tools/pack/CMakeLists.txt index c0380389..01425632 100644 --- a/src/nostalgia/tools/pack/CMakeLists.txt +++ b/src/nostalgia/tools/pack/CMakeLists.txt @@ -1,7 +1,6 @@ add_library( NostalgiaPack SHARED - imgconv.cpp pack.cpp ) diff --git a/src/nostalgia/tools/pack/pack.cpp b/src/nostalgia/tools/pack/pack.cpp index ba673d20..fa4f8245 100644 --- a/src/nostalgia/tools/pack/pack.cpp +++ b/src/nostalgia/tools/pack/pack.cpp @@ -10,7 +10,6 @@ #include #include -#include "imgconv.hpp" #include "pack.hpp" namespace nostalgia { @@ -83,21 +82,10 @@ namespace { } else { std::vector buff; // do transforms - const std::string OldExt = path.substr(path.find_last_of('.')); - constexpr std::string_view NgExt = ".ng"; - if (OldExt != NgExt) { - // load file from full path and transform - const auto fullPath = src->basePath() + currentFile; - oxReturnError(toBuffer(imgToNg(fullPath.c_str(), 0, 0).get()).get(&buff)); - currentFile = currentFile.substr(0, currentFile.size() - OldExt.size()) + NgExt.data(); - if (!buff.size()) { - return OxError(1); - } - } else { - // load file - buff.resize(stat.size); - oxReturnError(src->read(currentFile.c_str(), buff.data(), buff.size())); - } + //const std::string OldExt = path.substr(path.find_last_of('.')); + // load file + buff.resize(stat.size); + oxReturnError(src->read(currentFile.c_str(), buff.data(), buff.size())); // write file to dest std::cout << "writing " << currentFile << '\n'; oxReturnError(dest->write(currentFile.c_str(), buff.data(), buff.size()));