Merge branch 'upstream/development' into LYN-8514_AutomatedReviewServerLogChecks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <CryEndian.h> // eLittleEndian
|
||||
#include <CryHalf.inl>
|
||||
#include <float.h>
|
||||
#include <limits>
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declarations //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
@@ -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
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
//##@}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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));
|
||||
};
|
||||
|
||||
@@ -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>;
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user