[nostalgia/core/studio] Move imgconv to Core Studio
This commit is contained in:
parent
aa171fa069
commit
0a809037ac
@ -1,19 +1,17 @@
|
|||||||
|
|
||||||
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
|
add_library(
|
||||||
add_library(
|
NostalgiaCore-Studio SHARED
|
||||||
NostalgiaCore-Studio SHARED
|
imgconv.cpp
|
||||||
import_tilesheet_wizard.cpp
|
import_tilesheet_wizard.cpp
|
||||||
new_tilesheet_wizard.cpp
|
new_tilesheet_wizard.cpp
|
||||||
plugin.cpp
|
plugin.cpp
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
NostalgiaCore-Studio
|
NostalgiaCore-Studio
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
NostalgiaStudio
|
NostalgiaStudio
|
||||||
NostalgiaPack
|
|
||||||
OxFS
|
OxFS
|
||||||
OxStd
|
OxStd
|
||||||
)
|
)
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
#include <nostalgia/core/consts.hpp>
|
#include <nostalgia/core/consts.hpp>
|
||||||
#include <nostalgia/tools/pack/imgconv.hpp>
|
|
||||||
|
|
||||||
|
#include "imgconv.hpp"
|
||||||
#include "import_tilesheet_wizard.hpp"
|
#include "import_tilesheet_wizard.hpp"
|
||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
add_library(
|
add_library(
|
||||||
NostalgiaPack SHARED
|
NostalgiaPack SHARED
|
||||||
imgconv.cpp
|
|
||||||
pack.cpp
|
pack.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "imgconv.hpp"
|
|
||||||
#include "pack.hpp"
|
#include "pack.hpp"
|
||||||
|
|
||||||
namespace nostalgia {
|
namespace nostalgia {
|
||||||
@ -83,21 +82,10 @@ namespace {
|
|||||||
} else {
|
} else {
|
||||||
std::vector<uint8_t> buff;
|
std::vector<uint8_t> buff;
|
||||||
// do transforms
|
// do transforms
|
||||||
const std::string OldExt = path.substr(path.find_last_of('.'));
|
//const std::string OldExt = path.substr(path.find_last_of('.'));
|
||||||
constexpr std::string_view NgExt = ".ng";
|
// load file
|
||||||
if (OldExt != NgExt) {
|
buff.resize(stat.size);
|
||||||
// load file from full path and transform
|
oxReturnError(src->read(currentFile.c_str(), buff.data(), buff.size()));
|
||||||
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()));
|
|
||||||
}
|
|
||||||
// write file to dest
|
// write file to dest
|
||||||
std::cout << "writing " << currentFile << '\n';
|
std::cout << "writing " << currentFile << '\n';
|
||||||
oxReturnError(dest->write(currentFile.c_str(), buff.data(), buff.size()));
|
oxReturnError(dest->write(currentFile.c_str(), buff.data(), buff.size()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user