Add initial support for Deploying Windows games to the SteamDeck through .ini entries

#jira UE-145123
[REVIEW] [at]Josh.Adams
#rb Josh.Adams, David.Harvey
#preflight 6230b118f33750e39249d834

#ROBOMERGE-OWNER: brandon.schaefer
#ROBOMERGE-AUTHOR: brandon.schaefer
#ROBOMERGE-SOURCE: CL 19389680 in //UE5/Release-5.0/... via CL 19391874
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19402230 by brandon schaefer in ue5-main branch]
This commit is contained in:
brandon schaefer
2022-03-16 03:01:51 -04:00
parent 54d6a6e6ca
commit 5141cd3106
3 changed files with 292 additions and 0 deletions
@@ -9,6 +9,7 @@
#include "LocalPcTargetDevice.h"
#endif
#include "Serialization/MemoryLayout.h"
#include "SteamDeckDevice.h"
#if WITH_ENGINE
#include "Sound/SoundWave.h"
@@ -45,6 +46,9 @@ public:
#if PLATFORM_WINDOWS
// only add local device if actually running on Windows
LocalDevice = MakeShareable(new TTargetDevice(*this));
// Check if we have any SteamDeck devices around
SteamDevices = FSteamDeckDevice::DiscoverDevices(*this);
#endif
#if WITH_ENGINE
@@ -91,6 +95,7 @@ public:
bRequiresEncodedHDRReflectionCaptures = TargetedShaderFormats.Contains(NAME_SF_VULKAN_ES31)
|| TargetedShaderFormats.Contains(NAME_OPENGL_150_ES3_1)
|| TargetedShaderFormats.Contains(NAME_PCD3D_ES3_1);
#endif
}
@@ -107,6 +112,14 @@ public:
{
OutDevices.Add(LocalDevice);
}
for (const ITargetDevicePtr& SteamDeck : SteamDevices)
{
if (SteamDeck.IsValid())
{
OutDevices.Add(SteamDeck);
}
}
}
virtual bool GenerateStreamingInstallManifest(const TMultiMap<FString, int32>& PakchunkMap, const TSet<int32>& PakchunkIndicesInUse) const override
@@ -131,6 +144,14 @@ public:
return LocalDevice;
}
for (const ITargetDevicePtr& SteamDeck : SteamDevices)
{
if (SteamDeck.IsValid() && DeviceId == SteamDeck->GetId())
{
return SteamDeck;
}
}
return nullptr;
}
@@ -362,6 +383,8 @@ private:
// Holds the local device.
ITargetDevicePtr LocalDevice;
TArray<ITargetDevicePtr> SteamDevices;
#if WITH_ENGINE
// Holds the texture LOD settings.
const UTextureLODSettings* TextureLODSettings;
@@ -0,0 +1,90 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Common/TargetPlatformBase.h"
#include "Misc/ConfigCacheIni.h"
#if PLATFORM_WINDOWS
#include "LocalPcTargetDevice.h"
#endif
#include "Serialization/MemoryLayout.h"
// Extend SteamDevice from LocalPcDevice as we are leveraging the Windows Device for Steam Deck when building
// for the Win64 platform. As SteamDeck consumes the exact same build it would for a normal Win64 device
#if PLATFORM_WINDOWS
class FSteamDeckDevice : public TLocalPcTargetDevice<true>
{
public:
FSteamDeckDevice(FString InIpAddr, FString InDeviceName, FString InUserName, const ITargetPlatform& InTargetPlatform)
: TLocalPcTargetDevice<true>(InTargetPlatform)
, IpAddr(InIpAddr)
, DeviceName(InDeviceName)
, UserName(InUserName)
{
}
virtual FString GetName() const override
{
return DeviceName;
}
virtual FTargetDeviceId GetId() const override
{
return FTargetDeviceId(TargetPlatform.PlatformName(), IpAddr);
}
virtual FString GetOperatingSystemName() override
{
return TEXT("SteamOS");
}
virtual bool GetUserCredentials(FString& OutUserName, FString& OutUserPassword) override
{
OutUserName = UserName;
// No need for a password, as it will use an rsa key that is part of the SteamOS Devkit Client
OutUserPassword = FString();
return true;
}
static TArray<ITargetDevicePtr> DiscoverDevices(const ITargetPlatform& GenericWindowsTP)
{
TArray<FString> EngineIniSteamDeckDevices;
// Expected ini format: +SteamDeckDevice=(IpAddr=10.1.33.19,Name=MySteamDeck,UserName=deck)
GConfig->GetArray(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("SteamDeckDevice"), EngineIniSteamDeckDevices, GEngineIni);
TArray<ITargetDevicePtr> SteamDevices;
for (const FString& Device : EngineIniSteamDeckDevices)
{
FString IpAddr;
FString Name;
FString UserName;
if (!FParse::Value(*Device, TEXT("IpAddr="), IpAddr))
{
continue;
}
// Name is not required, if not set use the IpAddr. This is what is displayed in the Editor
if (!FParse::Value(*Device, TEXT("Name="), Name))
{
Name = IpAddr;
}
if (!FParse::Value(*Device, TEXT("UserName="), UserName))
{
continue;
}
SteamDevices.Add(MakeShareable(new FSteamDeckDevice(IpAddr, Name, UserName, GenericWindowsTP)));
}
return SteamDevices;
}
private:
FString IpAddr;
FString DeviceName;
FString UserName;
};
#endif // PLATFORM_WINDOWS