platform.h cleanup

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-06 15:10:21 -07:00
parent 9a8a411a0b
commit d6744690ee
34 changed files with 145 additions and 777 deletions
+1
View File
@@ -14,6 +14,7 @@
#include <AzCore/PlatformIncl.h>
#include <CryCommon/platform.h>
#include <CryCommon/Cry_Geo.h>
#include <set>
// forward declarations.
class CEntityObject;
+2
View File
@@ -15,6 +15,8 @@
#include "Util/GuidUtil.h"
#include "ErrorReport.h"
#include <set>
class CPakFile;
class CErrorRecord;
struct IObjectManager;
@@ -9,6 +9,7 @@
#include "CryFile.h"
#include "PerforceSourceControl.h"
#include "PasswordDlg.h"
#include <CryCommon/CryThread.h>
#include <QSettings>
#include <QDir>
-1
View File
@@ -35,7 +35,6 @@
// to what some structs/classes need.
#define CRY_FORCE_MALLOC_NEW_ALIGN
#define DEBUG_BREAK raise(SIGTRAP)
#define RC_EXECUTABLE "rc"
#define USE_CRT 1
#define SIZEOF_PTR 4
-7
View File
@@ -18,7 +18,6 @@
#endif
#define DEBUG_BREAK __builtin_trap()
#define RC_EXECUTABLE "rc"
//////////////////////////////////////////////////////////////////////////
@@ -52,12 +51,6 @@
#define __COUNTER__ __LINE__
#endif
#ifdef __FUNC__
#undef __FUNC__
#endif
#define __FUNC__ __func__
typedef void* LPVOID;
#define VOID void
#define PVOID void*
-11
View File
@@ -36,7 +36,6 @@ ILINE uint32 countLeadingZeros32(uint32 x)
{
DWORD result = 32 ^ 31; // assumes result is unmodified if _BitScanReverse returns 0
_BitScanReverse(&result, x);
PREFAST_SUPPRESS_WARNING(6102);
result ^= 31; // needed because the index is from LSB (whereas all other implementations are from MSB)
return result;
}
@@ -73,16 +72,6 @@ inline bool IsPowerOfTwo(TInteger x)
return (x & (x - 1)) == 0;
}
// compile time version of IsPowerOfTwo, useful for STATIC_CHECK
template <int nValue>
struct IsPowerOfTwoCompileTime
{
enum
{
IsPowerOfTwo = ((nValue & (nValue - 1)) == 0)
};
};
inline uint32 NextPower2(uint32 n)
{
n--;
+2 -16
View File
@@ -15,24 +15,10 @@
//---------------------------------------------------------------------------
// Convenient iteration macros
#define for_iter(IT, it, b, e) for (IT it = (b), _e = (e); it != _e; ++it)
#define for_container(CT, it, cont) for_iter (CT::iterator, it, (cont).begin(), (cont).end())
#define for_ptr(T, it, b, e) for (T* it = (b), * _e = (e); it != _e; ++it)
#define for_array_ptr(T, it, arr) for_ptr (T, it, (arr).begin(), (arr).end())
#define for_array(i, arr) for (int i = 0, _e = (arr).size(); i < _e; i++)
#define for_all(cont) for_array (_i, cont) cont[_i]
//---------------------------------------------------------------------------
// Stack array helper
#define ALIGNED_STACK_ARRAY(T, name, size, alignment) \
PREFAST_SUPPRESS_WARNING(6255) \
T * name = (T*) alloca((size) * sizeof(T) + alignment - 1); \
name = Align(name, alignment);
#define STACK_ARRAY(T, name, size) \
ALIGNED_STACK_ARRAY(T, name, size, alignof(T)) \
#define for_array_ptr(T, it, arr) for_ptr (T, it, (arr).begin(), (arr).end())
#define for_array(i, arr) for (int i = 0, _e = (arr).size(); i < _e; i++)
//---------------------------------------------------------------------------
// Specify semantics for moving objects.
+1 -2
View File
@@ -71,7 +71,6 @@
#if defined(USE_CRY_ASSERT) && CRYASSERT_H_TRAIT_USE_CRY_ASSERT_MESSAGE
void CryAssertTrace(const char*, ...);
bool CryAssert(const char*, const char*, unsigned int, bool*);
void CryDebugBreak();
#define CRY_ASSERT(condition) CRY_ASSERT_MESSAGE(condition, NULL)
@@ -86,7 +85,7 @@ void CryDebugBreak();
CryAssertTrace parenthese_message; \
if (CryAssert(#condition, __FILE__, __LINE__, &s_bIgnoreAssert)) \
{ \
DEBUG_BREAK; \
AZ::Debug::Trace::Break(); \
} \
} \
} while (0)
+2 -2
View File
@@ -581,7 +581,7 @@ protected:
// use this to push (and automatically pop) the sizer component name at the beginning of the
// getSize() function
#define SIZER_COMPONENT_NAME(pSizerPointer, szComponentName) PREFAST_SUPPRESS_WARNING(6246) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, false)
#define SIZER_SUBCOMPONENT_NAME(pSizerPointer, szComponentName) PREFAST_SUPPRESS_WARNING(6246) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, true)
#define SIZER_COMPONENT_NAME(pSizerPointer, szComponentName) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, false)
#define SIZER_SUBCOMPONENT_NAME(pSizerPointer, szComponentName) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, true)
#endif // CRYINCLUDE_CRYCOMMON_CRYSIZER_H
@@ -14,13 +14,7 @@
#include "CryThread_pthreads.h"
#if PLATFORM_SUPPORTS_THREADLOCAL
THREADLOCAL CrySimpleThreadSelf
* CrySimpleThreadSelf::m_Self = NULL;
#else
TLS_DEFINE(CrySimpleThreadSelf*, g_CrySimpleThreadSelf)
#endif
AZ_THREAD_LOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
//////////////////////////////////////////////////////////////////////////
// CryEvent(Timed) implementation
@@ -20,7 +20,7 @@ struct SThreadNameDesc
DWORD dwFlags;
};
THREADLOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
AZ_THREAD_LOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
//////////////////////////////////////////////////////////////////////////
CryEvent::CryEvent()
+1 -1
View File
@@ -672,7 +672,7 @@ protected:
m_Self = pSelf;
}
private:
static THREADLOCAL CrySimpleThreadSelf* m_Self;
static AZ_THREAD_LOCAL CrySimpleThreadSelf* m_Self;
#else
+1 -1
View File
@@ -189,7 +189,7 @@ public:
virtual ~CrySimpleThreadSelf();
protected:
void StartThread(unsigned (__stdcall * func)(void*), void* argList);
static THREADLOCAL CrySimpleThreadSelf* m_Self;
static AZ_THREAD_LOCAL CrySimpleThreadSelf* m_Self;
private:
CrySimpleThreadSelf(const CrySimpleThreadSelf&);
CrySimpleThreadSelf& operator = (const CrySimpleThreadSelf&);
+1
View File
@@ -14,6 +14,7 @@
#define CRYINCLUDE_CRYCOMMON_IFUNCTORBASE_H
#pragma once
#include <CryCommon/CryThread.h>
// Base class for functor storage.
// Not intended for direct usage.
+1
View File
@@ -37,6 +37,7 @@ struct IRenderMesh;
#include <IXml.h>
#include <smartptr.h>
#include <AzCore/EBus/EBus.h>
#include <CryThread.h>
#ifdef MAX_SUB_MATERIALS
// This checks that the values are in sync in the different files.
+1 -1
View File
@@ -1419,7 +1419,7 @@ namespace Detail
} DummyStaticInstance; \
if (!(gEnv->pConsole != 0 ? gEnv->pConsole->Register(&DummyStaticInstance) : 0)) \
{ \
DEBUG_BREAK; \
AZ::Debug::Trace::Break(); \
CryFatalError("Can not register dummy CVar"); \
} \
} while (0)
-1
View File
@@ -18,7 +18,6 @@
#define _CPU_X86
//#define _CPU_SSE
#define DEBUG_BREAK raise(SIGTRAP)
#define RC_EXECUTABLE "rc"
#define USE_CRT 1
#define SIZEOF_PTR 4
-1
View File
@@ -20,7 +20,6 @@
#define _CPU_AMD64
#define _CPU_SSE
#define DEBUG_BREAK ::raise(SIGTRAP)
#define RC_EXECUTABLE "rc"
#define USE_CRT 1
#define SIZEOF_PTR 8
-17
View File
@@ -42,23 +42,6 @@
#include <vector>
#include <string>
#ifdef __FUNC__
#undef __FUNC__
#endif
#if defined(__GNUC__) || defined(__clang__)
#define __FUNC__ __func__
#else
#define __FUNC__ \
({ \
static char __f[sizeof(__PRETTY_FUNCTION__) + 1]; \
strcpy(__f, __PRETTY_FUNCTION__); \
char* __p = (char*)strchr(__f, '('); \
*__p = 0; \
while (*(__p) != ' ' && __p != (__f - 1)) {--__p; } \
(__p + 1); \
})
#endif
typedef void* LPVOID;
#define VOID void
#define PVOID void*
+1 -1
View File
@@ -63,7 +63,7 @@ void CMTRand_int32::seed(const uint32* array, int size) // init by array
}
for (int k = n - 1; k; --k)
{
PREFAST_SUPPRESS_WARNING(6385) PREFAST_SUPPRESS_WARNING(6386) m_nState[i] = (m_nState[i] ^ ((m_nState[i - 1] ^ (m_nState[i - 1] >> 30)) * 1566083941UL)) - i;
m_nState[i] = (m_nState[i] ^ ((m_nState[i - 1] ^ (m_nState[i - 1] >> 30)) * 1566083941UL)) - i;
if ((++i) == n)
{
m_nState[0] = m_nState[n - 1];
+53 -133
View File
@@ -16,10 +16,6 @@
#include "BaseTypes.h"
#include <AzCore/PlatformDef.h>
#if defined(_RELEASE) && !defined(RELEASE)
#define RELEASE
#endif
// Section dictionary
#if defined(AZ_RESTRICTED_PLATFORM)
#define PROJECTDEFINES_H_SECTION_STATS_AGENT 1
@@ -31,57 +27,51 @@
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_STATS_AGENT
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#elif defined(WIN32) || defined(WIN64)
#if !defined(_RELEASE) || defined(PERFORMANCE_BUILD)
#define ENABLE_STATS_AGENT
#endif
#if !defined(_RELEASE) || defined(PERFORMANCE_BUILD)
#define ENABLE_STATS_AGENT
#endif
#endif
// The following definitions are used by Sandbox and RC to determine which platform support is needed
#define TOOLS_SUPPORT_POWERVR
#define TOOLS_SUPPORT_ETC2COMP
// Type used for vertex indices
// WARNING: If you change this typedef, you need to update AssetProcessorPlatformConfig.ini to convert cgf and abc files to the proper index format.
#if defined(RESOURCE_COMPILER)
typedef uint32 vtx_idx;
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
typedef uint32 vtx_idx;
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(MOBILE)
typedef uint16 vtx_idx;
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
typedef uint16 vtx_idx;
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_VTX_IDX
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
// Uncomment one of the two following typedefs:
typedef uint32 vtx_idx;
//typedef uint16 vtx_idx;
// Uncomment one of the two following typedefs:
typedef uint32 vtx_idx;
//typedef uint16 vtx_idx;
#endif
// 0=off, 1=on
#define TERRAIN_USE_CIE_COLORSPACE 0
// When non-zero, const cvar accesses (by name) are logged in release-mode on consoles.
// This can be used to find non-optimal usage scenario's, where the constant should be used directly instead.
// Since read accesses tend to be used in flow-control logic, constants allow for better optimization by the compiler.
#define LOG_CONST_CVAR_ACCESS 0
#if defined(WIN32) || defined(WIN64) || LOG_CONST_CVAR_ACCESS
#define RELEASE_LOGGING
#define RELEASE_LOGGING
#endif
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
#define EXCLUDE_NORMAL_LOG
#define EXCLUDE_NORMAL_LOG
#endif
// Add the "REMOTE_ASSET_PROCESSOR" define except in release
// this makes it so that asset processor functions. Without this, all assets must be present and on local media
// with this, the asset processor can be used to remotely process assets.
#if !defined(_RELEASE)
# define REMOTE_ASSET_PROCESSOR
#define REMOTE_ASSET_PROCESSOR
#endif
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD))
@@ -93,132 +83,68 @@ typedef uint32 vtx_idx;
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_TRAITS
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
#else
#define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
#if !defined(LINUX) && !defined(APPLE)
#define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
#endif
#if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
#define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
#endif
#define PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION 1
#if defined(WIN32)
#define PROJECTDEFINES_H_TRAIT_USE_SVO_GI 1
#endif
#if defined(APPLE) || defined(LINUX)
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS 1
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_UNIX_PATHS 1
#endif
#endif
#define USE_GLOBAL_BUCKET_ALLOCATOR
#ifdef IS_PROSDK
# define USING_TAGES_SECURITY // Wrapper for TGVM security
# if defined(LINUX) || defined(APPLE)
# error LINUX and Mac does not support evaluation version
# endif
#endif
#ifdef USING_TAGES_SECURITY
# define TAGES_EXPORT __declspec(dllexport)
#else
# define TAGES_EXPORT
#endif // USING_TAGES_SECURITY
// test -------------------------------------
#define _DATAPROBE
//This feature allows automatic crash submission to JIRA, but does not work outside of O3DE
//Note: This #define will be commented out during code export
#define ENABLE_CRASH_HANDLER
#if !defined(PHYSICS_STACK_SIZE)
# define PHYSICS_STACK_SIZE (128U << 10)
#define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
#if !defined(LINUX) && !defined(APPLE)
#define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
#endif
#if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
#define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
#endif
#define PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION 1
#if defined(WIN32)
#define PROJECTDEFINES_H_TRAIT_USE_SVO_GI 1
#endif
#if defined(APPLE) || defined(LINUX)
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS 1
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_UNIX_PATHS 1
#endif
#endif
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) && !defined(RESOURCE_COMPILER)
#ifndef ENABLE_PROFILING_CODE
#define ENABLE_PROFILING_CODE
#endif
#if !(defined(SANDBOX_EXPORTS) || defined(PLUGIN_EXPORTS) || (defined(AZ_MONOLITHIC_BUILD) && PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS))
#define ENABLE_PROFILING_MARKERS
#endif
#ifndef ENABLE_PROFILING_CODE
#define ENABLE_PROFILING_CODE
#endif
//lightweight profilers, disable for submissions, disables displayinfo inside 3dengine as well
#ifndef ENABLE_LW_PROFILERS
#define ENABLE_LW_PROFILERS
#endif
#endif
#if defined(ENABLE_PROFILING_CODE)
#define ENABLE_ART_RT_TIME_ESTIMATE
#endif
#if defined(ENABLE_PROFILING_CODE) && !defined(_RELEASE)
#define FMOD_STREAMING_DEBUGGING 1
#endif
#if defined(WIN32) || defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX)
#define FLARES_SUPPORT_EDITING
//lightweight profilers, disable for submissions, disables displayinfo inside 3dengine as well
#ifndef ENABLE_LW_PROFILERS
#define ENABLE_LW_PROFILERS
#endif
#endif
// Reflect texture slot information - only used in the editor
#if defined(WIN32) || defined(WIN64) || defined(AZ_PLATFORM_MAC)
#define SHADER_REFLECT_TEXTURE_SLOTS 1
#define SHADER_REFLECT_TEXTURE_SLOTS 1
#else
#define SHADER_REFLECT_TEXTURE_SLOTS 0
#define SHADER_REFLECT_TEXTURE_SLOTS 0
#endif
// these enable and disable certain net features to give compatibility between PCs and consoles / profile and performance builds
#define PC_CONSOLE_NET_COMPATIBLE 0
#define PROFILE_PERFORMANCE_NET_COMPATIBLE 0
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) && !PROFILE_PERFORMANCE_NET_COMPATIBLE
#define USE_LAGOMETER (1)
#else
#define USE_LAGOMETER (0)
#endif
// enable this in order to support old style material names in old data ("engine/material.mtl" or "mygame/material.mtl" as opposed to just "material.mtl")
// previously, material names could have the game folder in it, but this is not necessary anymore and would not work with things like gems
// note that if you use any older projects such as GameSDK this should remain enabled
#define SUPPORT_LEGACY_MATERIAL_NAMES
// Enable additional structures and code for sprite motion blur. Currently non-functional and disabled
// #define PARTICLE_MOTION_BLUR
// a special ticker thread to run during load and unload of levels
#define USE_NETWORK_STALL_TICKER_THREAD
#if !defined(MOBILE)
//---------------------------------------------------------------------
// Enable Tessellation Features
// (displacement mapping, subdivision, water tessellation)
//---------------------------------------------------------------------
// Modules : 3DEngine, Renderer
// Depends on: DX11
//---------------------------------------------------------------------
// Enable Tessellation Features
// (displacement mapping, subdivision, water tessellation)
//---------------------------------------------------------------------
// Modules : 3DEngine, Renderer
// Depends on: DX11
// Global tessellation feature flag
// Global tessellation feature flag
#define TESSELLATION
#ifdef TESSELLATION
// Specific features flags
// Specific features flags
#define WATER_TESSELLATION
#define PARTICLES_TESSELLATION
#if PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION
// Mesh tessellation (displacement, smoothing, subd)
// Mesh tessellation (displacement, smoothing, subd)
#define MESH_TESSELLATION
// Mesh tessellation also in motion blur passes
// Mesh tessellation also in motion blur passes
#define MOTIONBLUR_TESSELLATION
#endif
// Dependencies
// Dependencies
#ifdef MESH_TESSELLATION
#define MESH_TESSELLATION_ENGINE
#endif
#ifndef NULL_RENDERER
#ifndef NULL_RENDERER
#ifdef WATER_TESSELLATION
#define WATER_TESSELLATION_RENDERER
#endif
@@ -230,7 +156,7 @@ typedef uint32 vtx_idx;
#endif
#if defined(WATER_TESSELLATION_RENDERER) || defined(PARTICLES_TESSELLATION_RENDERER) || defined(MESH_TESSELLATION_RENDERER)
// Common tessellation flag enabling tessellation stages in renderer
// Common tessellation flag enabling tessellation stages in renderer
#define TESSELLATION_RENDERER
#endif
#endif // !NULL_RENDERER
@@ -249,14 +175,8 @@ typedef uint32 vtx_idx;
#endif
#if defined(ENABLE_PROFILING_CODE)
# define USE_DISK_PROFILER
# define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
#endif
#if PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES && !defined(NULL_RENDERER)
#define GPU_PARTICLES 1
#else
#define GPU_PARTICLES 0
#define USE_DISK_PROFILER
#define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
#endif
// The maximum number of joints in an animation
-1
View File
@@ -23,7 +23,6 @@
#define ILINE __forceinline
#endif
#define DEBUG_BREAK _asm { int 3 }
#define RC_EXECUTABLE "rc.exe"
#define DEPRECATED __declspec(deprecated)
#define TYPENAME(x) typeid(x).name()
-1
View File
@@ -19,7 +19,6 @@
#define _CPU_SSE
#define ILINE __forceinline
#define DEBUG_BREAK CryDebugBreak()
#define RC_EXECUTABLE "rc.exe"
#define DEPRECATED __declspec(deprecated)
#define TYPENAME(x) typeid(x).name()
-41
View File
@@ -1127,20 +1127,6 @@ void CrySleep(unsigned int dwMilliseconds)
Sleep(dwMilliseconds);
}
//////////////////////////////////////////////////////////////////////////
void CryLowLatencySleep(unsigned int dwMilliseconds)
{
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION WINBASE_CPP_SECTION_6
#include AZ_RESTRICTED_FILE(WinBase_cpp)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
CrySleep(dwMilliseconds);
#endif
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
@@ -1284,14 +1270,6 @@ int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
#endif
}
//////////////////////////////////////////////////////////////////////////
short CryGetAsyncKeyState(int vKey)
{
//TODO: implement
CRY_ASSERT_MESSAGE(0, "CryGetAsyncKeyState not implemented yet");
return 0;
}
#if defined(LINUX) || defined(APPLE) || defined(DEFINE_CRY_INTERLOCKED_INCREMENT)
//[K01]: http://www.memoryhole.net/kyle/2007/05/atomic_incrementing.html
//http://forums.devx.com/archive/index.php/t-160558.html
@@ -1382,10 +1360,6 @@ threadID CryGetCurrentThreadId()
return GetCurrentThreadId();
}
void CryDebugBreak()
{
__builtin_trap();
}
#endif//LINUX APPLE
#if defined(APPLE) || defined(LINUX)
@@ -1398,11 +1372,6 @@ DLL_EXPORT void OutputDebugString(const char* outputString)
#endif
}
DLL_EXPORT void DebugBreak()
{
CryDebugBreak();
}
#endif
// This code does not have a long life span and will be replaced soon
@@ -1626,16 +1595,6 @@ DWORD GetFileAttributes(LPCSTR lpFileName)
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
}
uint32 CryGetFileAttributes(const char* lpFileName)
{
string fn = lpFileName;
adaptFilenameToLinux(fn);
const char* buffer = fn.c_str();
return GetFileAttributes(buffer);
}
__finddata64_t::~__finddata64_t()
{
if (m_Dir != FS_DIR_NULL)
+40 -437
View File
@@ -7,136 +7,31 @@
*/
// Description : Platform dependend stuff.
// Description : Platform dependent stuff.
// Include this file instead of windows h
#pragma once
#if defined(AZ_RESTRICTED_PLATFORM)
#undef AZ_RESTRICTED_SECTION
#define PLATFORM_H_SECTION_1 1
#define PLATFORM_H_SECTION_2 2
#define PLATFORM_H_SECTION_3 3
#define PLATFORM_H_SECTION_4 4
#define PLATFORM_H_SECTION_5 5
#define PLATFORM_H_SECTION_6 6
#define PLATFORM_H_SECTION_7 7
#define PLATFORM_H_SECTION_8 8
#define PLATFORM_H_SECTION_9 9
#define PLATFORM_H_SECTION_10 10
#define PLATFORM_H_SECTION_11 11
#define PLATFORM_H_SECTION_12 12
#define PLATFORM_H_SECTION_13 13
#define PLATFORM_H_SECTION_14 14
#define PLATFORM_H_SECTION_15 15
#endif
// certain C++ features are not available in some compiler versions
// turn them off here:
// #define _ALLOW_KEYWORD_MACROS
// #define _DISALLOW_INITIALIZER_LISTS
// #define _DISALLOW_ENUM_CLASS
#if defined(_MSC_VER)
#define _ALLOW_KEYWORD_MACROS
#define alignof _alignof
#if !defined(_HAS_EXCEPTIONS)
#define _HAS_EXCEPTIONS 0
#endif
#elif defined(__GNUC__)
#define alignof __alignof__
#endif
// Alignment|InitializerList support.
#define _ALLOW_INITIALIZER_LISTS
#if (defined(LINUX) && !defined(ANDROID)) || defined(APPLE)
#define _FILE_OFFSET_BITS 64 // define large file support > 2GB
#define _FILE_OFFSET_BITS 64 // define large file support > 2GB
#endif
#include <AzCore/PlatformIncl.h>
#include <cstring>
#if defined(_MSC_VER) // We want the class name to be included, but __FUNCTION__ doesn't contain that on GCC/clang
#define __FUNC__ __FUNCTION__
#else
#define __FUNC__ __PRETTY_FUNCTION__
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_1
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(_DEBUG) && !defined(LINUX) && !defined(APPLE)
#include <crtdbg.h>
#endif
#define RESTRICT_POINTER __restrict
// we have to use it because of VS doesn't support restrict reference variables
#if defined(APPLE) || defined(LINUX)
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#define GCC411_OR_LATER
#endif
#define RESTRICT_REFERENCE __restrict
#else
#define RESTRICT_REFERENCE
#endif
#ifndef CHECK_REFERENCE_COUNTS //define that in your StdAfx.h to override per-project
# define CHECK_REFERENCE_COUNTS 0 //default value
#endif
#if CHECK_REFERENCE_COUNTS
# define CHECK_REFCOUNT_CRASH(x) { if (!(x)) {*((int*)0) = 0; } \
}
#else
# define CHECK_REFCOUNT_CRASH(x)
#endif
#ifndef GARBAGE_MEMORY_ON_FREE //define that in your StdAfx.h to override per-project
# define GARBAGE_MEMORY_ON_FREE 0 //default value
#endif
#if GARBAGE_MEMORY_ON_FREE
# ifndef GARBAGE_MEMORY_RANDOM //define that in your StdAfx.h to override per-project
# define GARBAGE_MEMORY_RANDOM 1 //0 to change it to progressive pattern
# endif
#endif
//////////////////////////////////////////////////////////////////////////
// Available predefined compiler macros for Visual C++.
// _MSC_VER // Indicates MS Visual C compiler version
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_2
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
// _WIN32, _WIN64 // Indicates target OS
#endif
// _M_IX86, _M_PPC // Indicates target processor
// _DEBUG // Building in Debug mode
// _DLL // Linking with DLL runtime libs
// _MT // Linking with multi-threaded runtime libs
//////////////////////////////////////////////////////////////////////////
//
// Translate some predefined macros.
//
// NDEBUG disables std asserts, etc.
// Define it automatically if not compiling with Debug libs, or with ADEBUG flag.
#if !defined(_DEBUG) && !defined(ADEBUG) && !defined(NDEBUG)
#define NDEBUG
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_3
#include AZ_RESTRICTED_FILE(platform_h)
@@ -147,44 +42,6 @@
#define CONSOLE
#endif
//render thread settings, as this is accessed inside 3dengine and renderer and needs to be compile time defined, we need to do it here
//enable this macro to strip out the overhead for render thread
// #define STRIP_RENDER_THREAD
#ifdef STRIP_RENDER_THREAD
#define RT_COMMAND_BUF_COUNT 1
#else
//can be enhanced to triple buffering, FlushFrame needs to be adjusted and RenderObj would become 132 bytes
#define RT_COMMAND_BUF_COUNT 2
#endif
// We use WIN macros without _.
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_4
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
#if defined(_WIN32) && !defined(LINUX32) && !defined(LINUX64) && !defined(APPLE) && !defined(WIN32)
#define WIN32
#endif
#if defined(_WIN64) && !defined(WIN64)
#define WIN64
#endif
#endif
// In Win32 Release we use static linkage
#ifdef WIN32
#if !defined(_RELEASE) || defined(RESOURCE_COMPILER) || defined(EDITOR) || defined(_FORCEDLL)
// All windows targets not in Release built as DLLs.
#ifndef _USRDLL
#define _USRDLL
#endif
#endif
#endif //WIN32
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_5
#include AZ_RESTRICTED_FILE(platform_h)
@@ -205,19 +62,17 @@
#define PRId64 "lld"
#define PRIu64 "llu"
#endif
#define PLATFORM_I64(x) x##ll
#else
#include <inttypes.h>
#define PLATFORM_I64(x) x##i64
#endif
#if !defined(PRISIZE_T)
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_6
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_6
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN64)
#define PRISIZE_T "I64u" //size_t defined as unsigned __int64
#elif defined(WIN32) || defined(LINUX32)
@@ -228,13 +83,14 @@
#error "Please defined PRISIZE_T for this platform"
#endif
#endif
#if !defined(PRI_THREADID)
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_7
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_7
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(MAC) || defined(IOS) && defined(__LP64__) && defined(__LP64__)
#define PRI_THREADID "lld"
#elif defined(LINUX64) || defined(ANDROID)
@@ -243,6 +99,7 @@
#define PRI_THREADID "d"
#endif
#endif
#include "ProjectDefines.h" // to get some defines available in every CryEngine project
// Function attribute for printf/scanf-style parameters.
@@ -277,47 +134,6 @@
#define PRINTF_EMPTY_FORMAT ""
#endif
#if defined(IOS)
#define USE_PTHREAD_TLS
#endif
// Storage class modifier for thread local storage.
// THEADLOCAL should NOT be defined to empty because that creates some
// really hard to find issues.
#if !defined(USE_PTHREAD_TLS)
# define THREADLOCAL AZ_TRAIT_COMPILER_THREAD_LOCAL
#endif //!defined(USE_PTHREAD_TLS)
//////////////////////////////////////////////////////////////////////////
// define Read Write Barrier macro needed for lockless programming
//////////////////////////////////////////////////////////////////////////
#if defined(__arm__)
/**
* (ARMv7) Full memory barriar.
*
* None of GCC 4.6/4.8 or clang 3.3/3.4 have a builtin intrinsic for ARM's ldrex/strex or dmb
* instructions. This is a placeholder until supplied by the toolchain.
*/
inline void __dmb()
{
// The linux kernel uses "dmb ish" to only sync with local monitor (arch/arm/include/asm/barrier.h):
//#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
//#define smp_mb() dmb(ish)
__asm__ __volatile__ ("dmb ish" : : : "memory");
}
#define READ_WRITE_BARRIER {__dmb(); }
#else
#define READ_WRITE_BARRIER
#endif
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// define macro to prevent memory reoderings of reads/and writes
//TODO implement for all GCC platforms, else there are potential crashes with strict aliasing
#define MEMORY_RW_REORDERING_BARRIER do { /*not implemented*/} while (0)
//default stack size for threads, currently only used on pthread platforms
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -325,7 +141,7 @@ inline void __dmb()
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(LINUX) || defined(APPLE)
#if !defined(_DEBUG)
#define SIMPLE_THREAD_STACK_SIZE_KB (256)
@@ -362,22 +178,6 @@ inline void __dmb()
#else
#define _HELP(x) ""
#endif
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Globally Used Defines.
//////////////////////////////////////////////////////////////////////////
// CPU Types: _CPU_X86,_CPU_AMD64,_CPU_G5
// Platform: WIN23,WIN64,LINUX32,LINUX64,MAC
// CPU supported functionality: _CPU_SSE
//////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER)
#define PREFAST_SUPPRESS_WARNING(W) __pragma(warning(suppress: W))
#else
#define PREFAST_SUPPRESS_WARNING(W)
#endif
#ifdef _PREFAST_
# define PREFAST_ASSUME(cond) __analysis_assume(cond)
@@ -385,47 +185,21 @@ inline void __dmb()
# define PREFAST_ASSUME(cond)
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_9
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
#if defined(WIN32) && !defined(WIN64)
#include "Win32specific.h"
#endif
#if defined(WIN64)
#include "Win64specific.h"
#endif
#endif
#if defined(LINUX64) && !defined(ANDROID)
#include "Linux64Specific.h"
#endif
#if defined(LINUX32) && !defined(ANDROID)
#include "Linux32Specific.h"
#endif
#if defined(ANDROID)
#include "AndroidSpecific.h"
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_10
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(MAC)
#include "MacSpecific.h"
#endif
#if defined(IOS)
#include "iOSSpecific.h"
#else
#if defined(WIN64)
#include "Win64specific.h"
#elif defined(LINUX64)
#include "Linux64Specific.h"
#elif defined(MAC)
#include "MacSpecific.h"
#elif defined(ANDROID)
#include "AndroidSpecific.h"
#elif defined(IOS)
#include "iOSSpecific.h"
#endif
#endif
@@ -480,12 +254,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
#define DEPRECATED
#endif
//////////////////////////////////////////////////////////////////////////
// compile time error stuff
//////////////////////////////////////////////////////////////////////////
#undef STATIC_CHECK
#define STATIC_CHECK(expr, msg) static_assert(expr, #msg)
// Assert dialog box macros
#include "CryAssert.h"
@@ -500,30 +268,8 @@ ILINE DestinationType alias_cast(SourceType pPtr)
// Platform dependent functions that emulate Win32 API.
// Mostly used only for debugging!
//////////////////////////////////////////////////////////////////////////
void CryDebugBreak();
void CrySleep(unsigned int dwMilliseconds);
void CryLowLatencySleep(unsigned int dwMilliseconds);
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType);
short CryGetAsyncKeyState(int vKey);
unsigned int CryGetFileAttributes(const char* lpFileName);
inline void CryHeapCheck()
{
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_11
#include AZ_RESTRICTED_FILE(platform_h)
#elif !defined(LINUX) && !defined(APPLE) // todo: this might be readded with later xdks?
#if !defined(NDEBUG)
int Result =
#endif
_heapchk();
assert(Result != _HEAPBADBEGIN);
assert(Result != _HEAPBADNODE);
assert(Result != _HEAPBADPTR);
assert(Result != _HEAPEMPTY);
assert(Result == _HEAPOK);
#endif
}
//---------------------------------------------------------------------------
// Useful function to clean the structure.
@@ -554,77 +300,6 @@ inline D check_cast(S const& s)
return d;
}
// Convert one type to another, asserting there is no conversion loss.
// Usage: DestType dest; check_convert(dest, src);
template<class D, class S>
inline D& check_convert(D& d, S const& s)
{
d = D(s);
assert(S(d) == s);
return d;
}
// Convert one type to another, asserting there is no conversion loss.
// Usage: DestType dest; check_convert(dest) = src;
template<class D>
struct CheckConvert
{
CheckConvert(D& d)
: dest(&d) {}
template<class S>
D& operator=(S const& s)
{
return check_convert(*dest, s);
}
protected:
D* dest;
};
template<class D>
inline CheckConvert<D> check_convert(D& d)
{
return d;
}
//---------------------------------------------------------------------------
// Use NoCopy as a base class to easily prevent copy init & assign for any class.
struct NoCopy
{
NoCopy() {}
private:
NoCopy(const NoCopy&);
NoCopy& operator =(const NoCopy&);
};
//---------------------------------------------------------------------------
// ZeroInit: base class to zero the memory of the derived class before initialization, so local objects initialize the same as static.
// Usage:
// class MyClass: ZeroInit<MyClass> {...}
// class MyChild: public MyClass, ZeroInit<MyChild> {...} // ZeroInit must be the last base class
template<class TDerived>
struct ZeroInit
{
#if defined(__clang__) || defined(__GNUC__)
bool __dummy; // Dummy var to create non-zero size, ensuring proper placement in TDerived
#endif
ZeroInit(bool bZero = true)
{
// Optional bool arg to selectively disable zeroing.
if (bZero)
{
// Infer offset of this base class by static casting to derived class.
// Zero only the additional memory of the derived class.
TDerived* struct_end = static_cast<TDerived*>(this) + 1;
size_t memory_size = (char*)struct_end - (char*)this;
memset(this, 0, memory_size);
}
}
};
//---------------------------------------------------------------------------
// Quick const-manipulation macros
@@ -705,29 +380,19 @@ threadID CryGetCurrentThreadId();
#include "CryFixedString.h"
#endif
// need this in a common header file and any other file would be too misleading
enum ETriState
{
eTS_false,
eTS_true,
eTS_maybe
};
#ifdef __GNUC__
#define NO_INLINE __attribute__ ((noinline))
# define NO_INLINE_WEAK __attribute__ ((noinline)) __attribute__((weak)) // marks a function as no_inline, but also as weak to prevent multiple-defined errors
# define __PACKED __attribute__ ((packed))
#else
#define NO_INLINE _declspec(noinline)
# define NO_INLINE_WEAK _declspec(noinline) inline
# define __PACKED
#endif
#ifdef __GNUC__
#define NO_INLINE __attribute__ ((noinline))
#define NO_INLINE_WEAK __attribute__ ((noinline)) __attribute__((weak)) // marks a function as no_inline, but also as weak to prevent multiple-defined errors
#define __PACKED __attribute__ ((packed))
#else
#define NO_INLINE _declspec(noinline)
#define NO_INLINE_WEAK _declspec(noinline) inline
#define __PACKED
#endif
// Fallback for Alignment macro of GCC/CLANG (must be after the class definition)
#if !defined(_ALIGN)
#define _ALIGN(num) AZ_POP_DISABLE_WARNING
#define _ALIGN(num) AZ_POP_DISABLE_WARNING
#endif
// Fallback for Alignment macro of MSVC (must be before the class definition)
@@ -735,60 +400,13 @@ enum ETriState
#define _MS_ALIGN(num) AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option")
#endif
#if defined(WIN32) || defined(WIN64)
extern "C" {
__declspec(dllimport) unsigned long __stdcall TlsAlloc();
__declspec(dllimport) void* __stdcall TlsGetValue(unsigned long dwTlsIndex);
__declspec(dllimport) int __stdcall TlsSetValue(unsigned long dwTlsIndex, void* lpTlsValue);
}
#define TLS_DECLARE(type, var) extern int var##idx;
#define TLS_DEFINE(type, var) \
int var##idx; \
struct Init##var { \
Init##var() { var##idx = TlsAlloc(); } \
}; \
Init##var g_init##var;
#define TLS_DEFINE_DEFAULT_VALUE(type, var, value) \
int var##idx; \
struct Init##var { \
Init##var() { var##idx = TlsAlloc(); TlsSetValue(var##idx, reinterpret_cast<void*>(value)); } \
}; \
Init##var g_init##var;
#define TLS_GET(type, var) (type)TlsGetValue(var##idx)
#define TLS_SET(var, val) TlsSetValue(var##idx, reinterpret_cast<void*>(val))
#elif defined(USE_PTHREAD_TLS)
#define TLS_DECLARE(_TYPE, _VAR) extern SCryPthreadTLS<_TYPE> _VAR##TLSKey;
#define TLS_DEFINE(_TYPE, _VAR) SCryPthreadTLS<_TYPE> _VAR##TLSKey;
#define TLS_DEFINE_DEFAULT_VALUE(_TYPE, _VAR, _DEFAULT) SCryPthreadTLS<_TYPE> _VAR##TLSKey = _DEFAULT;
#define TLS_GET(_TYPE, _VAR) _VAR##TLSKey.Get()
#define TLS_SET(_VAR, _VALUE) _VAR##TLSKey.Set(_VALUE)
#elif defined(THREADLOCAL)
#define TLS_DECLARE(type, var) extern THREADLOCAL type var;
#if defined(LINUX) || defined(MAC)
#define TLS_DEFINE(type, var) THREADLOCAL type var = 0;
#else
#define TLS_DEFINE(type, var) THREADLOCAL type var;
#endif // defined(LINUX) || defined(MAC)
#define TLS_DEFINE_DEFAULT_VALUE(type, var, value) THREADLOCAL type var = value;
#define TLS_GET(type, var) (var)
#define TLS_SET(var, val) (var = (val))
#else // defined(THREADLOCAL)
#error "There's no support for thread local storage"
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_13
#include AZ_RESTRICTED_FILE(platform_h)
#elif !defined(LINUX) && !defined(APPLE)
typedef int socklen_t;
typedef int socklen_t;
#endif
// Include MultiThreading support.
#include "CryThread.h"
#include "MultiThread.h"
// In RELEASE disable printf and fprintf
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -797,19 +415,4 @@ typedef int socklen_t;
#endif
#endif
#define _STRINGIFY(x) #x
#define STRINGIFY(x) _STRINGIFY(x)
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_15
#include AZ_RESTRICTED_FILE(platform_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN32) || defined(WIN64)
#define MESSAGE(msg) message(__FILE__ "(" STRINGIFY(__LINE__) "): " msg)
#else
#define MESSAGE(msg)
#endif
void InitRootDir(char szExeFileName[] = nullptr, uint nExeSize = 0, char szExeRootName[] = nullptr, uint nRootSize = 0);
-53
View File
@@ -204,17 +204,6 @@ void __stl_debug_message(const char* format_str, ...)
#include "CryAssert_impl.h"
//////////////////////////////////////////////////////////////////////////
void CryDebugBreak()
{
#if defined(WIN32) && !defined(RELEASE)
if (IsDebuggerPresent())
#endif
{
DebugBreak();
}
}
//////////////////////////////////////////////////////////////////////////
void CrySleep(unsigned int dwMilliseconds)
{
@@ -222,21 +211,6 @@ void CrySleep(unsigned int dwMilliseconds)
Sleep(dwMilliseconds);
}
//////////////////////////////////////////////////////////////////////////
void CryLowLatencySleep(unsigned int dwMilliseconds)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System);
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYLOWLATENCYSLEEP
#include AZ_RESTRICTED_FILE(platform_impl_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
CrySleep(dwMilliseconds);
#endif
}
//////////////////////////////////////////////////////////////////////////
int CryMessageBox([[maybe_unused]] const char* lpText, [[maybe_unused]] const char* lpCaption, [[maybe_unused]] unsigned int uType)
{
@@ -302,16 +276,6 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[ma
}
}
//////////////////////////////////////////////////////////////////////////
short CryGetAsyncKeyState([[maybe_unused]] int vKey)
{
#ifdef WIN32
return GetAsyncKeyState(vKey);
#else
return 0;
#endif
}
//////////////////////////////////////////////////////////////////////////
LONG CryInterlockedIncrement(int volatile* lpAddend)
{
@@ -417,23 +381,6 @@ void CryLeaveCriticalSection(void* cs)
LeaveCriticalSection((CRITICAL_SECTION*)cs);
}
//////////////////////////////////////////////////////////////////////////
uint32 CryGetFileAttributes(const char* lpFileName)
{
WIN32_FILE_ATTRIBUTE_DATA data;
BOOL res;
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYGETFILEATTRIBUTES
#include AZ_RESTRICTED_FILE(platform_impl_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
res = GetFileAttributesEx(lpFileName, GetFileExInfoStandard, &data);
#endif
return res ? data.dwFileAttributes : -1;
}
//////////////////////////////////////////////////////////////////////////
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
{
+7 -6
View File
@@ -13,6 +13,7 @@
#include <platform.h>
#include <type_traits>
#include <MultiThread.h>
void CryFatalError(const char*, ...) PRINTF_PARAMS(1, 2);
#if defined(APPLE)
@@ -171,13 +172,13 @@ public:
void AddRef()
{
CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
++m_nRefCounter;
}
void Release()
{
CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
if (--m_nRefCounter == 0)
{
delete static_cast<TDerived*>(this);
@@ -215,13 +216,13 @@ public:
void AddRef()
{
CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
++m_nRefCounter;
}
void Release()
{
CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
if (--m_nRefCounter == 0)
{
delete this;
@@ -272,13 +273,13 @@ public:
void AddRef()
{
CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
++m_nRefCounter;
}
void Release()
{
CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
if (--m_nRefCounter == 0)
{
assert(m_pDeleteFnc);
+1 -1
View File
@@ -227,7 +227,7 @@ void IDebugCallStack::FatalError(const char* description)
#if defined(WIN32) || !defined(_RELEASE)
int* p = 0x0;
PREFAST_SUPPRESS_WARNING(6011) * p = 1; // we're intentionally crashing here
*p = 1; // we're intentionally crashing here
#endif
}
+1 -1
View File
@@ -252,7 +252,7 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs)
case 1:
{
int* p = 0;
PREFAST_SUPPRESS_WARNING(6011) * p = 0xABCD;
*p = 0xABCD;
}
break;
case 2:
+16 -23
View File
@@ -355,32 +355,25 @@ void CSystem::FatalError(const char* format, ...)
IDebugCallStack::instance()->FatalError(szBuffer);
#endif
CryDebugBreak();
// app can not continue
AZ::Debug::Trace::Break();
#ifdef _DEBUG
#if defined(WIN32) || defined(WIN64)
_flushall();
// on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
TerminateProcess(GetCurrentProcess(), 1);
#endif
#if defined(WIN32) && !defined(WIN64)
DEBUG_BREAK;
#endif
#else
#if defined(WIN32) || defined(WIN64)
_flushall();
// on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
TerminateProcess(GetCurrentProcess(), 1);
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
_exit(1);
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
_exit(1);
#endif
#endif
}
@@ -26,7 +26,7 @@
if (count > 0) \
{ \
const size_t memSize = count * sizeof(IViewSystemListener*); \
PREFAST_SUPPRESS_WARNING(6255) IViewSystemListener * *pArray = (IViewSystemListener**) alloca(memSize); \
IViewSystemListener* *pArray = (IViewSystemListener**) alloca(memSize); \
memcpy(pArray, &*m_listeners.begin(), memSize); \
while (count--) \
{ \
+1 -1
View File
@@ -1390,7 +1390,7 @@ protected:
{
((XmlParserImp*)userData)->onEndElement(name);
}
static void characterData(void* userData, const char* s, int len) PREFAST_SUPPRESS_WARNING(6262)
static void characterData(void* userData, const char* s, int len)
{
char str[32700];
if (len > sizeof(str) - 1)
@@ -26,12 +26,12 @@
//////////////////////////////////////////////////////////////////////////
// Serialization for anim nodes & param types
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(eUiAnimNodeType_ ## name) == g_animNodeEnumToStringMap.end()); \
g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = STRINGIFY(name); \
g_animNodeStringToEnumMap[string(STRINGIFY(name))] = eUiAnimNodeType_ ## name;
g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = AZ_STRINGIZE(name); \
g_animNodeStringToEnumMap[string(AZ_STRINGIZE(name))] = eUiAnimNodeType_ ## name;
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(eUiAnimParamType_ ## name) == g_animParamEnumToStringMap.end()); \
g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = STRINGIFY(name); \
g_animParamStringToEnumMap[string(STRINGIFY(name))] = eUiAnimParamType_ ## name;
g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = AZ_STRINGIZE(name); \
g_animParamStringToEnumMap[string(AZ_STRINGIZE(name))] = eUiAnimParamType_ ## name;
namespace
{
@@ -74,12 +74,12 @@ static SMovieSequenceAutoComplete s_movieSequenceAutoComplete;
//////////////////////////////////////////////////////////////////////////
// Serialization for anim nodes & param types
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(AnimNodeType::name) == g_animNodeEnumToStringMap.end()); \
g_animNodeEnumToStringMap[AnimNodeType::name] = STRINGIFY(name); \
g_animNodeStringToEnumMap[string(STRINGIFY(name))] = AnimNodeType::name;
g_animNodeEnumToStringMap[AnimNodeType::name] = AZ_STRINGIZE(name); \
g_animNodeStringToEnumMap[string(AZ_STRINGIZE(name))] = AnimNodeType::name;
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(AnimParamType::name) == g_animParamEnumToStringMap.end()); \
g_animParamEnumToStringMap[AnimParamType::name] = STRINGIFY(name); \
g_animParamStringToEnumMap[string(STRINGIFY(name))] = AnimParamType::name;
g_animParamEnumToStringMap[AnimParamType::name] = AZ_STRINGIZE(name); \
g_animParamStringToEnumMap[string(AZ_STRINGIZE(name))] = AnimParamType::name;
namespace
{