yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
hex_commands.h
Go to the documentation of this file.
1#ifndef YAZE_SRC_CLI_HANDLERS_HEX_COMMANDS_H_
2#define YAZE_SRC_CLI_HANDLERS_HEX_COMMANDS_H_
3
5
6namespace yaze {
7namespace cli {
8namespace handlers {
9
14 public:
15 std::string GetName() const { return "hex-read"; }
16 std::string GetDescription() const {
17 return "Read hex data from ROM at specified address";
18 }
19 std::string GetUsage() const {
20 return "hex-read --address <address> [--length <length>] "
21 "[--data-format <hex|ascii|both>] [--format <json|text>]";
22 }
23
24 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
25 return parser.RequireArgs({"address"});
26 }
27
28 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
29 resources::OutputFormatter& formatter) override;
30};
31
36 public:
37 std::string GetName() const { return "hex-write"; }
38 std::string GetDescription() const {
39 return "Write hex data to ROM at specified address (dry-run unless "
40 "--write)";
41 }
42 std::string GetUsage() const {
43 return "hex-write --address <address> --data <data> [--write] "
44 "[--allow-project-rom]";
45 }
46
47 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
48 return parser.RequireArgs({"address", "data"});
49 }
50
51 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
52 resources::OutputFormatter& formatter) override;
53};
54
59 public:
60 std::string GetName() const { return "hex-search"; }
61 std::string GetDescription() const {
62 return "Search for hex patterns in ROM";
63 }
64 std::string GetUsage() const {
65 return "hex-search --pattern <pattern> [--start <start>] [--end <end>]";
66 }
67
68 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
69 return parser.RequireArgs({"pattern"});
70 }
71
72 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
73 resources::OutputFormatter& formatter) override;
74};
75
76} // namespace handlers
77} // namespace cli
78} // namespace yaze
79
80#endif // YAZE_SRC_CLI_HANDLERS_HEX_COMMANDS_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:52
Command handler for reading hex data from ROM.
std::string GetUsage() const
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
std::string GetName() const
Get the command name.
Command handler for searching hex patterns in ROM.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
std::string GetName() const
Get the command name.
std::string GetUsage() const
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
Command handler for writing hex data to ROM.
std::string GetUsage() const
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
std::string GetName() const
Get the command name.
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.
Utility for consistent output formatting across commands.