Merge branch 'upstream/development' into LYN-8514_AutomatedReviewServerLogChecks
This commit is contained in:
@@ -1027,8 +1027,6 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
// key CRC
|
||||
uint32 keyCRC;
|
||||
|
||||
size_t nMemSize = 0;
|
||||
|
||||
for (;; )
|
||||
{
|
||||
int nRowIndex = -1;
|
||||
@@ -1509,30 +1507,6 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
pEntry->flags |= SLocalizedStringEntry::IS_INTERCEPTED;
|
||||
}
|
||||
|
||||
nMemSize += sizeof(*pEntry) + pEntry->sCharacterName.length() * sizeof(char);
|
||||
if (m_cvarLocalizationEncode == 0)
|
||||
{
|
||||
//Note that this isn't accurate if we're using encoding/compression to shrink the string as the encoding step hasn't happened yet
|
||||
if (pEntry->TranslatedText.psUtf8Uncompressed)
|
||||
{
|
||||
nMemSize += pEntry->TranslatedText.psUtf8Uncompressed->length() * sizeof(char);
|
||||
}
|
||||
}
|
||||
if (pEntry->pEditorExtension != NULL)
|
||||
{
|
||||
nMemSize += pEntry->pEditorExtension->sKey.length()
|
||||
+ pEntry->pEditorExtension->sOriginalActorLine.length()
|
||||
+ pEntry->pEditorExtension->sUtf8TranslatedActorLine.length() * sizeof(char)
|
||||
+ pEntry->pEditorExtension->sOriginalText.length()
|
||||
+ pEntry->pEditorExtension->sOriginalCharacterName.length();
|
||||
}
|
||||
|
||||
|
||||
// Compression Preparation
|
||||
//unsigned int nSourceSize = pEntry->swTranslatedText.length()*sizeof(wchar_t);
|
||||
//if (nSourceSize)
|
||||
// int zResult = Compress(pDest, nDestLen, pEntry->swTranslatedText.c_str(), nSourceSize);
|
||||
|
||||
AddLocalizedString(m_pLanguage, pEntry, keyCRC);
|
||||
}
|
||||
|
||||
@@ -1540,10 +1514,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
{
|
||||
pEncoder->Finalize();
|
||||
|
||||
{
|
||||
uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
|
||||
//uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
|
||||
size_t uncompressedTotal = 0, compressedTotal = 0;
|
||||
for (size_t stringToCompress = startOfStringsToCompress; stringToCompress < m_pLanguage->m_vLocalizedStrings.size(); stringToCompress++)
|
||||
{
|
||||
SLocalizedStringEntry* pStringToCompress = m_pLanguage->m_vLocalizedStrings[stringToCompress];
|
||||
@@ -1551,30 +1522,19 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
{
|
||||
size_t compBufSize = COMPRESSION_FIXED_BUFFER_LENGTH;
|
||||
memset(compressionBuffer, 0, COMPRESSION_FIXED_BUFFER_LENGTH);
|
||||
//CryLogAlways("%u Compressing %s (%p)", stringToCompress, pStringToCompress->szCompressedTranslatedText, pStringToCompress->szCompressedTranslatedText);
|
||||
size_t inputStringLength = strlen((const char*)(pStringToCompress->TranslatedText.szCompressed));
|
||||
pEncoder->CompressInput(pStringToCompress->TranslatedText.szCompressed, inputStringLength, compressionBuffer, &compBufSize);
|
||||
compressionBuffer[compBufSize] = 0;
|
||||
pStringToCompress->huffmanTreeIndex = iEncoder;
|
||||
pEncoder->AddRef();
|
||||
//CryLogAlways("Compressed %s (%u) to %s (%u)", pStringToCompress->szCompressedTranslatedText, strlen((const char*)pStringToCompress->szCompressedTranslatedText), compressionBuffer, compBufSize);
|
||||
uncompressedTotal += inputStringLength;
|
||||
compressedTotal += compBufSize;
|
||||
|
||||
uint8* szCompressedString = new uint8[compBufSize];
|
||||
SAFE_DELETE_ARRAY(pStringToCompress->TranslatedText.szCompressed);
|
||||
|
||||
memcpy(szCompressedString, compressionBuffer, compBufSize);
|
||||
pStringToCompress->TranslatedText.szCompressed = szCompressedString;
|
||||
|
||||
//Testing code
|
||||
//memset( decompressionBuffer, 0, COMPRESSION_FIXED_BUFFER_LENGTH );
|
||||
//size_t decompBufSize = pEncoder->UncompressInput(compressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH, decompressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH);
|
||||
//CryLogAlways("Decompressed %s (%u) to %s (%u)", compressionBuffer, compBufSize, decompressionBuffer, decompBufSize);
|
||||
}
|
||||
}
|
||||
//CryLogAlways("[LOC PROFILING] %s, %u, Uncompressed %u, Compressed %u", sFileName, m_pLanguage->m_vLocalizedStrings.size() - startOfStringsToCompress, uncompressedTotal, compressedTotal);
|
||||
}
|
||||
}
|
||||
|
||||
pXmlTableReader->Release();
|
||||
@@ -1584,11 +1544,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
|
||||
bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8 nTagID, bool bReload)
|
||||
{
|
||||
if (!sFileName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!m_pLanguage)
|
||||
if (!sFileName|| !m_pLanguage)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1731,7 +1687,6 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
|
||||
}
|
||||
{
|
||||
uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH] = {};
|
||||
size_t uncompressedTotal = 0, compressedTotal = 0;
|
||||
for (size_t stringToCompress = startOfStringsToCompress; stringToCompress < m_pLanguage->m_vLocalizedStrings.size(); stringToCompress++)
|
||||
{
|
||||
SLocalizedStringEntry* pStringToCompress = m_pLanguage->m_vLocalizedStrings[stringToCompress];
|
||||
@@ -1744,8 +1699,6 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
|
||||
compressionBuffer[compBufSize] = 0;
|
||||
pStringToCompress->huffmanTreeIndex = iEncoder;
|
||||
pEncoder->AddRef();
|
||||
uncompressedTotal += inputStringLength;
|
||||
compressedTotal += compBufSize;
|
||||
uint8* szCompressedString = new uint8[compBufSize];
|
||||
SAFE_DELETE_ARRAY(pStringToCompress->TranslatedText.szCompressed);
|
||||
memcpy(szCompressedString, compressionBuffer, compBufSize);
|
||||
@@ -1810,7 +1763,7 @@ bool CLocalizedStringsManager::LocalizeString_s(const AZStd::string& sString, AZ
|
||||
bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish)
|
||||
{
|
||||
assert (m_pLanguage);
|
||||
if (m_pLanguage == 0)
|
||||
if (m_pLanguage == nullptr)
|
||||
{
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "LocalizeString: No language set.");
|
||||
outLocalizedString.assign(pStr, pStr + len);
|
||||
|
||||
@@ -209,20 +209,7 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
|
||||
m_env.pSharedEnvironment = pSharedEnvironment;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
m_pIFont = NULL;
|
||||
m_pIFontUi = NULL;
|
||||
m_rWidth = NULL;
|
||||
m_rHeight = NULL;
|
||||
m_rWidthAndHeightAsFractionOfScreenSize = NULL;
|
||||
m_rMaxWidth = NULL;
|
||||
m_rMaxHeight = NULL;
|
||||
m_rColorBits = NULL;
|
||||
m_rDepthBits = NULL;
|
||||
m_cvSSInfo = NULL;
|
||||
m_rStencilBits = NULL;
|
||||
m_rFullscreen = NULL;
|
||||
m_sysNoUpdate = NULL;
|
||||
m_pProcess = NULL;
|
||||
m_pCmdLine = NULL;
|
||||
m_pLevelSystem = NULL;
|
||||
m_pLocalizationManager = NULL;
|
||||
@@ -230,18 +217,9 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(System_cpp)
|
||||
#endif
|
||||
m_sys_min_step = 0;
|
||||
m_sys_max_step = 0;
|
||||
|
||||
m_cvAIUpdate = NULL;
|
||||
|
||||
m_pUserCallback = NULL;
|
||||
m_sys_memory_debug = NULL;
|
||||
m_sysWarnings = NULL;
|
||||
m_sysKeyboard = NULL;
|
||||
m_sys_firstlaunch = NULL;
|
||||
m_sys_enable_budgetmonitoring = NULL;
|
||||
m_sys_preload = NULL;
|
||||
|
||||
// m_sys_filecache = NULL;
|
||||
m_gpu_particle_physics = NULL;
|
||||
@@ -256,22 +234,11 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
|
||||
m_bNoCrashDialog = false;
|
||||
m_bNoErrorReportWindow = false;
|
||||
|
||||
m_pCVarQuit = NULL;
|
||||
|
||||
m_bForceNonDevMode = false;
|
||||
m_bWasInDevMode = false;
|
||||
m_bInDevMode = false;
|
||||
m_bGameFolderWritable = false;
|
||||
|
||||
m_bDrawConsole = true;
|
||||
m_bDrawUI = true;
|
||||
|
||||
m_nServerConfigSpec = CONFIG_VERYHIGH_SPEC;
|
||||
m_nMaxConfigSpec = CONFIG_VERYHIGH_SPEC;
|
||||
|
||||
m_bPaused = false;
|
||||
m_bNoUpdate = false;
|
||||
m_nUpdateCounter = 0;
|
||||
m_iApplicationInstance = -1;
|
||||
|
||||
|
||||
@@ -293,7 +260,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
|
||||
|
||||
m_bHasRenderedErrorMessage = false;
|
||||
|
||||
m_pDataProbe = nullptr;
|
||||
#if AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER
|
||||
RegisterWindowMessageHandler(this);
|
||||
#endif
|
||||
@@ -339,48 +305,15 @@ void CSystem::Release()
|
||||
delete this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::FreeLib(AZStd::unique_ptr<AZ::DynamicModuleHandle>& hLibModule)
|
||||
{
|
||||
if (hLibModule)
|
||||
{
|
||||
if (hLibModule->IsLoaded())
|
||||
{
|
||||
hLibModule->Unload();
|
||||
}
|
||||
hLibModule.release();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IRemoteConsole* CSystem::GetIRemoteConsole()
|
||||
{
|
||||
return CRemoteConsole::GetInst();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::SetForceNonDevMode(const bool bValue)
|
||||
{
|
||||
m_bForceNonDevMode = bValue;
|
||||
if (bValue)
|
||||
{
|
||||
SetDevMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CSystem::GetForceNonDevMode() const
|
||||
{
|
||||
return m_bForceNonDevMode;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::SetDevMode(bool bEnable)
|
||||
{
|
||||
if (bEnable)
|
||||
{
|
||||
m_bWasInDevMode = true;
|
||||
}
|
||||
m_bInDevMode = bEnable;
|
||||
}
|
||||
|
||||
@@ -464,31 +397,13 @@ void CSystem::ShutDown()
|
||||
|
||||
// Release console variables.
|
||||
|
||||
SAFE_RELEASE(m_pCVarQuit);
|
||||
SAFE_RELEASE(m_rWidth);
|
||||
SAFE_RELEASE(m_rHeight);
|
||||
SAFE_RELEASE(m_rWidthAndHeightAsFractionOfScreenSize);
|
||||
SAFE_RELEASE(m_rMaxWidth);
|
||||
SAFE_RELEASE(m_rMaxHeight);
|
||||
SAFE_RELEASE(m_rColorBits);
|
||||
SAFE_RELEASE(m_rDepthBits);
|
||||
SAFE_RELEASE(m_cvSSInfo);
|
||||
SAFE_RELEASE(m_rStencilBits);
|
||||
SAFE_RELEASE(m_rFullscreen);
|
||||
|
||||
SAFE_RELEASE(m_sysWarnings);
|
||||
SAFE_RELEASE(m_sysKeyboard);
|
||||
SAFE_RELEASE(m_sys_firstlaunch);
|
||||
SAFE_RELEASE(m_sys_enable_budgetmonitoring);
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_3
|
||||
#include AZ_RESTRICTED_FILE(System_cpp)
|
||||
#endif
|
||||
|
||||
SAFE_RELEASE(m_sys_min_step);
|
||||
SAFE_RELEASE(m_sys_max_step);
|
||||
|
||||
SAFE_DELETE(m_pLocalizationManager);
|
||||
|
||||
delete m_pCmdLine;
|
||||
@@ -556,14 +471,6 @@ bool CSystem::IsQuitting() const
|
||||
return wasExitMainLoopRequested;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::SetIProcess(IProcess* process)
|
||||
{
|
||||
m_pProcess = process;
|
||||
//if (m_pProcess)
|
||||
//m_pProcess->SetPMessage("");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ISystem* CSystem::GetCrySystem()
|
||||
{
|
||||
@@ -659,7 +566,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
|
||||
|
||||
AZ_TRACE_METHOD();
|
||||
|
||||
m_nUpdateCounter++;
|
||||
#ifndef EXCLUDE_UPDATE_ON_CONSOLE
|
||||
if (m_pUserCallback)
|
||||
{
|
||||
@@ -952,13 +858,16 @@ void CSystem::Warning(EValidatorModule module, EValidatorSeverity severity, int
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CSystem::ShowMessage(const char* text, const char* caption, unsigned int uType)
|
||||
void CSystem::ShowMessage(const char* text, const char* caption, unsigned int uType)
|
||||
{
|
||||
if (m_pUserCallback)
|
||||
{
|
||||
return m_pUserCallback->ShowMessage(text, caption, uType);
|
||||
m_pUserCallback->ShowMessage(text, caption, uType);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryMessageBox(text, caption, uType);
|
||||
}
|
||||
return CryMessageBox(text, caption, uType);
|
||||
}
|
||||
|
||||
inline const char* ValidatorModuleToString(EValidatorModule module)
|
||||
@@ -1035,22 +944,18 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int
|
||||
default:
|
||||
break;
|
||||
}
|
||||
char szBuffer[MAX_WARNING_LENGTH];
|
||||
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, format, args);
|
||||
|
||||
AZStd::fixed_string<MAX_WARNING_LENGTH> fmt;
|
||||
vsnprintf_s(fmt.data(), MAX_WARNING_LENGTH, MAX_WARNING_LENGTH - 1, format, args);
|
||||
|
||||
if (file && *file)
|
||||
{
|
||||
AZStd::fixed_string<MAX_WARNING_LENGTH> fmt = szBuffer;
|
||||
fmt += " [File=";
|
||||
fmt += file;
|
||||
fmt += "]";
|
||||
|
||||
m_env.pLog->LogWithType(ltype, flags | VALIDATOR_FLAG_SKIP_VALIDATOR, "%s", fmt.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.pLog->LogWithType(ltype, flags | VALIDATOR_FLAG_SKIP_VALIDATOR, "%s", szBuffer);
|
||||
}
|
||||
m_env.pLog->LogWithType(ltype, flags | VALIDATOR_FLAG_SKIP_VALIDATOR, "%s", fmt.c_str());
|
||||
|
||||
if (bDbgBreak && g_cvars.sys_error_debugbreak)
|
||||
{
|
||||
@@ -1135,34 +1040,6 @@ ILocalizationManager* CSystem::GetLocalizationManager()
|
||||
return m_pLocalizationManager;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::debug_GetCallStackRaw(void** callstack, uint32& callstackLength)
|
||||
{
|
||||
memset(callstack, 0, sizeof(void*) * callstackLength);
|
||||
|
||||
#if !defined(ANDROID)
|
||||
callstackLength = 0;
|
||||
#endif
|
||||
|
||||
#if AZ_LEGACY_CRYSYSTEM_TRAIT_CAPTURESTACK
|
||||
uint32 nNumStackFramesToSkip = 1;
|
||||
uint32 callstackCapacity = callstackLength;
|
||||
if (callstackCapacity > 0x40)
|
||||
{
|
||||
callstackCapacity = 0x40;
|
||||
}
|
||||
callstackLength = RtlCaptureStackBackTrace(nNumStackFramesToSkip, callstackCapacity, callstack, NULL);
|
||||
#elif defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_7
|
||||
#include AZ_RESTRICTED_FILE(System_cpp)
|
||||
#endif
|
||||
|
||||
if (callstackLength > 0)
|
||||
{
|
||||
std::reverse(callstack, callstack + callstackLength);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::ExecuteCommandLine(bool deferred)
|
||||
{
|
||||
@@ -1201,12 +1078,6 @@ void CSystem::ExecuteCommandLine(bool deferred)
|
||||
//gEnv->pConsole->ExecuteString("sys_RestoreSpec test*"); // to get useful debugging information about current spec settings to the log file
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ESystemConfigSpec CSystem::GetMaxConfigSpec() const
|
||||
{
|
||||
return m_nMaxConfigSpec;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::SetConfigPlatform(const ESystemConfigPlatform platform)
|
||||
{
|
||||
@@ -1401,23 +1272,6 @@ void CSystem::SetSystemGlobalState(const ESystemGlobalState systemGlobalState)
|
||||
#endif // if AZ_LOADSCREENCOMPONENT_ENABLED
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void* CSystem::GetRootWindowMessageHandler()
|
||||
{
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEM_CPP_SECTION_9
|
||||
#include AZ_RESTRICTED_FILE(System_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(WIN32)
|
||||
return reinterpret_cast<void*>(&WndProc);
|
||||
#else
|
||||
CRY_ASSERT(false && "This platform does not support window message handlers");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RegisterWindowMessageHandler(IWindowMessageHandler* pHandler)
|
||||
{
|
||||
@@ -1601,11 +1455,6 @@ bool CSystem::HandleMessage([[maybe_unused]] HWND hWnd, UINT uMsg, WPARAM wParam
|
||||
|
||||
#endif
|
||||
|
||||
std::shared_ptr<AZ::IO::FileIOBase> CSystem::CreateLocalFileIO()
|
||||
{
|
||||
return std::make_shared<AZ::IO::LocalFileIO>();
|
||||
}
|
||||
|
||||
ILevelSystem* CSystem::GetILevelSystem()
|
||||
{
|
||||
return m_pLevelSystem;
|
||||
|
||||
+15
-138
@@ -78,9 +78,6 @@ class CWatchdogThread;
|
||||
#if defined(WIN32)
|
||||
#define AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER 1
|
||||
#endif
|
||||
#if defined(WIN64) || defined(WIN32)
|
||||
#define AZ_LEGACY_CRYSYSTEM_TRAIT_CAPTURESTACK 1
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -98,30 +95,12 @@ namespace Audio
|
||||
struct IAudioSystem;
|
||||
struct IMusicSystem;
|
||||
} // namespace Audio
|
||||
struct IDataProbe;
|
||||
|
||||
#define PHSYICS_OBJECT_ENTITY 0
|
||||
|
||||
#define MAX_STREAMING_POOL_INDEX 6
|
||||
#define MAX_THREAD_POOL_INDEX 6
|
||||
|
||||
struct SSystemCVars
|
||||
{
|
||||
int sys_streaming_requests_grouping_time_period;
|
||||
int sys_streaming_sleep;
|
||||
int sys_streaming_memory_budget;
|
||||
int sys_streaming_max_finalize_per_frame;
|
||||
float sys_streaming_max_bandwidth;
|
||||
int sys_streaming_cpu;
|
||||
int sys_streaming_cpu_worker;
|
||||
int sys_streaming_debug;
|
||||
int sys_streaming_resetstats;
|
||||
int sys_streaming_debug_filter;
|
||||
float sys_streaming_debug_filter_min_time;
|
||||
int sys_streaming_use_optical_drive_thread;
|
||||
ICVar* sys_streaming_debug_filter_file_name;
|
||||
ICVar* sys_localization_folder;
|
||||
int sys_streaming_in_blocks;
|
||||
|
||||
int sys_float_exceptions;
|
||||
int sys_no_crash_dialog;
|
||||
@@ -129,33 +108,16 @@ struct SSystemCVars
|
||||
int sys_dump_aux_threads;
|
||||
int sys_WER;
|
||||
int sys_dump_type;
|
||||
int sys_ai;
|
||||
int sys_entitysystem;
|
||||
int sys_trackview;
|
||||
float sys_update_profile_time;
|
||||
int sys_limit_phys_thread_count;
|
||||
int sys_MaxFPS;
|
||||
float sys_maxTimeStepForMovieSystem;
|
||||
int sys_force_installtohdd_mode;
|
||||
int sys_report_files_not_found_in_paks = 0;
|
||||
|
||||
#ifdef USE_HTTP_WEBSOCKETS
|
||||
int sys_simple_http_base_port;
|
||||
#endif
|
||||
|
||||
int sys_asserts;
|
||||
int sys_error_debugbreak;
|
||||
|
||||
int sys_FilesystemCaseSensitivity;
|
||||
|
||||
AZ::IO::ArchiveVars archiveVars;
|
||||
|
||||
#if defined(WIN32)
|
||||
int sys_display_threads;
|
||||
#elif defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEM_H_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(System_h)
|
||||
#endif
|
||||
};
|
||||
extern SSystemCVars g_cvars;
|
||||
|
||||
@@ -239,9 +201,8 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// retrieves the perlin noise singleton instance
|
||||
CPNoise3* GetNoiseGen() override;
|
||||
uint64 GetUpdateCounter() override { return m_nUpdateCounter; };
|
||||
|
||||
void DetectGameFolderAccessRights();
|
||||
void DetectGameFolderAccessRights();
|
||||
|
||||
void ExecuteCommandLine(bool deferred=true) override;
|
||||
|
||||
@@ -256,9 +217,6 @@ public:
|
||||
|
||||
void IgnoreUpdates(bool bIgnore) override { m_bIgnoreUpdates = bIgnore; };
|
||||
|
||||
void SetIProcess(IProcess* process) override;
|
||||
IProcess* GetIProcess() override{ return m_pProcess; }
|
||||
|
||||
bool IsTestMode() const override { return m_bTestMode; }
|
||||
//@}
|
||||
|
||||
@@ -269,7 +227,7 @@ public:
|
||||
// Validator Warning.
|
||||
void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args) override;
|
||||
void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...) override;
|
||||
int ShowMessage(const char* text, const char* caption, unsigned int uType) override;
|
||||
void ShowMessage(const char* text, const char* caption, unsigned int uType) override;
|
||||
bool CheckLogVerbosity(int verbosity) override;
|
||||
|
||||
//! Return pointer to user defined callback.
|
||||
@@ -278,7 +236,6 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SaveConfiguration() override;
|
||||
void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = nullptr, bool warnIfMissing = true) override;
|
||||
ESystemConfigSpec GetMaxConfigSpec() const override;
|
||||
ESystemConfigPlatform GetConfigPlatform() const override;
|
||||
void SetConfigPlatform(ESystemConfigPlatform platform) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -288,9 +245,6 @@ public:
|
||||
ILocalizationManager* GetLocalizationManager() override;
|
||||
void debug_GetCallStack(const char** pFunctions, int& nCount) override;
|
||||
void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0) override;
|
||||
// Get the current callstack in raw address form (more lightweight than the above functions)
|
||||
// static as memReplay needs it before CSystem has been setup - expose a ISystem interface to this function if you need it outside CrySystem
|
||||
static void debug_GetCallStackRaw(void** callstack, uint32& callstackLength);
|
||||
|
||||
public:
|
||||
#if !defined(RELEASE)
|
||||
@@ -300,7 +254,6 @@ public:
|
||||
#if defined(WIN32)
|
||||
friend LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
void* GetRootWindowMessageHandler() override;
|
||||
void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler) override;
|
||||
void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) override;
|
||||
|
||||
@@ -330,8 +283,6 @@ private:
|
||||
void CreateSystemVars();
|
||||
void CreateAudioVars();
|
||||
|
||||
void FreeLib(AZStd::unique_ptr<AZ::DynamicModuleHandle>& hLibModule);
|
||||
|
||||
void QueryVersionInfo();
|
||||
void LogVersion();
|
||||
void LogBuildInfo();
|
||||
@@ -341,7 +292,6 @@ private:
|
||||
static void SystemVersionChanged(ICVar* pCVar);
|
||||
#endif // #ifndef _RELEASE
|
||||
|
||||
bool ReLaunchMediaCenter();
|
||||
void UpdateAudioSystems();
|
||||
|
||||
void AddCVarGroupDirectory(const AZStd::string& sPath) override;
|
||||
@@ -357,14 +307,7 @@ public:
|
||||
void EnableFloatExceptions(int type);
|
||||
|
||||
// interface ISystem -------------------------------------------
|
||||
virtual IDataProbe* GetIDataProbe() { return m_pDataProbe; };
|
||||
void SetForceNonDevMode(bool bValue) override;
|
||||
bool GetForceNonDevMode() const override;
|
||||
bool WasInDevMode() const override { return m_bWasInDevMode; };
|
||||
bool IsDevMode() const override { return m_bInDevMode && !GetForceNonDevMode(); }
|
||||
|
||||
void SetConsoleDrawEnabled(bool enabled) override { m_bDrawConsole = enabled; }
|
||||
void SetUIDrawEnabled(bool enabled) override { m_bDrawUI = enabled; }
|
||||
bool IsDevMode() const override { return m_bInDevMode; }
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
@@ -373,47 +316,30 @@ public:
|
||||
ICVar* attachVariable (const char* szVarName, int* pContainer, const char* szComment, int dwFlags = 0);
|
||||
|
||||
const CTimeValue& GetLastTickTime() const { return m_lastTickTime; }
|
||||
const ICVar* GetDedicatedMaxRate() const { return m_svDedicatedMaxRate; }
|
||||
|
||||
std::shared_ptr<AZ::IO::FileIOBase> CreateLocalFileIO() override;
|
||||
|
||||
private: // ------------------------------------------------------
|
||||
|
||||
// System environment.
|
||||
SSystemGlobalEnvironment m_env;
|
||||
|
||||
bool m_bInitializedSuccessfully; //!< true if the system completed all initialization steps
|
||||
bool m_bRelaunch; //!< relaunching the app or not (true beforerelaunch)
|
||||
int m_iLoadingMode; //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading)
|
||||
bool m_bTestMode; //!< If running in testing mode.
|
||||
bool m_bEditor; //!< If running in Editor.
|
||||
bool m_bNoCrashDialog;
|
||||
bool m_bNoErrorReportWindow;
|
||||
bool m_bPreviewMode; //!< If running in Preview mode.
|
||||
bool m_bDedicatedServer; //!< If running as Dedicated server.
|
||||
bool m_bIgnoreUpdates; //!< When set to true will ignore Update and Render calls,
|
||||
bool m_bForceNonDevMode; //!< true when running on a cheat protected server or a client that is connected to it (not used in singlplayer)
|
||||
bool m_bWasInDevMode; //!< Set to true if was in dev mode.
|
||||
bool m_bInDevMode; //!< Set to true if was in dev mode.
|
||||
bool m_bGameFolderWritable;//!< True when verified that current game folder have write access.
|
||||
int m_ttMemStatSS; //!< Time to memstat screenshot
|
||||
bool m_bDrawConsole; //!< Set to true if OK to draw the console.
|
||||
bool m_bDrawUI; //!< Set to true if OK to draw UI.
|
||||
|
||||
//! current active process
|
||||
IProcess* m_pProcess;
|
||||
bool m_bInitializedSuccessfully; //!< true if the system completed all initialization steps
|
||||
bool m_bRelaunch; //!< relaunching the app or not (true beforerelaunch)
|
||||
int m_iLoadingMode; //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading)
|
||||
bool m_bTestMode; //!< If running in testing mode.
|
||||
bool m_bEditor; //!< If running in Editor.
|
||||
bool m_bNoCrashDialog;
|
||||
bool m_bNoErrorReportWindow;
|
||||
bool m_bPreviewMode; //!< If running in Preview mode.
|
||||
bool m_bDedicatedServer; //!< If running as Dedicated server.
|
||||
bool m_bIgnoreUpdates; //!< When set to true will ignore Update and Render calls,
|
||||
bool m_bInDevMode; //!< Set to true if was in dev mode.
|
||||
bool m_bGameFolderWritable; //!< True when verified that current game folder have write access.
|
||||
|
||||
CTimeValue m_lastTickTime;
|
||||
|
||||
//! system event dispatcher
|
||||
ISystemEventDispatcher* m_pSystemEventDispatcher;
|
||||
|
||||
//! The default mono-spaced font for internal usage (profiling, debug info, etc.)
|
||||
IFFont* m_pIFont;
|
||||
|
||||
//! The default font for end-user UI interfaces
|
||||
IFFont* m_pIFontUi;
|
||||
|
||||
//! System to manage levels.
|
||||
ILevelSystem* m_pLevelSystem;
|
||||
|
||||
@@ -432,12 +358,6 @@ private: // ------------------------------------------------------
|
||||
// System console variables.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// DLL names
|
||||
ICVar* m_sys_dll_response_system;
|
||||
#if !defined(_RELEASE)
|
||||
ICVar* m_sys_resource_cache_folder;
|
||||
#endif
|
||||
|
||||
#if AZ_LOADSCREENCOMPONENT_ENABLED
|
||||
ICVar* m_game_load_screen_uicanvas_path;
|
||||
ICVar* m_level_load_screen_uicanvas_path;
|
||||
@@ -451,37 +371,9 @@ private: // ------------------------------------------------------
|
||||
ICVar* m_level_load_screen_minimum_time{};
|
||||
#endif // if AZ_LOADSCREENCOMPONENT_ENABLED
|
||||
|
||||
ICVar* m_sys_initpreloadpacks;
|
||||
ICVar* m_sys_menupreloadpacks;
|
||||
|
||||
ICVar* m_cvAIUpdate;
|
||||
ICVar* m_rWidth;
|
||||
ICVar* m_rHeight;
|
||||
ICVar* m_rWidthAndHeightAsFractionOfScreenSize;
|
||||
ICVar* m_rTabletWidthAndHeightAsFractionOfScreenSize;
|
||||
ICVar* m_rHDRDolby;
|
||||
ICVar* m_rMaxWidth;
|
||||
ICVar* m_rMaxHeight;
|
||||
ICVar* m_rColorBits;
|
||||
ICVar* m_rDepthBits;
|
||||
ICVar* m_rStencilBits;
|
||||
ICVar* m_rFullscreen;
|
||||
ICVar* m_rFullscreenWindow;
|
||||
ICVar* m_rFullscreenNativeRes;
|
||||
ICVar* m_rDisplayInfo;
|
||||
ICVar* m_rOverscanBordersDrawDebugView;
|
||||
ICVar* m_sysNoUpdate;
|
||||
ICVar* m_cvEntitySuppressionLevel;
|
||||
ICVar* m_pCVarQuit;
|
||||
ICVar* m_cvMemStats;
|
||||
ICVar* m_cvMemStatsThreshold;
|
||||
ICVar* m_cvMemStatsMaxDepth;
|
||||
ICVar* m_sysKeyboard;
|
||||
ICVar* m_sysWarnings; //!< might be 0, "sys_warnings" - Treat warning as errors.
|
||||
ICVar* m_cvSSInfo; //!< might be 0, "sys_SSInfo" 0/1 - get file sourcesafe info
|
||||
ICVar* m_svDedicatedMaxRate;
|
||||
ICVar* m_sys_firstlaunch;
|
||||
ICVar* m_sys_asset_processor;
|
||||
ICVar* m_sys_load_files_to_memory;
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
@@ -491,13 +383,6 @@ private: // ------------------------------------------------------
|
||||
|
||||
ICVar* m_sys_audio_disable;
|
||||
|
||||
ICVar* m_sys_min_step;
|
||||
ICVar* m_sys_max_step;
|
||||
ICVar* m_sys_enable_budgetmonitoring;
|
||||
ICVar* m_sys_memory_debug;
|
||||
ICVar* m_sys_preload;
|
||||
|
||||
// ICVar *m_sys_filecache;
|
||||
ICVar* m_gpu_particle_physics;
|
||||
|
||||
AZStd::string m_sSavedRDriver; //!< to restore the driver when quitting the dedicated server
|
||||
@@ -509,28 +394,20 @@ private: // ------------------------------------------------------
|
||||
SFileVersion m_fileVersion;
|
||||
SFileVersion m_productVersion;
|
||||
SFileVersion m_buildVersion;
|
||||
IDataProbe* m_pDataProbe;
|
||||
|
||||
class CLocalizedStringsManager* m_pLocalizationManager;
|
||||
|
||||
ESystemConfigSpec m_nServerConfigSpec;
|
||||
ESystemConfigSpec m_nMaxConfigSpec;
|
||||
ESystemConfigPlatform m_ConfigPlatform;
|
||||
|
||||
// Pause mode.
|
||||
bool m_bPaused;
|
||||
bool m_bNoUpdate;
|
||||
|
||||
uint64 m_nUpdateCounter;
|
||||
|
||||
bool m_executedCommandLine = false;
|
||||
|
||||
AZStd::unique_ptr<AzFramework::MissingAssetLogger> m_missingAssetLogger;
|
||||
|
||||
public:
|
||||
ICVar* m_sys_main_CPU;
|
||||
ICVar* m_sys_streaming_CPU;
|
||||
ICVar* m_sys_TaskThread_CPU[MAX_THREAD_POOL_INDEX];
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// File version.
|
||||
|
||||
@@ -1203,18 +1203,6 @@ void CSystem::CreateSystemVars()
|
||||
assert(gEnv);
|
||||
assert(gEnv->pConsole);
|
||||
|
||||
// Register DLL names as cvars before we load them
|
||||
//
|
||||
EVarFlags dllFlags = (EVarFlags)0;
|
||||
m_sys_dll_response_system = REGISTER_STRING("sys_dll_response_system", 0, dllFlags, "Specifies the DLL to load for the dynamic response system");
|
||||
|
||||
m_sys_initpreloadpacks = REGISTER_STRING("sys_initpreloadpacks", "", 0, "Specifies the paks for an engine initialization");
|
||||
m_sys_menupreloadpacks = REGISTER_STRING("sys_menupreloadpacks", 0, 0, "Specifies the paks for a main menu loading");
|
||||
|
||||
#ifndef _RELEASE
|
||||
m_sys_resource_cache_folder = REGISTER_STRING("sys_resource_cache_folder", "Editor\\ResourceCache", 0, "Folder for resource compiled locally. Managed by Sandbox.");
|
||||
#endif
|
||||
|
||||
#if AZ_LOADSCREENCOMPONENT_ENABLED
|
||||
m_game_load_screen_uicanvas_path = REGISTER_STRING("game_load_screen_uicanvas_path", "", 0, "Game load screen UiCanvas path.");
|
||||
m_level_load_screen_uicanvas_path = REGISTER_STRING("level_load_screen_uicanvas_path", "", 0, "Level load screen UiCanvas path.");
|
||||
@@ -1230,8 +1218,6 @@ void CSystem::CreateSystemVars()
|
||||
|
||||
REGISTER_INT("cvDoVerboseWindowTitle", 0, VF_NULL, "");
|
||||
|
||||
m_pCVarQuit = REGISTER_INT("ExitOnQuit", 1, VF_NULL, "");
|
||||
|
||||
// Register an AZ Console command to quit the engine.
|
||||
// The command is available even in Release builds.
|
||||
static AZ::ConsoleFunctor<void, false> s_functorQuit
|
||||
@@ -1252,52 +1238,14 @@ void CSystem::CreateSystemVars()
|
||||
REGISTER_STRING_CB("sys_version", "", VF_CHEAT, "Override system file/product version", SystemVersionChanged);
|
||||
#endif // #ifndef _RELEASE
|
||||
|
||||
m_cvAIUpdate = REGISTER_INT("ai_NoUpdate", 0, VF_CHEAT, "Disables AI system update when 1");
|
||||
|
||||
m_cvMemStats = REGISTER_INT("MemStats", 0, 0,
|
||||
"0/x=refresh rate in milliseconds\n"
|
||||
"Use 1000 to switch on and 0 to switch off\n"
|
||||
"Usage: MemStats [0..]");
|
||||
m_cvMemStatsThreshold = REGISTER_INT ("MemStatsThreshold", 32000, VF_NULL, "");
|
||||
m_cvMemStatsMaxDepth = REGISTER_INT("MemStatsMaxDepth", 4, VF_NULL, "");
|
||||
|
||||
attachVariable("sys_PakReadSlice", &g_cvars.archiveVars.nReadSlice, "If non-0, means number of kilobytes to use to read files in portions. Should only be used on Win9x kernels");
|
||||
|
||||
attachVariable("sys_PakInMemorySizeLimit", &g_cvars.archiveVars.nInMemoryPerPakSizeLimit, "Individual pak size limit for being loaded into memory (MB)");
|
||||
attachVariable("sys_PakTotalInMemorySizeLimit", &g_cvars.archiveVars.nTotalInMemoryPakSizeLimit, "Total limit (in MB) for all in memory paks");
|
||||
attachVariable("sys_PakLoadCache", &g_cvars.archiveVars.nLoadCache, "Load in memory paks from _LoadCache folder");
|
||||
attachVariable("sys_PakLoadModePaks", &g_cvars.archiveVars.nLoadModePaks, "Load mode switching paks from modes folder");
|
||||
attachVariable("sys_PakStreamCache", &g_cvars.archiveVars.nStreamCache, "Load in memory paks for faster streaming (cgf_cache.pak,dds_cache.pak)");
|
||||
attachVariable("sys_PakSaveTotalResourceList", &g_cvars.archiveVars.nSaveTotalResourceList, "Save resource list");
|
||||
attachVariable("sys_PakSaveLevelResourceList", &g_cvars.archiveVars.nSaveLevelResourceList, "Save resource list when loading level");
|
||||
attachVariable("sys_PakSaveFastLoadResourceList", &g_cvars.archiveVars.nSaveFastloadResourceList, "Save resource list during initial loading");
|
||||
attachVariable("sys_PakSaveMenuCommonResourceList", &g_cvars.archiveVars.nSaveMenuCommonResourceList, "Save resource list during front end menu flow");
|
||||
attachVariable("sys_PakMessageInvalidFileAccess", &g_cvars.archiveVars.nMessageInvalidFileAccess, "Message Box synchronous file access when in game");
|
||||
attachVariable("sys_PakLogInvalidFileAccess", &g_cvars.archiveVars.nLogInvalidFileAccess, "Log synchronous file access when in game");
|
||||
#ifndef _RELEASE
|
||||
attachVariable("sys_PakLogAllFileAccess", &g_cvars.archiveVars.nLogAllFileAccess, "Log all file access allowing you to easily see whether a file has been loaded directly, or which pak file.");
|
||||
#endif
|
||||
attachVariable("sys_PakValidateFileHash", &g_cvars.archiveVars.nValidateFileHashes, "Validate file hashes in pak files for collisions");
|
||||
attachVariable("sys_UncachedStreamReads", &g_cvars.archiveVars.nUncachedStreamReads, "Enable stream reads via an uncached file handle");
|
||||
attachVariable("sys_PakDisableNonLevelRelatedPaks", &g_cvars.archiveVars.nDisableNonLevelRelatedPaks, "Disables all paks that are not required by specific level; This is used with per level splitted assets.");
|
||||
attachVariable("sys_PakWarnOnPakAccessFailures", &g_cvars.archiveVars.nWarnOnPakAccessFails, "If 1, access failure for Paks is treated as a warning, if zero it is only a log message.");
|
||||
|
||||
static const int fileSystemCaseSensitivityDefault = 0;
|
||||
REGISTER_CVAR2("sys_FilesystemCaseSensitivity", &g_cvars.sys_FilesystemCaseSensitivity, fileSystemCaseSensitivityDefault, VF_NULL,
|
||||
"0 - CryPak lowercases all input file names\n"
|
||||
"1 - CryPak preserves file name casing\n"
|
||||
"Default is 1");
|
||||
|
||||
m_sysNoUpdate = REGISTER_INT("sys_noupdate", 0, VF_CHEAT,
|
||||
"Toggles updating of system with sys_script_debugger.\n"
|
||||
"Usage: sys_noupdate [0/1]\n"
|
||||
"Default is 0 (system updates during debug).");
|
||||
|
||||
m_sysWarnings = REGISTER_INT("sys_warnings", 0, 0,
|
||||
"Toggles printing system warnings.\n"
|
||||
"Usage: sys_warnings [0/1]\n"
|
||||
"Default is 0 (off).");
|
||||
|
||||
#if defined(_RELEASE) && defined(CONSOLE) && !defined(ENABLE_LW_PROFILERS)
|
||||
enum
|
||||
{
|
||||
@@ -1309,10 +1257,6 @@ void CSystem::CreateSystemVars()
|
||||
e_sysKeyboardDefault = 1
|
||||
};
|
||||
#endif
|
||||
m_sysKeyboard = REGISTER_INT("sys_keyboard", e_sysKeyboardDefault, 0,
|
||||
"Enables keyboard.\n"
|
||||
"Usage: sys_keyboard [0/1]\n"
|
||||
"Default is 1 (on).");
|
||||
|
||||
m_svDedicatedMaxRate = REGISTER_FLOAT("sv_DedicatedMaxRate", 30.0f, 0,
|
||||
"Sets the maximum update rate when running as a dedicated server.\n"
|
||||
@@ -1328,55 +1272,14 @@ void CSystem::CreateSystemVars()
|
||||
"Usage: sv_DedicatedCPUVariance [5..50]\n"
|
||||
"Default is 10.");
|
||||
|
||||
m_cvSSInfo = REGISTER_INT("sys_SSInfo", 0, 0,
|
||||
"Show SourceSafe information (Name,Comment,Date) for file errors."
|
||||
"Usage: sys_SSInfo [0/1]\n"
|
||||
"Default is 0 (off)");
|
||||
|
||||
m_cvEntitySuppressionLevel = REGISTER_INT("e_EntitySuppressionLevel", 0, 0,
|
||||
"Defines the level at which entities are spawned.\n"
|
||||
"Entities marked with lower level will not be spawned - 0 means no level.\n"
|
||||
"Usage: e_EntitySuppressionLevel [0-infinity]\n"
|
||||
"Default is 0 (off)");
|
||||
|
||||
m_sys_firstlaunch = REGISTER_INT("sys_firstlaunch", 0, 0,
|
||||
"Indicates that the game was run for the first time.");
|
||||
|
||||
m_sys_main_CPU = REGISTER_INT("sys_main_CPU", 0, 0,
|
||||
"Specifies the physical CPU index main will run on");
|
||||
|
||||
m_sys_TaskThread_CPU[0] = REGISTER_INT("sys_TaskThread0_CPU", 3, 0,
|
||||
"Specifies the physical CPU index taskthread0 will run on");
|
||||
|
||||
m_sys_TaskThread_CPU[1] = REGISTER_INT("sys_TaskThread1_CPU", 5, 0,
|
||||
"Specifies the physical CPU index taskthread1 will run on");
|
||||
|
||||
m_sys_TaskThread_CPU[2] = REGISTER_INT("sys_TaskThread2_CPU", 4, 0,
|
||||
"Specifies the physical CPU index taskthread2 will run on");
|
||||
|
||||
m_sys_TaskThread_CPU[3] = REGISTER_INT("sys_TaskThread3_CPU", 3, 0,
|
||||
"Specifies the physical CPU index taskthread3 will run on");
|
||||
|
||||
m_sys_TaskThread_CPU[4] = REGISTER_INT("sys_TaskThread4_CPU", 2, 0,
|
||||
"Specifies the physical CPU index taskthread4 will run on");
|
||||
|
||||
m_sys_TaskThread_CPU[5] = REGISTER_INT("sys_TaskThread5_CPU", 1, 0,
|
||||
"Specifies the physical CPU index taskthread5 will run on");
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_12
|
||||
#include AZ_RESTRICTED_FILE(SystemInit_cpp)
|
||||
#endif
|
||||
|
||||
m_sys_min_step = REGISTER_FLOAT("sys_min_step", 0.01f, 0,
|
||||
"Specifies the minimum physics step in a separate thread");
|
||||
m_sys_max_step = REGISTER_FLOAT("sys_max_step", 0.05f, 0,
|
||||
"Specifies the maximum physics step in a separate thread");
|
||||
|
||||
// used in define MEMORY_DEBUG_POINT()
|
||||
m_sys_memory_debug = REGISTER_INT("sys_memory_debug", 0, VF_CHEAT,
|
||||
"Enables to activate low memory situation is specific places in the code (argument defines which place), 0=off");
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_17
|
||||
#include AZ_RESTRICTED_FILE(SystemInit_cpp)
|
||||
@@ -1387,40 +1290,7 @@ void CSystem::CreateSystemVars()
|
||||
# define SYS_STREAMING_CPU_DEFAULT_VALUE 1
|
||||
# define SYS_STREAMING_CPU_WORKER_DEFAULT_VALUE 5
|
||||
#endif
|
||||
REGISTER_CVAR2("sys_streaming_CPU", &g_cvars.sys_streaming_cpu, SYS_STREAMING_CPU_DEFAULT_VALUE, VF_NULL, "Specifies the physical CPU file IO thread run on");
|
||||
REGISTER_CVAR2("sys_streaming_CPU_worker", &g_cvars.sys_streaming_cpu_worker, SYS_STREAMING_CPU_WORKER_DEFAULT_VALUE, VF_NULL, "Specifies the physical CPU file IO worker thread/s run on");
|
||||
REGISTER_CVAR2("sys_streaming_memory_budget", &g_cvars.sys_streaming_memory_budget, 10 * 1024, VF_NULL, "Temp memory streaming system can use in KB");
|
||||
REGISTER_CVAR2("sys_streaming_max_finalize_per_frame", &g_cvars.sys_streaming_max_finalize_per_frame, 0, VF_NULL,
|
||||
"Maximum stream finalizing calls per frame to reduce the CPU impact on main thread (0 to disable)");
|
||||
REGISTER_CVAR2("sys_streaming_max_bandwidth", &g_cvars.sys_streaming_max_bandwidth, 0, VF_NULL, "Enables capping of max streaming bandwidth in MB/s");
|
||||
REGISTER_CVAR2("sys_streaming_debug", &g_cvars.sys_streaming_debug, 0, VF_NULL, "Enable streaming debug information\n"
|
||||
"0=off\n"
|
||||
"1=Streaming Stats\n"
|
||||
"2=File IO\n"
|
||||
"3=Request Order\n"
|
||||
"4=Write to Log\n"
|
||||
"5=Stats per extension\n"
|
||||
);
|
||||
REGISTER_CVAR2("sys_streaming_requests_grouping_time_period", &g_cvars.sys_streaming_requests_grouping_time_period, 2, VF_NULL, // Vlad: 2 works better than 4 visually, should be be re-tested when streaming pak's activated
|
||||
"Streaming requests are grouped by request time and then sorted by disk offset");
|
||||
REGISTER_CVAR2("sys_streaming_debug_filter", &g_cvars.sys_streaming_debug_filter, 0, VF_NULL, "Set streaming debug information filter.\n"
|
||||
"0=all\n"
|
||||
"1=Texture\n"
|
||||
"2=Geometry\n"
|
||||
"3=Terrain\n"
|
||||
"4=Animation\n"
|
||||
"5=Music\n"
|
||||
"6=Sound\n"
|
||||
"7=Shader\n"
|
||||
);
|
||||
g_cvars.sys_streaming_debug_filter_file_name = REGISTER_STRING("sys_streaming_debug_filter_file_name", "", VF_CHEAT,
|
||||
"Set streaming debug information filter");
|
||||
REGISTER_CVAR2("sys_streaming_debug_filter_min_time", &g_cvars.sys_streaming_debug_filter_min_time, 0.f, VF_NULL, "Show only slow items.");
|
||||
REGISTER_CVAR2("sys_streaming_resetstats", &g_cvars.sys_streaming_resetstats, 0, VF_NULL,
|
||||
"Reset all the streaming stats");
|
||||
#define DEFAULT_USE_OPTICAL_DRIVE_THREAD (gEnv->IsDedicated() ? 0 : 1)
|
||||
REGISTER_CVAR2("sys_streaming_use_optical_drive_thread", &g_cvars.sys_streaming_use_optical_drive_thread, DEFAULT_USE_OPTICAL_DRIVE_THREAD, VF_NULL,
|
||||
"Allow usage of an extra optical drive thread for faster streaming from 2 medias");
|
||||
|
||||
const char* localizeFolder = "Localization";
|
||||
g_cvars.sys_localization_folder = REGISTER_STRING_CB("sys_localization_folder", localizeFolder, VF_NULL,
|
||||
@@ -1430,9 +1300,6 @@ void CSystem::CreateSystemVars()
|
||||
"Default: Localization\n",
|
||||
CSystem::OnLocalizationFolderCVarChanged);
|
||||
|
||||
REGISTER_CVAR2("sys_streaming_in_blocks", &g_cvars.sys_streaming_in_blocks, 1, VF_NULL,
|
||||
"Streaming of large files happens in blocks");
|
||||
|
||||
#if (defined(WIN32) || defined(WIN64)) && defined(_DEBUG)
|
||||
REGISTER_CVAR2("sys_float_exceptions", &g_cvars.sys_float_exceptions, 2, 0, "Use or not use floating point exceptions.");
|
||||
#else // Float exceptions by default disabled for console builds.
|
||||
@@ -1451,11 +1318,6 @@ void CSystem::CreateSystemVars()
|
||||
REGISTER_CVAR2("sys_WER", &g_cvars.sys_WER, 0, 0, "Enables Windows Error Reporting");
|
||||
#endif
|
||||
|
||||
#ifdef USE_HTTP_WEBSOCKETS
|
||||
REGISTER_CVAR2("sys_simple_http_base_port", &g_cvars.sys_simple_http_base_port, 1880, VF_REQUIRE_APP_RESTART,
|
||||
"sets the base port for the simple http server to run on, defaults to 1880");
|
||||
#endif
|
||||
|
||||
const int DEFAULT_DUMP_TYPE = 2;
|
||||
|
||||
REGISTER_CVAR2("sys_dump_type", &g_cvars.sys_dump_type, DEFAULT_DUMP_TYPE, VF_NULL,
|
||||
@@ -1467,8 +1329,6 @@ void CSystem::CreateSystemVars()
|
||||
);
|
||||
REGISTER_CVAR2("sys_dump_aux_threads", &g_cvars.sys_dump_aux_threads, 1, VF_NULL, "Dumps callstacks of other threads in case of a crash");
|
||||
|
||||
REGISTER_CVAR2("sys_limit_phys_thread_count", &g_cvars.sys_limit_phys_thread_count, 1, VF_NULL, "Limits p_num_threads to physical CPU count - 1");
|
||||
|
||||
#if (defined(WIN32) || defined(WIN64)) && defined(_RELEASE)
|
||||
const int DEFAULT_SYS_MAX_FPS = 0;
|
||||
#else
|
||||
@@ -1480,11 +1340,8 @@ void CSystem::CreateSystemVars()
|
||||
|
||||
REGISTER_CVAR2("sys_maxTimeStepForMovieSystem", &g_cvars.sys_maxTimeStepForMovieSystem, 0.1f, VF_NULL, "Caps the time step for the movie system so that a cut-scene won't be jumped in the case of an extreme stall.");
|
||||
|
||||
REGISTER_CVAR2("sys_force_installtohdd_mode", &g_cvars.sys_force_installtohdd_mode, 0, VF_NULL, "Forces install to HDD mode even when doing DVD emulation");
|
||||
|
||||
REGISTER_CVAR2("sys_report_files_not_found_in_paks", &g_cvars.sys_report_files_not_found_in_paks, 0, VF_NULL, "Reports when files are searched for in paks and not found. 1 = log, 2 = warning, 3 = error");
|
||||
|
||||
m_sys_preload = REGISTER_INT("sys_preload", 0, 0, "Preload Game Resources");
|
||||
REGISTER_COMMAND("sys_crashtest", CmdCrashTest, VF_CHEAT, "Make the game crash\n"
|
||||
"0=off\n"
|
||||
"1=null pointer exception\n"
|
||||
@@ -1523,20 +1380,11 @@ void CSystem::CreateSystemVars()
|
||||
"To speed up loading from non HD media\n"
|
||||
"0=off / 1=enabled");
|
||||
*/
|
||||
REGISTER_CVAR2("sys_AI", &g_cvars.sys_ai, 1, 0, "Enables AI Update");
|
||||
REGISTER_CVAR2("sys_entities", &g_cvars.sys_entitysystem, 1, 0, "Enables Entities Update");
|
||||
REGISTER_CVAR2("sys_trackview", &g_cvars.sys_trackview, 1, 0, "Enables TrackView Update");
|
||||
|
||||
//Defines selected language.
|
||||
REGISTER_STRING_CB("g_language", "", VF_NULL, "Defines which language pak is loaded", CSystem::OnLanguageCVarChanged);
|
||||
|
||||
#if defined(WIN32)
|
||||
REGISTER_CVAR2("sys_display_threads", &g_cvars.sys_display_threads, 0, 0, "Displays Thread info");
|
||||
#elif defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_13
|
||||
#include AZ_RESTRICTED_FILE(SystemInit_cpp)
|
||||
#endif
|
||||
|
||||
// adding CVAR to toggle assert verbosity level
|
||||
const int defaultAssertValue = 1;
|
||||
REGISTER_CVAR2_CB("sys_asserts", &g_cvars.sys_asserts, defaultAssertValue, VF_CHEAT,
|
||||
|
||||
@@ -383,45 +383,6 @@ void CSystem::debug_LogCallStack(int nMaxFuncs, [[maybe_unused]] int nFlags)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Support relaunching for windows media center edition.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if defined(WIN32)
|
||||
#if (_WIN32_WINNT < 0x0501)
|
||||
#define SM_MEDIACENTER 87
|
||||
#endif
|
||||
bool CSystem::ReLaunchMediaCenter()
|
||||
{
|
||||
// Skip if not running on a Media Center
|
||||
if (GetSystemMetrics(SM_MEDIACENTER) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the path to Media Center
|
||||
wchar_t szExpandedPath[AZ_MAX_PATH_LEN];
|
||||
if (!ExpandEnvironmentStringsW(L"%SystemRoot%\\ehome\\ehshell.exe", szExpandedPath, AZ_MAX_PATH_LEN))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip if ehshell.exe doesn't exist
|
||||
if (GetFileAttributesW(szExpandedPath) == 0xFFFFFFFF)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Launch ehshell.exe
|
||||
INT_PTR result = (INT_PTR)ShellExecuteW(NULL, TEXT("open"), szExpandedPath, NULL, NULL, SW_SHOWNORMAL);
|
||||
return (result > 32);
|
||||
}
|
||||
#else
|
||||
bool CSystem::ReLaunchMediaCenter()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif //defined(WIN32)
|
||||
|
||||
#if (defined(WIN32) || defined(WIN64))
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
|
||||
|
||||
@@ -11,20 +11,6 @@
|
||||
#include "Cry_Color.h"
|
||||
#include "XMLBinaryNode.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBinaryXmlData::CBinaryXmlData()
|
||||
: pNodes(0)
|
||||
, pAttributes(0)
|
||||
, pChildIndices(0)
|
||||
, pStringData(0)
|
||||
, pFileContents(0)
|
||||
, nFileSize(0)
|
||||
, bOwnsFileContentsMemory(true)
|
||||
, pBinaryNodes(0)
|
||||
, nRefCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBinaryXmlData::~CBinaryXmlData()
|
||||
{
|
||||
@@ -32,10 +18,10 @@ CBinaryXmlData::~CBinaryXmlData()
|
||||
{
|
||||
delete [] pFileContents;
|
||||
}
|
||||
pFileContents = 0;
|
||||
pFileContents = nullptr;
|
||||
|
||||
delete [] pBinaryNodes;
|
||||
pBinaryNodes = 0;
|
||||
pBinaryNodes = nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -56,7 +42,7 @@ XmlNodeRef CBinaryXmlNode::getParent() const
|
||||
XmlNodeRef CBinaryXmlNode::createNode([[maybe_unused]] const char* tag)
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -93,7 +79,7 @@ bool CBinaryXmlNode::getAttr(const char* key, const char** value) const
|
||||
|
||||
bool CBinaryXmlNode::haveAttr(const char* key) const
|
||||
{
|
||||
return (GetValue(key) != 0);
|
||||
return (GetValue(key) != nullptr);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -113,7 +99,7 @@ bool CBinaryXmlNode::getAttr(const char* key, unsigned int& value) const
|
||||
const char* svalue = GetValue(key);
|
||||
if (svalue)
|
||||
{
|
||||
value = strtoul(svalue, NULL, 10);
|
||||
value = strtoul(svalue, nullptr, 10);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -290,7 +276,7 @@ XmlNodeRef CBinaryXmlNode::findChild(const char* tag) const
|
||||
return m_pData->pBinaryNodes + m_pData->pChildIndices[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! Get XML Node child nodes.
|
||||
|
||||
@@ -6,13 +6,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYNODE_H
|
||||
#define CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYNODE_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include "IXml.h"
|
||||
#include "XMLBinaryHeaders.h"
|
||||
|
||||
@@ -26,20 +21,20 @@ class CBinaryXmlNode;
|
||||
class CBinaryXmlData
|
||||
{
|
||||
public:
|
||||
const XMLBinary::Node* pNodes;
|
||||
const XMLBinary::Attribute* pAttributes;
|
||||
const XMLBinary::NodeIndex* pChildIndices;
|
||||
const char* pStringData;
|
||||
const XMLBinary::Node* pNodes = nullptr;
|
||||
const XMLBinary::Attribute* pAttributes = nullptr;
|
||||
const XMLBinary::NodeIndex* pChildIndices = nullptr;
|
||||
const char* pStringData = nullptr;
|
||||
|
||||
const char* pFileContents;
|
||||
size_t nFileSize;
|
||||
bool bOwnsFileContentsMemory;
|
||||
const char* pFileContents = nullptr;
|
||||
size_t nFileSize = 0;
|
||||
bool bOwnsFileContentsMemory = true;
|
||||
|
||||
CBinaryXmlNode* pBinaryNodes;
|
||||
CBinaryXmlNode* pBinaryNodes = nullptr;
|
||||
|
||||
int nRefCount;
|
||||
int nRefCount = 0;
|
||||
|
||||
CBinaryXmlData();
|
||||
CBinaryXmlData() = default;
|
||||
~CBinaryXmlData();
|
||||
};
|
||||
|
||||
@@ -96,7 +91,6 @@ public:
|
||||
virtual bool getAttributeByIndex(int index, XmlString& key, XmlString& value);
|
||||
|
||||
|
||||
void shareChildren([[maybe_unused]] const XmlNodeRef& fromNode) override { assert(0); };
|
||||
void copyAttributes(XmlNodeRef fromNode) override { assert(0); };
|
||||
|
||||
//! Get XML Node attribute for specified key.
|
||||
@@ -110,8 +104,6 @@ public:
|
||||
bool haveAttr(const char* key) const override;
|
||||
|
||||
XmlNodeRef newChild([[maybe_unused]] const char* tagName) override { assert(0); return 0; };
|
||||
void replaceChild([[maybe_unused]] int inChild, [[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
|
||||
void insertChild([[maybe_unused]] int inChild, [[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
|
||||
void addChild([[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
|
||||
void removeChild([[maybe_unused]] const XmlNodeRef& node) override { assert(0); };
|
||||
|
||||
@@ -127,7 +119,6 @@ public:
|
||||
//! Find node with specified tag.
|
||||
XmlNodeRef findChild(const char* tag) const override;
|
||||
void deleteChild([[maybe_unused]] const char* tag) { assert(0); };
|
||||
void deleteChildAt([[maybe_unused]] int nIndex) override { assert(0); };
|
||||
|
||||
//! Get parent XML node.
|
||||
XmlNodeRef getParent() const override;
|
||||
@@ -136,10 +127,6 @@ public:
|
||||
const char* getContent() const override { return _string(_node()->nContentStringOffset); };
|
||||
void setContent([[maybe_unused]] const char* str) override { assert(0); };
|
||||
|
||||
XmlNodeRef clone() override { assert(0); return 0; };
|
||||
|
||||
//! Returns line number for XML tag.
|
||||
int getLine() const override { return 0; };
|
||||
//! Set line number in xml.
|
||||
void setLine([[maybe_unused]] int line) override { assert(0); };
|
||||
|
||||
@@ -225,5 +212,3 @@ private:
|
||||
|
||||
friend class XMLBinary::XMLBinaryReader;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_XML_XMLBINARYNODE_H
|
||||
|
||||
@@ -79,22 +79,16 @@ void GetMD5(const char* pSrcBuffer, int nSrcSize, char signatureMD5[16])
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CXmlSerializer
|
||||
: public IXmlSerializer
|
||||
class CXmlSerializer final : public IXmlSerializer
|
||||
{
|
||||
public:
|
||||
CXmlSerializer()
|
||||
: m_nRefCount(0)
|
||||
, m_pReaderImpl(nullptr)
|
||||
, m_pReaderSer(nullptr)
|
||||
, m_pWriterSer(nullptr)
|
||||
, m_pWriterImpl(nullptr)
|
||||
{
|
||||
}
|
||||
CXmlSerializer() = default;
|
||||
|
||||
~CXmlSerializer()
|
||||
{
|
||||
ClearAll();
|
||||
}
|
||||
|
||||
void ClearAll()
|
||||
{
|
||||
SAFE_DELETE(m_pReaderSer);
|
||||
@@ -104,7 +98,11 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void AddRef() override { ++m_nRefCount; }
|
||||
void AddRef() override
|
||||
{
|
||||
++m_nRefCount;
|
||||
}
|
||||
|
||||
void Release() override
|
||||
{
|
||||
if (--m_nRefCount <= 0)
|
||||
@@ -120,6 +118,7 @@ public:
|
||||
m_pWriterSer = new CSimpleSerializeWithDefaults<CSerializeXMLWriterImpl>(*m_pWriterImpl);
|
||||
return m_pWriterSer;
|
||||
}
|
||||
|
||||
ISerialize* GetReader(XmlNodeRef& node) override
|
||||
{
|
||||
ClearAll();
|
||||
@@ -130,12 +129,12 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
int m_nRefCount;
|
||||
CSerializeXMLReaderImpl* m_pReaderImpl;
|
||||
CSimpleSerializeWithDefaults<CSerializeXMLReaderImpl>* m_pReaderSer;
|
||||
int m_nRefCount = 0;
|
||||
CSerializeXMLReaderImpl* m_pReaderImpl = nullptr;
|
||||
CSimpleSerializeWithDefaults<CSerializeXMLReaderImpl>* m_pReaderSer = nullptr;
|
||||
|
||||
CSerializeXMLWriterImpl* m_pWriterImpl;
|
||||
CSimpleSerializeWithDefaults<CSerializeXMLWriterImpl>* m_pWriterSer;
|
||||
CSerializeXMLWriterImpl* m_pWriterImpl = nullptr;
|
||||
CSimpleSerializeWithDefaults<CSerializeXMLWriterImpl>* m_pWriterSer = nullptr;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -145,8 +144,7 @@ IXmlSerializer* CXmlUtils::CreateXmlSerializer()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CXmlBinaryDataWriterFile
|
||||
: public XMLBinary::IDataWriter
|
||||
class CXmlBinaryDataWriterFile final : public XMLBinary::IDataWriter
|
||||
{
|
||||
public:
|
||||
CXmlBinaryDataWriterFile(const char* file)
|
||||
@@ -177,8 +175,7 @@ private:
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CXmlTableReader
|
||||
: public IXmlTableReader
|
||||
class CXmlTableReader final : public IXmlTableReader
|
||||
{
|
||||
public:
|
||||
CXmlTableReader();
|
||||
|
||||
@@ -626,20 +626,6 @@ void CXmlNode::deleteChild(const char* tag)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXmlNode::deleteChildAt(int nIndex)
|
||||
{
|
||||
if (m_pChilds)
|
||||
{
|
||||
XmlNodes& childs = *m_pChilds;
|
||||
if (nIndex >= 0 && nIndex < (int)childs.size())
|
||||
{
|
||||
ReleaseChild(childs[nIndex]);
|
||||
childs.erase(childs.begin() + nIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Adds new child node.
|
||||
void CXmlNode::addChild(const XmlNodeRef& node)
|
||||
{
|
||||
@@ -655,74 +641,12 @@ void CXmlNode::addChild(const XmlNodeRef& node)
|
||||
pNode->setParent(this);
|
||||
};
|
||||
|
||||
void CXmlNode::shareChildren(const XmlNodeRef& inFromMe)
|
||||
{
|
||||
int numChildren = inFromMe->getChildCount();
|
||||
|
||||
removeAllChilds();
|
||||
|
||||
if (numChildren > 0)
|
||||
{
|
||||
XmlNodeRef child;
|
||||
|
||||
m_pChilds = new XmlNodes;
|
||||
m_pChilds->reserve(numChildren);
|
||||
for (int i = 0; i < numChildren; i++)
|
||||
{
|
||||
child = inFromMe->getChild(i);
|
||||
|
||||
child->AddRef();
|
||||
// not overwriting parent assignment of child, we share the node but do not exclusively own it
|
||||
m_pChilds->push_back(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CXmlNode::setParent(const XmlNodeRef& inNewParent)
|
||||
{
|
||||
// note, parent ptrs are not ref counted
|
||||
m_parent = inNewParent;
|
||||
}
|
||||
|
||||
void CXmlNode::insertChild(int inIndex, const XmlNodeRef& inNewChild)
|
||||
{
|
||||
assert(inIndex >= 0 && inIndex <= getChildCount());
|
||||
assert(inNewChild != 0);
|
||||
if (inIndex >= 0 && inIndex <= getChildCount() && inNewChild)
|
||||
{
|
||||
if (getChildCount() == 0)
|
||||
{
|
||||
addChild(inNewChild);
|
||||
}
|
||||
else
|
||||
{
|
||||
IXmlNode* pNode = ((IXmlNode*)inNewChild);
|
||||
pNode->AddRef();
|
||||
m_pChilds->insert(m_pChilds->begin() + inIndex, pNode);
|
||||
pNode->setParent(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CXmlNode::replaceChild(int inIndex, const XmlNodeRef& inNewChild)
|
||||
{
|
||||
assert(inIndex >= 0 && inIndex < getChildCount());
|
||||
assert(inNewChild != 0);
|
||||
if (inIndex >= 0 && inIndex < getChildCount() && inNewChild)
|
||||
{
|
||||
IXmlNode* wasChild = (*m_pChilds)[inIndex];
|
||||
|
||||
if (wasChild->getParent() == this)
|
||||
{
|
||||
wasChild->setParent(XmlNodeRef()); // child is orphaned, will be freed by Release() below if this parent is last holding a reference to it
|
||||
}
|
||||
wasChild->Release();
|
||||
inNewChild->AddRef();
|
||||
(*m_pChilds)[inIndex] = inNewChild;
|
||||
inNewChild->setParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
XmlNodeRef CXmlNode::newChild(const char* tagName)
|
||||
{
|
||||
XmlNodeRef node = createNode(tagName);
|
||||
@@ -817,34 +741,6 @@ bool CXmlNode::getAttributeByIndex(int index, XmlString& key, XmlString& value)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef CXmlNode::clone()
|
||||
{
|
||||
CXmlNode* node = new CXmlNode;
|
||||
XmlNodeRef result(node);
|
||||
node->m_pStringPool = m_pStringPool;
|
||||
m_pStringPool->AddRef();
|
||||
node->m_tag = m_tag;
|
||||
node->m_content = m_content;
|
||||
// Clone attributes.
|
||||
CXmlNode* n = (CXmlNode*)(IXmlNode*)node;
|
||||
n->copyAttributes(this);
|
||||
// Clone sub nodes.
|
||||
|
||||
if (m_pChilds)
|
||||
{
|
||||
const XmlNodes& childs = *m_pChilds;
|
||||
|
||||
node->m_pChilds = new XmlNodes;
|
||||
node->m_pChilds->reserve(childs.size());
|
||||
for (int i = 0, num = static_cast<int>(childs.size()); i < num; ++i)
|
||||
{
|
||||
node->addChild(childs[i]->clone());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static void AddTabsToString(XmlString& xml, int level)
|
||||
@@ -1206,16 +1102,6 @@ XmlString CXmlNode::getXML(int level) const
|
||||
return xml;
|
||||
}
|
||||
|
||||
XmlString CXmlNode::getXMLUnsafe(int level, char* tmpBuffer, uint32 sizeOfTmpBuffer) const
|
||||
{
|
||||
char* endPtr = tmpBuffer + sizeOfTmpBuffer - 1;
|
||||
char* endOfBuffer = AddToXmlStringUnsafe(tmpBuffer, level, endPtr);
|
||||
endOfBuffer[0] = '\0';
|
||||
XmlString ret(tmpBuffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// TODO: those 2 saving functions are a bit messy. should probably make a separate one for the use of PlatformAPI
|
||||
bool CXmlNode::saveToFile(const char* fileName)
|
||||
{
|
||||
@@ -1247,9 +1133,7 @@ bool CXmlNode::saveToFile(const char* fileName)
|
||||
|
||||
bool CXmlNode::saveToFile([[maybe_unused]] const char* fileName, size_t chunkSize, AZ::IO::HandleType fileHandle)
|
||||
{
|
||||
#ifdef WIN32
|
||||
CrySetFileAttributes(fileName, 0x00000080); // FILE_ATTRIBUTE_NORMAL
|
||||
#endif //WIN32
|
||||
CrySetFileAttributes(fileName, FILE_ATTRIBUTE_NORMAL);
|
||||
|
||||
if (chunkSize < 256 * 1024) // make at least 256k
|
||||
{
|
||||
|
||||
@@ -46,14 +46,14 @@ class XmlParser
|
||||
{
|
||||
public:
|
||||
explicit XmlParser(bool bReuseStrings);
|
||||
~XmlParser();
|
||||
~XmlParser() override;
|
||||
|
||||
void AddRef()
|
||||
void AddRef() override
|
||||
{
|
||||
++m_nRefCount;
|
||||
}
|
||||
|
||||
void Release()
|
||||
void Release() override
|
||||
{
|
||||
if (--m_nRefCount <= 0)
|
||||
{
|
||||
@@ -61,9 +61,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual XmlNodeRef ParseFile(const char* filename, bool bCleanPools);
|
||||
XmlNodeRef ParseFile(const char* filename, bool bCleanPools) override;
|
||||
|
||||
virtual XmlNodeRef ParseBuffer(const char* buffer, int nBufLen, bool bCleanPools, bool bSuppressWarnings = false);
|
||||
XmlNodeRef ParseBuffer(const char* buffer, int nBufLen, bool bCleanPools, bool bSuppressWarnings = false) override;
|
||||
|
||||
const char* getErrorString() const { return m_errorString; }
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
CXmlNode();
|
||||
CXmlNode(const char* tag, bool bReuseStrings, bool bIsProcessingInstruction = false);
|
||||
//! Destructor.
|
||||
~CXmlNode();
|
||||
~CXmlNode() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Custom new/delete with pool allocator.
|
||||
@@ -120,125 +120,118 @@ public:
|
||||
//void* operator new( size_t nSize );
|
||||
//void operator delete( void *ptr );
|
||||
|
||||
virtual void DeleteThis();
|
||||
void DeleteThis() override;
|
||||
|
||||
//! Create new XML node.
|
||||
XmlNodeRef createNode(const char* tag);
|
||||
XmlNodeRef createNode(const char* tag) override;
|
||||
|
||||
//! Get XML node tag.
|
||||
const char* getTag() const { return m_tag; };
|
||||
void setTag(const char* tag);
|
||||
const char* getTag() const override
|
||||
{ return m_tag; };
|
||||
void setTag(const char* tag) override;
|
||||
|
||||
//! Return true if given tag equal to node tag.
|
||||
bool isTag(const char* tag) const;
|
||||
bool isTag(const char* tag) const override;
|
||||
|
||||
//! Get XML Node attributes.
|
||||
virtual int getNumAttributes() const { return m_pAttributes ? (int)m_pAttributes->size() : 0; };
|
||||
int getNumAttributes() const override
|
||||
{ return m_pAttributes ? (int)m_pAttributes->size() : 0; };
|
||||
//! Return attribute key and value by attribute index.
|
||||
virtual bool getAttributeByIndex(int index, const char** key, const char** value);
|
||||
bool getAttributeByIndex(int index, const char** key, const char** value) override;
|
||||
|
||||
//! Return attribute key and value by attribute index, string version.
|
||||
virtual bool getAttributeByIndex(int index, XmlString& key, XmlString& value);
|
||||
|
||||
|
||||
virtual void copyAttributes(XmlNodeRef fromNode);
|
||||
virtual void shareChildren(const XmlNodeRef& fromNode);
|
||||
void copyAttributes(XmlNodeRef fromNode) override;
|
||||
|
||||
//! Get XML Node attribute for specified key.
|
||||
const char* getAttr(const char* key) const;
|
||||
const char* getAttr(const char* key) const override;
|
||||
|
||||
//! Get XML Node attribute for specified key.
|
||||
// Returns true if the attribute existes, alse otherwise.
|
||||
bool getAttr(const char* key, const char** value) const;
|
||||
bool getAttr(const char* key, const char** value) const override;
|
||||
|
||||
//! Check if attributes with specified key exist.
|
||||
bool haveAttr(const char* key) const;
|
||||
bool haveAttr(const char* key) const override;
|
||||
|
||||
//! Creates new xml node and add it to childs list.
|
||||
XmlNodeRef newChild(const char* tagName);
|
||||
XmlNodeRef newChild(const char* tagName) override;
|
||||
|
||||
//! Adds new child node.
|
||||
void addChild(const XmlNodeRef& node);
|
||||
void addChild(const XmlNodeRef& node) override;
|
||||
//! Remove child node.
|
||||
void removeChild(const XmlNodeRef& node);
|
||||
|
||||
void insertChild(int nIndex, const XmlNodeRef& node);
|
||||
void replaceChild(int nIndex, const XmlNodeRef& node);
|
||||
void removeChild(const XmlNodeRef& node) override;
|
||||
|
||||
//! Remove all child nodes.
|
||||
void removeAllChilds();
|
||||
void removeAllChilds() override;
|
||||
|
||||
//! Get number of child XML nodes.
|
||||
int getChildCount() const { return m_pChilds ? (int)m_pChilds->size() : 0; };
|
||||
int getChildCount() const override { return m_pChilds ? (int)m_pChilds->size() : 0; }
|
||||
|
||||
//! Get XML Node child nodes.
|
||||
XmlNodeRef getChild(int i) const;
|
||||
XmlNodeRef getChild(int i) const override;
|
||||
|
||||
//! Find node with specified tag.
|
||||
XmlNodeRef findChild(const char* tag) const;
|
||||
XmlNodeRef findChild(const char* tag) const override;
|
||||
void deleteChild(const char* tag);
|
||||
void deleteChildAt(int nIndex);
|
||||
|
||||
//! Get parent XML node.
|
||||
XmlNodeRef getParent() const { return m_parent; }
|
||||
void setParent(const XmlNodeRef& inRef);
|
||||
XmlNodeRef getParent() const override { return m_parent; }
|
||||
void setParent(const XmlNodeRef& inRef) override;
|
||||
|
||||
|
||||
//! Returns content of this node.
|
||||
const char* getContent() const { return m_content; };
|
||||
void setContent(const char* str);
|
||||
const char* getContent() const override
|
||||
{ return m_content; };
|
||||
void setContent(const char* str) override;
|
||||
|
||||
XmlNodeRef clone();
|
||||
|
||||
//! Returns line number for XML tag.
|
||||
int getLine() const { return m_line; };
|
||||
//! Set line number in xml.
|
||||
void setLine(int line) { m_line = line; };
|
||||
void setLine(int line) override { m_line = line; }
|
||||
|
||||
//! Returns XML of this node and sub nodes.
|
||||
virtual IXmlStringData* getXMLData(int nReserveMem = 0) const;
|
||||
XmlString getXML(int level = 0) const;
|
||||
XmlString getXMLUnsafe(int level, char* tmpBuffer, uint32 sizeOfTmpBuffer) const;
|
||||
bool saveToFile(const char* fileName); // saves in one huge chunk
|
||||
bool saveToFile(const char* fileName, size_t chunkSizeBytes, AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle); // save in small memory chunks
|
||||
IXmlStringData* getXMLData(int nReserveMem = 0) const override;
|
||||
XmlString getXML(int level = 0) const override;
|
||||
bool saveToFile(const char* fileName) override; // saves in one huge chunk
|
||||
bool saveToFile(const char* fileName, size_t chunkSizeBytes, AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle) override; // save in small memory chunks
|
||||
|
||||
//! Set new XML Node attribute (or override attribute with same key).
|
||||
using IXmlNode::setAttr;
|
||||
void setAttr(const char* key, const char* value);
|
||||
void setAttr(const char* key, int value);
|
||||
void setAttr(const char* key, unsigned int value);
|
||||
void setAttr(const char* key, int64 value);
|
||||
void setAttr(const char* key, uint64 value, bool useHexFormat = true);
|
||||
void setAttr(const char* key, float value);
|
||||
void setAttr(const char* key, double value);
|
||||
void setAttr(const char* key, const Vec2& value);
|
||||
void setAttr(const char* key, const Ang3& value);
|
||||
void setAttr(const char* key, const Vec3& value);
|
||||
void setAttr(const char* key, const Vec4& value);
|
||||
void setAttr(const char* key, const Quat& value);
|
||||
void setAttr(const char* key, const char* value) override;
|
||||
void setAttr(const char* key, int value) override;
|
||||
void setAttr(const char* key, unsigned int value) override;
|
||||
void setAttr(const char* key, int64 value) override;
|
||||
void setAttr(const char* key, uint64 value, bool useHexFormat = true) override;
|
||||
void setAttr(const char* key, float value) override;
|
||||
void setAttr(const char* key, double value) override;
|
||||
void setAttr(const char* key, const Vec2& value) override;
|
||||
void setAttr(const char* key, const Ang3& value) override;
|
||||
void setAttr(const char* key, const Vec3& value) override;
|
||||
void setAttr(const char* key, const Vec4& value) override;
|
||||
void setAttr(const char* key, const Quat& value) override;
|
||||
|
||||
//! Delete attrbute.
|
||||
void delAttr(const char* key);
|
||||
void delAttr(const char* key) override;
|
||||
//! Remove all node attributes.
|
||||
void removeAllAttributes();
|
||||
void removeAllAttributes() override;
|
||||
|
||||
//! Get attribute value of node.
|
||||
bool getAttr(const char* key, int& value) const;
|
||||
bool getAttr(const char* key, unsigned int& value) const;
|
||||
bool getAttr(const char* key, int64& value) const;
|
||||
bool getAttr(const char* key, uint64& value, bool useHexFormat = true /*ignored*/) const;
|
||||
bool getAttr(const char* key, float& value) const;
|
||||
bool getAttr(const char* key, double& value) const;
|
||||
bool getAttr(const char* key, bool& value) const;
|
||||
bool getAttr(const char* key, int& value) const override;
|
||||
bool getAttr(const char* key, unsigned int& value) const override;
|
||||
bool getAttr(const char* key, int64& value) const override;
|
||||
bool getAttr(const char* key, uint64& value, bool useHexFormat = true /*ignored*/) const override;
|
||||
bool getAttr(const char* key, float& value) const override;
|
||||
bool getAttr(const char* key, double& value) const override;
|
||||
bool getAttr(const char* key, bool& value) const override;
|
||||
|
||||
bool getAttr(const char* key, XmlString& value) const {const char* v(NULL); bool boHasAttribute(getAttr(key, &v)); value = v; return boHasAttribute; }
|
||||
bool getAttr(const char* key, XmlString& value) const override
|
||||
{const char* v(NULL); bool boHasAttribute(getAttr(key, &v)); value = v; return boHasAttribute; }
|
||||
|
||||
bool getAttr(const char* key, Vec2& value) const;
|
||||
bool getAttr(const char* key, Ang3& value) const;
|
||||
bool getAttr(const char* key, Vec3& value) const;
|
||||
bool getAttr(const char* key, Vec4& value) const;
|
||||
bool getAttr(const char* key, Quat& value) const;
|
||||
bool getAttr(const char* key, ColorB& value) const;
|
||||
bool getAttr(const char* key, Vec2& value) const override;
|
||||
bool getAttr(const char* key, Ang3& value) const override;
|
||||
bool getAttr(const char* key, Vec3& value) const override;
|
||||
bool getAttr(const char* key, Vec4& value) const override;
|
||||
bool getAttr(const char* key, Quat& value) const override;
|
||||
bool getAttr(const char* key, ColorB& value) const override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -356,7 +349,7 @@ class CXmlNodeReuse
|
||||
{
|
||||
public:
|
||||
CXmlNodeReuse(const char* tag, CXmlNodePool* pPool);
|
||||
virtual void Release();
|
||||
void Release() override;
|
||||
|
||||
protected:
|
||||
CXmlNodePool* m_pPool;
|
||||
|
||||
Reference in New Issue
Block a user