yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
oracle_menu_commands.h
Go to the documentation of this file.
1#ifndef YAZE_SRC_CLI_HANDLERS_GAME_ORACLE_MENU_COMMANDS_H_
2#define YAZE_SRC_CLI_HANDLERS_GAME_ORACLE_MENU_COMMANDS_H_
3
5
6namespace yaze::cli::handlers {
7
9 public:
10 std::string GetName() const override { return "oracle-menu-index"; }
11 std::string GetUsage() const override {
12 return "oracle-menu-index [--project <path>] [--table <label>] "
13 "[--draw-filter <text>] [--missing-bins] [--format <json|text>]";
14 }
15 bool RequiresRom() const override { return false; }
16
17 Descriptor Describe() const override {
18 Descriptor descriptor;
19 descriptor.display_name = "Oracle Menu Index";
20 descriptor.summary =
21 "Scan Oracle menu ASM for incbin assets, draw routines, and "
22 "menu_offset component tables.";
23 descriptor.todo_reference = "todo#oracle-menu-tooling";
24 return descriptor;
25 }
26
27 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
28
29 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
30 resources::OutputFormatter& formatter) override;
31};
32
34 public:
35 std::string GetName() const override { return "oracle-menu-set-offset"; }
36 std::string GetUsage() const override {
37 return "oracle-menu-set-offset --asm <path> --table <label> --index <n> "
38 "--row <n> --col <n> [--project <path>] [--write] "
39 "[--format <json|text>]";
40 }
41 bool RequiresRom() const override { return false; }
42
43 Descriptor Describe() const override {
44 Descriptor descriptor;
45 descriptor.display_name = "Oracle Menu Set Offset";
46 descriptor.summary =
47 "Update a single menu_offset(row,col) entry in a component table. "
48 "Dry-run by default; use --write to apply.";
49 descriptor.todo_reference = "todo#oracle-menu-tooling";
50 return descriptor;
51 }
52
53 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
54 return parser.RequireArgs({"asm", "table", "index", "row", "col"});
55 }
56
57 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
58 resources::OutputFormatter& formatter) override;
59};
60
62 public:
63 std::string GetName() const override { return "oracle-menu-validate"; }
64 std::string GetUsage() const override {
65 return "oracle-menu-validate [--project <path>] [--max-row <n>] "
66 "[--max-col <n>] [--strict] [--format <json|text>]";
67 }
68 bool RequiresRom() const override { return false; }
69
70 Descriptor Describe() const override {
71 Descriptor descriptor;
72 descriptor.display_name = "Oracle Menu Validate";
73 descriptor.summary =
74 "Validate Oracle menu bins and component tables; exits non-zero on "
75 "errors.";
76 descriptor.todo_reference = "todo#oracle-menu-tooling";
77 return descriptor;
78 }
79
80 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
81
82 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
83 resources::OutputFormatter& formatter) override;
84};
85
86// ---------------------------------------------------------------------------
87// dungeon-oracle-preflight
88//
89// Single consolidated ROM safety check that runs all Oracle-specific
90// preflight validators and emits one structured JSON report. Intended as
91// the "one command to verify all three workflows" before any write path.
92// ---------------------------------------------------------------------------
94 public:
95 std::string GetName() const override { return "dungeon-oracle-preflight"; }
96 std::string GetUsage() const override {
97 return "dungeon-oracle-preflight [--required-collision-rooms "
98 "<hex,hex,...>] "
99 "[--required-water-fill-rooms <hex,hex,...>] "
100 "[--require-write-support] [--skip-collision-maps] "
101 "[--report <path>] [--format <json|text>]";
102 }
103
104 Descriptor Describe() const override {
105 Descriptor descriptor;
106 descriptor.display_name = "Dungeon Oracle Preflight";
107 descriptor.summary =
108 "Run all Oracle ROM safety checks (water-fill region/table, custom "
109 "collision maps, required-room collision) and emit one JSON report. "
110 "Returns non-zero on any error.";
111 descriptor.todo_reference = "todo#oracle-testing-infra";
112 descriptor.entries = {
113 {"--required-collision-rooms",
114 "Comma-separated hex room IDs that must have authored custom "
115 "collision data (e.g. 0x32 for the D3 prison)",
116 ""},
117 {"--required-water-fill-rooms",
118 "Comma-separated hex room IDs that must be present in the runtime "
119 "WaterFill table (e.g. 0x25,0x27 for D4 water gates)",
120 ""},
121 {"--require-write-support",
122 "Also require expanded custom collision write region (needed for "
123 "dungeon-import-custom-collision-json)",
124 ""},
125 {"--skip-collision-maps",
126 "Skip per-room collision pointer validation (faster, for ROM doctor)",
127 ""},
128 {"--report", "Write the JSON report to this path in addition to stdout",
129 ""},
130 };
131 return descriptor;
132 }
133
134 // Probes --report path writability before the formatter starts.
135 // Called by CommandHandler::Run() before formatter.BeginObject(), so a
136 // failure here produces zero stdout output (pure stderr + non-zero exit).
137 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
138
139 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
140 resources::OutputFormatter& formatter) override;
141};
142
143} // namespace yaze::cli::handlers
144
145#endif // YAZE_SRC_CLI_HANDLERS_GAME_ORACLE_MENU_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
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.
std::string GetUsage() const override
Get the command usage string.
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
std::string GetName() const override
Get the command name.
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
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.
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.
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
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.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
std::string GetName() const override
Get the command name.
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
std::string GetUsage() const override
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.
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.