[nostalgia/core/studio] Move imgconv to Core Studio

This commit is contained in:
Gary Talent 2019-10-22 23:47:58 -05:00
parent aa171fa069
commit 0a809037ac
6 changed files with 12 additions and 27 deletions

View File

@ -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
)

View File

@ -11,8 +11,8 @@
#include <QFile>
#include <nostalgia/core/consts.hpp>
#include <nostalgia/tools/pack/imgconv.hpp>
#include "imgconv.hpp"
#include "import_tilesheet_wizard.hpp"
namespace nostalgia::core {

View File

@ -1,7 +1,6 @@
add_library(
NostalgiaPack SHARED
imgconv.cpp
pack.cpp
)

View File

@ -10,7 +10,6 @@
#include <string_view>
#include <vector>
#include "imgconv.hpp"
#include "pack.hpp"
namespace nostalgia {
@ -83,21 +82,10 @@ namespace {
} else {
std::vector<uint8_t> 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()));