|
Porytiles
|
Provides a pokeemerald project filesystem-based implementation for TilesetMetadataProvider. More...
#include <project_tileset_metadata_provider.hpp>
Public Member Functions | |
| ProjectTilesetMetadataProvider (std::filesystem::path project_root, gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > diag) | |
| bool | exists (const std::string &tileset_name) const override |
| Checks whether a tileset exists in the backing store for the given tileset name. | |
| ChainableResult< bool > | is_secondary (const std::string &tileset_name) const override |
| Determines whether a tileset is a secondary tileset. | |
| ChainableResult< bool > | has_animations (const std::string &tileset_name) const override |
| Determines whether a tileset has animation support. | |
| ChainableResult< std::set< std::string > > | tilesets () const override |
| Returns all tileset names known to this provider. | |
| ChainableResult< ProjectTilesetMetadata > | metadata_for (const std::string &tileset_name) const |
| Retrieves metadata for a specific tileset from the struct cache. | |
| ChainableResult< ProjectTilesetArtifactPaths > | artifact_paths_for (const std::string &tileset_name) const |
| Resolves artifact paths for a tileset by parsing INCBIN declarations. | |
| void | invalidate_metadata_cache () const |
| Invalidates the lazy-loaded metadata and artifact paths caches, forcing a re-parse on next access. | |
Public Member Functions inherited from porytiles::TilesetMetadataProvider | |
| virtual | ~TilesetMetadataProvider ()=default |
Provides a pokeemerald project filesystem-based implementation for TilesetMetadataProvider.
This class parses tileset struct declarations from headers.h to extract metadata such as whether a tileset is primary/secondary, what animation callback it uses, and the variable names for tiles, palettes, metatiles, and attributes.
Tileset struct metadata is lazy-loaded and cached for efficiency.
Definition at line 30 of file project_tileset_metadata_provider.hpp.
|
inline |
Definition at line 32 of file project_tileset_metadata_provider.hpp.
| ChainableResult< ProjectTilesetArtifactPaths > porytiles::ProjectTilesetMetadataProvider::artifact_paths_for | ( | const std::string & | tileset_name | ) | const |
Resolves artifact paths for a tileset by parsing INCBIN declarations.
This method retrieves tileset metadata (which contains INCBIN variable names), then looks up the actual filesystem paths for those variables by parsing graphics.h, metatiles.h, and src/graphics.c.
| tileset_name | The name of the tileset (e.g., "gTileset_General") |
Definition at line 260 of file project_tileset_metadata_provider.cpp.
|
overridevirtual |
Checks whether a tileset exists in the backing store for the given tileset name.
| tileset_name | The name of the tileset to check (e.g., "gTileset_General") |
Implements porytiles::TilesetMetadataProvider.
Definition at line 211 of file project_tileset_metadata_provider.cpp.
|
overridevirtual |
Determines whether a tileset has animation support.
Animated tilesets have a non-null animation callback function that cycles through animation frames. This information is needed to properly handle tile references that may animate at runtime.
| tileset_name | The identifier for the tileset (e.g., "gTileset_General") |
Implements porytiles::TilesetMetadataProvider.
Definition at line 223 of file project_tileset_metadata_provider.cpp.
| void porytiles::ProjectTilesetMetadataProvider::invalidate_metadata_cache | ( | ) | const |
Invalidates the lazy-loaded metadata and artifact paths caches, forcing a re-parse on next access.
This is needed when the underlying files (e.g. headers.h) have been modified on disk since the cache was populated. For example, after creating a new tileset struct, the cache must be invalidated so subsequent metadata lookups see the newly written struct.
Definition at line 281 of file project_tileset_metadata_provider.cpp.
|
overridevirtual |
Determines whether a tileset is a secondary tileset.
In pokeemerald, tilesets are either primary or secondary. Primary tilesets contain shared tiles and palettes, while secondary tilesets contain map-specific content and layer on top of primaries. This distinction affects tile indexing, palette allocation, and metatile attribute encoding.
| tileset_name | The identifier for the tileset (e.g., "gTileset_General") |
Implements porytiles::TilesetMetadataProvider.
Definition at line 217 of file project_tileset_metadata_provider.cpp.
| ChainableResult< ProjectTilesetMetadata > porytiles::ProjectTilesetMetadataProvider::metadata_for | ( | const std::string & | tileset_name | ) | const |
Retrieves metadata for a specific tileset from the struct cache.
This method parses tileset struct declarations from headers.h to extract raw field values. The result contains only the fields directly from the struct: name, is_secondary, variable names, and callback.
| tileset_name | The name of the tileset (e.g., "gTileset_General") |
Definition at line 244 of file project_tileset_metadata_provider.cpp.
|
overridevirtual |
Returns all tileset names known to this provider.
Enumerates all tilesets available in the backing store. This enables batch operations, validation, and listing without requiring callers to know tileset names in advance.
Implements porytiles::TilesetMetadataProvider.
Definition at line 229 of file project_tileset_metadata_provider.cpp.