Loads and queries the hack manifest JSON for yaze-ASM integration. More...
#include <hack_manifest.h>

Public Member Functions | |
| HackManifest ()=default | |
| absl::Status | LoadFromFile (const std::string &filepath) |
| Load manifest from a JSON file path. | |
| absl::Status | LoadFromString (const std::string &json_content) |
| Load manifest from a JSON string. | |
| bool | loaded () const |
| Check if the manifest has been loaded. | |
| void | Clear () |
| Clear any loaded manifest state. | |
| AddressOwnership | ClassifyAddress (uint32_t address) const |
| Classify a ROM address by ownership. | |
| bool | IsWriteOverwritten (uint32_t address) const |
| Check if a ROM write at this address would be overwritten by asar. | |
| bool | IsProtected (uint32_t address) const |
| Check if an address is in a protected region. | |
| std::optional< AddressOwnership > | GetBankOwnership (uint8_t bank) const |
| Get the bank ownership for a given bank number. | |
| std::string | GetRoomTagLabel (uint8_t tag_id) const |
| Get the human-readable label for a room tag ID. | |
| std::optional< RoomTagEntry > | GetRoomTag (uint8_t tag_id) const |
| Get the full room tag entry for a tag ID. | |
| const std::vector< RoomTagEntry > & | room_tags () const |
| Get all room tags. | |
| bool | IsFeatureEnabled (const std::string &flag_name) const |
| const std::vector< FeatureFlag > & | feature_flags () const |
| std::string | GetSramVariableName (uint32_t address) const |
| const std::vector< SramVariable > & | sram_variables () const |
| const MessageLayout & | message_layout () const |
| bool | IsExpandedMessage (uint16_t message_id) const |
| const std::vector< ProtectedRegion > & | protected_regions () const |
| const std::unordered_map< uint8_t, OwnedBank > & | owned_banks () const |
| std::vector< WriteConflict > | AnalyzeWriteRanges (const std::vector< std::pair< uint32_t, uint32_t > > &ranges) const |
| Analyze a set of address ranges for write conflicts. | |
| std::vector< WriteConflict > | AnalyzePcWriteRanges (const std::vector< std::pair< uint32_t, uint32_t > > &pc_ranges) const |
| Analyze a set of PC-offset ranges for write conflicts. | |
| absl::Status | LoadProjectRegistry (const std::string &code_folder) |
| Load project registry data from the code folder. | |
| const ProjectRegistry & | project_registry () const |
| bool | HasProjectRegistry () const |
| void | SetOracleProgressionState (const OracleProgressionState &state) |
| void | ClearOracleProgressionState () |
| std::optional< OracleProgressionState > | oracle_progression_state () const |
| const BuildPipeline & | build_pipeline () const |
| const std::string & | hack_name () const |
| int | manifest_version () const |
| int | total_hooks () const |
Private Member Functions | |
| void | Reset () |
Private Attributes | |
| bool | loaded_ = false |
| int | manifest_version_ = 0 |
| std::string | hack_name_ |
| int | total_hooks_ = 0 |
| std::vector< ProtectedRegion > | protected_regions_ |
| std::unordered_map< uint8_t, OwnedBank > | owned_banks_ |
| std::unordered_map< uint8_t, RoomTagEntry > | room_tag_map_ |
| std::vector< RoomTagEntry > | room_tags_ |
| std::unordered_map< std::string, FeatureFlag > | feature_flag_map_ |
| std::vector< FeatureFlag > | feature_flags_ |
| std::unordered_map< uint32_t, SramVariable > | sram_map_ |
| std::vector< SramVariable > | sram_variables_ |
| MessageLayout | message_layout_ {} |
| BuildPipeline | build_pipeline_ |
| ProjectRegistry | project_registry_ |
| std::optional< OracleProgressionState > | oracle_progression_state_ |
Loads and queries the hack manifest JSON for yaze-ASM integration.
The manifest describes which ROM addresses belong to the ASM hack layer versus the yaze editing layer. This enables yaze to:
Usage: HackManifest manifest; auto status = manifest.LoadFromFile("hack_manifest.json"); if (status.ok()) { auto ownership = manifest.ClassifyAddress(0x0085C4); // ownership == AddressOwnership::kHookPatched
auto tag_name = manifest.GetRoomTagLabel(0x39); // tag_name == "CustomTag" }
Definition at line 223 of file hack_manifest.h.
|
default |
| absl::Status yaze::core::HackManifest::LoadFromFile | ( | const std::string & | filepath | ) |
Load manifest from a JSON file path.
Definition at line 119 of file hack_manifest.cc.
References LoadFromString().
Referenced by yaze::project::YazeProject::TryLoadHackManifest().

| absl::Status yaze::core::HackManifest::LoadFromString | ( | const std::string & | json_content | ) |
Load manifest from a JSON string.
Definition at line 129 of file hack_manifest.cc.
References yaze::core::RoomTagEntry::address, yaze::core::SramVariable::address, yaze::core::BuildPipeline::assembler, ASSIGN_OR_RETURN, yaze::core::OwnedBank::bank, yaze::core::OwnedBank::bank_end, yaze::core::OwnedBank::bank_start, build_pipeline_, yaze::core::BuildPipeline::build_script, yaze::Json::contains(), yaze::core::MessageLayout::data_end, yaze::core::MessageLayout::data_start, yaze::core::BuildPipeline::dev_rom, yaze::core::RoomTagEntry::enabled, yaze::core::FeatureFlag::enabled, yaze::core::ProtectedRegion::end, yaze::core::BuildPipeline::entry_point, yaze::core::MessageLayout::expanded_count, yaze::core::RoomTagEntry::feature_flag, feature_flag_map_, feature_flags_, yaze::core::MessageLayout::first_expanded_id, hack_name_, yaze::core::MessageLayout::hook_address, yaze::core::ProtectedRegion::hook_count, yaze::core::MessageLayout::last_expanded_id, loaded_, manifest_version_, message_layout_, yaze::core::RoomTagEntry::name, yaze::core::FeatureFlag::name, yaze::core::SramVariable::name, owned_banks_, yaze::core::OwnedBank::ownership, yaze::core::OwnedBank::ownership_note, yaze::Json::parse(), yaze::core::BuildPipeline::patched_rom, protected_regions_, yaze::core::RoomTagEntry::purpose, yaze::core::SramVariable::purpose, Reset(), room_tag_map_, room_tags_, yaze::core::RoomTagEntry::source, yaze::core::FeatureFlag::source, sram_map_, sram_variables_, yaze::core::ProtectedRegion::start, yaze::core::RoomTagEntry::tag_id, total_hooks_, yaze::core::FeatureFlag::value, yaze::Json::value(), and yaze::core::MessageLayout::vanilla_count.
Referenced by LoadFromFile().

|
inline |
Check if the manifest has been loaded.
Definition at line 240 of file hack_manifest.h.
References loaded_.
Referenced by yaze::editor::RomLifecycleManager::CheckOracleRomSafetyPreSave(), yaze::editor::ManifestPanel::DrawManifestStatus(), yaze::editor::SettingsPanel::DrawProjectSettings(), yaze::editor::ManifestPanel::DrawProtectedRegions(), yaze::editor::RoomTagEditorPanel::DrawQuickAssign(), yaze::editor::RoomTagEditorPanel::DrawTagTable(), yaze::zelda3::ResourceLabelProvider::GetLabel(), yaze::project::YazeProject::InitializeResourceLabelProvider(), yaze::editor::SramViewerPanel::LoadVariablesFromManifest(), yaze::editor::ProgressionDashboardPanel::PushStateToManifestIfNeeded(), yaze::editor::FeatureFlagEditorPanel::RefreshFromManifest(), yaze::editor::EditorManager::RefreshResourceLabelProvider(), yaze::editor::MessageEditor::ResolveExpandedMessageBaseId(), yaze::editor::OverworldEditor::Save(), yaze::editor::EditorManager::SaveRom(), yaze::editor::DungeonEditorV2::SaveRoomData(), and yaze::project::YazeProject::TryLoadHackManifest().
|
inline |
Clear any loaded manifest state.
This is primarily used when switching projects to ensure we never keep a stale manifest across loads.
Definition at line 248 of file hack_manifest.h.
References Reset().
Referenced by yaze::project::YazeProject::TryLoadHackManifest().

| AddressOwnership yaze::core::HackManifest::ClassifyAddress | ( | uint32_t | address | ) | const |
Classify a ROM address by ownership.
Checks in order:
Definition at line 292 of file hack_manifest.cc.
References IsProtected(), yaze::core::kHookPatched, yaze::core::kVanillaSafe, loaded_, and owned_banks_.
Referenced by IsWriteOverwritten().

| bool yaze::core::HackManifest::IsWriteOverwritten | ( | uint32_t | address | ) | const |
Check if a ROM write at this address would be overwritten by asar.
Returns true for hook_patched, asm_owned, and asm_expansion addresses. For shared addresses, returns false (yaze can write, but must rebuild).
Definition at line 313 of file hack_manifest.cc.
References ClassifyAddress(), yaze::core::kAsmExpansion, yaze::core::kAsmOwned, and yaze::core::kHookPatched.

| bool yaze::core::HackManifest::IsProtected | ( | uint32_t | address | ) | const |
Check if an address is in a protected region.
Definition at line 320 of file hack_manifest.cc.
References protected_regions_.
Referenced by ClassifyAddress().
| std::optional< AddressOwnership > yaze::core::HackManifest::GetBankOwnership | ( | uint8_t | bank | ) | const |
Get the bank ownership for a given bank number.
Definition at line 339 of file hack_manifest.cc.
References owned_banks_.
| std::string yaze::core::HackManifest::GetRoomTagLabel | ( | uint8_t | tag_id | ) | const |
Get the human-readable label for a room tag ID.
Definition at line 350 of file hack_manifest.cc.
References room_tag_map_.
Referenced by yaze::zelda3::ResourceLabelProvider::GetLabel().
| std::optional< RoomTagEntry > yaze::core::HackManifest::GetRoomTag | ( | uint8_t | tag_id | ) | const |
Get the full room tag entry for a tag ID.
Definition at line 357 of file hack_manifest.cc.
References room_tag_map_.
Referenced by yaze::editor::RoomTagEditorPanel::DrawQuickAssign(), and yaze::editor::RoomTagEditorPanel::DrawTagTable().
|
inline |
Get all room tags.
Definition at line 296 of file hack_manifest.h.
References room_tags_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings().
| bool yaze::core::HackManifest::IsFeatureEnabled | ( | const std::string & | flag_name | ) | const |
Definition at line 364 of file hack_manifest.cc.
References feature_flag_map_.
|
inline |
Definition at line 304 of file hack_manifest.h.
References feature_flags_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings(), and yaze::editor::FeatureFlagEditorPanel::RefreshFromManifest().
| std::string yaze::core::HackManifest::GetSramVariableName | ( | uint32_t | address | ) | const |
Definition at line 473 of file hack_manifest.cc.
References sram_map_.
|
inline |
Definition at line 312 of file hack_manifest.h.
References sram_variables_.
Referenced by yaze::editor::SramViewerPanel::LoadVariablesFromManifest().
|
inline |
Definition at line 318 of file hack_manifest.h.
References message_layout_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings(), and yaze::editor::MessageEditor::ResolveExpandedMessageBaseId().
| bool yaze::core::HackManifest::IsExpandedMessage | ( | uint16_t | message_id | ) | const |
Definition at line 480 of file hack_manifest.cc.
References yaze::core::MessageLayout::first_expanded_id, yaze::core::MessageLayout::last_expanded_id, and message_layout_.
|
inline |
Definition at line 326 of file hack_manifest.h.
References protected_regions_.
Referenced by yaze::editor::ManifestPanel::DrawProtectedRegions().
|
inline |
Definition at line 330 of file hack_manifest.h.
References owned_banks_.
| std::vector< WriteConflict > yaze::core::HackManifest::AnalyzeWriteRanges | ( | const std::vector< std::pair< uint32_t, uint32_t > > & | ranges | ) | const |
Analyze a set of address ranges for write conflicts.
For each range [start, end), checks if any addresses are owned by the ASM layer. Returns one WriteConflict per conflicting region (not per byte). Useful for pre-save diagnostics in the dungeon/overworld editors.
Definition at line 371 of file hack_manifest.cc.
References yaze::core::WriteConflict::address, yaze::core::kHookPatched, loaded_, owned_banks_, yaze::core::WriteConflict::ownership, and protected_regions_.
Referenced by AnalyzePcWriteRanges().
| std::vector< WriteConflict > yaze::core::HackManifest::AnalyzePcWriteRanges | ( | const std::vector< std::pair< uint32_t, uint32_t > > & | pc_ranges | ) | const |
Analyze a set of PC-offset ranges for write conflicts.
Editors typically operate on raw ROM offsets (PC). The hack manifest uses SNES addresses (LoROM) as emitted by org $XXXXXX in ASM.
This helper converts PC ranges to SNES ranges (splitting at LoROM bank boundaries) and then runs the same conflict analysis.
Definition at line 441 of file hack_manifest.cc.
References AnalyzeWriteRanges(), loaded_, and yaze::PcToSnes().
Referenced by yaze::editor::EditorManager::SaveRom().

| absl::Status yaze::core::HackManifest::LoadProjectRegistry | ( | const std::string & | code_folder | ) |
Load project registry data from the code folder.
Loads dungeons.json, overworld.json, and resource labels from oracle_resource_labels.json (unified) or oracle_room_labels.json (legacy).
Definition at line 489 of file hack_manifest.cc.
References yaze::core::ProjectRegistry::all_resource_labels, yaze::core::OverworldArea::area_id, yaze::core::StoryEventGraph::AutoLayout(), yaze::core::DungeonRoom::blockset, yaze::Json::contains(), yaze::core::DungeonConnection::direction, yaze::core::DungeonEntry::doors, yaze::core::ProjectRegistry::dungeons, yaze::core::StoryEventGraph::edges(), yaze::core::DungeonConnection::from_room, yaze::core::DungeonRoom::grid_col, yaze::core::OverworldArea::grid_col, yaze::core::DungeonRoom::grid_row, yaze::core::OverworldArea::grid_row, yaze::core::DungeonEntry::holewarps, yaze::core::DungeonRoom::id, yaze::core::DungeonEntry::id, yaze::Json::is_array(), yaze::Json::is_object(), yaze::Json::items(), yaze::core::DungeonConnection::label, yaze::core::StoryEventGraph::LoadFromJson(), LOG_DEBUG, LOG_WARN, yaze::core::DungeonRoom::name, yaze::core::DungeonEntry::name, yaze::core::OverworldArea::name, yaze::core::StoryEventGraph::nodes(), oracle_progression_state_, yaze::core::ProjectRegistry::overworld_areas, yaze::core::DungeonRoom::palette, yaze::Json::parse(), project_registry_, yaze::core::DungeonEntry::rooms, yaze::core::DungeonRoom::spriteset, yaze::core::DungeonEntry::stairs, yaze::core::ProjectRegistry::story_events, yaze::core::DungeonRoom::tag1, yaze::core::DungeonRoom::tag2, yaze::core::DungeonConnection::to_room, yaze::core::DungeonRoom::type, yaze::core::StoryEventGraph::UpdateStatus(), yaze::core::DungeonEntry::vanilla_name, and yaze::core::OverworldArea::world.
Referenced by yaze::project::YazeProject::TryLoadHackManifest().
|
inline |
Definition at line 369 of file hack_manifest.h.
References project_registry_.
Referenced by yaze::editor::StoryEventGraphPanel::Draw(), yaze::editor::DungeonMapPanel::DrawRegistrySelector(), yaze::editor::EditorManager::RefreshResourceLabelProvider(), and yaze::project::YazeProject::TryLoadHackManifest().
|
inline |
Definition at line 373 of file hack_manifest.h.
References yaze::core::ProjectRegistry::all_resource_labels, yaze::core::ProjectRegistry::dungeons, yaze::core::StoryEventGraph::loaded(), project_registry_, and yaze::core::ProjectRegistry::story_events.
Referenced by yaze::editor::RomLifecycleManager::CheckOracleRomSafetyPreSave(), yaze::editor::StoryEventGraphPanel::Draw(), yaze::editor::DungeonMapPanel::DrawDungeonSelector(), yaze::editor::EditorManager::RefreshResourceLabelProvider(), and yaze::project::YazeProject::TryLoadHackManifest().

| void yaze::core::HackManifest::SetOracleProgressionState | ( | const OracleProgressionState & | state | ) |
Definition at line 766 of file hack_manifest.cc.
References yaze::core::StoryEventGraph::loaded(), oracle_progression_state_, project_registry_, yaze::core::ProjectRegistry::story_events, and yaze::core::StoryEventGraph::UpdateStatus().
Referenced by yaze::editor::StoryEventGraphPanel::ImportOracleSramFromFileDialog(), yaze::editor::ProgressionDashboardPanel::PushStateToManifestIfNeeded(), and yaze::editor::StoryEventGraphPanel::RefreshStateFromLiveSram().

| void yaze::core::HackManifest::ClearOracleProgressionState | ( | ) |
Definition at line 773 of file hack_manifest.cc.
References yaze::core::StoryEventGraph::loaded(), oracle_progression_state_, project_registry_, yaze::core::ProjectRegistry::story_events, and yaze::core::StoryEventGraph::UpdateStatus().
Referenced by yaze::editor::StoryEventGraphPanel::ClearOracleSramState(), and yaze::editor::ProgressionDashboardPanel::DrawSrmImportControls().

|
inline |
Definition at line 389 of file hack_manifest.h.
References oracle_progression_state_.
Referenced by yaze::editor::StoryEventGraphPanel::ComputeProgressionFingerprint(), yaze::editor::StoryEventGraphPanel::Draw(), and yaze::editor::ProgressionDashboardPanel::PushStateToManifestIfNeeded().
|
inline |
Definition at line 396 of file hack_manifest.h.
References build_pipeline_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings().
|
inline |
Definition at line 402 of file hack_manifest.h.
References hack_name_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings().
|
inline |
Definition at line 403 of file hack_manifest.h.
References manifest_version_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings().
|
inline |
Definition at line 404 of file hack_manifest.h.
References total_hooks_.
Referenced by yaze::editor::SettingsPanel::DrawProjectSettings().
|
private |
Definition at line 100 of file hack_manifest.cc.
References build_pipeline_, feature_flag_map_, feature_flags_, hack_name_, loaded_, manifest_version_, message_layout_, oracle_progression_state_, owned_banks_, project_registry_, protected_regions_, room_tag_map_, room_tags_, sram_map_, sram_variables_, and total_hooks_.
Referenced by Clear(), and LoadFromString().
|
private |
Definition at line 409 of file hack_manifest.h.
Referenced by AnalyzePcWriteRanges(), AnalyzeWriteRanges(), ClassifyAddress(), loaded(), LoadFromString(), and Reset().
|
private |
Definition at line 410 of file hack_manifest.h.
Referenced by LoadFromString(), manifest_version(), and Reset().
|
private |
Definition at line 411 of file hack_manifest.h.
Referenced by hack_name(), LoadFromString(), and Reset().
|
private |
Definition at line 412 of file hack_manifest.h.
Referenced by LoadFromString(), Reset(), and total_hooks().
|
private |
Definition at line 415 of file hack_manifest.h.
Referenced by AnalyzeWriteRanges(), IsProtected(), LoadFromString(), protected_regions(), and Reset().
|
private |
Definition at line 418 of file hack_manifest.h.
Referenced by AnalyzeWriteRanges(), ClassifyAddress(), GetBankOwnership(), LoadFromString(), owned_banks(), and Reset().
|
private |
Definition at line 421 of file hack_manifest.h.
Referenced by GetRoomTag(), GetRoomTagLabel(), LoadFromString(), and Reset().
|
private |
Definition at line 422 of file hack_manifest.h.
Referenced by LoadFromString(), Reset(), and room_tags().
|
private |
Definition at line 425 of file hack_manifest.h.
Referenced by IsFeatureEnabled(), LoadFromString(), and Reset().
|
private |
Definition at line 426 of file hack_manifest.h.
Referenced by feature_flags(), LoadFromString(), and Reset().
|
private |
Definition at line 429 of file hack_manifest.h.
Referenced by GetSramVariableName(), LoadFromString(), and Reset().
|
private |
Definition at line 430 of file hack_manifest.h.
Referenced by LoadFromString(), Reset(), and sram_variables().
|
private |
Definition at line 433 of file hack_manifest.h.
Referenced by IsExpandedMessage(), LoadFromString(), message_layout(), and Reset().
|
private |
Definition at line 436 of file hack_manifest.h.
Referenced by build_pipeline(), LoadFromString(), and Reset().
|
private |
Definition at line 439 of file hack_manifest.h.
Referenced by ClearOracleProgressionState(), HasProjectRegistry(), LoadProjectRegistry(), project_registry(), Reset(), and SetOracleProgressionState().
|
private |
Definition at line 443 of file hack_manifest.h.
Referenced by ClearOracleProgressionState(), LoadProjectRegistry(), oracle_progression_state(), Reset(), and SetOracleProgressionState().