Legacy cleanup, part 2 (#3659)

* Legacy cleanup, part 2

There are still things that can be removed, those will be likely done in part three:
`The Return of the Cleanup` :)

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix windows build

Somehow there were some unfixed errors from enabled warnings?
I'm unsure if I've pulled repo in unstable state, or those were somehow
missed.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
Artur K
2021-08-30 22:40:02 +02:00
committed by GitHub
parent fa0f2a1007
commit 96a5f06ca3
116 changed files with 189 additions and 18706 deletions
@@ -10,9 +10,11 @@
#pragma once
#include <ILocalizationManager.h>
#include <ISystem.h>
#include <StlUtils.h>
#include <VectorMap.h>
#include <AzCore/std/containers/map.h>
#include <CryCommon/LegacyAllocator.h>
#include "Huffman.h"
@@ -153,9 +155,9 @@ private:
CryHalf fVolume;
CryHalf fRadioRatio;
// SoundMoods
DynArray<SLocalizedAdvancesSoundEntry> SoundMoods;
AZStd::vector<SLocalizedAdvancesSoundEntry, AZ::StdLegacyAllocator> SoundMoods;
// EventParameters
DynArray<SLocalizedAdvancesSoundEntry> EventParameters;
AZStd::vector<SLocalizedAdvancesSoundEntry, AZ::StdLegacyAllocator> EventParameters;
// ~audio specific part
// subtitle & radio flags
@@ -312,5 +314,3 @@ private:
mutable AZStd::mutex m_cs;
typedef AZStd::lock_guard<AZStd::mutex> AutoLock;
};
+1 -18
View File
@@ -12,7 +12,7 @@
#pragma once
#include "ISystem.h"
#include <CryCommon/CryLegacyAllocator.h>
#include <StlUtils.h>
//TODO: Pull most of this into a cpp file!
@@ -265,23 +265,6 @@ public:
return ret;
}
void GetMemoryUsage(ICrySizer* pSizer) const
{
BLOCK* pBlock = m_blocks;
while (pBlock)
{
pSizer->AddObject(pBlock, offsetof(BLOCK, s) + pBlock->size * sizeof(char));
pBlock = pBlock->next;
}
pBlock = m_free_blocks;
while (pBlock)
{
pSizer->AddObject(pBlock, offsetof(BLOCK, s) + pBlock->size * sizeof(char));
pBlock = pBlock->next;
}
}
private:
CSimpleStringPool(const CSimpleStringPool&);
CSimpleStringPool& operator = (const CSimpleStringPool&);
+3 -1
View File
@@ -20,6 +20,7 @@
#include <CryPath.h>
#include <CrySystemBus.h>
#include <CryCommon/IFont.h>
#include <CryCommon/MiniQueue.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/API/ApplicationAPI_Platform.h>
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
@@ -28,6 +29,7 @@
#include <AzCore/Debug/Trace.h>
#include <AzCore/Debug/IEventLogger.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/algorithm.h>
#include <AzFramework/Logging/MissingAssetLogger.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <AzCore/Interface/Interface.h>
@@ -641,7 +643,7 @@ void CSystem::SleepIfNeeded()
allowStallCatchup = true;
float totalElapsed = (now - prevNow.Front()).GetSeconds();
float wantSleepTime = CLAMP(minTime * (prevNow.Size() - 1) - totalElapsed, 0, (minTime - elapsed) * 0.9f);
float wantSleepTime = AZStd::clamp(minTime * (prevNow.Size() - 1) - totalElapsed, 0.0f, (minTime - elapsed) * 0.9f);
static float sleepTime = 0;
sleepTime = (15 * sleepTime + wantSleepTime) / 16;
int sleepMS = (int)(1000.0f * sleepTime + 0.5f);
+7 -8
View File
@@ -13,7 +13,6 @@
#include <HMDBus.h>
#include "View.h"
#include <AzCore/Math/MathUtils.h>
#include <IStereoRenderer.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Component/Entity.h>
#include <Random.h>
@@ -541,13 +540,13 @@ void CView::GetMemoryUsage(ICrySizer* s) const
s->AddObject(m_shakes);
}
void CView::Serialize(TSerialize ser)
{
if (ser.IsReading())
{
ResetShaking();
}
}
//void CView::Serialize(TSerialize ser)
//{
// if (ser.IsReading())
// {
// ResetShaking();
// }
//}
void CView::PostSerialize()
{
+1 -1
View File
@@ -15,6 +15,7 @@
#include <Cry_Camera.h>
class CGameObject;
struct ISystem;
namespace LegacyViewSystem
{
@@ -106,7 +107,6 @@ public:
virtual void SetActive(const bool bActive);
// ~IView
void Serialize(TSerialize ser) override;
void PostSerialize() override;
CCamera& GetCamera() override { return m_camera; }
const CCamera& GetCamera() const override { return m_camera; }
+10 -10
View File
@@ -617,16 +617,16 @@ void CViewSystem::GetMemoryUsage(ICrySizer* s) const
s->AddContainer(m_views);
}
void CViewSystem::Serialize(TSerialize ser)
{
TViewMap::iterator iter = m_views.begin();
TViewMap::iterator iterEnd = m_views.end();
while (iter != iterEnd)
{
iter->second->Serialize(ser);
++iter;
}
}
//void CViewSystem::Serialize(TSerialize ser)
//{
// TViewMap::iterator iter = m_views.begin();
// TViewMap::iterator iterEnd = m_views.end();
// while (iter != iterEnd)
// {
// iter->second->Serialize(ser);
// ++iter;
// }
//}
void CViewSystem::PostSerialize()
{
@@ -53,7 +53,6 @@ public:
virtual unsigned int GetViewId(IView* pView);
virtual unsigned int GetActiveViewId();
virtual void Serialize(TSerialize ser);
virtual void PostSerialize();
virtual IView* GetViewByEntityId(const AZ::EntityId& id, bool forceCreate);
+1 -226
View File
@@ -1762,7 +1762,7 @@ void CXConsole::ExecuteString(const char* command, const bool bSilentMode, const
AZ::StringFunc::TrimWhiteSpace(str, true, false);
// Unroll the exec command
bool unroll = (0 == AZ::StringFunc::Find(str, "exec", 0, false, false));
if (unroll)
@@ -2891,75 +2891,6 @@ int CXConsole::GetNumVisibleVars()
return numVars;
}
//////////////////////////////////////////////////////////////////////////
bool CXConsole::IsHashCalculated()
{
return m_bCheatHashDirty == false;
}
//////////////////////////////////////////////////////////////////////////
int CXConsole::GetNumCheatVars()
{
return static_cast<int>(m_randomCheckedVariables.size());
}
//////////////////////////////////////////////////////////////////////////
uint64 CXConsole::GetCheatVarHash()
{
return m_nCheatHash;
}
//////////////////////////////////////////////////////////////////////////
void CXConsole::SetCheatVarHashRange(size_t firstVar, size_t lastVar)
{
// check inputs are sane
#if !defined(NDEBUG)
size_t numVars = GetNumCheatVars();
assert(firstVar < numVars && lastVar < numVars && lastVar >= firstVar);
#endif
#if defined(DEFENCE_CVAR_HASH_LOGGING)
if (m_bCheatHashDirty)
{
CryLog("HASHING: WARNING - trying to set up new cvar hash range while existing hash still calculating!");
}
#endif
m_nCheatHashRangeFirst = firstVar;
m_nCheatHashRangeLast = lastVar;
m_bCheatHashDirty = true;
}
//////////////////////////////////////////////////////////////////////////
void CXConsole::CalcCheatVarHash()
{
if (!m_bCheatHashDirty)
{
return;
}
CCrc32 runningNameCrc32;
CCrc32 runningNameValueCrc32;
AddCVarsToHash(m_randomCheckedVariables.begin() + m_nCheatHashRangeFirst, m_randomCheckedVariables.begin() + m_nCheatHashRangeLast, runningNameCrc32, runningNameValueCrc32);
AddCVarsToHash(m_alwaysCheckedVariables.begin(), m_alwaysCheckedVariables.end() - 1, runningNameCrc32, runningNameValueCrc32);
// store hash
m_nCheatHash = (((uint64)runningNameCrc32.Get()) << 32) | runningNameValueCrc32.Get();
m_bCheatHashDirty = false;
#if defined(DEFENCE_CVAR_HASH_LOGGING)
if (!gEnv->IsDedicated())
{
CryLog("HASHING: Range %d->%d = %llx(%x,%x), max cvars = %d", m_nCheatHashRangeFirst, m_nCheatHashRangeLast,
m_nCheatHash, runningNameCrc32.Get(), runningNameValueCrc32.Get(),
GetNumCheatVars());
PrintCheatVars(true);
}
#endif
}
void CXConsole::AddCVarsToHash(ConsoleVariablesVector::const_iterator begin, ConsoleVariablesVector::const_iterator end, CCrc32& runningNameCrc32, CCrc32& runningNameValueCrc32)
{
for (ConsoleVariablesVector::const_iterator it = begin; it <= end; ++it)
@@ -2974,162 +2905,6 @@ void CXConsole::AddCVarsToHash(ConsoleVariablesVector::const_iterator begin, Con
}
}
void CXConsole::CmdDumpAllAnticheatVars([[maybe_unused]] IConsoleCmdArgs* pArgs)
{
#if defined(DEFENCE_CVAR_HASH_LOGGING)
CXConsole* pConsole = (CXConsole*)gEnv->pConsole;
if (pConsole->IsHashCalculated())
{
CryLog("HASHING: Displaying Full Anticheat Cvar list:");
pConsole->PrintCheatVars(false);
}
else
{
CryLogAlways("DumpAllAnticheatVars - cannot complete, cheat vars are in a state of flux, please retry.");
}
#endif
}
void CXConsole::CmdDumpLastHashedAnticheatVars([[maybe_unused]] IConsoleCmdArgs* pArgs)
{
#if defined(DEFENCE_CVAR_HASH_LOGGING)
CXConsole* pConsole = (CXConsole*)gEnv->pConsole;
if (pConsole->IsHashCalculated())
{
CryLog("HASHING: Displaying Last Hashed Anticheat Cvar list:");
pConsole->PrintCheatVars(true);
}
else
{
CryLogAlways("DumpLastHashedAnticheatVars - cannot complete, cheat vars are in a state of flux, please retry.");
}
#endif
}
void CXConsole::PrintCheatVars([[maybe_unused]] bool bUseLastHashRange)
{
#if defined(DEFENCE_CVAR_HASH_LOGGING)
if (m_bCheatHashDirty)
{
return;
}
size_t i = 0;
char floatFormatBuf[64];
size_t nStart = 0;
size_t nEnd = m_mapVariables.size();
if (bUseLastHashRange)
{
nStart = m_nCheatHashRangeFirst;
nEnd = m_nCheatHashRangeLast;
}
// iterate over all const cvars in our range
// then hash the string.
CryLog("VF_CHEAT & ~VF_CHEAT_NOCHECK list:");
ConsoleVariablesMap::const_iterator it, end = m_mapVariables.end();
for (it = m_mapVariables.begin(); it != end; ++it)
{
// only count cheat cvars
if ((it->second->GetFlags() & VF_CHEAT) == 0 ||
(it->second->GetFlags() & VF_CHEAT_NOCHECK) != 0)
{
continue;
}
// count up
i++;
// if we haven't reached the first var, or have passed the last var, break out
if (i - 1 < nStart)
{
continue;
}
if (i - 1 > nEnd)
{
break;
}
// add name & variable to string. We add both since adding only the value could cause
// many collisions with variables all having value 0 or all 1.
string hashStr = it->first;
if (it->second->GetType() == CVAR_FLOAT)
{
sprintf(floatFormatBuf, "%.1g", it->second->GetFVal());
hashStr += floatFormatBuf;
}
else
{
hashStr += it->second->GetString();
}
CryLog("%s", hashStr.c_str());
}
// iterate over any must-check variables
CryLog("VF_CHEAT_ALWAYS_CHECK list:");
for (it = m_mapVariables.begin(); it != end; ++it)
{
// only count cheat cvars
if ((it->second->GetFlags() & VF_CHEAT_ALWAYS_CHECK) == 0)
{
continue;
}
// add name & variable to string. We add both since adding only the value could cause
// many collisions with variables all having value 0 or all 1.
string hashStr = it->first;
hashStr += it->second->GetString();
CryLog("%s", hashStr.c_str());
}
#endif
}
char* CXConsole::GetCheatVarAt(uint32 nOffset)
{
if (m_bCheatHashDirty)
{
return NULL;
}
size_t i = 0;
size_t nStart = nOffset;
// iterate over all const cvars in our range
// then hash the string.
ConsoleVariablesMap::const_iterator it, end = m_mapVariables.end();
for (it = m_mapVariables.begin(); it != end; ++it)
{
// only count cheat cvars
if ((it->second->GetFlags() & VF_CHEAT) == 0 ||
(it->second->GetFlags() & VF_CHEAT_NOCHECK) != 0)
{
continue;
}
// count up
i++;
// if we haven't reached the first var continue
if (i - 1 < nStart)
{
continue;
}
return (char*)it->first;
}
return NULL;
}
//////////////////////////////////////////////////////////////////////////
size_t CXConsole::GetSortedVars(AZStd::vector<AZStd::string_view>& pszArray, const char* szPrefix)
{
-11
View File
@@ -182,11 +182,6 @@ public:
virtual int GetNumVars();
virtual int GetNumVisibleVars();
virtual size_t GetSortedVars(AZStd::vector<AZStd::string_view>& pszArray, const char* szPrefix = 0);
virtual int GetNumCheatVars();
virtual void SetCheatVarHashRange(size_t firstVar, size_t lastVar);
virtual void CalcCheatVarHash();
virtual bool IsHashCalculated();
virtual uint64 GetCheatVarHash();
virtual void FindVar(const char* substr);
virtual const char* AutoComplete(const char* substr);
virtual const char* AutoCompletePrev(const char* substr);
@@ -231,9 +226,6 @@ public:
// 0 if the operation failed
ICVar* RegisterCVarGroup(const char* sName, const char* szFileName);
virtual void PrintCheatVars(bool bUseLastHashRange);
virtual char* GetCheatVarAt(uint32 nOffset);
void SetProcessingGroup(bool isGroup) { m_bIsProcessingGroup = isGroup; }
bool GetIsProcessingGroup(void) const { return m_bIsProcessingGroup; }
@@ -286,9 +278,6 @@ protected: // ------------------------------------------------------------------
static const char* GetFlagsString(const uint32 dwFlags);
static void CmdDumpAllAnticheatVars(IConsoleCmdArgs* pArgs);
static void CmdDumpLastHashedAnticheatVars(IConsoleCmdArgs* pArgs);
private: // ----------------------------------------------------------
typedef std::map<const char*, ICVar*, string_nocase_lt> ConsoleVariablesMap; // key points into string stored in ICVar or in .exe/.dll
@@ -129,40 +129,6 @@ uint64 CXConsoleVariableBase::AddOnChangeFunctor(const SFunctor& pChangeFunctor)
return newId;
}
uint64 CXConsoleVariableBase::GetNumberOfOnChangeFunctors() const
{
return m_changeFunctors.size();
}
const SFunctor& CXConsoleVariableBase::GetOnChangeFunctor(uint64 nFunctorId) const
{
auto predicate = [nFunctorId](const std::pair<int, SFunctor>& entry) -> bool { return entry.first == nFunctorId; };
auto changeFunctor = std::find_if(m_changeFunctors.begin(), m_changeFunctors.end(), predicate);
if (changeFunctor != m_changeFunctors.end())
{
return (*changeFunctor).second;
}
static SFunctor sDummyFunctor;
assert(false && "[CXConsoleVariableBase::GetOnChangeFunctor] Trying to get a functor for an id that does not exist.");
return sDummyFunctor;
}
bool CXConsoleVariableBase::RemoveOnChangeFunctor(const uint64 nFunctorId)
{
auto predicate = [nFunctorId](const std::pair<int, SFunctor>& entry) -> bool { return entry.first == nFunctorId; };
auto changeFunctor = std::find_if(m_changeFunctors.begin(), m_changeFunctors.end(), predicate);
if (changeFunctor != m_changeFunctors.end())
{
m_changeFunctors.erase(changeFunctor);
return true;
}
return false;
}
ConsoleVarFunc CXConsoleVariableBase::GetOnChangeCallback() const
{
return m_pChangeFunc;
+5 -8
View File
@@ -108,9 +108,6 @@ public:
virtual void ForceSet(const char* s);
virtual void SetOnChangeCallback(ConsoleVarFunc pChangeFunc);
virtual uint64 AddOnChangeFunctor(const SFunctor& pChangeFunctor) override;
virtual bool RemoveOnChangeFunctor(const uint64 nFunctorId) override;
virtual uint64 GetNumberOfOnChangeFunctors() const;
virtual const SFunctor& GetOnChangeFunctor(uint64 nFunctorId) const override;
virtual ConsoleVarFunc GetOnChangeCallback() const;
virtual bool ShouldReset() const { return (m_nFlags & VF_RESETTABLE) != 0; }
@@ -250,7 +247,7 @@ public:
virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); }
private: // --------------------------------------------------------------------------------------------
AZStd::string m_sValue;
AZStd::string m_sValue;
AZStd::string m_sDefault; //!<
};
@@ -315,7 +312,7 @@ public:
virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); }
protected: // --------------------------------------------------------------------------------------------
int m_iValue;
int m_iValue;
int m_iDefault; //!<
};
@@ -382,7 +379,7 @@ public:
virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); }
protected: // --------------------------------------------------------------------------------------------
int64 m_iValue;
int64 m_iValue;
int64 m_iDefault; //!<
};
@@ -488,7 +485,7 @@ protected:
private: // --------------------------------------------------------------------------------------------
float m_fValue;
float m_fValue;
float m_fDefault; //!<
};
@@ -578,7 +575,7 @@ public:
virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); }
private: // --------------------------------------------------------------------------------------------
int& m_iValue;
int& m_iValue;
int m_iDefault; //!<
};