backend-infra-engineer: Release v0.3.0 snapshot

This commit is contained in:
scawful
2025-09-27 00:25:45 -04:00
parent 8ce29e1436
commit e32ac75b9c
346 changed files with 55946 additions and 11764 deletions

View File

@@ -1,3 +1,5 @@
#include "cli/z3ed.h"
#include <cstring>
#include <iostream>
#include <memory>
@@ -5,92 +7,26 @@
#include <unordered_map>
#include <vector>
#include "absl/flags/flag.h"
#include "app/core/constants.h"
#include "cli/z3ed.h"
#include "tui.h"
#include "cli/tui.h"
#include "util/flag.h"
#include "util/macro.h"
ABSL_FLAG(bool, verbose, false, "Enable verbose output");
ABSL_FLAG(bool, debug, false, "Enable debug output");
DEFINE_FLAG(std::string, rom_file, "", "The ROM file to load.");
DEFINE_FLAG(std::string, bps_file, "", "The BPS file to apply.");
namespace yaze {
/**
* @namespace yaze::cli
* @brief Namespace for the command line interface.
*/
namespace cli {
namespace {
DEFINE_FLAG(std::string, src_file, "", "The source file.");
DEFINE_FLAG(std::string, modified_file, "", "The modified file.");
ColorModifier ylw(ColorCode::FG_YELLOW);
ColorModifier mag(ColorCode::FG_MAGENTA);
ColorModifier red(ColorCode::FG_RED);
ColorModifier reset(ColorCode::FG_RESET);
ColorModifier underline(ColorCode::FG_UNDERLINE);
DEFINE_FLAG(std::string, bin_file, "", "The binary file to export to.");
DEFINE_FLAG(std::string, address, "", "The address to convert.");
DEFINE_FLAG(std::string, length, "", "The length of the data to read.");
void HelpCommand() {
std::cout << "\n";
std::cout << ylw << "" << reset << " z3ed\n";
std::cout << ylw << "▲ ▲ " << reset << " by " << mag << "scawful\n\n"
<< reset;
std::cout << "The Legend of " << red << "Zelda" << reset
<< ": A Link to the Past Hacking Tool\n\n";
std::cout << underline;
std::cout << "Command" << reset << " " << underline << "Arg"
<< reset << " " << underline << "Params\n"
<< reset;
std::cout << "Apply BPS Patch -a <rom_file> <bps_file>\n";
std::cout << "Create BPS Patch -c <bps_file> <src_file> "
"<modified_file>\n\n";
std::cout << "Open ROM -o <rom_file>\n";
std::cout << "Backup ROM -b <rom_file> <optional:new_file>\n";
std::cout << "Expand ROM -x <rom_file> <file_size>\n\n";
std::cout << "Transfer Tile16 -t <src_rom> <dest_rom> "
"<tile32_id_list:csv>\n\n";
std::cout << "Export Graphics -e <rom_file> <bin_file>\n";
std::cout << "Import Graphics -i <bin_file> <rom_file>\n\n";
std::cout << "SNES to PC Address -s <address>\n";
std::cout << "PC to SNES Address -p <address>\n";
std::cout << "\n";
}
int RunCommandHandler(int argc, char *argv[]) {
if (argc == 1) {
HelpCommand();
return EXIT_SUCCESS;
}
if (std::strcmp(argv[1], "-h") == 0 || argc == 1) {
HelpCommand();
return EXIT_SUCCESS;
}
std::vector<std::string> arguments;
for (int i = 2; i < argc; i++) { // Skip the arg mode (argv[1])
std::cout << "argv[" << i << "] = " << argv[i] << std::endl;
arguments.emplace_back(argv[i]);
}
Commands commands;
std::string mode = argv[1];
if (commands.handlers.find(mode) != commands.handlers.end()) {
PRINT_IF_ERROR(commands.handlers[mode]->handle(arguments))
} else {
std::cerr << "Invalid mode specified: " << mode << std::endl;
}
return EXIT_SUCCESS;
}
} // namespace
} // namespace cli
} // namespace yaze
DEFINE_FLAG(std::string, file_size, "", "The size of the file to expand to.");
DEFINE_FLAG(std::string, dest_rom, "", "The destination ROM file.");
int main(int argc, char *argv[]) {
yaze::util::FlagParser flag_parser(yaze::util::global_flag_registry());
RETURN_IF_EXCEPTION(flag_parser.Parse(argc, argv));
yaze::cli::ShowMain();
return EXIT_SUCCESS;
// return yaze::cli::RunCommandHandler(argc, argv);
}