Merge pull request #5532 from aws-lumberyard-dev/optimization/unused_files

Optimization: remove unused files
This commit is contained in:
Esteban Papp
2022-01-26 08:19:08 -08:00
committed by GitHub
611 changed files with 223 additions and 82448 deletions
+5 -85
View File
@@ -13,92 +13,12 @@
#include <AzCore/base.h>
//-----------------------------------------------------------------------------------------------------
// Just undef this if you want to use the standard assert function
//-----------------------------------------------------------------------------------------------------
// if AZ_ENABLE_TRACING is enabled, then calls to AZ_Assert(...) will flow in. This is the case
// even in Profile mode - thus if you want to manage what happens, USE_CRY_ASSERT also needs to be enabled in those cases.
// if USE_CRY_ASSERT is not enabled, but AZ_ENABLE_TRACING is enabled, then the default behavior for assets will occur instead
// which is to throw the DEBUG BREAK exception / signal, which tends to end with application shutdown.
#if defined(AZ_ENABLE_TRACE_ASSERTS)
#define USE_AZ_ASSERT
#endif
#if !defined (USE_AZ_ASSERT) && defined(AZ_ENABLE_TRACING)
#undef USE_CRY_ASSERT
#define USE_CRY_ASSERT
#endif
// you can undefine this. It will cause the assert message box to appear anywhere that USE_CRY_ASSERT is enabled
// instead of it only appearing in debug.
// if this is DEFINED then only in debug builds will you see the message box. In other builds, CRY_ASSERTS become CryWarning instead of
// instead (showing no message box, only a warning).
#define CRY_ASSERT_DIALOG_ONLY_IN_DEBUG
#if defined(FORCE_STANDARD_ASSERT) || defined(USE_AZ_ASSERT)
#undef USE_CRY_ASSERT
#undef CRY_ASSERT_DIALOG_ONLY_IN_DEBUG
#endif
// Using AZ_Assert for all assert kinds (assert =, CRY_ASSERT, AZ_Assert).
// see Trace::Assert for implementation
#if defined(USE_AZ_ASSERT)
#undef assert
#if !defined(NDEBUG)
#define assert(condition) AZ_Assert(condition, "%s", #condition)
#else
#define assert(condition)
#endif
#endif //defined(USE_AZ_ASSERT)
#undef assert
#define assert(condition) AZ_Assert(condition, "%s", #condition)
//-----------------------------------------------------------------------------------------------------
// Use like this:
// CRY_ASSERT(expression);
// CRY_ASSERT_MESSAGE(expression,"Useful message");
// CRY_ASSERT_TRACE(expression,("This should never happen because parameter n%d named %s is %f",iParameter,szParam,fValue));
//-----------------------------------------------------------------------------------------------------
#define CRY_ASSERT(condition) AZ_Assert(condition, "%s", #condition)
#define CRY_ASSERT_MESSAGE(condition, message) AZ_Assert(condition, message)
#define CRY_ASSERT_TRACE(condition, parenthese_message) AZ_Assert(condition, parenthese_message)
#if defined(AZ_RESTRICTED_PLATFORM)
#include AZ_RESTRICTED_FILE(CryAssert_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN32) || defined(APPLE) || defined(LINUX)
#define CRYASSERT_H_TRAIT_USE_CRY_ASSERT_MESSAGE 1
#endif
#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*);
#define CRY_ASSERT(condition) CRY_ASSERT_MESSAGE(condition, NULL)
#define CRY_ASSERT_MESSAGE(condition, message) CRY_ASSERT_TRACE(condition, (message))
#define CRY_ASSERT_TRACE(condition, parenthese_message) \
do \
{ \
static bool s_bIgnoreAssert = false; \
if (!s_bIgnoreAssert && !(condition)) \
{ \
CryAssertTrace parenthese_message; \
if (CryAssert(#condition, __FILE__, __LINE__, &s_bIgnoreAssert)) \
{ \
AZ::Debug::Trace::Break(); \
} \
} \
} while (0)
#undef assert
#define assert CRY_ASSERT
#elif !defined(CRY_ASSERT)
#ifndef USE_AZ_ASSERT
#include <assert.h>
#endif //USE_AZ_ASSERT
#define CRY_ASSERT(condition) assert(condition)
#define CRY_ASSERT_MESSAGE(condition, message) assert(condition)
#define CRY_ASSERT_TRACE(condition, parenthese_message) assert(condition)
#endif
//-----------------------------------------------------------------------------------------------------
-101
View File
@@ -1,101 +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 : Assert dialog box for android
#ifndef CRYINCLUDE_CRYCOMMON_CRYASSERT_ANDROID_H
#define CRYINCLUDE_CRYCOMMON_CRYASSERT_ANDROID_H
#pragma once
#if defined(USE_CRY_ASSERT) && defined(ANDROID)
#include <AzCore/NativeUI/NativeUIRequests.h>
static char gs_szMessage[MAX_PATH];
void CryAssertTrace(const char* szFormat, ...)
{
if (gEnv == 0)
{
return;
}
if (!gEnv->bIgnoreAllAsserts)
{
if (szFormat == NULL)
{
gs_szMessage[0] = '\0';
}
else
{
va_list args;
va_start(args, szFormat);
vsnprintf(gs_szMessage, sizeof(gs_szMessage), szFormat, args);
va_end(args);
}
}
}
bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, bool* pIgnore)
{
if (!gEnv)
{
return true;
}
#if defined(CRY_ASSERT_DIALOG_ONLY_IN_DEBUG) && !defined(AZ_DEBUG_BUILD)
// we are in a non-debug build, so we should turn this into a warning instead.
if ((gEnv) && (gEnv->pLog))
{
if (!gEnv->bIgnoreAllAsserts)
{
gEnv->pLog->LogWarning("%s(%u): Assertion failed - \"%s\"", szFile, line, szCondition);
}
}
if (pIgnore)
{
// avoid showing the same one repeatedly.
*pIgnore = true;
}
return false;
#endif
gEnv->pSystem->OnAssert(szCondition, gs_szMessage, szFile, line);
if (!gEnv->bNoAssertDialog && !gEnv->bIgnoreAllAsserts)
{
AZ::NativeUI::AssertAction result;
EBUS_EVENT_RESULT(result, AZ::NativeUI::NativeUIRequestBus, DisplayAssertDialog, gs_szMessage);
switch (result)
{
case AZ::NativeUI::AssertAction::IGNORE_ASSERT:
return false;
case AZ::NativeUI::AssertAction::IGNORE_ALL_ASSERTS:
gEnv->bNoAssertDialog = true;
gEnv->bIgnoreAllAsserts = true;
return false;
case AZ::NativeUI::AssertAction::BREAK:
return true;
default:
break;
}
return true;
}
else
{
return false;
}
}
#endif
#endif // CRYINCLUDE_CRYCOMMON_CRYASSERT_ANDROID_H
-132
View File
@@ -1,132 +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 :
// Assert dialog box for LINUX. The linux assert dialog is based on a
// small ncurses application which writes the choice to a file. This
// was chosen since there is no default UI system on Linux. X11 wasn't
// used due to the possibility of the system running another display
// protocol (e.g.: WayLand, Mir)
#ifndef CRYINCLUDE_CRYCOMMON_CRYASSERT_LINUX_H
#define CRYINCLUDE_CRYCOMMON_CRYASSERT_LINUX_H
#pragma once
#if defined(USE_CRY_ASSERT) && defined(LINUX) && !defined(ANDROID)
static char gs_szMessage[MAX_PATH];
void CryAssertTrace(const char* szFormat, ...)
{
if (gEnv == 0)
{
return;
}
if (!gEnv->bIgnoreAllAsserts)
{
if (szFormat == NULL)
{
gs_szMessage[0] = '\0';
}
else
{
va_list args;
va_start(args, szFormat);
vsnprintf(gs_szMessage, sizeof(gs_szMessage), szFormat, args);
va_end(args);
}
}
}
bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, bool* pIgnore)
{
if (!gEnv)
{
return false;
}
#if defined(CRY_ASSERT_DIALOG_ONLY_IN_DEBUG) && !defined(AZ_DEBUG_BUILD)
// we are in a non-debug build, so we should turn this into a warning instead.
if (gEnv->pLog)
{
if (!gEnv->bIgnoreAllAsserts)
{
gEnv->pLog->LogWarning("%s(%u): Assertion failed - \"%s\"", szFile, line, szCondition);
}
}
if (pIgnore)
{
// avoid showing the same one repeatedly.
*pIgnore = true;
}
return false;
#endif
static const int max_len = 4096;
static char gs_command_str[4096];
static AZStd::recursive_mutex lock;
gEnv->pSystem->OnAssert(szCondition, gs_szMessage, szFile, line);
size_t file_len = strlen(szFile);
if (!gEnv->bNoAssertDialog && !gEnv->bIgnoreAllAsserts)
{
AZStd::scoped_lock lk(lock);
snprintf(gs_command_str, max_len, "xterm -geometry 100x20 -n 'Assert Dialog [Linux Launcher]' -T 'Assert Dialog [Linux Launcher]' -e 'BinLinux/assert_term \"%s\" \"%s\" %d \"%s\"; echo \"$?\" > .assert_return'",
szCondition, (file_len > 60) ? szFile + (file_len - 61) : szFile, line, gs_szMessage);
int ret = system(gs_command_str);
if (ret != 0)
{
CryLogAlways("<Assert> Terminal failed to execute");
return false;
}
FILE* assert_file = fopen(".assert_return", "r");
if (!assert_file)
{
CryLogAlways("<Assert> Couldn't open assert file");
return false;
}
int result = -1;
fscanf(assert_file, "%d", &result);
fclose(assert_file);
switch (result)
{
case 0:
break;
case 1:
*pIgnore = true;
break;
case 2:
gEnv->bIgnoreAllAsserts = true;
break;
case 3:
return true;
break;
case 4:
raise(SIGABRT);
exit(-1);
break;
default:
CryLogAlways("<Assert> Unknown result in assert file: %d", result);
return false;
}
}
return false;
}
#endif
#endif // CRYINCLUDE_CRYCOMMON_CRYASSERT_LINUX_H
-107
View File
@@ -1,107 +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 : Assert dialog box for Mac OS X
#ifndef CRYINCLUDE_CRYCOMMON_CRYASSERT_MAC_H
#define CRYINCLUDE_CRYCOMMON_CRYASSERT_MAC_H
#pragma once
#if defined(USE_CRY_ASSERT) && defined(MAC)
#include <AzCore/NativeUI/NativeUIRequests.h>
static char gs_szMessage[MAX_PATH];
void CryAssertTrace(const char* szFormat, ...)
{
if (gEnv == 0)
{
return;
}
if (!gEnv->bIgnoreAllAsserts)
{
if (szFormat == NULL)
{
gs_szMessage[0] = '\0';
}
else
{
va_list args;
va_start(args, szFormat);
vsnprintf(gs_szMessage, sizeof(gs_szMessage), szFormat, args);
va_end(args);
}
}
}
bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, bool* pIgnore)
{
if (!gEnv)
{
return false;
}
#if defined(CRY_ASSERT_DIALOG_ONLY_IN_DEBUG) && !defined(AZ_DEBUG_BUILD)
// we are in a non-debug build, so we should turn this into a warning instead.
if ((gEnv) && (gEnv->pLog))
{
if (!gEnv->bIgnoreAllAsserts)
{
gEnv->pLog->LogWarning("%s(%u): Assertion failed - \"%s\"", szFile, line, szCondition);
}
}
if (pIgnore)
{
// avoid showing the same one repeatedly.
*pIgnore = true;
}
return false;
#endif
static const int max_len = 4096;
static char gs_command_str[4096];
gEnv->pSystem->OnAssert(szCondition, gs_szMessage, szFile, line);
size_t file_len = strlen(szFile);
if (!gEnv->bNoAssertDialog && !gEnv->bIgnoreAllAsserts)
{
AZ::NativeUI::AssertAction result;
EBUS_EVENT_RESULT(result, AZ::NativeUI::NativeUIRequestBus, DisplayAssertDialog, gs_szMessage);
switch(result)
{
case AZ::NativeUI::AssertAction::IGNORE_ASSERT:
return false;
case AZ::NativeUI::AssertAction::IGNORE_ALL_ASSERTS:
gEnv->bNoAssertDialog = true;
gEnv->bIgnoreAllAsserts = true;
return false;
case AZ::NativeUI::AssertAction::BREAK:
return true;
default:
break;
}
// For asserts on the Mac always trigger a debug break. Annoying but at least it does not kill the thread like assert() does.
__asm__("int $3");
}
return false;
}
#endif
#endif // CRYINCLUDE_CRYCOMMON_CRYASSERT_MAC_H
-99
View File
@@ -1,99 +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 : Assert dialog box for Mac OS X
#ifndef CRYINCLUDE_CRYCOMMON_CRYASSERT_IOS_H
#define CRYINCLUDE_CRYCOMMON_CRYASSERT_IOS_H
#pragma once
#if defined(USE_CRY_ASSERT) && (defined(IOS)
#include <AzCore/NativeUI/NativeUIRequests.h>
static char gs_szMessage[MAX_PATH];
void CryAssertTrace(const char* szFormat, ...)
{
if (gEnv == 0)
{
return;
}
if (!gEnv->bIgnoreAllAsserts)
{
if (szFormat == NULL)
{
gs_szMessage[0] = '\0';
}
else
{
va_list args;
va_start(args, szFormat);
vsnprintf(gs_szMessage, sizeof(gs_szMessage), szFormat, args);
va_end(args);
}
}
}
bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, bool* pIgnore)
{
if (!gEnv)
{
return false;
}
#if defined(CRY_ASSERT_DIALOG_ONLY_IN_DEBUG) && !defined(AZ_DEBUG_BUILD)
// we are in a non-debug build, so we should turn this into a warning instead.
if ((gEnv) && (gEnv->pLog))
{
if (!gEnv->bIgnoreAllAsserts)
{
gEnv->pLog->LogWarning("%s(%u): Assertion failed - \"%s\"", szFile, line, szCondition);
}
}
if (pIgnore)
{
// avoid showing the same one repeatedly.
*pIgnore = true;
}
return false;
#endif
gEnv->pSystem->OnAssert(szCondition, gs_szMessage, szFile, line);
if (!gEnv->bNoAssertDialog && !gEnv->bIgnoreAllAsserts)
{
printf("!!ASSERT!!\n\tCondition: %s\n\tMessage : %s\n\tFile : %s\n\tLine : %d", szCondition, gs_szMessage, szFile, line);
AZ::NativeUI::AssertAction result;
EBUS_EVENT_RESULT(result, AZ::NativeUI::NativeUIRequestBus, DisplayAssertDialog, gs_szMessage);
switch(result)
{
case AZ::NativeUI::AssertAction::IGNORE_ASSERT:
return false;
case AZ::NativeUI::AssertAction::IGNORE_ALL_ASSERTS:
gEnv->bNoAssertDialog = true;
gEnv->bIgnoreAllAsserts = true;
return false;
case AZ::NativeUI::AssertAction::BREAK:
return true;
default:
break;
}
}
return false;
}
#endif
#endif // CRYINCLUDE_CRYCOMMON_CRYASSERT_IOS_H
-468
View File
@@ -1,468 +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 : Assert dialog box
#pragma once
#if defined(AZ_RESTRICTED_PLATFORM)
#undef AZ_RESTRICTED_SECTION
#define CRYASSERT_IMPL_H_SECTION_1 1
#define CRYASSERT_IMPL_H_SECTION_2 2
#endif
#if defined(USE_CRY_ASSERT)
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION CRYASSERT_IMPL_H_SECTION_1
#include AZ_RESTRICTED_FILE(CryAssert_impl_h)
#endif
#if defined(APPLE)
#if defined(MAC)
#include "CryAssert_Mac.h"
#else
#include "CryAssert_iOS.h"
#endif
#endif
#if defined(LINUX)
#if defined(ANDROID)
#include "CryAssert_Android.h"
#else
#include "CryAssert_Linux.h"
#endif
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION CRYASSERT_IMPL_H_SECTION_2
#include AZ_RESTRICTED_FILE(CryAssert_impl_h)
#elif defined(WIN32)
//-----------------------------------------------------------------------------------------------------
#include <signal.h>
#include <AzCore/PlatformIncl.h>
//-----------------------------------------------------------------------------------------------------
#define IDD_DIALOG_ASSERT 101
#define IDC_CRYASSERT_EDIT_LINE 1000
#define IDC_CRYASSERT_EDIT_FILE 1001
#define IDC_CRYASSERT_EDIT_CONDITION 1002
#define IDC_CRYASSERT_BUTTON_CONTINUE 1003
#define IDC_CRYASSERT_EDIT_REASON 1004
#define IDC_CRYASSERT_BUTTON_IGNORE 1005
#define IDC_CRYASSERT_BUTTON_STOP 1007
#define IDC_CRYASSERT_BUTTON_BREAK 1008
#define IDC_CRYASSERT_BUTTON_IGNORE_ALL 1009
#define IDC_CRYASSERT_STATIC_TEXT 0
#define DLG_TITLE L"Assertion Failed"
#define DLG_FONT L"MS Sans Serif"
#define DLG_ITEM_TEXT_0 L"Continue"
#define DLG_ITEM_TEXT_1 L"Stop"
#define DLG_ITEM_TEXT_2 L"Info"
#define DLG_ITEM_TEXT_3 L""
#define DLG_ITEM_TEXT_4 L"Line"
#define DLG_ITEM_TEXT_5 L""
#define DLG_ITEM_TEXT_6 L"File"
#define DLG_ITEM_TEXT_7 L"Condition"
#define DLG_ITEM_TEXT_8 L""
#define DLG_ITEM_TEXT_9 L"failed"
#define DLG_ITEM_TEXT_10 L""
#define DLG_ITEM_TEXT_11 L"Reason"
#define DLG_ITEM_TEXT_12 L"Ignore"
#define DLG_ITEM_TEXT_14 L"Break"
#define DLG_ITEM_TEXT_15 L"Ignore All"
#define DLG_NB_ITEM 15
template<int iTitleSize>
struct SDlgItem
{
// If use my struct instead of DLGTEMPLATE, or else (for some strange reason) it is not DWORD aligned !!
DWORD style;
DWORD dwExtendedStyle;
short x;
short y;
short cx;
short cy;
WORD id;
WORD ch;
WORD c;
WCHAR t[iTitleSize];
WORD dummy;
};
#define SDLGITEM(TEXT, V) SDlgItem<sizeof(TEXT) / 2> V;
struct SDlgData
{
DLGTEMPLATE dlt;
WORD _menu;
WORD _class;
WCHAR _title[sizeof(DLG_TITLE) / 2];
WORD pointSize;
WCHAR _font[sizeof(DLG_FONT) / 2];
SDLGITEM(DLG_ITEM_TEXT_0, i0);
SDLGITEM(DLG_ITEM_TEXT_12, i12);
SDLGITEM(DLG_ITEM_TEXT_15, i15);
SDLGITEM(DLG_ITEM_TEXT_14, i14);
SDLGITEM(DLG_ITEM_TEXT_1, i1);
SDLGITEM(DLG_ITEM_TEXT_2, i2);
SDLGITEM(DLG_ITEM_TEXT_3, i3);
SDLGITEM(DLG_ITEM_TEXT_4, i4);
SDLGITEM(DLG_ITEM_TEXT_5, i5);
SDLGITEM(DLG_ITEM_TEXT_6, i6);
SDLGITEM(DLG_ITEM_TEXT_7, i7);
SDLGITEM(DLG_ITEM_TEXT_8, i8);
SDLGITEM(DLG_ITEM_TEXT_9, i9);
SDLGITEM(DLG_ITEM_TEXT_10, i10);
SDLGITEM(DLG_ITEM_TEXT_11, i11);
};
//-----------------------------------------------------------------------------------------------------
static SDlgData g_dialogRC =
{
{DS_SETFOREGROUND | DS_MODALFRAME | DS_3DLOOK | DS_SETFONT | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE, 0, DLG_NB_ITEM, 0, 0, 330, 134}, 0, 0, DLG_TITLE, 8, DLG_FONT,
{BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 12, 113, 50, 14, IDC_CRYASSERT_BUTTON_CONTINUE, 0xFFFF, 0x0080, DLG_ITEM_TEXT_0, 0},
{BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 66, 113, 50, 14, IDC_CRYASSERT_BUTTON_IGNORE, 0xFFFF, 0x0080, DLG_ITEM_TEXT_12, 0},
{BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 120, 113, 50, 14, IDC_CRYASSERT_BUTTON_IGNORE_ALL, 0xFFFF, 0x0080, DLG_ITEM_TEXT_15, 0},
{BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 214, 113, 50, 14, IDC_CRYASSERT_BUTTON_BREAK, 0xFFFF, 0x0080, DLG_ITEM_TEXT_14, 0},
{BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 268, 113, 50, 14, IDC_CRYASSERT_BUTTON_STOP, 0xFFFF, 0x0080, DLG_ITEM_TEXT_1, 0},
{BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 0, 7, 7, 316, 100, IDC_CRYASSERT_STATIC_TEXT, 0xFFFF, 0x0080, DLG_ITEM_TEXT_2, 0},
{ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_CHILD | WS_VISIBLE, 0, 50, 48, 25, 13, IDC_CRYASSERT_EDIT_LINE, 0xFFFF, 0x0081, DLG_ITEM_TEXT_3, 0},
{WS_CHILD | WS_VISIBLE, 0, 14, 50, 14, 8, IDC_CRYASSERT_STATIC_TEXT, 0xFFFF, 0x0082, DLG_ITEM_TEXT_4, 0},
{ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_CHILD | WS_VISIBLE, 0, 50, 32, 240, 13, IDC_CRYASSERT_EDIT_FILE, 0xFFFF, 0x0081, DLG_ITEM_TEXT_5, 0},
{WS_CHILD | WS_VISIBLE, 0, 14, 34, 12, 8, IDC_CRYASSERT_STATIC_TEXT, 0xFFFF, 0x0082, DLG_ITEM_TEXT_6, 0},
{WS_CHILD | WS_VISIBLE, 0, 13, 18, 30, 8, IDC_CRYASSERT_STATIC_TEXT, 0xFFFF, 0x0082, DLG_ITEM_TEXT_7, 0},
{ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_CHILD | WS_VISIBLE, 0, 50, 16, 240, 13, IDC_CRYASSERT_EDIT_CONDITION, 0xFFFF, 0x0081, DLG_ITEM_TEXT_8, 0},
{WS_CHILD | WS_VISIBLE, 0, 298, 19, 18, 8, IDC_CRYASSERT_STATIC_TEXT, 0xFFFF, 0x0082, DLG_ITEM_TEXT_9, 0},
{ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_CHILD | WS_VISIBLE, 0, 50, 67, 240, 13, IDC_CRYASSERT_EDIT_REASON, 0xFFFF, 0x0081, DLG_ITEM_TEXT_10, 0},
{WS_CHILD | WS_VISIBLE, 0, 15, 69, 26, 8, IDC_CRYASSERT_STATIC_TEXT, 0xFFFF, 0x0082, DLG_ITEM_TEXT_11, 0},
};
//-----------------------------------------------------------------------------------------------------
struct SCryAssertInfo
{
const char* pszCondition;
const char* pszFile;
const char* pszMessage;
unsigned int uiLine;
enum
{
BUTTON_CONTINUE,
BUTTON_IGNORE,
BUTTON_IGNORE_ALL,
BUTTON_BREAK,
BUTTON_STOP,
BUTTON_REPORT_AS_BUG,
} btnChosen;
unsigned int uiX;
unsigned int uiY;
};
//-----------------------------------------------------------------------------------------------------
static INT_PTR CALLBACK DlgProc(HWND _hDlg, UINT _uiMsg, WPARAM _wParam, LPARAM _lParam)
{
static SCryAssertInfo* pAssertInfo = NULL;
const UINT WM_USER_SHOWFILE_MESSAGE = (WM_USER + 0x4000);
switch (_uiMsg)
{
case WM_INITDIALOG:
{
pAssertInfo = (SCryAssertInfo*) _lParam;
SetWindowText(GetDlgItem(_hDlg, IDC_CRYASSERT_EDIT_CONDITION), pAssertInfo->pszCondition);
SetWindowText(GetDlgItem(_hDlg, IDC_CRYASSERT_EDIT_FILE), pAssertInfo->pszFile);
// Want to move the cursor on the file text, so that the end of the file is the first thing visible,
// instead of the beginning, which will be the user's depot, and the same for pretty much every file.
// Have to do this delayed, because if it's done in WM_INITDIALOG, it doesn't work.
// PostMessage will add this to the end of the message queue.
PostMessage(_hDlg, WM_USER_SHOWFILE_MESSAGE, 0, 0);
char szLine[MAX_PATH];
sprintf_s(szLine, "%d", pAssertInfo->uiLine);
SetWindowText(GetDlgItem(_hDlg, IDC_CRYASSERT_EDIT_LINE), szLine);
if (pAssertInfo->pszMessage && pAssertInfo->pszMessage[0] != '\0')
{
SetWindowText(GetDlgItem(_hDlg, IDC_CRYASSERT_EDIT_REASON), pAssertInfo->pszMessage);
}
else
{
SetWindowText(GetDlgItem(_hDlg, IDC_CRYASSERT_EDIT_REASON), "No Reason");
}
SetWindowPos(_hDlg, HWND_TOPMOST, pAssertInfo->uiX, pAssertInfo->uiY, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
break;
}
case WM_USER_SHOWFILE_MESSAGE:
{
// Still have to delay sending this message, or it won't work for some reason.
// Windows does a whole bunch of stuff behind the scenes. Using PostMessage here seems to work better.
PostMessage(GetDlgItem(_hDlg, IDC_CRYASSERT_EDIT_FILE), EM_SETSEL, strlen(pAssertInfo->pszFile), -1);
break;
}
case WM_COMMAND:
{
switch (LOWORD(_wParam))
{
case IDCANCEL:
case IDC_CRYASSERT_BUTTON_CONTINUE:
{
pAssertInfo->btnChosen = SCryAssertInfo::BUTTON_CONTINUE;
EndDialog(_hDlg, 0);
break;
}
case IDC_CRYASSERT_BUTTON_IGNORE:
{
pAssertInfo->btnChosen = SCryAssertInfo::BUTTON_IGNORE;
EndDialog(_hDlg, 0);
break;
}
case IDC_CRYASSERT_BUTTON_IGNORE_ALL:
{
pAssertInfo->btnChosen = SCryAssertInfo::BUTTON_IGNORE_ALL;
EndDialog(_hDlg, 0);
break;
}
case IDC_CRYASSERT_BUTTON_BREAK:
{
pAssertInfo->btnChosen = SCryAssertInfo::BUTTON_BREAK;
EndDialog(_hDlg, 0);
break;
}
case IDC_CRYASSERT_BUTTON_STOP:
{
pAssertInfo->btnChosen = SCryAssertInfo::BUTTON_STOP;
EndDialog(_hDlg, 1);
break;
}
default:
break;
}
;
break;
}
case WM_DESTROY:
{
if (pAssertInfo)
{
RECT rcWindowBounds;
GetWindowRect(_hDlg, &rcWindowBounds);
pAssertInfo->uiX = rcWindowBounds.left;
pAssertInfo->uiY = rcWindowBounds.top;
}
break;
}
default:
return FALSE;
}
;
return TRUE;
}
//-----------------------------------------------------------------------------------------------------
static char gs_szMessage[MAX_PATH];
//-----------------------------------------------------------------------------------------------------
void CryAssertTrace(const char* _pszFormat, ...)
{
if (gEnv == 0)
{
return;
}
if (!gEnv->bIgnoreAllAsserts)
{
if (NULL == _pszFormat)
{
gs_szMessage[0] = '\0';
}
else
{
va_list args;
va_start(args, _pszFormat);
vsnprintf_s(gs_szMessage, sizeof(gs_szMessage), _TRUNCATE, _pszFormat, args);
va_end(args);
}
}
}
//-----------------------------------------------------------------------------------------------------
static const char* gs_strRegSubKey = "Software\\O3DE\\AssertWindow";
static const char* gs_strRegXValue = "AssertInfoX";
static const char* gs_strRegYValue = "AssertInfoY";
//-----------------------------------------------------------------------------------------------------
void RegistryReadUInt32(const char* _strSubKey, const char* _strRegName, unsigned int* _puiValue, unsigned int _uiDefault)
{
HKEY hKey;
RegCreateKeyEx(HKEY_CURRENT_USER, _strSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL);
DWORD dwType;
DWORD dwLength = sizeof(DWORD);
if (ERROR_SUCCESS != RegQueryValueEx(hKey, _strRegName, 0, &dwType, (BYTE*) _puiValue, &dwLength))
{
*_puiValue = _uiDefault;
}
RegCloseKey(hKey);
}
//-----------------------------------------------------------------------------------------------------
void RegistryWriteUInt32(const char* _strSubKey, const char* _strRegName, unsigned int _uiValue)
{
HKEY hKey;
RegCreateKeyEx(HKEY_CURRENT_USER, _strSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL);
RegSetValueEx (hKey, _strRegName, 0, REG_DWORD, (BYTE*) &_uiValue, sizeof(DWORD));
RegCloseKey (hKey);
}
//-----------------------------------------------------------------------------------------------------
class CCursorShowerWithStack
{
public:
void StoreCurrentAndShow()
{
m_numberOfShows = 1;
while (ShowCursor(TRUE) < 0)
{
++m_numberOfShows;
}
}
void RevertToPrevious()
{
while (m_numberOfShows > 0)
{
ShowCursor(FALSE);
--m_numberOfShows;
}
}
private:
int m_numberOfShows;
};
bool CryAssert(const char* _pszCondition, const char* _pszFile, unsigned int _uiLine, bool* _pbIgnore)
{
if (!gEnv)
{
return false;
}
#if defined(CRY_ASSERT_DIALOG_ONLY_IN_DEBUG) && !defined(AZ_DEBUG_BUILD)
// we are in a non-debug build, so we should turn this into a warning instead.
if ((gEnv) && (gEnv->pLog))
{
if (!gEnv->bIgnoreAllAsserts)
{
gEnv->pLog->LogWarning("%s(%u): Assertion failed - \"%s\"", _pszFile, _uiLine, _pszCondition);
}
}
if (_pbIgnore)
{
// avoid showing the same one repeatedly.
*_pbIgnore = true;
}
return false;
#endif
if (!gEnv->bNoAssertDialog && !gEnv->bIgnoreAllAsserts)
{
SCryAssertInfo assertInfo;
assertInfo.pszCondition = _pszCondition;
assertInfo.pszFile = _pszFile;
assertInfo.pszMessage = gs_szMessage;
assertInfo.uiLine = _uiLine;
assertInfo.btnChosen = SCryAssertInfo::BUTTON_CONTINUE;
gEnv->pSystem->SetAssertVisible(true);
RegistryReadUInt32(gs_strRegSubKey, gs_strRegXValue, &assertInfo.uiX, 10);
RegistryReadUInt32(gs_strRegSubKey, gs_strRegYValue, &assertInfo.uiY, 10);
CCursorShowerWithStack cursorShowerWithStack;
cursorShowerWithStack.StoreCurrentAndShow();
DialogBoxIndirectParam(GetModuleHandle(NULL), (DLGTEMPLATE*) &g_dialogRC, GetDesktopWindow(), DlgProc, (LPARAM) &assertInfo);
cursorShowerWithStack.RevertToPrevious();
RegistryWriteUInt32(gs_strRegSubKey, gs_strRegXValue, assertInfo.uiX);
RegistryWriteUInt32(gs_strRegSubKey, gs_strRegYValue, assertInfo.uiY);
gEnv->pSystem->SetAssertVisible(false);
switch (assertInfo.btnChosen)
{
case SCryAssertInfo::BUTTON_IGNORE:
*_pbIgnore = true;
break;
case SCryAssertInfo::BUTTON_IGNORE_ALL:
gEnv->bIgnoreAllAsserts = true;
break;
case SCryAssertInfo::BUTTON_BREAK:
return true;
case SCryAssertInfo::BUTTON_STOP:
raise(SIGABRT);
exit(-1);
case SCryAssertInfo::BUTTON_REPORT_AS_BUG:
if (gEnv && gEnv->pSystem)
{
const char* pszSafeMessage = (assertInfo.pszMessage && assertInfo.pszMessage[0]) ? assertInfo.pszMessage : "<no reason>";
gEnv->pSystem->ReportBug("Assert: %s - %s", assertInfo.pszCondition, pszSafeMessage);
}
break;
}
}
if (gEnv && gEnv->pSystem)
{
// this also can cause fatal / shutdown behavior:
gEnv->pSystem->OnAssert(_pszCondition, gs_szMessage, _pszFile, _uiLine);
}
return false;
}
//-----------------------------------------------------------------------------------------------------
#endif
#endif
//-----------------------------------------------------------------------------------------------------
-35
View File
@@ -1,35 +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 : Process common interface
#ifndef CRYINCLUDE_CRYCOMMON_IPROCESS_H
#define CRYINCLUDE_CRYCOMMON_IPROCESS_H
#pragma once
// forward declaration
struct SRenderingPassInfo;
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
struct IProcess
{
// <interfuscator:shuffle>
virtual ~IProcess(){}
virtual bool Init() = 0;
virtual void Update() = 0;
virtual void RenderWorld(int nRenderFlags, const SRenderingPassInfo& passInfo, const char* szDebugName) = 0;
virtual void ShutDown() = 0;
virtual void SetFlags(int flags) = 0;
virtual int GetFlags(void) = 0;
// </interfuscator:shuffle>
};
#endif // CRYINCLUDE_CRYCOMMON_IPROCESS_H
-9
View File
@@ -46,7 +46,6 @@ namespace AZ::IO
struct IConsole;
struct IRemoteConsole;
struct IRenderer;
struct IProcess;
struct ICryFont;
struct IMovieSystem;
namespace Audio
@@ -1294,15 +1293,7 @@ namespace Detail
#endif
#if defined(USE_CRY_ASSERT)
static void AssertConsoleExists(void)
{
CRY_ASSERT(gEnv->pConsole != NULL);
}
#define ASSERT_CONSOLE_EXISTS AssertConsoleExists()
#else
#define ASSERT_CONSOLE_EXISTS 0
#endif // defined(USE_CRY_ASSERT)
// the following macros allow the help text to be easily stripped out
@@ -1,39 +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
*
*/
#ifndef CRYINCLUDE_CRYCOMMON_MAESTRO_TYPES_ANIMVALUE_H
#define CRYINCLUDE_CRYCOMMON_MAESTRO_TYPES_ANIMVALUE_H
#pragma once
//! Values that animation track can hold.
// Do not change values! they are serialized
//
// Attention: This should only be expanded if you add a completely new value type that tracks can control!
// If you just want to control a new parameter of an entity etc. extend EParamType
//
// Note: If the param type of a track is known and valid these can be derived from the node.
// These are serialized in case the parameter got invalid (for example for material nodes)
//
enum class AnimValue
{
Float = 0,
Vector = 1,
Quat = 2,
Bool = 3,
Select = 5,
Vector4 = 15,
DiscreteFloat = 16,
RGB = 20,
CharacterAnim = 21,
Unknown = static_cast<int>(0xFFFFFFFF)
};
#endif CRYINCLUDE_CRYCOMMON_MAESTRO_TYPES_ANIMVALUE_H
@@ -1,59 +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 <IAudioSystem.h>
namespace Audio
{
struct AudioProxyMock
: public IAudioProxy
{
MOCK_METHOD2(Initialize, void(const char* const sObjectName, bool bInitAsync /* = true */));
MOCK_METHOD0(Release, void());
MOCK_METHOD0(Reset, void());
MOCK_METHOD1(StopTrigger, void(TAudioControlID nTriggerID));
MOCK_METHOD2(SetSwitchState, void(TAudioControlID nSwitchID, TAudioSwitchStateID nStateID));
MOCK_METHOD2(SetRtpcValue, void(TAudioControlID nRtpcID, float fValue));
MOCK_METHOD1(SetObstructionCalcType, void(EAudioObjectObstructionCalcType eObstructionType));
MOCK_METHOD1(SetPosition, void(const SATLWorldPosition& rPosition));
MOCK_METHOD1(SetPosition, void(const AZ::Vector3& rPosition));
MOCK_METHOD2(SetEnvironmentAmount, void(TAudioEnvironmentID nEnvironmentID, float fAmount));
MOCK_METHOD0(SetCurrentEnvironments, void());
MOCK_CONST_METHOD0(GetAudioObjectID, TAudioObjectID());
};
struct AudioSystemMock
: public IAudioSystem
{
MOCK_METHOD0(Initialize, bool());
MOCK_METHOD0(Release, void());
MOCK_METHOD1(PushRequest, void(const SAudioRequest& rAudioRequestData));
MOCK_METHOD4(AddRequestListener, void(AudioRequestCallbackType func, void* pObjectToListenTo, EAudioRequestType requestType /* = eART_AUDIO_ALL_REQUESTS */, TATLEnumFlagsType specificRequestMask /* = ALL_AUDIO_REQUEST_SPECIFIC_TYPE_FLAGS */));
MOCK_METHOD2(RemoveRequestListener, void(AudioRequestCallbackType func, void* pObjectToListenTo));
MOCK_METHOD0(ExternalUpdate, void());
MOCK_CONST_METHOD1(GetAudioTriggerID, TAudioControlID(const char* sAudioTriggerName));
MOCK_CONST_METHOD1(GetAudioRtpcID, TAudioControlID(const char* sAudioRtpcName));
MOCK_CONST_METHOD1(GetAudioSwitchID, TAudioControlID(const char* sAudioSwitchName));
MOCK_CONST_METHOD2(GetAudioSwitchStateID, TAudioSwitchStateID(const TAudioControlID nSwitchID, const char* sAudioStateName));
MOCK_CONST_METHOD1(GetAudioPreloadRequestID, TAudioPreloadRequestID(const char* sAudioPreloadRequestName));
MOCK_CONST_METHOD1(GetAudioEnvironmentID, TAudioEnvironmentID(const char* sAudioEnvironmentName));
MOCK_METHOD1(ReserveAudioListenerID, bool(TAudioObjectID& rAudioListenerID));
MOCK_METHOD1(ReleaseAudioListenerID, bool(TAudioObjectID nAudioObjectID));
MOCK_METHOD1(OnCVarChanged, void(ICVar* const pCVar));
MOCK_METHOD1(GetInfo, void(SAudioSystemInfo& rAudioSystemInfo));
MOCK_CONST_METHOD0(GetControlsPath, const char*());
MOCK_METHOD0(UpdateControlsPath, void());
MOCK_METHOD0(GetFreeAudioProxy, IAudioProxy*());
MOCK_METHOD1(FreeAudioProxy, void(IAudioProxy* pIAudioProxy));
MOCK_CONST_METHOD2(GetAudioControlName, const char*(EAudioControlType eAudioEntityType, TATLIDType nAudioEntityID));
MOCK_CONST_METHOD2(GetAudioSwitchStateName, const char*(TAudioControlID switchID, TAudioSwitchStateID stateID));
};
} // namespace Audio
-57
View File
@@ -1,57 +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 <ILog.h>
class LogMock
: public ILog
{
public:
MOCK_METHOD3(LogV,
void(ELogType nType, const char* szFormat, va_list args));
MOCK_METHOD4(LogV,
void(ELogType nType, int flags, const char* szFormat, va_list args));
MOCK_METHOD0(Release,
void());
MOCK_METHOD2(SetFileName,
bool(const char* fileNameOrFullPath, bool doBackups));
MOCK_METHOD0(GetFileName,
const char*());
MOCK_METHOD0(GetBackupFileName,
const char*());
virtual void Log([[maybe_unused]] const char* szCommand, ...) override {}
virtual void LogWarning([[maybe_unused]] const char* szCommand, ...) override {}
virtual void LogError([[maybe_unused]] const char* szCommand, ...) override {}
virtual void LogAlways([[maybe_unused]] const char* szCommand, ...) override {}
virtual void LogPlus([[maybe_unused]] const char* command, ...) override {}
virtual void LogToFile([[maybe_unused]] const char* command, ...) override {}
virtual void LogToFilePlus([[maybe_unused]] const char* command, ...) override {}
virtual void LogToConsole([[maybe_unused]] const char* command, ...) override {}
virtual void LogToConsolePlus([[maybe_unused]] const char* command, ...) override {}
virtual void UpdateLoadingScreen([[maybe_unused]] const char* command, ...) override {}
MOCK_METHOD1(SetVerbosity,
void(int verbosity));
MOCK_METHOD0(GetVerbosityLevel,
int());
MOCK_METHOD1(AddCallback,
void(ILogCallback * pCallback));
MOCK_METHOD1(RemoveCallback,
void(ILogCallback * pCallback));
MOCK_METHOD0(Update,
void());
MOCK_METHOD0(GetModuleFilter,
const char*());
MOCK_METHOD1(Indent,
void(class CLogIndenter * indenter));
MOCK_METHOD1(Unindent,
void(class CLogIndenter * indenter));
MOCK_METHOD0(FlushAndClose,
void());
};
-25
View File
@@ -1,25 +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
//---------------------------------------------------------------------------
// Synchronization policies, for classes (e.g. containers, allocators) that may
// or may not be multithread-safe.
//
// Policies should be used as a template argument to such classes,
// and these class implementations should then utilise the policy, as a base-class or member.
//
//---------------------------------------------------------------------------
#include <AzCore/std/parallel/spin_mutex.h>
namespace stl
{
};
-111
View File
@@ -1,111 +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 : Specific to Win32 declarations, inline functions etc.
#ifndef CRYINCLUDE_CRYCOMMON_WIN32SPECIFIC_H
#define CRYINCLUDE_CRYCOMMON_WIN32SPECIFIC_H
#pragma once
#define _CPU_X86
#define _CPU_SSE
#ifdef _DEBUG
#define ILINE _inline
#else
#define ILINE __forceinline
#endif
#define DEPRECATED __declspec(deprecated)
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x501
#endif
//////////////////////////////////////////////////////////////////////////
// Standard includes.
//////////////////////////////////////////////////////////////////////////
#include <malloc.h>
#include <io.h>
#include <new.h>
#include <direct.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
//////////////////////////////////////////////////////////////////////////
// Special intrinsics
#include <intrin.h> // moved here to prevent assert from being redefined when included elsewhere
//////////////////////////////////////////////////////////////////////////
// Define platform independent types.
//////////////////////////////////////////////////////////////////////////
#include "BaseTypes.h"
typedef unsigned char BYTE;
typedef unsigned int threadID;
typedef unsigned long DWORD;
typedef double real; // biggest float-type on this machine
typedef long LONG;
#if defined(_WIN64)
typedef __int64 INT_PTR, * PINT_PTR;
typedef unsigned __int64 UINT_PTR, * PUINT_PTR;
typedef __int64 LONG_PTR, * PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, * PULONG_PTR;
typedef ULONG_PTR DWORD_PTR, * PDWORD_PTR;
#else
typedef __w64 int INT_PTR, * PINT_PTR;
typedef __w64 unsigned int UINT_PTR, * PUINT_PTR;
typedef __w64 long LONG_PTR, * PLONG_PTR;
typedef __w64 unsigned long ULONG_PTR, * PULONG_PTR;
typedef ULONG_PTR DWORD_PTR, * PDWORD_PTR;
#endif
typedef void* THREAD_HANDLE;
typedef void* EVENT_HANDLE;
//////////////////////////////////////////////////////////////////////////
// Multi platform Hi resolution ticks function, should only be used for profiling.
//////////////////////////////////////////////////////////////////////////
int64 CryGetTicks();
int64 CryGetTicksPerSec();
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } \
}
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if (p) { delete [] (p); (p) = NULL; } \
}
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } \
}
#endif
#ifndef FILE_ATTRIBUTE_NORMAL
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#endif
#define TARGET_DEFAULT_ALIGN (0x4U)
#endif // CRYINCLUDE_CRYCOMMON_WIN32SPECIFIC_H
-10
View File
@@ -712,16 +712,6 @@ DWORD Sleep(DWORD dwMilliseconds)
#endif
}
//////////////////////////////////////////////////////////////////////////
DWORD SleepEx(DWORD dwMilliseconds, BOOL /*bAlertable*/)
{
//TODO: implement
// CRY_ASSERT_MESSAGE(0, "SleepEx not implemented yet");
printf("SleepEx not properly implemented yet\n");
Sleep(dwMilliseconds);
return 0;
}
#if defined(LINUX) || defined(APPLE)
BOOL GetComputerName(LPSTR lpBuffer, LPDWORD lpnSize)
{
@@ -22,7 +22,6 @@ set(FILES
IMaterial.h
IMiniLog.h
IMovieSystem.h
IProcess.h
IRenderAuxGeom.h
IRenderer.h
ISerialize.h
@@ -85,11 +84,6 @@ set(FILES
MathConversion.h
AndroidSpecific.h
AppleSpecific.h
CryAssert_Android.h
CryAssert_impl.h
CryAssert_iOS.h
CryAssert_Linux.h
CryAssert_Mac.h
Linux32Specific.h
Linux64Specific.h
Linux_Win32Wrapper.h
@@ -98,7 +92,6 @@ set(FILES
MacSpecific.h
platform.h
platform_impl.cpp
Win32specific.h
Win64specific.h
Maestro/Bus/EditorSequenceAgentComponentBus.h
Maestro/Bus/EditorSequenceBus.h
@@ -107,7 +100,6 @@ set(FILES
Maestro/Bus/SequenceAgentComponentBus.h
Maestro/Types/AnimNodeType.h
Maestro/Types/AnimParamType.h
Maestro/Types/AnimValue.h
Maestro/Types/AnimValueType.h
Maestro/Types/AssetBlendKey.h
Maestro/Types/AssetBlends.h
@@ -7,10 +7,8 @@
#
set(FILES
Mocks/IAudioSystemMock.h
Mocks/IConsoleMock.h
Mocks/ICryPakMock.h
Mocks/ILogMock.h
Mocks/ISystemMock.h
Mocks/ICVarMock.h
)
-6
View File
@@ -238,12 +238,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
// Assert dialog box macros
#include "CryAssert.h"
// Replace standard assert calls by our custom one
// Works only ifdef USE_CRY_ASSERT && _DEBUG && WIN32
#ifndef assert
#define assert CRY_ASSERT
#endif
//////////////////////////////////////////////////////////////////////////
// Platform dependent functions that emulate Win32 API.
// Mostly used only for debugging!
-6
View File
@@ -157,10 +157,6 @@ void __stl_debug_message(const char* format_str, ...)
#include <intrin.h>
#endif
#if defined(APPLE) || defined(LINUX)
#include "CryAssert_impl.h"
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRY_SYSTEM_FUNCTIONS
#include AZ_RESTRICTED_FILE(platform_impl_h)
@@ -168,8 +164,6 @@ void __stl_debug_message(const char* format_str, ...)
#if defined (_WIN32)
#include "CryAssert_impl.h"
//////////////////////////////////////////////////////////////////////////
void CrySleep(unsigned int dwMilliseconds)
{
-53
View File
@@ -77,64 +77,11 @@ public:
bool OnPreAssert(const char* fileName, int line, const char* func, const char* message) override
{
#if defined(USE_CRY_ASSERT) && AZ_LEGACY_CRYSYSTEM_TRAIT_DO_PREASSERT
AZ::Crc32 crc;
crc.Add(&line, sizeof(line));
if (fileName)
{
crc.Add(fileName, strlen(fileName));
}
bool* ignore = nullptr;
auto foundIter = m_ignoredAsserts->find(crc);
if (foundIter == m_ignoredAsserts->end())
{
ignore = &((*m_ignoredAsserts)[crc]);
*ignore = false;
}
else
{
ignore = &((*m_ignoredAsserts)[crc]);
}
if (!(*ignore))
{
using namespace AZ::Debug;
Trace::Output(nullptr, "\n==================================================================\n");
AZ::OSString outputMsg = AZ::OSString::format("Trace::Assert\n %s(%d): '%s'\n%s\n", fileName, line, func, message);
Trace::Output(nullptr, outputMsg.c_str());
// Suppress 3 in stack depth - this function, the bus broadcast that got us here, and Trace::Assert
Trace::Output(nullptr, "------------------------------------------------\n");
Trace::PrintCallstack(nullptr, 3);
Trace::Output(nullptr, "\n==================================================================\n");
AZ::EnvironmentVariable<bool> inEditorBatchMode = AZ::Environment::FindVariable<bool>("InEditorBatchMode");
if (!inEditorBatchMode.IsConstructed() || !inEditorBatchMode.Get())
{
// Note - CryAssertTrace doesn't actually print any info to logging
// it just stores the message internally for the message box in CryAssert to use
CryAssertTrace("%s", message);
if (CryAssert("Assertion failed", fileName, line, ignore) || Trace::IsDebuggerPresent())
{
Trace::Break();
}
}
}
else
{
CryLogAlways("%s", message);
}
return m_suppressSystemOutput;
#else
AZ_UNUSED(fileName);
AZ_UNUSED(line);
AZ_UNUSED(func);
AZ_UNUSED(message);
return false; // allow AZCore to do its default behavior. This usually results in an application shutdown.
#endif
}
bool OnPreError(const char* window, const char* fileName, int line, const char* func, const char* message) override
@@ -104,7 +104,6 @@ struct ITimer;
struct IFFont;
struct ICVar;
struct IConsole;
struct IProcess;
namespace AZ::IO
{
struct IArchive;
@@ -15,7 +15,7 @@
#include <ILocalizationManager.h>
#include "CryPath.h"
#include <LoadScreenBus.h>
#include <CryCommon/LoadScreenBus.h>
#include <CryCommon/StaticInstance.h>
#include <AzCore/Time/ITime.h>
@@ -10,7 +10,7 @@
#include "SpawnableLevelSystem.h"
#include "IMovieSystem.h"
#include <LoadScreenBus.h>
#include <CryCommon/LoadScreenBus.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/IO/FileOperations.h>
+1 -5
View File
@@ -116,7 +116,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#include <IMovieSystem.h>
#include <ILog.h>
#include <IAudioSystem.h>
#include <IProcess.h>
#include <LoadScreenBus.h>
@@ -1279,10 +1278,7 @@ void CSystem::RegisterWindowMessageHandler(IWindowMessageHandler* pHandler)
void CSystem::UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler)
{
#if AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER
#if !defined(NDEBUG)
bool bRemoved =
#endif
stl::find_and_erase(m_windowMessageHandlers, pHandler);
[[maybe_unused]] bool bRemoved = stl::find_and_erase(m_windowMessageHandlers, pHandler);
assert(pHandler && bRemoved && "This IWindowMessageHandler was not registered");
#else
CRY_ASSERT(false && "This platform does not support window message handlers");
+1 -8
View File
@@ -17,7 +17,7 @@
#include "CmdLine.h"
#include <AzFramework/Archive/ArchiveVars.h>
#include <LoadScreenBus.h>
#include <CryCommon/LoadScreenBus.h>
#include <AzCore/Module/DynamicModuleHandle.h>
#include <AzCore/Math/Crc.h>
@@ -53,11 +53,6 @@ class CWatchdogThread;
#define AZ_LEGACY_CRYSYSTEM_TRAIT_ALLOW_CREATE_BACKUP_LOG_FILE 1
#endif
//////////////////////////////////////////////////////////////////////////
#if defined(WIN32) || defined(APPLE) || defined(LINUX)
#define AZ_LEGACY_CRYSYSTEM_TRAIT_DO_PREASSERT 1
#endif
#if defined(LINUX) || defined(APPLE)
#define AZ_LEGACY_CRYSYSTEM_TRAIT_FORWARD_EXCEPTION_POINTERS 1
#endif
@@ -72,9 +67,7 @@ class CWatchdogThread;
#define AZ_LEGACY_CRYSYSTEM_TRAIT_DEBUGCALLSTACK_APPEND_MODULENAME 1
#endif
#if 1
#define AZ_LEGACY_CRYSYSTEM_TRAIT_USE_EXCLUDEUPDATE_ON_CONSOLE 0
#endif
#if defined(WIN32)
#define AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER 1
#endif
+1 -2
View File
@@ -51,7 +51,7 @@
#include <AzFramework/Archive/INestedArchive.h>
#include <AzFramework/Archive/ArchiveFileIO.h>
#include <LoadScreenBus.h>
#include <CryCommon/LoadScreenBus.h>
#include <AzFramework/Logging/MissingAssetLogger.h>
#include <AzFramework/Platform/PlatformDefaults.h>
#include <AzCore/Interface/Interface.h>
@@ -75,7 +75,6 @@
#include <ILog.h>
#include <IAudioSystem.h>
#include <ICmdLine.h>
#include <IProcess.h>
#include <AzFramework/Archive/Archive.h>
#include "XConsole.h"
@@ -1,284 +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
*
*/
#include <platform.h>
#include "XMLBinaryWriter.h"
#include "CryEndian.h"
#include <string.h> // memcpy()
//////////////////////////////////////////////////////////////////////////
XMLBinary::CXMLBinaryWriter::CXMLBinaryWriter()
{
m_nStringDataSize = 0;
}
static void align(size_t& nPosition, const size_t nAlignment)
{
const size_t nPadSize = ((nPosition + (nAlignment - 1)) & ~(nAlignment - 1)) - nPosition;
nPosition += nPadSize;
}
static void alignWrite(XMLBinary::IDataWriter* const pFile, size_t& nPosition, const size_t nAlignment)
{
size_t nPadSize = ((nPosition + (nAlignment - 1)) & ~(nAlignment - 1)) - nPosition;
if (nPadSize > 0)
{
nPosition += nPadSize;
static const char zeroes[32] = { 0 };
while (nPadSize > 0)
{
const size_t n = (nPadSize <= sizeof(zeroes)) ? nPadSize : sizeof(zeroes);
nPadSize -= n;
pFile->Write(zeroes, n);
}
}
}
static void write(XMLBinary::IDataWriter* const pFile, size_t& nPosition, const void* const pData, const size_t nDataSize)
{
pFile->Write(pData, nDataSize);
nPosition += nDataSize;
}
//////////////////////////////////////////////////////////////////////////
bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error)
{
error = "";
// Scan the node tree, building a flat node list, attribute list and string table.
m_nStringDataSize = 0;
if (!CompileTables(node, pFilter, error))
{
return false;
}
static const uint nMaxNodeCount = (NodeIndex) ~0;
if (m_nodes.size() > nMaxNodeCount)
{
error = AZStd::string::format("XMLBinary: Too many nodes: %zu (max is %i)", m_nodes.size(), nMaxNodeCount);
return false;
}
// Initialize the file header.
size_t nTheoreticalPosition = 0;
static const size_t nAlignment = sizeof(uint32);
BinaryFileHeader header;
static const char signature[] = "CryXmlB";
static_assert(sizeof(signature) == sizeof(header.szSignature));
memcpy(header.szSignature, signature, sizeof(header.szSignature));
nTheoreticalPosition += sizeof(header);
align(nTheoreticalPosition, nAlignment);
header.nNodeTablePosition = static_cast<uint32>(nTheoreticalPosition);
header.nNodeCount = int(m_nodes.size());
nTheoreticalPosition += header.nNodeCount * sizeof(Node);
align(nTheoreticalPosition, nAlignment);
header.nChildTablePosition = static_cast<uint32>(nTheoreticalPosition);
header.nChildCount = int(m_childs.size());
nTheoreticalPosition += header.nChildCount * sizeof(NodeIndex);
align(nTheoreticalPosition, nAlignment);
header.nAttributeTablePosition = static_cast<uint32>(nTheoreticalPosition);
header.nAttributeCount = int(m_attributes.size());
nTheoreticalPosition += header.nAttributeCount * sizeof(Attribute);
align(nTheoreticalPosition, nAlignment);
header.nStringDataPosition = static_cast<uint32>(nTheoreticalPosition);
header.nStringDataSize = m_nStringDataSize;
nTheoreticalPosition += header.nStringDataSize;
header.nXMLSize = static_cast<uint32>(nTheoreticalPosition);
// Write file
{
nTheoreticalPosition = 0;
// Write out the file header.
write(pFile, nTheoreticalPosition, &header, sizeof(header));
alignWrite(pFile, nTheoreticalPosition, nAlignment);
// Write out the node table.
if (!m_nodes.empty())
{
write(pFile, nTheoreticalPosition, &m_nodes[0], sizeof(m_nodes[0]) * m_nodes.size());
alignWrite(pFile, nTheoreticalPosition, nAlignment);
}
// Write out the children table.
if (!m_childs.empty())
{
write(pFile, nTheoreticalPosition, &m_childs[0], sizeof(m_childs[0]) * m_childs.size());
alignWrite(pFile, nTheoreticalPosition, nAlignment);
}
// Write out the attribute table.
if (!m_attributes.empty())
{
write(pFile, nTheoreticalPosition, &m_attributes[0], sizeof(m_attributes[0]) * m_attributes.size());
alignWrite(pFile, nTheoreticalPosition, nAlignment);
}
// Write out the data of all the m_strings.
for (size_t nString = 0; nString < m_strings.size(); ++nString)
{
pFile->Write(m_strings[nString].c_str(), m_strings[nString].size() + 1);
}
}
return true;
}
bool XMLBinary::CXMLBinaryWriter::CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error)
{
bool ok = CompileTablesForNode(node, -1, pFilter, error);
ok = ok && CompileChildTable(node, pFilter, error);
return ok;
}
//////////////////////////////////////////////////////////////////////////
bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, AZStd::string& error)
{
// Add the tag to the string table.
int nTagStringOffset = AddString(node->getTag());
// Add the content string to the string table.
int nContentStringOffset = AddString(node->getContent());
// Add all the attributes to the attributes table.
const char* szKey;
const char* szValue;
const int nFirstAttributeIndex = int(m_attributes.size());
for (int i = 0, attrCount = node->getNumAttributes(); i < attrCount; ++i)
{
if (node->getAttributeByIndex(i, &szKey, &szValue) &&
(!pFilter || pFilter->IsAccepted(IFilter::eType_AttributeName, szKey)))
{
// Add the key and the value to the string table.
Attribute attribute;
attribute.nKeyStringOffset = AddString(szKey);
attribute.nValueStringOffset = AddString(szValue);
// Add the attribute to the attribute table.
m_attributes.push_back(attribute);
}
}
const int nAttributeCount = int(m_attributes.size()) - nFirstAttributeIndex;
static const int nMaxAttributeCount = (uint16) ~0;
if (nAttributeCount > nMaxAttributeCount)
{
error = AZStd::string::format("XMLBinary: Too many attributes in a node: %d (max is %i)", nAttributeCount, nMaxAttributeCount);
return false;
}
// Add ourselves to the node list.
const int nIndex = int(m_nodes.size());
{
Node nd;
memset(&nd, 0, sizeof(nd));
nd.nTagStringOffset = nTagStringOffset;
nd.nContentStringOffset = nContentStringOffset;
nd.nParentIndex = nParentIndex;
nd.nFirstAttributeIndex = nFirstAttributeIndex;
nd.nAttributeCount = static_cast<uint16>(nAttributeCount);
m_nodes.push_back(nd);
}
m_nodesMap.insert(NodesMap::value_type(node, nIndex));
// Recurse to the child nodes.
int nChildCount = 0;
static const int nMaxChildCount = (uint16) ~0;
for (int nChild = 0, numChilds = node->getChildCount(); nChild < numChilds; ++nChild)
{
XmlNodeRef childNode = node->getChild(nChild);
if (!pFilter || pFilter->IsAccepted(IFilter::eType_ElementName, childNode->getTag()))
{
if (++nChildCount > nMaxChildCount)
{
error = AZStd::string::format("XMLBinary: Too many children in node '%s': %d (max is %i)", childNode->getTag(), nChildCount, nMaxChildCount);
return false;
}
if (!CompileTablesForNode(childNode, nIndex, pFilter, error))
{
return false;
}
}
}
m_nodes[nIndex].nChildCount = static_cast<uint16>(nChildCount);
return true;
}
//////////////////////////////////////////////////////////////////////////
bool XMLBinary::CXMLBinaryWriter::CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error)
{
const int nIndex = m_nodesMap.find(node)->second; // Assume node always exist in map.
const int nFirstChildIndex = (int)m_childs.size();
Node& nd = m_nodes[nIndex];
nd.nFirstChildIndex = nFirstChildIndex;
int nChildCount = 0;
for (int nChild = 0, numChilds = node->getChildCount(); nChild < numChilds; ++nChild)
{
XmlNodeRef childNode = node->getChild(nChild);
if (!pFilter || pFilter->IsAccepted(IFilter::eType_ElementName, childNode->getTag()))
{
++nChildCount;
const int nChildIndex = m_nodesMap.find(childNode)->second; // Assume node always exist in map.
m_childs.push_back(nChildIndex);
}
}
if (nChildCount != nd.nChildCount)
{
error = AZStd::string::format("XMLBinary: Internal error in CompileChildTable()");
return false;
}
// Recurse to the child nodes.
for (int nChild = 0, numChilds = node->getChildCount(); nChild < numChilds; ++nChild)
{
XmlNodeRef childNode = node->getChild(nChild);
if (!pFilter || pFilter->IsAccepted(IFilter::eType_ElementName, childNode->getTag()))
{
if (!CompileChildTable(childNode, pFilter, error))
{
return false;
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
int XMLBinary::CXMLBinaryWriter::AddString(const XmlString& sString)
{
// If we have such string already, then we will re-use its data.
StringMap::const_iterator itStringEntry = m_stringMap.find(sString);
if (itStringEntry == m_stringMap.end())
{
// We don't have such string yet, so we should add it to the tables.
m_strings.push_back(sString);
itStringEntry = m_stringMap.insert(StringMap::value_type(sString, m_nStringDataSize)).first;
m_nStringDataSize += static_cast<uint>(sString.length() + 1);
}
// Return offset of the string in the string data buffer.
return (*itStringEntry).second;
}
@@ -1,53 +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
*
*/
#ifndef CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYWRITER_H
#define CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYWRITER_H
#pragma once
#include "IXml.h"
#include "XMLBinaryHeaders.h"
#include <vector>
#include <map>
class IXMLDataSink;
namespace XMLBinary
{
class CXMLBinaryWriter
{
public:
CXMLBinaryWriter();
bool WriteNode(IDataWriter* pFile, XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string & error);
private:
bool CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error);
bool CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, AZStd::string& error);
bool CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error);
int AddString(const XmlString& sString);
private:
// tables.
typedef std::map<IXmlNode*, int> NodesMap;
typedef std::map<AZStd::string, uint> StringMap;
std::vector<Node> m_nodes;
NodesMap m_nodesMap;
std::vector<Attribute> m_attributes;
std::vector<NodeIndex> m_childs;
std::vector<AZStd::string> m_strings;
StringMap m_stringMap;
uint m_nStringDataSize;
};
}
#endif // CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYWRITER_H
-1
View File
@@ -16,7 +16,6 @@
#include "SerializeXMLReader.h"
#include "SerializeXMLWriter.h"
#include "XMLBinaryWriter.h"
#include "XMLBinaryReader.h"
#include <md5.h>
@@ -11,6 +11,4 @@ set(FILES
XMLBinaryNode.h
XMLBinaryReader.cpp
XMLBinaryReader.h
XMLBinaryWriter.cpp
XMLBinaryWriter.h
)