Integrating latest from github/staging
Integrating up through commit 5e1bdae
This commit is contained in:
@@ -67,8 +67,12 @@ if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
|
||||
|
||||
endif()
|
||||
|
||||
foreach(project ${LY_PROJECTS_NAME})
|
||||
|
||||
get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME)
|
||||
foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJECTS)
|
||||
# Computes the realpath to the project
|
||||
# If the project_path is relative, it is evaluated relative to the ${LY_ROOT_FOLDER}
|
||||
# Otherwise the the absolute project_path is returned with symlinks resolved
|
||||
file(REAL_PATH ${project_path} project_real_path BASE_DIRECTORY ${LY_ROOT_FOLDER})
|
||||
################################################################################
|
||||
# Monolithic game
|
||||
################################################################################
|
||||
@@ -77,7 +81,7 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
# In the monolithic case, we need to register the gem modules, to do so we will generate a StaticModules.inl
|
||||
# file from StaticModules.in
|
||||
|
||||
get_property(game_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project}.GameLauncher)
|
||||
get_property(game_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project_name}.GameLauncher)
|
||||
|
||||
unset(extern_module_declarations)
|
||||
unset(module_invocations)
|
||||
@@ -96,7 +100,7 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
endforeach()
|
||||
|
||||
configure_file(StaticModules.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project}.GameLauncher/Includes/StaticModules.inl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project_name}.GameLauncher/Includes/StaticModules.inl
|
||||
)
|
||||
|
||||
set(game_build_dependencies
|
||||
@@ -107,7 +111,7 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
)
|
||||
|
||||
if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
|
||||
get_property(server_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project}.ServerLauncher)
|
||||
get_property(server_gem_dependencies GLOBAL PROPERTY LY_DELAYED_DEPENDENCIES_${project_name}.ServerLauncher)
|
||||
|
||||
unset(extern_module_declarations)
|
||||
unset(module_invocations)
|
||||
@@ -126,7 +130,7 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
endforeach()
|
||||
|
||||
configure_file(StaticModules.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project}.ServerLauncher/Includes/StaticModules.inl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project_name}.ServerLauncher/Includes/StaticModules.inl
|
||||
)
|
||||
|
||||
set(server_build_dependencies
|
||||
@@ -156,7 +160,7 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
# Game
|
||||
################################################################################
|
||||
ly_add_target(
|
||||
NAME ${project}.GameLauncher ${PAL_TRAIT_LAUNCHERUNIFIED_LAUNCHER_TYPE}
|
||||
NAME ${project_name}.GameLauncher ${PAL_TRAIT_LAUNCHERUNIFIED_LAUNCHER_TYPE}
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
launcher_project_files.cmake
|
||||
@@ -165,15 +169,18 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
COMPILE_DEFINITIONS
|
||||
PRIVATE
|
||||
# Adds the name of the project/game
|
||||
LY_GAME_PROJECT_NAME="${project}"
|
||||
# Adds the ${project}_GameLauncher target as a define so for the Settings Registry to use
|
||||
LY_PROJECT_NAME="${project_name}"
|
||||
# Adds the project path supplied to CMake during configuration
|
||||
# This is used as a fallback to launch the AssetProcessor
|
||||
LY_PROJECT_CMAKE_PATH="${project_path}"
|
||||
# Adds the ${project_name}_GameLauncher target as a define so for the Settings Registry to use
|
||||
# when loading .setreg file specializations
|
||||
# This is needed so that only gems for the project game launcher are loaded
|
||||
LY_CMAKE_TARGET="${project}_GameLauncher"
|
||||
LY_CMAKE_TARGET="${project_name}_GameLauncher"
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project}.GameLauncher/Includes # required for StaticModules.inl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project_name}.GameLauncher/Includes # required for StaticModules.inl
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::Launcher.Static
|
||||
@@ -183,9 +190,9 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
${game_runtime_dependencies}
|
||||
)
|
||||
# Needs to be set manually after ly_add_target to prevent the default location overriding it
|
||||
set_target_properties(${project}.GameLauncher
|
||||
set_target_properties(${project_name}.GameLauncher
|
||||
PROPERTIES
|
||||
FOLDER ${project}
|
||||
FOLDER ${project_name}
|
||||
)
|
||||
|
||||
################################################################################
|
||||
@@ -194,10 +201,10 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
|
||||
|
||||
get_property(server_projects GLOBAL PROPERTY LY_LAUNCHER_SERVER_PROJECTS)
|
||||
if(${project} IN_LIST server_projects)
|
||||
if(${project_name} IN_LIST server_projects)
|
||||
|
||||
ly_add_target(
|
||||
NAME ${project}.ServerLauncher APPLICATION
|
||||
NAME ${project_name}.ServerLauncher APPLICATION
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
launcher_project_files.cmake
|
||||
@@ -206,15 +213,18 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
COMPILE_DEFINITIONS
|
||||
PRIVATE
|
||||
# Adds the name of the project/game
|
||||
LY_GAME_PROJECT_NAME="${project}"
|
||||
# Adds the ${project}_ServerLauncher target as a define so for the Settings Registry to use
|
||||
LY_PROJECT_NAME="${project_name}"
|
||||
# Adds the project path supplied to CMake during configuration
|
||||
# This is used as a fallback to launch the AssetProcessor
|
||||
LY_PROJECT_CMAKE_PATH="${project_path}"
|
||||
# Adds the ${project_name}_ServerLauncher target as a define so for the Settings Registry to use
|
||||
# when loading .setreg file specializations
|
||||
# This is needed so that only gems for the project server launcher are loaded
|
||||
LY_CMAKE_TARGET="${project}_ServerLauncher"
|
||||
LY_CMAKE_TARGET="${project_name}_ServerLauncher"
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project}.ServerLauncher/Includes # required for StaticModules.inl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${project_name}.ServerLauncher/Includes # required for StaticModules.inl
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::Launcher.Static
|
||||
@@ -224,9 +234,9 @@ foreach(project ${LY_PROJECTS_NAME})
|
||||
${server_runtime_dependencies}
|
||||
)
|
||||
# Needs to be set manually after ly_add_target to prevent the default location overriding it
|
||||
set_target_properties(${project}.ServerLauncher
|
||||
set_target_properties(${project_name}.ServerLauncher
|
||||
PROPERTIES
|
||||
FOLDER ${project}
|
||||
FOLDER ${project_name}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
#include <CryLibrary.h>
|
||||
#include <IConsole.h>
|
||||
#include <ISystem.h>
|
||||
#include <ITimer.h>
|
||||
#include <LegacyAllocator.h>
|
||||
#include <ParseEngineConfig.h>
|
||||
|
||||
#include <Launcher_Traits_Platform.h>
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace
|
||||
|
||||
// argument is strictly to match the API of AZ::DynamicModuleHandle
|
||||
bool Load(bool unused)
|
||||
{
|
||||
{
|
||||
AZ_UNUSED(unused);
|
||||
|
||||
if (IsLoaded())
|
||||
@@ -90,14 +90,14 @@ namespace
|
||||
return CryFreeLibrary(m_moduleHandle);
|
||||
}
|
||||
|
||||
bool IsLoaded() const
|
||||
{
|
||||
return m_moduleHandle != nullptr;
|
||||
bool IsLoaded() const
|
||||
{
|
||||
return m_moduleHandle != nullptr;
|
||||
}
|
||||
|
||||
const AZ::OSString& GetFilename() const
|
||||
{
|
||||
return m_fileName;
|
||||
const AZ::OSString& GetFilename() const
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
template<typename Function>
|
||||
@@ -119,7 +119,7 @@ namespace
|
||||
: m_fileName()
|
||||
, m_moduleHandle(nullptr)
|
||||
{
|
||||
m_fileName = AZ::OSString::format("%s%s%s",
|
||||
m_fileName = AZ::OSString::format("%s%s%s",
|
||||
CrySharedLibraryPrefix, fileFullName, CrySharedLibraryExtension);
|
||||
}
|
||||
|
||||
@@ -296,9 +296,6 @@ namespace LumberyardLauncher
|
||||
case ReturnCode::Success:
|
||||
return "Success";
|
||||
|
||||
case ReturnCode::ErrBootstrapMismatch:
|
||||
return "Mismatch detected between Launcher compiler defines and bootstrap values (LY_GAMEFOLDER/sys_game_folder).";
|
||||
|
||||
case ReturnCode::ErrCommandLine:
|
||||
return "Failed to copy command line arguments";
|
||||
|
||||
@@ -326,99 +323,6 @@ namespace LumberyardLauncher
|
||||
}
|
||||
}
|
||||
|
||||
void CopySettingsRegistryToCrySystemInitParams(const AZ::SettingsRegistryInterface& registry, SSystemInitParams& params)
|
||||
{
|
||||
constexpr AZStd::string_view DefaultRemoteIp = "127.0.0.1";
|
||||
constexpr uint16_t DefaultRemotePort = 45643U;
|
||||
|
||||
AZ::SettingsRegistryInterface::FixedValueString settingsKeyPrefix = AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey;
|
||||
AZ::SettingsRegistryInterface::FixedValueString settingsValueString;
|
||||
AZ::s64 settingsValueInt{};
|
||||
|
||||
// remote filesystem
|
||||
if (registry.Get(settingsValueInt, settingsKeyPrefix + "/remote_filesystem"))
|
||||
{
|
||||
params.remoteFileIO = settingsValueInt != 0;
|
||||
}
|
||||
// remote port
|
||||
if(registry.Get(settingsValueInt, settingsKeyPrefix + "/remote_port"))
|
||||
{
|
||||
params.remotePort = aznumeric_cast<int>(settingsValueInt);
|
||||
}
|
||||
else
|
||||
{
|
||||
params.remotePort = DefaultRemotePort;
|
||||
}
|
||||
|
||||
// remote ip
|
||||
if (registry.Get(settingsValueString, settingsKeyPrefix + "/remote_ip"))
|
||||
{
|
||||
azstrncpy(AZStd::data(params.remoteIP), AZStd::size(params.remoteIP), settingsValueString.c_str(), settingsValueString.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
azstrncpy(AZStd::data(params.remoteIP), AZStd::size(params.remoteIP), DefaultRemoteIp.data(), DefaultRemoteIp.size());
|
||||
}
|
||||
|
||||
// connect_to_remote - also supports <platform>_connect_to_remote override
|
||||
if (registry.Get(settingsValueInt, settingsKeyPrefix + "/" AZ_TRAIT_OS_PLATFORM_CODENAME_LOWER "_connect_to_remote")
|
||||
|| registry.Get(settingsValueInt, settingsKeyPrefix + "/connect_to_remote"))
|
||||
{
|
||||
params.connectToRemote = settingsValueInt != 0;
|
||||
}
|
||||
#if !defined(DEDICATED_SERVER)
|
||||
// wait_for_connect - also supports <platform>_wait_for_connect override
|
||||
// Dedicated server does not depend on Asset Processor and assumes that assets are already prepared.
|
||||
if (registry.Get(settingsValueInt, settingsKeyPrefix + "/" AZ_TRAIT_OS_PLATFORM_CODENAME_LOWER "_wait_for_connect")
|
||||
|| registry.Get(settingsValueInt, settingsKeyPrefix + "/wait_for_connect"))
|
||||
{
|
||||
params.waitForConnection = settingsValueInt != 0;
|
||||
}
|
||||
#endif // defined(DEDICATED_SERVER)
|
||||
|
||||
// assets - also supports <platform>_assets override
|
||||
settingsValueString.clear();
|
||||
if (registry.Get(settingsValueString, settingsKeyPrefix + "/" AZ_TRAIT_OS_PLATFORM_CODENAME_LOWER "_assets")
|
||||
|| registry.Get(settingsValueString, settingsKeyPrefix + "/assets"))
|
||||
{
|
||||
azstrncpy(AZStd::data(params.assetsPlatform), AZStd::size(params.assetsPlatform), settingsValueString.c_str(), settingsValueString.size());
|
||||
}
|
||||
|
||||
// Project name - First tries sys_game_folder
|
||||
settingsValueString.clear();
|
||||
if (registry.Get(settingsValueString, settingsKeyPrefix + "/sys_game_folder"))
|
||||
{
|
||||
// sys_game_folder is the current way to do it
|
||||
azstrncpy(AZStd::data(params.gameFolderName), AZStd::size(params.gameFolderName), settingsValueString.c_str(), settingsValueString.size());
|
||||
}
|
||||
|
||||
// assetProcessor_branch_token
|
||||
if (registry.Get(settingsValueInt, settingsKeyPrefix + "/assetProcessor_branch_token"))
|
||||
{
|
||||
azsnprintf(AZStd::data(params.branchToken), AZStd::size(params.branchToken), "0x%llx", settingsValueInt);
|
||||
}
|
||||
|
||||
// Engine root path(also AppRoot path as well)
|
||||
settingsValueString.clear();
|
||||
if (registry.Get(settingsValueString, AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder))
|
||||
{
|
||||
azstrncpy(AZStd::data(params.rootPath), AZStd::size(params.rootPath), settingsValueString.c_str(), settingsValueString.size());
|
||||
}
|
||||
// Asset Cache Root path
|
||||
settingsValueString.clear();
|
||||
if (registry.Get(settingsValueString, AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
|
||||
{
|
||||
azstrncpy(AZStd::data(params.rootPathCache), AZStd::size(params.rootPathCache), settingsValueString.c_str(), settingsValueString.size());
|
||||
}
|
||||
// Asset Cache Game path (Includes as part of path, the current project name)
|
||||
settingsValueString.clear();
|
||||
if (registry.Get(settingsValueString, AZ::SettingsRegistryMergeUtils::FilePathKey_CacheGameFolder))
|
||||
{
|
||||
azstrncpy(AZStd::data(params.assetsPathCache), AZStd::size(params.assetsPathCache), settingsValueString.c_str(), settingsValueString.size());
|
||||
azstrncpy(AZStd::data(params.assetsPath), AZStd::size(params.assetsPath), settingsValueString.c_str(), settingsValueString.size());
|
||||
}
|
||||
}
|
||||
|
||||
void CompileCriticalAssets();
|
||||
void CreateRemoteFileIO();
|
||||
|
||||
@@ -493,24 +397,37 @@ namespace LumberyardLauncher
|
||||
}
|
||||
|
||||
//! Add the GameProjectName and Launcher build target name into the settings registry
|
||||
void AddGameProjectNameToSettingsRegistry(AZ::SettingsRegistryInterface& settingsRegistry, AZ::CommandLine& commandLine)
|
||||
void AddProjectMetadataToSettingsRegistry(AZ::SettingsRegistryInterface& settingsRegistry, AZ::CommandLine& commandLine)
|
||||
{
|
||||
auto gameProjectNameKey = AZ::SettingsRegistryInterface::FixedValueString::format("%s/sys_game_folder", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey);
|
||||
AZ::SettingsRegistryInterface::FixedValueString bootstrapGameProjectName;
|
||||
settingsRegistry.Get(bootstrapGameProjectName, gameProjectNameKey);
|
||||
// Inject the Project Path and Project into the CommandLine parameters to beginning of the command line
|
||||
// in order to allow it to used as a fallback if the parameters aren't supplied launch parameters already
|
||||
// Command Line parameters are the bootstrap settings into the Settings Registry, so they precedence
|
||||
auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
|
||||
+ "/project_path";
|
||||
auto projectNameKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey)
|
||||
+ "/project_name";
|
||||
|
||||
const AZStd::string_view gameProjectName = GetGameProjectName();
|
||||
AZ::SettingsRegistryInterface::FixedValueString gameProjectCommandLineOverride = R"(--regset=)";
|
||||
gameProjectCommandLineOverride += gameProjectNameKey;
|
||||
gameProjectCommandLineOverride += '=';
|
||||
gameProjectCommandLineOverride += gameProjectName;
|
||||
|
||||
// Inject the Project Name into the CommandLine parameters, so that the Setting Registry
|
||||
// always is set to the launcher's project name whenever the command line is merged into the Settings Registry
|
||||
// This happens several times through application such as in GameApplication::Start
|
||||
AZ::CommandLine::ParamContainer commandLineArgs;
|
||||
commandLine.Dump(commandLineArgs);
|
||||
commandLineArgs.emplace_back(gameProjectCommandLineOverride);
|
||||
|
||||
// Insert the project_name option to the front
|
||||
const AZStd::string_view launcherProjectName = GetProjectName();
|
||||
if (!launcherProjectName.empty())
|
||||
{
|
||||
auto projectNameOptionOverride = AZ::SettingsRegistryInterface::FixedValueString::format(R"(--regset="%s=%.*s")",
|
||||
projectNameKey.c_str(), aznumeric_cast<int>(launcherProjectName.size()), launcherProjectName.data());
|
||||
commandLineArgs.emplace(commandLineArgs.begin(), projectNameOptionOverride);
|
||||
}
|
||||
|
||||
// Insert the project_path option to the front
|
||||
const AZStd::string_view projectPath = GetProjectPath();
|
||||
if (!projectPath.empty())
|
||||
{
|
||||
auto projectPathOptionOverride = AZ::SettingsRegistryInterface::FixedValueString::format(R"(--regset="%s=%.*s")",
|
||||
projectPathKey.c_str(), aznumeric_cast<int>(projectPath.size()), projectPath.data());
|
||||
commandLineArgs.emplace(commandLineArgs.begin(), projectPathOptionOverride);
|
||||
}
|
||||
|
||||
commandLine.Parse(commandLineArgs);
|
||||
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(settingsRegistry, commandLine, false);
|
||||
@@ -519,27 +436,16 @@ namespace LumberyardLauncher
|
||||
const AZStd::string_view buildTargetName = LumberyardLauncher::GetBuildTargetName();
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(settingsRegistry, buildTargetName);
|
||||
|
||||
// Output a trace message if the sys_game_folder value read from the boostrap.cfg file doesn't match the value of the
|
||||
// LY_GAMEFOLDER define built into the Launcher.
|
||||
// This isn't any kind of error or ever warning, but is used as an informational message to the user
|
||||
// that the launcher will use the always used the injected LY_GAMEFOLDER define
|
||||
if (bootstrapGameProjectName != gameProjectName)
|
||||
{
|
||||
AZ_TracePrintf("Launcher", R"(The game project "%s" read into the Settings Registry from the bootstrap.cfg file)"
|
||||
R"( does not match the LY_GAMEFOLDER define "%.*s")" "\n",
|
||||
bootstrapGameProjectName.c_str(), aznumeric_cast<int>(gameProjectName.size()), gameProjectName.data());
|
||||
}
|
||||
|
||||
AZ_TracePrintf("Launcher", R"(The game project name of "%.*s" is the value of the LY_GAMEFOLDER define.)" "\n"
|
||||
R"(That value has been successfully set into the Settings Registry at key "%s/sys_game_folder" for Launcher target "%.*s")" "\n",
|
||||
aznumeric_cast<int>(gameProjectName.size()), gameProjectName.data(),
|
||||
AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey,
|
||||
AZ_TracePrintf("Launcher", R"(Running project "%.*s.)" "\n"
|
||||
R"(The project name value has been successfully set in the Settings Registry at key "%s/project_name" for Launcher target "%.*s")" "\n",
|
||||
aznumeric_cast<int>(launcherProjectName.size()), launcherProjectName.data(),
|
||||
AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey,
|
||||
aznumeric_cast<int>(buildTargetName.size()), buildTargetName.data());
|
||||
}
|
||||
|
||||
ReturnCode Run(const PlatformMainInfo& mainInfo)
|
||||
{
|
||||
if (mainInfo.m_updateResourceLimits
|
||||
if (mainInfo.m_updateResourceLimits
|
||||
&& !mainInfo.m_updateResourceLimits())
|
||||
{
|
||||
return ReturnCode::ErrResourceLimit;
|
||||
@@ -562,9 +468,8 @@ namespace LumberyardLauncher
|
||||
|
||||
// Inject the ${LY_GAMEFOLDER} project name define that from the Launcher build target
|
||||
// into the settings registry
|
||||
AddGameProjectNameToSettingsRegistry(*settingsRegistry, *gameApplication.GetAzCommandLine());
|
||||
AddProjectMetadataToSettingsRegistry(*settingsRegistry, *gameApplication.GetAzCommandLine());
|
||||
|
||||
bool applyAppRootOverride = (AZ_TRAIT_LAUNCHER_SET_APPROOT_OVERRIDE == 1);
|
||||
AZ::SettingsRegistryInterface::FixedValueString pathToAssets;
|
||||
if (!settingsRegistry->Get(pathToAssets, AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
|
||||
{
|
||||
@@ -581,51 +486,6 @@ namespace LumberyardLauncher
|
||||
}
|
||||
|
||||
CryAllocatorsRAII cryAllocatorsRAII;
|
||||
#if AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE
|
||||
char appRootOverride[AZ_MAX_PATH_LEN] = { 0 };
|
||||
{
|
||||
// Search for the app root argument (--app-root <PATH>) where <PATH> is the app root path to set for the application
|
||||
const static char* appRootArgPrefix = "--app-root";
|
||||
size_t appRootArgPrefixLen = strlen(appRootArgPrefix);
|
||||
|
||||
const char* appRootArg = nullptr;
|
||||
|
||||
char cmdLineCopy[AZ_COMMAND_LINE_LEN] = { 0 };
|
||||
azstrncpy(cmdLineCopy, AZ_COMMAND_LINE_LEN, mainInfo.m_commandLine, mainInfo.m_commandLineLen);
|
||||
|
||||
const char* delimiters = " ";
|
||||
char* nextToken = nullptr;
|
||||
char* token = azstrtok(cmdLineCopy, 0, delimiters, &nextToken);
|
||||
while (token != NULL)
|
||||
{
|
||||
if (azstrnicmp(appRootArgPrefix, token, appRootArgPrefixLen) == 0)
|
||||
{
|
||||
appRootArg = azstrtok(nullptr, 0, delimiters, &nextToken);
|
||||
break;
|
||||
}
|
||||
token = azstrtok(nullptr, 0, delimiters, &nextToken);
|
||||
}
|
||||
|
||||
if (appRootArg)
|
||||
{
|
||||
AZStd::string_view appRootArgView = appRootArg;
|
||||
size_t afterStartQuotes = appRootArgView.find_first_not_of(R"(")");
|
||||
if (afterStartQuotes != AZStd::string_view::npos)
|
||||
{
|
||||
appRootArgView.remove_prefix(afterStartQuotes);
|
||||
}
|
||||
size_t beforeEndQuotes = appRootArgView.find_last_not_of(R"(")");
|
||||
if (beforeEndQuotes != AZStd::string_view::npos)
|
||||
{
|
||||
appRootArgView.remove_suffix(appRootArgView.size() - (beforeEndQuotes + 1));
|
||||
}
|
||||
appRootArgView.copy(appRootOverride, AZ_MAX_PATH_LEN);
|
||||
appRootOverride[appRootArgView.size()] = '\0';
|
||||
pathToAssets = appRootOverride;
|
||||
applyAppRootOverride = true;
|
||||
}
|
||||
}
|
||||
#endif // AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE
|
||||
|
||||
// System Init Params ("Legacy" Lumberyard)
|
||||
SSystemInitParams systemInitParams;
|
||||
@@ -634,12 +494,6 @@ namespace LumberyardLauncher
|
||||
{
|
||||
AzGameFramework::GameApplication::StartupParameters gameApplicationStartupParams;
|
||||
|
||||
if (applyAppRootOverride)
|
||||
{
|
||||
// NOTE: setting this on android doesn't work when assets are packaged in the APK
|
||||
gameApplicationStartupParams.m_appRootOverride = pathToAssets.c_str();
|
||||
}
|
||||
|
||||
if (mainInfo.m_allocator)
|
||||
{
|
||||
gameApplicationStartupParams.m_allocator = mainInfo.m_allocator;
|
||||
@@ -654,8 +508,6 @@ namespace LumberyardLauncher
|
||||
gameApplicationStartupParams.m_loadDynamicModules = false;
|
||||
#endif // defined(AZ_MONOLITHIC_BUILD)
|
||||
|
||||
CopySettingsRegistryToCrySystemInitParams(*settingsRegistry, systemInitParams);
|
||||
|
||||
gameApplication.Start({}, gameApplicationStartupParams);
|
||||
|
||||
#if defined(REMOTE_ASSET_PROCESSOR)
|
||||
@@ -688,7 +540,7 @@ namespace LumberyardLauncher
|
||||
mainInfo.m_onPostAppStart();
|
||||
}
|
||||
|
||||
azstrncpy(systemInitParams.szSystemCmdLine, sizeof(systemInitParams.szSystemCmdLine),
|
||||
azstrncpy(systemInitParams.szSystemCmdLine, sizeof(systemInitParams.szSystemCmdLine),
|
||||
mainInfo.m_commandLine, mainInfo.m_commandLineLen);
|
||||
|
||||
systemInitParams.pSharedEnvironment = AZ::Environment::GetInstance();
|
||||
@@ -704,7 +556,10 @@ namespace LumberyardLauncher
|
||||
|
||||
systemInitParams.bDedicatedServer = IsDedicatedServer();
|
||||
|
||||
if (systemInitParams.remoteFileIO)
|
||||
bool remoteFileSystemEnabled{};
|
||||
AZ::SettingsRegistryMergeUtils::PlatformGet(*settingsRegistry, remoteFileSystemEnabled,
|
||||
AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey, "remote_filesystem");
|
||||
if (remoteFileSystemEnabled)
|
||||
{
|
||||
AZ_TracePrintf("Launcher", "Application is configured for VFS");
|
||||
AZ_TracePrintf("Launcher", "Log and cache files will be written to the Cache directory on your host PC");
|
||||
@@ -716,22 +571,15 @@ namespace LumberyardLauncher
|
||||
{
|
||||
AZ_TracePrintf("Launcher", "%s\n%s", message, mainInfo.m_additionalVfsResolution)
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
AZ_TracePrintf("Launcher", "%s", message)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_TracePrintf("Launcher", "Application is configured to use device local files at %s\n", systemInitParams.rootPath);
|
||||
AZ_TracePrintf("Launcher", "Application is configured to use device local files at %s\n", pathToAssets.c_str());
|
||||
AZ_TracePrintf("Launcher", "Log and cache files will be written to device storage\n");
|
||||
|
||||
const char* writeStorage = mainInfo.m_appWriteStoragePath;
|
||||
if (writeStorage)
|
||||
{
|
||||
AZ_TracePrintf("Launcher", "User Storage will be set to %s/user\n", writeStorage);
|
||||
azsnprintf(systemInitParams.userPath, AZ_MAX_PATH_LEN, "%s/user", writeStorage);
|
||||
}
|
||||
}
|
||||
|
||||
// Create CrySystem.
|
||||
|
||||
@@ -84,7 +84,6 @@ namespace LumberyardLauncher
|
||||
Success = 0,
|
||||
|
||||
ErrExePath, //!< Failed to get the executable path
|
||||
ErrBootstrapMismatch, //!< Failed to validate launcher compiler defines with bootstrap values
|
||||
ErrCommandLine, //!< Failed to copy the command line
|
||||
ErrValidation, //!< Failed to validate secret
|
||||
ErrResourceLimit, //!< Failed to increase unix resource limits
|
||||
@@ -107,10 +106,13 @@ namespace LumberyardLauncher
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! This function returns the name of the project
|
||||
const AZStd::string_view GetGameProjectName();
|
||||
AZStd::string_view GetProjectName();
|
||||
|
||||
//! This function returns the path of the project as known by the build system
|
||||
AZStd::string_view GetProjectPath();
|
||||
|
||||
//! This function returns the build system target name
|
||||
const AZStd::string_view GetBuildTargetName();
|
||||
AZStd::string_view GetBuildTargetName();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// The following functions are defined per launcher type (e.g. Game/Server)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace LumberyardLauncher
|
||||
{
|
||||
//! This file is to be added only to the ${project}.[Game|Server]Launcher build target
|
||||
//! This function returns the build system target name
|
||||
const AZStd::string_view GetBuildTargetName()
|
||||
AZStd::string_view GetBuildTargetName()
|
||||
{
|
||||
#if !defined (LY_CMAKE_TARGET)
|
||||
#error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
|
||||
@@ -29,11 +29,22 @@ namespace LumberyardLauncher
|
||||
}
|
||||
|
||||
|
||||
const AZStd::string_view GetGameProjectName()
|
||||
AZStd::string_view GetProjectName()
|
||||
{
|
||||
#if !defined (LY_GAME_PROJECT_NAME)
|
||||
#error "LY_GAME_PROJECT_NAME must be defined in order to for the Launcher to run using a Game Project"
|
||||
#if !defined (LY_PROJECT_NAME)
|
||||
#error "LY_PROJECT_NAME must be defined in order to for the Launcher to run using a Game Project"
|
||||
#endif
|
||||
return { LY_PROJECT_NAME };
|
||||
}
|
||||
|
||||
AZStd::string_view GetProjectPath()
|
||||
{
|
||||
// The Project CMake path optional and not required
|
||||
// It is used as fall back project root path
|
||||
#if defined LY_PROJECT_CMAKE_PATH
|
||||
return { LY_PROJECT_CMAKE_PATH };
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
return { LY_GAME_PROJECT_NAME };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,5 @@
|
||||
#pragma once
|
||||
|
||||
#define AZ_TRAIT_LAUNCHER_LOWER_CASE_PATHS 1
|
||||
#define AZ_TRAIT_LAUNCHER_SET_APPROOT_OVERRIDE 0
|
||||
#define AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE 0
|
||||
#define AZ_TRAIT_LAUNCHER_USE_CRY_DYNAMIC_MODULE_HANDLE 1
|
||||
#define AZ_TRAIT_SHARED_LIBRARY_FILENAME_FORMAT "%s/lib%s.so"
|
||||
|
||||
@@ -12,7 +12,5 @@
|
||||
#pragma once
|
||||
|
||||
#define AZ_TRAIT_LAUNCHER_LOWER_CASE_PATHS 0
|
||||
#define AZ_TRAIT_LAUNCHER_SET_APPROOT_OVERRIDE 0
|
||||
#define AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE 1
|
||||
#define AZ_TRAIT_LAUNCHER_USE_CRY_DYNAMIC_MODULE_HANDLE 1
|
||||
#define AZ_TRAIT_SHARED_LIBRARY_FILENAME_FORMAT "%s/lib%s.so"
|
||||
|
||||
@@ -12,7 +12,5 @@
|
||||
#pragma once
|
||||
|
||||
#define AZ_TRAIT_LAUNCHER_LOWER_CASE_PATHS 1
|
||||
#define AZ_TRAIT_LAUNCHER_SET_APPROOT_OVERRIDE 1
|
||||
#define AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE 1
|
||||
#define AZ_TRAIT_LAUNCHER_USE_CRY_DYNAMIC_MODULE_HANDLE 1
|
||||
#define AZ_TRAIT_SHARED_LIBRARY_FILENAME_FORMAT "%s/lib%s.dylib"
|
||||
|
||||
@@ -20,35 +20,39 @@ else()
|
||||
endif()
|
||||
|
||||
# Add resources and app icons to launchers
|
||||
get_target_property(${project}_SOURCE_DIR ${project} SOURCE_DIR)
|
||||
get_filename_component(${project}_SOURCE_PARENT_DIR ${${project}_SOURCE_DIR} DIRECTORY)
|
||||
|
||||
set(ly_game_resource_folder ${${project}_SOURCE_PARENT_DIR}/Resources/Platform/Mac)
|
||||
if (NOT EXISTS ${ly_game_resource_folder})
|
||||
set(ly_game_resource_folder ${${project}_SOURCE_PARENT_DIR}/Resources/MacLauncher)
|
||||
if (NOT EXISTS ${ly_game_resource_folder})
|
||||
message(FATAL_ERROR "Missing expected resources folder")
|
||||
list(APPEND candidate_paths ${project_real_path}/Resources/Platform/Mac)
|
||||
list(APPEND candidate_paths ${project_real_path}/Gem/Resources/Platform/Mac) # Legacy projects
|
||||
list(APPEND candidate_paths ${project_real_path}/Gem/Resources/MacLauncher) # Legacy projects
|
||||
foreach(resource_path IN LISTS candidate_paths)
|
||||
if(EXISTS ${resource_path})
|
||||
set(ly_game_resource_folder ${resource_path})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT EXISTS ${ly_game_resource_folder})
|
||||
list(JOIN candidate_paths " " formatted_error)
|
||||
message(FATAL_ERROR "Missing 'Resources' folder. Candidate paths tried were: ${formatted_error}")
|
||||
endif()
|
||||
|
||||
target_sources(${project}.GameLauncher PRIVATE ${ly_game_resource_folder}/Images.xcassets)
|
||||
set_target_properties(${project}.GameLauncher PROPERTIES
|
||||
|
||||
target_sources(${project_name}.GameLauncher PRIVATE ${ly_game_resource_folder}/Images.xcassets)
|
||||
set_target_properties(${project_name}.GameLauncher PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${ly_game_resource_folder}/Info.plist
|
||||
RESOURCE ${ly_game_resource_folder}/Images.xcassets
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME ${project}AppIcon
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME ${project_name}AppIcon
|
||||
)
|
||||
|
||||
set(layout_tool_dir ${LY_ROOT_FOLDER}/cmake/Tools)
|
||||
|
||||
add_custom_command(TARGET ${project}.GameLauncher POST_BUILD
|
||||
add_custom_command(TARGET ${project_name}.GameLauncher POST_BUILD
|
||||
COMMAND ${LY_PYTHON_CMD} layout_tool.py
|
||||
--dev-root "${LY_ROOT_FOLDER}"
|
||||
-p Mac
|
||||
-a ${LY_ASSET_DEPLOY_ASSET_TYPE}
|
||||
-g ${project}
|
||||
--project-path ${project_real_path}
|
||||
-m ${LY_ASSET_DEPLOY_MODE}
|
||||
--create-layout-root
|
||||
-l $<TARGET_BUNDLE_DIR:${project}.GameLauncher>/Contents/Resources/assets
|
||||
-l $<TARGET_BUNDLE_DIR:${project_name}.GameLauncher>/Contents/Resources/assets
|
||||
--build-config $<CONFIG>
|
||||
--warn-on-missing-assets
|
||||
--verify
|
||||
|
||||
@@ -12,7 +12,5 @@
|
||||
#pragma once
|
||||
|
||||
#define AZ_TRAIT_LAUNCHER_LOWER_CASE_PATHS 0
|
||||
#define AZ_TRAIT_LAUNCHER_SET_APPROOT_OVERRIDE 0
|
||||
#define AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE 1
|
||||
#define AZ_TRAIT_LAUNCHER_USE_CRY_DYNAMIC_MODULE_HANDLE 0
|
||||
#define AZ_TRAIT_SHARED_LIBRARY_FILENAME_FORMAT R"(%s\%s.dll)"
|
||||
|
||||
@@ -21,17 +21,14 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
# Find the resource from the game gem
|
||||
get_target_property(${project}_SOURCE_DIR ${project} SOURCE_DIR) # Point to where the code is
|
||||
get_filename_component(${project}_SOURCE_PARENT_DIR ${${project}_SOURCE_DIR} DIRECTORY) # Parent directory
|
||||
|
||||
set(ICON_FILE ${${project}_SOURCE_PARENT_DIR}/Resources/GameSDK.ico)
|
||||
set(ICON_FILE ${project_real_path}/Gem/Resources/GameSDK.ico)
|
||||
if(NOT EXISTS ${ICON_FILE})
|
||||
# Try the common LauncherUnified icon instead
|
||||
set(ICON_FILE Resources/GameSDK.ico)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${ICON_FILE})
|
||||
set(target_file ${CMAKE_CURRENT_BINARY_DIR}/${project}.GameLauncher.rc)
|
||||
set(target_file ${CMAKE_CURRENT_BINARY_DIR}/${project_name}.GameLauncher.rc)
|
||||
configure_file(Platform/Windows/Launcher.rc.in
|
||||
${target_file}
|
||||
@ONLY
|
||||
|
||||
@@ -12,7 +12,5 @@
|
||||
#pragma once
|
||||
|
||||
#define AZ_TRAIT_LAUNCHER_LOWER_CASE_PATHS 1
|
||||
#define AZ_TRAIT_LAUNCHER_SET_APPROOT_OVERRIDE 1
|
||||
#define AZ_TRAIT_LAUNCHER_ALLOW_CMDLINE_APPROOT_OVERRIDE 0
|
||||
#define AZ_TRAIT_LAUNCHER_USE_CRY_DYNAMIC_MODULE_HANDLE 0
|
||||
#define AZ_TRAIT_SHARED_LIBRARY_FILENAME_FORMAT "%s/lib%s.dylib"
|
||||
|
||||
@@ -21,37 +21,40 @@ else()
|
||||
set(LY_RUNTIME_DEPENDENCIES Legacy::CryRenderMetal)
|
||||
endif()
|
||||
|
||||
# Find the resource from the game gem
|
||||
get_target_property(${project}_SOURCE_DIR ${project} SOURCE_DIR) # Point to where the code is
|
||||
get_filename_component(${project}_SOURCE_PARENT_DIR ${${project}_SOURCE_DIR} DIRECTORY) # Parent directory
|
||||
|
||||
set(ly_game_resource_folder ${${project}_SOURCE_PARENT_DIR}/Resources/Platform/iOS)
|
||||
if (NOT EXISTS ${ly_game_resource_folder})
|
||||
set(ly_game_resource_folder ${${project}_SOURCE_PARENT_DIR}/Resources/IOSLauncher)
|
||||
if (NOT EXISTS ${ly_game_resource_folder})
|
||||
message(FATAL_ERROR "Missing expected resources folder")
|
||||
# Add resources and app icons to launchers
|
||||
list(APPEND candidate_paths ${project_real_path}/Resources/Platform/iOS)
|
||||
list(APPEND candidate_paths ${project_real_path}/Gem/Resources/Platform/iOS) # Legacy projects
|
||||
list(APPEND candidate_paths ${project_real_path}/Gem/Resources/IOSLauncher) # Legacy projects
|
||||
foreach(resource_path IN LISTS candidate_paths)
|
||||
if(EXISTS ${resource_path})
|
||||
set(ly_game_resource_folder ${resource_path})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT EXISTS ${ly_game_resource_folder})
|
||||
list(JOIN candidate_paths " " formatted_error)
|
||||
message(FATAL_ERROR "Missing 'Resources' folder. Candidate paths tried were: ${formatted_error}")
|
||||
endif()
|
||||
|
||||
# Add resources and app icons to launchers
|
||||
target_sources(${project}.GameLauncher PRIVATE ${ly_game_resource_folder}/Images.xcassets)
|
||||
set_target_properties(${project}.GameLauncher PROPERTIES
|
||||
|
||||
target_sources(${project_name}.GameLauncher PRIVATE ${ly_game_resource_folder}/Images.xcassets)
|
||||
set_target_properties(${project_name}.GameLauncher PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${ly_game_resource_folder}/Info.plist
|
||||
RESOURCE ${ly_game_resource_folder}/Images.xcassets
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME ${project}AppIcon
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME ${project_name}AppIcon
|
||||
)
|
||||
|
||||
set(layout_tool_dir ${LY_ROOT_FOLDER}/cmake/Tools)
|
||||
|
||||
add_custom_command(TARGET ${project}.GameLauncher POST_BUILD
|
||||
add_custom_command(TARGET ${project_name}.GameLauncher POST_BUILD
|
||||
COMMAND ${LY_PYTHON_CMD} layout_tool.py
|
||||
--dev-root "${LY_ROOT_FOLDER}"
|
||||
-p iOS
|
||||
-a ${LY_ASSET_DEPLOY_ASSET_TYPE}
|
||||
-g ${project}
|
||||
--project-path ${project_real_path}
|
||||
-m ${LY_ASSET_DEPLOY_MODE}
|
||||
--create-layout-root
|
||||
-l $<TARGET_BUNDLE_DIR:${project}.GameLauncher>/assets
|
||||
-l $<TARGET_BUNDLE_DIR:${project_name}.GameLauncher>/assets
|
||||
--build-config $<CONFIG>
|
||||
--warn-on-missing-assets
|
||||
--verify
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace LumberyardLauncher
|
||||
return "@log@/Game.log";
|
||||
}
|
||||
|
||||
const AZStd::string_view GetBuildTargetName()
|
||||
AZStd::string_view GetBuildTargetName()
|
||||
{
|
||||
#if !defined (LY_CMAKE_TARGET)
|
||||
#error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
|
||||
@@ -37,7 +37,12 @@ namespace LumberyardLauncher
|
||||
return { LY_CMAKE_TARGET };
|
||||
}
|
||||
|
||||
const AZStd::string_view GetGameProjectName()
|
||||
AZStd::string_view GetProjectName()
|
||||
{
|
||||
return { "Tests" };
|
||||
}
|
||||
|
||||
AZStd::string_view GetProjectPath()
|
||||
{
|
||||
return { "Tests" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user