* 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>
monroegm-disable-blank-issue-2
lumberyard-employee-dm4 years agocommitted byGitHub
addLegacyGeneral(behaviorContext->Method("get_pak_from_file", PyGetPakFromFile,nullptr,"Finds a pak file name for a given file."));
addLegacyGeneral(behaviorContext->Method("get_pak_from_file",[](constchar*filename)->AZStd::string{returnPyGetPakFromFile(filename).Native();},nullptr,"Finds a pak file name for a given file."));
addLegacyGeneral(behaviorContext->Method("log",PyLog,nullptr,"Prints the message to the editor console window."));
AZ_CVAR(bool,ed_previewGameInFullscreen_once,false,nullptr,AZ::ConsoleFunctorFlags::IsInvisible,"Preview the game (Ctrl+G, \"Play Game\", etc.) in fullscreen once");
AZ_CVAR(bool,ed_lowercasepaths,false,nullptr,AZ::ConsoleFunctorFlags::Null,"Convert CCryFile paths to lowercase on Open");
REGISTER_CVAR2("ed_highlightGeometry",&viewports.bHighlightMouseOverGeometry,viewports.bHighlightMouseOverGeometry,0,"Highlight geometry when mouse over it");
REGISTER_CVAR2("ed_showFrozenHelpers",&viewports.nShowFrozenHelpers,viewports.nShowFrozenHelpers,0,"Show helpers of frozen objects");
REGISTER_CVAR2("ed_lowercasepaths",&useLowercasePaths,useLowercasePaths,0,"generate paths in lowercase");
gEnv->pConsole->RegisterInt("fe_fbx_savetempfile",0,0,"When importing an FBX file into Facial Editor, this will save out a conversion FSQ to the Animations/temp folder for trouble shooting");
REGISTER_CVAR2_CB("ed_toolbarIconSize",&gui.nToolbarIconSize,gui.nToolbarIconSize,VF_NULL,"Override size of the toolbar icons 0-default, 16,32,...",ToolbarIconSizeChanged);
// Cannot edit file in pack, suggest to extract it for editing.
if(QMessageBox::critical(QApplication::activeWindow(),QString(),QObject::tr("File %1 is inside a PAK file %2\r\nDo you want it to be extracted for editing ?").arg(file,sPakName),QMessageBox::Yes|QMessageBox::No)==QMessageBox::No)
AZ_Assert(filenameSize>=fileIt->second.length(),"Filename size %"PRIu64" is larger than the size of the tracked file %s:%zu",fileIt->second.c_str(),fileIt->second.size());
THROW_ZIPDIR_ERROR(ZD_ERROR_DATA_IS_CORRUPT,"The central directory offset or size are out of range, the pak is probably corrupt, try to repare or delete the file");
AZ_Warning("Archive",false,"ZD_ERROR_DATA_IS_CORRUPT: The central directory offset or size are out of range, the pak is probably corrupt, try to repare or delete the file");
returnfalse;
}
@ -394,7 +387,12 @@ namespace AZ::IO::ZipDir
// if there's nothing to search
if(nNewBufPos>=nOldBufPos)
{
THROW_ZIPDIR_ERROR(ZD_ERROR_NO_CDR,"Cannot find Central Directory Record in pak. This is either not a pak file, or a pak file without Central Directory. It does not mean that the data is permanently lost, but it may be severely damaged. Please repair the file with external tools, there may be enough information left to recover the file completely.");// we didn't find anything
AZ_Warning("Archive",false,"ZD_ERROR_NO_CDR: Cannot find Central Directory Record in pak."
" This is either not a pak file, or a pak file without Central Directory."
" It does not mean that the data is permanently lost,"
" but it may be severely damaged."
" Please repair the file with external tools,"
" there may be enough information left to recover the file completely.");// we didn't find anything
returnfalse;
}
@ -418,7 +416,11 @@ namespace AZ::IO::ZipDir
}
else
{
THROW_ZIPDIR_ERROR(ZD_ERROR_DATA_IS_CORRUPT,"Central Directory Record is followed by a comment of inconsistent length. This might be a minor misconsistency, please try to repair the file. However, it is dangerous to open the file because I will have to guess some structure offsets, which can lead to permanent unrecoverable damage of the archive content");
THROW_ZIPDIR_ERROR(ZD_ERROR_UNEXPECTED,"The program flow may not have possibly lead here. This error is unexplainable");// we shouldn't be here
AZ_Assert(false,"ZD_ERROR_UNEXPECTED: The program flow may not have possibly lead here. This error is unexplainable");// we shouldn't be here
returnfalse;
}
@ -460,13 +462,13 @@ namespace AZ::IO::ZipDir
if(pBuffer.empty())// couldn't allocate enough memory for temporary copy of CDR
{
THROW_ZIPDIR_ERROR(ZD_ERROR_NO_MEMORY,"Not enough memory to cache Central Directory record for fast initialization. This error may not happen on non-console systems");
AZ_Warning("Archive",false,"ZD_ERROR_NO_MEMORY: Not enough memory to cache Central Directory record for fast initialization. This error may not happen on non-console systems");
THROW_ZIPDIR_ERROR(ZD_ERROR_CDR_IS_CORRUPT,"Central Directory contains file descriptors pointing outside the archive file boundaries. The archive file is either truncated or damaged. Please try to repair the file");// the file offset is beyond the CDR: impossible
THROW_ZIPDIR_ERROR(ZD_ERROR_VALIDATION_FAILED,"File with STORE compression method declares its compressed size not matching its uncompressed size. File descriptor is inconsistent, archive content may be damaged, please try to repair the archive");
THROW_ZIPDIR_ERROR(ZD_ERROR_VALIDATION_FAILED,"The local file header descriptor doesn't match the basic parameters declared in the global file header in the file. The archive content is misconsistent and may be damaged. Please try to repair the archive");
// either file name, or the extra field do not match
THROW_ZIPDIR_ERROR(ZD_ERROR_VALIDATION_FAILED,"The local file header contains file name which does not match the file name of the global file header. The archive content is misconsistent with its directory. Please repair the archive");
" The local file header contains file name which does not match the file name of the global file header."
" The archive content is misconsistent with its directory. Please repair the archive");
return;
}
@ -642,7 +653,9 @@ namespace AZ::IO::ZipDir
if(fileEntry.nFileDataOffset>=m_nCDREndPos)
{
THROW_ZIPDIR_ERROR(ZD_ERROR_VALIDATION_FAILED,"The global file header declares the file which crosses the boundaries of the archive. The archive is either corrupted or truncated, please try to repair it");
THROW_ZIPDIR_ERROR(ZD_ERROR_ZLIB_CORRUPTED_DATA,"ZLib reported compressed stream data error");
AZ_Warning("Archive",false,"ZD_ERROR_ZLIB_CORRUPTED_DATA: ZLib reported compressed stream data error");
return;
default:
THROW_ZIPDIR_ERROR(ZD_ERROR_ZLIB_FAILED,"ZLib reported an unexpected unknown error");
AZ_Warning("Archive",false,"ZD_ERROR_ZLIB_FAILED: ZLib reported an unexpected unknown error");
return;
}
if(nDestSize!=fileEntry.desc.lSizeUncompressed)
{
THROW_ZIPDIR_ERROR(ZD_ERROR_CORRUPTED_DATA,"Uncompressed stream doesn't match the size of uncompressed file stored in the archive file headers");
AZ_Warning("Archive",false,"ZD_ERROR_CORRUPTED_DATA: Uncompressed stream doesn't match the size of uncompressed file stored in the archive file headers");
THROW_ZIPDIR_ERROR(ZD_ERROR_IO_FAILED,"Cannot fseek() to the new position in the file. This is unexpected error and should not happen under any circumstances. Perhaps some network or disk failure error has caused this");
AZ_Warning("Archive",false,"ZD_ERROR_IO_FAILED: Cannot fseek() to the new position in the file. This is unexpected error and should not happen under any circumstances. Perhaps some network or disk failure error has caused this");
return;
}
}
@ -747,7 +760,7 @@ namespace AZ::IO::ZipDir
int64_tnPos=FTell(&m_fileExt);
if(nPos==-1)
{
THROW_ZIPDIR_ERROR(ZD_ERROR_IO_FAILED,"Cannot ftell() position in the archive. This is unexpected error and should not happen under any circumstances. Perhaps some network or disk failure error has caused this");
AZ_Warning("Archive",false,"ZD_ERROR_IO_FAILED: Cannot ftell() position in the archive. This is unexpected error and should not happen under any circumstances. Perhaps some network or disk failure error has caused this");
return0;
}
returnnPos;
@ -757,7 +770,7 @@ namespace AZ::IO::ZipDir
{
if(FRead(&m_fileExt,pDest,nSize,1)!=1)
{
THROW_ZIPDIR_ERROR(ZD_ERROR_IO_FAILED,"Cannot fread() a portion of data from archive");
AZ_Warning("Archive",false,"ZD_ERROR_IO_FAILED: Cannot fread() a portion of data from archive");