Cry Legacy: the Lessening (#5961)
* Generic Cleanup Removals: * Unused cvars,member variables and defines * Windows media center edition support routines * CSystem - removed debug_GetCallStackRaw/GetRootWindowMessageHandler/ UnloadDLL/ShutdownModuleLibraries Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix CryMessageBox return values in Windows build Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove named selection group and a few smaller unused functionalities Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager export functionality + 2 deprecated functions Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove object legacy freeze/hide support from ObjectManager Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager duplicate name dection, as well as object renaming Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager serialization and selection callbacks Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - remove MoveObjects/HitTestObject/EndEditParams and related members/functions Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove a bunch of unused clone related functionality + misc Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - misc removals Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - more removals Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused object selection/retrieval in ObjectManager and LoadObjects in ObjectLoader Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove unused material layers mask support Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More CBaseObject cleanups. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove SubObj functions and IMouseCreateCallback Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused procedural floor management, helper scale and tags. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove more unused methods. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Removals in multiple places. CBaseObject - unused `OBJTYPE_DUMMY` flag removed, member `IsSameClass` CObjectArchive removed unused methods/members CObjectManager removed unused `Update` method Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More removals IDisplayViewport - HitTestLine/GetGridStep/setHitcontext/ GetConstructionPlane Unused Cry_Matrix44 template specializations. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * O3DE.exe Project-Centric "Open Editor" fix (#5852) * The O3DE.exe Open Editor button now attempts to open the Editor in the build directory of the project being opened. If their is no Editor within the build directory of the Project, it uses the Editor.exe in the current O3DE.exe executable directory if it exists Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Engine .gitignore now ignores the build directory if placed in the AutomatedTesting project Previously it was just ignoring a `[Bb]uild` directory if it was directly within the engine root. This change matches the behavior of the project templates. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Renamed the ProjectUtils GetEditorDirectory function to GetEditorExecutablePath Added a platform specific implementation for retrieving the path to the Editor executable in the GetEditorExectuablePath function. It first attempts to locate the Editor via checking the project build directory for an Editor executable before falling back to checking the binary directory of the currently running O3DE executable. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Correct the MacOS GetEditorExecutablePath to return the Editor path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Adding missing C++20 std::erase implementations (#5735) There were already implementations for std::erase_if. This adds the counterpart AZStd::erase versions resolves #5734 Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More removals and refactors `ShowMessage` and `CryMessageBox` return void now Simplify code in `CSystem::WarningV` Remove unused `CryGetTicksPerSec` Remove unused WinBase functionality Replace `nanosleep` call in WinBase with `std::this_thread::sleep_for` Remove unused Win32Wrapper routines Remove unused IFunctorBase.h and IEntityObjectListener.h Fix VectorAndArray.cpp compilation Use QMessageBox instead of CryMessageBox in the editor. Remove empty ArchiveVars platform specific files Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix test code. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove an unused function Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject and undo description removals. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * A bunch of removals * Remove IRenderNode * Remove editor's KDTree * Remove StatObjBus, InstanceStatObjEventBus::ReleaseData is redundant ( same functionality in the only available handler is triggered by `OnCryEditorCloseScene`) * Remove CExportManager::AddStatObj/AddMeshes/AddMesh, IExportManager::ExportSingleStatObj * Remove CIconManager/IIconManager::GetObject * Remove CBaseObject::IntersectRayMesh * Remove IIndexedMesh and related structs. * Unused IUndoObject::GetDescription and all derived implementations. * Unused CUndoBaseLibrary/CUndoBaseLibraryManager * Unused Matrix34_tpl typedefs * Legacy Xml classes cleanup Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused `Vec3ToVector3D` helper Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * fix - remove unused static variable Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
@@ -16,102 +16,6 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CXmlArchive
|
||||
bool CXmlArchive::Load(const QString& file)
|
||||
{
|
||||
bLoading = true;
|
||||
|
||||
char filename[AZ_MAX_PATH_LEN] = { 0 };
|
||||
AZ::IO::FileIOBase::GetInstance()->ResolvePath(file.toUtf8().data(), filename, AZ_MAX_PATH_LEN);
|
||||
|
||||
QFile cFile(filename);
|
||||
if (!cFile.open(QFile::ReadOnly))
|
||||
{
|
||||
CLogFile::FormatLine("Warning: Loading of %s failed", filename);
|
||||
return false;
|
||||
}
|
||||
CArchive ar(&cFile, CArchive::load);
|
||||
|
||||
QString str;
|
||||
ar >> str;
|
||||
|
||||
root = XmlHelpers::LoadXmlFromBuffer(str.toUtf8().data(), str.toUtf8().length());
|
||||
if (!root)
|
||||
{
|
||||
// If we didn't extract valid XML, attempt to check the header to see if we're dealing with an improperly serialized archive
|
||||
// When deserializing QStrings, we use readStringLength in EditorUtils, which mimics MFC's decoding.
|
||||
// In this encoding, the length is first read as an unsigned 8-bit value, if that is 0xFF then the next two bytes are read
|
||||
// If the 16 bit uint is 0xFFFF, then the next four bytes are read, etc. up to a final 64 bit value.
|
||||
|
||||
// In 1.09, there was a bug in which we'd serialize out the 32-bit length improperly like so:
|
||||
// 0xFF 0xFF 0x00 <4 byte proper length>
|
||||
|
||||
// Note that the header could also historically start with 0xFF 0xFF 0xFE to indicate wide strings prior to the length data
|
||||
// but we don't have to deal with that here as the broken version of the code never prepended this
|
||||
cFile.seek(0);
|
||||
quint8 len8;
|
||||
ar >> len8;
|
||||
|
||||
quint16 len16;
|
||||
ar >> len16;
|
||||
|
||||
// Possible bad header, attempt to read 32 bit length.
|
||||
if (len8 == 0xff && len16 == 0xff)
|
||||
{
|
||||
// This version of operator<< only serialized out UTF8 strings up to 32 bits of length, no need to 64-bit check or do wchar.
|
||||
quint32 len32;
|
||||
ar >> len32;
|
||||
|
||||
str = QString::fromUtf8(cFile.read(len32));
|
||||
root = XmlHelpers::LoadXmlFromBuffer(str.toUtf8().data(), str.toUtf8().length());
|
||||
}
|
||||
|
||||
if (!root)
|
||||
{
|
||||
CLogFile::FormatLine("Warning: Loading of %s failed", filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const bool loaded = pNamedData->Serialize(ar);
|
||||
if (!loaded)
|
||||
{
|
||||
CLogFile::FormatLine("Error: Can't load xml file: '%s'! File corrupted. Binary file possibly was corrupted by Source Control if it was marked like text format.", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXmlArchive::Save(const QString& file)
|
||||
{
|
||||
char filename[AZ_MAX_PATH_LEN] = { 0 };
|
||||
AZ::IO::FileIOBase::GetInstance()->ResolvePath(file.toUtf8().data(), filename, AZ_MAX_PATH_LEN);
|
||||
|
||||
bLoading = false;
|
||||
if (!root)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QFile cFile(filename);
|
||||
// Open the file for writing, create it if needed
|
||||
if (!cFile.open(QFile::WriteOnly))
|
||||
{
|
||||
CLogFile::FormatLine("Warning: Saving of %s failed", filename);
|
||||
return;
|
||||
}
|
||||
// Create the archive object
|
||||
CArchive ar(&cFile, CArchive::store);
|
||||
|
||||
_smart_ptr<IXmlStringData> pXmlStrData = root->getXMLData(5000000);
|
||||
|
||||
// Need convert to QString for CArchive::operator<<
|
||||
QString str = pXmlStrData->GetString();
|
||||
ar << str;
|
||||
|
||||
pNamedData->Serialize(ar);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CXmlArchive::SaveToPak([[maybe_unused]] const QString& levelPath, CPakFile& pakFile)
|
||||
|
||||
Reference in New Issue
Block a user