tools: Remove dead/obsoleted code
Clean = good.
This commit is contained in:
parent
3968cde61e
commit
a5642f2365
4 changed files with 0 additions and 172 deletions
|
@ -12,31 +12,8 @@ add_subdirectory(toollib)
|
|||
add_subdirectory(eupak)
|
||||
add_subdirectory(eutex)
|
||||
|
||||
add_executable(texdump texdump.cpp)
|
||||
target_link_libraries(texdump PUBLIC
|
||||
europa
|
||||
lodepng
|
||||
)
|
||||
europa_target(texdump)
|
||||
|
||||
|
||||
add_executable(jsfscramble jsfscramble.cpp)
|
||||
target_link_libraries(jsfscramble PUBLIC
|
||||
europa
|
||||
)
|
||||
europa_target(jsfscramble)
|
||||
|
||||
|
||||
# Temporary test target.
|
||||
add_executable(toollib_test
|
||||
toollib_test.cpp
|
||||
toollib_test_cmd.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(toollib_test PUBLIC
|
||||
europa
|
||||
toollib
|
||||
)
|
||||
|
||||
europa_target(toollib_test)
|
||||
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
//
|
||||
// EuropaTools
|
||||
//
|
||||
// (C) 2021-2025 modeco80 <lily.modeco80@protonmail.ch>
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <lodepng.h>
|
||||
|
||||
#include <europa/io/yatf/Reader.hpp>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "europa/structs/Yatf.hpp"
|
||||
#include "europa/util/ImageSurface.hpp"
|
||||
|
||||
namespace eio = europa::io;
|
||||
namespace eutil = europa::util;
|
||||
namespace yatf = eio::yatf;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// TODO: use argparse, probably!
|
||||
if(argc != 2) {
|
||||
std::cout << "Usage: " << argv[0] << " [path to PS2 Europa .tex file]\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::ifstream ifs(argv[1], std::ifstream::binary);
|
||||
|
||||
if(!ifs) {
|
||||
std::cout << "Invalid file \"" << argv[1] << "\"\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
yatf::Reader reader(ifs);
|
||||
|
||||
europa::structs::YatfHeader yatfHeader;
|
||||
eutil::ImageSurface surface;
|
||||
|
||||
|
||||
std::cout << "Opening \"" << argv[1] << "\"\n";
|
||||
|
||||
if(!reader.ReadImage(yatfHeader, surface)) {
|
||||
std::cout << "Invalid YATF file \"" << argv[1] << "\"\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto outPath = fs::path(argv[1]).replace_extension(".png");
|
||||
auto size = surface.GetSize();
|
||||
|
||||
if(auto res = lodepng::encode(outPath.string(), reinterpret_cast<std::uint8_t*>(surface.GetBuffer()), size.width, size.height, LCT_RGBA, 8); res == 0) {
|
||||
std::cout << "Wrote image to " << outPath << '\n';
|
||||
return 0;
|
||||
} else {
|
||||
std::cout << "Error encoding PNG: " << lodepng_error_text(res) << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
//
|
||||
// EuropaTools
|
||||
//
|
||||
// (C) 2021-2025 modeco80 <lily.modeco80@protonmail.ch>
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
// Test/excercise of new toollib system.
|
||||
#include <toollib/ToolCommand.hpp>
|
||||
#include <toollib/ToolMain.hpp>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
auto tasks = std::vector {
|
||||
tool::ToolCommandFactory::CreateNamed("test")
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
return tool::ToolMain(tool::ToolInfo {
|
||||
.name = "toollib_test",
|
||||
.version = "0.0.1",
|
||||
.description = "A test/excercise of the new toollib APIs."
|
||||
}, tool::ToolMainInput {
|
||||
.toolCommands = tasks,
|
||||
.argc = argc,
|
||||
.argv = argv
|
||||
});
|
||||
// clang-format on
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
//
|
||||
// EuropaTools
|
||||
//
|
||||
// (C) 2021-2025 modeco80 <lily.modeco80@protonmail.ch>
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <toollib/ToolCommand.hpp>
|
||||
|
||||
struct TestCmd : tool::IToolCommand {
|
||||
TestCmd()
|
||||
: parser("test", "", argparse::default_arguments::help) {
|
||||
// clang-format off
|
||||
parser
|
||||
.add_description("Does something cool");
|
||||
|
||||
|
||||
// FIXME: Probably just print this always, in a thinner format, but use
|
||||
// the existing thicker format for verbosity.
|
||||
parser
|
||||
.add_argument("--verbose")
|
||||
.help("Increase information output verbosity")
|
||||
.default_value(false)
|
||||
.implicit_value(true);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void Init(argparse::ArgumentParser& parent) override {
|
||||
parent.add_subparser(parser);
|
||||
}
|
||||
|
||||
bool ShouldRun(argparse::ArgumentParser& parent) const override {
|
||||
return parent.is_subcommand_used("test");
|
||||
}
|
||||
|
||||
int Parse() override {
|
||||
verbose = parser.get<bool>("--verbose");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Run() override {
|
||||
std::printf("Pretend this does something useful\n");
|
||||
|
||||
if(verbose)
|
||||
std::printf("I printed you a cake! it might be a lie thogh x3\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
argparse::ArgumentParser parser;
|
||||
|
||||
// Parsed arguments
|
||||
bool verbose = false;
|
||||
};
|
||||
|
||||
TOOLLIB_REGISTER_TOOLCOMMAND("test", TestCmd);
|
Loading…
Reference in a new issue