MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ReloadSilent

Method ReloadSilent

Source/Engine/Content/Storage/FlaxStorage.cpp:635–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

633}
634
635bool FlaxStorage::ReloadSilent()
636{
637 ScopeLock lock(_loadLocker);
638 if (!IsLoaded())
639 return false;
640
641 // Open file
642 auto stream = OpenFile();
643 if (stream == nullptr)
644 return true;
645
646 // Magic Code
647 uint32 magicCode;
648 stream->ReadUint32(&magicCode);
649 if (magicCode != MagicCode)
650 {
651 LOG(Warning, "Invalid asset magic code in {0}", ToString());
652 return true;
653 }
654
655 // Version
656 uint32 version;
657 stream->ReadUint32(&version);
658 if (version == 9)
659 {
660 _version = version;
661
662 // Custom storage data
663 CustomData customData;
664 stream->Read(customData);
665
666 // Entries
667 int32 assetsCount;
668 stream->ReadInt32(&assetsCount);
669 if (assetsCount != GetEntriesCount())
670 {
671 LOG(Warning, "Incorrect amount of assets ({} instead of {}) saved in {}", assetsCount, GetEntriesCount(), ToString());
672 return true;
673 }
674 for (int32 i = 0; i < assetsCount; i++)
675 {
676 SerializedEntryV9 se;
677 stream->ReadBytes(&se, sizeof(se));
678 Entry e(se.ID, se.TypeName.Data, se.Address);
679 SetEntry(i, e);
680 }
681
682 // TODO: load chunks metadata? compare against loaded chunks?
683 }
684 else
685 {
686 // Fallback to full reload
687 LOG(Warning, "Fallback to full reload of {0}", ToString());
688 Reload();
689 }
690
691 return false;
692}

Callers 1

CreateMethod · 0.80

Calls 6

OpenFileFunction · 0.85
IsLoadedFunction · 0.70
ToStringFunction · 0.50
ReadMethod · 0.45
ReadInt32Method · 0.45
ReadBytesMethod · 0.45

Tested by

no test coverage detected