1#ifndef YAZE_SRC_CLI_HANDLERS_ROM_COMMANDS_H_
2#define YAZE_SRC_CLI_HANDLERS_ROM_COMMANDS_H_
22 const std::vector<uint8_t>& bytes,
23 const resources::ArgumentParser& parser,
24 resources::OutputFormatter& formatter);
31 std::string
GetName()
const override {
return "rom-read"; }
33 return "Read raw bytes from ROM at an address";
36 return "rom-read --address <hex> [--length <bytes>] "
37 "[--data-format <hex|ascii|both>] [--format <json|text>]";
53 std::string
GetName()
const override {
return "rom-write"; }
55 return "Write raw bytes to ROM at an address (dry-run unless --write)";
58 return "rom-write --address <hex> --data <hex_string> [--write] "
59 "[--allow-project-rom]";
75 std::string
GetName()
const override {
return "rom-info"; }
77 std::string
GetUsage()
const override {
return "rom-info"; }
80 return absl::OkStatus();
92 std::string
GetName()
const override {
return "rom-validate"; }
94 std::string
GetUsage()
const override {
return "rom-validate"; }
97 return absl::OkStatus();
109 std::string
GetName()
const override {
return "rom-diff"; }
112 return "rom-diff --rom_a <file> --rom_b <file>";
129 std::string
GetName()
const override {
return "rom-generate-golden"; }
131 return "Generate golden ROM file for testing";
134 return "rom-generate-golden --rom_file <file> --golden_file <file>";
139 return parser.
RequireArgs({
"rom_file",
"golden_file"});
151 std::string
GetName()
const override {
return "rom-resolve-address"; }
153 return "Resolve an address to a symbol name";
156 return "rom-resolve-address --address <hex> [--max-offset <bytes>]";
172 std::string
GetName()
const override {
return "rom-find-symbol"; }
174 return "Find a symbol by name or pattern";
177 return "rom-find-symbol --name <string>";
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Command handler for comparing ROM files.
std::string GetDescription() const
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetName() const override
Get the command name.
std::string GetUsage() const override
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
Command handler for finding a symbol by name.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetDescription() const
std::string GetName() const override
Get the command name.
std::string GetUsage() const override
Get the command usage string.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Command handler for generating golden ROM files.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetUsage() const override
Get the command usage string.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const override
Get the command name.
std::string GetDescription() const
Command handler for displaying ROM information.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetUsage() const override
Get the command usage string.
std::string GetName() const override
Get the command name.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
std::string GetDescription() const
Command handler for reading raw ROM bytes.
std::string GetUsage() const override
Get the command usage string.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetDescription() const
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Command handler for resolving an address to a symbol.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetUsage() const override
Get the command usage string.
std::string GetDescription() const
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Command handler for validating ROM files.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetUsage() const override
Get the command usage string.
std::string GetName() const override
Get the command name.
std::string GetDescription() const
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Command handler for writing raw ROM bytes.
std::string GetDescription() const
std::string GetUsage() const override
Get the command usage string.
std::string GetName() const override
Get the command name.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
Utility for parsing common CLI argument patterns.
absl::Status RequireArgs(const std::vector< std::string > &required) const
Validate that required arguments are present.
Base class for CLI command handlers.
absl::Status ApplyRawRomWrite(Rom *rom, uint32_t address, const std::vector< uint8_t > &bytes, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter)
Shared body of rom-write and hex-write.