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
20 public:
21 std::string GetName() const override { return "gfx-export"; }
22 std::string GetUsage() const override {
23 return "gfx-export --sheet <id> --png <file> [--block <0-15>] "
24 "[--count <n>] [--palette gray|rgb:...|room-bg:<room>:<row>|"
25 "room-sprite:<room>:<row>|room-slot:<room>:<slot>:<row>] [--json "
26 "<file>]";
27 }
28 std::string GetDefaultFormat() const override { return "json"; }
29 std::string GetOutputTitle() const override { return "Graphics Export"; }
30 bool RequiresRom() const override { return true; }
31 Descriptor Describe() const override {
32 Descriptor desc;
33 desc.display_name = "gfx-export";
34 desc.summary =
35 "Export a graphics sheet (or 16x16 block range) to an "
36 "indexed PNG with a chosen palette.";
37 return desc;
38 }
39 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
40 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
41 resources::OutputFormatter& formatter) override;
42};
43
50 public:
51 std::string GetName() const override { return "gfx-import"; }
52 std::string GetUsage() const override {
53 return "gfx-import --sheet <id> --png <file> [--block <0-15>] "
54 "[--palette ...] (--dry-run | --write --out <rom file>)";
55 }
56 std::string GetDefaultFormat() const override { return "json"; }
57 std::string GetOutputTitle() const override { return "Graphics Import"; }
58 bool RequiresRom() const override { return true; }
59 Descriptor Describe() const override {
60 Descriptor desc;
61 desc.display_name = "gfx-import";
62 desc.summary =
63 "Import an indexed PNG into a graphics sheet: preview the "
64 "exact changes, then write a new ROM file.";
65 return desc;
66 }
67 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
68 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
69 resources::OutputFormatter& formatter) override;
70};
71
80 public:
81 std::string GetName() const override { return "gfx-room-export"; }
82 std::string GetUsage() const override {
83 return "gfx-room-export --room <id> (--png <file> | --out-dir <new-dir>) "
84 "[--row <0-7>] "
85 "[--palette ...] [--json <file>]";
86 }
87 std::string GetDefaultFormat() const override { return "json"; }
88 std::string GetOutputTitle() const override {
89 return "Room Background Export";
90 }
91 bool RequiresRom() const override { return true; }
92 Descriptor Describe() const override {
93 Descriptor desc;
94 desc.display_name = "gfx-room-export";
95 desc.summary =
96 "Export a dungeon room's background sheets to one PNG "
97 "with the room palette, and list the rooms that share "
98 "them.";
99 return desc;
100 }
101 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
102 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
103 resources::OutputFormatter& formatter) override;
104};
105
111 public:
112 std::string GetName() const override { return "gfx-room-import"; }
113 std::string GetUsage() const override {
114 return "gfx-room-import --room <id> --png <file> [--row <0-7>] "
115 "[--palette ...] (--dry-run | --write --out <rom file>)";
116 }
117 std::string GetDefaultFormat() const override { return "json"; }
118 std::string GetOutputTitle() const override {
119 return "Room Background Import";
120 }
121 bool RequiresRom() const override { return true; }
122 Descriptor Describe() const override {
123 Descriptor desc;
124 desc.display_name = "gfx-room-import";
125 desc.summary =
126 "Import an edited room background PNG into the sheets it "
127 "changes.";
128 return desc;
129 }
130 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override;
131 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
132 resources::OutputFormatter& formatter) override;
133};
134
135} // namespace cli
136} // namespace yaze
137
138#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:49
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.