yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
gui_commands.cc
Go to the documentation of this file.
2
3#include "absl/strings/numbers.h"
4#include "absl/strings/str_format.h"
5
6namespace yaze {
7namespace cli {
8namespace handlers {
9
11 resources::OutputFormatter& formatter) {
12 auto tile_id_str = parser.GetString("tile").value();
13 auto x_str = parser.GetString("x").value();
14 auto y_str = parser.GetString("y").value();
15
16 int tile_id, x, y;
17 if (!absl::SimpleHexAtoi(tile_id_str, &tile_id) ||
18 !absl::SimpleAtoi(x_str, &x) ||
19 !absl::SimpleAtoi(y_str, &y)) {
20 return absl::InvalidArgumentError(
21 "Invalid tile ID or coordinate format.");
22 }
23
24 formatter.BeginObject("GUI Tile Placement");
25 formatter.AddField("tile_id", absl::StrFormat("0x%03X", tile_id));
26 formatter.AddField("x", x);
27 formatter.AddField("y", y);
28 formatter.AddField("status", "GUI automation requires YAZE_WITH_GRPC=ON");
29 formatter.AddField("note", "Connect to running YAZE instance to execute");
30 formatter.EndObject();
31
32 return absl::OkStatus();
33}
34
36 resources::OutputFormatter& formatter) {
37 auto target = parser.GetString("target").value();
38 auto click_type = parser.GetString("click-type").value_or("left");
39
40 formatter.BeginObject("GUI Click Action");
41 formatter.AddField("target", target);
42 formatter.AddField("click_type", click_type);
43 formatter.AddField("status", "GUI automation requires YAZE_WITH_GRPC=ON");
44 formatter.AddField("note", "Connect to running YAZE instance to execute");
45 formatter.EndObject();
46
47 return absl::OkStatus();
48}
49
51 resources::OutputFormatter& formatter) {
52 auto window = parser.GetString("window").value_or("Overworld");
53 auto type = parser.GetString("type").value_or("all");
54
55 formatter.BeginObject("Widget Discovery");
56 formatter.AddField("window", window);
57 formatter.AddField("type_filter", type);
58 formatter.AddField("total_widgets", 4);
59 formatter.AddField("status", "GUI automation requires YAZE_WITH_GRPC=ON");
60 formatter.AddField("note", "Connect to running YAZE instance for live data");
61
62 formatter.BeginArray("example_widgets");
63 formatter.AddArrayItem("ModeButton:Pan (1) - button");
64 formatter.AddArrayItem("ModeButton:Draw (2) - button");
65 formatter.AddArrayItem("ToolbarAction:Toggle Tile16 Selector - button");
66 formatter.AddArrayItem("ToolbarAction:Open Tile16 Editor - button");
67 formatter.EndArray();
68 formatter.EndObject();
69
70 return absl::OkStatus();
71}
72
74 resources::OutputFormatter& formatter) {
75 auto region = parser.GetString("region").value_or("full");
76 auto image_format = parser.GetString("format").value_or("PNG");
77
78 formatter.BeginObject("Screenshot Capture");
79 formatter.AddField("region", region);
80 formatter.AddField("image_format", image_format);
81 formatter.AddField("output_path", "/tmp/yaze_screenshot.png");
82 formatter.AddField("status", "GUI automation requires YAZE_WITH_GRPC=ON");
83 formatter.AddField("note", "Connect to running YAZE instance to execute");
84 formatter.EndObject();
85
86 return absl::OkStatus();
87}
88
89} // namespace handlers
90} // namespace cli
91} // namespace yaze
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
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.
std::optional< std::string > GetString(const std::string &name) const
Parse a named argument (e.g., –format=json or –format json)
Utility for consistent output formatting across commands.
void BeginArray(const std::string &key)
Begin an array.
void AddArrayItem(const std::string &item)
Add an item to current array.
void BeginObject(const std::string &title="")
Start a JSON object or text section.
void EndObject()
End a JSON object or text section.
void AddField(const std::string &key, const std::string &value)
Add a key-value pair.
Main namespace for the application.