yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
gfx_sheet_png_commands.h
Go to the documentation of this file.
1#ifndef YAZE_CLI_HANDLERS_GRAPHICS_GFX_SHEET_PNG_COMMANDS_H_
2#define YAZE_CLI_HANDLERS_GRAPHICS_GFX_SHEET_PNG_COMMANDS_H_
3
5
6namespace yaze {
7namespace cli {
8
9// Palette specs shared by gfx-export and gfx-import:
10// gray 8-step grayscale (default)
11// rgb:#RRGGBB,... exactly 8 colors for indices 0-7
12// room-bg:<room>:<row> explicit LEFT half of background CGRAM row 0-7
13// room-slot:<room>:<slot>:<row> loaded slot's palette half (single sheet)
14// room-sprite:<room>:<row> dungeon room sprite palette (OAM row 0-7);
15// the high half for sheets vanilla loads there
16
21 public:
22 std::string GetName() const override { return "gfx-export"; }
23 std::string GetUsage() const override {
24 return "gfx-export --sheet <id> --png <file> [--block <0-15>] "
25 "[--count <n>] [--palette gray|rgb:...|room-bg:<room>:<row>|"
26 "room-sprite:<room>:<row>|room-slot:<room>:<slot>:<row>] [--json "
27 "<file>]";
28 }
29 std::string GetDefaultFormat() const override { return "json"; }
30 std::string GetOutputTitle() const override { return "Graphics Export"; }
31 bool RequiresRom() const override { return true; }
32 Descriptor Describe() const override {
33 Descriptor desc;
34 desc.display_name = "gfx-export";
35 desc.summary =
36 "Export a graphics sheet (or 16x16 block range) to an "
37 "indexed PNG with a chosen palette.";
38 return desc;
39 }
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
56 public:
57 std::string GetName() const override { return "gfx-import"; }
58 std::string GetUsage() const override {
59 return "gfx-import --sheet <id> --png <file> [--block <0-15>] "
60 "[--palette ...] [--diff-png <file>] "
61 "[--project-context <path.yaze>] "
62 "(--dry-run | --write --out <rom file>)";
63 }
64 std::string GetDefaultFormat() const override { return "json"; }
65 std::string GetOutputTitle() const override { return "Graphics Import"; }
66 bool RequiresRom() const override { return true; }
67 Descriptor Describe() const override {
68 Descriptor desc;
69 desc.display_name = "gfx-import";
70 desc.summary =
71 "Import an indexed PNG into a graphics sheet: preview the "
72 "exact changes, then write a new ROM file.";
73 return desc;
74 }
75 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
76 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
77 resources::OutputFormatter& formatter) override;
78};
79
88 public:
89 std::string GetName() const override { return "gfx-room-export"; }
90 std::string GetUsage() const override {
91 return "gfx-room-export --room <id> (--png <file> | --out-dir <new-dir>) "
92 "[--row <0-7>] "
93 "[--palette ...] [--json <file>]";
94 }
95 std::string GetDefaultFormat() const override { return "json"; }
96 std::string GetOutputTitle() const override {
97 return "Room Background Export";
98 }
99 bool RequiresRom() const override { return true; }
100 Descriptor Describe() const override {
101 Descriptor desc;
102 desc.display_name = "gfx-room-export";
103 desc.summary =
104 "Export a dungeon room's background sheets to one PNG "
105 "with the room palette, and list the rooms that share "
106 "them.";
107 return desc;
108 }
109 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
110 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
111 resources::OutputFormatter& formatter) override;
112};
113
120 public:
121 std::string GetName() const override { return "gfx-room-import"; }
122 std::string GetUsage() const override {
123 return "gfx-room-import --room <id> --png <file> [--row <0-7>] "
124 "[--palette ...] [--project-context <path.yaze>] "
125 "(--dry-run | --write --out <rom file>)";
126 }
127 std::string GetDefaultFormat() const override { return "json"; }
128 std::string GetOutputTitle() const override {
129 return "Room Background Import";
130 }
131 bool RequiresRom() const override { return true; }
132 Descriptor Describe() const override {
133 Descriptor desc;
134 desc.display_name = "gfx-room-import";
135 desc.summary =
136 "Import an edited room background PNG into the sheets it "
137 "changes.";
138 return desc;
139 }
140 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
141 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
142 resources::OutputFormatter& formatter) override;
143};
144
145} // namespace cli
146} // namespace yaze
147
148#endif // YAZE_CLI_HANDLERS_GRAPHICS_GFX_SHEET_PNG_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:52
Export 16x16 blocks of a 3bpp graphics sheet to an indexed PNG.
std::string GetOutputTitle() const override
Get the output title for formatting.
std::string GetDefaultFormat() const override
Get the default output format ("json" or "text")
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
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.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const override
Get the command name.
Import an indexed PNG into a sheet at a 16x16 block. –dry-run reports the blocks, tiles and ROM bytes...
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.
std::string GetOutputTitle() const override
Get the output title for formatting.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
std::string GetName() const override
Get the command name.
std::string GetDefaultFormat() const override
Get the default output format ("json" or "text")
Export a dungeon room's 8 background sheets as one 128x256 indexed PNG with one uniform palette,...
Descriptor Describe() const override
Provide metadata for TUI/help summaries.
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 GetDefaultFormat() const override
Get the default output format ("json" or "text")
std::string GetOutputTitle() const override
Get the output title for formatting.
std::string GetName() const override
Get the command name.
Import an edited room background PNG: only sheets whose pixels changed are written,...
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.
std::string GetName() const override
Get the command name.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetDefaultFormat() const override
Get the default output format ("json" or "text")
std::string GetOutputTitle() const override
Get the output title for formatting.
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.
Base class for CLI command handlers.
Utility for consistent output formatting across commands.