yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::CustomObjectManager Class Reference

Manages loading and caching of custom object binary files. More...

#include <custom_object.h>

Collaboration diagram for yaze::zelda3::CustomObjectManager:

Classes

struct  RuntimeContext
 
struct  State
 

Public Member Functions

void Initialize (const std::string &custom_objects_folder)
 
void SetObjectFileMap (const std::unordered_map< int, std::vector< std::string > > &map)
 
void ClearObjectFileMap ()
 
bool HasCustomFileMap () const
 
void ActivateRuntimeContext (uint64_t context_id, const State &state)
 
void ActivateStandaloneContext ()
 
void RemoveRuntimeContext (uint64_t context_id)
 
std::optional< uint64_t > active_runtime_context_id () const
 
absl::StatusOr< std::shared_ptr< CustomObject > > LoadObject (const std::string &filename)
 
absl::StatusOr< std::shared_ptr< CustomObject > > GetObjectInternal (int object_id, int subtype)
 
int GetSubtypeCount (int object_id) const
 
void ReloadAll ()
 
std::vector< std::string > GetEffectiveFileList (int object_id) const
 
const std::string & GetBasePath () const
 
uint64_t asset_generation () const
 
absl::StatusOr< CustomObjectSlotBindingResolveSlotBinding (int object_id, int subtype) const
 
std::string ResolveFilename (int object_id, int subtype) const
 
State SnapshotState () const
 
void RestoreState (const State &state)
 

Static Public Member Functions

static CustomObjectManagerGet ()
 
static int RuntimeSubtypeCountForObject (int object_id)
 
static const std::array< int, 3 > & RuntimeObjectIds ()
 
static const std::vector< std::string > & DefaultSubtypeFilenamesForObject (int object_id)
 

Private Member Functions

 CustomObjectManager ()
 
RuntimeContextActiveContext ()
 
const RuntimeContextActiveContext () const
 
uint64_t NextAssetGeneration ()
 
void InvalidateCaches ()
 
const std::vector< std::string > * ResolveFileList (int object_id) const
 

Private Attributes

RuntimeContext standalone_context_
 
std::unordered_map< uint64_t, RuntimeContextruntime_contexts_
 
std::optional< uint64_t > active_runtime_context_id_
 
uint64_t next_asset_generation_ = 1
 

Static Private Attributes

static const std::vector< std::string > kSubtype1Filenames
 
static const std::vector< std::string > kSubtype2Filenames
 
static const std::vector< std::string > kSubtype54Filenames
 

Detailed Description

Manages loading and caching of custom object binary files.

Definition at line 136 of file custom_object.h.

Constructor & Destructor Documentation

◆ CustomObjectManager()

yaze::zelda3::CustomObjectManager::CustomObjectManager ( )
private

Definition at line 529 of file custom_object.cc.

References yaze::zelda3::CustomObjectManager::RuntimeContext::asset_generation, NextAssetGeneration(), and standalone_context_.

Here is the call graph for this function:

Member Function Documentation

◆ Get()

CustomObjectManager & yaze::zelda3::CustomObjectManager::Get ( )
static

Definition at line 524 of file custom_object.cc.

Referenced by yaze::editor::ObjectTileEditorPanel::AnalyzeSourceImpactSnapshot(), yaze::editor::EditorManager::ApplyCurrentProjectRuntimeContext(), yaze::cli::resources::CommandContext::ApplyProjectRuntimeContext(), yaze::editor::ObjectTileEditorPanel::BuildSourceImpactProvenanceFingerprint(), yaze::zelda3::ObjectTileEditor::CaptureObjectLayout(), yaze::zelda3::draw_routines::CustomDraw(), yaze::editor::DungeonObjectSelector::DetachRuntimeContext(), yaze::zelda3::ObjectDrawer::DrawCustomObject(), yaze::editor::DungeonObjectSelector::DrawCustomObjectAssetBrowser(), yaze::editor::DungeonObjectSelector::DrawObjectAssetBrowser(), yaze::editor::workbench::DrawObjectSizeControls(), yaze::editor::DungeonObjectSelector::GetCustomObjectAssetStatus(), yaze::zelda3::ObjectDimensionTable::GetSelectionBounds(), yaze::editor::EditorManager::HandleSessionClosed(), yaze::editor::EditorManager::HandleSessionSwitched(), yaze::zelda3::HasActiveCustomObjectOverride(), yaze::zelda3::IsRoomObjectResizable(), yaze::zelda3::ObjectTileEditor::LoadCustomObjectLayout(), yaze::zelda3::ObjectGeometry::MeasureByObjectId(), yaze::cli::resources::CommandContext::RestoreProjectRuntimeContext(), yaze::editor::DungeonObjectSelector::SelectObject(), yaze::editor::DungeonEditorV2::SynchronizeCustomObjectAssets(), yaze::editor::DungeonObjectSelector::SynchronizeCustomObjectGeneration(), yaze::editor::TileObjectHandler::UpdateObjectsSize(), and yaze::zelda3::ObjectTileEditor::WriteBack().

◆ Initialize()

void yaze::zelda3::CustomObjectManager::Initialize ( const std::string & custom_objects_folder)

◆ SetObjectFileMap()

void yaze::zelda3::CustomObjectManager::SetObjectFileMap ( const std::unordered_map< int, std::vector< std::string > > & map)

◆ ClearObjectFileMap()

void yaze::zelda3::CustomObjectManager::ClearObjectFileMap ( )

◆ HasCustomFileMap()

bool yaze::zelda3::CustomObjectManager::HasCustomFileMap ( ) const

◆ ActivateRuntimeContext()

void yaze::zelda3::CustomObjectManager::ActivateRuntimeContext ( uint64_t context_id,
const State & state )

◆ ActivateStandaloneContext()

void yaze::zelda3::CustomObjectManager::ActivateStandaloneContext ( )

◆ RemoveRuntimeContext()

void yaze::zelda3::CustomObjectManager::RemoveRuntimeContext ( uint64_t context_id)

◆ active_runtime_context_id()

std::optional< uint64_t > yaze::zelda3::CustomObjectManager::active_runtime_context_id ( ) const
inline

Definition at line 162 of file custom_object.h.

References active_runtime_context_id_.

◆ LoadObject()

absl::StatusOr< std::shared_ptr< CustomObject > > yaze::zelda3::CustomObjectManager::LoadObject ( const std::string & filename)

Definition at line 630 of file custom_object.cc.

References ActiveContext(), yaze::zelda3::CustomObjectManager::RuntimeContext::cache, GetBasePath(), yaze::zelda3::LoadCustomObjectAsset(), and LOG_ERROR.

Referenced by GetObjectInternal().

Here is the call graph for this function:

◆ GetObjectInternal()

◆ GetSubtypeCount()

int yaze::zelda3::CustomObjectManager::GetSubtypeCount ( int object_id) const

Definition at line 667 of file custom_object.cc.

References ResolveFileList(), and RuntimeSubtypeCountForObject().

Referenced by yaze::zelda3::IsRoomObjectResizable().

Here is the call graph for this function:

◆ RuntimeSubtypeCountForObject()

◆ RuntimeObjectIds()

const std::array< int, 3 > & yaze::zelda3::CustomObjectManager::RuntimeObjectIds ( )
static

◆ ReloadAll()

void yaze::zelda3::CustomObjectManager::ReloadAll ( )

Definition at line 710 of file custom_object.cc.

References InvalidateCaches().

Here is the call graph for this function:

◆ GetEffectiveFileList()

std::vector< std::string > yaze::zelda3::CustomObjectManager::GetEffectiveFileList ( int object_id) const

Definition at line 687 of file custom_object.cc.

References ResolveFileList().

Here is the call graph for this function:

◆ DefaultSubtypeFilenamesForObject()

const std::vector< std::string > & yaze::zelda3::CustomObjectManager::DefaultSubtypeFilenamesForObject ( int object_id)
static

◆ GetBasePath()

const std::string & yaze::zelda3::CustomObjectManager::GetBasePath ( ) const

Definition at line 765 of file custom_object.cc.

References ActiveContext(), yaze::zelda3::CustomObjectManager::State::base_path, and yaze::zelda3::CustomObjectManager::RuntimeContext::state.

Referenced by Initialize(), and LoadObject().

Here is the call graph for this function:

◆ asset_generation()

◆ ResolveSlotBinding()

◆ ResolveFilename()

std::string yaze::zelda3::CustomObjectManager::ResolveFilename ( int object_id,
int subtype ) const

Definition at line 741 of file custom_object.cc.

References ResolveFileList(), ResolveSlotBinding(), and RuntimeSubtypeCountForObject().

Referenced by yaze::zelda3::ObjectTileEditor::CaptureObjectLayout().

Here is the call graph for this function:

◆ SnapshotState()

CustomObjectManager::State yaze::zelda3::CustomObjectManager::SnapshotState ( ) const

Definition at line 756 of file custom_object.cc.

References ActiveContext(), and yaze::zelda3::CustomObjectManager::RuntimeContext::state.

Referenced by yaze::cli::resources::CommandContext::ApplyProjectRuntimeContext().

Here is the call graph for this function:

◆ RestoreState()

void yaze::zelda3::CustomObjectManager::RestoreState ( const State & state)

◆ ActiveContext() [1/2]

◆ ActiveContext() [2/2]

const CustomObjectManager::RuntimeContext & yaze::zelda3::CustomObjectManager::ActiveContext ( ) const
private

◆ NextAssetGeneration()

uint64_t yaze::zelda3::CustomObjectManager::NextAssetGeneration ( )
private

◆ InvalidateCaches()

void yaze::zelda3::CustomObjectManager::InvalidateCaches ( )
private

◆ ResolveFileList()

const std::vector< std::string > * yaze::zelda3::CustomObjectManager::ResolveFileList ( int object_id) const
private

Member Data Documentation

◆ standalone_context_

RuntimeContext yaze::zelda3::CustomObjectManager::standalone_context_
private

Definition at line 225 of file custom_object.h.

Referenced by ActiveContext(), ActiveContext(), and CustomObjectManager().

◆ runtime_contexts_

std::unordered_map<uint64_t, RuntimeContext> yaze::zelda3::CustomObjectManager::runtime_contexts_
private

◆ active_runtime_context_id_

std::optional<uint64_t> yaze::zelda3::CustomObjectManager::active_runtime_context_id_
private

◆ next_asset_generation_

uint64_t yaze::zelda3::CustomObjectManager::next_asset_generation_ = 1
private

Definition at line 228 of file custom_object.h.

Referenced by NextAssetGeneration().

◆ kSubtype1Filenames

const std::vector< std::string > yaze::zelda3::CustomObjectManager::kSubtype1Filenames
staticprivate
Initial value:
= {
"track_LR.bin",
"track_UD.bin",
"track_corner_TL.bin",
"track_corner_TR.bin",
"track_corner_BL.bin",
"track_corner_BR.bin",
"track_floor_UD.bin",
"track_floor_LR.bin",
"track_floor_corner_TL.bin",
"track_floor_corner_TR.bin",
"track_floor_corner_BL.bin",
"track_floor_corner_BR.bin",
"track_floor_any.bin",
"wall_sword_house.bin",
"track_any.bin",
"small_statue.bin",
}

Definition at line 231 of file custom_object.h.

Referenced by DefaultSubtypeFilenamesForObject(), and ResolveFileList().

◆ kSubtype2Filenames

const std::vector< std::string > yaze::zelda3::CustomObjectManager::kSubtype2Filenames
staticprivate
Initial value:
= {
"furnace.bin",
"firewood.bin",
"ice_chair.bin",
}

Definition at line 233 of file custom_object.h.

Referenced by DefaultSubtypeFilenamesForObject(), and ResolveFileList().

◆ kSubtype54Filenames

const std::vector< std::string > yaze::zelda3::CustomObjectManager::kSubtype54Filenames
staticprivate
Initial value:
= {
"kydreeok_body.bin",
"manhandla_body_1a.bin",
}

Definition at line 235 of file custom_object.h.

Referenced by DefaultSubtypeFilenamesForObject(), and ResolveFileList().


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