Add support for configuring default Archive File Search Mode through a Cache Var (#5668)

* Renamed ArchiveLocationPriority enum to FileSearchPriority and made it a proper enum class

Added an ArchiveVars.cpp which checks the a new define: `LY_ARCHIVE_FILE_SEARCH_MODE_DEFAULT`
That define represents the default value to use for the Archive system search mode

Moved the FileSearchLocation enum to the ArchiveVars.h header

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the AssetBundleComponent to use AZ::IO::Path for level dirs

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added a LY_ARCHIVE_FILE_SEARCH_MODE cache variable

The Cache Variable default value is to Archive File Search Mode to PakOnly
in Release. This can be overridden using a value for all configurations
by specifying a number of 0, 1 or 2.
Alternatively a generator expression can be used to set the Archive File
Search Mode in specific configurations.
For example to set the FileSearchMode to 1 in profile and 2 in release
the following LY_ARCHIVE_FILE_SEARCH_MODE value can be used
`$<$<CONFIG:profile>:1>$<$<CONFIG:release>:2>`

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated AssetBundler(Batch) VS Debugger arguments to populate the
project-path optoin if a single project is configured.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Add support for serializing older versions of the AssetBundleManifest

This is done by attaching the "ObjectStreamWriteElementOverride"
attribute to the AssetBundleManifest reflection.
That attribute contains a function which outputs an older serialized
version of the AssetBundleManifest based on the `m_bundleVersion` member
value.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* AZStd::variant Serialization fix

The AttributeData<T> type is no longer suitable for storing the
ObjectStreamWriterOverrideCB function

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
lumberyard-employee-dm
2021-11-18 10:22:08 -06:00
committed by GitHub
parent 489877b82a
commit 9d22c98c26
31 changed files with 396 additions and 304 deletions
-38
View File
@@ -170,14 +170,6 @@ void CryEngineSignalHandler(int signal)
extern HMODULE gDLLHandle;
#endif
namespace
{
#if defined(AZ_PLATFORM_WINDOWS)
// on windows, we lock our cache using a lockfile. On other platforms this is not necessary since devices like ios, android, consoles cannot
// run more than one game process that uses the same folder anyway.
HANDLE g_cacheLock = INVALID_HANDLE_VALUE;
#endif
}
//static int g_sysSpecChanged = false;
@@ -339,9 +331,6 @@ bool CSystem::InitFileSystem()
m_pUserCallback->OnInitProgress("Initializing File System...");
}
// get the DirectInstance FileIOBase which should be the AZ::LocalFileIO
m_env.pFileIO = AZ::IO::FileIOBase::GetDirectInstance();
m_env.pCryPak = AZ::Interface<AZ::IO::IArchive>::Get();
m_env.pFileIO = AZ::IO::FileIOBase::GetInstance();
AZ_Assert(m_env.pCryPak, "CryPak has not been initialized on AZ::Interface");
@@ -365,33 +354,6 @@ bool CSystem::InitFileSystem()
void CSystem::ShutdownFileSystem()
{
#if defined(AZ_PLATFORM_WINDOWS)
if (g_cacheLock != INVALID_HANDLE_VALUE)
{
CloseHandle(g_cacheLock);
g_cacheLock = INVALID_HANDLE_VALUE;
}
#endif
using namespace AZ::IO;
FileIOBase* directInstance = FileIOBase::GetDirectInstance();
FileIOBase* pakInstance = FileIOBase::GetInstance();
if (directInstance == m_env.pFileIO)
{
// we only mess with file io if we own the instance that we installed.
// if we dont' own the instance, then we never configured fileIO and we should not alter it.
delete directInstance;
FileIOBase::SetDirectInstance(nullptr);
if (pakInstance != directInstance)
{
delete pakInstance;
FileIOBase::SetInstance(nullptr);
}
}
m_env.pFileIO = nullptr;
}