Unified interface for accessing resource labels with project overrides. More...
#include <resource_labels.h>

Public Types | |
| using | LabelMap = std::unordered_map<std::string, std::string> |
| using | ProjectLabels = std::unordered_map<std::string, LabelMap> |
Public Member Functions | |
| ResourceLabelProvider ()=default | |
| void | SetProjectLabels (ProjectLabels *labels) |
| Set the project labels reference (typically from YazeProject) | |
| void | SetHackManifest (const core::HackManifest *manifest) |
| Set the hack manifest reference for ASM-defined labels. | |
| std::string | GetLabel (ResourceType type, int id) const |
| Get a label for a resource by type and ID. | |
| std::string | GetLabel (const std::string &type_str, int id) const |
| Get a label using string type key (for compatibility) | |
| void | SetProjectLabel (ResourceType type, int id, const std::string &label) |
| Set a project-specific label override. | |
| void | ClearProjectLabel (ResourceType type, int id) |
| Clear a project-specific label (revert to default) | |
| bool | HasProjectLabel (ResourceType type, int id) const |
| Check if a project-specific label exists. | |
| std::string | GetVanillaLabel (ResourceType type, int id) const |
| Get the vanilla (default) label for a resource. | |
| std::string | GetHMagicLabel (ResourceType type, int id) const |
| Get the Hyrule Magic label for a resource (sprites only) | |
| void | SetPreferHMagicNames (bool prefer) |
| Set whether to prefer Hyrule Magic sprite names. | |
| bool | PreferHMagicNames () const |
| Get whether Hyrule Magic names are preferred. | |
| absl::Status | ImportFromZScreamFormat (const std::string &content) |
| Import labels from ZScream DefaultNames.txt format. | |
| std::string | ExportToZScreamFormat () const |
| Export project labels to ZScream DefaultNames.txt format. | |
| absl::Status | ImportOracleSpriteRegistry (const std::string &csv_content) |
| Import sprite labels from Oracle of Secrets registry.csv format. | |
| int | GetResourceCount (ResourceType type) const |
| Get the count of resources for a given type. | |
| const LabelMap * | GetProjectLabelsForType (ResourceType type) const |
| Get all project labels for a given type. | |
| void | ClearAllProjectLabels () |
| Clear all project labels. | |
| const ProjectLabels * | GetAllProjectLabels () const |
| Get all project labels (read-only) | |
Private Member Functions | |
| bool | ParseZScreamLine (const std::string &line, const std::string §ion, int &line_index) |
Private Attributes | |
| ProjectLabels * | project_labels_ = nullptr |
| const core::HackManifest * | hack_manifest_ = nullptr |
| bool | prefer_hmagic_ = true |
Unified interface for accessing resource labels with project overrides.
This class provides a centralized way to access resource labels (names) for various game resources. It supports:
Resolution Priority: Project Labels -> Hyrule Magic (if enabled) -> Vanilla
Definition at line 57 of file resource_labels.h.
| using yaze::zelda3::ResourceLabelProvider::LabelMap = std::unordered_map<std::string, std::string> |
Definition at line 59 of file resource_labels.h.
| using yaze::zelda3::ResourceLabelProvider::ProjectLabels = std::unordered_map<std::string, LabelMap> |
Definition at line 60 of file resource_labels.h.
|
default |
|
inline |
Set the project labels reference (typically from YazeProject)
Definition at line 67 of file resource_labels.h.
References project_labels_.
|
inline |
Set the hack manifest reference for ASM-defined labels.
Definition at line 72 of file resource_labels.h.
References hack_manifest_.
Referenced by yaze::project::YazeProject::TryLoadHackManifest().
| std::string yaze::zelda3::ResourceLabelProvider::GetLabel | ( | ResourceType | type, |
| int | id ) const |
Get a label for a resource by type and ID.
| type | The resource type |
| id | The numeric ID of the resource |
Resolution order:
Definition at line 135 of file resource_labels.cc.
References GetHMagicLabel(), yaze::core::HackManifest::GetRoomTagLabel(), GetVanillaLabel(), hack_manifest_, yaze::zelda3::kRoomTag, yaze::zelda3::kSprite, yaze::core::HackManifest::loaded(), prefer_hmagic_, project_labels_, and yaze::zelda3::ResourceTypeToString().
Referenced by ExportToZScreamFormat(), yaze::zelda3::GetEntranceLabel(), yaze::zelda3::GetItemLabel(), GetLabel(), yaze::zelda3::GetMusicLabel(), yaze::zelda3::GetOverlordLabel(), yaze::zelda3::GetOverworldMapLabel(), yaze::zelda3::GetRoomLabel(), yaze::zelda3::GetRoomTagLabel(), yaze::zelda3::GetSpriteLabel(), and yaze::zelda3::ResolveSpriteName().
| std::string yaze::zelda3::ResourceLabelProvider::GetLabel | ( | const std::string & | type_str, |
| int | id ) const |
Get a label using string type key (for compatibility)
Definition at line 174 of file resource_labels.cc.
References GetLabel(), and yaze::zelda3::StringToResourceType().

| void yaze::zelda3::ResourceLabelProvider::SetProjectLabel | ( | ResourceType | type, |
| int | id, | ||
| const std::string & | label ) |
Set a project-specific label override.
Definition at line 180 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| void yaze::zelda3::ResourceLabelProvider::ClearProjectLabel | ( | ResourceType | type, |
| int | id ) |
Clear a project-specific label (revert to default)
Definition at line 189 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| bool yaze::zelda3::ResourceLabelProvider::HasProjectLabel | ( | ResourceType | type, |
| int | id ) const |
Check if a project-specific label exists.
Definition at line 200 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| std::string yaze::zelda3::ResourceLabelProvider::GetVanillaLabel | ( | ResourceType | type, |
| int | id ) const |
Get the vanilla (default) label for a resource.
Definition at line 212 of file resource_labels.cc.
References yaze::zelda3::Zelda3Labels::GetEntranceNames(), yaze::zelda3::Zelda3Labels::GetGraphicsSheetNames(), yaze::zelda3::Zelda3Labels::GetItemNames(), yaze::zelda3::Zelda3Labels::GetMusicTrackNames(), yaze::zelda3::Zelda3Labels::GetOverlordNames(), yaze::zelda3::Zelda3Labels::GetOverworldMapNames(), yaze::zelda3::Zelda3Labels::GetRoomEffectNames(), yaze::zelda3::Zelda3Labels::GetRoomNames(), yaze::zelda3::Zelda3Labels::GetRoomTagNames(), yaze::zelda3::Zelda3Labels::GetSpriteNames(), yaze::zelda3::Zelda3Labels::GetTileTypeNames(), yaze::zelda3::kEntrance, yaze::zelda3::kGraphics, yaze::zelda3::kItem, yaze::zelda3::kMusic, yaze::zelda3::kOverlord, yaze::zelda3::kOverworldMap, yaze::zelda3::kRoom, yaze::zelda3::kRoomEffect, yaze::zelda3::kRoomTag, yaze::zelda3::kSprite, and yaze::zelda3::kTileType.
Referenced by GetLabel().
| std::string yaze::zelda3::ResourceLabelProvider::GetHMagicLabel | ( | ResourceType | type, |
| int | id ) const |
Get the Hyrule Magic label for a resource (sprites only)
Definition at line 296 of file resource_labels.cc.
References yaze::zelda3::kSprite, yaze::zelda3::kSpriteNameCount, and yaze::zelda3::kSpriteNames.
Referenced by GetLabel().
|
inline |
Set whether to prefer Hyrule Magic sprite names.
Definition at line 126 of file resource_labels.h.
References prefer_hmagic_.
Referenced by yaze::zelda3::SetPreferHmagicSpriteNames().
|
inline |
Get whether Hyrule Magic names are preferred.
Definition at line 131 of file resource_labels.h.
References prefer_hmagic_.
Referenced by yaze::zelda3::PreferHmagicSpriteNames().
| absl::Status yaze::zelda3::ResourceLabelProvider::ImportFromZScreamFormat | ( | const std::string & | content | ) |
Import labels from ZScream DefaultNames.txt format.
| content | The file content to parse |
Parses sections:
Definition at line 361 of file resource_labels.cc.
References ParseZScreamLine(), and project_labels_.

| std::string yaze::zelda3::ResourceLabelProvider::ExportToZScreamFormat | ( | ) | const |
Export project labels to ZScream DefaultNames.txt format.
Definition at line 468 of file resource_labels.cc.
References GetLabel(), GetResourceCount(), yaze::zelda3::kItem, yaze::zelda3::kRoom, yaze::zelda3::kRoomTag, and yaze::zelda3::kSprite.

| absl::Status yaze::zelda3::ResourceLabelProvider::ImportOracleSpriteRegistry | ( | const std::string & | csv_content | ) |
Import sprite labels from Oracle of Secrets registry.csv format.
| csv_content | The CSV file content (name,id,paths,group,notes,allow_dupe) |
CSV format: name,id,paths,group,notes,allow_dupe Example: Sprite_Manhandla,$88,Sprites/Bosses/manhandla.asm,manhandla,,
Definition at line 510 of file resource_labels.cc.
References yaze::zelda3::name, and project_labels_.
Referenced by yaze::cli::handlers::anonymous_namespace{dungeon_commands.cc}::MaybeLoadSpriteRegistry().
| int yaze::zelda3::ResourceLabelProvider::GetResourceCount | ( | ResourceType | type | ) | const |
Get the count of resources for a given type.
Definition at line 310 of file resource_labels.cc.
References yaze::zelda3::Zelda3Labels::GetGraphicsSheetNames(), yaze::zelda3::Zelda3Labels::GetItemNames(), yaze::zelda3::Zelda3Labels::GetMusicTrackNames(), yaze::zelda3::Zelda3Labels::GetOverlordNames(), yaze::zelda3::Zelda3Labels::GetRoomEffectNames(), yaze::zelda3::Zelda3Labels::GetRoomTagNames(), yaze::zelda3::Zelda3Labels::GetTileTypeNames(), yaze::zelda3::kEntrance, yaze::zelda3::kGraphics, yaze::zelda3::kItem, yaze::zelda3::kMusic, yaze::zelda3::kOverlord, yaze::zelda3::kOverworldMap, yaze::zelda3::kRoom, yaze::zelda3::kRoomEffect, yaze::zelda3::kRoomTag, yaze::zelda3::kSprite, and yaze::zelda3::kTileType.
Referenced by ExportToZScreamFormat().
| const ResourceLabelProvider::LabelMap * yaze::zelda3::ResourceLabelProvider::GetProjectLabelsForType | ( | ResourceType | type | ) | const |
Get all project labels for a given type.
Definition at line 339 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| void yaze::zelda3::ResourceLabelProvider::ClearAllProjectLabels | ( | ) |
Clear all project labels.
Definition at line 351 of file resource_labels.cc.
References project_labels_.
|
inline |
Get all project labels (read-only)
Definition at line 188 of file resource_labels.h.
References project_labels_.
|
private |
Definition at line 401 of file resource_labels.cc.
References project_labels_.
Referenced by ImportFromZScreamFormat().
|
private |
Definition at line 192 of file resource_labels.h.
Referenced by ClearAllProjectLabels(), ClearProjectLabel(), GetAllProjectLabels(), GetLabel(), GetProjectLabelsForType(), HasProjectLabel(), ImportFromZScreamFormat(), ImportOracleSpriteRegistry(), ParseZScreamLine(), SetProjectLabel(), and SetProjectLabels().
|
private |
Definition at line 195 of file resource_labels.h.
Referenced by GetLabel(), and SetHackManifest().
|
private |
Definition at line 198 of file resource_labels.h.
Referenced by GetLabel(), PreferHMagicNames(), and SetPreferHMagicNames().