yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
message_commands.h
Go to the documentation of this file.
1#ifndef YAZE_SRC_CLI_HANDLERS_MESSAGE_COMMANDS_H_
2#define YAZE_SRC_CLI_HANDLERS_MESSAGE_COMMANDS_H_
3
5
6namespace yaze {
7namespace cli {
8namespace handlers {
9
14 public:
15 std::string GetName() const { return "message-list"; }
16 std::string GetDescription() const { return "List available messages"; }
17 std::string GetUsage() const {
18 return "message-list [--limit <limit>] [--format <json|text>]";
19 }
20
21 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
22 return absl::OkStatus(); // No required args
23 }
24
25 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
26 resources::OutputFormatter& formatter) override;
27};
28
33 public:
34 std::string GetName() const { return "message-read"; }
35 std::string GetDescription() const { return "Read a specific message"; }
36 std::string GetUsage() const {
37 return "message-read --id <message_id> [--format <json|text>]";
38 }
39
40 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
41 return parser.RequireArgs({"id"});
42 }
43
44 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
45 resources::OutputFormatter& formatter) override;
46};
47
52 public:
53 std::string GetName() const { return "message-search"; }
54 std::string GetDescription() const {
55 return "Search messages by text content";
56 }
57 std::string GetUsage() const {
58 return "message-search --query <query> [--limit <limit>] [--format "
59 "<json|text>]";
60 }
61
62 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
63 return parser.RequireArgs({"query"});
64 }
65
66 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
67 resources::OutputFormatter& formatter) override;
68};
69
77 public:
78 std::string GetName() const override { return "message-encode"; }
79 std::string GetUsage() const override {
80 return "message-encode --text <text> [--format <json|text>]";
81 }
82 bool RequiresRom() const override { return false; }
83
84 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
85 return parser.RequireArgs({"text"});
86 }
87
88 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
89 resources::OutputFormatter& formatter) override;
90};
91
99 public:
100 std::string GetName() const override { return "message-decode"; }
101 std::string GetUsage() const override {
102 return "message-decode --hex <hex_bytes> [--format <json|text>]";
103 }
104 bool RequiresRom() const override { return false; }
105
106 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
107 return parser.RequireArgs({"hex"});
108 }
109
110 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
111 resources::OutputFormatter& formatter) override;
112};
113
121 public:
122 std::string GetName() const override { return "message-import-org"; }
123 std::string GetUsage() const override {
124 return "message-import-org --file <path> [--format <json|text>]";
125 }
126 bool RequiresRom() const override { return false; }
127
128 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
129 return parser.RequireArgs({"file"});
130 }
131
132 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
133 resources::OutputFormatter& formatter) override;
134};
135
142 public:
143 std::string GetName() const override { return "message-export-org"; }
144 std::string GetUsage() const override {
145 return "message-export-org --output <path> [--format <json|text>]";
146 }
147 bool RequiresRom() const override { return true; }
148
149 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
150 return parser.RequireArgs({"output"});
151 }
152
153 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
154 resources::OutputFormatter& formatter) override;
155};
156
161 public:
162 std::string GetName() const override { return "message-export-bundle"; }
163 std::string GetUsage() const override {
164 return "message-export-bundle --output <path> [--range <all|vanilla|expanded>]"
165 " [--format <json|text>]";
166 }
167 bool RequiresRom() const override { return true; }
168
169 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
170 return parser.RequireArgs({"output"});
171 }
172
173 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
174 resources::OutputFormatter& formatter) override;
175};
176
181 public:
182 std::string GetName() const override { return "message-import-bundle"; }
183 std::string GetUsage() const override {
184 return "message-import-bundle --file <path> [--apply] [--strict]"
185 " [--range <all|vanilla|expanded>] [--format <json|text>]";
186 }
187 bool RequiresRom() const override { return false; }
188
189 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
190 return parser.RequireArgs({"file"});
191 }
192
193 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
194 resources::OutputFormatter& formatter) override;
195};
196
203 public:
204 std::string GetName() const override { return "message-write"; }
205 std::string GetUsage() const override {
206 return "message-write --id <id> --text <text> [--format <json|text>]";
207 }
208 bool RequiresRom() const override { return true; }
209
210 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
211 return parser.RequireArgs({"id", "text"});
212 }
213
214 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
215 resources::OutputFormatter& formatter) override;
216};
217
222 public:
223 std::string GetName() const override { return "message-export-bin"; }
224 std::string GetUsage() const override {
225 return "message-export-bin --output <path> [--range expanded] "
226 "[--format <json|text>]";
227 }
228 bool RequiresRom() const override { return true; }
229
230 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
231 return parser.RequireArgs({"output"});
232 }
233
234 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
235 resources::OutputFormatter& formatter) override;
236};
237
242 public:
243 std::string GetName() const override { return "message-export-asm"; }
244 std::string GetUsage() const override {
245 return "message-export-asm --output <path> [--range expanded] "
246 "[--format <json|text>]";
247 }
248 bool RequiresRom() const override { return true; }
249
250 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
251 return parser.RequireArgs({"output"});
252 }
253
254 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
255 resources::OutputFormatter& formatter) override;
256};
257
258} // namespace handlers
259} // namespace cli
260} // namespace yaze
261
262#endif // YAZE_SRC_CLI_HANDLERS_MESSAGE_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:28
Decode raw ROM bytes (hex string) to human-readable text.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
std::string GetUsage() const override
Get the command usage string.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const override
Get the command name.
Encode a human-readable message string to ROM bytes.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
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.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Export expanded message region as assembly source.
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 GetUsage() const override
Get the command usage string.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetName() const override
Get the command name.
Export expanded message region as binary or assembly.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
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 GetUsage() const override
Get the command usage string.
Export messages as a bundle JSON for round-trip editing.
std::string GetUsage() const override
Get the command usage string.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
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.
Export messages from ROM as .org format.
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.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetUsage() const override
Get the command usage string.
std::string GetName() const override
Get the command name.
Import messages from a bundle JSON for validation or apply to 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.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
Import messages from .org format file.
std::string GetName() const override
Get the command name.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
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 listing messages.
std::string GetUsage() const
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const
Get the command name.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Command handler for reading messages.
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 GetUsage() const
Get the command usage string.
std::string GetName() const
Get the command name.
Command handler for searching messages.
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.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
Write an encoded message to the expanded message bank.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
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.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
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.