Exemplo n.º 1
0
void FUdpMessageBeacon::SendSegment(EUdpMessageSegments::Type SegmentType)
{
	FUdpMessageSegment::FHeader Header;

	Header.SenderNodeId = NodeId;
	Header.ProtocolVersion = UDP_MESSAGING_TRANSPORT_PROTOCOL_VERSION;
	Header.SegmentType = SegmentType;

	FArrayWriter Writer;
	
	Writer << Header;
	Writer << NodeId;

	int32 Sent;

	Socket->Wait(ESocketWaitConditions::WaitForWrite, BeaconInterval);
	Socket->SendTo(Writer.GetData(), Writer.Num(), Sent, *MulticastAddress);
}
Exemplo n.º 2
0
void FUdpMessageProcessor::AcknowledgeReceipt( int32 MessageId, const FNodeInfo& NodeInfo )
{
	FUdpMessageSegment::FHeader Header;

	Header.RecipientNodeId = NodeInfo.NodeId;
	Header.SenderNodeId = LocalNodeId;
	Header.ProtocolVersion = UDP_MESSAGING_TRANSPORT_PROTOCOL_VERSION;
	Header.SegmentType = EUdpMessageSegments::Acknowledge;

	FUdpMessageSegment::FAcknowledgeChunk AcknowledgeChunk;

	AcknowledgeChunk.MessageId = MessageId;

	FArrayWriter Writer;

	Writer << Header;
	Writer << AcknowledgeChunk;

	int32 Sent;

	Socket->SendTo(Writer.GetData(), Writer.Num(), Sent, *NodeInfo.Endpoint.ToInternetAddr());
}
Exemplo n.º 3
0
bool FChunkManifestGenerator::SaveAssetRegistry(const FString& SandboxPath)
{
	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Saving asset registry."));

	// Create asset registry data
	FArrayWriter SerializedAssetRegistry;
	TMap<FName, FAssetData*> GeneratedAssetRegistryData;
	for (auto& AssetData : AssetRegistryData)
	{
		// Add only assets that have actually been cooked and belong to any chunk
		if (AssetData.ChunkIDs.Num() > 0)
		{
			GeneratedAssetRegistryData.Add(AssetData.ObjectPath, &AssetData);
		}
	}
	AssetRegistry.SaveRegistryData(SerializedAssetRegistry, GeneratedAssetRegistryData, GeneratedAssetRegistryData.Num());
	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Generated asset registry num assets %d, size is %5.2fkb"), GeneratedAssetRegistryData.Num(), (float)SerializedAssetRegistry.Num() / 1024.f);

	// Save the generated registry for each platform
	for (auto Platform : Platforms)
	{
		FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
		FFileHelper::SaveArrayToFile(SerializedAssetRegistry, *PlatformSandboxPath);
	}

	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Done saving asset registry."));

	return true;
}
bool FChunkManifestGenerator::SaveAssetRegistry(const FString& SandboxPath, const TArray<FName>* IgnorePackageList)
{
	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Saving asset registry."));


	TSet<FName> IgnorePackageSet;
	if (IgnorePackageList != nullptr)
	{
		for (const auto& IgnorePackage : *IgnorePackageList)
		{
			IgnorePackageSet.Add(IgnorePackage);
		}
	}
	

	// Create asset registry data
	TArray<FName> MapList;
	FArrayWriter SerializedAssetRegistry;
	SerializedAssetRegistry.SetFilterEditorOnly(true);
	TMap<FName, FAssetData*> GeneratedAssetRegistryData;
	for (auto& AssetData : AssetRegistryData)
	{
		if (IgnorePackageSet.Contains(AssetData.PackageName))
		{
			continue;
		}

		// Add only assets that have actually been cooked and belong to any chunk
		if (AssetData.ChunkIDs.Num() > 0)
		{
			GeneratedAssetRegistryData.Add(AssetData.PackageName, &AssetData);

			if (ContainsMap(AssetData.PackageName))
			{
				MapList.Add(AssetData.PackageName);
		}
	}
	}

	AssetRegistry.SaveRegistryData(SerializedAssetRegistry, GeneratedAssetRegistryData, &MapList);
	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Generated asset registry num assets %d, size is %5.2fkb"), GeneratedAssetRegistryData.Num(), (float)SerializedAssetRegistry.Num() / 1024.f);

	auto CookerFileOrderString = CreateCookerFileOrderString(GeneratedAssetRegistryData, MapList);

	// Save the generated registry for each platform
	for (auto Platform : Platforms)
	{
		FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
		FFileHelper::SaveArrayToFile(SerializedAssetRegistry, *PlatformSandboxPath);

		if (CookerFileOrderString.Len())
		{
			auto OpenOrderFilename = FString::Printf(TEXT("%sBuild/%s/FileOpenOrder/CookerOpenOrder.log"), *FPaths::GameDir(), *Platform->PlatformName());
			FFileHelper::SaveStringToFile(CookerFileOrderString, *OpenOrderFilename);
		}
	}

	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Done saving asset registry."));

	return true;
}
bool FChunkManifestGenerator::SaveAssetRegistry(const FString& SandboxPath, const TArray<FName>* IgnorePackageList)
{
    UE_LOG(LogChunkManifestGenerator, Display, TEXT("Saving asset registry."));


    TSet<FName> IgnorePackageSet;
    if (IgnorePackageList != nullptr)
    {
        for (const auto& IgnorePackage : *IgnorePackageList)
        {
            IgnorePackageSet.Add(IgnorePackage);
        }
    }


    // Create asset registry data
    FArrayWriter SerializedAssetRegistry;
    SerializedAssetRegistry.SetFilterEditorOnly(true);
    TMap<FName, FAssetData*> GeneratedAssetRegistryData;
    for (auto& AssetData : AssetRegistryData)
    {
        if (IgnorePackageSet.Contains(AssetData.PackageName))
        {
            continue;
        }

        // Add only assets that have actually been cooked and belong to any chunk
        if (AssetData.ChunkIDs.Num() > 0)
        {
            GeneratedAssetRegistryData.Add(AssetData.ObjectPath, &AssetData);
        }
    }
    AssetRegistry.SaveRegistryData(SerializedAssetRegistry, GeneratedAssetRegistryData);
    UE_LOG(LogChunkManifestGenerator, Display, TEXT("Generated asset registry num assets %d, size is %5.2fkb"), GeneratedAssetRegistryData.Num(), (float)SerializedAssetRegistry.Num() / 1024.f);

    // Save the generated registry for each platform
    for (auto Platform : Platforms)
    {
        FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
        FFileHelper::SaveArrayToFile(SerializedAssetRegistry, *PlatformSandboxPath);
    }

    UE_LOG(LogChunkManifestGenerator, Display, TEXT("Done saving asset registry."));

    return true;
}