yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
mesen_handlers.h
Go to the documentation of this file.
1#ifndef YAZE_CLI_HANDLERS_MESEN_HANDLERS_H_
2#define YAZE_CLI_HANDLERS_MESEN_HANDLERS_H_
3
4#include <string>
5#include <vector>
6
8
9namespace yaze {
10namespace cli {
11namespace handlers {
12
13// Handler implementations for Mesen2 commands
14
16 public:
17 std::string GetName() const override { return "mesen-gamestate"; }
18 std::string GetDescription() const {
19 return "Get ALTTP game state from running Mesen2";
20 }
21 std::string GetUsage() const override {
22 return "mesen-gamestate [--format <json|text>]";
23 }
24 bool RequiresRom() const override { return false; }
25 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
26 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
27 resources::OutputFormatter& formatter) override;
28};
29
31 public:
32 std::string GetName() const override { return "mesen-sprites"; }
33 std::string GetDescription() const {
34 return "Get active sprites from running Mesen2";
35 }
36 std::string GetUsage() const override {
37 return "mesen-sprites [--all] [--format <json|text>]";
38 }
39 bool RequiresRom() const override { return false; }
40 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
41 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
42 resources::OutputFormatter& formatter) override;
43};
44
46 public:
47 std::string GetName() const override { return "mesen-cpu"; }
48 std::string GetDescription() const {
49 return "Get CPU register state from Mesen2";
50 }
51 std::string GetUsage() const override {
52 return "mesen-cpu [--format <json|text>]";
53 }
54 bool RequiresRom() const override { return false; }
55 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
56 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
57 resources::OutputFormatter& formatter) override;
58};
59
61 public:
62 std::string GetName() const override { return "mesen-memory-read"; }
63 std::string GetDescription() const {
64 return "Read memory from Mesen2 emulator";
65 }
66 std::string GetUsage() const override {
67 return "mesen-memory-read --address <hex> [--length <n>] [--format "
68 "<json|text>]";
69 }
70 bool RequiresRom() const override { return false; }
71 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
72 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
73 resources::OutputFormatter& formatter) override;
74};
75
77 public:
78 std::string GetName() const override { return "mesen-memory-write"; }
79 std::string GetDescription() const {
80 return "Write memory in Mesen2 emulator";
81 }
82 std::string GetUsage() const override {
83 return "mesen-memory-write --address <hex> --data <hexbytes> [--format "
84 "<json|text>]";
85 }
86 bool RequiresRom() const override { return false; }
87 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
88 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
89 resources::OutputFormatter& formatter) override;
90};
91
93 public:
94 std::string GetName() const override { return "mesen-disasm"; }
95 std::string GetDescription() const {
96 return "Disassemble code at address in Mesen2";
97 }
98 std::string GetUsage() const override {
99 return "mesen-disasm --address <hex> [--count <n>] [--format <json|text>]";
100 }
101 bool RequiresRom() const override { return false; }
102 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
103 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
104 resources::OutputFormatter& formatter) override;
105};
106
108 public:
109 std::string GetName() const override { return "mesen-trace"; }
110 std::string GetDescription() const {
111 return "Get execution trace from Mesen2";
112 }
113 std::string GetUsage() const override {
114 return "mesen-trace [--count <n>] [--format <json|text>]";
115 }
116 bool RequiresRom() const override { return false; }
117 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
118 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
119 resources::OutputFormatter& formatter) override;
120};
121
123 public:
124 std::string GetName() const override { return "mesen-breakpoint"; }
125 std::string GetDescription() const { return "Manage breakpoints in Mesen2"; }
126 std::string GetUsage() const override {
127 return "mesen-breakpoint --action <add|remove|clear|list> [--address "
128 "<hex>] [--id <n>] [--type <exec|read|write|rw>]";
129 }
130 bool RequiresRom() const override { return false; }
131 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
132 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
133 resources::OutputFormatter& formatter) override;
134};
135
137 public:
138 std::string GetName() const override { return "mesen-control"; }
139 std::string GetDescription() const {
140 return "Control Mesen2 emulation state";
141 }
142 std::string GetUsage() const override {
143 return "mesen-control --action <pause|resume|step|frame|reset>";
144 }
145 bool RequiresRom() const override { return false; }
146 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
147 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
148 resources::OutputFormatter& formatter) override;
149};
150
152 public:
153 std::string GetName() const override { return "mesen-session"; }
154 std::string GetDescription() const {
155 return "Get tracked autonomous control session state";
156 }
157 std::string GetUsage() const override {
158 return "mesen-session [--action <show|reset|export|import>] [--file "
159 "<path>]";
160 }
161 bool RequiresRom() const override { return false; }
162 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
163 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
164 resources::OutputFormatter& formatter) override;
165};
166
168 public:
169 std::string GetName() const override { return "mesen-await"; }
170 std::string GetDescription() const {
171 return "Block until frame/pc/breakpoint condition is met";
172 }
173 std::string GetUsage() const override {
174 return "mesen-await --type <frame|pc|breakpoint> [--count <n>] [--address "
175 "<hex>] [--id <n>] [--timeout-ms <n>] [--poll-ms <n>]";
176 }
177 bool RequiresRom() const override { return false; }
178 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
179 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
180 resources::OutputFormatter& formatter) override;
181};
182
184 public:
185 std::string GetName() const override { return "mesen-goal"; }
186 std::string GetDescription() const {
187 return "Execute atomic goal macros for deterministic debugging";
188 }
189 std::string GetUsage() const override {
190 return "mesen-goal --goal <break-at|run-frames|capture-state-at-pc> "
191 "[--address <hex>] [--count <n>] [--timeout-ms <n>] [--poll-ms <n>]";
192 }
193 bool RequiresRom() const override { return false; }
194 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
195 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
196 resources::OutputFormatter& formatter) override;
197};
198
200 public:
201 std::string GetName() const override { return "mesen-state-verify"; }
202 std::string GetDescription() const {
203 return "Verify a savestate matches current ROM hash and metadata";
204 }
205 std::string GetUsage() const override {
206 return "mesen-state-verify --state <path> --rom-file <path> [--meta "
207 "<path>] "
208 "[--scenario <id>]";
209 }
210 bool RequiresRom() const override { return false; }
211 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
212 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
213 resources::OutputFormatter& formatter) override;
214};
215
217 public:
218 std::string GetName() const override { return "mesen-state-regen"; }
219 std::string GetDescription() const {
220 return "Regenerate savestate freshness metadata for current ROM";
221 }
222 std::string GetUsage() const override {
223 return "mesen-state-regen --state <path> --rom-file <path> [--meta <path>] "
224 "[--scenario <id>]";
225 }
226 bool RequiresRom() const override { return false; }
227 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
228 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
229 resources::OutputFormatter& formatter) override;
230};
231
233 public:
234 std::string GetName() const override { return "mesen-state-capture"; }
235 std::string GetDescription() const {
236 return "Capture/refresh savestate metadata in one command";
237 }
238 std::string GetUsage() const override {
239 return "mesen-state-capture --state <path> --rom-file <path> [--meta "
240 "<path>] [--scenario <id>] [--slot <n>] [--states-dir <path>] "
241 "[--wait-ms <n>]";
242 }
243 bool RequiresRom() const override { return false; }
244 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
245 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
246 resources::OutputFormatter& formatter) override;
247};
248
250 public:
251 std::string GetName() const override { return "mesen-state-hook"; }
252 std::string GetDescription() const {
253 return "Preflight hook summary for agent automation";
254 }
255 std::string GetUsage() const override {
256 return "mesen-state-hook --state <path> --rom-file <path> [--meta "
257 "<path>] [--scenario <id>]";
258 }
259 bool RequiresRom() const override { return false; }
260 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
261 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
262 resources::OutputFormatter& formatter) override;
263};
264
268std::vector<std::unique_ptr<resources::CommandHandler>>
270
271} // namespace handlers
272} // namespace cli
273} // namespace yaze
274
275#endif // YAZE_CLI_HANDLERS_MESEN_HANDLERS_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
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.
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.
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.
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.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
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.
std::string GetName() const override
Get the command name.
std::string GetUsage() const override
Get the command usage string.
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.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
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.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetUsage() const override
Get the command usage string.
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.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
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.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const override
Get the command name.
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.
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.
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 GetName() const override
Get the command name.
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 GetUsage() const override
Get the command usage string.
std::string GetUsage() const override
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
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.
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.
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.
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.
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 override
Get the command name.
std::string GetUsage() const override
Get the command usage string.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
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.
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.
Utility for parsing common CLI argument patterns.
Base class for CLI command handlers.
Utility for consistent output formatting across commands.
std::vector< std::unique_ptr< resources::CommandHandler > > CreateMesenCommandHandlers()
Factory function to create Mesen2 command handlers.