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 <hex,hex,...>] "
98 "[--require-write-support] [--skip-collision-maps] "
99 "[--report <path>] [--format <json|text>]";
100 }
101
102 Descriptor Describe() const override {
103 Descriptor descriptor;
104 descriptor.display_name = "Dungeon Oracle Preflight";
105 descriptor.summary =
106 "Run all Oracle ROM safety checks (water-fill region/table, custom "
107 "collision maps, required-room collision) and emit one JSON report. "
108 "Returns non-zero on any error.";
109 descriptor.todo_reference = "todo#oracle-testing-infra";
110 descriptor.entries = {
111 {"--required-collision-rooms",
112 "Comma-separated hex room IDs that must have authored custom "
113 "collision data (e.g. 0x25,0x27 for D4 water gates)",
114 ""},
115 {"--require-write-support",
116 "Also require expanded custom collision write region (needed for "
117 "dungeon-import-custom-collision-json)",
118 ""},
119 {"--skip-collision-maps",
120 "Skip per-room collision pointer validation (faster, for ROM doctor)",
121 ""},
122 {"--report",
123 "Write the JSON report to this path in addition to stdout", ""},
124 };
125 return descriptor;
126 }
127
128 // Probes --report path writability before the formatter starts.
129 // Called by CommandHandler::Run() before formatter.BeginObject(), so a
130 // failure here produces zero stdout output (pure stderr + non-zero exit).
131 absl::Status ValidateArgs(
132 const resources::ArgumentParser& parser) override;
133
134 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
135 resources::OutputFormatter& formatter) override;
136};
137
138} // namespace yaze::cli::handlers
139
140#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.