Update z3ed CLI tool and project build configuration

- Updated `.clang-tidy` and `.clangd` configurations for improved code quality checks and diagnostics.
- Added new submodules for JSON and HTTP libraries to support future features.
- Refined README and documentation files to standardize naming conventions and improve clarity.
- Introduced a new command palette in the CLI for easier command access and execution.
- Implemented various CLI handlers for managing ROM, sprites, palettes, and dungeon functionalities.
- Enhanced the TUI components for better user interaction and command execution.
- Added AI service integration for generating commands based on user prompts, expanding the CLI's capabilities.
This commit is contained in:
scawful
2025-10-01 08:57:10 -04:00
parent e7d4f5ea02
commit ba50d89e7d
46 changed files with 2421 additions and 965 deletions

View File

@@ -1,4 +1,10 @@
#include "cli/z3ed.h"
#include "app/gfx/scad_format.h"
#include "app/gfx/arena.h"
#include "absl/flags/flag.h"
#include "absl/flags/declare.h"
ABSL_DECLARE_FLAG(std::string, rom);
namespace yaze {
namespace cli {
@@ -8,8 +14,34 @@ absl::Status GfxExport::Run(const std::vector<std::string>& arg_vec) {
return absl::InvalidArgumentError("Usage: gfx export-sheet <sheet_id> --to <file>");
}
// TODO: Implement gfx export logic
std::cout << "Gfx export not yet implemented." << std::endl;
int sheet_id = std::stoi(arg_vec[0]);
std::string output_file = arg_vec[1];
std::string rom_file = absl::GetFlag(FLAGS_rom);
if (rom_file.empty()) {
return absl::InvalidArgumentError("ROM file must be provided via --rom flag.");
}
rom_.LoadFromFile(rom_file);
if (!rom_.is_loaded()) {
return absl::AbortedError("Failed to load ROM.");
}
auto& arena = gfx::Arena::Get();
auto sheet = arena.gfx_sheet(sheet_id);
if (!sheet.is_active()) {
return absl::NotFoundError("Graphics sheet not found.");
}
// For now, we will just save the raw 8bpp data.
// TODO: Convert the 8bpp data to the correct SNES bpp format.
std::vector<uint8_t> header; // Empty header for now
auto status = gfx::SaveCgx(sheet.depth(), output_file, sheet.vector(), header);
if (!status.ok()) {
return status;
}
std::cout << "Successfully exported graphics sheet " << sheet_id << " to " << output_file << std::endl;
return absl::OkStatus();
}
@@ -19,8 +51,39 @@ absl::Status GfxImport::Run(const std::vector<std::string>& arg_vec) {
return absl::InvalidArgumentError("Usage: gfx import-sheet <sheet_id> --from <file>");
}
// TODO: Implement gfx import logic
std::cout << "Gfx import not yet implemented." << std::endl;
int sheet_id = std::stoi(arg_vec[0]);
std::string input_file = arg_vec[1];
std::string rom_file = absl::GetFlag(FLAGS_rom);
if (rom_file.empty()) {
return absl::InvalidArgumentError("ROM file must be provided via --rom flag.");
}
rom_.LoadFromFile(rom_file);
if (!rom_.is_loaded()) {
return absl::AbortedError("Failed to load ROM.");
}
std::vector<uint8_t> cgx_data, cgx_loaded, cgx_header;
auto status = gfx::LoadCgx(8, input_file, cgx_data, cgx_loaded, cgx_header);
if (!status.ok()) {
return status;
}
auto& arena = gfx::Arena::Get();
auto sheet = arena.gfx_sheet(sheet_id);
if (!sheet.is_active()) {
return absl::NotFoundError("Graphics sheet not found.");
}
// TODO: Convert the 8bpp data to the correct SNES bpp format before writing.
// For now, we just replace the data directly.
sheet.set_data(cgx_loaded);
// TODO: Implement saving the modified graphics sheet back to the ROM.
std::cout << "Successfully imported graphics sheet " << sheet_id << " from " << input_file << std::endl;
std::cout << "(Saving to ROM not yet implemented)" << std::endl;
return absl::OkStatus();
}