Merge branch 'development' into redcode/crythread-2nd-pass

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-08-11 20:31:58 -07:00
1650 changed files with 39333 additions and 62370 deletions
+23 -72
View File
@@ -8,16 +8,16 @@
#include <platform.h>
#include <StringUtils.h>
#include <ISystem.h>
#include <Random.h>
#include <UnicodeFunctions.h>
#include <IConsole.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Debug/ProfileModuleInit.h>
#include <AzCore/Memory/AllocatorManager.h>
#include <AzCore/Module/Environment.h>
#include <AzCore/std/string/conversions.h>
#include <AzCore/Utils/Utils.h>
// Section dictionary
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -200,17 +200,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)
{
@@ -218,47 +207,32 @@ 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)
{
#ifdef WIN32
#if !defined(RESOURCE_COMPILER)
ICVar* const pCVar = gEnv && gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : NULL;
if ((pCVar && pCVar->GetIVal() != 0) || (gEnv && gEnv->bNoAssertDialog))
{
return 0;
}
#endif
wstring wideText, wideCaption;
Unicode::Convert(wideText, lpText);
Unicode::Convert(wideCaption, lpCaption);
return MessageBoxW(NULL, wideText.c_str(), wideCaption.c_str(), uType);
AZStd::wstring lpTextW;
AZStd::to_wstring(lpTextW, lpText);
AZStd::wstring lpCaptionW;
AZStd::to_wstring(lpCaptionW, lpCaption);
return MessageBoxW(NULL, lpTextW.c_str(), lpCaptionW.c_str(), uType);
#else
return 0;
#endif
}
// Initializes root folder of the game, optionally returns exe and path name.
void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[maybe_unused]] uint nRootSize)
void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], uint nRootSize)
{
WCHAR szPath[_MAX_PATH];
size_t nLen = GetModuleFileNameW(GetModuleHandle(NULL), szPath, _MAX_PATH);
assert(nLen < _MAX_PATH && "The path to the current executable exceeds the expected length");
char szPath[_MAX_PATH];
AZ::Utils::GetExecutablePathReturnType ret = AZ::Utils::GetExecutablePath(szPath, _MAX_PATH);
AZ_Assert(ret.m_pathStored == AZ::Utils::ExecutablePathResult::Success, "The path to the current executable exceeds the expected length");
const size_t nLen = strnlen(szPath, _MAX_PATH);
// Find path above exe name and deepest folder.
bool firstIteration = true;
@@ -273,58 +247,33 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[ma
// Return exe path
if (szExeRootName)
{
Unicode::Convert(szExeRootName, n+1, szPath);
azstrncpy(szExeRootName, nRootSize, szPath + n + 1, nLen - n - 1);
}
// Return exe name
if (szExeFileName)
{
Unicode::Convert(szExeFileName, nExeSize, szPath + n);
azstrncpy(szExeFileName, nExeSize, szPath + n, nLen - n);
}
firstIteration = false;
}
// Check if the engineroot exists
wcscat_s(szPath, L"\\engine.json");
azstrcat(szPath, AZ_ARRAY_SIZE(szPath), "\\engine.json");
WIN32_FILE_ATTRIBUTE_DATA data;
BOOL res = GetFileAttributesExW(szPath, GetFileExInfoStandard, &data);
wchar_t szPathW[_MAX_PATH];
AZStd::to_wstring(szPathW, _MAX_PATH, szPath);
BOOL res = GetFileAttributesExW(szPathW, GetFileExInfoStandard, &data);
if (res != 0 && data.dwFileAttributes != INVALID_FILE_ATTRIBUTES)
{
// Found file
szPath[n] = 0;
SetCurrentDirectoryW(szPath);
SetCurrentDirectoryW(szPathW);
break;
}
}
}
}
//////////////////////////////////////////////////////////////////////////
short CryGetAsyncKeyState([[maybe_unused]] int vKey)
{
#ifdef WIN32
return GetAsyncKeyState(vKey);
#else
return 0;
#endif
}
//////////////////////////////////////////////////////////////////////////
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)
{
@@ -335,7 +284,9 @@ bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
return SetFileAttributes(lpFileName, dwFileAttributes) != 0;
AZStd::wstring lpFileNameW;
AZStd::to_wstring(lpFileNameW, lpFileName);
return SetFileAttributes(lpFileNameW.c_str(), dwFileAttributes) != 0;
#endif
}
@@ -384,7 +335,7 @@ inline void CryDebugStr([[maybe_unused]] const char* format, ...)
va_start(ArgList, format);
azvsnprintf(szBuffer,sizeof(szBuffer)-1, format, ArgList);
va_end(ArgList);
cry_strcat(szBuffer,"\n");
azstrcat(szBuffer,"\n");
OutputDebugString(szBuffer);
#endif
*/