|
Porytiles
|
Provides surgical update capability for tileset metadata in headers.h files. More...
#include <project_tileset_metadata_writer.hpp>
Public Member Functions | |
| ProjectTilesetMetadataWriter (std::filesystem::path project_root, gsl::not_null< const TextFormatter * > format) | |
| ChainableResult< void > | update_callback (const std::string &tileset_name, const std::string &new_callback_value) const |
| Updates the .callback field for a specific tileset. | |
| ChainableResult< void > | update_fields (const std::string &tileset_name, const std::map< std::string, std::string > &field_updates) const |
| Updates multiple fields for a specific tileset in headers.h. | |
| ChainableResult< void > | update_to_porytiles_managed (const std::string &tileset_name) const |
| Updates asset fields to Porytiles-managed values. | |
| ChainableResult< void > | create_tileset_struct (const std::string &tileset_name, bool is_secondary) const |
| Creates a new tileset struct and appends it to headers.h. | |
Provides surgical update capability for tileset metadata in headers.h files.
This class enables targeted modifications to specific fields within tileset struct declarations in pokeemerald headers.h files. Unlike a full rewrite approach, it performs surgical line-level edits to preserve formatting, comments, and other content in the file.
Supports updating any field in the Tileset struct, including .tiles, .palettes, .metatiles, .metatileAttributes, and .callback.
Definition at line 25 of file project_tileset_metadata_writer.hpp.
| porytiles::ProjectTilesetMetadataWriter::ProjectTilesetMetadataWriter | ( | std::filesystem::path | project_root, |
| gsl::not_null< const TextFormatter * > | format | ||
| ) |
Definition at line 29 of file project_tileset_metadata_writer.cpp.
| ChainableResult< void > porytiles::ProjectTilesetMetadataWriter::create_tileset_struct | ( | const std::string & | tileset_name, |
| bool | is_secondary | ||
| ) | const |
Creates a new tileset struct and appends it to headers.h.
Generates a complete Tileset struct with Porytiles-managed field values and appends it to the end of headers.h. The struct uses the standard pokeemerald format:
| tileset_name | The tileset name (e.g., "gTileset_MyTileset") |
| is_secondary | If true, sets .isSecondary = TRUE; if false, sets .isSecondary = FALSE |
Definition at line 146 of file project_tileset_metadata_writer.cpp.
| ChainableResult< void > porytiles::ProjectTilesetMetadataWriter::update_callback | ( | const std::string & | tileset_name, |
| const std::string & | new_callback_value | ||
| ) | const |
Updates the .callback field for a specific tileset.
Locates the tileset struct by name in headers.h and surgically replaces the .callback field value. The new value is written exactly as provided - callers should pass either "NULL" or "InitTilesetAnim_<name>" format.
| tileset_name | The tileset name (e.g., "gTileset_General") - must match exactly |
| new_callback_value | The exact value to write (e.g., "InitTilesetAnim_General" or "NULL") |
Definition at line 35 of file project_tileset_metadata_writer.cpp.
| ChainableResult< void > porytiles::ProjectTilesetMetadataWriter::update_fields | ( | const std::string & | tileset_name, |
| const std::map< std::string, std::string > & | field_updates | ||
| ) | const |
Updates multiple fields for a specific tileset in headers.h.
Locates the tileset struct by name and surgically replaces specified field values. All updates are performed in a single parse-modify-write cycle for efficiency. Field names should be provided WITHOUT the leading dot (e.g., "tiles" not ".tiles").
| tileset_name | The tileset name (e.g., "gTileset_General") - must match exactly |
| field_updates | Map of field names to new values |
Definition at line 41 of file project_tileset_metadata_writer.cpp.
| ChainableResult< void > porytiles::ProjectTilesetMetadataWriter::update_to_porytiles_managed | ( | const std::string & | tileset_name | ) | const |
Updates asset fields to Porytiles-managed values.
Generates new field values using the "PorytilesManaged" naming convention:
| tileset_name | The tileset name (e.g., "gTileset_General") |
Definition at line 124 of file project_tileset_metadata_writer.cpp.