Updated the GameApplication to mount the engine.pak (#4128)
* Updated the GameApplication to mount the engine.pak This allows loading the autoexec.cfg and bootstrap.game.<config>.<platform>.setreg from the engine.pak files The engine.pak is searched for in the following order: <ExecutableDirectory>/engine.pak, followed by <ProjectCacheRoot>/engine.pak Removed a lot of unused APIs from the AZ::IO::Archive feature suite Updated many of the AZ::IO::Archive classes to use AZ::IO::Path internally. The logic to search for files within an Archive has been updated to use AZ::IO::Path and to remove case-insensitve string comparisons Somehow removed the CryFile dependency on anything Cry Updated the Settings Registry to support reading from the FileIOBase and therefore Archive files in the GameLauncher via the `SetUseFileIO` function Removed AzFramework Dependency on md5 3rdParty library Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Linux build fix Added an include of <stdio.h> before the <rapidxml/rapidxml.h> include as it usesnprintf. Added `static` to the constexpr constants in ExtractFileDescription in SettingsRegistryImpl.cpp to fix clang compile issue Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the case used to mount the Engine PAK file in the GameApplication to be Engine.pak to match the other locations where it is mounted Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the proper FFont call to FileIOBase::Size to supply the correct integer type of AZ::u64 instead of size_t This fixes building on platforms where size_t is type defined to be unsigned long Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed segmentation fault in Archive::Unregister when outputing the filename of the Archive file being closed Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fix calls to OpenPack in the Legacy LevelSystem The LevelSystem was calling the incorrect overload of OpenPack that accepts BindRoot for the mounted level.pak instead of the overload that that passes a memory block object. This was causing the level pak files to be mounted using an invalid directory, causing file accesses inside the level pak to fail. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the error messages in the ZipDir CacheFactory class to use AZ_Warning directly Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the ArchiveFileIO m_trackedFiles container to store mapped type as an AZ::IO::Path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b95e170f9e
commit
447832dd81
@@ -81,71 +81,6 @@ namespace AzFramework
|
||||
static constexpr const char s_prefabSystemKey[] = "/Amazon/Preferences/EnablePrefabSystem";
|
||||
static constexpr const char s_prefabWipSystemKey[] = "/Amazon/Preferences/EnablePrefabSystemWipFeatures";
|
||||
static constexpr const char s_legacySlicesAssertKey[] = "/Amazon/Preferences/ShouldAssertForLegacySlicesUsage";
|
||||
|
||||
// A Helper function that can load an app descriptor from file.
|
||||
AZ::Outcome<AZStd::unique_ptr<AZ::ComponentApplication::Descriptor>, AZStd::string> LoadDescriptorFromFilePath(const char* appDescriptorFilePath, AZ::SerializeContext& serializeContext)
|
||||
{
|
||||
AZStd::unique_ptr<AZ::ComponentApplication::Descriptor> loadedDescriptor;
|
||||
|
||||
AZ::IO::SystemFile appDescriptorFile;
|
||||
if (!appDescriptorFile.Open(appDescriptorFilePath, AZ::IO::SystemFile::SF_OPEN_READ_ONLY))
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format("Failed to open file: %s", appDescriptorFilePath));
|
||||
}
|
||||
|
||||
AZ::IO::SystemFileStream appDescriptorFileStream(&appDescriptorFile, true);
|
||||
if (!appDescriptorFileStream.IsOpen())
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format("Failed to stream file: %s", appDescriptorFilePath));
|
||||
}
|
||||
|
||||
// Callback function for allocating the root elements in the file.
|
||||
AZ::ObjectStream::InplaceLoadRootInfoCB inplaceLoadCb =
|
||||
[](void** rootAddress, const AZ::SerializeContext::ClassData**, const AZ::Uuid& classId, AZ::SerializeContext*)
|
||||
{
|
||||
if (rootAddress && classId == azrtti_typeid<AZ::ComponentApplication::Descriptor>())
|
||||
{
|
||||
// ComponentApplication::Descriptor is normally a singleton.
|
||||
// Force a unique instance to be created.
|
||||
*rootAddress = aznew AZ::ComponentApplication::Descriptor();
|
||||
}
|
||||
};
|
||||
|
||||
// Callback function for saving the root elements in the file.
|
||||
AZ::ObjectStream::ClassReadyCB classReadyCb =
|
||||
[&loadedDescriptor](void* classPtr, const AZ::Uuid& classId, AZ::SerializeContext* context)
|
||||
{
|
||||
// Save descriptor, delete anything else loaded from file.
|
||||
if (classId == azrtti_typeid<AZ::ComponentApplication::Descriptor>())
|
||||
{
|
||||
loadedDescriptor.reset(static_cast<AZ::ComponentApplication::Descriptor*>(classPtr));
|
||||
}
|
||||
else if (const AZ::SerializeContext::ClassData* classData = context->FindClassData(classId))
|
||||
{
|
||||
classData->m_factory->Destroy(classPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("Application", false, "Unexpected type %s found in application descriptor file. This memory will leak.",
|
||||
classId.ToString<AZStd::string>().c_str());
|
||||
}
|
||||
};
|
||||
|
||||
// There's other stuff in the file we may not recognize (system components), but we're not interested in that stuff.
|
||||
AZ::ObjectStream::FilterDescriptor loadFilter(&AZ::Data::AssetFilterNoAssetLoading, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES);
|
||||
|
||||
if (!AZ::ObjectStream::LoadBlocking(&appDescriptorFileStream, serializeContext, classReadyCb, loadFilter, inplaceLoadCb))
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format("Failed to load objects from file: %s", appDescriptorFilePath));
|
||||
}
|
||||
|
||||
if (!loadedDescriptor)
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format("Failed to find descriptor object in file: %s", appDescriptorFilePath));
|
||||
}
|
||||
|
||||
return AZ::Success(AZStd::move(loadedDescriptor));
|
||||
}
|
||||
}
|
||||
|
||||
Application::Application()
|
||||
|
||||
Reference in New Issue
Block a user