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 "
165 "<all|vanilla|expanded>]"
166 " [--format <json|text>]";
167 }
168 bool RequiresRom() const override { return true; }
169
170 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
171 return parser.RequireArgs({"output"});
172 }
173
174 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
175 resources::OutputFormatter& formatter) override;
176};
177
182 public:
183 std::string GetName() const override { return "message-import-bundle"; }
184 std::string GetUsage() const override {
185 return "message-import-bundle --file <path> [--apply] [--strict]"
186 " [--range <all|vanilla|expanded>] [--project <path>]"
187 " [--format <json|text>] (expanded --apply requires --project)";
188 }
189 bool RequiresRom() const override { return false; }
190
191 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
192 return parser.RequireArgs({"file"});
193 }
194
195 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
196 resources::OutputFormatter& formatter) override;
197};
198
205 public:
206 std::string GetName() const override { return "message-write"; }
207 std::string GetUsage() const override {
208 return "message-write --id <id> --text <text> --project <path>"
209 " [--format <json|text>]";
210 }
211 bool RequiresRom() const override { return true; }
212
213 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
214 return parser.RequireArgs({"id", "text"});
215 }
216
217 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
218 resources::OutputFormatter& formatter) override;
219};
220
225 public:
226 std::string GetName() const override { return "message-export-bin"; }
227 std::string GetUsage() const override {
228 return "message-export-bin --output <path> [--range expanded] "
229 "[--format <json|text>]";
230 }
231 bool RequiresRom() const override { return true; }
232
233 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
234 return parser.RequireArgs({"output"});
235 }
236
237 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
238 resources::OutputFormatter& formatter) override;
239};
240
245 public:
246 std::string GetName() const override { return "message-export-asm"; }
247 std::string GetUsage() const override {
248 return "message-export-asm --output <path> [--range expanded] "
249 "[--format <json|text>]";
250 }
251 bool RequiresRom() const override { return true; }
252
253 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
254 return parser.RequireArgs({"output"});
255 }
256
257 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
258 resources::OutputFormatter& formatter) override;
259};
260
261} // namespace handlers
262} // namespace cli
263} // namespace yaze
264
265#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.