feat: Enhance ROM loading options and proposal management

- Introduced `RomLoadOptions` struct to manage various loading configurations for ROM files, including options for stripping headers, populating metadata, and loading Zelda 3 content.
- Updated `Rom::LoadFromFile` and `Rom::LoadFromData` methods to accept `RomLoadOptions`, allowing for more flexible ROM loading behavior.
- Implemented `MaybeStripSmcHeader` function to conditionally remove SMC headers from ROM data.
- Added new command handler `RomInfo` to display basic ROM information, including title and size.
- Created `ProposalRegistry` class to manage agent-generated proposals, including creation, logging, and status updates.
- Enhanced CLI commands to support proposal listing and detailed diff viewing, improving user interaction with agent-generated modifications.
- Updated resource catalog to include new actions for ROM info and agent proposal management.
This commit is contained in:
scawful
2025-10-01 18:18:48 -04:00
parent 04a4d04f4e
commit 02c6985201
13 changed files with 1373 additions and 72 deletions

View File

@@ -8,15 +8,34 @@ ABSL_DECLARE_FLAG(std::string, rom);
namespace yaze {
namespace cli {
absl::Status RomInfo::Run(const std::vector<std::string>& arg_vec) {
std::string rom_file = absl::GetFlag(FLAGS_rom);
if (rom_file.empty()) {
return absl::InvalidArgumentError("ROM file must be provided via --rom flag.");
}
RETURN_IF_ERROR(rom_.LoadFromFile(rom_file, RomLoadOptions::CliDefaults()));
if (!rom_.is_loaded()) {
return absl::AbortedError("Failed to load ROM.");
}
std::cout << "ROM Information:" << std::endl;
std::cout << " Title: " << rom_.title() << std::endl;
std::cout << " Size: 0x" << std::hex << rom_.size() << " bytes" << std::endl;
std::cout << " Filename: " << rom_file << std::endl;
return absl::OkStatus();
}
absl::Status RomValidate::Run(const std::vector<std::string>& arg_vec) {
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);
RETURN_IF_ERROR(rom_.LoadFromFile(rom_file, RomLoadOptions::CliDefaults()));
if (!rom_.is_loaded()) {
return absl::AbortedError("Failed to load ROM.");
return absl::AbortedError("Failed to load ROM.");
}
bool all_ok = true;
@@ -57,13 +76,13 @@ absl::Status RomDiff::Run(const std::vector<std::string>& arg_vec) {
}
Rom rom_a;
auto status_a = rom_a.LoadFromFile(arg_vec[0]);
auto status_a = rom_a.LoadFromFile(arg_vec[0], RomLoadOptions::CliDefaults());
if (!status_a.ok()) {
return status_a;
}
Rom rom_b;
auto status_b = rom_b.LoadFromFile(arg_vec[1]);
auto status_b = rom_b.LoadFromFile(arg_vec[1], RomLoadOptions::CliDefaults());
if (!status_b.ok()) {
return status_b;
}
@@ -95,7 +114,7 @@ absl::Status RomGenerateGolden::Run(const std::vector<std::string>& arg_vec) {
}
Rom rom;
auto status = rom.LoadFromFile(arg_vec[0]);
auto status = rom.LoadFromFile(arg_vec[0], RomLoadOptions::CliDefaults());
if (!status.ok()) {
return status;
}