Porytiles
Loading...
Searching...
No Matches
porytiles::ProjectTilesetArtifactKeyProvider Class Referencefinal

Provides a pokeemerald project filesystem-based implementation for TilesetArtifactKeyProvider. More...

#include <project_tileset_artifact_key_provider.hpp>

Inheritance diagram for porytiles::ProjectTilesetArtifactKeyProvider:
[legend]
Collaboration diagram for porytiles::ProjectTilesetArtifactKeyProvider:
[legend]

Public Member Functions

 ProjectTilesetArtifactKeyProvider (std::filesystem::path project_root, gsl::not_null< const InfraConfig * > config, gsl::not_null< const TilesetMetadataProvider * > metadata_provider, gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > diag)
 Constructs a ProjectTilesetArtifactKeyProvider.
 
ChainableResult< ArtifactKeykey_for_metatiles_bin (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_metatile_attributes_bin (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_tiles_png (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_porymap_pal_n (const std::string &tileset_name, std::size_t index) const override
 
ChainableResult< ArtifactKeykey_for_porymap_anim_frame (const std::string &tileset_name, const std::string &anim_name, const std::string &frame_name) const override
 
ChainableResult< ArtifactKeykey_for_porymap_anim_params (const std::string &tileset_name) const override
 Returns the key for Porymap animation parameters.
 
ChainableResult< ArtifactKeykey_for_bottom_png (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_middle_png (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_top_png (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_attributes_csv (const std::string &tileset_name) const override
 
ChainableResult< ArtifactKeykey_for_porytiles_pal_n (const std::string &tileset_name, std::size_t index) const override
 
ChainableResult< ArtifactKeykey_for_porytiles_anim_frame (const std::string &tileset_name, const std::string &anim_name, const std::string &frame_name) const override
 
ChainableResult< ArtifactKeykey_for_porytiles_anim_params (const std::string &tileset_name) const override
 Returns the key for the anim.json file (Porytiles animation configuration).
 
bool artifact_exists (const ArtifactKey &key) const override
 Checks whether an artifact exists in the backing store for the given key.
 
ChainableResult< std::set< std::string > > discover_porymap_anims (const std::string &tileset_name) const override
 Discovers the names of all Porymap animations available for a tileset.
 
ChainableResult< std::set< std::string > > discover_porymap_anim_frames (const std::string &tileset_name, const std::string &anim_name) const override
 Discovers the frame indices for a specific Porymap animation.
 
ChainableResult< std::set< std::string > > discover_porytiles_anims (const std::string &tileset_name) const override
 Discovers the names of all Porytiles animations available for a tileset.
 
ChainableResult< std::set< std::string > > discover_porytiles_anim_frames (const std::string &tileset_name, const std::string &anim_name) const override
 Discovers the frame indices for a specific Porytiles animation.
 
- Public Member Functions inherited from porytiles::TilesetArtifactKeyProvider
virtual ~TilesetArtifactKeyProvider ()=default
 
virtual ChainableResult< std::vector< ArtifactKey > > get_porymap_artifact_keys (const std::string &tileset_name) const
 Gets the keys for all Porymap artifacts present in the given Tileset.
 
virtual ChainableResult< std::vector< ArtifactKey > > get_porytiles_artifact_keys (const std::string &tileset_name) const
 Gets the keys for all Porytiles artifacts present in the given Tileset.
 
virtual ChainableResult< std::vector< ArtifactKey > > get_all_artifact_keys (const std::string &tileset_name) const
 Gets the keys for all tileset artifacts (both Porytiles and Porymap) present in the given Tileset.
 

Detailed Description

Provides a pokeemerald project filesystem-based implementation for TilesetArtifactKeyProvider.

This class implements the TilesetArtifactKeyProvider interface to provide filesystem paths as keys for various tileset artifacts. It operates within the context of a Pokémon Gen III decompilation project, discovering and managing paths for animations, tiles, and other tileset components based on the project's directory structure.

Tileset metadata and artifact paths are discovered dynamically by parsing C source files (headers.h, graphics.h, metatiles.h) rather than relying on hardcoded filesystem path conventions.

For Porymap artifacts (tiles, palettes, metatiles), paths are resolved from INCBIN declarations. For Porytiles artifacts (bottom.png, middle.png, etc.), paths use a hardcoded relative location within each tileset.

Precondition
The tileset_name parameter in each method below (except tileset_exists) must refer to an existing tileset

Definition at line 35 of file project_tileset_artifact_key_provider.hpp.

Constructor & Destructor Documentation

◆ ProjectTilesetArtifactKeyProvider()

porytiles::ProjectTilesetArtifactKeyProvider::ProjectTilesetArtifactKeyProvider ( std::filesystem::path  project_root,
gsl::not_null< const InfraConfig * >  config,
gsl::not_null< const TilesetMetadataProvider * >  metadata_provider,
gsl::not_null< const TextFormatter * >  format,
gsl::not_null< const UserDiagnostics * >  diag 
)
inlineexplicit

Constructs a ProjectTilesetArtifactKeyProvider.

Parameters
project_rootThe root directory of the pokeemerald-style project
formatText formatter for styled output (non-owning, must outlive this)
diagDiagnostics handler for warnings (non-owning, must outlive this)

Definition at line 44 of file project_tileset_artifact_key_provider.hpp.

Member Function Documentation

◆ artifact_exists()

bool porytiles::ProjectTilesetArtifactKeyProvider::artifact_exists ( const ArtifactKey key) const
overridevirtual

Checks whether an artifact exists in the backing store for the given key.

This method should perform the actual existence check against the backing store using the provided key. This may involve filesystem operations, database queries, or other I/O depending on the implementation.

Parameters
keyThe key identifying the artifact to check (generated by key_for)
Returns
True if the artifact exists in the backing store, false otherwise

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 384 of file project_tileset_artifact_key_provider.cpp.

◆ discover_porymap_anim_frames()

ChainableResult< std::set< std::string > > porytiles::ProjectTilesetArtifactKeyProvider::discover_porymap_anim_frames ( const std::string &  tileset_name,
const std::string &  anim_name 
) const
overridevirtual

Discovers the frame indices for a specific Porymap animation.

Searches the backing store to find all animation frame files (excluding the key frame and 00.png) for a specific Porymap animation. The returned indices should be consecutive starting from 1. Since frame 0 is required, callers don't need to discover it.

Parameters
tileset_nameThe name of the tileset containing the animation
anim_nameThe name of the animation to search for frames
Returns
Set of frames found in the backing store

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 410 of file project_tileset_artifact_key_provider.cpp.

◆ discover_porymap_anims()

ChainableResult< std::set< std::string > > porytiles::ProjectTilesetArtifactKeyProvider::discover_porymap_anims ( const std::string &  tileset_name) const
overridevirtual

Discovers the names of all Porymap animations available for a tileset.

Searches the backing store to find all Porymap animation assets for the specified tileset. Porymap animations do not require key frames, only sequential frame files.

Parameters
tileset_nameThe name of the tileset to search for animations
Returns
Set of animation names found in the backing store

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 392 of file project_tileset_artifact_key_provider.cpp.

◆ discover_porytiles_anim_frames()

ChainableResult< std::set< std::string > > porytiles::ProjectTilesetArtifactKeyProvider::discover_porytiles_anim_frames ( const std::string &  tileset_name,
const std::string &  anim_name 
) const
overridevirtual

Discovers the frame indices for a specific Porytiles animation.

Searches the backing store to find all animation frame files (excluding the key frame and 00.png) for a specific Porytiles animation. The returned indices should be consecutive starting from 1. Since frame 0 is required, callers don't need to discover it.

Parameters
tileset_nameThe name of the tileset containing the animation
anim_nameThe name of the animation to search for frames
Returns
Set of frames found in the backing store (typically starting from 1)

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 448 of file project_tileset_artifact_key_provider.cpp.

◆ discover_porytiles_anims()

ChainableResult< std::set< std::string > > porytiles::ProjectTilesetArtifactKeyProvider::discover_porytiles_anims ( const std::string &  tileset_name) const
overridevirtual

Discovers the names of all Porytiles animations available for a tileset.

Searches the backing store to find all Porytiles animation directories or assets for the specified tileset. Porytiles animations require both a key frame and at least one animation frame (00.png).

Parameters
tileset_nameThe name of the tileset to search for animations
Returns
Set of animation names found in the backing store

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 430 of file project_tileset_artifact_key_provider.cpp.

◆ key_for_attributes_csv()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_attributes_csv ( const std::string &  tileset_name) const
overridevirtual

◆ key_for_bottom_png()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_bottom_png ( const std::string &  tileset_name) const
overridevirtual

◆ key_for_metatile_attributes_bin()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_metatile_attributes_bin ( const std::string &  tileset_name) const
overridevirtual

◆ key_for_metatiles_bin()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_metatiles_bin ( const std::string &  tileset_name) const
overridevirtual

◆ key_for_middle_png()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_middle_png ( const std::string &  tileset_name) const
overridevirtual

◆ key_for_porymap_anim_frame()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_porymap_anim_frame ( const std::string &  tileset_name,
const std::string &  anim_name,
const std::string &  frame_name 
) const
overridevirtual

◆ key_for_porymap_anim_params()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_porymap_anim_params ( const std::string &  tileset_name) const
overridevirtual

Returns the key for Porymap animation parameters.

Parameters
tileset_nameThe name of the tileset
Returns
Key for the generated_anim_code.h file

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 229 of file project_tileset_artifact_key_provider.cpp.

◆ key_for_porymap_pal_n()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_porymap_pal_n ( const std::string &  tileset_name,
std::size_t  index 
) const
overridevirtual

◆ key_for_porytiles_anim_frame()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_porytiles_anim_frame ( const std::string &  tileset_name,
const std::string &  anim_name,
const std::string &  frame_name 
) const
overridevirtual

◆ key_for_porytiles_anim_params()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_porytiles_anim_params ( const std::string &  tileset_name) const
overridevirtual

Returns the key for the anim.json file (Porytiles animation configuration).

The anim.json file stores animation parameters for the Porytiles component. It defines frame sequences, timing parameters, and other configuration for each animation in the tileset. For Porytiles animations, the anim parameters store is the source of truth for animation names, frame sequences, timing, and other parameters.

Parameters
tileset_nameThe name of the tileset
Returns
Key for the anim.json file

Implements porytiles::TilesetArtifactKeyProvider.

Definition at line 364 of file project_tileset_artifact_key_provider.cpp.

◆ key_for_porytiles_pal_n()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_porytiles_pal_n ( const std::string &  tileset_name,
std::size_t  index 
) const
overridevirtual

◆ key_for_tiles_png()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_tiles_png ( const std::string &  tileset_name) const
overridevirtual

◆ key_for_top_png()

ChainableResult< ArtifactKey > porytiles::ProjectTilesetArtifactKeyProvider::key_for_top_png ( const std::string &  tileset_name) const
overridevirtual

The documentation for this class was generated from the following files: