You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Decouple container concept from IoDispatcher * Decoiuple PackageStore implementation from AsyncLoading2 * Restore ucas unmount fix that got kist when merrging from UE4 * Fix packages being left in the PackageStiore even after unmounting contaiiners #rnx #rb pj.kack, per.larsson #preflight 61520cc52afc2d0001146ce7 #ROBOMERGE-AUTHOR: carlmagnus.nordin #ROBOMERGE-SOURCE: CL 17641845 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v874-17637634) [CL 17642353 by carlmagnus nordin in ue5-release-engine-test branch]
63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "StorageServerPackageStore.h"
|
|
#include "IO/IoContainerHeader.h"
|
|
#include "IO/IoDispatcher.h"
|
|
#include "StorageServerConnection.h"
|
|
|
|
#if !UE_BUILD_SHIPPING
|
|
|
|
FStorageServerPackageStore::FStorageServerPackageStore(FStorageServerConnection& Connection)
|
|
{
|
|
FIoChunkId HeaderChunkId = CreateIoChunkId(FIoContainerId::FromName(TEXT("global")).Value(), 0, EIoChunkType::ContainerHeader);
|
|
Connection.ReadChunkRequest(HeaderChunkId, 0, uint64(-1), [this](FStorageServerResponse& ResponseStream)
|
|
{
|
|
if (ResponseStream.IsOk())
|
|
{
|
|
FIoContainerHeader ContainerHeader;
|
|
ResponseStream << ContainerHeader;
|
|
StoreEntriesData = MoveTemp(ContainerHeader.StoreEntries);
|
|
StoreEntriesMap.Reserve(ContainerHeader.PackageCount);
|
|
TArrayView<const FFilePackageStoreEntry> StoreEntries(reinterpret_cast<const FFilePackageStoreEntry*>(StoreEntriesData.GetData()), ContainerHeader.PackageCount);
|
|
int32 Index = 0;
|
|
for (const FFilePackageStoreEntry& StoreEntry : StoreEntries)
|
|
{
|
|
const FPackageId& PackageId = ContainerHeader.PackageIds[Index];
|
|
check(PackageId.IsValid());
|
|
StoreEntriesMap.FindOrAdd(PackageId, &StoreEntry);
|
|
++Index;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
bool FStorageServerPackageStore::DoesPackageExist(FPackageId PackageId)
|
|
{
|
|
return PackageId.IsValid() && StoreEntriesMap.Contains(PackageId);
|
|
}
|
|
|
|
FPackageStoreEntryHandle FStorageServerPackageStore::GetPackageEntryHandle(FPackageId PackageId, const FName& PackageName)
|
|
{
|
|
const FFilePackageStoreEntry* FindEntry = StoreEntriesMap.FindRef(PackageId);
|
|
const uint64 Handle = reinterpret_cast<uint64>(FindEntry);
|
|
return FPackageStoreEntryHandle::Create(Handle, Handle ? EPackageStoreEntryStatus::Ok : EPackageStoreEntryStatus::Missing);
|
|
}
|
|
|
|
FPackageStoreEntry FStorageServerPackageStore::GetPackageEntry(FPackageStoreEntryHandle Handle)
|
|
{
|
|
check(Handle.IsValid());
|
|
const FFilePackageStoreEntry* Entry = reinterpret_cast<const FFilePackageStoreEntry*>(Handle.Value());
|
|
check(Entry);
|
|
return FPackageStoreEntry
|
|
{
|
|
FPackageStoreExportInfo
|
|
{
|
|
Entry->ExportCount,
|
|
Entry->ExportBundleCount
|
|
},
|
|
MakeArrayView(Entry->ImportedPackages.Data(), Entry->ImportedPackages.Num()),
|
|
MakeArrayView(Entry->ShaderMapHashes.Data(), Entry->ShaderMapHashes.Num())
|
|
};
|
|
}
|
|
|
|
#endif |