Merge branch 'upstream/development' into LYN-8514_AutomatedReviewServerLogChecks

This commit is contained in:
Gene Walters
2021-11-30 14:34:42 -08:00
595 changed files with 16165 additions and 11658 deletions
-21
View File
@@ -141,11 +141,6 @@ typedef uint8 byte;
#endif
#ifndef SAFE_RELEASE_FORCE
#define SAFE_RELEASE_FORCE(p) { if (p) { (p)->ReleaseForce(); (p) = NULL; } \
}
#endif
#define MAKEWORD(a, b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
#define MAKELONG(a, b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff))
@@ -472,22 +467,6 @@ inline int64 CryGetTicks()
return counter.QuadPart;
}
inline int64 CryGetTicksPerSec()
{
LARGE_INTEGER li;
QueryPerformanceFrequency(&li);
return li.QuadPart;
}
/*
inline uint32 GetTickCount()
{
LARGE_INTEGER count, freq;
QueryPerformanceCounter(&count);
QueryPerformanceFrequency(&freq);
return uint32(count.QuadPart * 1000 / freq.QuadPart);
}
*/
#ifdef _RELEASE
#define __debugbreak()
#else
+1
View File
@@ -17,6 +17,7 @@
#include <CryEndian.h> // eLittleEndian
#include <CryHalf.inl>
#include <float.h>
#include <limits>
///////////////////////////////////////////////////////////////////////////////
// Forward declarations //
///////////////////////////////////////////////////////////////////////////////
-5
View File
@@ -799,11 +799,6 @@ struct Matrix34_tpl
///////////////////////////////////////////////////////////////////////////////
typedef Matrix34_tpl<f32> Matrix34; //always 32 bit
#if AZ_COMPILER_MSVC
typedef __declspec(align(16)) Matrix34_tpl<f32> Matrix34A;
#elif AZ_COMPILER_CLANG
typedef Matrix34_tpl<f32> __attribute__((aligned(16))) Matrix34A;
#endif
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
-31
View File
@@ -276,30 +276,6 @@ struct Matrix44_tpl
m32 = m.m32;
m33 = m.m33;
}
//CONSTRUCTOR for identical types which converts between double/float
//Matrix44 m=m44r;
//Matrix44r m=m44;
template<class F1>
ILINE Matrix44_tpl<F>(const Matrix44_tpl<F1>&m)
{
assert(m.IsValid());
m00 = F(m.m00);
m01 = F(m.m01);
m02 = F(m.m02);
m03 = F(m.m03);
m10 = F(m.m10);
m11 = F(m.m11);
m12 = F(m.m12);
m13 = F(m.m13);
m20 = F(m.m20);
m21 = F(m.m21);
m22 = F(m.m22);
m23 = F(m.m23);
m30 = F(m.m30);
m31 = F(m.m31);
m32 = F(m.m32);
m33 = F(m.m33);
}
//---------------------------------------------------------------------
@@ -662,13 +638,6 @@ struct Matrix44_tpl
///////////////////////////////////////////////////////////////////////////////
typedef Matrix44_tpl<f32> Matrix44; //always 32 bit
typedef Matrix44_tpl<f64> Matrix44d; //always 64 bit
typedef Matrix44_tpl<real> Matrix44r; //variable float precision. depending on the target system it can be between 32, 64 or 80 bit
#if AZ_COMPILER_MSVC
typedef __declspec(align(16)) Matrix44_tpl<f32> Matrix44A;
#elif AZ_COMPILER_CLANG
typedef Matrix44_tpl<f32> __attribute__((aligned(16))) Matrix44A;
#endif
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
@@ -1,26 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <CryCommon/Cry_Matrix34.h>
struct IStatObj;
struct IRenderNode
{
// Gives access to object components.
IStatObj* GetEntityStatObj(unsigned int = 0, unsigned int = 0, Matrix34* = nullptr, bool = false) {
return nullptr;
}
int GetSlotCount() const { return 1; }
// Max view distance settings.
static constexpr int VIEW_DISTANCE_MULTIPLIER_MAX = 100;
};
-54
View File
@@ -1,54 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
// Description : Base header for multi DLL functors.
#ifndef CRYINCLUDE_CRYCOMMON_IFUNCTORBASE_H
#define CRYINCLUDE_CRYCOMMON_IFUNCTORBASE_H
#pragma once
#include <AzCore/std/parallel/atomic.h>
// Base class for functor storage.
// Not intended for direct usage.
class IFunctorBase
{
public:
IFunctorBase()
: m_nReferences(0){}
virtual ~IFunctorBase(){};
virtual void Call() = 0;
void AddRef()
{
m_nReferences.fetch_add(1, AZStd::memory_order_acq_rel);
}
void Release()
{
if (m_nReferences.fetch_sub(1, AZStd::memory_order_acq_rel) == 1)
{
delete this;
}
}
protected:
AZStd::atomic_int m_nReferences;
};
// Base Template for specialization.
// Not intended for direct usage.
template<typename tType>
class TFunctor
: public IFunctorBase
{
};
#endif // CRYINCLUDE_CRYCOMMON_IFUNCTORBASE_H
-117
View File
@@ -10,7 +10,6 @@
#pragma once
#include "Cry_Color.h"
#include <VertexFormats.h>
#include <Vertex.h>
// Description:
@@ -53,119 +52,3 @@ public:
a = othera;
}
};
// Description:
// Defines a single triangle face in the CMesh topology.
struct SMeshFace
{
int v[3]; // indices to vertex, normals and optionally tangent basis arrays
unsigned char nSubset; // index to mesh subsets array.
};
// Description:
// 3D Normal Vector used by CMesh.
struct SMeshNormal
{
SMeshNormal() {}
private:
Vec3 Normal;
public:
explicit SMeshNormal(const Vec3& othern)
{
Normal = othern;
}
Vec3 GetN() const { return Normal; }
};
// Subset of mesh is a continuous range of vertices and indices that share same material.
struct SMeshSubset
{
Vec3 vCenter;
float fRadius;
float fTexelDensity;
int nFirstIndexId;
int nNumIndices;
int nFirstVertId;
int nNumVerts;
int nMatID; // Material Sub-object id.
int nMatFlags; // Special Material flags.
int nPhysicalizeType; // Type of physicalization for this subset.
AZ::Vertex::Format vertexFormat;
SMeshSubset()
: vCenter(0, 0, 0)
, fRadius(0)
, fTexelDensity(0)
, nFirstIndexId(0)
, nNumIndices(0)
, nFirstVertId(0)
, nNumVerts(0)
, nMatID(0)
, nMatFlags(0)
, nPhysicalizeType(0x1000)
, vertexFormat(eVF_P3S_C4B_T2S)
{
}
};
// Description:
// Editable mesh interface.
// IndexedMesh can be created directly or loaded from CGF file, before rendering it is converted into IRenderMesh.
// IStatObj is used to host IIndexedMesh, and corresponding IRenderMesh.
struct IIndexedMesh
{
/*! Structure used for read-only access to mesh data. Used by GetMesh() function */
struct SMeshDescription
{
const SMeshFace* m_pFaces; // pointer to array of faces
const Vec3* m_pVerts; // pointer to array of vertices in f32 format
const Vec3f16* m_pVertsF16; // pointer to array of vertices in f16 format
const SMeshNormal* m_pNorms; // pointer to array of normals
const SMeshColor* m_pColor; // pointer to array of vertex colors
const SMeshTexCoord* m_pTexCoord; // pointer to array of texture coordinates
const vtx_idx* m_pIndices; // pointer to array of indices
int m_nFaceCount; // number of elements m_pFaces array
int m_nVertCount; // number of elements in m_pVerts, m_pNorms and m_pColor arrays
int m_nCoorCount; // number of elements in m_pTexCoord array
int m_nIndexCount; // number of elements in m_pIndices array
};
virtual ~IIndexedMesh() {}
// Release indexed mesh.
virtual void Release() = 0;
//! Gives read-only access to mesh data
virtual void GetMeshDescription(SMeshDescription& meshDesc) const = 0;
//! Return number of allocated faces
virtual int GetFaceCount() const = 0;
//! Return number of allocated vertices, normals and colors
virtual int GetVertexCount() const = 0;
/*! Reallocates vertices, normals and colors. Calling this function invalidates SMeshDescription pointers */
virtual void SetVertexCount(int nNewCount) = 0;
//! Return number of allocated texture coordinates
virtual int GetTexCoordCount() const = 0;
// Get number of indices in the mesh.
virtual int GetIndexCount() const = 0;
//////////////////////////////////////////////////////////////////////////
// Subset access.
//////////////////////////////////////////////////////////////////////////
virtual int GetSubSetCount() const = 0;
virtual const SMeshSubset& GetSubSet(int nIndex) const = 0;
};
-110
View File
@@ -1,110 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include "Cry_Math.h"
#include "Cry_Geo.h"
#include "IMaterial.h"
// General forward declaration.
struct SRenderingPassInfo;
//////////////////////////////////////////////////////////////////////////
// Type of static sub object.
//////////////////////////////////////////////////////////////////////////
enum EStaticSubObjectType
{
STATIC_SUB_OBJECT_MESH, // This simple geometry part of the multi-sub object geometry.
STATIC_SUB_OBJECT_HELPER_MESH, // Special helper mesh, not rendered usually, used for broken pieces.
};
// used for on-CPU voxelization
struct SRayHitInfo
{
SRayHitInfo()
{
memset(this, 0, sizeof(*this));
}
//////////////////////////////////////////////////////////////////////////
// Input parameters.
Vec3 inReferencePoint;
Ray inRay;
//////////////////////////////////////////////////////////////////////////
// Output parameters.
Vec3 vHitPos;
Vec3 vHitNormal;
// More inputs
bool bInFirstHit;
bool bUseCache;
};
// Summary:
// Interface to hold static object data
struct IStatObj
{
//////////////////////////////////////////////////////////////////////////
// SubObject
//////////////////////////////////////////////////////////////////////////
struct SSubObject
{
EStaticSubObjectType nType;
Matrix34 localTM; // Local transformation matrix, relative to parent.
IStatObj* pStatObj; // Static object for sub part of CGF.
};
//////////////////////////////////////////////////////////////////////////
virtual ~IStatObj() {}
// Description:
// Provide access to the faces, vertices, texture coordinates, normals and
// colors of the object used later for CRenderMesh construction.
// Return Value:
//
// Summary:
// Get the object source geometry
virtual struct IIndexedMesh* GetIndexedMesh(bool bCreateIfNone = false) = 0;
// Summary:
// Get the bounding box
// Arguments:
// Mins - Position of the bottom left close corner of the bounding box
// Maxs - Position of the top right far corner of the bounding box
virtual AABB GetAABB() = 0;
// Description:
// Returns the LOD object, if present.
// Arguments:
// nLodLevel - Level of the LOD
// bReturnNearest - if true will return nearest available LOD to nLodLevel.
// Return Value:
// A static object with the desired LOD. The value NULL will be return if there isn't any LOD object for the level requested.
// Summary:
// Get the LOD object
virtual IStatObj* GetLodObject(int nLodLevel, bool bReturnNearest = false) = 0;
// Summary:
// Returns a pointer to the object
// Return Value:
// A pointer to the current object, which is simply done like this "return this;"
virtual struct IStatObj* GetIStatObj() { return this; }
//////////////////////////////////////////////////////////////////////////
// Interface to the Sub Objects.
//////////////////////////////////////////////////////////////////////////
// Summary:
// Retrieve number of sub-objects.
virtual int GetSubObjectCount() const = 0;
// Summary:
// Retrieve sub object by index, where 0 <= nIndex < GetSubObjectCount()
virtual SSubObject* GetSubObject(int nIndex) = 0;
// Intersect ray with static object.
// Ray must be in object local space.
virtual bool RayIntersection(SRayHitInfo& hitInfo, IMaterial* pCustomMtl = nullptr) = 0;
};
+2 -45
View File
@@ -427,7 +427,7 @@ struct ISystemUserCallback
// Description:
// Show message by provider.
virtual int ShowMessage(const char* text, const char* caption, unsigned int uType) { return CryMessageBox(text, caption, uType); }
virtual void ShowMessage(const char* text, const char* caption, unsigned int uType) { CryMessageBox(text, caption, uType); }
// </interfuscator:shuffle>
@@ -811,14 +811,13 @@ struct ISystem
// Description:
// Report message by provider or by using CryMessageBox.
// Doesn't terminate the execution.
virtual int ShowMessage(const char* text, const char* caption, unsigned int uType) = 0;
virtual void ShowMessage(const char* text, const char* caption, unsigned int uType) = 0;
// Summary:
// Compare specified verbosity level to the one currently set.
virtual bool CheckLogVerbosity(int verbosity) = 0;
// return the related subsystem interface
virtual ILevelSystem* GetILevelSystem() = 0;
virtual ICmdLine* GetICmdLine() = 0;
virtual ILog* GetILog() = 0;
@@ -829,13 +828,6 @@ struct ISystem
virtual IRemoteConsole* GetIRemoteConsole() = 0;
virtual ISystemEventDispatcher* GetISystemEventDispatcher() = 0;
// Arguments:
// bValue - Set to true when running on a cheat protected server or a client that is connected to it (not used in singleplayer).
virtual void SetForceNonDevMode(bool bValue) = 0;
// Return Value:
// True when running on a cheat protected server or a client that is connected to it (not used in singleplayer).
virtual bool GetForceNonDevMode() const = 0;
virtual bool WasInDevMode() const = 0;
virtual bool IsDevMode() const = 0;
//////////////////////////////////////////////////////////////////////////
@@ -860,18 +852,6 @@ struct ISystem
// When ignore update sets to true, system will ignore and updates and render calls.
virtual void IgnoreUpdates(bool bIgnore) = 0;
// Summary:
// Sets the active process
// Arguments:
// process - A pointer to a class that implement the IProcess interface.
virtual void SetIProcess(IProcess* process) = 0;
// Summary:
// Gets the active process.
// Return Value:
// A pointer to the current active process.
virtual IProcess* GetIProcess() = 0;
// Return Value:
// True if system running in Test mode.
virtual bool IsTestMode() const = 0;
@@ -911,8 +891,6 @@ struct ISystem
// pCallback - 0 means normal LoadConfigVar behaviour is used
virtual void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = 0, bool warnIfMissing = true) = 0;
virtual ESystemConfigSpec GetMaxConfigSpec() const = 0;
//////////////////////////////////////////////////////////////////////////
// Summary:
@@ -937,10 +915,6 @@ struct ISystem
// Retrieves the perlin noise singleton instance.
virtual CPNoise3* GetNoiseGen() = 0;
// Summary:
// Retrieves system update counter.
virtual uint64 GetUpdateCounter() = 0;
//////////////////////////////////////////////////////////////////////////
// Error callback handling
@@ -973,13 +947,6 @@ struct ISystem
virtual void SetAssertVisible(bool bAssertVisble) = 0;
//////////////////////////////////////////////////////////////////////////
// Summary:
// Enable/Disable drawing the console
virtual void SetConsoleDrawEnabled(bool enabled) = 0;
// Enable/Disable drawing the UI
virtual void SetUIDrawEnabled(bool enabled) = 0;
// Summary:
// Get the index of the currently running O3DE application. (0 = first instance, 1 = second instance, etc)
virtual int GetApplicationInstance() = 0;
@@ -1027,12 +994,6 @@ struct ISystem
virtual bool IsSavingResourceList() const = 0;
#endif
// Summary:
// Gets the root window message handler function
// The returned pointer is platform-specific:
// For Windows OS, the pointer is of type WNDPROC
virtual void* GetRootWindowMessageHandler() = 0;
// Summary:
// Register a IWindowMessageHandler that will be informed about window messages
// The delivered messages are platform-specific
@@ -1042,10 +1003,6 @@ struct ISystem
// Unregister an IWindowMessageHandler that was previously registered using RegisterWindowMessageHandler
virtual void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
// Create an instance of a Local File IO object (which reads directly off the local filesystem, instead of,
// for example, reading from the network or a pack or USB or such.
virtual std::shared_ptr<AZ::IO::FileIOBase> CreateLocalFileIO() = 0;
////////////////////////////////////////////////////////////////////////////////////////////////
// EBus interface used to listen for cry system notifications
class CrySystemNotifications : public AZ::EBusTraits
+19 -67
View File
@@ -87,7 +87,7 @@ class XmlString
public:
XmlString() {};
XmlString(const char* str)
: AZStd::string(str) {};
: AZStd::string(str) {}
size_t GetAllocatedMemory() const
{
@@ -243,15 +243,6 @@ public:
// Removes child node.
virtual void removeChild(const XmlNodeRef& node) = 0;
// Summary:
// Inserts child node.
virtual void insertChild(int nIndex, const XmlNodeRef& node) = 0;
// Summary:
// Replaces a specified child with the passed one
// Not supported by all node implementations
virtual void replaceChild(int nIndex, const XmlNodeRef& fromNode) = 0;
// Summary:
// Removes all child nodes.
virtual void removeAllChilds() = 0;
@@ -283,13 +274,6 @@ public:
// Sets content of this node.
virtual void setContent(const char* str) = 0;
// Summary:
// Deep clone of this and all child xml nodes.
virtual XmlNodeRef clone() = 0;
// Summary:
// Returns line number for XML tag.
virtual int getLine() const = 0;
// Summary:
// Set line number in xml.
virtual void setLine(int line) = 0;
@@ -385,20 +369,6 @@ public:
}
#endif
// Summary:
// Copies children to this node from a given node.
// Children are reference copied (shallow copy) and the children's parent is NOT set to this
// node, but left with its original parent (which is still the parent)
virtual void shareChildren(const XmlNodeRef& fromNode) = 0;
// Summary:
// Removes child node at known position.
virtual void deleteChildAt(int nIndex) = 0;
// Summary:
// Returns XML of this node and sub nodes into tmpBuffer without XML checks (much faster)
virtual XmlString getXMLUnsafe(int level, [[maybe_unused]] char* tmpBuffer, [[maybe_unused]] uint32 sizeOfTmpBuffer) const { return getXML(level); }
// Notes:
// Save in small memory chunks.
virtual bool saveToFile(const char* fileName, size_t chunkSizeBytes, AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle) = 0;
@@ -413,28 +383,22 @@ public:
bool getAttr(const char* key, long& value) const
{
int v;
if (getAttr(key, v))
{
value = static_cast<long>(v);
return true;
}
else
if (!getAttr(key, v))
{
return false;
}
value = static_cast<long>(v);
return true;
}
bool getAttr(const char* key, unsigned long& value) const
{
int v;
if (getAttr(key, v))
{
value = static_cast<unsigned long>(v);
return true;
}
else
if (!getAttr(key, v))
{
return false;
}
value = static_cast<unsigned long>(v);
return true;
}
void setAttr(const char* key, unsigned long value) { setAttr(key, (unsigned int)value); };
void setAttr(const char* key, long value) { setAttr(key, (int)value); };
@@ -442,54 +406,42 @@ public:
bool getAttr(const char* key, unsigned short& value) const
{
int v;
if (getAttr(key, v))
{
value = static_cast<unsigned short>(v);
return true;
}
else
if (!getAttr(key, v))
{
return false;
}
value = static_cast<unsigned short>(v);
return true;
}
bool getAttr(const char* key, unsigned char& value) const
{
int v;
if (getAttr(key, v))
{
value = static_cast<unsigned char>(v);
return true;
}
else
if (!getAttr(key, v))
{
return false;
}
value = static_cast<unsigned char>(v);
return true;
}
bool getAttr(const char* key, short& value) const
{
int v;
if (getAttr(key, v))
{
value = static_cast<short>(v);
return true;
}
else
if (!getAttr(key, v))
{
return false;
}
value = static_cast<short>(v);
return true;
}
bool getAttr(const char* key, char& value) const
{
int v;
if (getAttr(key, v))
{
value = static_cast<char>(v);
return true;
}
else
if (!getAttr(key, v))
{
return false;
}
value = static_cast<char>(v);
return true;
}
//##@}
-12
View File
@@ -102,11 +102,6 @@ typedef float FLOAT;
#endif
#ifndef SAFE_RELEASE_FORCE
#define SAFE_RELEASE_FORCE(p) { if (p) { (p)->ReleaseForce(); (p) = NULL; } \
}
#endif
#define MAKEWORD(a, b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
#define MAKELONG(a, b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff))
@@ -462,13 +457,6 @@ inline int64 CryGetTicks()
return counter.QuadPart;
}
inline int64 CryGetTicksPerSec()
{
LARGE_INTEGER li;
QueryPerformanceFrequency(&li);
return li.QuadPart;
}
#endif //__cplusplus
inline int _CrtCheckMemory() { return 1; };
@@ -5,10 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CRYINCLUDE_CRYCOMMON_LINUX_WIN32WRAPPER_H
#define CRYINCLUDE_CRYCOMMON_LINUX_WIN32WRAPPER_H
#pragma once
#include <CryAssert.h>
@@ -326,57 +322,6 @@ inline uint32 GetTickCount()
#define _strlwr_s(BUF, SIZE) strlwr(BUF)
#define _strups strupr
typedef struct __finddata64_t
{
//!< atributes set by find request
unsigned int attrib; //!< attributes, only directory and readonly flag actually set
int64 time_create; //!< creation time, cannot parse under linux, last modification time is used instead (game does nowhere makes decision based on this values)
int64 time_access; //!< last access time
int64 time_write; //!< last modification time
int64 size; //!< file size (for a directory it will be the block size)
char name[256]; //!< file/directory name
private:
int m_LastIndex; //!< last index for findnext
char m_DirectoryName[260]; //!< directory name, needed when getting file attributes on the fly
char m_ToMatch[260]; //!< pattern to match with
DIR* m_Dir; //!< directory handle
std::vector<AZStd::string> m_Entries; //!< all file entries in the current directories
public:
inline __finddata64_t()
: attrib(0)
, time_create(0)
, time_access(0)
, time_write(0)
, size(0)
, m_LastIndex(-1)
, m_Dir(NULL)
{
memset(name, '0', 256);
}
~__finddata64_t();
//!< copies and retrieves the data for an actual match (to not waste any effort retrioeving data for unused files)
void CopyFoundData(const char* rMatchedFileName);
public:
//!< global _findfirst64 function using struct above, can't be a member function due to required semantic match
friend intptr_t _findfirst64(const char* pFileName, __finddata64_t* pFindData);
//!< global _findnext64 function using struct above, can't be a member function due to required semantic match
friend int _findnext64(intptr_t last, __finddata64_t* pFindData);
}__finddata64_t;
typedef struct _finddata_t
: public __finddata64_t
{}_finddata_t;//!< need inheritance since in many places it get used as struct _finddata_t
extern int _findnext64(intptr_t last, __finddata64_t* pFindData);
extern intptr_t _findfirst64(const char* pFileName, __finddata64_t* pFindData);
extern DWORD GetFileAttributesW(LPCWSTR lpFileName);
extern const bool GetFilenameNoCase(const char* file, char*, const bool cCreateNew = false);
extern BOOL GetUserName(LPSTR lpBuffer, LPDWORD nSize);
//error code stuff
@@ -646,8 +591,3 @@ inline unsigned long long _byteswap_uint64(unsigned long long input)
((input & 0x000000000000ff00ull) << 40) |
((input & 0x00000000000000ffull) << 56));
}
#endif // CRYINCLUDE_CRYCOMMON_LINUX_WIN32WRAPPER_H
// vim:ts=2
+1 -23
View File
@@ -52,7 +52,7 @@ public:
void Warning([[maybe_unused]] EValidatorModule module, [[maybe_unused]] EValidatorSeverity severity, [[maybe_unused]] int flags, [[maybe_unused]] const char* file, [[maybe_unused]] const char* format, ...) override {}
MOCK_METHOD3(ShowMessage,
int(const char* text, const char* caption, unsigned int uType));
void(const char* text, const char* caption, unsigned int uType));
MOCK_METHOD1(CheckLogVerbosity,
bool(int verbosity));
MOCK_METHOD0(GetILevelSystem,
@@ -75,12 +75,6 @@ public:
IRemoteConsole * ());
MOCK_METHOD0(GetISystemEventDispatcher,
ISystemEventDispatcher * ());
MOCK_METHOD1(SetForceNonDevMode,
void(bool bValue));
MOCK_CONST_METHOD0(GetForceNonDevMode,
bool());
MOCK_CONST_METHOD0(WasInDevMode,
bool());
MOCK_CONST_METHOD0(IsDevMode,
bool());
MOCK_METHOD3(CreateXmlNode,
@@ -93,10 +87,6 @@ public:
IXmlUtils * ());
MOCK_METHOD1(IgnoreUpdates,
void(bool bIgnore));
MOCK_METHOD1(SetIProcess,
void(IProcess * process));
MOCK_METHOD0(GetIProcess,
IProcess * ());
MOCK_CONST_METHOD0(IsTestMode,
bool());
MOCK_METHOD3(SetFrameProfiler,
@@ -115,8 +105,6 @@ public:
MOCK_METHOD3(LoadConfiguration,
void(const char*, ILoadConfigurationEntrySink*, bool));
MOCK_CONST_METHOD0(GetMaxConfigSpec,
ESystemConfigSpec());
MOCK_CONST_METHOD0(GetConfigPlatform,
ESystemConfigPlatform());
MOCK_METHOD1(SetConfigPlatform,
@@ -127,8 +115,6 @@ public:
ILocalizationManager * ());
MOCK_METHOD0(GetNoiseGen,
CPNoise3 * ());
MOCK_METHOD0(GetUpdateCounter,
uint64());
MOCK_METHOD1(RegisterErrorObserver,
bool(IErrorObserver * errorObserver));
MOCK_METHOD1(UnregisterErrorObserver,
@@ -139,10 +125,6 @@ public:
bool());
MOCK_METHOD1(SetAssertVisible,
void(bool bAssertVisble));
MOCK_METHOD1(SetConsoleDrawEnabled,
void(bool enabled));
MOCK_METHOD1(SetUIDrawEnabled,
void(bool enabled));
MOCK_METHOD0(GetApplicationInstance,
int());
MOCK_METHOD1(GetApplicationLogInstance,
@@ -167,14 +149,10 @@ public:
bool());
#endif
MOCK_METHOD0(GetRootWindowMessageHandler,
void*());
MOCK_METHOD1(RegisterWindowMessageHandler,
void(IWindowMessageHandler * pHandler));
MOCK_METHOD1(UnregisterWindowMessageHandler,
void(IWindowMessageHandler * pHandler));
MOCK_METHOD0(CreateLocalFileIO,
std::shared_ptr<AZ::IO::FileIOBase>());
MOCK_METHOD2(ForceMaxFps, void(bool, int));
};
-36
View File
@@ -1,36 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/containers/unordered_set.h>
//////////////////////////////////////////////////////////////////////////
//
// EBUS support for triggering necessary updates when IStatObj instances
// caches should be updated when 3D Engine events happen during level loads,
// shutting down the application, and so forth
//
//////////////////////////////////////////////////////////////////////////
class InstanceStatObjEvents
: public AZ::EBusTraits
{
public:
virtual ~InstanceStatObjEvents() = default;
// AZ::EBusTraits
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
using MutexType = AZStd::recursive_mutex;
virtual void ReleaseData()
{
}
};
using InstanceStatObjEventBus = AZ::EBus<InstanceStatObjEvents>;
+12 -523
View File
@@ -53,21 +53,8 @@
#include <mach/mach_host.h>
#endif
#if defined(ANDROID)
#define FIX_FILENAME_CASE 0 // everything is lower case on android
#elif defined(LINUX) || defined(APPLE)
#define FIX_FILENAME_CASE 1
#endif
#include <sys/time.h>
#if !defined(_RELEASE) || defined(_DEBUG)
#include <set>
unsigned int g_EnableMultipleAssert = 0;//set to something else than 0 if to enable already reported asserts
#endif
#if defined(LINUX) || defined(APPLE)
#include <sys/types.h>
#include <unistd.h>
@@ -81,106 +68,11 @@ unsigned int g_EnableMultipleAssert = 0;//set to something else than 0 if to ena
#if AZ_TRAIT_COMPILER_DEFINE_FS_ERRNO_TYPE
typedef int FS_ERRNO_TYPE;
#if AZ_TRAIT_COMPILER_DEFINE_FS_STAT_TYPE
typedef struct stat FS_STAT_TYPE;
#else
typedef struct stat64 FS_STAT_TYPE;
#endif
#include <mutex>
#elif AZ_TRAIT_COMPILER_DEFINE_FS_STAT_TYPE
#error cannot request AZ_TRAIT_COMPILER_DEFINE_FS_STAT_TYPE if AZ_TRAIT_COMPILER_DEFINE_FS_ERRNO_TYPE is zero
#endif
#if AZ_TRAIT_COMPILER_DEFINE_SASSERTDATA_TYPE && (!defined(_RELEASE) || defined(_DEBUG))
struct SAssertData
{
int line;
char fileName[256 - sizeof(int)];
const bool operator==(const SAssertData& crArg) const
{
return crArg.line == line && (strcmp(fileName, crArg.fileName) == 0);
}
const bool operator<(const SAssertData& crArg) const
{
if (line == crArg.line)
{
return strcmp(fileName, crArg.fileName) < 0;
}
else
{
return line < crArg.line;
}
}
SAssertData()
: line(-1){}
SAssertData(const int cLine, const char* cpFile)
: line(cLine)
{
azstrcpy(fileName, AZ_ARRAY_SIZE(fileName), cpFile);
}
SAssertData(const SAssertData& crAssertData)
{
memcpy((void*)this, &crAssertData, sizeof(SAssertData));
}
void operator=(const SAssertData& crAssertData)
{
memcpy((void*)this, &crAssertData, sizeof(SAssertData));
}
};
//#define OUTPUT_ASSERT_TO_FILE
void HandleAssert(const char* cpMessage, const char* cpFunc, const char* cpFile, const int cLine)
{
#if defined(OUTPUT_ASSERT_TO_FILE)
static FILE* pAssertLogFile = nullptr;
if (!pAssertLogFile)
{
azfopen(&pAssertLogFile, "Assert.log", "w+");
}
#endif
bool report = true;
static std::set<SAssertData> assertSet;
SAssertData assertData(cLine, cpFile);
if (!g_EnableMultipleAssert)
{
std::set<SAssertData>::const_iterator it = assertSet.find(assertData);
if (it != assertSet.end())
{
report = false;
}
else
{
assertSet.insert(assertData);
}
}
else
{
assertSet.insert(assertData);
}
if (report)
{
//added function to be able to place a breakpoint here or to print out to other consoles
printf("ASSERT: %s in %s (%s : %d)\n", cpMessage, cpFunc, cpFile, cLine);
#if defined(OUTPUT_ASSERT_TO_FILE)
if (pAssertLogFile)
{
fprintf(pAssertLogFile, "ASSERT: %s in %s (%s : %d)\n", cpMessage, cpFunc, cpFile, cLine);
fflush(pAssertLogFile);
}
#endif
}
}
#endif
bool IsBadReadPtr(void* ptr, unsigned int size)
{
//too complicated to really support it
@@ -232,9 +124,9 @@ char* strupr (char* str)
char* ltoa (long i, char* a, int radix)
{
if (a == NULL)
if (a == nullptr)
{
return NULL;
return nullptr;
}
strcpy (a, "0");
if (i && radix > 1 && radix < 37)
@@ -369,9 +261,9 @@ void _makepath(char* path, const char* drive, const char* dir, const char* filen
char* _ui64toa(unsigned long long value, char* str, int radix)
{
if (str == 0)
if (str == nullptr)
{
return 0;
return nullptr;
}
char buffer[65];
@@ -401,7 +293,7 @@ char* _ui64toa(unsigned long long value, char* str, int radix)
long long _atoi64(const char* str)
{
if (str == 0)
if (str == nullptr)
{
return -1;
}
@@ -550,22 +442,6 @@ void _splitpath(const char* inpath, char* drv, char* dir, char* fname, char* ext
}
}
//////////////////////////////////////////////////////////////////////////
int memicmp(LPCSTR s1, LPCSTR s2, DWORD len)
{
int ret = 0;
while (len--)
{
if ((ret = tolower(*s1) - tolower(*s2)))
{
break;
}
s1++;
s2++;
}
return ret;
}
//-----------------------------------------other stuff-------------------------------------------------------------------
void GlobalMemoryStatus(LPMEMORYSTATUS lpmem)
@@ -697,7 +573,7 @@ static void NormalizeTimeFields(short* FieldToNormalize, short* CarryField, int
*CarryField = (short) (*CarryField + 1);
}
bool TimeFieldsToTime(PTIME_FIELDS tfTimeFields, PLARGE_INTEGER Time)
static bool TimeFieldsToTime(PTIME_FIELDS tfTimeFields, PLARGE_INTEGER Time)
{
#define SECSPERMIN 60
#define MINSPERHOUR 60
@@ -775,119 +651,6 @@ BOOL SystemTimeToFileTime(const SYSTEMTIME* syst, LPFILETIME ft)
return TRUE;
}
void adaptFilenameToLinux(AZStd::string& rAdjustedFilename)
{
//first replace all \\ by /
AZStd::string::size_type loc = 0;
while ((loc = rAdjustedFilename.find("\\", loc)) != AZStd::string::npos)
{
rAdjustedFilename.replace(loc, 1, "/");
}
loc = 0;
//remove /./
while ((loc = rAdjustedFilename.find("/./", loc)) != AZStd::string::npos)
{
rAdjustedFilename.replace(loc, 3, "/");
}
}
void replaceDoublePathFilename(char* szFileName)
{
//replace "\.\" by "\"
AZStd::string s(szFileName);
AZStd::string::size_type loc = 0;
//remove /./
while ((loc = s.find("/./", loc)) != AZStd::string::npos)
{
s.replace(loc, 3, "/");
}
loc = 0;
//remove "\.\"
while ((loc = s.find("\\.\\", loc)) != AZStd::string::npos)
{
s.replace(loc, 3, "\\");
}
azstrcpy((char*)szFileName, AZ_MAX_PATH_LEN, s.c_str());
}
#if FIX_FILENAME_CASE
static bool FixOnePathElement(char* path)
{
if (*path == '\0')
{
return true;
}
if ((path[0] == '/') && (path[1] == '\0'))
{
return true; // root dir always exists.
}
if (strchr(path, '*') || strchr(path, '?'))
{
return true; // wildcard...stop correcting path.
}
struct stat statbuf;
if (stat(path, &statbuf) != -1) // current case exists.
{
return true;
}
char* name = path;
char* ptr = strrchr(path, '/');
if (ptr)
{
name = ptr + 1;
*ptr = '\0';
}
if (*name == '\0') // trailing '/' ?
{
*ptr = '/';
return true;
}
const char* parent;
if (ptr == path)
{
parent = "/";
}
else if (ptr == NULL)
{
parent = ".";
}
else
{
parent = path;
}
DIR* dirp = opendir(parent);
if (ptr)
{
*ptr = '/';
}
if (dirp == NULL)
{
return false;
}
struct dirent* dent;
bool found = false;
while ((dent = readdir(dirp)) != NULL)
{
if (strcasecmp(dent->d_name, name) == 0)
{
azstrcpy(name, AZ_MAX_PATH_LEN, dent->d_name);
found = true;
break;
}
}
closedir(dirp);
return found;
}
#endif
#define Int32x32To64(a, b) ((uint64)((uint64)(a)) * (uint64)((uint64)(b)))
//////////////////////////////////////////////////////////////////////////
@@ -904,24 +667,14 @@ threadID GetCurrentThreadId()
}
#endif
#include <chrono>
#include <thread>
//////////////////////////////////////////////////////////////////////////
DWORD Sleep(DWORD dwMilliseconds)
{
#if defined(LINUX) || defined(APPLE)
timespec req;
timespec rem;
memset(&req, 0, sizeof(req));
memset(&rem, 0, sizeof(rem));
time_t sec = (int)(dwMilliseconds / 1000);
req.tv_sec = sec;
req.tv_nsec = (dwMilliseconds - (sec * 1000)) * 1000000L;
if (nanosleep(&req, &rem) == -1)
{
nanosleep(&rem, 0);
}
std::this_thread::sleep_for(std::chrono::milliseconds(dwMilliseconds));
return 0;
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(AZ_RESTRICTED_PLATFORM)
@@ -960,7 +713,7 @@ DWORD Sleep(DWORD dwMilliseconds)
}
//////////////////////////////////////////////////////////////////////////
DWORD SleepEx(DWORD dwMilliseconds, BOOL bAlertable)
DWORD SleepEx(DWORD dwMilliseconds, BOOL /*bAlertable*/)
{
//TODO: implement
// CRY_ASSERT_MESSAGE(0, "SleepEx not implemented yet");
@@ -1006,7 +759,7 @@ void CrySleep(unsigned int dwMilliseconds)
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
void CryMessageBox(const char* lpText, const char* lpCaption, [[maybe_unused]] unsigned int uType)
{
#ifdef WIN32
# error WIN32 is defined in WinBase.cpp (it is a non-Windows file)
@@ -1087,63 +840,8 @@ int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
CFRelease(strText);
}
if (kResult == kCFUserNotificationDefaultResponse)
{
switch (uType & 0xf)
{
case MB_OK:
case MB_OKCANCEL:
default:
return IDOK;
case MB_ABORTRETRYIGNORE:
return IDABORT;
case MB_YESNOCANCEL:
case MB_YESNO:
return IDYES;
case MB_RETRYCANCEL:
return IDRETRY;
case MB_CANCELTRYCONTINUE:
return IDCANCEL;
}
}
else if (kResult == kCFUserNotificationAlternateResponse)
{
switch (uType & 0xf)
{
case MB_OKCANCEL:
case MB_RETRYCANCEL:
return IDCANCEL;
case MB_ABORTRETRYIGNORE:
return IDRETRY;
case MB_YESNOCANCEL:
case MB_YESNO:
return IDNO;
case MB_CANCELTRYCONTINUE:
return IDTRYAGAIN;
default:
assert(false);
return IDCANCEL;
}
}
else if (kResult == kCFUserNotificationOtherResponse)
{
switch (uType & 0xf)
{
case MB_ABORTRETRYIGNORE:
return IDIGNORE;
case MB_YESNOCANCEL:
return IDCANCEL;
case MB_CANCELTRYCONTINUE:
return IDCONTINUE;
default:
assert(false);
return IDCANCEL;
}
}
return 0;
#else
printf("Messagebox: cap: %s text:%s\n", lpCaption ? lpCaption : " ", lpText ? lpText : " ");
return 0;
#endif
}
@@ -1171,21 +869,6 @@ DLL_EXPORT void OutputDebugString(const char* outputString)
// This code does not have a long life span and will be replaced soon
#if defined(APPLE) || defined(LINUX) || defined(DEFINE_LEGACY_CRY_FILE_OPERATIONS)
typedef DIR* FS_DIR_TYPE;
typedef dirent FS_DIRENT_TYPE;
static const FS_ERRNO_TYPE FS_ENOENT = ENOENT;
static const FS_DIR_TYPE FS_DIR_NULL = NULL;
typedef int FS_ERRNO_TYPE;
#if defined(APPLE)
typedef struct stat FS_STAT_TYPE;
#else
typedef struct stat64 FS_STAT_TYPE;
#endif
#include <mutex>
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
{
//TODO: implement
@@ -1194,201 +877,7 @@ bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
}
ILINE void FS_OPEN(const char* szFileName, int iFlags, int& iFileDesc, mode_t uMode, FS_ERRNO_TYPE& rErr)
{
rErr = ((iFileDesc = open(szFileName, iFlags, uMode)) != -1) ? 0 : errno;
}
ILINE void FS_CLOSE(int iFileDesc, FS_ERRNO_TYPE& rErr)
{
rErr = close(iFileDesc) != -1 ? 0 : errno;
}
ILINE void FS_CLOSE_NOERR(int iFileDesc)
{
close(iFileDesc);
}
ILINE void FS_OPENDIR(const char* szDirName, FS_DIR_TYPE& pDir, FS_ERRNO_TYPE& rErr)
{
rErr = (pDir = opendir(szDirName)) != NULL ? 0 : errno;
}
ILINE void FS_READDIR(FS_DIR_TYPE pDir, FS_DIRENT_TYPE& kEnt, uint64_t& uEntSize, FS_ERRNO_TYPE& rErr)
{
errno = 0; // errno is used to determine if readdir succeeds after
FS_DIRENT_TYPE* pDirent(readdir(pDir));
if (pDirent == NULL)
{
uEntSize = 0;
rErr = (errno == FS_ENOENT) ? 0 : errno;
}
else
{
kEnt = *pDirent;
uEntSize = static_cast<uint64_t>(sizeof(FS_DIRENT_TYPE));
rErr = 0;
}
}
ILINE void FS_STAT(const char* szFileName, FS_STAT_TYPE& kStat, FS_ERRNO_TYPE& rErr)
{
#if defined(APPLE)
rErr = stat(szFileName, &kStat) != -1 ? 0 : errno;
#else
rErr = stat64(szFileName, &kStat) != -1 ? 0 : errno;
#endif
}
ILINE void FS_FSTAT(int iFileDesc, FS_STAT_TYPE& kStat, FS_ERRNO_TYPE& rErr)
{
#if defined(APPLE)
rErr = fstat(iFileDesc, &kStat) != -1 ? 0 : errno;
#else
rErr = fstat64(iFileDesc, &kStat) != -1 ? 0 : errno;
#endif
}
ILINE void FS_CLOSEDIR(FS_DIR_TYPE pDir, FS_ERRNO_TYPE& rErr)
{
errno = 0;
rErr = closedir(pDir) == 0 ? 0 : errno;
}
ILINE void FS_CLOSEDIR_NOERR(FS_DIR_TYPE pDir)
{
closedir(pDir);
}
const bool GetFilenameNoCase
(
const char* file,
char* pAdjustedFilename,
const bool cCreateNew
)
{
assert(file);
assert(pAdjustedFilename);
azstrcpy(pAdjustedFilename, AZ_MAX_PATH_LEN, file);
// Fix the dirname case.
const int cLen = strlen(file);
for (int i = 0; i < cLen; ++i)
{
if (pAdjustedFilename[i] == '\\')
{
pAdjustedFilename[i] = '/';
}
}
char* slash;
const char* dirname;
char* name;
if ((pAdjustedFilename) == (char*)-1)
{
return false;
}
slash = strrchr(pAdjustedFilename, '/');
if (slash)
{
dirname = pAdjustedFilename;
name = slash + 1;
*slash = 0;
}
else
{
dirname = ".";
name = pAdjustedFilename;
}
#if !defined(LINUX) && !defined(APPLE) && !defined(DEFINE_SKIP_WILDCARD_CHECK) // fix the parent path anyhow.
// Check for wildcards. We'll always return true if the specified filename is
// a wildcard pattern.
if (strchr(name, '*') || strchr(name, '?'))
{
if (slash)
{
*slash = '/';
}
return true;
}
#endif
// Scan for the file.
if (slash)
{
*slash = '/';
}
#if FIX_FILENAME_CASE
char* path = pAdjustedFilename;
char* sep;
while ((sep = strchr(path, '/')) != NULL)
{
*sep = '\0';
const bool exists = FixOnePathElement(pAdjustedFilename);
*sep = '/';
if (!exists)
{
return false;
}
path = sep + 1;
}
if (!FixOnePathElement(pAdjustedFilename)) // catch last filename.
{
return false;
}
#else
for (char* c = pAdjustedFilename; *c; ++c)
{
*c = tolower(*c);
}
#endif
return true;
}
DWORD GetFileAttributes(LPCWSTR lpFileNameW)
{
AZStd::string lpFileName;
AZStd::to_string(lpFileName, lpFileNameW);
struct stat fileStats;
const int success = stat(lpFileName.c_str(), &fileStats);
if (success == -1)
{
char adjustedFilename[MAX_PATH];
GetFilenameNoCase(lpFileName.c_str(), adjustedFilename);
if (stat(adjustedFilename, &fileStats) == -1)
{
return (DWORD)INVALID_FILE_ATTRIBUTES;
}
}
DWORD ret = 0;
const int acc = (fileStats.st_mode & S_IWRITE);
if (acc != 0)
{
if (S_ISDIR(fileStats.st_mode) != 0)
{
ret |= FILE_ATTRIBUTE_DIRECTORY;
}
}
return (ret == 0) ? FILE_ATTRIBUTE_NORMAL : ret;//return file attribute normal as the default value, must only be set if no other attributes have been found
}
__finddata64_t::~__finddata64_t()
{
if (m_Dir != FS_DIR_NULL)
{
FS_CLOSEDIR_NOERR(m_Dir);
m_Dir = FS_DIR_NULL;
}
}
#endif //defined(APPLE) || defined(LINUX)
#endif // AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS
@@ -11,9 +11,7 @@ set(FILES
IAudioSystem.h
ICmdLine.h
IConsole.h
IEntityRenderState.h
IFont.h
IFunctorBase.h
IGem.h
IIndexedMesh.h
ILevelSystem.h
@@ -30,8 +28,6 @@ set(FILES
ISerialize.h
IShader.h
ISplines.h
IStatObj.h
StatObjBus.h
ISystem.h
ITexture.h
IValidator.h
+1 -1
View File
@@ -249,7 +249,7 @@ ILINE DestinationType alias_cast(SourceType pPtr)
// Mostly used only for debugging!
//////////////////////////////////////////////////////////////////////////
void CrySleep(unsigned int dwMilliseconds);
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType);
void CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType);
//---------------------------------------------------------------------------
// Useful function to clean the structure.
+4 -10
View File
@@ -178,21 +178,21 @@ void CrySleep(unsigned int dwMilliseconds)
}
//////////////////////////////////////////////////////////////////////////
int CryMessageBox([[maybe_unused]] const char* lpText, [[maybe_unused]] const char* lpCaption, [[maybe_unused]] unsigned int uType)
void CryMessageBox([[maybe_unused]] const char* lpText, [[maybe_unused]] const char* lpCaption, [[maybe_unused]] unsigned int uType)
{
#ifdef WIN32
ICVar* const pCVar = gEnv && gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : NULL;
if ((pCVar && pCVar->GetIVal() != 0) || (gEnv && gEnv->bNoAssertDialog))
{
return 0;
return;
}
AZStd::wstring lpTextW;
AZStd::to_wstring(lpTextW, lpText);
AZStd::wstring lpCaptionW;
AZStd::to_wstring(lpCaptionW, lpCaption);
return MessageBoxW(NULL, lpTextW.c_str(), lpCaptionW.c_str(), uType);
MessageBoxW(NULL, lpTextW.c_str(), lpCaptionW.c_str(), uType);
#else
return 0;
return;
#endif
}
@@ -281,12 +281,6 @@ int64 CryGetTicks()
return li.QuadPart;
}
int64 CryGetTicksPerSec()
{
LARGE_INTEGER li;
QueryPerformanceFrequency(&li);
return li.QuadPart;
}
#endif
@@ -1027,8 +1027,6 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
// key CRC
uint32 keyCRC;
size_t nMemSize = 0;
for (;; )
{
int nRowIndex = -1;
@@ -1509,30 +1507,6 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
pEntry->flags |= SLocalizedStringEntry::IS_INTERCEPTED;
}
nMemSize += sizeof(*pEntry) + pEntry->sCharacterName.length() * sizeof(char);
if (m_cvarLocalizationEncode == 0)
{
//Note that this isn't accurate if we're using encoding/compression to shrink the string as the encoding step hasn't happened yet
if (pEntry->TranslatedText.psUtf8Uncompressed)
{
nMemSize += pEntry->TranslatedText.psUtf8Uncompressed->length() * sizeof(char);
}
}
if (pEntry->pEditorExtension != NULL)
{
nMemSize += pEntry->pEditorExtension->sKey.length()
+ pEntry->pEditorExtension->sOriginalActorLine.length()
+ pEntry->pEditorExtension->sUtf8TranslatedActorLine.length() * sizeof(char)
+ pEntry->pEditorExtension->sOriginalText.length()
+ pEntry->pEditorExtension->sOriginalCharacterName.length();
}
// Compression Preparation
//unsigned int nSourceSize = pEntry->swTranslatedText.length()*sizeof(wchar_t);
//if (nSourceSize)
// int zResult = Compress(pDest, nDestLen, pEntry->swTranslatedText.c_str(), nSourceSize);
AddLocalizedString(m_pLanguage, pEntry, keyCRC);
}
@@ -1540,10 +1514,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
{
pEncoder->Finalize();
{
uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
//uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
size_t uncompressedTotal = 0, compressedTotal = 0;
for (size_t stringToCompress = startOfStringsToCompress; stringToCompress < m_pLanguage->m_vLocalizedStrings.size(); stringToCompress++)
{
SLocalizedStringEntry* pStringToCompress = m_pLanguage->m_vLocalizedStrings[stringToCompress];
@@ -1551,30 +1522,19 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
{
size_t compBufSize = COMPRESSION_FIXED_BUFFER_LENGTH;
memset(compressionBuffer, 0, COMPRESSION_FIXED_BUFFER_LENGTH);
//CryLogAlways("%u Compressing %s (%p)", stringToCompress, pStringToCompress->szCompressedTranslatedText, pStringToCompress->szCompressedTranslatedText);
size_t inputStringLength = strlen((const char*)(pStringToCompress->TranslatedText.szCompressed));
pEncoder->CompressInput(pStringToCompress->TranslatedText.szCompressed, inputStringLength, compressionBuffer, &compBufSize);
compressionBuffer[compBufSize] = 0;
pStringToCompress->huffmanTreeIndex = iEncoder;
pEncoder->AddRef();
//CryLogAlways("Compressed %s (%u) to %s (%u)", pStringToCompress->szCompressedTranslatedText, strlen((const char*)pStringToCompress->szCompressedTranslatedText), compressionBuffer, compBufSize);
uncompressedTotal += inputStringLength;
compressedTotal += compBufSize;
uint8* szCompressedString = new uint8[compBufSize];
SAFE_DELETE_ARRAY(pStringToCompress->TranslatedText.szCompressed);
memcpy(szCompressedString, compressionBuffer, compBufSize);
pStringToCompress->TranslatedText.szCompressed = szCompressedString;
//Testing code
//memset( decompressionBuffer, 0, COMPRESSION_FIXED_BUFFER_LENGTH );
//size_t decompBufSize = pEncoder->UncompressInput(compressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH, decompressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH);
//CryLogAlways("Decompressed %s (%u) to %s (%u)", compressionBuffer, compBufSize, decompressionBuffer, decompBufSize);
}
}
//CryLogAlways("[LOC PROFILING] %s, %u, Uncompressed %u, Compressed %u", sFileName, m_pLanguage->m_vLocalizedStrings.size() - startOfStringsToCompress, uncompressedTotal, compressedTotal);
}
}
pXmlTableReader->Release();
@@ -1584,11 +1544,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8 nTagID, bool bReload)
{
if (!sFileName)
{
return false;
}
if (!m_pLanguage)
if (!sFileName|| !m_pLanguage)
{
return false;
}
@@ -1731,7 +1687,6 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
}
{
uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH] = {};
size_t uncompressedTotal = 0, compressedTotal = 0;
for (size_t stringToCompress = startOfStringsToCompress; stringToCompress < m_pLanguage->m_vLocalizedStrings.size(); stringToCompress++)
{
SLocalizedStringEntry* pStringToCompress = m_pLanguage->m_vLocalizedStrings[stringToCompress];
@@ -1744,8 +1699,6 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
compressionBuffer[compBufSize] = 0;
pStringToCompress->huffmanTreeIndex = iEncoder;
pEncoder->AddRef();
uncompressedTotal += inputStringLength;
compressedTotal += compBufSize;
uint8* szCompressedString = new uint8[compBufSize];
SAFE_DELETE_ARRAY(pStringToCompress->TranslatedText.szCompressed);
memcpy(szCompressedString, compressionBuffer, compBufSize);
@@ -1810,7 +1763,7 @@ bool CLocalizedStringsManager::LocalizeString_s(const AZStd::string& sString, AZ
bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish)
{
assert (m_pLanguage);
if (m_pLanguage == 0)
if (m_pLanguage == nullptr)
{
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "LocalizeString: No language set.");
outLocalizedString.assign(pStr, pStr + len);
+10 -161
View File
@@ -209,20 +209,7 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_env.pSharedEnvironment = pSharedEnvironment;
//////////////////////////////////////////////////////////////////////////
m_pIFont = NULL;
m_pIFontUi = NULL;
m_rWidth = NULL;
m_rHeight = NULL;
m_rWidthAndHeightAsFractionOfScreenSize = NULL;
m_rMaxWidth = NULL;
m_rMaxHeight = NULL;
m_rColorBits = NULL;
m_rDepthBits = NULL;
m_cvSSInfo = NULL;
m_rStencilBits = NULL;
m_rFullscreen = NULL;
m_sysNoUpdate = NULL;
m_pProcess = NULL;
m_pCmdLine = NULL;
m_pLevelSystem = NULL;
m_pLocalizationManager = NULL;
@@ -230,18 +217,9 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_2
#include AZ_RESTRICTED_FILE(System_cpp)
#endif
m_sys_min_step = 0;
m_sys_max_step = 0;
m_cvAIUpdate = NULL;
m_pUserCallback = NULL;
m_sys_memory_debug = NULL;
m_sysWarnings = NULL;
m_sysKeyboard = NULL;
m_sys_firstlaunch = NULL;
m_sys_enable_budgetmonitoring = NULL;
m_sys_preload = NULL;
// m_sys_filecache = NULL;
m_gpu_particle_physics = NULL;
@@ -256,22 +234,11 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_bNoCrashDialog = false;
m_bNoErrorReportWindow = false;
m_pCVarQuit = NULL;
m_bForceNonDevMode = false;
m_bWasInDevMode = false;
m_bInDevMode = false;
m_bGameFolderWritable = false;
m_bDrawConsole = true;
m_bDrawUI = true;
m_nServerConfigSpec = CONFIG_VERYHIGH_SPEC;
m_nMaxConfigSpec = CONFIG_VERYHIGH_SPEC;
m_bPaused = false;
m_bNoUpdate = false;
m_nUpdateCounter = 0;
m_iApplicationInstance = -1;
@@ -293,7 +260,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
m_bHasRenderedErrorMessage = false;
m_pDataProbe = nullptr;
#if AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER
RegisterWindowMessageHandler(this);
#endif
@@ -339,48 +305,15 @@ void CSystem::Release()
delete this;
}
//////////////////////////////////////////////////////////////////////////
void CSystem::FreeLib(AZStd::unique_ptr<AZ::DynamicModuleHandle>& hLibModule)
{
if (hLibModule)
{
if (hLibModule->IsLoaded())
{
hLibModule->Unload();
}
hLibModule.release();
}
}
//////////////////////////////////////////////////////////////////////////
IRemoteConsole* CSystem::GetIRemoteConsole()
{
return CRemoteConsole::GetInst();
}
//////////////////////////////////////////////////////////////////////////
void CSystem::SetForceNonDevMode(const bool bValue)
{
m_bForceNonDevMode = bValue;
if (bValue)
{
SetDevMode(false);
}
}
//////////////////////////////////////////////////////////////////////////
bool CSystem::GetForceNonDevMode() const
{
return m_bForceNonDevMode;
}
//////////////////////////////////////////////////////////////////////////
void CSystem::SetDevMode(bool bEnable)
{
if (bEnable)
{
m_bWasInDevMode = true;
}
m_bInDevMode = bEnable;
}
@@ -464,31 +397,13 @@ void CSystem::ShutDown()
// Release console variables.
SAFE_RELEASE(m_pCVarQuit);
SAFE_RELEASE(m_rWidth);
SAFE_RELEASE(m_rHeight);
SAFE_RELEASE(m_rWidthAndHeightAsFractionOfScreenSize);
SAFE_RELEASE(m_rMaxWidth);
SAFE_RELEASE(m_rMaxHeight);
SAFE_RELEASE(m_rColorBits);
SAFE_RELEASE(m_rDepthBits);
SAFE_RELEASE(m_cvSSInfo);
SAFE_RELEASE(m_rStencilBits);
SAFE_RELEASE(m_rFullscreen);
SAFE_RELEASE(m_sysWarnings);
SAFE_RELEASE(m_sysKeyboard);
SAFE_RELEASE(m_sys_firstlaunch);
SAFE_RELEASE(m_sys_enable_budgetmonitoring);
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_3
#include AZ_RESTRICTED_FILE(System_cpp)
#endif
SAFE_RELEASE(m_sys_min_step);
SAFE_RELEASE(m_sys_max_step);
SAFE_DELETE(m_pLocalizationManager);
delete m_pCmdLine;
@@ -556,14 +471,6 @@ bool CSystem::IsQuitting() const
return wasExitMainLoopRequested;
}
//////////////////////////////////////////////////////////////////////////
void CSystem::SetIProcess(IProcess* process)
{
m_pProcess = process;
//if (m_pProcess)
//m_pProcess->SetPMessage("");
}
//////////////////////////////////////////////////////////////////////////
ISystem* CSystem::GetCrySystem()
{
@@ -659,7 +566,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
AZ_TRACE_METHOD();
m_nUpdateCounter++;
#ifndef EXCLUDE_UPDATE_ON_CONSOLE
if (m_pUserCallback)
{
@@ -952,13 +858,16 @@ void CSystem::Warning(EValidatorModule module, EValidatorSeverity severity, int
}
//////////////////////////////////////////////////////////////////////////
int CSystem::ShowMessage(const char* text, const char* caption, unsigned int uType)
void CSystem::ShowMessage(const char* text, const char* caption, unsigned int uType)
{
if (m_pUserCallback)
{
return m_pUserCallback->ShowMessage(text, caption, uType);
m_pUserCallback->ShowMessage(text, caption, uType);
}
else
{
CryMessageBox(text, caption, uType);
}
return CryMessageBox(text, caption, uType);
}
inline const char* ValidatorModuleToString(EValidatorModule module)
@@ -1035,22 +944,18 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int
default:
break;
}
char szBuffer[MAX_WARNING_LENGTH];
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, format, args);
AZStd::fixed_string<MAX_WARNING_LENGTH> fmt;
vsnprintf_s(fmt.data(), MAX_WARNING_LENGTH, MAX_WARNING_LENGTH - 1, format, args);
if (file && *file)
{
AZStd::fixed_string<MAX_WARNING_LENGTH> fmt = szBuffer;
fmt += " [File=";
fmt += file;
fmt += "]";
m_env.pLog->LogWithType(ltype, flags | VALIDATOR_FLAG_SKIP_VALIDATOR, "%s", fmt.c_str());
}
else
{
m_env.pLog->LogWithType(ltype, flags | VALIDATOR_FLAG_SKIP_VALIDATOR, "%s", szBuffer);
}
m_env.pLog->LogWithType(ltype, flags | VALIDATOR_FLAG_SKIP_VALIDATOR, "%s", fmt.c_str());
if (bDbgBreak && g_cvars.sys_error_debugbreak)
{
@@ -1135,34 +1040,6 @@ ILocalizationManager* CSystem::GetLocalizationManager()
return m_pLocalizationManager;
}
//////////////////////////////////////////////////////////////////////////
void CSystem::debug_GetCallStackRaw(void** callstack, uint32& callstackLength)
{
memset(callstack, 0, sizeof(void*) * callstackLength);
#if !defined(ANDROID)
callstackLength = 0;
#endif
#if AZ_LEGACY_CRYSYSTEM_TRAIT_CAPTURESTACK
uint32 nNumStackFramesToSkip = 1;
uint32 callstackCapacity = callstackLength;
if (callstackCapacity > 0x40)
{
callstackCapacity = 0x40;
}
callstackLength = RtlCaptureStackBackTrace(nNumStackFramesToSkip, callstackCapacity, callstack, NULL);
#elif defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_7
#include AZ_RESTRICTED_FILE(System_cpp)
#endif
if (callstackLength > 0)
{
std::reverse(callstack, callstack + callstackLength);
}
}
//////////////////////////////////////////////////////////////////////////
void CSystem::ExecuteCommandLine(bool deferred)
{
@@ -1201,12 +1078,6 @@ void CSystem::ExecuteCommandLine(bool deferred)
//gEnv->pConsole->ExecuteString("sys_RestoreSpec test*"); // to get useful debugging information about current spec settings to the log file
}
//////////////////////////////////////////////////////////////////////////
ESystemConfigSpec CSystem::GetMaxConfigSpec() const
{
return m_nMaxConfigSpec;
}
//////////////////////////////////////////////////////////////////////////
void CSystem::SetConfigPlatform(const ESystemConfigPlatform platform)
{
@@ -1401,23 +1272,6 @@ void CSystem::SetSystemGlobalState(const ESystemGlobalState systemGlobalState)
#endif // if AZ_LOADSCREENCOMPONENT_ENABLED
}
//////////////////////////////////////////////////////////////////////////
void* CSystem::GetRootWindowMessageHandler()
{
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_9
#include AZ_RESTRICTED_FILE(System_cpp)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN32)
return reinterpret_cast<void*>(&WndProc);
#else
CRY_ASSERT(false && "This platform does not support window message handlers");
return NULL;
#endif
}
//////////////////////////////////////////////////////////////////////////
void CSystem::RegisterWindowMessageHandler(IWindowMessageHandler* pHandler)
{
@@ -1601,11 +1455,6 @@ bool CSystem::HandleMessage([[maybe_unused]] HWND hWnd, UINT uMsg, WPARAM wParam
#endif
std::shared_ptr<AZ::IO::FileIOBase> CSystem::CreateLocalFileIO()
{
return std::make_shared<AZ::IO::LocalFileIO>();
}
ILevelSystem* CSystem::GetILevelSystem()
{
return m_pLevelSystem;
+15 -138
View File
@@ -78,9 +78,6 @@ class CWatchdogThread;
#if defined(WIN32)
#define AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER 1
#endif
#if defined(WIN64) || defined(WIN32)
#define AZ_LEGACY_CRYSYSTEM_TRAIT_CAPTURESTACK 1
#endif
//////////////////////////////////////////////////////////////////////////
@@ -98,30 +95,12 @@ namespace Audio
struct IAudioSystem;
struct IMusicSystem;
} // namespace Audio
struct IDataProbe;
#define PHSYICS_OBJECT_ENTITY 0
#define MAX_STREAMING_POOL_INDEX 6
#define MAX_THREAD_POOL_INDEX 6
struct SSystemCVars
{
int sys_streaming_requests_grouping_time_period;
int sys_streaming_sleep;
int sys_streaming_memory_budget;
int sys_streaming_max_finalize_per_frame;
float sys_streaming_max_bandwidth;
int sys_streaming_cpu;
int sys_streaming_cpu_worker;
int sys_streaming_debug;
int sys_streaming_resetstats;
int sys_streaming_debug_filter;
float sys_streaming_debug_filter_min_time;
int sys_streaming_use_optical_drive_thread;
ICVar* sys_streaming_debug_filter_file_name;
ICVar* sys_localization_folder;
int sys_streaming_in_blocks;
int sys_float_exceptions;
int sys_no_crash_dialog;
@@ -129,33 +108,16 @@ struct SSystemCVars
int sys_dump_aux_threads;
int sys_WER;
int sys_dump_type;
int sys_ai;
int sys_entitysystem;
int sys_trackview;
float sys_update_profile_time;
int sys_limit_phys_thread_count;
int sys_MaxFPS;
float sys_maxTimeStepForMovieSystem;
int sys_force_installtohdd_mode;
int sys_report_files_not_found_in_paks = 0;
#ifdef USE_HTTP_WEBSOCKETS
int sys_simple_http_base_port;
#endif
int sys_asserts;
int sys_error_debugbreak;
int sys_FilesystemCaseSensitivity;
AZ::IO::ArchiveVars archiveVars;
#if defined(WIN32)
int sys_display_threads;
#elif defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEM_H_SECTION_2
#include AZ_RESTRICTED_FILE(System_h)
#endif
};
extern SSystemCVars g_cvars;
@@ -239,9 +201,8 @@ public:
//////////////////////////////////////////////////////////////////////////
// retrieves the perlin noise singleton instance
CPNoise3* GetNoiseGen() override;
uint64 GetUpdateCounter() override { return m_nUpdateCounter; };
void DetectGameFolderAccessRights();
void DetectGameFolderAccessRights();
void ExecuteCommandLine(bool deferred=true) override;
@@ -256,9 +217,6 @@ public:
void IgnoreUpdates(bool bIgnore) override { m_bIgnoreUpdates = bIgnore; };
void SetIProcess(IProcess* process) override;
IProcess* GetIProcess() override{ return m_pProcess; }
bool IsTestMode() const override { return m_bTestMode; }
//@}
@@ -269,7 +227,7 @@ public:
// Validator Warning.
void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args) override;
void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...) override;
int ShowMessage(const char* text, const char* caption, unsigned int uType) override;
void ShowMessage(const char* text, const char* caption, unsigned int uType) override;
bool CheckLogVerbosity(int verbosity) override;
//! Return pointer to user defined callback.
@@ -278,7 +236,6 @@ public:
//////////////////////////////////////////////////////////////////////////
void SaveConfiguration() override;
void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = nullptr, bool warnIfMissing = true) override;
ESystemConfigSpec GetMaxConfigSpec() const override;
ESystemConfigPlatform GetConfigPlatform() const override;
void SetConfigPlatform(ESystemConfigPlatform platform) override;
//////////////////////////////////////////////////////////////////////////
@@ -288,9 +245,6 @@ public:
ILocalizationManager* GetLocalizationManager() override;
void debug_GetCallStack(const char** pFunctions, int& nCount) override;
void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0) override;
// Get the current callstack in raw address form (more lightweight than the above functions)
// static as memReplay needs it before CSystem has been setup - expose a ISystem interface to this function if you need it outside CrySystem
static void debug_GetCallStackRaw(void** callstack, uint32& callstackLength);
public:
#if !defined(RELEASE)
@@ -300,7 +254,6 @@ public:
#if defined(WIN32)
friend LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
#endif
void* GetRootWindowMessageHandler() override;
void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler) override;
void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) override;
@@ -330,8 +283,6 @@ private:
void CreateSystemVars();
void CreateAudioVars();
void FreeLib(AZStd::unique_ptr<AZ::DynamicModuleHandle>& hLibModule);
void QueryVersionInfo();
void LogVersion();
void LogBuildInfo();
@@ -341,7 +292,6 @@ private:
static void SystemVersionChanged(ICVar* pCVar);
#endif // #ifndef _RELEASE
bool ReLaunchMediaCenter();
void UpdateAudioSystems();
void AddCVarGroupDirectory(const AZStd::string& sPath) override;
@@ -357,14 +307,7 @@ public:
void EnableFloatExceptions(int type);
// interface ISystem -------------------------------------------
virtual IDataProbe* GetIDataProbe() { return m_pDataProbe; };
void SetForceNonDevMode(bool bValue) override;
bool GetForceNonDevMode() const override;
bool WasInDevMode() const override { return m_bWasInDevMode; };
bool IsDevMode() const override { return m_bInDevMode && !GetForceNonDevMode(); }
void SetConsoleDrawEnabled(bool enabled) override { m_bDrawConsole = enabled; }
void SetUIDrawEnabled(bool enabled) override { m_bDrawUI = enabled; }
bool IsDevMode() const override { return m_bInDevMode; }
// -------------------------------------------------------------
@@ -373,47 +316,30 @@ public:
ICVar* attachVariable (const char* szVarName, int* pContainer, const char* szComment, int dwFlags = 0);
const CTimeValue& GetLastTickTime() const { return m_lastTickTime; }
const ICVar* GetDedicatedMaxRate() const { return m_svDedicatedMaxRate; }
std::shared_ptr<AZ::IO::FileIOBase> CreateLocalFileIO() override;
private: // ------------------------------------------------------
// System environment.
SSystemGlobalEnvironment m_env;
bool m_bInitializedSuccessfully; //!< true if the system completed all initialization steps
bool m_bRelaunch; //!< relaunching the app or not (true beforerelaunch)
int m_iLoadingMode; //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading)
bool m_bTestMode; //!< If running in testing mode.
bool m_bEditor; //!< If running in Editor.
bool m_bNoCrashDialog;
bool m_bNoErrorReportWindow;
bool m_bPreviewMode; //!< If running in Preview mode.
bool m_bDedicatedServer; //!< If running as Dedicated server.
bool m_bIgnoreUpdates; //!< When set to true will ignore Update and Render calls,
bool m_bForceNonDevMode; //!< true when running on a cheat protected server or a client that is connected to it (not used in singlplayer)
bool m_bWasInDevMode; //!< Set to true if was in dev mode.
bool m_bInDevMode; //!< Set to true if was in dev mode.
bool m_bGameFolderWritable;//!< True when verified that current game folder have write access.
int m_ttMemStatSS; //!< Time to memstat screenshot
bool m_bDrawConsole; //!< Set to true if OK to draw the console.
bool m_bDrawUI; //!< Set to true if OK to draw UI.
//! current active process
IProcess* m_pProcess;
bool m_bInitializedSuccessfully; //!< true if the system completed all initialization steps
bool m_bRelaunch; //!< relaunching the app or not (true beforerelaunch)
int m_iLoadingMode; //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading)
bool m_bTestMode; //!< If running in testing mode.
bool m_bEditor; //!< If running in Editor.
bool m_bNoCrashDialog;
bool m_bNoErrorReportWindow;
bool m_bPreviewMode; //!< If running in Preview mode.
bool m_bDedicatedServer; //!< If running as Dedicated server.
bool m_bIgnoreUpdates; //!< When set to true will ignore Update and Render calls,
bool m_bInDevMode; //!< Set to true if was in dev mode.
bool m_bGameFolderWritable; //!< True when verified that current game folder have write access.
CTimeValue m_lastTickTime;
//! system event dispatcher
ISystemEventDispatcher* m_pSystemEventDispatcher;
//! The default mono-spaced font for internal usage (profiling, debug info, etc.)
IFFont* m_pIFont;
//! The default font for end-user UI interfaces
IFFont* m_pIFontUi;
//! System to manage levels.
ILevelSystem* m_pLevelSystem;
@@ -432,12 +358,6 @@ private: // ------------------------------------------------------
// System console variables.
//////////////////////////////////////////////////////////////////////////
// DLL names
ICVar* m_sys_dll_response_system;
#if !defined(_RELEASE)
ICVar* m_sys_resource_cache_folder;
#endif
#if AZ_LOADSCREENCOMPONENT_ENABLED
ICVar* m_game_load_screen_uicanvas_path;
ICVar* m_level_load_screen_uicanvas_path;
@@ -451,37 +371,9 @@ private: // ------------------------------------------------------
ICVar* m_level_load_screen_minimum_time{};
#endif // if AZ_LOADSCREENCOMPONENT_ENABLED
ICVar* m_sys_initpreloadpacks;
ICVar* m_sys_menupreloadpacks;
ICVar* m_cvAIUpdate;
ICVar* m_rWidth;
ICVar* m_rHeight;
ICVar* m_rWidthAndHeightAsFractionOfScreenSize;
ICVar* m_rTabletWidthAndHeightAsFractionOfScreenSize;
ICVar* m_rHDRDolby;
ICVar* m_rMaxWidth;
ICVar* m_rMaxHeight;
ICVar* m_rColorBits;
ICVar* m_rDepthBits;
ICVar* m_rStencilBits;
ICVar* m_rFullscreen;
ICVar* m_rFullscreenWindow;
ICVar* m_rFullscreenNativeRes;
ICVar* m_rDisplayInfo;
ICVar* m_rOverscanBordersDrawDebugView;
ICVar* m_sysNoUpdate;
ICVar* m_cvEntitySuppressionLevel;
ICVar* m_pCVarQuit;
ICVar* m_cvMemStats;
ICVar* m_cvMemStatsThreshold;
ICVar* m_cvMemStatsMaxDepth;
ICVar* m_sysKeyboard;
ICVar* m_sysWarnings; //!< might be 0, "sys_warnings" - Treat warning as errors.
ICVar* m_cvSSInfo; //!< might be 0, "sys_SSInfo" 0/1 - get file sourcesafe info
ICVar* m_svDedicatedMaxRate;
ICVar* m_sys_firstlaunch;
ICVar* m_sys_asset_processor;
ICVar* m_sys_load_files_to_memory;
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -491,13 +383,6 @@ private: // ------------------------------------------------------
ICVar* m_sys_audio_disable;
ICVar* m_sys_min_step;
ICVar* m_sys_max_step;
ICVar* m_sys_enable_budgetmonitoring;
ICVar* m_sys_memory_debug;
ICVar* m_sys_preload;
// ICVar *m_sys_filecache;
ICVar* m_gpu_particle_physics;
AZStd::string m_sSavedRDriver; //!< to restore the driver when quitting the dedicated server
@@ -509,28 +394,20 @@ private: // ------------------------------------------------------
SFileVersion m_fileVersion;
SFileVersion m_productVersion;
SFileVersion m_buildVersion;
IDataProbe* m_pDataProbe;
class CLocalizedStringsManager* m_pLocalizationManager;
ESystemConfigSpec m_nServerConfigSpec;
ESystemConfigSpec m_nMaxConfigSpec;
ESystemConfigPlatform m_ConfigPlatform;
// Pause mode.
bool m_bPaused;
bool m_bNoUpdate;
uint64 m_nUpdateCounter;
bool m_executedCommandLine = false;
AZStd::unique_ptr<AzFramework::MissingAssetLogger> m_missingAssetLogger;
public:
ICVar* m_sys_main_CPU;
ICVar* m_sys_streaming_CPU;
ICVar* m_sys_TaskThread_CPU[MAX_THREAD_POOL_INDEX];
//////////////////////////////////////////////////////////////////////////
// File version.
-152
View File
@@ -1203,18 +1203,6 @@ void CSystem::CreateSystemVars()
assert(gEnv);
assert(gEnv->pConsole);
// Register DLL names as cvars before we load them
//
EVarFlags dllFlags = (EVarFlags)0;
m_sys_dll_response_system = REGISTER_STRING("sys_dll_response_system", 0, dllFlags, "Specifies the DLL to load for the dynamic response system");
m_sys_initpreloadpacks = REGISTER_STRING("sys_initpreloadpacks", "", 0, "Specifies the paks for an engine initialization");
m_sys_menupreloadpacks = REGISTER_STRING("sys_menupreloadpacks", 0, 0, "Specifies the paks for a main menu loading");
#ifndef _RELEASE
m_sys_resource_cache_folder = REGISTER_STRING("sys_resource_cache_folder", "Editor\\ResourceCache", 0, "Folder for resource compiled locally. Managed by Sandbox.");
#endif
#if AZ_LOADSCREENCOMPONENT_ENABLED
m_game_load_screen_uicanvas_path = REGISTER_STRING("game_load_screen_uicanvas_path", "", 0, "Game load screen UiCanvas path.");
m_level_load_screen_uicanvas_path = REGISTER_STRING("level_load_screen_uicanvas_path", "", 0, "Level load screen UiCanvas path.");
@@ -1230,8 +1218,6 @@ void CSystem::CreateSystemVars()
REGISTER_INT("cvDoVerboseWindowTitle", 0, VF_NULL, "");
m_pCVarQuit = REGISTER_INT("ExitOnQuit", 1, VF_NULL, "");
// Register an AZ Console command to quit the engine.
// The command is available even in Release builds.
static AZ::ConsoleFunctor<void, false> s_functorQuit
@@ -1252,52 +1238,14 @@ void CSystem::CreateSystemVars()
REGISTER_STRING_CB("sys_version", "", VF_CHEAT, "Override system file/product version", SystemVersionChanged);
#endif // #ifndef _RELEASE
m_cvAIUpdate = REGISTER_INT("ai_NoUpdate", 0, VF_CHEAT, "Disables AI system update when 1");
m_cvMemStats = REGISTER_INT("MemStats", 0, 0,
"0/x=refresh rate in milliseconds\n"
"Use 1000 to switch on and 0 to switch off\n"
"Usage: MemStats [0..]");
m_cvMemStatsThreshold = REGISTER_INT ("MemStatsThreshold", 32000, VF_NULL, "");
m_cvMemStatsMaxDepth = REGISTER_INT("MemStatsMaxDepth", 4, VF_NULL, "");
attachVariable("sys_PakReadSlice", &g_cvars.archiveVars.nReadSlice, "If non-0, means number of kilobytes to use to read files in portions. Should only be used on Win9x kernels");
attachVariable("sys_PakInMemorySizeLimit", &g_cvars.archiveVars.nInMemoryPerPakSizeLimit, "Individual pak size limit for being loaded into memory (MB)");
attachVariable("sys_PakTotalInMemorySizeLimit", &g_cvars.archiveVars.nTotalInMemoryPakSizeLimit, "Total limit (in MB) for all in memory paks");
attachVariable("sys_PakLoadCache", &g_cvars.archiveVars.nLoadCache, "Load in memory paks from _LoadCache folder");
attachVariable("sys_PakLoadModePaks", &g_cvars.archiveVars.nLoadModePaks, "Load mode switching paks from modes folder");
attachVariable("sys_PakStreamCache", &g_cvars.archiveVars.nStreamCache, "Load in memory paks for faster streaming (cgf_cache.pak,dds_cache.pak)");
attachVariable("sys_PakSaveTotalResourceList", &g_cvars.archiveVars.nSaveTotalResourceList, "Save resource list");
attachVariable("sys_PakSaveLevelResourceList", &g_cvars.archiveVars.nSaveLevelResourceList, "Save resource list when loading level");
attachVariable("sys_PakSaveFastLoadResourceList", &g_cvars.archiveVars.nSaveFastloadResourceList, "Save resource list during initial loading");
attachVariable("sys_PakSaveMenuCommonResourceList", &g_cvars.archiveVars.nSaveMenuCommonResourceList, "Save resource list during front end menu flow");
attachVariable("sys_PakMessageInvalidFileAccess", &g_cvars.archiveVars.nMessageInvalidFileAccess, "Message Box synchronous file access when in game");
attachVariable("sys_PakLogInvalidFileAccess", &g_cvars.archiveVars.nLogInvalidFileAccess, "Log synchronous file access when in game");
#ifndef _RELEASE
attachVariable("sys_PakLogAllFileAccess", &g_cvars.archiveVars.nLogAllFileAccess, "Log all file access allowing you to easily see whether a file has been loaded directly, or which pak file.");
#endif
attachVariable("sys_PakValidateFileHash", &g_cvars.archiveVars.nValidateFileHashes, "Validate file hashes in pak files for collisions");
attachVariable("sys_UncachedStreamReads", &g_cvars.archiveVars.nUncachedStreamReads, "Enable stream reads via an uncached file handle");
attachVariable("sys_PakDisableNonLevelRelatedPaks", &g_cvars.archiveVars.nDisableNonLevelRelatedPaks, "Disables all paks that are not required by specific level; This is used with per level splitted assets.");
attachVariable("sys_PakWarnOnPakAccessFailures", &g_cvars.archiveVars.nWarnOnPakAccessFails, "If 1, access failure for Paks is treated as a warning, if zero it is only a log message.");
static const int fileSystemCaseSensitivityDefault = 0;
REGISTER_CVAR2("sys_FilesystemCaseSensitivity", &g_cvars.sys_FilesystemCaseSensitivity, fileSystemCaseSensitivityDefault, VF_NULL,
"0 - CryPak lowercases all input file names\n"
"1 - CryPak preserves file name casing\n"
"Default is 1");
m_sysNoUpdate = REGISTER_INT("sys_noupdate", 0, VF_CHEAT,
"Toggles updating of system with sys_script_debugger.\n"
"Usage: sys_noupdate [0/1]\n"
"Default is 0 (system updates during debug).");
m_sysWarnings = REGISTER_INT("sys_warnings", 0, 0,
"Toggles printing system warnings.\n"
"Usage: sys_warnings [0/1]\n"
"Default is 0 (off).");
#if defined(_RELEASE) && defined(CONSOLE) && !defined(ENABLE_LW_PROFILERS)
enum
{
@@ -1309,10 +1257,6 @@ void CSystem::CreateSystemVars()
e_sysKeyboardDefault = 1
};
#endif
m_sysKeyboard = REGISTER_INT("sys_keyboard", e_sysKeyboardDefault, 0,
"Enables keyboard.\n"
"Usage: sys_keyboard [0/1]\n"
"Default is 1 (on).");
m_svDedicatedMaxRate = REGISTER_FLOAT("sv_DedicatedMaxRate", 30.0f, 0,
"Sets the maximum update rate when running as a dedicated server.\n"
@@ -1328,55 +1272,14 @@ void CSystem::CreateSystemVars()
"Usage: sv_DedicatedCPUVariance [5..50]\n"
"Default is 10.");
m_cvSSInfo = REGISTER_INT("sys_SSInfo", 0, 0,
"Show SourceSafe information (Name,Comment,Date) for file errors."
"Usage: sys_SSInfo [0/1]\n"
"Default is 0 (off)");
m_cvEntitySuppressionLevel = REGISTER_INT("e_EntitySuppressionLevel", 0, 0,
"Defines the level at which entities are spawned.\n"
"Entities marked with lower level will not be spawned - 0 means no level.\n"
"Usage: e_EntitySuppressionLevel [0-infinity]\n"
"Default is 0 (off)");
m_sys_firstlaunch = REGISTER_INT("sys_firstlaunch", 0, 0,
"Indicates that the game was run for the first time.");
m_sys_main_CPU = REGISTER_INT("sys_main_CPU", 0, 0,
"Specifies the physical CPU index main will run on");
m_sys_TaskThread_CPU[0] = REGISTER_INT("sys_TaskThread0_CPU", 3, 0,
"Specifies the physical CPU index taskthread0 will run on");
m_sys_TaskThread_CPU[1] = REGISTER_INT("sys_TaskThread1_CPU", 5, 0,
"Specifies the physical CPU index taskthread1 will run on");
m_sys_TaskThread_CPU[2] = REGISTER_INT("sys_TaskThread2_CPU", 4, 0,
"Specifies the physical CPU index taskthread2 will run on");
m_sys_TaskThread_CPU[3] = REGISTER_INT("sys_TaskThread3_CPU", 3, 0,
"Specifies the physical CPU index taskthread3 will run on");
m_sys_TaskThread_CPU[4] = REGISTER_INT("sys_TaskThread4_CPU", 2, 0,
"Specifies the physical CPU index taskthread4 will run on");
m_sys_TaskThread_CPU[5] = REGISTER_INT("sys_TaskThread5_CPU", 1, 0,
"Specifies the physical CPU index taskthread5 will run on");
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_12
#include AZ_RESTRICTED_FILE(SystemInit_cpp)
#endif
m_sys_min_step = REGISTER_FLOAT("sys_min_step", 0.01f, 0,
"Specifies the minimum physics step in a separate thread");
m_sys_max_step = REGISTER_FLOAT("sys_max_step", 0.05f, 0,
"Specifies the maximum physics step in a separate thread");
// used in define MEMORY_DEBUG_POINT()
m_sys_memory_debug = REGISTER_INT("sys_memory_debug", 0, VF_CHEAT,
"Enables to activate low memory situation is specific places in the code (argument defines which place), 0=off");
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_17
#include AZ_RESTRICTED_FILE(SystemInit_cpp)
@@ -1387,40 +1290,7 @@ void CSystem::CreateSystemVars()
# define SYS_STREAMING_CPU_DEFAULT_VALUE 1
# define SYS_STREAMING_CPU_WORKER_DEFAULT_VALUE 5
#endif
REGISTER_CVAR2("sys_streaming_CPU", &g_cvars.sys_streaming_cpu, SYS_STREAMING_CPU_DEFAULT_VALUE, VF_NULL, "Specifies the physical CPU file IO thread run on");
REGISTER_CVAR2("sys_streaming_CPU_worker", &g_cvars.sys_streaming_cpu_worker, SYS_STREAMING_CPU_WORKER_DEFAULT_VALUE, VF_NULL, "Specifies the physical CPU file IO worker thread/s run on");
REGISTER_CVAR2("sys_streaming_memory_budget", &g_cvars.sys_streaming_memory_budget, 10 * 1024, VF_NULL, "Temp memory streaming system can use in KB");
REGISTER_CVAR2("sys_streaming_max_finalize_per_frame", &g_cvars.sys_streaming_max_finalize_per_frame, 0, VF_NULL,
"Maximum stream finalizing calls per frame to reduce the CPU impact on main thread (0 to disable)");
REGISTER_CVAR2("sys_streaming_max_bandwidth", &g_cvars.sys_streaming_max_bandwidth, 0, VF_NULL, "Enables capping of max streaming bandwidth in MB/s");
REGISTER_CVAR2("sys_streaming_debug", &g_cvars.sys_streaming_debug, 0, VF_NULL, "Enable streaming debug information\n"
"0=off\n"
"1=Streaming Stats\n"
"2=File IO\n"
"3=Request Order\n"
"4=Write to Log\n"
"5=Stats per extension\n"
);
REGISTER_CVAR2("sys_streaming_requests_grouping_time_period", &g_cvars.sys_streaming_requests_grouping_time_period, 2, VF_NULL, // Vlad: 2 works better than 4 visually, should be be re-tested when streaming pak's activated
"Streaming requests are grouped by request time and then sorted by disk offset");
REGISTER_CVAR2("sys_streaming_debug_filter", &g_cvars.sys_streaming_debug_filter, 0, VF_NULL, "Set streaming debug information filter.\n"
"0=all\n"
"1=Texture\n"
"2=Geometry\n"
"3=Terrain\n"
"4=Animation\n"
"5=Music\n"
"6=Sound\n"
"7=Shader\n"
);
g_cvars.sys_streaming_debug_filter_file_name = REGISTER_STRING("sys_streaming_debug_filter_file_name", "", VF_CHEAT,
"Set streaming debug information filter");
REGISTER_CVAR2("sys_streaming_debug_filter_min_time", &g_cvars.sys_streaming_debug_filter_min_time, 0.f, VF_NULL, "Show only slow items.");
REGISTER_CVAR2("sys_streaming_resetstats", &g_cvars.sys_streaming_resetstats, 0, VF_NULL,
"Reset all the streaming stats");
#define DEFAULT_USE_OPTICAL_DRIVE_THREAD (gEnv->IsDedicated() ? 0 : 1)
REGISTER_CVAR2("sys_streaming_use_optical_drive_thread", &g_cvars.sys_streaming_use_optical_drive_thread, DEFAULT_USE_OPTICAL_DRIVE_THREAD, VF_NULL,
"Allow usage of an extra optical drive thread for faster streaming from 2 medias");
const char* localizeFolder = "Localization";
g_cvars.sys_localization_folder = REGISTER_STRING_CB("sys_localization_folder", localizeFolder, VF_NULL,
@@ -1430,9 +1300,6 @@ void CSystem::CreateSystemVars()
"Default: Localization\n",
CSystem::OnLocalizationFolderCVarChanged);
REGISTER_CVAR2("sys_streaming_in_blocks", &g_cvars.sys_streaming_in_blocks, 1, VF_NULL,
"Streaming of large files happens in blocks");
#if (defined(WIN32) || defined(WIN64)) && defined(_DEBUG)
REGISTER_CVAR2("sys_float_exceptions", &g_cvars.sys_float_exceptions, 2, 0, "Use or not use floating point exceptions.");
#else // Float exceptions by default disabled for console builds.
@@ -1451,11 +1318,6 @@ void CSystem::CreateSystemVars()
REGISTER_CVAR2("sys_WER", &g_cvars.sys_WER, 0, 0, "Enables Windows Error Reporting");
#endif
#ifdef USE_HTTP_WEBSOCKETS
REGISTER_CVAR2("sys_simple_http_base_port", &g_cvars.sys_simple_http_base_port, 1880, VF_REQUIRE_APP_RESTART,
"sets the base port for the simple http server to run on, defaults to 1880");
#endif
const int DEFAULT_DUMP_TYPE = 2;
REGISTER_CVAR2("sys_dump_type", &g_cvars.sys_dump_type, DEFAULT_DUMP_TYPE, VF_NULL,
@@ -1467,8 +1329,6 @@ void CSystem::CreateSystemVars()
);
REGISTER_CVAR2("sys_dump_aux_threads", &g_cvars.sys_dump_aux_threads, 1, VF_NULL, "Dumps callstacks of other threads in case of a crash");
REGISTER_CVAR2("sys_limit_phys_thread_count", &g_cvars.sys_limit_phys_thread_count, 1, VF_NULL, "Limits p_num_threads to physical CPU count - 1");
#if (defined(WIN32) || defined(WIN64)) && defined(_RELEASE)
const int DEFAULT_SYS_MAX_FPS = 0;
#else
@@ -1480,11 +1340,8 @@ void CSystem::CreateSystemVars()
REGISTER_CVAR2("sys_maxTimeStepForMovieSystem", &g_cvars.sys_maxTimeStepForMovieSystem, 0.1f, VF_NULL, "Caps the time step for the movie system so that a cut-scene won't be jumped in the case of an extreme stall.");
REGISTER_CVAR2("sys_force_installtohdd_mode", &g_cvars.sys_force_installtohdd_mode, 0, VF_NULL, "Forces install to HDD mode even when doing DVD emulation");
REGISTER_CVAR2("sys_report_files_not_found_in_paks", &g_cvars.sys_report_files_not_found_in_paks, 0, VF_NULL, "Reports when files are searched for in paks and not found. 1 = log, 2 = warning, 3 = error");
m_sys_preload = REGISTER_INT("sys_preload", 0, 0, "Preload Game Resources");
REGISTER_COMMAND("sys_crashtest", CmdCrashTest, VF_CHEAT, "Make the game crash\n"
"0=off\n"
"1=null pointer exception\n"
@@ -1523,20 +1380,11 @@ void CSystem::CreateSystemVars()
"To speed up loading from non HD media\n"
"0=off / 1=enabled");
*/
REGISTER_CVAR2("sys_AI", &g_cvars.sys_ai, 1, 0, "Enables AI Update");
REGISTER_CVAR2("sys_entities", &g_cvars.sys_entitysystem, 1, 0, "Enables Entities Update");
REGISTER_CVAR2("sys_trackview", &g_cvars.sys_trackview, 1, 0, "Enables TrackView Update");
//Defines selected language.
REGISTER_STRING_CB("g_language", "", VF_NULL, "Defines which language pak is loaded", CSystem::OnLanguageCVarChanged);
#if defined(WIN32)
REGISTER_CVAR2("sys_display_threads", &g_cvars.sys_display_threads, 0, 0, "Displays Thread info");
#elif defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_13
#include AZ_RESTRICTED_FILE(SystemInit_cpp)
#endif
// adding CVAR to toggle assert verbosity level
const int defaultAssertValue = 1;
REGISTER_CVAR2_CB("sys_asserts", &g_cvars.sys_asserts, defaultAssertValue, VF_CHEAT,
-39
View File
@@ -383,45 +383,6 @@ void CSystem::debug_LogCallStack(int nMaxFuncs, [[maybe_unused]] int nFlags)
}
}
//////////////////////////////////////////////////////////////////////////
// Support relaunching for windows media center edition.
//////////////////////////////////////////////////////////////////////////
#if defined(WIN32)
#if (_WIN32_WINNT < 0x0501)
#define SM_MEDIACENTER 87
#endif
bool CSystem::ReLaunchMediaCenter()
{
// Skip if not running on a Media Center
if (GetSystemMetrics(SM_MEDIACENTER) == 0)
{
return false;
}
// Get the path to Media Center
wchar_t szExpandedPath[AZ_MAX_PATH_LEN];
if (!ExpandEnvironmentStringsW(L"%SystemRoot%\\ehome\\ehshell.exe", szExpandedPath, AZ_MAX_PATH_LEN))
{
return false;
}
// Skip if ehshell.exe doesn't exist
if (GetFileAttributesW(szExpandedPath) == 0xFFFFFFFF)
{
return false;
}
// Launch ehshell.exe
INT_PTR result = (INT_PTR)ShellExecuteW(NULL, TEXT("open"), szExpandedPath, NULL, NULL, SW_SHOWNORMAL);
return (result > 32);
}
#else
bool CSystem::ReLaunchMediaCenter()
{
return false;
}
#endif //defined(WIN32)
#if (defined(WIN32) || defined(WIN64))
//////////////////////////////////////////////////////////////////////////
bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
+6 -20
View File
@@ -11,20 +11,6 @@
#include "Cry_Color.h"
#include "XMLBinaryNode.h"
//////////////////////////////////////////////////////////////////////////
CBinaryXmlData::CBinaryXmlData()
: pNodes(0)
, pAttributes(0)
, pChildIndices(0)
, pStringData(0)
, pFileContents(0)
, nFileSize(0)
, bOwnsFileContentsMemory(true)
, pBinaryNodes(0)
, nRefCount(0)
{
}
//////////////////////////////////////////////////////////////////////////
CBinaryXmlData::~CBinaryXmlData()
{
@@ -32,10 +18,10 @@ CBinaryXmlData::~CBinaryXmlData()
{
delete [] pFileContents;
}
pFileContents = 0;
pFileContents = nullptr;
delete [] pBinaryNodes;
pBinaryNodes = 0;
pBinaryNodes = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -56,7 +42,7 @@ XmlNodeRef CBinaryXmlNode::getParent() const
XmlNodeRef CBinaryXmlNode::createNode([[maybe_unused]] const char* tag)
{
assert(0);
return 0;
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -93,7 +79,7 @@ bool CBinaryXmlNode::getAttr(const char* key, const char** value) const
bool CBinaryXmlNode::haveAttr(const char* key) const
{
return (GetValue(key) != 0);
return (GetValue(key) != nullptr);
}
//////////////////////////////////////////////////////////////////////////
@@ -113,7 +99,7 @@ bool CBinaryXmlNode::getAttr(const char* key, unsigned int& value) const
const char* svalue = GetValue(key);
if (svalue)
{
value = strtoul(svalue, NULL, 10);
value = strtoul(svalue, nullptr, 10);
return true;
}
return false;
@@ -290,7 +276,7 @@ XmlNodeRef CBinaryXmlNode::findChild(const char* tag) const
return m_pData->pBinaryNodes + m_pData->pChildIndices[i];
}
}
return 0;
return nullptr;
}
//! Get XML Node child nodes.
+10 -25
View File
@@ -6,13 +6,8 @@
*
*/
#ifndef CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYNODE_H
#define CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYNODE_H
#pragma once
#include <algorithm>
#include "IXml.h"
#include "XMLBinaryHeaders.h"
@@ -26,20 +21,20 @@ class CBinaryXmlNode;
class CBinaryXmlData
{
public:
const XMLBinary::Node* pNodes;
const XMLBinary::Attribute* pAttributes;
const XMLBinary::NodeIndex* pChildIndices;
const char* pStringData;
const XMLBinary::Node* pNodes = nullptr;
const XMLBinary::Attribute* pAttributes = nullptr;
const XMLBinary::NodeIndex* pChildIndices = nullptr;
const char* pStringData = nullptr;
const char* pFileContents;
size_t nFileSize;
bool bOwnsFileContentsMemory;
const char* pFileContents = nullptr;
size_t nFileSize = 0;
bool bOwnsFileContentsMemory = true;
CBinaryXmlNode* pBinaryNodes;
CBinaryXmlNode* pBinaryNodes = nullptr;
int nRefCount;
int nRefCount = 0;
CBinaryXmlData();
CBinaryXmlData() = default;
~CBinaryXmlData();
};
@@ -96,7 +91,6 @@ public:
virtual bool getAttributeByIndex(int index, XmlString& key, XmlString& value);
void shareChildren([[maybe_unused]] const XmlNodeRef& fromNode) override { assert(0); };
void copyAttributes(XmlNodeRef fromNode) override { assert(0); };
//! Get XML Node attribute for specified key.
@@ -110,8 +104,6 @@ public:
bool haveAttr(const char* key) const override;
XmlNodeRef newChild([[maybe_unused]] const char* tagName) override { assert(0); return 0; };
void replaceChild([[maybe_unused]] int inChild, [[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
void insertChild([[maybe_unused]] int inChild, [[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
void addChild([[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
void removeChild([[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
@@ -127,7 +119,6 @@ public:
//! Find node with specified tag.
XmlNodeRef findChild(const char* tag) const override;
void deleteChild([[maybe_unused]] const char* tag) { assert(0); };
void deleteChildAt([[maybe_unused]] int nIndex) override { assert(0); };
//! Get parent XML node.
XmlNodeRef getParent() const override;
@@ -136,10 +127,6 @@ public:
const char* getContent() const override { return _string(_node()->nContentStringOffset); };
void setContent([[maybe_unused]] const char* str) override { assert(0); };
XmlNodeRef clone() override { assert(0); return 0; };
//! Returns line number for XML tag.
int getLine() const override { return 0; };
//! Set line number in xml.
void setLine([[maybe_unused]] int line) override { assert(0); };
@@ -225,5 +212,3 @@ private:
friend class XMLBinary::XMLBinaryReader;
};
#endif // CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYNODE_H
+17 -20
View File
@@ -79,22 +79,16 @@ void GetMD5(const char* pSrcBuffer, int nSrcSize, char signatureMD5[16])
}
//////////////////////////////////////////////////////////////////////////
class CXmlSerializer
: public IXmlSerializer
class CXmlSerializer final : public IXmlSerializer
{
public:
CXmlSerializer()
: m_nRefCount(0)
, m_pReaderImpl(nullptr)
, m_pReaderSer(nullptr)
, m_pWriterSer(nullptr)
, m_pWriterImpl(nullptr)
{
}
CXmlSerializer() = default;
~CXmlSerializer()
{
ClearAll();
}
void ClearAll()
{
SAFE_DELETE(m_pReaderSer);
@@ -104,7 +98,11 @@ public:
}
//////////////////////////////////////////////////////////////////////////
void AddRef() override { ++m_nRefCount; }
void AddRef() override
{
++m_nRefCount;
}
void Release() override
{
if (--m_nRefCount <= 0)
@@ -120,6 +118,7 @@ public:
m_pWriterSer = new CSimpleSerializeWithDefaults<CSerializeXMLWriterImpl>(*m_pWriterImpl);
return m_pWriterSer;
}
ISerialize* GetReader(XmlNodeRef& node) override
{
ClearAll();
@@ -130,12 +129,12 @@ public:
//////////////////////////////////////////////////////////////////////////
private:
int m_nRefCount;
CSerializeXMLReaderImpl* m_pReaderImpl;
CSimpleSerializeWithDefaults<CSerializeXMLReaderImpl>* m_pReaderSer;
int m_nRefCount = 0;
CSerializeXMLReaderImpl* m_pReaderImpl = nullptr;
CSimpleSerializeWithDefaults<CSerializeXMLReaderImpl>* m_pReaderSer = nullptr;
CSerializeXMLWriterImpl* m_pWriterImpl;
CSimpleSerializeWithDefaults<CSerializeXMLWriterImpl>* m_pWriterSer;
CSerializeXMLWriterImpl* m_pWriterImpl = nullptr;
CSimpleSerializeWithDefaults<CSerializeXMLWriterImpl>* m_pWriterSer = nullptr;
};
//////////////////////////////////////////////////////////////////////////
@@ -145,8 +144,7 @@ IXmlSerializer* CXmlUtils::CreateXmlSerializer()
}
//////////////////////////////////////////////////////////////////////////
class CXmlBinaryDataWriterFile
: public XMLBinary::IDataWriter
class CXmlBinaryDataWriterFile final : public XMLBinary::IDataWriter
{
public:
CXmlBinaryDataWriterFile(const char* file)
@@ -177,8 +175,7 @@ private:
};
//////////////////////////////////////////////////////////////////////////
class CXmlTableReader
: public IXmlTableReader
class CXmlTableReader final : public IXmlTableReader
{
public:
CXmlTableReader();
+1 -117
View File
@@ -626,20 +626,6 @@ void CXmlNode::deleteChild(const char* tag)
}
}
//////////////////////////////////////////////////////////////////////////
void CXmlNode::deleteChildAt(int nIndex)
{
if (m_pChilds)
{
XmlNodes& childs = *m_pChilds;
if (nIndex >= 0 && nIndex < (int)childs.size())
{
ReleaseChild(childs[nIndex]);
childs.erase(childs.begin() + nIndex);
}
}
}
//! Adds new child node.
void CXmlNode::addChild(const XmlNodeRef& node)
{
@@ -655,74 +641,12 @@ void CXmlNode::addChild(const XmlNodeRef& node)
pNode->setParent(this);
};
void CXmlNode::shareChildren(const XmlNodeRef& inFromMe)
{
int numChildren = inFromMe->getChildCount();
removeAllChilds();
if (numChildren > 0)
{
XmlNodeRef child;
m_pChilds = new XmlNodes;
m_pChilds->reserve(numChildren);
for (int i = 0; i < numChildren; i++)
{
child = inFromMe->getChild(i);
child->AddRef();
// not overwriting parent assignment of child, we share the node but do not exclusively own it
m_pChilds->push_back(child);
}
}
}
void CXmlNode::setParent(const XmlNodeRef& inNewParent)
{
// note, parent ptrs are not ref counted
m_parent = inNewParent;
}
void CXmlNode::insertChild(int inIndex, const XmlNodeRef& inNewChild)
{
assert(inIndex >= 0 && inIndex <= getChildCount());
assert(inNewChild != 0);
if (inIndex >= 0 && inIndex <= getChildCount() && inNewChild)
{
if (getChildCount() == 0)
{
addChild(inNewChild);
}
else
{
IXmlNode* pNode = ((IXmlNode*)inNewChild);
pNode->AddRef();
m_pChilds->insert(m_pChilds->begin() + inIndex, pNode);
pNode->setParent(this);
}
}
}
void CXmlNode::replaceChild(int inIndex, const XmlNodeRef& inNewChild)
{
assert(inIndex >= 0 && inIndex < getChildCount());
assert(inNewChild != 0);
if (inIndex >= 0 && inIndex < getChildCount() && inNewChild)
{
IXmlNode* wasChild = (*m_pChilds)[inIndex];
if (wasChild->getParent() == this)
{
wasChild->setParent(XmlNodeRef()); // child is orphaned, will be freed by Release() below if this parent is last holding a reference to it
}
wasChild->Release();
inNewChild->AddRef();
(*m_pChilds)[inIndex] = inNewChild;
inNewChild->setParent(this);
}
}
XmlNodeRef CXmlNode::newChild(const char* tagName)
{
XmlNodeRef node = createNode(tagName);
@@ -817,34 +741,6 @@ bool CXmlNode::getAttributeByIndex(int index, XmlString& key, XmlString& value)
}
return false;
}
//////////////////////////////////////////////////////////////////////////
XmlNodeRef CXmlNode::clone()
{
CXmlNode* node = new CXmlNode;
XmlNodeRef result(node);
node->m_pStringPool = m_pStringPool;
m_pStringPool->AddRef();
node->m_tag = m_tag;
node->m_content = m_content;
// Clone attributes.
CXmlNode* n = (CXmlNode*)(IXmlNode*)node;
n->copyAttributes(this);
// Clone sub nodes.
if (m_pChilds)
{
const XmlNodes& childs = *m_pChilds;
node->m_pChilds = new XmlNodes;
node->m_pChilds->reserve(childs.size());
for (int i = 0, num = static_cast<int>(childs.size()); i < num; ++i)
{
node->addChild(childs[i]->clone());
}
}
return result;
}
//////////////////////////////////////////////////////////////////////////
static void AddTabsToString(XmlString& xml, int level)
@@ -1206,16 +1102,6 @@ XmlString CXmlNode::getXML(int level) const
return xml;
}
XmlString CXmlNode::getXMLUnsafe(int level, char* tmpBuffer, uint32 sizeOfTmpBuffer) const
{
char* endPtr = tmpBuffer + sizeOfTmpBuffer - 1;
char* endOfBuffer = AddToXmlStringUnsafe(tmpBuffer, level, endPtr);
endOfBuffer[0] = '\0';
XmlString ret(tmpBuffer);
return ret;
}
// TODO: those 2 saving functions are a bit messy. should probably make a separate one for the use of PlatformAPI
bool CXmlNode::saveToFile(const char* fileName)
{
@@ -1247,9 +1133,7 @@ bool CXmlNode::saveToFile(const char* fileName)
bool CXmlNode::saveToFile([[maybe_unused]] const char* fileName, size_t chunkSize, AZ::IO::HandleType fileHandle)
{
#ifdef WIN32
CrySetFileAttributes(fileName, 0x00000080); // FILE_ATTRIBUTE_NORMAL
#endif //WIN32
CrySetFileAttributes(fileName, FILE_ATTRIBUTE_NORMAL);
if (chunkSize < 256 * 1024) // make at least 256k
{
+66 -73
View File
@@ -46,14 +46,14 @@ class XmlParser
{
public:
explicit XmlParser(bool bReuseStrings);
~XmlParser();
~XmlParser() override;
void AddRef()
void AddRef() override
{
++m_nRefCount;
}
void Release()
void Release() override
{
if (--m_nRefCount <= 0)
{
@@ -61,9 +61,9 @@ public:
}
}
virtual XmlNodeRef ParseFile(const char* filename, bool bCleanPools);
XmlNodeRef ParseFile(const char* filename, bool bCleanPools) override;
virtual XmlNodeRef ParseBuffer(const char* buffer, int nBufLen, bool bCleanPools, bool bSuppressWarnings = false);
XmlNodeRef ParseBuffer(const char* buffer, int nBufLen, bool bCleanPools, bool bSuppressWarnings = false) override;
const char* getErrorString() const { return m_errorString; }
@@ -112,7 +112,7 @@ public:
CXmlNode();
CXmlNode(const char* tag, bool bReuseStrings, bool bIsProcessingInstruction = false);
//! Destructor.
~CXmlNode();
~CXmlNode() override;
//////////////////////////////////////////////////////////////////////////
// Custom new/delete with pool allocator.
@@ -120,125 +120,118 @@ public:
//void* operator new( size_t nSize );
//void operator delete( void *ptr );
virtual void DeleteThis();
void DeleteThis() override;
//! Create new XML node.
XmlNodeRef createNode(const char* tag);
XmlNodeRef createNode(const char* tag) override;
//! Get XML node tag.
const char* getTag() const { return m_tag; };
void setTag(const char* tag);
const char* getTag() const override
{ return m_tag; };
void setTag(const char* tag) override;
//! Return true if given tag equal to node tag.
bool isTag(const char* tag) const;
bool isTag(const char* tag) const override;
//! Get XML Node attributes.
virtual int getNumAttributes() const { return m_pAttributes ? (int)m_pAttributes->size() : 0; };
int getNumAttributes() const override
{ return m_pAttributes ? (int)m_pAttributes->size() : 0; };
//! Return attribute key and value by attribute index.
virtual bool getAttributeByIndex(int index, const char** key, const char** value);
bool getAttributeByIndex(int index, const char** key, const char** value) override;
//! Return attribute key and value by attribute index, string version.
virtual bool getAttributeByIndex(int index, XmlString& key, XmlString& value);
virtual void copyAttributes(XmlNodeRef fromNode);
virtual void shareChildren(const XmlNodeRef& fromNode);
void copyAttributes(XmlNodeRef fromNode) override;
//! Get XML Node attribute for specified key.
const char* getAttr(const char* key) const;
const char* getAttr(const char* key) const override;
//! Get XML Node attribute for specified key.
// Returns true if the attribute existes, alse otherwise.
bool getAttr(const char* key, const char** value) const;
bool getAttr(const char* key, const char** value) const override;
//! Check if attributes with specified key exist.
bool haveAttr(const char* key) const;
bool haveAttr(const char* key) const override;
//! Creates new xml node and add it to childs list.
XmlNodeRef newChild(const char* tagName);
XmlNodeRef newChild(const char* tagName) override;
//! Adds new child node.
void addChild(const XmlNodeRef& node);
void addChild(const XmlNodeRef& node) override;
//! Remove child node.
void removeChild(const XmlNodeRef& node);
void insertChild(int nIndex, const XmlNodeRef& node);
void replaceChild(int nIndex, const XmlNodeRef& node);
void removeChild(const XmlNodeRef& node) override;
//! Remove all child nodes.
void removeAllChilds();
void removeAllChilds() override;
//! Get number of child XML nodes.
int getChildCount() const { return m_pChilds ? (int)m_pChilds->size() : 0; };
int getChildCount() const override { return m_pChilds ? (int)m_pChilds->size() : 0; }
//! Get XML Node child nodes.
XmlNodeRef getChild(int i) const;
XmlNodeRef getChild(int i) const override;
//! Find node with specified tag.
XmlNodeRef findChild(const char* tag) const;
XmlNodeRef findChild(const char* tag) const override;
void deleteChild(const char* tag);
void deleteChildAt(int nIndex);
//! Get parent XML node.
XmlNodeRef getParent() const { return m_parent; }
void setParent(const XmlNodeRef& inRef);
XmlNodeRef getParent() const override { return m_parent; }
void setParent(const XmlNodeRef& inRef) override;
//! Returns content of this node.
const char* getContent() const { return m_content; };
void setContent(const char* str);
const char* getContent() const override
{ return m_content; };
void setContent(const char* str) override;
XmlNodeRef clone();
//! Returns line number for XML tag.
int getLine() const { return m_line; };
//! Set line number in xml.
void setLine(int line) { m_line = line; };
void setLine(int line) override { m_line = line; }
//! Returns XML of this node and sub nodes.
virtual IXmlStringData* getXMLData(int nReserveMem = 0) const;
XmlString getXML(int level = 0) const;
XmlString getXMLUnsafe(int level, char* tmpBuffer, uint32 sizeOfTmpBuffer) const;
bool saveToFile(const char* fileName); // saves in one huge chunk
bool saveToFile(const char* fileName, size_t chunkSizeBytes, AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle); // save in small memory chunks
IXmlStringData* getXMLData(int nReserveMem = 0) const override;
XmlString getXML(int level = 0) const override;
bool saveToFile(const char* fileName) override; // saves in one huge chunk
bool saveToFile(const char* fileName, size_t chunkSizeBytes, AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle) override; // save in small memory chunks
//! Set new XML Node attribute (or override attribute with same key).
using IXmlNode::setAttr;
void setAttr(const char* key, const char* value);
void setAttr(const char* key, int value);
void setAttr(const char* key, unsigned int value);
void setAttr(const char* key, int64 value);
void setAttr(const char* key, uint64 value, bool useHexFormat = true);
void setAttr(const char* key, float value);
void setAttr(const char* key, double value);
void setAttr(const char* key, const Vec2& value);
void setAttr(const char* key, const Ang3& value);
void setAttr(const char* key, const Vec3& value);
void setAttr(const char* key, const Vec4& value);
void setAttr(const char* key, const Quat& value);
void setAttr(const char* key, const char* value) override;
void setAttr(const char* key, int value) override;
void setAttr(const char* key, unsigned int value) override;
void setAttr(const char* key, int64 value) override;
void setAttr(const char* key, uint64 value, bool useHexFormat = true) override;
void setAttr(const char* key, float value) override;
void setAttr(const char* key, double value) override;
void setAttr(const char* key, const Vec2& value) override;
void setAttr(const char* key, const Ang3& value) override;
void setAttr(const char* key, const Vec3& value) override;
void setAttr(const char* key, const Vec4& value) override;
void setAttr(const char* key, const Quat& value) override;
//! Delete attrbute.
void delAttr(const char* key);
void delAttr(const char* key) override;
//! Remove all node attributes.
void removeAllAttributes();
void removeAllAttributes() override;
//! Get attribute value of node.
bool getAttr(const char* key, int& value) const;
bool getAttr(const char* key, unsigned int& value) const;
bool getAttr(const char* key, int64& value) const;
bool getAttr(const char* key, uint64& value, bool useHexFormat = true /*ignored*/) const;
bool getAttr(const char* key, float& value) const;
bool getAttr(const char* key, double& value) const;
bool getAttr(const char* key, bool& value) const;
bool getAttr(const char* key, int& value) const override;
bool getAttr(const char* key, unsigned int& value) const override;
bool getAttr(const char* key, int64& value) const override;
bool getAttr(const char* key, uint64& value, bool useHexFormat = true /*ignored*/) const override;
bool getAttr(const char* key, float& value) const override;
bool getAttr(const char* key, double& value) const override;
bool getAttr(const char* key, bool& value) const override;
bool getAttr(const char* key, XmlString& value) const {const char* v(NULL); bool boHasAttribute(getAttr(key, &v)); value = v; return boHasAttribute; }
bool getAttr(const char* key, XmlString& value) const override
{const char* v(NULL); bool boHasAttribute(getAttr(key, &v)); value = v; return boHasAttribute; }
bool getAttr(const char* key, Vec2& value) const;
bool getAttr(const char* key, Ang3& value) const;
bool getAttr(const char* key, Vec3& value) const;
bool getAttr(const char* key, Vec4& value) const;
bool getAttr(const char* key, Quat& value) const;
bool getAttr(const char* key, ColorB& value) const;
bool getAttr(const char* key, Vec2& value) const override;
bool getAttr(const char* key, Ang3& value) const override;
bool getAttr(const char* key, Vec3& value) const override;
bool getAttr(const char* key, Vec4& value) const override;
bool getAttr(const char* key, Quat& value) const override;
bool getAttr(const char* key, ColorB& value) const override;
protected:
@@ -356,7 +349,7 @@ class CXmlNodeReuse
{
public:
CXmlNodeReuse(const char* tag, CXmlNodePool* pPool);
virtual void Release();
void Release() override;
protected:
CXmlNodePool* m_pPool;