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:
@@ -11,7 +11,7 @@
|
||||
#include "CmdLine.h"
|
||||
|
||||
|
||||
void CCmdLine::PushCommand(const string& sCommand, const string& sParameter)
|
||||
void CCmdLine::PushCommand(const AZStd::string& sCommand, const AZStd::string& sParameter)
|
||||
{
|
||||
if (sCommand.empty())
|
||||
{
|
||||
@@ -47,7 +47,7 @@ CCmdLine::CCmdLine(const char* commandLine)
|
||||
|
||||
char* src = (char*)commandLine;
|
||||
|
||||
string command, parameter;
|
||||
AZStd::string command, parameter;
|
||||
|
||||
for (;; )
|
||||
{
|
||||
@@ -56,12 +56,12 @@ CCmdLine::CCmdLine(const char* commandLine)
|
||||
break;
|
||||
}
|
||||
|
||||
string arg = Next(src);
|
||||
AZStd::string arg = Next(src);
|
||||
|
||||
if (m_args.empty())
|
||||
{
|
||||
// this is the filename, convert backslash to forward slash
|
||||
arg.replace('\\', '/');
|
||||
AZ::StringFunc::Replace(arg, '\\', '/');
|
||||
m_args.push_back(CCmdLineArg("filename", arg.c_str(), eCLAT_Executable));
|
||||
}
|
||||
else
|
||||
@@ -90,7 +90,7 @@ CCmdLine::CCmdLine(const char* commandLine)
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter += string(" ") + arg;
|
||||
parameter += AZStd::string(" ") + arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ const ICmdLineArg* CCmdLine::FindArg(const ECmdLineArgType ArgType, const char*
|
||||
}
|
||||
|
||||
|
||||
string CCmdLine::Next(char*& src)
|
||||
AZStd::string CCmdLine::Next(char*& src)
|
||||
{
|
||||
char ch = 0;
|
||||
char* org = src;
|
||||
@@ -170,7 +170,7 @@ string CCmdLine::Next(char*& src)
|
||||
;
|
||||
}
|
||||
|
||||
return string(org, src - 1);
|
||||
return AZStd::string(org, src - 1);
|
||||
|
||||
case '[':
|
||||
org = src;
|
||||
@@ -178,7 +178,7 @@ string CCmdLine::Next(char*& src)
|
||||
{
|
||||
;
|
||||
}
|
||||
return string(org, src - 1);
|
||||
return AZStd::string(org, src - 1);
|
||||
|
||||
case ' ':
|
||||
ch = *src++;
|
||||
@@ -190,12 +190,12 @@ string CCmdLine::Next(char*& src)
|
||||
;
|
||||
}
|
||||
|
||||
return string(org, src);
|
||||
return AZStd::string(org, src);
|
||||
}
|
||||
ch = *src++;
|
||||
}
|
||||
|
||||
return string();
|
||||
return AZStd::string();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ public:
|
||||
virtual const ICmdLineArg* GetArg(int n) const;
|
||||
virtual int GetArgCount() const;
|
||||
virtual const ICmdLineArg* FindArg(const ECmdLineArgType ArgType, const char* name, bool caseSensitive = false) const;
|
||||
virtual const char* GetCommandLine() const { return m_sCmdLine; };
|
||||
virtual const char* GetCommandLine() const { return m_sCmdLine.c_str(); };
|
||||
|
||||
private:
|
||||
void PushCommand(const string& sCommand, const string& sParameter);
|
||||
string Next(char*& str);
|
||||
void PushCommand(const AZStd::string& sCommand, const AZStd::string& sParameter);
|
||||
AZStd::string Next(char*& str);
|
||||
|
||||
string m_sCmdLine;
|
||||
AZStd::string m_sCmdLine;
|
||||
std::vector<CCmdLineArg> m_args;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
private:
|
||||
|
||||
ECmdLineArgType m_type;
|
||||
string m_name;
|
||||
string m_value;
|
||||
AZStd::string m_name;
|
||||
AZStd::string m_value;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_CMDLINEARG_H
|
||||
|
||||
@@ -57,7 +57,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
|
||||
Init();
|
||||
}
|
||||
|
||||
string filename;
|
||||
AZStd::string filename;
|
||||
|
||||
if (sFilename[0] != '@') // console config files are actually by default in @root@ instead of @assets@
|
||||
{
|
||||
@@ -78,7 +78,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
|
||||
filename = sFilename;
|
||||
}
|
||||
|
||||
if (strlen(PathUtil::GetExt(filename)) == 0)
|
||||
if (strlen(PathUtil::GetExt(filename.c_str())) == 0)
|
||||
{
|
||||
filename = PathUtil::ReplaceExtension(filename, "cfg");
|
||||
}
|
||||
@@ -88,20 +88,20 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
|
||||
|
||||
{
|
||||
const char* szLog = "Executing console batch file (try game,config,root):";
|
||||
string filenameLog;
|
||||
string sfn = PathUtil::GetFile(filename);
|
||||
AZStd::string filenameLog;
|
||||
AZStd::string sfn = PathUtil::GetFile(filename);
|
||||
|
||||
if (file.Open(filename, "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
|
||||
if (file.Open(filename.c_str(), "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
|
||||
{
|
||||
filenameLog = string("game/") + sfn;
|
||||
filenameLog = AZStd::string("game/") + sfn;
|
||||
}
|
||||
else if (file.Open(string("config/") + sfn, "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
|
||||
else if (file.Open((AZStd::string("config/") + sfn).c_str(), "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
|
||||
{
|
||||
filenameLog = string("game/config/") + sfn;
|
||||
filenameLog = AZStd::string("game/config/") + sfn;
|
||||
}
|
||||
else if (file.Open(string("./") + sfn, "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
|
||||
else if (file.Open((AZStd::string("./") + sfn).c_str(), "rb", AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK))
|
||||
{
|
||||
filenameLog = string("./") + sfn;
|
||||
filenameLog = AZStd::string("./") + sfn;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,11 +142,11 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
|
||||
str++;
|
||||
}
|
||||
|
||||
string strLine = s;
|
||||
AZStd::string strLine = s;
|
||||
|
||||
|
||||
//trim all whitespace characters at the beginning and the end of the current line and store its size
|
||||
strLine.Trim();
|
||||
AZ::StringFunc::TrimWhiteSpace(strLine, true, true);
|
||||
size_t strLineSize = strLine.size();
|
||||
|
||||
//skip comments, comments start with ";" or "--" but may have preceding whitespace characters
|
||||
@@ -168,7 +168,7 @@ bool CConsoleBatchFile::ExecuteConfigFile(const char* sFilename)
|
||||
}
|
||||
|
||||
{
|
||||
m_pConsole->ExecuteString(strLine);
|
||||
m_pConsole->ExecuteString(strLine.c_str());
|
||||
}
|
||||
}
|
||||
// See above
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
|
||||
#include "CrySystem_precompiled.h"
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
|
||||
#include "ConsoleHelpGen.h"
|
||||
#include "System.h"
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
|
||||
|
||||
// remove bad characters, toupper, not very fast
|
||||
string CConsoleHelpGen::FixAnchorName(const char* szName)
|
||||
AZStd::string CConsoleHelpGen::FixAnchorName(const char* szName)
|
||||
{
|
||||
string ret;
|
||||
AZStd::string ret;
|
||||
|
||||
const char* p = szName;
|
||||
|
||||
@@ -45,9 +45,9 @@ string CConsoleHelpGen::FixAnchorName(const char* szName)
|
||||
return ret;
|
||||
}
|
||||
|
||||
string CConsoleHelpGen::GetCleanPrefix(const char* p)
|
||||
AZStd::string CConsoleHelpGen::GetCleanPrefix(const char* p)
|
||||
{
|
||||
string sRet;
|
||||
AZStd::string sRet;
|
||||
|
||||
while (*p != '_' && *p != 0)
|
||||
{
|
||||
@@ -58,9 +58,9 @@ string CConsoleHelpGen::GetCleanPrefix(const char* p)
|
||||
}
|
||||
|
||||
|
||||
string CConsoleHelpGen::SplitPrefixString_Part1(const char* p)
|
||||
AZStd::string CConsoleHelpGen::SplitPrefixString_Part1(const char* p)
|
||||
{
|
||||
string sRet;
|
||||
AZStd::string sRet;
|
||||
|
||||
while (*p != 10 && *p != 13 && *p != 0)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ void CConsoleHelpGen::LogVersion(FILE* f) const
|
||||
char s[1024];
|
||||
|
||||
{
|
||||
GetModuleFileName(NULL, s, sizeof(s));
|
||||
AZ::Utils::GetExecutablePath(s, 1024);
|
||||
|
||||
char fdir[_MAX_PATH];
|
||||
char fdrive[_MAX_PATH];
|
||||
@@ -140,7 +140,7 @@ void CConsoleHelpGen::LogVersion(FILE* f) const
|
||||
char fext[_MAX_PATH];
|
||||
_splitpath_s(s, fdrive, fdir, file, fext);
|
||||
|
||||
KeyValue(f, "Executable", (string(file) + fext).c_str());
|
||||
KeyValue(f, "Executable", (AZStd::string(file) + fext).c_str());
|
||||
}
|
||||
|
||||
{
|
||||
@@ -273,11 +273,11 @@ void CConsoleHelpGen::SingleLinePrefix(FILE* f, const char* szPrefix, const char
|
||||
}
|
||||
else if (m_eWorkMode == eWM_Confluence)
|
||||
{
|
||||
string sPrefix;
|
||||
AZStd::string sPrefix;
|
||||
|
||||
if (*szPrefix)
|
||||
{
|
||||
sPrefix = string(szPrefix) + "_";
|
||||
sPrefix = AZStd::string(szPrefix) + "_";
|
||||
}
|
||||
|
||||
// fprintf(f,"| %s | [%s|%s] |\n",sPrefix.c_str(),szPrefixDesc,szLink); // e.g. "" "CL_" "CC_" "I_" "T_"
|
||||
@@ -406,7 +406,7 @@ void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_
|
||||
{
|
||||
const CConsoleCommand& cmd = itrCmd->second;
|
||||
|
||||
if (_strnicmp(cmd.m_sName, szLocalPrefix, strlen(szLocalPrefix)) == 0)
|
||||
if (_strnicmp(cmd.m_sName.c_str(), szLocalPrefix, strlen(szLocalPrefix)) == 0)
|
||||
{
|
||||
setCmdAndVars.insert(cmd.m_sName.c_str());
|
||||
}
|
||||
@@ -415,7 +415,7 @@ void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_
|
||||
|
||||
|
||||
|
||||
void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const
|
||||
void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const
|
||||
{
|
||||
CXConsole::ConsoleVariablesMap::const_iterator itrVar, itrVarEnd = m_rParent.m_mapVariables.end();
|
||||
|
||||
@@ -425,11 +425,11 @@ void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>&
|
||||
bool bInsert = true;
|
||||
|
||||
{
|
||||
std::map<string, const char*>::const_iterator it2, end = mapPrefix.end();
|
||||
std::map<AZStd::string, const char*>::const_iterator it2, end = mapPrefix.end();
|
||||
|
||||
for (it2 = mapPrefix.begin(); it2 != end; ++it2)
|
||||
{
|
||||
if (it2->first != "___" && _strnicmp(var->GetName(), it2->first, it2->first.size()) == 0)
|
||||
if (it2->first != "___" && _strnicmp(var->GetName(), it2->first.c_str(), it2->first.size()) == 0)
|
||||
{
|
||||
bInsert = false;
|
||||
break;
|
||||
@@ -446,7 +446,7 @@ void CConsoleHelpGen::InsertConsoleVars(std::set<const char*, string_nocase_lt>&
|
||||
|
||||
|
||||
|
||||
void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const
|
||||
void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const
|
||||
{
|
||||
CXConsole::ConsoleCommandsMap::const_iterator itrCmd, itrCmdEnd = m_rParent.m_mapCommands.end();
|
||||
|
||||
@@ -456,11 +456,11 @@ void CConsoleHelpGen::InsertConsoleCommands(std::set<const char*, string_nocase_
|
||||
bool bInsert = true;
|
||||
|
||||
{
|
||||
std::map<string, const char*>::const_iterator it2, end = mapPrefix.end();
|
||||
std::map<AZStd::string, const char*>::const_iterator it2, end = mapPrefix.end();
|
||||
|
||||
for (it2 = mapPrefix.begin(); it2 != end; ++it2)
|
||||
{
|
||||
if (it2->first != "___" && _strnicmp(cmd.m_sName, it2->first, it2->first.size()) == 0)
|
||||
if (it2->first != "___" && _strnicmp(cmd.m_sName.c_str(), it2->first.c_str(), it2->first.size()) == 0)
|
||||
{
|
||||
bInsert = false;
|
||||
break;
|
||||
@@ -480,7 +480,7 @@ void CConsoleHelpGen::CreateSingleEntryFile(const char* szName) const
|
||||
assert(m_eWorkMode == eWM_Confluence); // only needed for confluence
|
||||
|
||||
FILE* f3 = nullptr;
|
||||
azfopen(&f3, (string(GetFolderName()) + GetFileExtension() + "/" + FixAnchorName(szName)).c_str(), "w");
|
||||
azfopen(&f3, (AZStd::string(GetFolderName()) + GetFileExtension() + "/" + FixAnchorName(szName)).c_str(), "w");
|
||||
|
||||
if (!f3)
|
||||
{
|
||||
@@ -582,7 +582,7 @@ void CConsoleHelpGen::IncludeSingleEntry(FILE* f, const char* szName) const
|
||||
{
|
||||
fprintf(f, "<pre>\n");
|
||||
|
||||
string sHelp = szHelp;
|
||||
AZStd::string sHelp = szHelp;
|
||||
|
||||
// currently not required as the {noformat} is used
|
||||
// sHelp.replace("[","\\["); sHelp.replace("]","\\]");
|
||||
@@ -604,7 +604,7 @@ void CConsoleHelpGen::IncludeSingleEntry(FILE* f, const char* szName) const
|
||||
|
||||
void CConsoleHelpGen::Work()
|
||||
{
|
||||
// string sEngineFolder = string("@user@/")+GetFolderName();
|
||||
// AZStd::string sEngineFolder = AZStd::string("@user@/")+GetFolderName();
|
||||
// gEnv->pCryPak->RemoveDir(sEngineFolder.c_str()); // todo: check if that works
|
||||
// gEnv->pFileIO->CreatePath(sEngineFolder.c_str());
|
||||
|
||||
@@ -653,7 +653,7 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
{
|
||||
gEnv->pFileIO->CreatePath(GetFolderName());
|
||||
|
||||
std::map<string, const char*> mapPrefix;
|
||||
std::map<AZStd::string, const char*> mapPrefix;
|
||||
|
||||
// order here doesn't matter, after the name some help can be added (after the first return)
|
||||
mapPrefix[ "AI_"] = "Artificial Intelligence";
|
||||
@@ -701,7 +701,7 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
mapPrefix[ "___"] = "Remaining"; // key defined to get it sorted in the end
|
||||
|
||||
FILE* f1 = nullptr;
|
||||
azfopen(&f1, (string(GetFolderName()) + "/index" + GetFileExtension()).c_str(), "w");
|
||||
azfopen(&f1, (AZStd::string(GetFolderName()) + "/index" + GetFileExtension()).c_str(), "w");
|
||||
if (!f1)
|
||||
{
|
||||
return;
|
||||
@@ -729,17 +729,17 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
|
||||
// show all registered Prefix with one line
|
||||
{
|
||||
std::map<string, const char*>::const_iterator it, end = mapPrefix.end();
|
||||
std::map<AZStd::string, const char*>::const_iterator it, end = mapPrefix.end();
|
||||
|
||||
StartH3(f1, "Registered Prefixes");
|
||||
|
||||
for (it = mapPrefix.begin(); it != end; ++it)
|
||||
{
|
||||
const char* szLocalPrefix = it->first.c_str(); // can be 0 for remaining ones
|
||||
string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
|
||||
string sPrefixName = SplitPrefixString_Part1(it->second);
|
||||
AZStd::string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
|
||||
AZStd::string sPrefixName = SplitPrefixString_Part1(it->second);
|
||||
|
||||
SingleLinePrefix(f1, sCleanPrefix.c_str(), sPrefixName.c_str(), (string("CONSOLEPREFIX") + FixAnchorName(sCleanPrefix.c_str()) + GetFileExtension()).c_str());
|
||||
SingleLinePrefix(f1, sCleanPrefix.c_str(), sPrefixName.c_str(), (AZStd::string("CONSOLEPREFIX") + FixAnchorName(sCleanPrefix.c_str()) + GetFileExtension()).c_str());
|
||||
// fprintf(f1," * [[CONSOLEPREFIX%s][%s_ %s]]\n",FixAnchorName(sCleanPrefix.c_str()).c_str(),sCleanPrefix.c_str(),sPrefixName.c_str());
|
||||
}
|
||||
|
||||
@@ -750,15 +750,15 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
|
||||
|
||||
{
|
||||
std::map<string, const char*>::const_iterator it, it2, end = mapPrefix.end();
|
||||
std::map<AZStd::string, const char*>::const_iterator it, it2, end = mapPrefix.end();
|
||||
|
||||
StartH3(f1, "Console Commands and Variables Sorted by Prefix");
|
||||
|
||||
for (it = mapPrefix.begin(); it != end; ++it)
|
||||
{
|
||||
const char* szLocalPrefix = it->first.c_str(); // can be 0 for remaining ones
|
||||
string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
|
||||
string sPrefixName = SplitPrefixString_Part1(it->second);
|
||||
AZStd::string sCleanPrefix = GetCleanPrefix(szLocalPrefix);
|
||||
AZStd::string sPrefixName = SplitPrefixString_Part1(it->second);
|
||||
|
||||
std::set<const char*, string_nocase_lt> setCmdAndVars; // to get console variables and commands sorted together
|
||||
|
||||
@@ -777,11 +777,11 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
|
||||
// -------------------------------
|
||||
|
||||
string sSubName = string("CONSOLEPREFIX") + sCleanPrefix;
|
||||
AZStd::string sSubName = AZStd::string("CONSOLEPREFIX") + sCleanPrefix;
|
||||
|
||||
StartPrefix(f1, sCleanPrefix.c_str(), sPrefixName.c_str(), (sSubName + GetFileExtension()).c_str());
|
||||
|
||||
string sFileOut = string(GetFolderName()) + "/" + sSubName + GetFileExtension();
|
||||
AZStd::string sFileOut = AZStd::string(GetFolderName()) + "/" + sSubName + GetFileExtension();
|
||||
FILE* f2 = nullptr;
|
||||
azfopen(&f2, sFileOut.c_str(), "w");
|
||||
if (!f2)
|
||||
@@ -792,7 +792,7 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
|
||||
// headline
|
||||
{
|
||||
string sHeadline;
|
||||
AZStd::string sHeadline;
|
||||
|
||||
if (sCleanPrefix.empty())
|
||||
{
|
||||
@@ -800,7 +800,7 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
}
|
||||
else
|
||||
{
|
||||
sHeadline = string("Console Commands and Variables with Prefix ") + sCleanPrefix + "_";
|
||||
sHeadline = AZStd::string("Console Commands and Variables with Prefix ") + sCleanPrefix + "_";
|
||||
}
|
||||
|
||||
StartH1(f2, sHeadline.c_str());
|
||||
@@ -821,7 +821,7 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
for (itI = setCmdAndVars.begin(); itI != endI; ++itI)
|
||||
{
|
||||
SingleLineEntry_InGlobal(f1, *itI, (sSubName + GetFileExtension() + "#Anchor" + FixAnchorName(*itI)).c_str());
|
||||
SingleLineEntry_InGroup(f2, *itI, (string("#Anchor") + FixAnchorName(*itI)).c_str());
|
||||
SingleLineEntry_InGroup(f2, *itI, (AZStd::string("#Anchor") + FixAnchorName(*itI)).c_str());
|
||||
}
|
||||
|
||||
EndH3(f2);
|
||||
@@ -842,7 +842,7 @@ void CConsoleHelpGen::CreateMainPages()
|
||||
}
|
||||
bFirst = false;
|
||||
|
||||
Anchor(f2, (string("Anchor") + FixAnchorName(*itI)).c_str()); // anchor
|
||||
Anchor(f2, (AZStd::string("Anchor") + FixAnchorName(*itI)).c_str()); // anchor
|
||||
|
||||
IncludeSingleEntry(f2, *itI);
|
||||
}
|
||||
|
||||
@@ -59,19 +59,19 @@ private: // --------------------------------------------------------
|
||||
// insert if the name starts with the with prefix
|
||||
void InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, const char* szPrefix) const;
|
||||
// insert if the name does not start with any of the prefix in the map
|
||||
void InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const;
|
||||
void InsertConsoleVars(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const;
|
||||
// insert if the name does not start with any of the prefix in the map
|
||||
void InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<string, const char*> mapPrefix) const;
|
||||
void InsertConsoleCommands(std::set<const char*, string_nocase_lt>& setCmdAndVars, std::map<AZStd::string, const char*> mapPrefix) const;
|
||||
|
||||
// a single file for the entry is generate
|
||||
void CreateSingleEntryFile(const char* szName) const;
|
||||
|
||||
void IncludeSingleEntry(FILE* f, const char* szName) const;
|
||||
|
||||
static string FixAnchorName(const char* szName);
|
||||
static string GetCleanPrefix(const char* p);
|
||||
static AZStd::string FixAnchorName(const char* szName);
|
||||
static AZStd::string GetCleanPrefix(const char* p);
|
||||
// split before "|" (to get the prefix itself)
|
||||
static string SplitPrefixString_Part1(const char* p);
|
||||
static AZStd::string SplitPrefixString_Part1(const char* p);
|
||||
// split string after "|" (to get the optional help)
|
||||
static const char* SplitPrefixString_Part2(const char* p);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <CryWindows.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <tlhelp32.h>
|
||||
#undef GetCharWidth
|
||||
#undef GetUserName
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <AzCore/Debug/StackTracer.h>
|
||||
#include <AzCore/Debug/EventTraceDrillerBus.h>
|
||||
#include <AzCore/std/parallel/spin_mutex.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#define VS_VERSION_INFO 1
|
||||
#define IDD_CRITICAL_ERROR 101
|
||||
@@ -349,7 +350,7 @@ void DebugCallStack::ReportBug(const char* szErrorMessage)
|
||||
m_szBugMessage = NULL;
|
||||
}
|
||||
|
||||
void DebugCallStack::dumpCallStack(std::vector<string>& funcs)
|
||||
void DebugCallStack::dumpCallStack(std::vector<AZStd::string>& funcs)
|
||||
{
|
||||
WriteLineToLog("=============================================================================");
|
||||
int len = (int)funcs.size();
|
||||
@@ -365,7 +366,7 @@ void DebugCallStack::dumpCallStack(std::vector<string>& funcs)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
{
|
||||
string path("");
|
||||
AZStd::string path("");
|
||||
if ((gEnv) && (gEnv->pFileIO))
|
||||
{
|
||||
const char* logAlias = gEnv->pFileIO->GetAlias("@log@");
|
||||
@@ -380,12 +381,12 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
}
|
||||
}
|
||||
|
||||
string fileName = path;
|
||||
AZStd::string fileName = path;
|
||||
fileName += "error.log";
|
||||
|
||||
struct stat fileInfo;
|
||||
string timeStamp;
|
||||
string backupPath;
|
||||
AZStd::string timeStamp;
|
||||
AZStd::string backupPath;
|
||||
if (gEnv->IsDedicated())
|
||||
{
|
||||
backupPath = PathUtil::ToUnixPath(PathUtil::AddSlash(path + "DumpBackups"));
|
||||
@@ -400,8 +401,12 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
strftime(tempBuffer, sizeof(tempBuffer), "%d %b %Y (%H %M %S)", &creationTime);
|
||||
timeStamp = tempBuffer;
|
||||
|
||||
string backupFileName = backupPath + timeStamp + " error.log";
|
||||
CopyFile(fileName.c_str(), backupFileName.c_str(), true);
|
||||
AZStd::string backupFileName = backupPath + timeStamp + " error.log";
|
||||
AZStd::wstring fileNameW;
|
||||
AZStd::to_wstring(fileNameW, fileName.c_str());
|
||||
AZStd::wstring backupFileNameW;
|
||||
AZStd::to_wstring(backupFileNameW, backupFileName.c_str());
|
||||
CopyFileW(fileNameW.c_str(), backupFileNameW.c_str(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,8 +420,8 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
char versionbuf[1024];
|
||||
azstrcpy(versionbuf, AZ_ARRAY_SIZE(versionbuf), "");
|
||||
PutVersion(versionbuf, AZ_ARRAY_SIZE(versionbuf));
|
||||
cry_strcat(errorString, versionbuf);
|
||||
cry_strcat(errorString, "\n");
|
||||
azstrcat(errorString, AZ_ARRAY_SIZE(errorString), versionbuf);
|
||||
azstrcat(errorString, AZ_ARRAY_SIZE(errorString), "\n");
|
||||
|
||||
char excCode[MAX_WARNING_LENGTH];
|
||||
char excAddr[80];
|
||||
@@ -431,18 +436,18 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
{
|
||||
const char* const szMessage = m_bIsFatalError ? s_szFatalErrorCode : m_szBugMessage;
|
||||
excName = szMessage;
|
||||
cry_strcpy(excCode, szMessage);
|
||||
cry_strcpy(excAddr, "");
|
||||
cry_strcpy(desc, "");
|
||||
cry_strcpy(m_excModule, "");
|
||||
cry_strcpy(excDesc, szMessage);
|
||||
azstrcpy(excCode, AZ_ARRAY_SIZE(excCode), szMessage);
|
||||
azstrcpy(excAddr, AZ_ARRAY_SIZE(excAddr), "");
|
||||
azstrcpy(desc, AZ_ARRAY_SIZE(desc), "");
|
||||
azstrcpy(m_excModule, AZ_ARRAY_SIZE(m_excModule), "");
|
||||
azstrcpy(excDesc, AZ_ARRAY_SIZE(excDesc), szMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf_s(excAddr, "0x%04X:0x%p", pex->ContextRecord->SegCs, pex->ExceptionRecord->ExceptionAddress);
|
||||
sprintf_s(excCode, "0x%08X", pex->ExceptionRecord->ExceptionCode);
|
||||
excName = TranslateExceptionCode(pex->ExceptionRecord->ExceptionCode);
|
||||
cry_strcpy(desc, "");
|
||||
azstrcpy(desc, AZ_ARRAY_SIZE(desc), "");
|
||||
sprintf_s(excDesc, "%s\r\n%s", excName, desc);
|
||||
|
||||
|
||||
@@ -472,9 +477,9 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
WriteLineToLog("Exception Description: %s", desc);
|
||||
|
||||
|
||||
cry_strcpy(m_excDesc, excDesc);
|
||||
cry_strcpy(m_excAddr, excAddr);
|
||||
cry_strcpy(m_excCode, excCode);
|
||||
azstrcpy(m_excDesc, AZ_ARRAY_SIZE(m_excDesc), excDesc);
|
||||
azstrcpy(m_excAddr, AZ_ARRAY_SIZE(m_excAddr), excAddr);
|
||||
azstrcpy(m_excCode, AZ_ARRAY_SIZE(m_excCode), excCode);
|
||||
|
||||
|
||||
char errs[32768];
|
||||
@@ -482,9 +487,9 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
excCode, excAddr, m_excModule, excName, desc);
|
||||
|
||||
|
||||
cry_strcat(errs, "\nCall Stack Trace:\n");
|
||||
azstrcat(errs, AZ_ARRAY_SIZE(errs), "\nCall Stack Trace:\n");
|
||||
|
||||
std::vector<string> funcs;
|
||||
std::vector<AZStd::string> funcs;
|
||||
{
|
||||
AZ::Debug::StackFrame frames[25];
|
||||
AZ::Debug::SymbolStorage::StackLine lines[AZ_ARRAY_SIZE(frames)];
|
||||
@@ -500,20 +505,20 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
dumpCallStack(funcs);
|
||||
// Fill call stack.
|
||||
char str[s_iCallStackSize];
|
||||
cry_strcpy(str, "");
|
||||
azstrcpy(str, AZ_ARRAY_SIZE(str), "");
|
||||
for (unsigned int i = 0; i < funcs.size(); i++)
|
||||
{
|
||||
char temp[s_iCallStackSize];
|
||||
sprintf_s(temp, "%2zd) %s", funcs.size() - i, (const char*)funcs[i].c_str());
|
||||
cry_strcat(str, temp);
|
||||
cry_strcat(str, "\r\n");
|
||||
cry_strcat(errs, temp);
|
||||
cry_strcat(errs, "\n");
|
||||
azstrcat(str, AZ_ARRAY_SIZE(str), temp);
|
||||
azstrcat(str, AZ_ARRAY_SIZE(str), "\r\n");
|
||||
azstrcat(errs, AZ_ARRAY_SIZE(errs), temp);
|
||||
azstrcat(errs, AZ_ARRAY_SIZE(errs), "\n");
|
||||
}
|
||||
cry_strcpy(m_excCallstack, str);
|
||||
azstrcpy(m_excCallstack, AZ_ARRAY_SIZE(m_excCallstack), str);
|
||||
}
|
||||
|
||||
cry_strcat(errorString, errs);
|
||||
azstrcat(errorString, AZ_ARRAY_SIZE(errorString), errs);
|
||||
|
||||
if (f)
|
||||
{
|
||||
@@ -594,8 +599,12 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
timeStamp = tempBuffer;
|
||||
}
|
||||
|
||||
string backupFileName = backupPath + timeStamp + " error.dmp";
|
||||
CopyFile(fileName.c_str(), backupFileName.c_str(), true);
|
||||
AZStd::string backupFileName = backupPath + timeStamp + " error.dmp";
|
||||
AZStd::wstring fileNameW;
|
||||
AZStd::to_wstring(fileNameW, fileName.c_str());
|
||||
AZStd::wstring backupFileNameW;
|
||||
AZStd::to_wstring(backupFileNameW, backupFileName.c_str());
|
||||
CopyFileW(fileNameW.c_str(), backupFileNameW.c_str(), true);
|
||||
}
|
||||
|
||||
CryEngineExceptionFilterMiniDump(pex, fileName.c_str(), mdumpValue);
|
||||
@@ -636,11 +645,11 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
|
||||
{
|
||||
if (SaveCurrentLevel())
|
||||
{
|
||||
MessageBox(NULL, "Level has been successfully saved!\r\nPress Ok to terminate Editor.", "Save", MB_OK);
|
||||
MessageBoxW(NULL, L"Level has been successfully saved!\r\nPress Ok to terminate Editor.", L"Save", MB_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, "Error saving level.\r\nPress Ok to terminate Editor.", "Save", MB_OK | MB_ICONWARNING);
|
||||
MessageBoxW(NULL, L"Error saving level.\r\nPress Ok to terminate Editor.", L"Save", MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -819,7 +828,7 @@ void DebugCallStack::ResetFPU(EXCEPTION_POINTERS* pex)
|
||||
}
|
||||
}
|
||||
|
||||
string DebugCallStack::GetModuleNameForAddr(void* addr)
|
||||
AZStd::string DebugCallStack::GetModuleNameForAddr(void* addr)
|
||||
{
|
||||
if (m_modules.empty())
|
||||
{
|
||||
@@ -845,7 +854,7 @@ string DebugCallStack::GetModuleNameForAddr(void* addr)
|
||||
return m_modules.rbegin()->second;
|
||||
}
|
||||
|
||||
void DebugCallStack::GetProcNameForAddr(void* addr, string& procName, void*& baseAddr, string& filename, int& line)
|
||||
void DebugCallStack::GetProcNameForAddr(void* addr, AZStd::string& procName, void*& baseAddr, AZStd::string& filename, int& line)
|
||||
{
|
||||
AZ::Debug::SymbolStorage::StackLine func, file, module;
|
||||
AZ::Debug::SymbolStorage::FindFunctionFromIP(addr, &func, &file, &module, line, baseAddr);
|
||||
@@ -853,10 +862,10 @@ void DebugCallStack::GetProcNameForAddr(void* addr, string& procName, void*& bas
|
||||
filename = file;
|
||||
}
|
||||
|
||||
string DebugCallStack::GetCurrentFilename()
|
||||
AZStd::string DebugCallStack::GetCurrentFilename()
|
||||
{
|
||||
char fullpath[MAX_PATH_LENGTH + 1];
|
||||
GetModuleFileName(NULL, fullpath, MAX_PATH_LENGTH);
|
||||
AZ::Utils::GetExecutablePath(fullpath, MAX_PATH_LENGTH);
|
||||
return fullpath;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,20 +35,20 @@ public:
|
||||
|
||||
ISystem* GetSystem() { return m_pSystem; };
|
||||
|
||||
virtual string GetModuleNameForAddr(void* addr);
|
||||
virtual void GetProcNameForAddr(void* addr, string& procName, void*& baseAddr, string& filename, int& line);
|
||||
virtual string GetCurrentFilename();
|
||||
virtual AZStd::string GetModuleNameForAddr(void* addr);
|
||||
virtual void GetProcNameForAddr(void* addr, AZStd::string& procName, void*& baseAddr, AZStd::string& filename, int& line);
|
||||
virtual AZStd::string GetCurrentFilename();
|
||||
|
||||
void installErrorHandler(ISystem* pSystem);
|
||||
virtual int handleException(EXCEPTION_POINTERS* exception_pointer);
|
||||
|
||||
virtual void ReportBug(const char*);
|
||||
|
||||
void dumpCallStack(std::vector<string>& functions);
|
||||
void dumpCallStack(std::vector<AZStd::string>& functions);
|
||||
|
||||
void SetUserDialogEnable(const bool bUserDialogEnable);
|
||||
|
||||
typedef std::map<void*, string> TModules;
|
||||
typedef std::map<void*, AZStd::string> TModules;
|
||||
protected:
|
||||
static void RemoveOldFiles();
|
||||
static void RemoveFile(const char* szFileName);
|
||||
|
||||
@@ -187,7 +187,7 @@ AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option")
|
||||
azstrcat(str, length, "\n");
|
||||
|
||||
#if AZ_LEGACY_CRYSYSTEM_TRAIT_DEBUGCALLSTACK_APPEND_MODULENAME
|
||||
GetModuleFileNameA(NULL, s, sizeof(s));
|
||||
AZ::Utils::GetExecutablePath(s, sizeof(s));
|
||||
|
||||
// Log EXE filename only if possible (not full EXE path which could contain sensitive info)
|
||||
AZStd::string exeName;
|
||||
@@ -227,7 +227,7 @@ void IDebugCallStack::FatalError(const char* description)
|
||||
|
||||
#if defined(WIN32) || !defined(_RELEASE)
|
||||
int* p = 0x0;
|
||||
PREFAST_SUPPRESS_WARNING(6011) * p = 1; // we're intentionally crashing here
|
||||
*p = 1; // we're intentionally crashing here
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ void IDebugCallStack::WriteLineToLog(const char* format, ...)
|
||||
char szBuffer[MAX_WARNING_LENGTH];
|
||||
va_start(ArgList, format);
|
||||
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, format, ArgList);
|
||||
cry_strcat(szBuffer, "\n");
|
||||
azstrcat(szBuffer, MAX_WARNING_LENGTH, "\n");
|
||||
szBuffer[sizeof(szBuffer) - 1] = '\0';
|
||||
va_end(ArgList);
|
||||
|
||||
|
||||
@@ -33,23 +33,19 @@ public:
|
||||
virtual int handleException([[maybe_unused]] EXCEPTION_POINTERS* exception_pointer){return 0; }
|
||||
|
||||
// returns the module name of a given address
|
||||
virtual string GetModuleNameForAddr([[maybe_unused]] void* addr) { return "[unknown]"; }
|
||||
virtual AZStd::string GetModuleNameForAddr([[maybe_unused]] void* addr) { return "[unknown]"; }
|
||||
|
||||
// returns the function name of a given address together with source file and line number (if available) of a given address
|
||||
virtual void GetProcNameForAddr(void* addr, string& procName, void*& baseAddr, string& filename, int& line)
|
||||
virtual void GetProcNameForAddr(void* addr, AZStd::string& procName, void*& baseAddr, AZStd::string& filename, int& line)
|
||||
{
|
||||
filename = "[unknown]";
|
||||
line = 0;
|
||||
baseAddr = addr;
|
||||
#if defined(PLATFORM_64BIT)
|
||||
procName.Format("[%016llX]", addr);
|
||||
#else
|
||||
procName.Format("[%08X]", addr);
|
||||
#endif
|
||||
procName = AZStd::string::format("[%p]", addr);
|
||||
}
|
||||
|
||||
// returns current filename
|
||||
virtual string GetCurrentFilename() { return "[unknown]"; }
|
||||
virtual AZStd::string GetCurrentFilename() { return "[unknown]"; }
|
||||
|
||||
//! Dumps Current Call Stack to log.
|
||||
virtual void LogCallstack();
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
|
||||
#include <AzCore/Script/ScriptSystemBus.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <CryWindows.h>
|
||||
#endif
|
||||
|
||||
namespace LegacyLevelSystem
|
||||
{
|
||||
static constexpr const char* ArchiveExtension = ".pak";
|
||||
@@ -480,7 +476,7 @@ CLevelInfo* CLevelSystem::GetLevelInfoInternal(const AZStd::string& levelName)
|
||||
for (AZStd::vector<CLevelInfo>::iterator it = m_levelInfos.begin(); it != m_levelInfos.end(); ++it)
|
||||
{
|
||||
{
|
||||
if (!azstricmp(PathUtil::GetFileName(it->GetName()), levelName.c_str()))
|
||||
if (!azstricmp(PathUtil::GetFileName(it->GetName()).c_str(), levelName.c_str()))
|
||||
{
|
||||
return &(*it);
|
||||
}
|
||||
@@ -567,7 +563,7 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName)
|
||||
INDENT_LOG_DURING_SCOPE();
|
||||
|
||||
char levelName[256];
|
||||
cry_strcpy(levelName, _levelName);
|
||||
azstrcpy(levelName, AZ_ARRAY_SIZE(levelName), _levelName);
|
||||
|
||||
// Not remove a scope!!!
|
||||
{
|
||||
@@ -618,12 +614,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName)
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the camera to (1,1,1) (not (0,0,0) which is the invalid/uninitialised state,
|
||||
// to avoid the hack in the renderer to not show anything if the camera is at the origin).
|
||||
CCamera defaultCam;
|
||||
defaultCam.SetPosition(Vec3(1.0f));
|
||||
m_pSystem->SetViewCamera(defaultCam);
|
||||
|
||||
m_pLoadingLevelInfo = pLevelInfo;
|
||||
OnLoadingStart(levelName);
|
||||
|
||||
@@ -952,10 +942,6 @@ void CLevelSystem::UnloadLevel()
|
||||
oAudioRequestData.pData = &oAMData3;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
|
||||
// Reset the camera to (0,0,0) which is the invalid/uninitialised state
|
||||
CCamera defaultCam;
|
||||
m_pSystem->SetViewCamera(defaultCam);
|
||||
|
||||
OnUnloadComplete(m_lastLevelName.c_str());
|
||||
|
||||
// -- kenzo: this will close all pack files for this level
|
||||
|
||||
@@ -268,12 +268,6 @@ namespace LegacyLevelSystem
|
||||
// This is a workaround until the replacement for GameEntityContext is done
|
||||
AzFramework::GameEntityContextEventBus::Broadcast(&AzFramework::GameEntityContextEventBus::Events::OnPreGameEntitiesStarted);
|
||||
|
||||
// Reset the camera to (1,1,1) (not (0,0,0) which is the invalid/uninitialised state,
|
||||
// to avoid the hack in the renderer to not show anything if the camera is at the origin).
|
||||
CCamera defaultCam;
|
||||
defaultCam.SetPosition(Vec3(1.0f));
|
||||
m_pSystem->SetViewCamera(defaultCam);
|
||||
|
||||
OnLoadingStart(levelName);
|
||||
|
||||
auto pPak = gEnv->pCryPak;
|
||||
@@ -587,10 +581,6 @@ namespace LegacyLevelSystem
|
||||
oAudioRequestData.pData = &oAMData3;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
|
||||
// Reset the camera to (0,0,0) which is the invalid/uninitialised state
|
||||
CCamera defaultCam;
|
||||
m_pSystem->SetViewCamera(defaultCam);
|
||||
|
||||
OnUnloadComplete(m_lastLevelName.c_str());
|
||||
|
||||
AzFramework::RootSpawnableInterface::Get()->ReleaseRootSpawnable();
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
#include "System.h" // to access InitLocalization()
|
||||
#include <CryPath.h>
|
||||
#include <IConsole.h>
|
||||
#include <StringUtils.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
#define MAX_CELL_COUNT 32
|
||||
|
||||
@@ -146,9 +146,9 @@ static void ReloadDialogData([[maybe_unused]] IConsoleCmdArgs* pArgs)
|
||||
#if !defined(_RELEASE)
|
||||
static void TestFormatMessage ([[maybe_unused]] IConsoleCmdArgs* pArgs)
|
||||
{
|
||||
string fmt1 ("abc %1 def % gh%2i %");
|
||||
string fmt2 ("abc %[action:abc] %2 def % gh%1i %1");
|
||||
string out1, out2;
|
||||
AZStd::string fmt1 ("abc %1 def % gh%2i %");
|
||||
AZStd::string fmt2 ("abc %[action:abc] %2 def % gh%1i %1");
|
||||
AZStd::string out1, out2;
|
||||
LocalizationManagerRequestBus::Broadcast(&LocalizationManagerRequestBus::Events::FormatStringMessage, out1, fmt1, "first", "second", "third", nullptr);
|
||||
CryLogAlways("%s", out1.c_str());
|
||||
LocalizationManagerRequestBus::Broadcast(&LocalizationManagerRequestBus::Events::FormatStringMessage, out2, fmt2, "second", nullptr, nullptr, nullptr);
|
||||
@@ -206,18 +206,18 @@ CLocalizedStringsManager::CLocalizedStringsManager(ISystem* pSystem)
|
||||
|
||||
// Populate available languages by scanning the localization directory for paks
|
||||
// Default to US English if language is not supported
|
||||
string sPath;
|
||||
const string sLocalizationFolder(PathUtil::GetLocalizationFolder());
|
||||
AZStd::string sPath;
|
||||
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
|
||||
ILocalizationManager::TLocalizationBitfield availableLanguages = 0;
|
||||
|
||||
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
// test language name against supported languages
|
||||
for (int i = 0; i < ILocalizationManager::ePILID_MAX_OR_INVALID; i++)
|
||||
{
|
||||
string sCurrentLanguage = LangNameFromPILID((ILocalizationManager::EPlatformIndependentLanguageID)i);
|
||||
AZStd::string sCurrentLanguage = LangNameFromPILID((ILocalizationManager::EPlatformIndependentLanguageID)i);
|
||||
sPath = sLocalizationFolder.c_str() + sCurrentLanguage;
|
||||
sPath.MakeLower();
|
||||
if (fileIO && fileIO->IsDirectory(sPath))
|
||||
AZStd::to_lower(sPath.begin(), sPath.end());
|
||||
if (fileIO && fileIO->IsDirectory(sPath.c_str()))
|
||||
{
|
||||
availableLanguages |= ILocalizationManager::LocalizationBitfieldFromPILID((ILocalizationManager::EPlatformIndependentLanguageID)i);
|
||||
if (m_cvarLocalizationDebug >= 2)
|
||||
@@ -366,7 +366,7 @@ bool CLocalizedStringsManager::SetLanguage(const char* sLanguage)
|
||||
// Check if already language loaded.
|
||||
for (uint32 i = 0; i < m_languages.size(); i++)
|
||||
{
|
||||
if (_stricmp(sLanguage, m_languages[i]->sLanguage) == 0)
|
||||
if (_stricmp(sLanguage, m_languages[i]->sLanguage.c_str()) == 0)
|
||||
{
|
||||
InternalSetCurrentLanguage(m_languages[i]);
|
||||
return true;
|
||||
@@ -441,9 +441,9 @@ void CLocalizedStringsManager::AddControl([[maybe_unused]] int nKey)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, string>& SoundMoodIndex, std::map<int, string>& EventParameterIndex)
|
||||
void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, AZStd::string>& SoundMoodIndex, std::map<int, AZStd::string>& EventParameterIndex)
|
||||
{
|
||||
string sCellContent;
|
||||
AZStd::string sCellContent;
|
||||
|
||||
for (;; )
|
||||
{
|
||||
@@ -466,7 +466,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader,
|
||||
}
|
||||
|
||||
sCellContent.assign(pContent, contentSize);
|
||||
sCellContent.MakeLower();
|
||||
AZStd::to_lower(sCellContent.begin(), sCellContent.end());
|
||||
|
||||
for (int i = 0; i < sizeof(sLocalizedColumnNames) / sizeof(sLocalizedColumnNames[0]); ++i)
|
||||
{
|
||||
@@ -528,15 +528,15 @@ static void CopyLowercase(char* dst, size_t dstSize, const char* src, size_t src
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static void ReplaceEndOfLine(CryFixedStringT<CLocalizedStringsManager::LOADING_FIXED_STRING_LENGTH>& s)
|
||||
static void ReplaceEndOfLine(AZStd::fixed_string<CLocalizedStringsManager::LOADING_FIXED_STRING_LENGTH>& s)
|
||||
{
|
||||
const string oldSubstr("\\n");
|
||||
const string newSubstr(" \n");
|
||||
const AZStd::string oldSubstr("\\n");
|
||||
const AZStd::string newSubstr(" \n");
|
||||
size_t pos = 0;
|
||||
for (;; )
|
||||
{
|
||||
pos = s.find(oldSubstr, pos);
|
||||
if (pos == CryFixedStringT<CLocalizedStringsManager::LOADING_FIXED_STRING_LENGTH>::npos)
|
||||
if (pos == AZStd::fixed_string<CLocalizedStringsManager::LOADING_FIXED_STRING_LENGTH>::npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -565,7 +565,7 @@ void CLocalizedStringsManager::OnSystemEvent(
|
||||
|
||||
for (TStringVec::iterator it = m_tagLoadRequests.begin(); it != m_tagLoadRequests.end(); ++it)
|
||||
{
|
||||
LoadLocalizationDataByTag(*it);
|
||||
LoadLocalizationDataByTag(it->c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,7 +577,7 @@ void CLocalizedStringsManager::OnSystemEvent(
|
||||
// Load all tags after the Editor has finished initialization.
|
||||
for (TTagFileNames::iterator it = m_tagFileNames.begin(); it != m_tagFileNames.end(); ++it)
|
||||
{
|
||||
LoadLocalizationDataByTag(it->first);
|
||||
LoadLocalizationDataByTag(it->first.c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -600,7 +600,7 @@ bool CLocalizedStringsManager::InitLocalizationData(
|
||||
for (int i = 0; i < root->getChildCount(); i++)
|
||||
{
|
||||
XmlNodeRef typeNode = root->getChild(i);
|
||||
string sType = typeNode->getTag();
|
||||
AZStd::string sType = typeNode->getTag();
|
||||
|
||||
// tags should be unique
|
||||
if (m_tagFileNames.find(sType) != m_tagFileNames.end())
|
||||
@@ -678,9 +678,9 @@ bool CLocalizedStringsManager::LoadLocalizationDataByTag(
|
||||
for (TStringVec::iterator it2 = vEntries.begin(); it2 != vEntries.end(); ++it2)
|
||||
{
|
||||
//Only load files of the correct type for the configured format
|
||||
if ((m_cvarLocalizationFormat == 0 && strstr(*it2, ".xml")) || (m_cvarLocalizationFormat == 1 && strstr(*it2, ".agsxml")))
|
||||
if ((m_cvarLocalizationFormat == 0 && strstr(it2->c_str(), ".xml")) || (m_cvarLocalizationFormat == 1 && strstr(it2->c_str(), ".agsxml")))
|
||||
{
|
||||
bResult &= (this->*loadFunction)(*it2, it->second.id, bReload);
|
||||
bResult &= (this->*loadFunction)(it2->c_str(), it->second.id, bReload);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ bool CLocalizedStringsManager::LoadAllLocalizationData(bool bReload)
|
||||
{
|
||||
for (TTagFileNames::iterator it = m_tagFileNames.begin(); it != m_tagFileNames.end(); ++it)
|
||||
{
|
||||
if(!LoadLocalizationDataByTag(it->first, bReload))
|
||||
if(!LoadLocalizationDataByTag(it->first.c_str(), bReload))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -837,6 +837,37 @@ bool CLocalizedStringsManager::LoadExcelXmlSpreadsheet(const char* sFileName, bo
|
||||
return (this->*loadFunction)(sFileName, 0, bReload);
|
||||
}
|
||||
|
||||
enum class YesNoType
|
||||
{
|
||||
Yes,
|
||||
No,
|
||||
Invalid
|
||||
};
|
||||
|
||||
// parse the yes/no string
|
||||
/*!
|
||||
\param szString any of the following strings: yes, enable, true, 1, no, disable, false, 0
|
||||
\return YesNoType::Yes if szString is yes/enable/true/1, YesNoType::No if szString is no, disable, false, 0 and YesNoType::Invalid if the string is not one of the expected values.
|
||||
*/
|
||||
inline YesNoType ToYesNoType(const char* szString)
|
||||
{
|
||||
if (!_stricmp(szString, "yes")
|
||||
|| !_stricmp(szString, "enable")
|
||||
|| !_stricmp(szString, "true")
|
||||
|| !_stricmp(szString, "1"))
|
||||
{
|
||||
return YesNoType::Yes;
|
||||
}
|
||||
if (!_stricmp(szString, "no")
|
||||
|| !_stricmp(szString, "disable")
|
||||
|| !_stricmp(szString, "false")
|
||||
|| !_stricmp(szString, "0"))
|
||||
{
|
||||
return YesNoType::No;
|
||||
}
|
||||
return YesNoType::Invalid;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Loads a string-table from a Excel XML Spreadsheet file.
|
||||
bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, uint8 nTagID, bool bReload)
|
||||
@@ -850,7 +881,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
//check if this table has already been loaded
|
||||
if (!bReload)
|
||||
{
|
||||
if (m_loadedTables.find(CONST_TEMP_STRING(sFileName)) != m_loadedTables.end())
|
||||
if (m_loadedTables.find(AZStd::string(sFileName)) != m_loadedTables.end())
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
@@ -866,12 +897,12 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
}
|
||||
|
||||
XmlNodeRef root;
|
||||
string sPath;
|
||||
AZStd::string sPath;
|
||||
{
|
||||
const string sLocalizationFolder(PathUtil::GetLocalizationRoot());
|
||||
const string& languageFolder = m_pLanguage->sLanguage;
|
||||
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationRoot());
|
||||
const AZStd::string& languageFolder = m_pLanguage->sLanguage;
|
||||
sPath = sLocalizationFolder.c_str() + languageFolder + PathUtil::GetSlash() + sFileName;
|
||||
root = m_pSystem->LoadXmlFromFile(sPath);
|
||||
root = m_pSystem->LoadXmlFromFile(sPath.c_str());
|
||||
if (!root)
|
||||
{
|
||||
CryLog("Loading Localization File %s failed!", sPath.c_str());
|
||||
@@ -948,14 +979,14 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
memset(nCellIndexToType, 0, sizeof(nCellIndexToType));
|
||||
|
||||
// SoundMood Index
|
||||
std::map<int, string> SoundMoodIndex;
|
||||
std::map<int, AZStd::string> SoundMoodIndex;
|
||||
|
||||
// EventParameter Index
|
||||
std::map<int, string> EventParameterIndex;
|
||||
std::map<int, AZStd::string> EventParameterIndex;
|
||||
|
||||
bool bFirstRow = true;
|
||||
|
||||
CryFixedStringT<LOADING_FIXED_STRING_LENGTH> sTmp;
|
||||
AZStd::fixed_string<LOADING_FIXED_STRING_LENGTH> sTmp;
|
||||
|
||||
// lower case event name
|
||||
char szLowerCaseEvent[128];
|
||||
@@ -1083,7 +1114,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
break;
|
||||
case ELOCALIZED_COLUMN_USE_SUBTITLE:
|
||||
sTmp.assign(cell.ptr, cell.count);
|
||||
bUseSubtitle = CryStringUtils::ToYesNoType(sTmp.c_str()) == CryStringUtils::YesNoType::No ? false : true; // favor yes (yes and invalid -> yes)
|
||||
bUseSubtitle = ToYesNoType(sTmp.c_str()) == YesNoType::No ? false : true; // favor yes (yes and invalid -> yes)
|
||||
break;
|
||||
case ELOCALIZED_COLUMN_VOLUME:
|
||||
sTmp.assign(cell.ptr, cell.count);
|
||||
@@ -1121,7 +1152,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
{
|
||||
bIsIntercepted = true;
|
||||
}
|
||||
bIsDirectRadio = bIsIntercepted || (CryStringUtils::ToYesNoType(sTmp.c_str()) == CryStringUtils::YesNoType::Yes ? true : false); // favor no (no and invalid -> no)
|
||||
bIsDirectRadio = bIsIntercepted || (ToYesNoType(sTmp.c_str()) == YesNoType::Yes ? true : false); // favor no (no and invalid -> no)
|
||||
++nItems;
|
||||
break;
|
||||
// legacy names
|
||||
@@ -1358,7 +1389,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
}
|
||||
else
|
||||
{
|
||||
pEntry->TranslatedText.psUtf8Uncompressed = new string(sTmp.c_str(), sTmp.c_str() + sTmp.length());
|
||||
pEntry->TranslatedText.psUtf8Uncompressed = new AZStd::string(sTmp.c_str(), sTmp.c_str() + sTmp.length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1367,7 +1398,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
// the CryString makes sure, that only the ref-count is increment on assignment
|
||||
if (*szLowerCaseEvent)
|
||||
{
|
||||
PrototypeSoundEvents::iterator it = m_prototypeEvents.find(CONST_TEMP_STRING(szLowerCaseEvent));
|
||||
PrototypeSoundEvents::iterator it = m_prototypeEvents.find(AZStd::string(szLowerCaseEvent));
|
||||
if (it != m_prototypeEvents.end())
|
||||
{
|
||||
pEntry->sPrototypeSoundEvent = *it;
|
||||
@@ -1384,8 +1415,8 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
{
|
||||
sTmp.assign(sWho.ptr, sWho.count);
|
||||
ReplaceEndOfLine(sTmp);
|
||||
sTmp.replace(" ", "_");
|
||||
string tmp;
|
||||
AZStd::replace(sTmp.begin(), sTmp.end(), ' ', '_');
|
||||
AZStd::string tmp;
|
||||
{
|
||||
tmp = sTmp.c_str();
|
||||
}
|
||||
@@ -1531,19 +1562,19 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
|
||||
}
|
||||
if (!bReload)
|
||||
{
|
||||
if (m_loadedTables.find(CONST_TEMP_STRING(sFileName)) != m_loadedTables.end())
|
||||
if (m_loadedTables.find(AZStd::string(sFileName)) != m_loadedTables.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ListAndClearProblemLabels();
|
||||
XmlNodeRef root;
|
||||
string sPath;
|
||||
AZStd::string sPath;
|
||||
{
|
||||
const string sLocalizationFolder(PathUtil::GetLocalizationRoot());
|
||||
const string& languageFolder = m_pLanguage->sLanguage;
|
||||
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationRoot());
|
||||
const AZStd::string& languageFolder = m_pLanguage->sLanguage;
|
||||
sPath = sLocalizationFolder.c_str() + languageFolder + PathUtil::GetSlash() + sFileName;
|
||||
root = m_pSystem->LoadXmlFromFile(sPath);
|
||||
root = m_pSystem->LoadXmlFromFile(sPath.c_str());
|
||||
if (!root)
|
||||
{
|
||||
AZ_TracePrintf(LOC_WINDOW, "Loading Localization File %s failed!", sPath.c_str());
|
||||
@@ -1609,7 +1640,7 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
|
||||
{
|
||||
continue;
|
||||
}
|
||||
AzFramework::StringFunc::Replace(textValue, "\\n", " \n"); // carried over from helper func ReplaceEndOfLine(CryFixedStringT<>& s)
|
||||
AzFramework::StringFunc::Replace(textValue, "\\n", " \n");
|
||||
if (keyString[0] == '@')
|
||||
{
|
||||
AzFramework::StringFunc::LChop(keyString, 1);
|
||||
@@ -1654,7 +1685,7 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
|
||||
}
|
||||
else
|
||||
{
|
||||
pEntry->TranslatedText.psUtf8Uncompressed = new string(textString, textString + textLength);
|
||||
pEntry->TranslatedText.psUtf8Uncompressed = new AZStd::string(textString, textString + textLength);
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -1714,7 +1745,7 @@ void CLocalizedStringsManager::ReloadData()
|
||||
FreeLocalizationData();
|
||||
for (tmapFilenames::iterator it = temp.begin(); it != temp.end(); it++)
|
||||
{
|
||||
(this->*loadFunction)((*it).first, (*it).second.nTagID, true);
|
||||
(this->*loadFunction)((*it).first.c_str(), (*it).second.nTagID, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1732,19 +1763,19 @@ void CLocalizedStringsManager::AddLocalizedString(SLanguage* pLanguage, SLocaliz
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLocalizedStringsManager::LocalizeString_ch(const char* sString, string& outLocalizedString, bool bEnglish)
|
||||
bool CLocalizedStringsManager::LocalizeString_ch(const char* sString, AZStd::string& outLocalizedString, bool bEnglish)
|
||||
{
|
||||
return LocalizeStringInternal(sString, strlen(sString), outLocalizedString, bEnglish);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLocalizedStringsManager::LocalizeString_s(const string& sString, string& outLocalizedString, bool bEnglish)
|
||||
bool CLocalizedStringsManager::LocalizeString_s(const AZStd::string& sString, AZStd::string& outLocalizedString, bool bEnglish)
|
||||
{
|
||||
return LocalizeStringInternal(sString.c_str(), sString.length(), outLocalizedString, bEnglish);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t len, string& outLocalizedString, bool bEnglish)
|
||||
bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish)
|
||||
{
|
||||
assert (m_pLanguage);
|
||||
if (m_pLanguage == 0)
|
||||
@@ -1755,7 +1786,7 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
|
||||
}
|
||||
|
||||
// note: we don't write directly to outLocalizedString, in case it aliases pStr
|
||||
string out;
|
||||
AZStd::string out;
|
||||
|
||||
// scan the string
|
||||
const char* pPos = pStr;
|
||||
@@ -1783,8 +1814,8 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
|
||||
}
|
||||
|
||||
// localize token
|
||||
string token(pLabel, pLabelEnd);
|
||||
string sLocalizedToken;
|
||||
AZStd::string token(pLabel, pLabelEnd);
|
||||
AZStd::string sLocalizedToken;
|
||||
if (bEnglish)
|
||||
{
|
||||
GetEnglishString(token.c_str(), sLocalizedToken);
|
||||
@@ -1803,7 +1834,7 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
|
||||
|
||||
void CLocalizedStringsManager::LocalizeAndSubstituteInternal(AZStd::string& locString, const AZStd::vector<AZStd::string>& keys, const AZStd::vector<AZStd::string>& values)
|
||||
{
|
||||
string outString;
|
||||
AZStd::string outString;
|
||||
LocalizeString_ch(locString.c_str(), outString);
|
||||
locString = outString .c_str();
|
||||
if (values.size() != keys.size())
|
||||
@@ -1866,7 +1897,7 @@ static void LogDecompTimer(__int64 nTotalTicks, __int64 nDecompTicks, __int64 nA
|
||||
}
|
||||
#endif
|
||||
|
||||
string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const SLanguage* pLanguage) const
|
||||
AZStd::string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const SLanguage* pLanguage) const
|
||||
{
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
if ((flags & IS_COMPRESSED) != 0)
|
||||
@@ -1876,7 +1907,7 @@ string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const
|
||||
nTotalTicks = CryGetTicks();
|
||||
#endif //LOG_DECOMP_TIMES
|
||||
|
||||
string outputString;
|
||||
AZStd::string outputString;
|
||||
if (TranslatedText.szCompressed != NULL)
|
||||
{
|
||||
uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
|
||||
@@ -1923,7 +1954,7 @@ string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const
|
||||
}
|
||||
else
|
||||
{
|
||||
string emptyOutputString;
|
||||
AZStd::string emptyOutputString;
|
||||
return emptyOutputString;
|
||||
}
|
||||
}
|
||||
@@ -1949,7 +1980,7 @@ void CLocalizedStringsManager::ListAndClearProblemLabels()
|
||||
CryLog ("These labels caused localization problems:");
|
||||
INDENT_LOG_DURING_SCOPE();
|
||||
|
||||
for (std::map<string, bool>::iterator iter = m_warnedAboutLabels.begin(); iter != m_warnedAboutLabels.end(); iter++)
|
||||
for (std::map<AZStd::string, bool>::iterator iter = m_warnedAboutLabels.begin(); iter != m_warnedAboutLabels.end(); iter++)
|
||||
{
|
||||
CryLog ("%s", iter->first.c_str());
|
||||
}
|
||||
@@ -1961,7 +1992,7 @@ void CLocalizedStringsManager::ListAndClearProblemLabels()
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, string& outLocalString, bool bEnglish)
|
||||
bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, AZStd::string& outLocalString, bool bEnglish)
|
||||
{
|
||||
assert(sLabel);
|
||||
if (!m_pLanguage || !sLabel)
|
||||
@@ -1979,8 +2010,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, string& outLoca
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
|
||||
string translatedText = entry->GetTranslatedText(m_pLanguage);
|
||||
AZStd::string translatedText = entry->GetTranslatedText(m_pLanguage);
|
||||
if ((bEnglish || translatedText.empty()) && entry->pEditorExtension != NULL)
|
||||
{
|
||||
//assert(!"No Localization Text available!");
|
||||
@@ -2011,7 +2041,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, string& outLoca
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLocalizedStringsManager::GetEnglishString(const char* sKey, string& sLocalizedString)
|
||||
bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string& sLocalizedString)
|
||||
{
|
||||
assert(sKey);
|
||||
if (!m_pLanguage || !sKey)
|
||||
@@ -2086,7 +2116,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
|
||||
const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
|
||||
if (entry != NULL)
|
||||
{
|
||||
outGameInfo.szCharacterName = entry->sCharacterName;
|
||||
outGameInfo.szCharacterName = entry->sCharacterName.c_str();
|
||||
outGameInfo.sUtf8TranslatedText = entry->GetTranslatedText(m_pLanguage);
|
||||
|
||||
outGameInfo.bUseSubtitle = (entry->flags & SLocalizedStringEntry::USE_SUBTITLE);
|
||||
@@ -2119,7 +2149,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
|
||||
{
|
||||
bResult = true;
|
||||
|
||||
pOutSoundInfo->szCharacterName = pEntry->sCharacterName;
|
||||
pOutSoundInfo->szCharacterName = pEntry->sCharacterName.c_str();
|
||||
pOutSoundInfo->sUtf8TranslatedText = pEntry->GetTranslatedText(m_pLanguage);
|
||||
|
||||
//pOutSoundInfo->sOriginalActorLine = pEntry->sOriginalActorLine.c_str();
|
||||
@@ -2213,7 +2243,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByIndex(int nIndex, SLocalizedInf
|
||||
}
|
||||
const SLocalizedStringEntry* pEntry = entryVec[nIndex];
|
||||
|
||||
outGameInfo.szCharacterName = pEntry->sCharacterName;
|
||||
outGameInfo.szCharacterName = pEntry->sCharacterName.c_str();
|
||||
outGameInfo.sUtf8TranslatedText = pEntry->GetTranslatedText(m_pLanguage);
|
||||
|
||||
outGameInfo.bUseSubtitle = (pEntry->flags & SLocalizedStringEntry::USE_SUBTITLE);
|
||||
@@ -2233,18 +2263,18 @@ bool CLocalizedStringsManager::GetLocalizedInfoByIndex(int nIndex, SLocalizedInf
|
||||
return false;
|
||||
}
|
||||
const SLocalizedStringEntry* pEntry = entryVec[nIndex];
|
||||
outEditorInfo.szCharacterName = pEntry->sCharacterName;
|
||||
outEditorInfo.szCharacterName = pEntry->sCharacterName.c_str();
|
||||
outEditorInfo.sUtf8TranslatedText = pEntry->GetTranslatedText(m_pLanguage);
|
||||
|
||||
assert(pEntry->pEditorExtension != NULL);
|
||||
|
||||
outEditorInfo.sKey = pEntry->pEditorExtension->sKey;
|
||||
outEditorInfo.sKey = pEntry->pEditorExtension->sKey.c_str();
|
||||
|
||||
outEditorInfo.sOriginalActorLine = pEntry->pEditorExtension->sOriginalActorLine;
|
||||
outEditorInfo.sUtf8TranslatedActorLine = pEntry->pEditorExtension->sUtf8TranslatedActorLine;
|
||||
outEditorInfo.sOriginalActorLine = pEntry->pEditorExtension->sOriginalActorLine.c_str();
|
||||
outEditorInfo.sUtf8TranslatedActorLine = pEntry->pEditorExtension->sUtf8TranslatedActorLine.c_str();
|
||||
|
||||
//outEditorInfo.sOriginalText = pEntry->sOriginalText;
|
||||
outEditorInfo.sOriginalCharacterName = pEntry->pEditorExtension->sOriginalCharacterName;
|
||||
outEditorInfo.sOriginalCharacterName = pEntry->pEditorExtension->sOriginalCharacterName.c_str();
|
||||
|
||||
outEditorInfo.nRow = pEntry->pEditorExtension->nRow;
|
||||
outEditorInfo.bUseSubtitle = (pEntry->flags & SLocalizedStringEntry::USE_SUBTITLE);
|
||||
@@ -2252,7 +2282,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByIndex(int nIndex, SLocalizedInf
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, string& outSubtitle, bool bForceSubtitle)
|
||||
bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, AZStd::string& outSubtitle, bool bForceSubtitle)
|
||||
{
|
||||
assert(sKeyOrLabel);
|
||||
if (!m_pLanguage || !sKeyOrLabel || !*sKeyOrLabel)
|
||||
@@ -2300,21 +2330,20 @@ bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, string& outS
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StringClass, typename CharType>
|
||||
void InternalFormatStringMessage(StringClass& outString, const StringClass& sString, const CharType** sParams, int nParams)
|
||||
void InternalFormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams)
|
||||
{
|
||||
static const CharType token = (CharType) '%';
|
||||
static const CharType tokens1[2] = { token, (CharType) '\0' };
|
||||
static const CharType tokens2[3] = { token, token, (CharType) '\0' };
|
||||
static const char token = '%';
|
||||
static const char tokens1[2] = { token, '\0' };
|
||||
static const char tokens2[3] = { token, token, '\0' };
|
||||
|
||||
int maxArgUsed = 0;
|
||||
int lastPos = 0;
|
||||
int curPos = 0;
|
||||
size_t lastPos = 0;
|
||||
size_t curPos = 0;
|
||||
const int sourceLen = static_cast<int>(sString.length());
|
||||
while (true)
|
||||
{
|
||||
int foundPos = static_cast<int>(sString.find(token, curPos));
|
||||
if (foundPos != string::npos)
|
||||
auto foundPos = sString.find(token, curPos);
|
||||
if (foundPos != AZStd::string::npos)
|
||||
{
|
||||
if (foundPos + 1 < sourceLen)
|
||||
{
|
||||
@@ -2331,8 +2360,8 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr
|
||||
}
|
||||
else
|
||||
{
|
||||
StringClass tmp (sString);
|
||||
tmp.replace(tokens1, tokens2);
|
||||
AZStd::string tmp(sString);
|
||||
AZ::StringFunc::Replace(tmp, tokens1, tokens2);
|
||||
if constexpr (sizeof(*tmp.c_str()) == sizeof(char))
|
||||
{
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Parameter for argument %d is missing. [%s]", nArg + 1, (const char*)tmp.c_str());
|
||||
@@ -2362,11 +2391,10 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StringClass, typename CharType>
|
||||
void InternalFormatStringMessage(StringClass& outString, const StringClass& sString, const CharType* param1, const CharType* param2 = 0, const CharType* param3 = 0, const CharType* param4 = 0)
|
||||
void InternalFormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0)
|
||||
{
|
||||
static const int MAX_PARAMS = 4;
|
||||
const CharType* params[MAX_PARAMS] = { param1, param2, param3, param4 };
|
||||
const char* params[MAX_PARAMS] = { param1, param2, param3, param4 };
|
||||
int nParams = 0;
|
||||
while (nParams < MAX_PARAMS && params[nParams])
|
||||
{
|
||||
@@ -2376,13 +2404,13 @@ void InternalFormatStringMessage(StringClass& outString, const StringClass& sStr
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CLocalizedStringsManager::FormatStringMessage_List(string& outString, const string& sString, const char** sParams, int nParams)
|
||||
void CLocalizedStringsManager::FormatStringMessage_List(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams)
|
||||
{
|
||||
InternalFormatStringMessage(outString, sString, sParams, nParams);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CLocalizedStringsManager::FormatStringMessage(string& outString, const string& sString, const char* param1, const char* param2, const char* param3, const char* param4)
|
||||
void CLocalizedStringsManager::FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2, const char* param3, const char* param4)
|
||||
{
|
||||
InternalFormatStringMessage(outString, sString, param1, param2, param3, param4);
|
||||
}
|
||||
@@ -2462,7 +2490,7 @@ void CLocalizedStringsManager::InternalSetCurrentLanguage(CLocalizedStringsManag
|
||||
#if defined (WIN32) || defined(WIN64)
|
||||
if (m_pLanguage != 0)
|
||||
{
|
||||
g_currentLanguageID = GetLanguageID(m_pLanguage->sLanguage);
|
||||
g_currentLanguageID = GetLanguageID(m_pLanguage->sLanguage.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2494,7 +2522,7 @@ void CLocalizedStringsManager::InternalSetCurrentLanguage(CLocalizedStringsManag
|
||||
}
|
||||
}
|
||||
|
||||
void CLocalizedStringsManager::LocalizeDuration(int seconds, string& outDurationString)
|
||||
void CLocalizedStringsManager::LocalizeDuration(int seconds, AZStd::string& outDurationString)
|
||||
{
|
||||
int s = seconds;
|
||||
int d, h, m;
|
||||
@@ -2504,27 +2532,27 @@ void CLocalizedStringsManager::LocalizeDuration(int seconds, string& outDuration
|
||||
s -= h * 3600;
|
||||
m = s / 60;
|
||||
s = s - m * 60;
|
||||
string str;
|
||||
AZStd::string str;
|
||||
if (d > 1)
|
||||
{
|
||||
str.Format("%d @ui_days %02d:%02d:%02d", d, h, m, s);
|
||||
str = AZStd::string::format("%d @ui_days %02d:%02d:%02d", d, h, m, s);
|
||||
}
|
||||
else if (d > 0)
|
||||
{
|
||||
str.Format("%d @ui_day %02d:%02d:%02d", d, h, m, s);
|
||||
str = AZStd::string::format("%d @ui_day %02d:%02d:%02d", d, h, m, s);
|
||||
}
|
||||
else if (h > 0)
|
||||
{
|
||||
str.Format("%02d:%02d:%02d", h, m, s);
|
||||
str = AZStd::string::format("%02d:%02d:%02d", h, m, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
str.Format("%02d:%02d", m, s);
|
||||
str = AZStd::string::format("%02d:%02d", m, s);
|
||||
}
|
||||
LocalizeString_s(str, outDurationString);
|
||||
}
|
||||
|
||||
void CLocalizedStringsManager::LocalizeNumber(int number, string& outNumberString)
|
||||
void CLocalizedStringsManager::LocalizeNumber(int number, AZStd::string& outNumberString)
|
||||
{
|
||||
if (number == 0)
|
||||
{
|
||||
@@ -2535,8 +2563,8 @@ void CLocalizedStringsManager::LocalizeNumber(int number, string& outNumberStrin
|
||||
outNumberString.assign("");
|
||||
|
||||
int n = abs(number);
|
||||
string separator;
|
||||
CryFixedStringT<64> tmp;
|
||||
AZStd::string separator;
|
||||
AZStd::fixed_string<64> tmp;
|
||||
LocalizeString_ch("@ui_thousand_separator", separator);
|
||||
while (n > 0)
|
||||
{
|
||||
@@ -2544,49 +2572,49 @@ void CLocalizedStringsManager::LocalizeNumber(int number, string& outNumberStrin
|
||||
int b = n - (a * 1000);
|
||||
if (a > 0)
|
||||
{
|
||||
tmp.Format("%s%03d%s", separator.c_str(), b, tmp.c_str());
|
||||
tmp = AZStd::string::format("%s%03d%s", separator.c_str(), b, tmp.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp.Format("%d%s", b, tmp.c_str());
|
||||
tmp = AZStd::string::format("%d%s", b, tmp.c_str());
|
||||
}
|
||||
n = a;
|
||||
}
|
||||
|
||||
if (number < 0)
|
||||
{
|
||||
tmp.Format("-%s", tmp.c_str());
|
||||
tmp = AZStd::string::format("-%s", tmp.c_str());
|
||||
}
|
||||
|
||||
outNumberString.assign(tmp.c_str());
|
||||
}
|
||||
|
||||
void CLocalizedStringsManager::LocalizeNumber_Decimal(float number, int decimals, string& outNumberString)
|
||||
void CLocalizedStringsManager::LocalizeNumber_Decimal(float number, int decimals, AZStd::string& outNumberString)
|
||||
{
|
||||
if (number == 0.0f)
|
||||
{
|
||||
CryFixedStringT<64> tmp;
|
||||
tmp.Format("%.*f", decimals, number);
|
||||
AZStd::fixed_string<64> tmp;
|
||||
tmp = AZStd::fixed_string<64>::format("%.*f", decimals, number);
|
||||
outNumberString.assign(tmp.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
outNumberString.assign("");
|
||||
|
||||
string commaSeparator;
|
||||
AZStd::string commaSeparator;
|
||||
LocalizeString_ch("@ui_decimal_separator", commaSeparator);
|
||||
float f = number > 0.0f ? number : -number;
|
||||
int d = (int)f;
|
||||
|
||||
string intPart;
|
||||
AZStd::string intPart;
|
||||
LocalizeNumber(d, intPart);
|
||||
|
||||
float decimalsOnly = f - (float)d;
|
||||
|
||||
int decimalsAsInt = aznumeric_cast<int>(int_round(decimalsOnly * pow(10.0f, decimals)));
|
||||
|
||||
CryFixedStringT<64> tmp;
|
||||
tmp.Format("%s%s%0*d", intPart.c_str(), commaSeparator.c_str(), decimals, decimalsAsInt);
|
||||
AZStd::fixed_string<64> tmp;
|
||||
tmp = AZStd::fixed_string<64>::format("%s%s%0*d", intPart.c_str(), commaSeparator.c_str(), decimals, decimalsAsInt);
|
||||
|
||||
outNumberString.assign(tmp.c_str());
|
||||
}
|
||||
@@ -2640,7 +2668,7 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString)
|
||||
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString)
|
||||
{
|
||||
if (bMakeLocalTime)
|
||||
{
|
||||
@@ -2648,7 +2676,7 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool
|
||||
localtime_s(&thetime, &t);
|
||||
t = gEnv->pTimer->DateToSecondsUTC(thetime);
|
||||
}
|
||||
outTimeString.resize(0);
|
||||
outTimeString.clear();
|
||||
LCID lcID = g_currentLanguageID.lcID ? g_currentLanguageID.lcID : LOCALE_USER_DEFAULT;
|
||||
DWORD flags = bShowSeconds == false ? TIME_NOSECONDS : 0;
|
||||
SYSTEMTIME systemTime;
|
||||
@@ -2657,14 +2685,14 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool
|
||||
if (len > 0)
|
||||
{
|
||||
// len includes terminating null!
|
||||
CryFixedWStringT<256> tmpString;
|
||||
AZStd::fixed_wstring<256> tmpString;
|
||||
tmpString.resize(len);
|
||||
::GetTimeFormatW(lcID, flags, &systemTime, 0, (wchar_t*) tmpString.c_str(), len);
|
||||
Unicode::Convert(outTimeString, tmpString);
|
||||
AZStd::to_string(outTimeString, tmpString.data());
|
||||
}
|
||||
}
|
||||
|
||||
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString)
|
||||
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString)
|
||||
{
|
||||
if (bMakeLocalTime)
|
||||
{
|
||||
@@ -2678,7 +2706,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
|
||||
UnixTimeToSystemTime(t, &systemTime);
|
||||
|
||||
// len includes terminating null!
|
||||
CryFixedWStringT<256> tmpString;
|
||||
AZStd::fixed_wstring<256> tmpString;
|
||||
|
||||
if (bIncludeWeekday)
|
||||
{
|
||||
@@ -2689,8 +2717,8 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
|
||||
// len includes terminating null!
|
||||
tmpString.resize(len);
|
||||
::GetDateFormatW(lcID, 0, &systemTime, L"ddd", (wchar_t*) tmpString.c_str(), len);
|
||||
string utf8;
|
||||
Unicode::Convert(utf8, tmpString);
|
||||
AZStd::string utf8;
|
||||
AZStd::to_string(utf8, tmpString.data());
|
||||
outDateString.append(utf8);
|
||||
outDateString.append(" ");
|
||||
}
|
||||
@@ -2702,15 +2730,15 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
|
||||
// len includes terminating null!
|
||||
tmpString.resize(len);
|
||||
::GetDateFormatW(lcID, flags, &systemTime, 0, (wchar_t*) tmpString.c_str(), len);
|
||||
string utf8;
|
||||
Unicode::Convert(utf8, tmpString);
|
||||
AZStd::string utf8;
|
||||
AZStd::to_string(utf8, tmpString.data());
|
||||
outDateString.append(utf8);
|
||||
}
|
||||
}
|
||||
|
||||
#else // #if defined (WIN32) || defined(WIN64)
|
||||
|
||||
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString)
|
||||
void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString)
|
||||
{
|
||||
struct tm theTime;
|
||||
if (bMakeLocalTime)
|
||||
@@ -2734,10 +2762,10 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool
|
||||
const size_t bufSize = sizeof(buf) / sizeof(buf[0]);
|
||||
wcsftime(buf, bufSize, bShowSeconds ? L"%#X" : L"%X", &theTime);
|
||||
buf[bufSize - 1] = 0;
|
||||
Unicode::Convert(outTimeString, buf);
|
||||
AZStd::to_string(outTimeString, buf);
|
||||
}
|
||||
|
||||
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString)
|
||||
void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString)
|
||||
{
|
||||
struct tm theTime;
|
||||
if (bMakeLocalTime)
|
||||
@@ -2762,7 +2790,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
|
||||
const wchar_t* format = bShort ? (bIncludeWeekday ? L"%a %x" : L"%x") : L"%#x"; // long format always contains Weekday name
|
||||
wcsftime(buf, bufSize, format, &theTime);
|
||||
buf[bufSize - 1] = 0;
|
||||
Unicode::Convert(outDateString, buf);
|
||||
AZStd::to_string(outDateString, buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class CLocalizedStringsManager
|
||||
, public ISystemEventListener
|
||||
{
|
||||
public:
|
||||
typedef std::vector<string> TLocalizationTagVec;
|
||||
typedef std::vector<AZStd::string> TLocalizationTagVec;
|
||||
|
||||
constexpr const static size_t LOADING_FIXED_STRING_LENGTH = 2048;
|
||||
constexpr const static size_t COMPRESSION_FIXED_BUFFER_LENGTH = 6144;
|
||||
@@ -56,11 +56,11 @@ public:
|
||||
void ReloadData() override;
|
||||
void FreeData();
|
||||
|
||||
bool LocalizeString_s(const string& sString, string& outLocalizedString, bool bEnglish = false) override;
|
||||
bool LocalizeString_ch(const char* sString, string& outLocalizedString, bool bEnglish = false) override;
|
||||
bool LocalizeString_s(const AZStd::string& sString, AZStd::string& outLocalizedString, bool bEnglish = false) override;
|
||||
bool LocalizeString_ch(const char* sString, AZStd::string& outLocalizedString, bool bEnglish = false) override;
|
||||
|
||||
void LocalizeAndSubstituteInternal(AZStd::string& locString, const AZStd::vector<AZStd::string>& keys, const AZStd::vector<AZStd::string>& values) override;
|
||||
bool LocalizeLabel(const char* sLabel, string& outLocalizedString, bool bEnglish = false) override;
|
||||
bool LocalizeLabel(const char* sLabel, AZStd::string& outLocalizedString, bool bEnglish = false) override;
|
||||
bool IsLocalizedInfoFound(const char* sKey);
|
||||
bool GetLocalizedInfoByKey(const char* sKey, SLocalizedInfoGame& outGameInfo);
|
||||
bool GetLocalizedInfoByKey(const char* sKey, SLocalizedSoundInfoGame* pOutSoundInfoGame);
|
||||
@@ -68,17 +68,17 @@ public:
|
||||
bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoGame& outGameInfo);
|
||||
bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoEditor& outEditorInfo);
|
||||
|
||||
bool GetEnglishString(const char* sKey, string& sLocalizedString) override;
|
||||
bool GetSubtitle(const char* sKeyOrLabel, string& outSubtitle, bool bForceSubtitle = false) override;
|
||||
bool GetEnglishString(const char* sKey, AZStd::string& sLocalizedString) override;
|
||||
bool GetSubtitle(const char* sKeyOrLabel, AZStd::string& outSubtitle, bool bForceSubtitle = false) override;
|
||||
|
||||
void FormatStringMessage_List(string& outString, const string& sString, const char** sParams, int nParams) override;
|
||||
void FormatStringMessage(string& outString, const string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) override;
|
||||
void FormatStringMessage_List(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams) override;
|
||||
void FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) override;
|
||||
|
||||
void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, string& outTimeString) override;
|
||||
void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, string& outDateString) override;
|
||||
void LocalizeDuration(int seconds, string& outDurationString) override;
|
||||
void LocalizeNumber(int number, string& outNumberString) override;
|
||||
void LocalizeNumber_Decimal(float number, int decimals, string& outNumberString) override;
|
||||
void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString) override;
|
||||
void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString) override;
|
||||
void LocalizeDuration(int seconds, AZStd::string& outDurationString) override;
|
||||
void LocalizeNumber(int number, AZStd::string& outNumberString) override;
|
||||
void LocalizeNumber_Decimal(float number, int decimals, AZStd::string& outNumberString) override;
|
||||
|
||||
bool ProjectUsesLocalization() const override;
|
||||
// ~ILocalizationManager
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
private:
|
||||
void SetAvailableLocalizationsBitfield(const ILocalizationManager::TLocalizationBitfield availableLocalizations);
|
||||
|
||||
bool LocalizeStringInternal(const char* pStr, size_t len, string& outLocalizedString, bool bEnglish);
|
||||
bool LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish);
|
||||
|
||||
bool DoLoadExcelXmlSpreadsheet(const char* sFileName, uint8 tagID, bool bReload);
|
||||
typedef bool(CLocalizedStringsManager::*LoadFunc)(const char*, uint8, bool);
|
||||
@@ -104,11 +104,11 @@ private:
|
||||
|
||||
struct SLocalizedStringEntryEditorExtension
|
||||
{
|
||||
string sKey; // Map key text equivalent (without @)
|
||||
string sOriginalActorLine; // english text
|
||||
string sUtf8TranslatedActorLine; // localized text
|
||||
string sOriginalText; // subtitle. if empty, uses English text
|
||||
string sOriginalCharacterName; // english character name speaking via XML asset
|
||||
AZStd::string sKey; // Map key text equivalent (without @)
|
||||
AZStd::string sOriginalActorLine; // english text
|
||||
AZStd::string sUtf8TranslatedActorLine; // localized text
|
||||
AZStd::string sOriginalText; // subtitle. if empty, uses English text
|
||||
AZStd::string sOriginalCharacterName; // english character name speaking via XML asset
|
||||
|
||||
unsigned int nRow; // Number of row in XML file
|
||||
|
||||
@@ -141,15 +141,15 @@ private:
|
||||
|
||||
union trans_text
|
||||
{
|
||||
string* psUtf8Uncompressed;
|
||||
AZStd::string* psUtf8Uncompressed;
|
||||
uint8* szCompressed; // Note that no size information is stored. This is for struct size optimization and unfortunately renders the size info inaccurate.
|
||||
};
|
||||
|
||||
string sCharacterName; // character name speaking via XML asset
|
||||
AZStd::string sCharacterName; // character name speaking via XML asset
|
||||
trans_text TranslatedText; // Subtitle of this line
|
||||
|
||||
// audio specific part
|
||||
string sPrototypeSoundEvent; // associated sound event prototype (radio, ...)
|
||||
AZStd::string sPrototypeSoundEvent; // associated sound event prototype (radio, ...)
|
||||
CryHalf fVolume;
|
||||
CryHalf fRadioRatio;
|
||||
// SoundMoods
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
string GetTranslatedText(const SLanguage* pLanguage) const;
|
||||
AZStd::string GetTranslatedText(const SLanguage* pLanguage) const;
|
||||
|
||||
void GetMemoryUsage(ICrySizer* pSizer) const
|
||||
{
|
||||
@@ -224,7 +224,7 @@ private:
|
||||
typedef std::vector<SLocalizedStringEntry*> TLocalizedStringEntries;
|
||||
typedef std::vector<HuffmanCoder*> THuffmanCoders;
|
||||
|
||||
string sLanguage;
|
||||
AZStd::string sLanguage;
|
||||
StringsKeyMap m_keysMap;
|
||||
TLocalizedStringEntries m_vLocalizedStrings;
|
||||
THuffmanCoders m_vEncoders;
|
||||
@@ -246,7 +246,7 @@ private:
|
||||
};
|
||||
|
||||
#ifndef _RELEASE
|
||||
std::map<string, bool> m_warnedAboutLabels;
|
||||
std::map<AZStd::string, bool> m_warnedAboutLabels;
|
||||
bool m_haveWarnedAboutAtLeastOneLabel;
|
||||
|
||||
void LocalizedStringsManagerWarning(const char* label, const char* message);
|
||||
@@ -259,45 +259,45 @@ private:
|
||||
void AddLocalizedString(SLanguage* pLanguage, SLocalizedStringEntry* pEntry, const uint32 keyCRC32);
|
||||
void AddControl(int nKey);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, string>& SoundMoodIndex, std::map<int, string>& EventParameterIndex);
|
||||
void ParseFirstLine(IXmlTableReader* pXmlTableReader, char* nCellIndexToType, std::map<int, AZStd::string>& SoundMoodIndex, std::map<int, AZStd::string>& EventParameterIndex);
|
||||
void InternalSetCurrentLanguage(SLanguage* pLanguage);
|
||||
ISystem* m_pSystem;
|
||||
// Pointer to the current language.
|
||||
SLanguage* m_pLanguage;
|
||||
|
||||
// all loaded Localization Files
|
||||
typedef std::pair<string, SFileInfo> pairFileName;
|
||||
typedef std::map<string, SFileInfo> tmapFilenames;
|
||||
typedef std::pair<AZStd::string, SFileInfo> pairFileName;
|
||||
typedef std::map<AZStd::string, SFileInfo> tmapFilenames;
|
||||
tmapFilenames m_loadedTables;
|
||||
|
||||
|
||||
// filenames per tag
|
||||
typedef std::vector<string> TStringVec;
|
||||
typedef std::vector<AZStd::string> TStringVec;
|
||||
struct STag
|
||||
{
|
||||
TStringVec filenames;
|
||||
uint8 id;
|
||||
bool loaded;
|
||||
};
|
||||
typedef std::map<string, STag> TTagFileNames;
|
||||
typedef std::map<AZStd::string, STag> TTagFileNames;
|
||||
TTagFileNames m_tagFileNames;
|
||||
TStringVec m_tagLoadRequests;
|
||||
|
||||
// Array of loaded languages.
|
||||
std::vector<SLanguage*> m_languages;
|
||||
|
||||
typedef std::set<string> PrototypeSoundEvents;
|
||||
typedef std::set<AZStd::string> PrototypeSoundEvents;
|
||||
PrototypeSoundEvents m_prototypeEvents; // this set is purely used for clever string/string assigning to save memory
|
||||
|
||||
struct less_strcmp
|
||||
{
|
||||
bool operator()(const string& left, const string& right) const
|
||||
bool operator()(const AZStd::string& left, const AZStd::string& right) const
|
||||
{
|
||||
return strcmp(left.c_str(), right.c_str()) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<string, less_strcmp> CharacterNameSet;
|
||||
typedef std::set<AZStd::string, less_strcmp> CharacterNameSet;
|
||||
CharacterNameSet m_characterNameSet; // this set is purely used for clever string/string assigning to save memory
|
||||
|
||||
// CVARs
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <ISystem.h>
|
||||
#include "System.h"
|
||||
#include "CryPath.h" // PathUtil::ReplaceExtension()
|
||||
#include "UnicodeFunctions.h"
|
||||
|
||||
#include <AzFramework/IO/FileOperations.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
@@ -455,7 +454,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
|
||||
{
|
||||
case eWarning:
|
||||
case eWarningAlways:
|
||||
cry_strcpy(szString, MAX_WARNING_LENGTH, "$6[Warning] ");
|
||||
azstrcpy(szString, MAX_WARNING_LENGTH, "$6[Warning] ");
|
||||
szString += 12; // strlen("$6[Warning] ");
|
||||
szAfterColour += 2;
|
||||
prefixSize = 12;
|
||||
@@ -463,7 +462,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
|
||||
|
||||
case eError:
|
||||
case eErrorAlways:
|
||||
cry_strcpy(szString, MAX_WARNING_LENGTH, "$4[Error] ");
|
||||
azstrcpy(szString, MAX_WARNING_LENGTH, "$4[Error] ");
|
||||
szString += 10; // strlen("$4[Error] ");
|
||||
szAfterColour += 2;
|
||||
prefixSize = 10;
|
||||
@@ -498,7 +497,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
|
||||
stack_string s = szBuffer;
|
||||
s += "\t<Scope> ";
|
||||
s += sAssetScope;
|
||||
cry_strcpy(szBuffer, s.c_str());
|
||||
azstrcpy(szBuffer, AZ_ARRAY_SIZE(szBuffer), s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +520,7 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo
|
||||
}
|
||||
}
|
||||
i = m_iLastHistoryItem = m_iLastHistoryItem + 1 & sz - 1;
|
||||
cry_strcpy(m_history[i].str, m_history[i].ptr = szSpamCheck);
|
||||
azstrcpy(m_history[i].str, AZ_ARRAY_SIZE(m_history[i].str), m_history[i].ptr = szSpamCheck);
|
||||
m_history[i].type = type;
|
||||
m_history[i].time = time;
|
||||
}
|
||||
@@ -852,7 +851,7 @@ bool CLog::LogToMainThread(const char* szString, ELogType logType, bool bAdd, SL
|
||||
{
|
||||
// When logging from other thread then main, push all log strings to queue.
|
||||
SLogMsg msg;
|
||||
cry_strcpy(msg.msg, szString);
|
||||
azstrcpy(msg.msg, AZ_ARRAY_SIZE(msg.msg), szString);
|
||||
msg.bAdd = bAdd;
|
||||
msg.destination = destination;
|
||||
msg.logType = logType;
|
||||
@@ -945,7 +944,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
|
||||
{
|
||||
timeStr.clear();
|
||||
uint32 dwMs = (uint32)((currenttime - lasttime).GetMilliSeconds());
|
||||
timeStr.Format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
|
||||
timeStr = AZStd::string::format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
|
||||
tempString = timeStr + tempString;
|
||||
}
|
||||
lasttime = currenttime;
|
||||
@@ -972,7 +971,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
|
||||
{
|
||||
timeStr.clear();
|
||||
uint32 dwMs = (uint32)((currenttime - lasttime).GetMilliSeconds());
|
||||
timeStr.Format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
|
||||
timeStr = AZStd::string::format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
|
||||
tempString = timeStr + tempString;
|
||||
}
|
||||
lasttime = currenttime;
|
||||
@@ -989,7 +988,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
|
||||
{
|
||||
timeStr.clear();
|
||||
uint32 dwMs = (uint32)((currenttime - lasttime).GetMilliSeconds());
|
||||
timeStr.Format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
|
||||
timeStr = AZStd::string::format("<%3d.%.3d>: ", dwMs / 1000, dwMs % 1000);
|
||||
tempString = timeStr + tempString;
|
||||
}
|
||||
if (bFirst)
|
||||
@@ -1041,13 +1040,7 @@ void CLog::LogStringToFile(const char* szString, ELogType logType, bool bAdd, [[
|
||||
#if !defined(_RELEASE)
|
||||
if (queueState == MessageQueueState::NotQueued)
|
||||
{
|
||||
// Note: OutputDebugString(A) only accepts current ANSI code-page, and the W variant will call the A variant internally.
|
||||
// Here we replace non-ASCII characters with '?', which is the same as OutputDebugStringW will do for non-ANSI.
|
||||
// Thus, we discard slightly more characters (ie, those inside the current ANSI code-page, but outside ASCII).
|
||||
// In exchange, we save double-converting that would have happened otherwise (UTF-8 -> UTF-16 -> ANSI).
|
||||
LogStringType asciiString;
|
||||
Unicode::ConvertSafe<Unicode::EErrorRecovery::eErrorRecovery_FallbackLatin1ThenDiscard, Unicode::eEncoding_ASCII, Unicode::eEncoding_UTF8>(asciiString, tempString);
|
||||
OutputDebugString(asciiString.c_str());
|
||||
AZ::Debug::Platform::OutputToDebugger(nullptr, tempString.c_str());
|
||||
}
|
||||
|
||||
if (!bIsMainThread)
|
||||
@@ -1207,14 +1200,14 @@ void CLog::CreateBackupFile() const
|
||||
|
||||
// boswej: only create a backup if logging to the engine root, otherwise the
|
||||
// log output has been overridden and the user is responsible
|
||||
string logDir = PathUtil::RemoveSlash(PathUtil::ToUnixPath(PathUtil::GetParentDirectory(m_szFilename)));
|
||||
AZStd::string logDir = PathUtil::RemoveSlash(PathUtil::ToUnixPath(PathUtil::GetParentDirectory(m_szFilename)));
|
||||
|
||||
string sExt = PathUtil::GetExt(m_szFilename);
|
||||
string sFileWithoutExt = PathUtil::GetFileName(m_szFilename);
|
||||
AZStd::string sExt = PathUtil::GetExt(m_szFilename);
|
||||
AZStd::string sFileWithoutExt = PathUtil::GetFileName(m_szFilename);
|
||||
|
||||
{
|
||||
assert(::strstr(sFileWithoutExt, ":") == 0);
|
||||
assert(::strstr(sFileWithoutExt, "\\") == 0);
|
||||
assert(::strstr(sFileWithoutExt.c_str(), ":") == 0);
|
||||
assert(::strstr(sFileWithoutExt.c_str(), "\\") == 0);
|
||||
}
|
||||
|
||||
PathUtil::RemoveExtension(sFileWithoutExt);
|
||||
@@ -1223,14 +1216,14 @@ void CLog::CreateBackupFile() const
|
||||
AZ::IO::HandleType inFileHandle = AZ::IO::InvalidHandle;
|
||||
fileSystem->Open(m_szFilename, AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeBinary, inFileHandle);
|
||||
|
||||
string sBackupNameAttachment;
|
||||
AZStd::string sBackupNameAttachment;
|
||||
|
||||
// parse backup name attachment
|
||||
// e.g. BackupNameAttachment="attachment name"
|
||||
if (inFileHandle != AZ::IO::InvalidHandle)
|
||||
{
|
||||
bool bKeyFound = false;
|
||||
string sName;
|
||||
AZStd::string sName;
|
||||
|
||||
while (!fileSystem->Eof(inFileHandle))
|
||||
{
|
||||
@@ -1242,13 +1235,11 @@ void CLog::CreateBackupFile() const
|
||||
{
|
||||
bKeyFound = true;
|
||||
|
||||
if (sName.find("BackupNameAttachment=") == string::npos)
|
||||
if (sName.find("BackupNameAttachment=") == AZStd::string::npos)
|
||||
{
|
||||
#ifdef WIN32
|
||||
OutputDebugString("Log::CreateBackupFile ERROR '");
|
||||
OutputDebugString(sName.c_str());
|
||||
OutputDebugString("' not recognized \n");
|
||||
#endif
|
||||
AZ::Debug::Platform::OutputToDebugger("CrySystem Log", "Log::CreateBackupFile ERROR '");
|
||||
AZ::Debug::Platform::OutputToDebugger(nullptr, sName.c_str());
|
||||
AZ::Debug::Platform::OutputToDebugger(nullptr, "' not recognized \n");
|
||||
assert(0); // broken log file? - first line should include this name - written by LogVersion()
|
||||
return;
|
||||
}
|
||||
@@ -1273,12 +1264,12 @@ void CLog::CreateBackupFile() const
|
||||
fileSystem->Close(inFileHandle);
|
||||
}
|
||||
|
||||
string bakdest = PathUtil::Make(LOG_BACKUP_PATH, sFileWithoutExt + sBackupNameAttachment + "." + sExt);
|
||||
AZStd::string bakdest = PathUtil::Make(LOG_BACKUP_PATH, sFileWithoutExt + sBackupNameAttachment + "." + sExt);
|
||||
fileSystem->CreatePath(LOG_BACKUP_PATH);
|
||||
cry_strcpy(m_sBackupFilename, bakdest.c_str());
|
||||
azstrcpy(m_sBackupFilename, AZ_ARRAY_SIZE(m_sBackupFilename), bakdest.c_str());
|
||||
// Remove any existing backup file with the same name first since the copy will fail otherwise.
|
||||
fileSystem->Remove(m_sBackupFilename);
|
||||
fileSystem->Copy(m_szFilename, bakdest);
|
||||
fileSystem->Copy(m_szFilename, bakdest.c_str());
|
||||
#endif // AZ_LEGACY_CRYSYSTEM_TRAIT_ALLOW_CREATE_BACKUP_LOG_FILE
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class CLog
|
||||
{
|
||||
public:
|
||||
typedef std::list<ILogCallback*> Callbacks;
|
||||
typedef CryStackStringT<char, MAX_TEMP_LENGTH_SIZE> LogStringType;
|
||||
typedef AZStd::fixed_string<MAX_TEMP_LENGTH_SIZE> LogStringType;
|
||||
|
||||
// constructor
|
||||
CLog(ISystem* pSystem);
|
||||
|
||||
@@ -88,14 +88,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
// Handle with the default procedure
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
assert(IsWindowUnicode(hWnd) && "Window should be Unicode when compiling with UNICODE");
|
||||
#else
|
||||
if (!IsWindowUnicode(hWnd))
|
||||
{
|
||||
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
@@ -138,7 +131,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
#include "RemoteConsole/RemoteConsole.h"
|
||||
|
||||
#include <PNoise3.h>
|
||||
#include <StringUtils.h>
|
||||
|
||||
#include <LyShine/Bus/UiCursorBus.h>
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
@@ -1156,7 +1148,7 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int
|
||||
if (sModuleFilter && *sModuleFilter != 0)
|
||||
{
|
||||
const char* sModule = ValidatorModuleToString(module);
|
||||
if (strlen(sModule) > 1 || CryStringUtils::stristr(sModule, sModuleFilter) == 0)
|
||||
if (strlen(sModule) > 1 || AZ::StringFunc::Find(sModule, sModuleFilter) == AZStd::string::npos)
|
||||
{
|
||||
// Filter out warnings from other modules.
|
||||
return;
|
||||
@@ -1190,7 +1182,7 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int
|
||||
|
||||
if (file && *file)
|
||||
{
|
||||
CryFixedStringT<MAX_WARNING_LENGTH> fmt = szBuffer;
|
||||
AZStd::fixed_string<MAX_WARNING_LENGTH> fmt = szBuffer;
|
||||
fmt += " [File=";
|
||||
fmt += file;
|
||||
fmt += "]";
|
||||
@@ -1209,10 +1201,11 @@ void CSystem::WarningV(EValidatorModule module, EValidatorSeverity severity, int
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::GetLocalizedPath(const char* sLanguage, string& sLocalizedPath)
|
||||
void CSystem::GetLocalizedPath(const char* sLanguage, AZStd::string& sLocalizedPath)
|
||||
{
|
||||
// Omit the trailing slash!
|
||||
string sLocalizationFolder(string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1));
|
||||
AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
|
||||
sLocalizationFolder.pop_back();
|
||||
|
||||
int locFormat = 0;
|
||||
LocalizationManagerRequestBus::BroadcastResult(locFormat, &LocalizationManagerRequestBus::Events::GetLocalizationFormat);
|
||||
@@ -1222,37 +1215,38 @@ void CSystem::GetLocalizedPath(const char* sLanguage, string& sLocalizedPath)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sLocalizationFolder.compareNoCase("Languages") != 0)
|
||||
{
|
||||
sLocalizedPath = sLocalizationFolder + "/" + sLanguage + "_xml.pak";
|
||||
}
|
||||
else
|
||||
{
|
||||
sLocalizedPath = string("Localized/") + sLanguage + "_xml.pak";
|
||||
if (AZ::StringFunc::Equal(sLocalizationFolder, "Languages", false))
|
||||
{
|
||||
sLocalizedPath = sLocalizationFolder + "/" + sLanguage + "_xml.pak";
|
||||
}
|
||||
else
|
||||
{
|
||||
sLocalizedPath = AZStd::string("Localized/") + sLanguage + "_xml.pak";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::GetLocalizedAudioPath(const char* sLanguage, string& sLocalizedPath)
|
||||
void CSystem::GetLocalizedAudioPath(const char* sLanguage, AZStd::string& sLocalizedPath)
|
||||
{
|
||||
// Omit the trailing slash!
|
||||
string sLocalizationFolder(string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1));
|
||||
AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
|
||||
sLocalizationFolder.pop_back();
|
||||
|
||||
if (sLocalizationFolder.compareNoCase("Languages") != 0)
|
||||
if (AZ::StringFunc::Equal(sLocalizationFolder, "Languages", false))
|
||||
{
|
||||
sLocalizedPath = sLocalizationFolder + "/" + sLanguage + ".pak";
|
||||
}
|
||||
else
|
||||
{
|
||||
sLocalizedPath = string("Localized/") + sLanguage + ".pak";
|
||||
sLocalizedPath = AZStd::string("Localized/") + sLanguage + ".pak";
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::CloseLanguagePak(const char* sLanguage)
|
||||
{
|
||||
string sLocalizedPath;
|
||||
AZStd::string sLocalizedPath;
|
||||
GetLocalizedPath(sLanguage, sLocalizedPath);
|
||||
m_env.pCryPak->ClosePacks({ sLocalizedPath.c_str(), sLocalizedPath.size() });
|
||||
}
|
||||
@@ -1260,7 +1254,7 @@ void CSystem::CloseLanguagePak(const char* sLanguage)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::CloseLanguageAudioPak(const char* sLanguage)
|
||||
{
|
||||
string sLocalizedPath;
|
||||
AZStd::string sLocalizedPath;
|
||||
GetLocalizedAudioPath(sLanguage, sLocalizedPath);
|
||||
m_env.pCryPak->ClosePacks({ sLocalizedPath.c_str(), sLocalizedPath.size() });
|
||||
}
|
||||
@@ -1334,11 +1328,11 @@ void CSystem::ExecuteCommandLine(bool deferred)
|
||||
|
||||
if (pCmd->GetType() == eCLAT_Post)
|
||||
{
|
||||
string sLine = pCmd->GetName();
|
||||
AZStd::string sLine = pCmd->GetName();
|
||||
{
|
||||
if (pCmd->GetValue())
|
||||
{
|
||||
sLine += string(" ") + pCmd->GetValue();
|
||||
sLine += AZStd::string(" ") + pCmd->GetValue();
|
||||
}
|
||||
|
||||
GetILog()->Log("Executing command from command line: \n%s\n", sLine.c_str()); // - the actual command might be executed much later (e.g. level load pause)
|
||||
|
||||
@@ -353,9 +353,6 @@ public:
|
||||
virtual IXmlUtils* GetXmlUtils();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SetViewCamera(CCamera& Camera){ m_ViewCamera = Camera; }
|
||||
CCamera& GetViewCamera() { return m_ViewCamera; }
|
||||
|
||||
void IgnoreUpdates(bool bIgnore) { m_bIgnoreUpdates = bIgnore; };
|
||||
|
||||
void SetIProcess(IProcess* process);
|
||||
@@ -453,7 +450,7 @@ private:
|
||||
bool ReLaunchMediaCenter();
|
||||
void UpdateAudioSystems();
|
||||
|
||||
void AddCVarGroupDirectory(const string& sPath);
|
||||
void AddCVarGroupDirectory(const AZStd::string& sPath);
|
||||
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> LoadDynamiclibrary(const char* dllName) const;
|
||||
|
||||
@@ -494,7 +491,6 @@ private: // ------------------------------------------------------
|
||||
SSystemGlobalEnvironment m_env;
|
||||
|
||||
CTimer m_Time; //!<
|
||||
CCamera m_ViewCamera; //!<
|
||||
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)
|
||||
@@ -623,7 +619,7 @@ private: // ------------------------------------------------------
|
||||
// ICVar *m_sys_filecache;
|
||||
ICVar* m_gpu_particle_physics;
|
||||
|
||||
string m_sSavedRDriver; //!< to restore the driver when quitting the dedicated server
|
||||
AZStd::string m_sSavedRDriver; //!< to restore the driver when quitting the dedicated server
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! User define callback for system events.
|
||||
@@ -672,8 +668,8 @@ public:
|
||||
void OpenBasicPaks();
|
||||
void OpenLanguagePak(const char* sLanguage);
|
||||
void OpenLanguageAudioPak(const char* sLanguage);
|
||||
void GetLocalizedPath(const char* sLanguage, string& sLocalizedPath);
|
||||
void GetLocalizedAudioPath(const char* sLanguage, string& sLocalizedPath);
|
||||
void GetLocalizedPath(const char* sLanguage, AZStd::string& sLocalizedPath);
|
||||
void GetLocalizedAudioPath(const char* sLanguage, AZStd::string& sLocalizedPath);
|
||||
void CloseLanguagePak(const char* sLanguage);
|
||||
void CloseLanguageAudioPak(const char* sLanguage);
|
||||
void UpdateMovieSystem(const int updateFlags, const float fFrameTime, const bool bPreUpdate);
|
||||
@@ -718,14 +714,14 @@ protected: // -------------------------------------------------------------
|
||||
|
||||
CCmdLine* m_pCmdLine;
|
||||
|
||||
string m_currentLanguageAudio;
|
||||
string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_android.cfg or system_windows_pc.cfg
|
||||
AZStd::string m_currentLanguageAudio;
|
||||
AZStd::string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_android.cfg or system_windows_pc.cfg
|
||||
|
||||
std::vector< std::pair<CTimeValue, float> > m_updateTimes;
|
||||
|
||||
struct SErrorMessage
|
||||
{
|
||||
string m_Message;
|
||||
AZStd::string m_Message;
|
||||
float m_fTimeToShow;
|
||||
float m_Color[4];
|
||||
bool m_HardFailure;
|
||||
|
||||
@@ -114,20 +114,22 @@ void CSystem::QueryVersionInfo()
|
||||
|
||||
char ver[1024 * 8];
|
||||
|
||||
GetModuleFileName(NULL, moduleName, _MAX_PATH); //retrieves the PATH for the current module
|
||||
AZ::Utils::GetExecutablePath(moduleName, _MAX_PATH); //retrieves the PATH for the current module
|
||||
|
||||
#ifdef AZ_MONOLITHIC_BUILD
|
||||
GetModuleFileName(NULL, moduleName, _MAX_PATH); //retrieves the PATH for the current module
|
||||
AZ::Utils::GetExecutablePath(moduleName, _MAX_PATH); //retrieves the PATH for the current module
|
||||
#else // AZ_MONOLITHIC_BUILD
|
||||
azstrcpy(moduleName, AZ_ARRAY_SIZE(moduleName), "CrySystem.dll"); // we want to version from the system dll
|
||||
#endif // AZ_MONOLITHIC_BUILD
|
||||
|
||||
int verSize = GetFileVersionInfoSize(moduleName, &dwHandle);
|
||||
AZStd::wstring moduleNameW;
|
||||
AZStd::to_wstring(moduleNameW, moduleName);
|
||||
int verSize = GetFileVersionInfoSizeW(moduleNameW.c_str(), &dwHandle);
|
||||
if (verSize > 0)
|
||||
{
|
||||
GetFileVersionInfo(moduleName, dwHandle, 1024 * 8, ver);
|
||||
GetFileVersionInfoW(moduleNameW.c_str(), dwHandle, 1024 * 8, ver);
|
||||
VS_FIXEDFILEINFO* vinfo;
|
||||
VerQueryValue(ver, "\\", (void**)&vinfo, &len);
|
||||
VerQueryValueW(ver, L"\\", (void**)&vinfo, &len);
|
||||
|
||||
const uint32 verIndices[4] = {0, 1, 2, 3};
|
||||
m_fileVersion.v[verIndices[0]] = m_productVersion.v[verIndices[0]] = vinfo->dwFileVersionLS & 0xFFFF;
|
||||
@@ -143,14 +145,14 @@ void CSystem::QueryVersionInfo()
|
||||
}* lpTranslate;
|
||||
|
||||
UINT count = 0;
|
||||
char path[256];
|
||||
wchar_t path[256];
|
||||
char* version = NULL;
|
||||
|
||||
VerQueryValue(ver, "\\VarFileInfo\\Translation", (LPVOID*)&lpTranslate, &count);
|
||||
VerQueryValueW(ver, L"\\VarFileInfo\\Translation", (LPVOID*)&lpTranslate, &count);
|
||||
if (lpTranslate != NULL)
|
||||
{
|
||||
azsnprintf(path, sizeof(path), "\\StringFileInfo\\%04x%04x\\InternalName", lpTranslate[0].wLanguage, lpTranslate[0].wCodePage);
|
||||
VerQueryValue(ver, path, (LPVOID*)&version, &count);
|
||||
azsnwprintf(path, sizeof(path), L"\\StringFileInfo\\%04x%04x\\InternalName", lpTranslate[0].wLanguage, lpTranslate[0].wCodePage);
|
||||
VerQueryValueW(ver, path, (LPVOID*)&version, &count);
|
||||
if (version)
|
||||
{
|
||||
m_buildVersion.Set(version);
|
||||
@@ -211,7 +213,7 @@ void CSystem::LogVersion()
|
||||
CryLogAlways("Running 64 bit Mac version");
|
||||
#endif
|
||||
#if AZ_LEGACY_CRYSYSTEM_TRAIT_SYSTEMCFG_MODULENAME
|
||||
GetModuleFileName(NULL, s, sizeof(s));
|
||||
AZ::Utils::GetExecutablePath(s, sizeof(s));
|
||||
|
||||
// Log EXE filename only if possible (not full EXE path which could contain sensitive info)
|
||||
AZStd::string exeName;
|
||||
@@ -279,7 +281,7 @@ public:
|
||||
int nFlags = pCVar->GetFlags();
|
||||
if (((nFlags & VF_DUMPTODISK) && (nFlags & VF_MODIFIED)) || (nFlags & VF_WASINCONFIG))
|
||||
{
|
||||
string szValue = pCVar->GetString();
|
||||
AZStd::string szValue = pCVar->GetString();
|
||||
int pos;
|
||||
|
||||
pos = 1;
|
||||
@@ -287,7 +289,7 @@ public:
|
||||
{
|
||||
pos = static_cast<int>(szValue.find_first_of("\\", pos));
|
||||
|
||||
if (pos == string::npos)
|
||||
if (pos == AZStd::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -302,7 +304,7 @@ public:
|
||||
{
|
||||
pos = static_cast<int>(szValue.find_first_of("\"", pos));
|
||||
|
||||
if (pos == string::npos)
|
||||
if (pos == AZStd::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -311,7 +313,7 @@ public:
|
||||
pos += 2;
|
||||
}
|
||||
|
||||
string szLine = pCVar->GetName();
|
||||
AZStd::string szLine = pCVar->GetName();
|
||||
|
||||
if (pCVar->GetType() == CVAR_STRING)
|
||||
{
|
||||
@@ -344,7 +346,7 @@ void CSystem::SaveConfiguration()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// system cfg
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CSystemConfiguration::CSystemConfiguration(const string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing)
|
||||
CSystemConfiguration::CSystemConfiguration(const AZStd::string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing)
|
||||
: m_strSysConfigFilePath(strSysConfigFilePath)
|
||||
, m_bError(false)
|
||||
, m_pSink(pSink)
|
||||
@@ -364,14 +366,14 @@ CSystemConfiguration::~CSystemConfiguration()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CSystemConfiguration::ParseSystemConfig()
|
||||
{
|
||||
string filename = m_strSysConfigFilePath;
|
||||
if (strlen(PathUtil::GetExt(filename)) == 0)
|
||||
AZStd::string filename = m_strSysConfigFilePath;
|
||||
if (strlen(PathUtil::GetExt(filename.c_str())) == 0)
|
||||
{
|
||||
filename = PathUtil::ReplaceExtension(filename, "cfg");
|
||||
}
|
||||
|
||||
CCryFile file;
|
||||
string filenameLog;
|
||||
AZStd::string filenameLog;
|
||||
{
|
||||
int flags = AZ::IO::IArchive::FOPEN_HINT_QUIET | AZ::IO::IArchive::FOPEN_ONDISK;
|
||||
|
||||
@@ -380,7 +382,7 @@ bool CSystemConfiguration::ParseSystemConfig()
|
||||
// this is used when theres a very specific file to read, like @user@/game.cfg which is read
|
||||
// IN ADDITION to the one in the game folder, and afterwards to override values in it.
|
||||
// if the file is missing and its already prefixed with an alias, there is no need to look any further.
|
||||
if (!(file.Open(filename, "rb", flags)))
|
||||
if (!(file.Open(filename.c_str(), "rb", flags)))
|
||||
{
|
||||
if (m_warnIfMissing)
|
||||
{
|
||||
@@ -394,11 +396,11 @@ bool CSystemConfiguration::ParseSystemConfig()
|
||||
// otherwise, if the file isn't prefixed with an alias, then its likely one of the convenience mappings
|
||||
// to either root or assets/config. this is done so that code can just request a simple file name and get its data
|
||||
if (
|
||||
!(file.Open(filename, "rb", flags)) &&
|
||||
!(file.Open(string("@root@/") + filename, "rb", flags)) &&
|
||||
!(file.Open(string("@assets@/") + filename, "rb", flags)) &&
|
||||
!(file.Open(string("@assets@/config/") + filename, "rb", flags)) &&
|
||||
!(file.Open(string("@assets@/config/spec/") + filename, "rb", flags))
|
||||
!(file.Open(filename.c_str(), "rb", flags)) &&
|
||||
!(file.Open((AZStd::string("@root@/") + filename).c_str(), "rb", flags)) &&
|
||||
!(file.Open((AZStd::string("@assets@/") + filename).c_str(), "rb", flags)) &&
|
||||
!(file.Open((AZStd::string("@assets@/config/") + filename).c_str(), "rb", flags)) &&
|
||||
!(file.Open((AZStd::string("@assets@/config/spec/") + filename).c_str(), "rb", flags))
|
||||
)
|
||||
{
|
||||
if (m_warnIfMissing)
|
||||
@@ -429,7 +431,7 @@ bool CSystemConfiguration::ParseSystemConfig()
|
||||
sAllText[nLen] = '\0';
|
||||
sAllText[nLen + 1] = '\0';
|
||||
|
||||
string strGroup; // current group e.g. "[General]"
|
||||
AZStd::string strGroup; // current group e.g. "[General]"
|
||||
|
||||
char* strLast = sAllText + nLen;
|
||||
char* str = sAllText;
|
||||
@@ -447,26 +449,25 @@ bool CSystemConfiguration::ParseSystemConfig()
|
||||
str++;
|
||||
}
|
||||
|
||||
string strLine = s;
|
||||
AZStd::string strLine = s;
|
||||
AZ::StringFunc::TrimWhiteSpace(strLine, true, true);
|
||||
|
||||
// detect groups e.g. "[General]" should set strGroup="General"
|
||||
{
|
||||
string strTrimmedLine(RemoveWhiteSpaces(strLine));
|
||||
size_t size = strTrimmedLine.size();
|
||||
size_t size = strLine.size();
|
||||
|
||||
if (size >= 3)
|
||||
{
|
||||
if (strTrimmedLine[0] == '[' && strTrimmedLine[size - 1] == ']') // currently no comments are allowed to be behind groups
|
||||
if (strLine[0] == '[' && strLine[size - 1] == ']') // currently no comments are allowed to be behind groups
|
||||
{
|
||||
strGroup = &strTrimmedLine[1];
|
||||
strGroup.resize(size - 2); // remove [ and ]
|
||||
strGroup = &strLine[1];
|
||||
strGroup.resize(size - 2); // remove [ and ]
|
||||
continue; // next line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//trim all whitespace characters at the beginning and the end of the current line and store its size
|
||||
strLine.Trim();
|
||||
size_t strLineSize = strLine.size();
|
||||
|
||||
//skip comments, comments start with ";" or "--" but may have preceding whitespace characters
|
||||
@@ -488,35 +489,36 @@ bool CSystemConfiguration::ParseSystemConfig()
|
||||
}
|
||||
|
||||
//if line contains a '=' try to read and assign console variable
|
||||
string::size_type posEq(strLine.find("=", 0));
|
||||
if (string::npos != posEq)
|
||||
AZStd::string::size_type posEq(strLine.find("=", 0));
|
||||
if (AZStd::string::npos != posEq)
|
||||
{
|
||||
string stemp(strLine, 0, posEq);
|
||||
string strKey(RemoveWhiteSpaces(stemp));
|
||||
AZStd::string stemp;
|
||||
AZStd::string strKey(strLine, 0, posEq);
|
||||
AZ::StringFunc::TrimWhiteSpace(strKey, true, true);
|
||||
|
||||
{
|
||||
// extract value
|
||||
string::size_type posValueStart(strLine.find("\"", posEq + 1) + 1);
|
||||
string::size_type posValueEnd(strLine.rfind('\"'));
|
||||
AZStd::string::size_type posValueStart(strLine.find("\"", posEq + 1) + 1);
|
||||
AZStd::string::size_type posValueEnd(strLine.rfind('\"'));
|
||||
|
||||
string strValue;
|
||||
AZStd::string strValue;
|
||||
|
||||
if (string::npos != posValueStart && string::npos != posValueEnd)
|
||||
if (AZStd::string::npos != posValueStart && AZStd::string::npos != posValueEnd)
|
||||
{
|
||||
strValue = string(strLine, posValueStart, posValueEnd - posValueStart);
|
||||
strValue = AZStd::string(strLine, posValueStart, posValueEnd - posValueStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
string strTmp(strLine, posEq + 1, strLine.size() - (posEq + 1));
|
||||
strValue = RemoveWhiteSpaces(strTmp);
|
||||
strValue = AZStd::string(strLine, posEq + 1, strLine.size() - (posEq + 1));
|
||||
AZ::StringFunc::TrimWhiteSpace(strValue, true, true);
|
||||
}
|
||||
|
||||
{
|
||||
// replace '\\\\' with '\\' and '\\\"' with '\"'
|
||||
strValue.replace("\\\\", "\\");
|
||||
strValue.replace("\\\"", "\"");
|
||||
AZ::StringFunc::Replace(strValue, "\\\\", "\\");
|
||||
AZ::StringFunc::Replace(strValue, "\\\"", "\"");
|
||||
|
||||
m_pSink->OnLoadConfigurationEntry(strKey, strValue, strGroup);
|
||||
m_pSink->OnLoadConfigurationEntry(strKey.c_str(), strValue.c_str(), strGroup.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,22 +15,16 @@
|
||||
#include <math.h>
|
||||
#include <map>
|
||||
|
||||
typedef string SysConfigKey;
|
||||
typedef string SysConfigValue;
|
||||
typedef AZStd::string SysConfigKey;
|
||||
typedef AZStd::string SysConfigValue;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CSystemConfiguration
|
||||
{
|
||||
public:
|
||||
CSystemConfiguration(const string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing = true);
|
||||
CSystemConfiguration(const AZStd::string& strSysConfigFilePath, CSystem* pSystem, ILoadConfigurationEntrySink* pSink, bool warnIfMissing = true);
|
||||
~CSystemConfiguration();
|
||||
|
||||
string RemoveWhiteSpaces(string& s)
|
||||
{
|
||||
s.Trim();
|
||||
return s;
|
||||
}
|
||||
|
||||
bool IsError() const { return m_bError; }
|
||||
|
||||
private: // ----------------------------------------
|
||||
@@ -39,10 +33,10 @@ private: // ----------------------------------------
|
||||
// success
|
||||
bool ParseSystemConfig();
|
||||
|
||||
CSystem* m_pSystem;
|
||||
string m_strSysConfigFilePath;
|
||||
bool m_bError;
|
||||
ILoadConfigurationEntrySink* m_pSink; // never 0
|
||||
CSystem* m_pSystem;
|
||||
AZStd::string m_strSysConfigFilePath;
|
||||
bool m_bError;
|
||||
ILoadConfigurationEntrySink* m_pSink; // never 0
|
||||
bool m_warnIfMissing;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "CryLibrary.h"
|
||||
#include "CryPath.h"
|
||||
#include <StringUtils.h>
|
||||
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
@@ -252,7 +251,7 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs)
|
||||
case 1:
|
||||
{
|
||||
int* p = 0;
|
||||
PREFAST_SUPPRESS_WARNING(6011) * p = 0xABCD;
|
||||
*p = 0xABCD;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@@ -452,7 +451,7 @@ AZStd::unique_ptr<AZ::DynamicModuleHandle> CSystem::LoadDLL(const char* dllName)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// After loading DLL initialize it by calling ModuleInitISystem
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
string moduleName = PathUtil::GetFileName(dllName);
|
||||
AZStd::string moduleName = PathUtil::GetFileName(dllName);
|
||||
|
||||
typedef void*(*PtrFunc_ModuleInitISystem)(ISystem* pSystem, const char* moduleName);
|
||||
PtrFunc_ModuleInitISystem pfnModuleInitISystem = handle->GetFunction<PtrFunc_ModuleInitISystem>(DLL_MODULE_INIT_ISYSTEM);
|
||||
@@ -524,7 +523,7 @@ void CSystem::ShutdownModuleLibraries()
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
wstring GetErrorStringUnsupportedGPU(const char* gpuName, unsigned int gpuVendorId, unsigned int gpuDeviceId)
|
||||
AZStd::wstring GetErrorStringUnsupportedGPU(const char* gpuName, unsigned int gpuVendorId, unsigned int gpuDeviceId)
|
||||
{
|
||||
const size_t fullLangID = (size_t) GetKeyboardLayout(0);
|
||||
const size_t primLangID = fullLangID & 0x3FF;
|
||||
@@ -878,37 +877,35 @@ void CSystem::InitLocalization()
|
||||
languageID = ILocalizationManager::EPlatformIndependentLanguageID::ePILID_English_US;
|
||||
}
|
||||
|
||||
string language = m_pLocalizationManager->LangNameFromPILID(languageID);
|
||||
AZStd::string language = m_pLocalizationManager->LangNameFromPILID(languageID);
|
||||
m_pLocalizationManager->SetLanguage(language.c_str());
|
||||
if (m_pLocalizationManager->GetLocalizationFormat() == 1)
|
||||
{
|
||||
string translationsListXML = LOCALIZATION_TRANSLATIONS_LIST_FILE_NAME;
|
||||
m_pLocalizationManager->InitLocalizationData(translationsListXML);
|
||||
AZStd::string translationsListXML = LOCALIZATION_TRANSLATIONS_LIST_FILE_NAME;
|
||||
m_pLocalizationManager->InitLocalizationData(translationsListXML.c_str());
|
||||
|
||||
m_pLocalizationManager->LoadAllLocalizationData();
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the language value cannot be found, let's default to the english pak
|
||||
OpenLanguagePak(language);
|
||||
OpenLanguagePak(language.c_str());
|
||||
}
|
||||
|
||||
if (auto console = AZ::Interface<AZ::IConsole>::Get(); console != nullptr)
|
||||
{
|
||||
AZ::CVarFixedString languageAudio;
|
||||
if (auto result = console->GetCvarValue("g_languageAudio", languageAudio); result == AZ::GetValueResult::Success)
|
||||
console->GetCvarValue("g_languageAudio", languageAudio);
|
||||
if (languageAudio.empty())
|
||||
{
|
||||
if (languageAudio.size() == 0)
|
||||
{
|
||||
console->PerformCommand(AZStd::string::format("g_languageAudio %s", language.c_str()).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
language.assign(languageAudio.data(), languageAudio.size());
|
||||
}
|
||||
console->PerformCommand(AZStd::string::format("g_languageAudio %s", language.c_str()).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
language.assign(languageAudio.data(), languageAudio.size());
|
||||
}
|
||||
}
|
||||
OpenLanguageAudioPak(language);
|
||||
OpenLanguageAudioPak(language.c_str());
|
||||
}
|
||||
|
||||
void CSystem::OpenBasicPaks()
|
||||
@@ -972,10 +969,10 @@ void CSystem::OpenLanguagePak(const char* sLanguage)
|
||||
// Initialize languages.
|
||||
|
||||
// Omit the trailing slash!
|
||||
string sLocalizationFolder = PathUtil::GetLocalizationFolder();
|
||||
AZStd::string sLocalizationFolder = PathUtil::GetLocalizationFolder();
|
||||
|
||||
// load xml pak with full filenames to perform wildcard searches.
|
||||
string sLocalizedPath;
|
||||
AZStd::string sLocalizedPath;
|
||||
GetLocalizedPath(sLanguage, sLocalizedPath);
|
||||
if (!m_env.pCryPak->OpenPacks({ sLocalizationFolder.c_str(), sLocalizationFolder.size() }, { sLocalizedPath.c_str(), sLocalizedPath.size() }, 0))
|
||||
{
|
||||
@@ -1002,15 +999,15 @@ void CSystem::OpenLanguageAudioPak([[maybe_unused]] const char* sLanguage)
|
||||
int nPakFlags = 0;
|
||||
|
||||
// Omit the trailing slash!
|
||||
string sLocalizationFolder(string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1));
|
||||
AZStd::string sLocalizationFolder(AZStd::string().assign(PathUtil::GetLocalizationFolder(), 0, PathUtil::GetLocalizationFolder().size() - 1));
|
||||
|
||||
if (sLocalizationFolder.compareNoCase("Languages") == 0)
|
||||
if (!AZ::StringFunc::Equal(sLocalizationFolder, "Languages", false))
|
||||
{
|
||||
sLocalizationFolder = "@assets@";
|
||||
}
|
||||
|
||||
// load localized pak with crc32 filenames on consoles to save memory.
|
||||
string sLocalizedPath = "loc.pak";
|
||||
AZStd::string sLocalizedPath = "loc.pak";
|
||||
|
||||
if (!m_env.pCryPak->OpenPacks(sLocalizationFolder.c_str(), sLocalizedPath.c_str(), nPakFlags))
|
||||
{
|
||||
@@ -1020,10 +1017,10 @@ void CSystem::OpenLanguageAudioPak([[maybe_unused]] const char* sLanguage)
|
||||
}
|
||||
|
||||
|
||||
string GetUniqueLogFileName(string logFileName)
|
||||
AZStd::string GetUniqueLogFileName(AZStd::string logFileName)
|
||||
{
|
||||
string logFileNamePrefix = logFileName;
|
||||
if ((logFileNamePrefix[0] != '@') && (AzFramework::StringFunc::Path::IsRelative(logFileNamePrefix)))
|
||||
AZStd::string logFileNamePrefix = logFileName;
|
||||
if ((logFileNamePrefix[0] != '@') && (AzFramework::StringFunc::Path::IsRelative(logFileNamePrefix.c_str())))
|
||||
{
|
||||
logFileNamePrefix = "@log@/";
|
||||
logFileNamePrefix += logFileName;
|
||||
@@ -1039,9 +1036,9 @@ string GetUniqueLogFileName(string logFileName)
|
||||
return logFileNamePrefix;
|
||||
}
|
||||
|
||||
string logFileExtension;
|
||||
AZStd::string logFileExtension;
|
||||
size_t extensionIndex = logFileName.find_last_of('.');
|
||||
if (extensionIndex != string::npos)
|
||||
if (extensionIndex != AZStd::string::npos)
|
||||
{
|
||||
logFileExtension = logFileName.substr(extensionIndex, logFileName.length() - extensionIndex);
|
||||
logFileNamePrefix = logFileName.substr(0, extensionIndex);
|
||||
@@ -1215,7 +1212,7 @@ bool CSystem::Init(const SSystemInitParams& startupParams)
|
||||
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option")
|
||||
GetVersionExA(&osvi);
|
||||
GetVersionExW(&osvi);
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
bool bIsWindowsXPorLater = osvi.dwMajorVersion > 5 || (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1);
|
||||
@@ -1310,7 +1307,7 @@ AZ_POP_DISABLE_WARNING
|
||||
}
|
||||
else if (startupParams.sLogFileName) //otherwise see if the startup params has a log file name, if so use it
|
||||
{
|
||||
const string sUniqueLogFileName = GetUniqueLogFileName(startupParams.sLogFileName);
|
||||
const AZStd::string sUniqueLogFileName = GetUniqueLogFileName(startupParams.sLogFileName);
|
||||
m_env.pLog->SetFileName(sUniqueLogFileName.c_str(), startupParams.autoBackupLogs);
|
||||
}
|
||||
else//use the default log name
|
||||
@@ -1658,20 +1655,20 @@ static void LoadConfigurationCmd(IConsoleCmdArgs* pParams)
|
||||
return;
|
||||
}
|
||||
|
||||
GetISystem()->LoadConfiguration(string("Config/") + pParams->GetArg(1));
|
||||
GetISystem()->LoadConfiguration((AZStd::string("Config/") + pParams->GetArg(1)).c_str());
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
static string ConcatPath(const char* szPart1, const char* szPart2)
|
||||
static AZStd::string ConcatPath(const char* szPart1, const char* szPart2)
|
||||
{
|
||||
if (szPart1[0] == 0)
|
||||
{
|
||||
return szPart2;
|
||||
}
|
||||
|
||||
string ret;
|
||||
AZStd::string ret;
|
||||
|
||||
ret.reserve(strlen(szPart1) + 1 + strlen(szPart2));
|
||||
|
||||
@@ -2135,12 +2132,12 @@ void CSystem::CreateAudioVars()
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
void CSystem::AddCVarGroupDirectory(const string& sPath)
|
||||
void CSystem::AddCVarGroupDirectory(const AZStd::string& sPath)
|
||||
{
|
||||
CryLog("creating CVarGroups from directory '%s' ...", sPath.c_str());
|
||||
INDENT_LOG_DURING_SCOPE();
|
||||
|
||||
AZ::IO::ArchiveFileIterator handle = gEnv->pCryPak->FindFirst(ConcatPath(sPath, "*.cfg").c_str());
|
||||
AZ::IO::ArchiveFileIterator handle = gEnv->pCryPak->FindFirst(ConcatPath(sPath.c_str(), "*.cfg").c_str());
|
||||
|
||||
if (!handle)
|
||||
{
|
||||
@@ -2153,16 +2150,9 @@ void CSystem::AddCVarGroupDirectory(const string& sPath)
|
||||
{
|
||||
if (handle.m_filename != "." && handle.m_filename != "..")
|
||||
{
|
||||
AddCVarGroupDirectory(ConcatPath(sPath, handle.m_filename.data()));
|
||||
AddCVarGroupDirectory(ConcatPath(sPath.c_str(), handle.m_filename.data()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string sFilePath = ConcatPath(sPath, handle.m_filename.data());
|
||||
|
||||
string sCVarName = sFilePath;
|
||||
PathUtil::RemoveExtension(sCVarName);
|
||||
}
|
||||
} while (handle = gEnv->pCryPak->FindNext(handle));
|
||||
|
||||
gEnv->pCryPak->FindClose(handle);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <IMovieSystem.h>
|
||||
#include <ILog.h>
|
||||
#include <CryLibrary.h>
|
||||
#include <StringUtils.h>
|
||||
#include <AzCore/Debug/StackTracer.h>
|
||||
#include <AzCore/IO/SystemFile.h> // for AZ_MAX_PATH_LEN
|
||||
#include <AzCore/std/allocator_stack.h>
|
||||
@@ -127,7 +126,7 @@ const char* CSystem::GetUserName()
|
||||
DWORD dwSize = iNameBufferSize;
|
||||
wchar_t nameW[iNameBufferSize];
|
||||
::GetUserNameW(nameW, &dwSize);
|
||||
cry_strcpy(szNameBuffer, CryStringUtils::WStrToUTF8(nameW));
|
||||
AZStd::to_string(szNameBuffer, iNameBufferSize, { nameW, dwSize });
|
||||
return szNameBuffer;
|
||||
#else
|
||||
#if defined(LINUX)
|
||||
@@ -171,12 +170,12 @@ int CSystem::GetApplicationInstance()
|
||||
// this code below essentially "locks" an instance of the USER folder to a specific running application
|
||||
if (m_iApplicationInstance == -1)
|
||||
{
|
||||
string suffix;
|
||||
AZStd::wstring suffix;
|
||||
for (int instance = 0;; ++instance)
|
||||
{
|
||||
suffix.Format("(%d)", instance);
|
||||
suffix = AZStd::wstring::format(L"O3DEApplication(%d)", instance);
|
||||
|
||||
CreateMutex(NULL, TRUE, "LumberyardApplication" + suffix);
|
||||
CreateMutexW(NULL, TRUE, suffix.c_str());
|
||||
// search for duplicates
|
||||
if (GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
@@ -195,13 +194,13 @@ int CSystem::GetApplicationInstance()
|
||||
int CSystem::GetApplicationLogInstance([[maybe_unused]] const char* logFilePath)
|
||||
{
|
||||
#if AZ_TRAIT_OS_USE_WINDOWS_MUTEX
|
||||
string suffix;
|
||||
AZStd::wstring suffix;
|
||||
int instance = 0;
|
||||
for (;; ++instance)
|
||||
{
|
||||
suffix.Format("(%d)", instance);
|
||||
suffix = AZStd::wstring::format(L"%s(%d)", logFilePath, instance);
|
||||
|
||||
CreateMutex(NULL, TRUE, logFilePath + suffix);
|
||||
CreateMutexW(NULL, TRUE, suffix.c_str());
|
||||
if (GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
break;
|
||||
@@ -218,30 +217,11 @@ struct CryDbgModule
|
||||
{
|
||||
HANDLE heap;
|
||||
WIN_HMODULE handle;
|
||||
string name;
|
||||
AZStd::string name;
|
||||
DWORD dwSize;
|
||||
};
|
||||
|
||||
#ifdef WIN32
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CStringOrder
|
||||
{
|
||||
public:
|
||||
bool operator () (const char* szLeft, const char* szRight) const {return azstricmp(szLeft, szRight) < 0; }
|
||||
};
|
||||
typedef std::map<const char*, unsigned, CStringOrder> StringToSizeMap;
|
||||
void AddSize (StringToSizeMap& mapSS, const char* szString, unsigned nSize)
|
||||
{
|
||||
StringToSizeMap::iterator it = mapSS.find (szString);
|
||||
if (it == mapSS.end())
|
||||
{
|
||||
mapSS.insert (StringToSizeMap::value_type(szString, nSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second += nSize;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* GetModuleGroup (const char* szString)
|
||||
@@ -283,7 +263,7 @@ static const char* GetLastSystemErrorMessage()
|
||||
0,
|
||||
NULL))
|
||||
{
|
||||
cry_strcpy(szBuffer, (char*)lpMsgBuf);
|
||||
azstrcpy(szBuffer, AZ_ARRAY_SIZE(szBuffer), (char*)lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
else
|
||||
@@ -343,44 +323,40 @@ void CSystem::FatalError(const char* format, ...)
|
||||
assert(szBuffer[0] >= ' ');
|
||||
// strcpy(szBuffer,szBuffer+1); // remove verbosity tag since it is not supported by ::MessageBox
|
||||
|
||||
OutputDebugString(szBuffer);
|
||||
AZ::Debug::Platform::OutputToDebugger("CrySystem", szBuffer);
|
||||
|
||||
#ifdef WIN32
|
||||
OnFatalError(szBuffer);
|
||||
if (!g_cvars.sys_no_crash_dialog)
|
||||
{
|
||||
::MessageBox(NULL, szBuffer, "Open 3D Engine Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
|
||||
AZStd::wstring szBufferW;
|
||||
AZStd::to_wstring(szBufferW, szBuffer);
|
||||
::MessageBoxW(NULL, szBufferW.c_str(), L"Open 3D Engine Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
|
||||
}
|
||||
|
||||
// Dump callstack.
|
||||
IDebugCallStack::instance()->FatalError(szBuffer);
|
||||
#endif
|
||||
|
||||
CryDebugBreak();
|
||||
|
||||
// app can not continue
|
||||
AZ::Debug::Trace::Break();
|
||||
|
||||
#ifdef _DEBUG
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
_flushall();
|
||||
// on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
|
||||
TerminateProcess(GetCurrentProcess(), 1);
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(WIN64)
|
||||
DEBUG_BREAK;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
_flushall();
|
||||
// on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
|
||||
TerminateProcess(GetCurrentProcess(), 1);
|
||||
#endif
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
_exit(1);
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
_exit(1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -410,7 +386,7 @@ void CSystem::debug_GetCallStack(const char** pFunctions, int& nCount)
|
||||
unsigned int numFrames = StackRecorder::Record(frames, nMaxCount, 1);
|
||||
SymbolStorage::StackLine* textLines = (SymbolStorage::StackLine*)AZ_ALLOCA(sizeof(SymbolStorage::StackLine)*nMaxCount);
|
||||
SymbolStorage::DecodeFrames(frames, numFrames, textLines);
|
||||
for (int i = 0; i < numFrames; i++)
|
||||
for (unsigned int i = 0; i < numFrames; i++)
|
||||
{
|
||||
pFunctions[i] = textLines[i];
|
||||
}
|
||||
@@ -461,20 +437,20 @@ bool CSystem::ReLaunchMediaCenter()
|
||||
}
|
||||
|
||||
// Get the path to Media Center
|
||||
char szExpandedPath[AZ_MAX_PATH_LEN];
|
||||
if (!ExpandEnvironmentStrings("%SystemRoot%\\ehome\\ehshell.exe", szExpandedPath, AZ_MAX_PATH_LEN))
|
||||
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 (GetFileAttributes(szExpandedPath) == 0xFFFFFFFF)
|
||||
if (GetFileAttributesW(szExpandedPath) == 0xFFFFFFFF)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Launch ehshell.exe
|
||||
INT_PTR result = (INT_PTR)ShellExecute(NULL, TEXT("open"), szExpandedPath, NULL, NULL, SW_SHOWNORMAL);
|
||||
INT_PTR result = (INT_PTR)ShellExecuteW(NULL, TEXT("open"), szExpandedPath, NULL, NULL, SW_SHOWNORMAL);
|
||||
return (result > 32);
|
||||
}
|
||||
#else
|
||||
@@ -491,7 +467,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
|
||||
bool bSucceeded = false;
|
||||
// check Vista and later OS first
|
||||
|
||||
HMODULE shell32 = LoadLibraryA("Shell32.dll");
|
||||
HMODULE shell32 = LoadLibraryW(L"Shell32.dll");
|
||||
if (shell32)
|
||||
{
|
||||
typedef long (__stdcall * T_SHGetKnownFolderPath)(REFKNOWNFOLDERID rfid, unsigned long dwFlags, void* hToken, wchar_t** ppszPath);
|
||||
@@ -505,7 +481,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
|
||||
if (bSucceeded)
|
||||
{
|
||||
// Convert from UNICODE to UTF-8
|
||||
cry_strcpy(szMyDocumentsPath, maxPathSize, CryStringUtils::WStrToUTF8(wMyDocumentsPath));
|
||||
AZStd::to_string(szMyDocumentsPath, maxPathSize, wMyDocumentsPath);
|
||||
CoTaskMemFree(wMyDocumentsPath);
|
||||
}
|
||||
}
|
||||
@@ -519,7 +495,7 @@ bool CSystem::GetWinGameFolder(char* szMyDocumentsPath, int maxPathSize)
|
||||
bSucceeded = SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, wMyDocumentsPath));
|
||||
if (bSucceeded)
|
||||
{
|
||||
cry_strcpy(szMyDocumentsPath, maxPathSize, CryStringUtils::WStrToUTF8(wMyDocumentsPath));
|
||||
AZStd::to_string(szMyDocumentsPath, maxPathSize, wMyDocumentsPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +523,7 @@ void CSystem::DetectGameFolderAccessRights()
|
||||
BOOL bAccessStatus = FALSE;
|
||||
|
||||
// Get a pointer to the existing DACL.
|
||||
dwRes = GetNamedSecurityInfo(".", SE_FILE_OBJECT,
|
||||
dwRes = GetNamedSecurityInfoW(L".", SE_FILE_OBJECT,
|
||||
DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
|
||||
NULL, NULL, &pDACL, NULL, &pSD);
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ DebugCamera::~DebugCamera()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void DebugCamera::OnEnable()
|
||||
{
|
||||
m_position = gEnv->pSystem->GetViewCamera().GetPosition();
|
||||
m_position = Vec3_Zero;
|
||||
m_moveInput = Vec3_Zero;
|
||||
|
||||
Ang3 cameraAngles = Ang3(gEnv->pSystem->GetViewCamera().GetMatrix());
|
||||
Ang3 cameraAngles = Ang3(ZERO);
|
||||
m_cameraYaw = RAD2DEG(cameraAngles.z);
|
||||
m_cameraPitch = RAD2DEG(cameraAngles.x);
|
||||
m_view = Matrix33(Ang3(DEG2RAD(m_cameraPitch), 0.0f, DEG2RAD(m_cameraYaw)));
|
||||
@@ -126,13 +126,6 @@ void DebugCamera::Update()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void DebugCamera::PostUpdate()
|
||||
{
|
||||
if (m_cameraMode == DebugCamera::ModeOff)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CCamera& camera = gEnv->pSystem->GetViewCamera();
|
||||
camera.SetMatrix(Matrix34(m_view, m_position));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -55,79 +55,9 @@ void CView::Release()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void CView::Update(float frameTime, bool isActive)
|
||||
void CView::Update([[maybe_unused]] float frameTime, [[maybe_unused]] bool isActive)
|
||||
{
|
||||
//FIXME:some cameras may need to be updated always
|
||||
if (!isActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_azEntity)
|
||||
{
|
||||
m_viewParams.SaveLast();
|
||||
|
||||
CCamera* pSysCam = &m_pSystem->GetViewCamera();
|
||||
|
||||
//process screen shaking
|
||||
ProcessShaking(frameTime);
|
||||
|
||||
//FIXME:to let the updateView implementation use the correct shakeVector
|
||||
m_viewParams.currentShakeShift = m_viewParams.rotation * m_viewParams.currentShakeShift;
|
||||
|
||||
m_viewParams.frameTime = frameTime;
|
||||
//update view position/rotation
|
||||
if (m_azEntity != nullptr)
|
||||
{
|
||||
auto entityTransform = m_azEntity->GetTransform();
|
||||
if (entityTransform != nullptr)
|
||||
{
|
||||
AZ::Transform transform = entityTransform->GetWorldTM();
|
||||
m_viewParams.position = AZVec3ToLYVec3(transform.GetTranslation());
|
||||
m_viewParams.rotation = AZQuaternionToLYQuaternion(transform.GetRotation());
|
||||
}
|
||||
}
|
||||
|
||||
ApplyFrameAdditiveAngles(m_viewParams.rotation);
|
||||
|
||||
const float fNearZ = gEnv->pSystem->GetIViewSystem()->GetDefaultZNear();
|
||||
|
||||
//see if the view have to use a custom near clipping plane
|
||||
const float nearPlane = (m_viewParams.nearplane >= CAMERA_MIN_NEAR) ? (m_viewParams.nearplane) : fNearZ;
|
||||
const float farPlane = (m_viewParams.farplane > 0.f) ? m_viewParams.farplane : DEFAULT_FAR;
|
||||
float fov = (m_viewParams.fov < 0.001f) ? DEFAULT_FOV : m_viewParams.fov;
|
||||
|
||||
m_camera.SetFrustum(pSysCam->GetViewSurfaceX(), pSysCam->GetViewSurfaceZ(), fov, nearPlane, farPlane, pSysCam->GetPixelAspectRatio());
|
||||
|
||||
//apply shake & set the view matrix
|
||||
m_viewParams.rotation *= m_viewParams.currentShakeQuat;
|
||||
m_viewParams.rotation.NormalizeSafe();
|
||||
m_viewParams.position += m_viewParams.currentShakeShift;
|
||||
|
||||
// Blending between cameras needs to happen after Camera space rendering calculations have been applied
|
||||
// so that the m_viewParams.position is in World Space again
|
||||
m_viewParams.UpdateBlending(frameTime);
|
||||
|
||||
// [VR] specific
|
||||
// Add HMD's pose tracking on top of current camera pose
|
||||
// Each game-title can decide whether to keep this functionality here or (most likely)
|
||||
// move it somewhere else.
|
||||
|
||||
Quat q = m_viewParams.rotation;
|
||||
Vec3 pos = m_viewParams.position;
|
||||
Vec3 p = Vec3(ZERO);
|
||||
|
||||
Matrix34 viewMtx(q);
|
||||
viewMtx.SetTranslation(pos + p);
|
||||
m_camera.SetMatrix(viewMtx);
|
||||
|
||||
m_camera.SetEntityRotation(m_viewParams.rotation);
|
||||
m_camera.SetEntityPos(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_linkedTo = AZ::EntityId(0);
|
||||
}
|
||||
AZ_ErrorOnce("CryLegacy", false, "CryLegacy view system no longer available (CView::Update)");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
if (count > 0) \
|
||||
{ \
|
||||
const size_t memSize = count * sizeof(IViewSystemListener*); \
|
||||
PREFAST_SUPPRESS_WARNING(6255) IViewSystemListener * *pArray = (IViewSystemListener**) alloca(memSize); \
|
||||
IViewSystemListener* *pArray = (IViewSystemListener**) alloca(memSize); \
|
||||
memcpy(pArray, &*m_listeners.begin(), memSize); \
|
||||
while (count--) \
|
||||
{ \
|
||||
@@ -253,7 +253,7 @@ void CViewSystem::Update(float frameTime)
|
||||
}
|
||||
}
|
||||
|
||||
m_pSystem->SetViewCamera(rCamera);
|
||||
AZ_ErrorOnce("CryLegacy", false, "CryLegacy view system no longer available (CViewSystem::Update)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,23 +557,7 @@ void CViewSystem::SetOverrideCameraRotation(bool bOverride, Quat rotation)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CViewSystem::UpdateSoundListeners()
|
||||
{
|
||||
assert(gEnv->IsEditor() && !gEnv->IsEditorGameMode());
|
||||
|
||||
// In Editor we may want to control global listeners outside of the game view.
|
||||
if (m_bControlsAudioListeners)
|
||||
{
|
||||
IView* const pActiveView = static_cast<IView*>(GetActiveView());
|
||||
TViewMap::const_iterator Iter(m_views.begin());
|
||||
TViewMap::const_iterator const IterEnd(m_views.end());
|
||||
|
||||
for (; Iter != IterEnd; ++Iter)
|
||||
{
|
||||
IView* const pView = Iter->second;
|
||||
bool const bIsActive = (pView == pActiveView);
|
||||
CCamera const& rCamera = bIsActive ? gEnv->pSystem->GetViewCamera() : pView->GetCamera();
|
||||
pView->UpdateAudioListener(rCamera.GetMatrix());
|
||||
}
|
||||
}
|
||||
AZ_ErrorOnce("CryLegacy", false, "CryLegacy view system no longer available (CViewSystem::UpdateSoundListeners)");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -66,7 +66,9 @@ LONG WINAPI CryEngineExceptionFilterMiniDump(struct _EXCEPTION_POINTERS* pExcept
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
HANDLE hFile = ::CreateFile(szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
AZStd::wstring szDumpPathW;
|
||||
AZStd::to_wstring(szDumpPathW, szDumpPath);
|
||||
HANDLE hFile = ::CreateFileW(szDumpPathW.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CryLogAlways("Failed to record DMP file: could not open file '%s' for writing - error code: %d", szDumpPath, GetLastError());
|
||||
|
||||
+108
-179
@@ -15,9 +15,6 @@
|
||||
#include "XConsoleVariable.h"
|
||||
#include "System.h"
|
||||
#include "ConsoleBatchFile.h"
|
||||
#include "StringUtils.h"
|
||||
#include "UnicodeFunctions.h"
|
||||
#include "UnicodeIterator.h"
|
||||
|
||||
#include <ITimer.h>
|
||||
#include <IRenderer.h>
|
||||
@@ -87,33 +84,6 @@ inline int GetCharPrio(char x)
|
||||
return x;
|
||||
}
|
||||
}
|
||||
// case sensitive
|
||||
inline bool less_CVar(const char* left, const char* right)
|
||||
{
|
||||
for (;; )
|
||||
{
|
||||
uint32 l = GetCharPrio(*left), r = GetCharPrio(*right);
|
||||
|
||||
if (l < r)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (l > r)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*left == 0 || *right == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++left;
|
||||
++right;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Command_SetWaitSeconds(IConsoleCmdArgs* pCmd)
|
||||
{
|
||||
@@ -149,7 +119,7 @@ void Bind(IConsoleCmdArgs* cmdArgs)
|
||||
{
|
||||
if (cmdArgs->GetArgCount() >= 3)
|
||||
{
|
||||
string arg;
|
||||
AZStd::string arg;
|
||||
for (int i = 2; i < cmdArgs->GetArgCount(); ++i)
|
||||
{
|
||||
arg += cmdArgs->GetArg(i);
|
||||
@@ -348,28 +318,6 @@ void CXConsole::Init(ISystem* pSystem)
|
||||
con_restricted = 0;
|
||||
}
|
||||
|
||||
// test cases -----------------------------------------------
|
||||
assert(GetCVar("con_debug") != 0); // should be registered a few lines above
|
||||
assert(GetCVar("Con_Debug") == GetCVar("con_debug")); // different case
|
||||
|
||||
// editor
|
||||
assert(strcmp(AutoComplete("con_"), "con_debug") == 0);
|
||||
assert(strcmp(AutoComplete("CON_"), "con_debug") == 0);
|
||||
assert(strcmp(AutoComplete("con_debug"), "con_display_last_messages") == 0); // actually we should reconsider this behavior
|
||||
assert(strcmp(AutoComplete("Con_Debug"), "con_display_last_messages") == 0); // actually we should reconsider this behavior
|
||||
|
||||
// game
|
||||
assert(strcmp(ProcessCompletion("con_"), "con_debug ") == 0);
|
||||
ResetAutoCompletion();
|
||||
assert(strcmp(ProcessCompletion("CON_"), "con_debug ") == 0);
|
||||
ResetAutoCompletion();
|
||||
assert(strcmp(ProcessCompletion("con_debug"), "con_debug ") == 0);
|
||||
ResetAutoCompletion();
|
||||
assert(strcmp(ProcessCompletion("Con_Debug"), "con_debug ") == 0);
|
||||
ResetAutoCompletion();
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
m_nLoadingBackTexID = -1;
|
||||
|
||||
if (gEnv->IsDedicated())
|
||||
@@ -414,9 +362,7 @@ void CXConsole::Init(ISystem* pSystem)
|
||||
void CXConsole::LogChangeMessage(const char* name, const bool isConst, const bool isCheat, const bool isReadOnly, const bool isDeprecated,
|
||||
const char* oldValue, const char* newValue, [[maybe_unused]] const bool isProcessingGroup, const bool allowChange)
|
||||
{
|
||||
string logMessage;
|
||||
|
||||
logMessage.Format
|
||||
AZStd::string logMessage = AZStd::string::format
|
||||
("[CVARS]: [%s] variable [%s] from [%s] to [%s]%s; Marked as%s%s%s%s",
|
||||
(allowChange) ? "CHANGED" : "IGNORED CHANGE",
|
||||
name,
|
||||
@@ -452,7 +398,7 @@ void CXConsole::RegisterVar(ICVar* pCVar, ConsoleVarFunc pChangeFunc)
|
||||
bool isReadOnly = ((pCVar->GetFlags() & VF_READONLY) != 0);
|
||||
bool isDeprecated = ((pCVar->GetFlags() & VF_DEPRECATED) != 0);
|
||||
|
||||
ConfigVars::iterator it = m_configVars.find(CONST_TEMP_STRING(pCVar->GetName()));
|
||||
ConfigVars::iterator it = m_configVars.find(pCVar->GetName());
|
||||
if (it != m_configVars.end())
|
||||
{
|
||||
SConfigVar& var = it->second;
|
||||
@@ -906,7 +852,7 @@ void CXConsole::DumpKeyBinds(IKeyBindDumpSink* pCallback)
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const char* CXConsole::FindKeyBind(const char* sCmd) const
|
||||
{
|
||||
ConsoleBindsMap::const_iterator it = m_mapBinds.find(CONST_TEMP_STRING(sCmd));
|
||||
ConsoleBindsMap::const_iterator it = m_mapBinds.find(sCmd);
|
||||
|
||||
if (it != m_mapBinds.end())
|
||||
{
|
||||
@@ -1263,9 +1209,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel)
|
||||
if (m_nCursorPos)
|
||||
{
|
||||
const char* pCursor = m_sInputBuffer.c_str() + m_nCursorPos;
|
||||
Unicode::CIterator<const char*, false> pUnicode(pCursor);
|
||||
--pUnicode; // Note: This moves back one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics)
|
||||
pCursor = pUnicode.GetPosition();
|
||||
pCursor -= Utf8::Internal::sequence_length(pCursor); // Note: This moves back one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics)
|
||||
m_nCursorPos = pCursor - m_sInputBuffer.c_str();
|
||||
}
|
||||
return true;
|
||||
@@ -1275,9 +1219,7 @@ bool CXConsole::ProcessInput(const AzFramework::InputChannel& inputChannel)
|
||||
if (m_nCursorPos < (int)(m_sInputBuffer.length()))
|
||||
{
|
||||
const char* pCursor = m_sInputBuffer.c_str() + m_nCursorPos;
|
||||
Unicode::CIterator<const char*, false> pUnicode(pCursor);
|
||||
++pUnicode; // Note: This moves forward one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics)
|
||||
pCursor = pUnicode.GetPosition();
|
||||
pCursor += Utf8::Internal::sequence_length(pCursor); // Note: This moves forward one UCS code-point, but doesn't necessarily match one displayed character (ie, combining diacritics)
|
||||
m_nCursorPos = pCursor - m_sInputBuffer.c_str();
|
||||
}
|
||||
return true;
|
||||
@@ -1446,7 +1388,7 @@ bool CXConsole::GetLineNo(const int indwLineNo, char* outszBuffer, const int ind
|
||||
{
|
||||
buf++; // to jump over verbosity level character
|
||||
}
|
||||
cry_strcpy(outszBuffer, indwBufferSize, buf);
|
||||
azstrcpy(outszBuffer, indwBufferSize, buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1552,33 +1494,33 @@ const char* CXConsole::GetFlagsString(const uint32 dwFlags)
|
||||
static char sFlags[256];
|
||||
|
||||
// hiding this makes it a bit more difficult for cheaters
|
||||
// if(dwFlags&VF_CHEAT) cry_strcat( sFlags,"CHEAT, ");
|
||||
// if(dwFlags&VF_CHEAT) azstrcat( sFlags,"CHEAT, ");
|
||||
|
||||
cry_strcpy(sFlags, "");
|
||||
azstrcpy(sFlags, AZ_ARRAY_SIZE(sFlags), "");
|
||||
|
||||
if (dwFlags & VF_READONLY)
|
||||
{
|
||||
cry_strcat(sFlags, "READONLY, ");
|
||||
azstrcat(sFlags, AZ_ARRAY_SIZE(sFlags), "READONLY, ");
|
||||
}
|
||||
if (dwFlags & VF_DEPRECATED)
|
||||
{
|
||||
cry_strcat(sFlags, "DEPRECATED, ");
|
||||
azstrcat(sFlags, AZ_ARRAY_SIZE(sFlags), "DEPRECATED, ");
|
||||
}
|
||||
if (dwFlags & VF_DUMPTODISK)
|
||||
{
|
||||
cry_strcat(sFlags, "DUMPTODISK, ");
|
||||
azstrcat(sFlags, AZ_ARRAY_SIZE(sFlags), "DUMPTODISK, ");
|
||||
}
|
||||
if (dwFlags & VF_REQUIRE_LEVEL_RELOAD)
|
||||
{
|
||||
cry_strcat(sFlags, "REQUIRE_LEVEL_RELOAD, ");
|
||||
azstrcat(sFlags, AZ_ARRAY_SIZE(sFlags), "REQUIRE_LEVEL_RELOAD, ");
|
||||
}
|
||||
if (dwFlags & VF_REQUIRE_APP_RESTART)
|
||||
{
|
||||
cry_strcat(sFlags, "REQUIRE_APP_RESTART, ");
|
||||
azstrcat(sFlags, AZ_ARRAY_SIZE(sFlags), "REQUIRE_APP_RESTART, ");
|
||||
}
|
||||
if (dwFlags & VF_RESTRICTEDMODE)
|
||||
{
|
||||
cry_strcat(sFlags, "RESTRICTEDMODE, ");
|
||||
azstrcat(sFlags, AZ_ARRAY_SIZE(sFlags), "RESTRICTEDMODE, ");
|
||||
}
|
||||
|
||||
if (sFlags[0] != 0)
|
||||
@@ -1794,7 +1736,7 @@ void CXConsole::DisplayHelp(const char* help, const char* name)
|
||||
char* start, * pos;
|
||||
for (pos = strstr((char*)help, "\n"), start = (char*)help; pos; start = ++pos)
|
||||
{
|
||||
string s = start;
|
||||
AZStd::string s = start;
|
||||
s.resize(pos - start);
|
||||
ConsoleLogInputResponse(" $3%s", s.c_str());
|
||||
pos = strstr(pos, "\n");
|
||||
@@ -1816,11 +1758,12 @@ void CXConsole::ExecuteString(const char* command, const bool bSilentMode, const
|
||||
|
||||
// Store the string commands into a list and defer the execution for later.
|
||||
// The commands will be processed in CXConsole::Update()
|
||||
string str(command);
|
||||
str.TrimLeft();
|
||||
AZStd::string str(command);
|
||||
AZ::StringFunc::TrimWhiteSpace(str, true, false);
|
||||
|
||||
// Unroll the exec command
|
||||
bool unroll = (0 == str.Left(strlen("exec")).compareNoCase("exec"));
|
||||
|
||||
bool unroll = (0 == AZ::StringFunc::Find(str, "exec", 0, false, false));
|
||||
|
||||
if (unroll)
|
||||
{
|
||||
@@ -1858,10 +1801,10 @@ void CXConsole::ResetCVarsToDefaults()
|
||||
|
||||
}
|
||||
|
||||
void CXConsole::SplitCommands(const char* line, std::list<string>& split)
|
||||
void CXConsole::SplitCommands(const char* line, std::list<AZStd::string>& split)
|
||||
{
|
||||
const char* start = line;
|
||||
string working;
|
||||
AZStd::string working;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -1881,7 +1824,7 @@ void CXConsole::SplitCommands(const char* line, std::list<string>& split)
|
||||
case '\0':
|
||||
{
|
||||
working.assign(start, line - 1);
|
||||
working.Trim();
|
||||
AZ::StringFunc::TrimWhiteSpace(working, true, true);
|
||||
|
||||
if (!working.empty())
|
||||
{
|
||||
@@ -1931,15 +1874,15 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso
|
||||
ConsoleCommandsMapItor itrCmd;
|
||||
ConsoleVariablesMapItor itrVar;
|
||||
|
||||
std::list<string> lineCommands;
|
||||
std::list<AZStd::string> lineCommands;
|
||||
SplitCommands(command, lineCommands);
|
||||
|
||||
string sTemp;
|
||||
string sCommand, sLineCommand;
|
||||
AZStd::string sTemp;
|
||||
AZStd::string sCommand, sLineCommand;
|
||||
|
||||
while (!lineCommands.empty())
|
||||
{
|
||||
string::size_type nPos;
|
||||
AZStd::string::size_type nPos;
|
||||
|
||||
{
|
||||
sTemp = lineCommands.front();
|
||||
@@ -1951,17 +1894,17 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso
|
||||
{
|
||||
if (GetStatus())
|
||||
{
|
||||
AddLine(sTemp);
|
||||
AddLine(sTemp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
nPos = sTemp.find_first_of('=');
|
||||
|
||||
if (nPos != string::npos)
|
||||
if (nPos != AZStd::string::npos)
|
||||
{
|
||||
sCommand = sTemp.substr(0, nPos);
|
||||
}
|
||||
else if ((nPos = sTemp.find_first_of(' ')) != string::npos)
|
||||
else if ((nPos = sTemp.find_first_of(' ')) != AZStd::string::npos)
|
||||
{
|
||||
sCommand = sTemp.substr(0, nPos);
|
||||
}
|
||||
@@ -1970,7 +1913,7 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso
|
||||
sCommand = sTemp;
|
||||
}
|
||||
|
||||
sCommand.Trim();
|
||||
AZ::StringFunc::TrimWhiteSpace(sCommand, true, true);
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Search for CVars
|
||||
@@ -2005,7 +1948,7 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso
|
||||
|
||||
//////////////////////////////////////////
|
||||
//Check if is a variable
|
||||
itrVar = m_mapVariables.find(sCommand);
|
||||
itrVar = m_mapVariables.find(sCommand.c_str());
|
||||
if (itrVar != m_mapVariables.end())
|
||||
{
|
||||
ICVar* pCVar = itrVar->second;
|
||||
@@ -2017,10 +1960,10 @@ void CXConsole::ExecuteStringInternal(const char* command, const bool bFromConso
|
||||
m_blockCounter++;
|
||||
}
|
||||
|
||||
if (nPos != string::npos)
|
||||
if (nPos != AZStd::string::npos)
|
||||
{
|
||||
sTemp = sTemp.substr(nPos + 1); // remove the command from sTemp
|
||||
sTemp.Trim(" \t\r\n\"\'");
|
||||
AZ::StringFunc::StripEnds(sTemp, " \t\r\n\"\'");
|
||||
|
||||
if (sTemp == "?")
|
||||
{
|
||||
@@ -2094,12 +2037,12 @@ void CXConsole::ExecuteDeferredCommands()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDevMode)
|
||||
void CXConsole::ExecuteCommand(CConsoleCommand& cmd, AZStd::string& str, bool bIgnoreDevMode)
|
||||
{
|
||||
CryLog ("[CONSOLE] Executing console command '%s'", str.c_str());
|
||||
INDENT_LOG_DURING_SCOPE();
|
||||
|
||||
std::vector<string> args;
|
||||
std::vector<AZStd::string> args;
|
||||
size_t t;
|
||||
|
||||
{
|
||||
@@ -2118,7 +2061,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
{
|
||||
;
|
||||
}
|
||||
args.push_back(string(start + 1, commandLine - 1));
|
||||
args.push_back(AZStd::string(start + 1, commandLine - 1));
|
||||
start = commandLine;
|
||||
break;
|
||||
}
|
||||
@@ -2129,7 +2072,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
{
|
||||
if ((*commandLine == ' ') || !*commandLine)
|
||||
{
|
||||
args.push_back(string(start, commandLine));
|
||||
args.push_back(AZStd::string(start, commandLine));
|
||||
start = commandLine + 1;
|
||||
}
|
||||
}
|
||||
@@ -2139,7 +2082,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
|
||||
if (args.size() >= 2 && args[1] == "?")
|
||||
{
|
||||
DisplayHelp(cmd.m_sHelp, cmd.m_sName.c_str());
|
||||
DisplayHelp(cmd.m_sHelp.c_str(), cmd.m_sName.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2166,13 +2109,13 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
return;
|
||||
}
|
||||
|
||||
string buf;
|
||||
AZStd::string buf;
|
||||
{
|
||||
// only do this for commands with script implementation
|
||||
for (;; )
|
||||
{
|
||||
t = str.find_first_of("\\", t);
|
||||
if (t == string::npos)
|
||||
if (t == AZStd::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2183,7 +2126,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
for (t = 1;; )
|
||||
{
|
||||
t = str.find_first_of("\"", t);
|
||||
if (t == string::npos)
|
||||
if (t == AZStd::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2194,9 +2137,9 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
buf = cmd.m_sCommand;
|
||||
|
||||
size_t pp = buf.find("%%");
|
||||
if (pp != string::npos)
|
||||
if (pp != AZStd::string::npos)
|
||||
{
|
||||
string list = "";
|
||||
AZStd::string list = "";
|
||||
for (unsigned int i = 1; i < args.size(); i++)
|
||||
{
|
||||
list += "\"" + args[i] + "\"";
|
||||
@@ -2207,9 +2150,9 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
}
|
||||
buf.replace(pp, 2, list);
|
||||
}
|
||||
else if ((pp = buf.find("%line")) != string::npos)
|
||||
else if ((pp = buf.find("%line")) != AZStd::string::npos)
|
||||
{
|
||||
string tmp = "\"" + str.substr(str.find(" ") + 1) + "\"";
|
||||
AZStd::string tmp = "\"" + str.substr(str.find(" ") + 1) + "\"";
|
||||
if (args.size() > 1)
|
||||
{
|
||||
buf.replace(pp, 5, tmp);
|
||||
@@ -2226,7 +2169,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
char pat[10];
|
||||
azsprintf(pat, "%%%d", i);
|
||||
size_t pos = buf.find(pat);
|
||||
if (pos == string::npos)
|
||||
if (pos == AZStd::string::npos)
|
||||
{
|
||||
if (i != args.size())
|
||||
{
|
||||
@@ -2241,7 +2184,7 @@ void CXConsole::ExecuteCommand(CConsoleCommand& cmd, string& str, bool bIgnoreDe
|
||||
ConsoleWarning("Not enough arguments for: %s", cmd.m_sName.c_str());
|
||||
return;
|
||||
}
|
||||
string arg = "\"" + args[i] + "\"";
|
||||
AZStd::string arg = "\"" + args[i] + "\"";
|
||||
buf.replace(pos, strlen(pat), arg);
|
||||
}
|
||||
}
|
||||
@@ -2340,15 +2283,15 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer)
|
||||
}
|
||||
//try to search in command list
|
||||
bool bArgumentAutoComplete = false;
|
||||
std::vector<string> matches;
|
||||
std::vector<AZStd::string> matches;
|
||||
|
||||
if (m_sPrevTab.find(' ') != string::npos)
|
||||
if (m_sPrevTab.find(' ') != AZStd::string::npos)
|
||||
{
|
||||
bool bProcessAutoCompl = true;
|
||||
|
||||
// Find command.
|
||||
string sVar = m_sPrevTab.substr(0, m_sPrevTab.find(' '));
|
||||
ICVar* pCVar = GetCVar(sVar);
|
||||
AZStd::string sVar = m_sPrevTab.substr(0, m_sPrevTab.find(' '));
|
||||
ICVar* pCVar = GetCVar(sVar.c_str());
|
||||
if (pCVar)
|
||||
{
|
||||
if (!(pCVar->GetFlags() & VF_RESTRICTEDMODE) && con_restricted) // in restricted mode we allow only VF_RESTRICTEDMODE CVars&CCmd
|
||||
@@ -2376,7 +2319,7 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer)
|
||||
int nMatches = pArgumentAutoComplete->GetCount();
|
||||
for (int i = 0; i < nMatches; i++)
|
||||
{
|
||||
string cmd = string(sVar) + " " + pArgumentAutoComplete->GetValue(i);
|
||||
AZStd::string cmd = AZStd::string(sVar) + " " + pArgumentAutoComplete->GetValue(i);
|
||||
if (_strnicmp(m_sPrevTab.c_str(), cmd.c_str(), m_sPrevTab.length()) == 0)
|
||||
{
|
||||
{
|
||||
@@ -2430,16 +2373,16 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer)
|
||||
|
||||
if (!matches.empty())
|
||||
{
|
||||
std::sort(matches.begin(), matches.end(), less_CVar); // to sort commands with variables
|
||||
std::sort(matches.begin(), matches.end()); // to sort commands with variables
|
||||
}
|
||||
if (showlist && !matches.empty())
|
||||
{
|
||||
ConsoleLogInput(" "); // empty line before auto completion
|
||||
|
||||
for (std::vector<string>::iterator i = matches.begin(); i != matches.end(); ++i)
|
||||
for (std::vector<AZStd::string>::iterator i = matches.begin(); i != matches.end(); ++i)
|
||||
{
|
||||
// List matching variables
|
||||
const char* sVar = *i;
|
||||
const char* sVar = i->c_str();
|
||||
ICVar* pVar = GetCVar(sVar);
|
||||
|
||||
if (pVar)
|
||||
@@ -2453,7 +2396,7 @@ const char* CXConsole::ProcessCompletion(const char* szInputBuffer)
|
||||
}
|
||||
}
|
||||
|
||||
for (std::vector<string>::iterator i = matches.begin(); i != matches.end(); ++i)
|
||||
for (std::vector<AZStd::string>::iterator i = matches.begin(); i != matches.end(); ++i)
|
||||
{
|
||||
if (m_nTabCount <= nMatch)
|
||||
{
|
||||
@@ -2485,8 +2428,8 @@ void CXConsole::DisplayVarValue(ICVar* pVar)
|
||||
|
||||
const char* sFlagsString = GetFlagsString(pVar->GetFlags());
|
||||
|
||||
string sValue = (pVar->GetFlags() & VF_INVISIBLE) ? "" : pVar->GetString();
|
||||
string sVar = pVar->GetName();
|
||||
AZStd::string sValue = (pVar->GetFlags() & VF_INVISIBLE) ? "" : pVar->GetString();
|
||||
AZStd::string sVar = pVar->GetName();
|
||||
|
||||
char szRealState[40] = "";
|
||||
|
||||
@@ -2623,12 +2566,8 @@ void CXConsole::AddLine(const char* inputStr)
|
||||
|
||||
void CXConsole::PostLine(const char* lineOfText, size_t len)
|
||||
{
|
||||
string line;
|
||||
|
||||
{
|
||||
line = string(lineOfText, len);
|
||||
m_dqConsoleBuffer.push_back(line);
|
||||
}
|
||||
AZStd::string line = AZStd::string(lineOfText, len);
|
||||
m_dqConsoleBuffer.push_back(line);
|
||||
|
||||
int nBufferSize = con_line_buffer_size;
|
||||
|
||||
@@ -2701,7 +2640,7 @@ void CXConsole::RemoveOutputPrintSink(IOutputPrintSink* inpSink)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXConsole::AddLinePlus(const char* inputStr)
|
||||
{
|
||||
string str, tmpStr;
|
||||
AZStd::string str, tmpStr;
|
||||
|
||||
{
|
||||
if (!m_dqConsoleBuffer.size())
|
||||
@@ -2717,13 +2656,13 @@ void CXConsole::AddLinePlus(const char* inputStr)
|
||||
str.resize(str.size() - 1);
|
||||
}
|
||||
|
||||
string::size_type nPos;
|
||||
while ((nPos = str.find('\n')) != string::npos)
|
||||
AZStd::string::size_type nPos;
|
||||
while ((nPos = str.find('\n')) != AZStd::string::npos)
|
||||
{
|
||||
str.replace(nPos, 1, 1, ' ');
|
||||
}
|
||||
|
||||
while ((nPos = str.find('\r')) != string::npos)
|
||||
while ((nPos = str.find('\r')) != AZStd::string::npos)
|
||||
{
|
||||
str.replace(nPos, 1, 1, ' ');
|
||||
}
|
||||
@@ -2783,7 +2722,7 @@ void CXConsole::AddInputUTF8(const AZStd::string& textUTF8)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXConsole::ExecuteInputBuffer()
|
||||
{
|
||||
string sTemp = m_sInputBuffer;
|
||||
AZStd::string sTemp = m_sInputBuffer;
|
||||
if (m_sInputBuffer.empty())
|
||||
{
|
||||
return;
|
||||
@@ -2814,9 +2753,7 @@ void CXConsole::RemoveInputChar(bool bBackSpace)
|
||||
const char* const pBase = m_sInputBuffer.c_str();
|
||||
const char* pCursor = pBase + m_nCursorPos;
|
||||
const char* const pEnd = pCursor;
|
||||
Unicode::CIterator<const char*, false> pUnicode(pCursor);
|
||||
pUnicode--; // Remove one UCS code-point, doesn't account for combining diacritics
|
||||
pCursor = pUnicode.GetPosition();
|
||||
pCursor -= Utf8::Internal::sequence_length(pCursor); // Remove one UCS code-point, doesn't account for combining diacritics
|
||||
size_t length = pEnd - pCursor;
|
||||
m_sInputBuffer.erase(pCursor - pBase, length);
|
||||
m_nCursorPos -= length;
|
||||
@@ -2829,9 +2766,7 @@ void CXConsole::RemoveInputChar(bool bBackSpace)
|
||||
const char* const pBase = m_sInputBuffer.c_str();
|
||||
const char* pCursor = pBase + m_nCursorPos;
|
||||
const char* const pBegin = pCursor;
|
||||
Unicode::CIterator<const char*, false> pUnicode(pCursor);
|
||||
pUnicode--; // Remove one UCS code-point, doesn't account for combining diacritics
|
||||
pCursor = pUnicode.GetPosition();
|
||||
pCursor -= Utf8::Internal::sequence_length(pCursor); // Remove one UCS code-point, doesn't account for combining diacritics
|
||||
size_t length = pCursor - pBegin;
|
||||
m_sInputBuffer.erase(pBegin - pBase, length);
|
||||
}
|
||||
@@ -2905,29 +2840,29 @@ void CXConsole::Paste()
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
if (OpenClipboard(NULL) != 0)
|
||||
{
|
||||
wstring data;
|
||||
AZStd::string data;
|
||||
const HANDLE wideData = GetClipboardData(CF_UNICODETEXT);
|
||||
if (wideData)
|
||||
{
|
||||
const LPCWSTR pWideData = (LPCWSTR)GlobalLock(wideData);
|
||||
if (pWideData)
|
||||
{
|
||||
// Note: This conversion is just to make sure we discard malicious or malformed data
|
||||
Unicode::ConvertSafe<Unicode::eErrorRecovery_Discard>(data, pWideData);
|
||||
AZStd::to_string(data, pWideData);
|
||||
GlobalUnlock(wideData);
|
||||
}
|
||||
}
|
||||
CloseClipboard();
|
||||
|
||||
for (Unicode::CIterator<wstring::const_iterator> it(data.begin(), data.end()); it != data.end(); ++it)
|
||||
Utf8::Unchecked::octet_iterator end(data.end());
|
||||
for (Utf8::Unchecked::octet_iterator it(data.begin()); it != end; ++it)
|
||||
{
|
||||
const uint32 cp = *it;
|
||||
const wchar_t cp = *it;
|
||||
if (cp != '\r')
|
||||
{
|
||||
// Convert UCS code-point into UTF-8 string
|
||||
char utf8_buf[5];
|
||||
Unicode::Convert(utf8_buf, cp);
|
||||
AddInputUTF8(utf8_buf);
|
||||
AZStd::fixed_string<5> utf8_buf = {0};
|
||||
AZStd::to_string(utf8_buf.data(), 5, { &cp, 1 });
|
||||
AddInputUTF8(utf8_buf.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3030,7 +2965,7 @@ void CXConsole::AddCVarsToHash(ConsoleVariablesVector::const_iterator begin, Con
|
||||
{
|
||||
// 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;
|
||||
AZStd::string hashStr = it->first;
|
||||
|
||||
runningNameCrc32.Add(hashStr.c_str(), hashStr.length());
|
||||
hashStr += it->second->GetDataProbeString();
|
||||
@@ -3195,7 +3130,7 @@ char* CXConsole::GetCheatVarAt(uint32 nOffset)
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t CXConsole::GetSortedVars(const char** pszArray, size_t numItems, const char* szPrefix)
|
||||
size_t CXConsole::GetSortedVars(AZStd::vector<AZStd::string_view>& pszArray, const char* szPrefix)
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t iPrefixLen = szPrefix ? strlen(szPrefix) : 0;
|
||||
@@ -3205,7 +3140,7 @@ size_t CXConsole::GetSortedVars(const char** pszArray, size_t numItems, const ch
|
||||
ConsoleVariablesMap::const_iterator it, end = m_mapVariables.end();
|
||||
for (it = m_mapVariables.begin(); it != end; ++it)
|
||||
{
|
||||
if (pszArray && i >= numItems)
|
||||
if (i >= pszArray.size())
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -3223,10 +3158,7 @@ size_t CXConsole::GetSortedVars(const char** pszArray, size_t numItems, const ch
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pszArray)
|
||||
{
|
||||
pszArray[i] = it->first;
|
||||
}
|
||||
pszArray[i] = it->first;
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -3237,7 +3169,7 @@ size_t CXConsole::GetSortedVars(const char** pszArray, size_t numItems, const ch
|
||||
ConsoleCommandsMap::iterator it, end = m_mapCommands.end();
|
||||
for (it = m_mapCommands.begin(); it != end; ++it)
|
||||
{
|
||||
if (pszArray && i >= numItems)
|
||||
if (i >= pszArray.size())
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -3255,18 +3187,15 @@ size_t CXConsole::GetSortedVars(const char** pszArray, size_t numItems, const ch
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pszArray)
|
||||
{
|
||||
pszArray[i] = it->first.c_str();
|
||||
}
|
||||
pszArray[i] = it->first.c_str();
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != 0 && pszArray)
|
||||
if (i != 0)
|
||||
{
|
||||
std::sort(pszArray, pszArray + i, less_CVar);
|
||||
std::sort(pszArray.begin(), pszArray.end());
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -3275,22 +3204,22 @@ size_t CXConsole::GetSortedVars(const char** pszArray, size_t numItems, const ch
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXConsole::FindVar(const char* substr)
|
||||
{
|
||||
std::vector<const char*> cmds;
|
||||
AZStd::vector<AZStd::string_view> cmds;
|
||||
cmds.resize(GetNumVars() + m_mapCommands.size());
|
||||
size_t cmdCount = GetSortedVars(&cmds[0], cmds.size());
|
||||
size_t cmdCount = GetSortedVars(cmds);
|
||||
|
||||
for (size_t i = 0; i < cmdCount; i++)
|
||||
{
|
||||
if (CryStringUtils::stristr(cmds[i], substr))
|
||||
if (AZ::StringFunc::Find(cmds[i], substr) != AZStd::string::npos)
|
||||
{
|
||||
ICVar* pCvar = gEnv->pConsole->GetCVar(cmds[i]);
|
||||
ICVar* pCvar = gEnv->pConsole->GetCVar(cmds[i].data());
|
||||
if (pCvar)
|
||||
{
|
||||
DisplayVarValue(pCvar);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleLogInputResponse(" $3%s $6(Command)", cmds[i]);
|
||||
ConsoleLogInputResponse(" $3%.*s $6(Command)", aznumeric_cast<int>(cmds[i].size()), cmds[i].data());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3301,22 +3230,22 @@ const char* CXConsole::AutoComplete(const char* substr)
|
||||
{
|
||||
// following code can be optimized
|
||||
|
||||
std::vector<const char*> cmds;
|
||||
AZStd::vector<AZStd::string_view> cmds;
|
||||
cmds.resize(GetNumVars() + m_mapCommands.size());
|
||||
size_t cmdCount = GetSortedVars(&cmds[0], cmds.size());
|
||||
size_t cmdCount = GetSortedVars(cmds);
|
||||
|
||||
size_t substrLen = strlen(substr);
|
||||
|
||||
// If substring is empty return first command.
|
||||
if (substrLen == 0 && cmdCount > 0)
|
||||
{
|
||||
return cmds[0];
|
||||
return cmds[0].data();
|
||||
}
|
||||
|
||||
// find next
|
||||
for (size_t i = 0; i < cmdCount; i++)
|
||||
{
|
||||
const char* szCmd = cmds[i];
|
||||
const char* szCmd = cmds[i].data();
|
||||
size_t cmdlen = strlen(szCmd);
|
||||
if (cmdlen >= substrLen && memcmp(szCmd, substr, substrLen) == 0)
|
||||
{
|
||||
@@ -3325,32 +3254,32 @@ const char* CXConsole::AutoComplete(const char* substr)
|
||||
i++;
|
||||
if (i < cmdCount)
|
||||
{
|
||||
return cmds[i];
|
||||
return cmds[i].data();
|
||||
}
|
||||
return cmds[i - 1];
|
||||
return cmds[i - 1].data();
|
||||
}
|
||||
return cmds[i];
|
||||
return cmds[i].data();
|
||||
}
|
||||
}
|
||||
|
||||
// then first matching case insensitive
|
||||
for (size_t i = 0; i < cmdCount; i++)
|
||||
{
|
||||
const char* szCmd = cmds[i];
|
||||
const char* szCmd = cmds[i].data();
|
||||
|
||||
size_t cmdlen = strlen(szCmd);
|
||||
if (cmdlen >= substrLen && azmemicmp(szCmd, substr, substrLen) == 0)
|
||||
if (cmdlen >= substrLen && azstrnicmp(szCmd, substr, substrLen) == 0)
|
||||
{
|
||||
if (substrLen == cmdlen)
|
||||
{
|
||||
i++;
|
||||
if (i < cmdCount)
|
||||
{
|
||||
return cmds[i];
|
||||
return cmds[i].data();
|
||||
}
|
||||
return cmds[i - 1];
|
||||
return cmds[i - 1].data();
|
||||
}
|
||||
return cmds[i];
|
||||
return cmds[i].data();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3371,27 +3300,27 @@ void CXConsole::SetInputLine(const char* szLine)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* CXConsole::AutoCompletePrev(const char* substr)
|
||||
{
|
||||
std::vector<const char*> cmds;
|
||||
AZStd::vector<AZStd::string_view> cmds;
|
||||
cmds.resize(GetNumVars() + m_mapCommands.size());
|
||||
size_t cmdCount = GetSortedVars(&cmds[0], cmds.size());
|
||||
size_t cmdCount = GetSortedVars(cmds);
|
||||
|
||||
// If substring is empty return last command.
|
||||
if (strlen(substr) == 0 && cmds.size() > 0)
|
||||
{
|
||||
return cmds[cmdCount - 1];
|
||||
return cmds[cmdCount - 1].data();
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < cmdCount; i++)
|
||||
{
|
||||
if (azstricmp(substr, cmds[i]) == 0)
|
||||
if (azstricmp(substr, cmds[i].data()) == 0)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
return cmds[i - 1];
|
||||
return cmds[i - 1].data();
|
||||
}
|
||||
else
|
||||
{
|
||||
return cmds[0];
|
||||
return cmds[0].data();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3399,7 +3328,7 @@ const char* CXConsole::AutoCompletePrev(const char* substr)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline size_t sizeOf (const string& str)
|
||||
inline size_t sizeOf (const AZStd::string& str)
|
||||
{
|
||||
return str.capacity() + 1;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ enum ScrollDir
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CConsoleCommand
|
||||
{
|
||||
string m_sName; // Console command name
|
||||
string m_sCommand; // lua code that is executed when this command is invoked
|
||||
string m_sHelp; // optional help string - can be shown in the console with "<commandname> ?"
|
||||
int m_nFlags; // bitmask consist of flag starting with VF_ e.g. VF_CHEAT
|
||||
ConsoleCommandFunc m_func; // Pointer to console command.
|
||||
AZStd::string m_sName; // Console command name
|
||||
AZStd::string m_sCommand; // lua code that is executed when this command is invoked
|
||||
AZStd::string m_sHelp; // optional help string - can be shown in the console with "<commandname> ?"
|
||||
int m_nFlags; // bitmask consist of flag starting with VF_ e.g. VF_CHEAT
|
||||
ConsoleCommandFunc m_func; // Pointer to console command.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CConsoleCommand()
|
||||
@@ -67,7 +67,7 @@ struct CConsoleCommand
|
||||
struct CConsoleCommandArgs
|
||||
: public IConsoleCmdArgs
|
||||
{
|
||||
CConsoleCommandArgs(string& line, std::vector<string>& args)
|
||||
CConsoleCommandArgs(AZStd::string& line, std::vector<AZStd::string>& args)
|
||||
: m_line(line)
|
||||
, m_args(args) {};
|
||||
virtual int GetArgCount() const { return static_cast<int>(m_args.size()); };
|
||||
@@ -87,34 +87,20 @@ struct CConsoleCommandArgs
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<string>& m_args;
|
||||
string& m_line;
|
||||
std::vector<AZStd::string>& m_args;
|
||||
AZStd::string& m_line;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct string_nocase_lt
|
||||
{
|
||||
bool operator()(const char* s1, const char* s2) const
|
||||
bool operator()(const AZStd::string& s1, const AZStd::string& s2) const
|
||||
{
|
||||
return azstricmp(s1, s2) < 0;
|
||||
return azstricmp(s1.c_str(), s2.c_str()) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
/* - very dangerous to use with STL containers
|
||||
struct string_nocase_lt
|
||||
{
|
||||
bool operator()( const char *s1,const char *s2 ) const
|
||||
{
|
||||
return _stricmp(s1,s2) < 0;
|
||||
}
|
||||
bool operator()( const string &s1,const string &s2 ) const
|
||||
{
|
||||
return _stricmp(s1.c_str(),s2.c_str()) < 0;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
//forward declarations
|
||||
class ITexture;
|
||||
struct IRenderer;
|
||||
@@ -132,7 +118,7 @@ class CXConsole
|
||||
, public AzFramework::CommandRegistrationBus::Handler
|
||||
{
|
||||
public:
|
||||
typedef std::deque<string> ConsoleBuffer;
|
||||
typedef std::deque<AZStd::string> ConsoleBuffer;
|
||||
typedef ConsoleBuffer::iterator ConsoleBufferItor;
|
||||
typedef ConsoleBuffer::reverse_iterator ConsoleBufferRItor;
|
||||
|
||||
@@ -195,7 +181,7 @@ public:
|
||||
virtual bool IsOpened();
|
||||
virtual int GetNumVars();
|
||||
virtual int GetNumVisibleVars();
|
||||
virtual size_t GetSortedVars(const char** pszArray, size_t numItems, const char* szPrefix = 0);
|
||||
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();
|
||||
@@ -262,7 +248,7 @@ protected: // ------------------------------------------------------------------
|
||||
void AddInputUTF8(const AZStd::string& textUTF8);
|
||||
void RemoveInputChar(bool bBackSpace);
|
||||
void ExecuteInputBuffer();
|
||||
void ExecuteCommand(CConsoleCommand& cmd, string& params, bool bIgnoreDevMode = false);
|
||||
void ExecuteCommand(CConsoleCommand& cmd, AZStd::string& params, bool bIgnoreDevMode = false);
|
||||
|
||||
void ScrollConsole();
|
||||
|
||||
@@ -294,7 +280,7 @@ protected: // ------------------------------------------------------------------
|
||||
|
||||
// Arguments:
|
||||
// bFromConsole - true=from console, false=from outside
|
||||
void SplitCommands(const char* line, std::list<string>& split);
|
||||
void SplitCommands(const char* line, std::list<AZStd::string>& split);
|
||||
void ExecuteStringInternal(const char* command, const bool bFromConsole, const bool bSilentMode = false);
|
||||
void ExecuteDeferredCommands();
|
||||
|
||||
@@ -320,27 +306,27 @@ private: // ----------------------------------------------------------
|
||||
|
||||
void PostLine(const char* lineOfText, size_t len);
|
||||
|
||||
typedef std::map<string, CConsoleCommand, string_nocase_lt> ConsoleCommandsMap;
|
||||
typedef std::map<AZStd::string, CConsoleCommand, string_nocase_lt> ConsoleCommandsMap;
|
||||
typedef ConsoleCommandsMap::iterator ConsoleCommandsMapItor;
|
||||
|
||||
typedef std::map<string, string> ConsoleBindsMap;
|
||||
typedef std::map<AZStd::string, AZStd::string> ConsoleBindsMap;
|
||||
typedef ConsoleBindsMap::iterator ConsoleBindsMapItor;
|
||||
|
||||
typedef std::map<string, IConsoleArgumentAutoComplete*, stl::less_stricmp<string> > ArgumentAutoCompleteMap;
|
||||
typedef std::map<AZStd::string, IConsoleArgumentAutoComplete*, stl::less_stricmp<AZStd::string> > ArgumentAutoCompleteMap;
|
||||
|
||||
struct SConfigVar
|
||||
{
|
||||
string m_value;
|
||||
AZStd::string m_value;
|
||||
bool m_partOfGroup;
|
||||
};
|
||||
typedef std::map<string, SConfigVar, string_nocase_lt> ConfigVars;
|
||||
typedef std::map<AZStd::string, SConfigVar, string_nocase_lt> ConfigVars;
|
||||
|
||||
struct SDeferredCommand
|
||||
{
|
||||
string command;
|
||||
AZStd::string command;
|
||||
bool silentMode;
|
||||
|
||||
SDeferredCommand(const string& _command, bool _silentMode)
|
||||
SDeferredCommand(const AZStd::string& _command, bool _silentMode)
|
||||
: command(_command)
|
||||
, silentMode(_silentMode)
|
||||
{}
|
||||
@@ -359,10 +345,10 @@ private: // ----------------------------------------------------------
|
||||
int m_nProgress;
|
||||
int m_nProgressRange;
|
||||
|
||||
string m_sInputBuffer;
|
||||
string m_sReturnString;
|
||||
AZStd::string m_sInputBuffer;
|
||||
AZStd::string m_sReturnString;
|
||||
|
||||
string m_sPrevTab;
|
||||
AZStd::string m_sPrevTab;
|
||||
int m_nTabCount;
|
||||
|
||||
ConsoleCommandsMap m_mapCommands; //
|
||||
|
||||
@@ -286,7 +286,7 @@ void CXConsoleVariableCVarGroup::OnLoadConfigurationEntry_End()
|
||||
{
|
||||
if (!m_sDefaultValue.empty())
|
||||
{
|
||||
gEnv->pConsole->LoadConfigVar(GetName(), m_sDefaultValue);
|
||||
gEnv->pConsole->LoadConfigVar(GetName(), m_sDefaultValue.c_str());
|
||||
m_sDefaultValue.clear();
|
||||
}
|
||||
}
|
||||
@@ -299,9 +299,9 @@ CXConsoleVariableCVarGroup::CXConsoleVariableCVarGroup(CXConsole* pConsole, cons
|
||||
}
|
||||
|
||||
|
||||
string CXConsoleVariableCVarGroup::GetDetailedInfo() const
|
||||
AZStd::string CXConsoleVariableCVarGroup::GetDetailedInfo() const
|
||||
{
|
||||
string sRet = GetName();
|
||||
AZStd::string sRet = GetName();
|
||||
|
||||
sRet += " [";
|
||||
|
||||
@@ -326,11 +326,11 @@ string CXConsoleVariableCVarGroup::GetDetailedInfo() const
|
||||
sRet += "/default] [current]:\n";
|
||||
|
||||
|
||||
std::map<string, string>::const_iterator it, end = m_CVarGroupDefault.m_KeyValuePair.end();
|
||||
std::map<AZStd::string, AZStd::string>::const_iterator it, end = m_CVarGroupDefault.m_KeyValuePair.end();
|
||||
|
||||
for (it = m_CVarGroupDefault.m_KeyValuePair.begin(); it != end; ++it)
|
||||
{
|
||||
const string& rKey = it->first;
|
||||
const AZStd::string& rKey = it->first;
|
||||
|
||||
sRet += " ... ";
|
||||
sRet += rKey;
|
||||
@@ -344,7 +344,7 @@ string CXConsoleVariableCVarGroup::GetDetailedInfo() const
|
||||
sRet += "/";
|
||||
}
|
||||
sRet += GetValueSpec(rKey);
|
||||
ICVar* pCVar = gEnv->pConsole->GetCVar(rKey);
|
||||
ICVar* pCVar = gEnv->pConsole->GetCVar(rKey.c_str());
|
||||
if (pCVar)
|
||||
{
|
||||
sRet += " [";
|
||||
@@ -369,7 +369,7 @@ const char* CXConsoleVariableCVarGroup::GetHelp()
|
||||
}
|
||||
|
||||
// create help on demand
|
||||
string sRet = "Console variable group to apply settings to multiple variables\n\n";
|
||||
AZStd::string sRet = "Console variable group to apply settings to multiple variables\n\n";
|
||||
|
||||
sRet += GetDetailedInfo();
|
||||
|
||||
@@ -545,12 +545,12 @@ bool CXConsoleVariableCVarGroup::TestCVars(const SCVarGroup* pGroup, const ICVar
|
||||
bool CXConsoleVariableCVarGroup::TestCVars(const SCVarGroup& rGroup, const ICVar::EConsoleLogMode mode, const SCVarGroup* pExclude) const
|
||||
{
|
||||
bool bRet = true;
|
||||
std::map<string, string>::const_iterator it, end = rGroup.m_KeyValuePair.end();
|
||||
std::map<AZStd::string, AZStd::string>::const_iterator it, end = rGroup.m_KeyValuePair.end();
|
||||
|
||||
for (it = rGroup.m_KeyValuePair.begin(); it != end; ++it)
|
||||
{
|
||||
const string& rKey = it->first;
|
||||
const string& rValue = it->second;
|
||||
const AZStd::string& rKey = it->first;
|
||||
const AZStd::string& rValue = it->second;
|
||||
|
||||
if (pExclude)
|
||||
{
|
||||
@@ -674,7 +674,7 @@ bool CXConsoleVariableCVarGroup::TestCVars(const SCVarGroup& rGroup, const ICVar
|
||||
|
||||
|
||||
|
||||
string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* pSpec) const
|
||||
AZStd::string CXConsoleVariableCVarGroup::GetValueSpec(const AZStd::string& sKey, const int* pSpec) const
|
||||
{
|
||||
if (pSpec)
|
||||
{
|
||||
@@ -685,7 +685,7 @@ string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* p
|
||||
const SCVarGroup* pGrp = itGrp->second;
|
||||
|
||||
// check in spec
|
||||
std::map<string, string>::const_iterator it = pGrp->m_KeyValuePair.find(sKey);
|
||||
std::map<AZStd::string, AZStd::string>::const_iterator it = pGrp->m_KeyValuePair.find(sKey);
|
||||
|
||||
if (it != pGrp->m_KeyValuePair.end())
|
||||
{
|
||||
@@ -695,7 +695,7 @@ string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* p
|
||||
}
|
||||
|
||||
// check in default
|
||||
std::map<string, string>::const_iterator it = m_CVarGroupDefault.m_KeyValuePair.find(sKey);
|
||||
std::map<AZStd::string, AZStd::string>::const_iterator it = m_CVarGroupDefault.m_KeyValuePair.find(sKey);
|
||||
|
||||
if (it != m_CVarGroupDefault.m_KeyValuePair.end())
|
||||
{
|
||||
@@ -708,14 +708,14 @@ string CXConsoleVariableCVarGroup::GetValueSpec(const string& sKey, const int* p
|
||||
|
||||
void CXConsoleVariableCVarGroup::ApplyCVars(const SCVarGroup& rGroup, const SCVarGroup* pExclude)
|
||||
{
|
||||
std::map<string, string>::const_iterator it, end = rGroup.m_KeyValuePair.end();
|
||||
std::map<AZStd::string, AZStd::string>::const_iterator it, end = rGroup.m_KeyValuePair.end();
|
||||
|
||||
bool wasProcessingGroup = m_pConsole->GetIsProcessingGroup();
|
||||
m_pConsole->SetProcessingGroup(true);
|
||||
|
||||
for (it = rGroup.m_KeyValuePair.begin(); it != end; ++it)
|
||||
{
|
||||
const string& rKey = it->first;
|
||||
const AZStd::string& rKey = it->first;
|
||||
|
||||
if (pExclude)
|
||||
{
|
||||
@@ -728,7 +728,7 @@ void CXConsoleVariableCVarGroup::ApplyCVars(const SCVarGroup& rGroup, const SCVa
|
||||
// Useful for debugging cvar groups
|
||||
//CryLogAlways("[CVARS]: [APPLY] ([%s]) [%s] = [%s]", GetName(), rKey.c_str(), it->second.c_str());
|
||||
|
||||
m_pConsole->LoadConfigVar(rKey, it->second);
|
||||
m_pConsole->LoadConfigVar(rKey.c_str(), it->second.c_str());
|
||||
}
|
||||
|
||||
m_pConsole->SetProcessingGroup(wasProcessingGroup);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "SFunctor.h"
|
||||
|
||||
class CXConsole;
|
||||
typedef AZStd::fixed_string<512> stack_string;
|
||||
|
||||
inline int64 TextToInt64(const char* s, int64 nCurrent, bool bBitfield)
|
||||
{
|
||||
@@ -178,19 +179,22 @@ public:
|
||||
CXConsoleVariableString(CXConsole* pConsole, const char* sName, const char* szDefault, int nFlags, const char* help)
|
||||
: CXConsoleVariableBase(pConsole, sName, nFlags, help)
|
||||
{
|
||||
m_sValue = szDefault;
|
||||
m_sDefault = szDefault;
|
||||
if (szDefault)
|
||||
{
|
||||
m_sValue = szDefault;
|
||||
m_sDefault = szDefault;
|
||||
}
|
||||
}
|
||||
|
||||
// interface ICVar --------------------------------------------------------------------------------------
|
||||
|
||||
virtual int GetIVal() const { return atoi(m_sValue); }
|
||||
virtual int64 GetI64Val() const { return _atoi64(m_sValue); }
|
||||
virtual float GetFVal() const { return (float)atof(m_sValue); }
|
||||
virtual const char* GetString() const { return m_sValue; }
|
||||
virtual int GetIVal() const { return atoi(m_sValue.c_str()); }
|
||||
virtual int64 GetI64Val() const { return _atoi64(m_sValue.c_str()); }
|
||||
virtual float GetFVal() const { return (float)atof(m_sValue.c_str()); }
|
||||
virtual const char* GetString() const { return m_sValue.c_str(); }
|
||||
virtual void ResetImpl()
|
||||
{
|
||||
Set(m_sDefault);
|
||||
Set(m_sDefault.c_str());
|
||||
}
|
||||
virtual void Set(const char* s)
|
||||
{
|
||||
@@ -219,8 +223,7 @@ public:
|
||||
|
||||
virtual void Set(float f)
|
||||
{
|
||||
stack_string s;
|
||||
s.Format("%g", f);
|
||||
stack_string s = stack_string::format("%g", f);
|
||||
|
||||
if ((m_sValue == s.c_str()) && (m_nFlags & VF_ALWAYSONCHANGE) == 0)
|
||||
{
|
||||
@@ -233,8 +236,7 @@ public:
|
||||
|
||||
virtual void Set(int i)
|
||||
{
|
||||
stack_string s;
|
||||
s.Format("%d", i);
|
||||
stack_string s = stack_string::format("%d", i);
|
||||
|
||||
if ((m_sValue == s.c_str()) && (m_nFlags & VF_ALWAYSONCHANGE) == 0)
|
||||
{
|
||||
@@ -248,8 +250,8 @@ public:
|
||||
|
||||
virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); }
|
||||
private: // --------------------------------------------------------------------------------------------
|
||||
string m_sValue;
|
||||
string m_sDefault; //!<
|
||||
AZStd::string m_sValue;
|
||||
AZStd::string m_sDefault; //!<
|
||||
};
|
||||
|
||||
|
||||
@@ -296,8 +298,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
stack_string s;
|
||||
s.Format("%d", i);
|
||||
stack_string s = stack_string::format("%d", i);
|
||||
|
||||
if (m_pConsole->OnBeforeVarChange(this, s.c_str()))
|
||||
{
|
||||
@@ -364,8 +365,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
stack_string s;
|
||||
s.Format("%lld", i);
|
||||
stack_string s = stack_string::format("%lld", i);
|
||||
|
||||
if (m_pConsole->OnBeforeVarChange(this, s.c_str()))
|
||||
{
|
||||
@@ -442,8 +442,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
stack_string s;
|
||||
s.Format("%g", f);
|
||||
stack_string s = stack_string::format("%g", f);
|
||||
|
||||
if (m_pConsole->OnBeforeVarChange(this, s.c_str()))
|
||||
{
|
||||
@@ -718,7 +717,7 @@ public:
|
||||
{
|
||||
return m_sValue.c_str();
|
||||
}
|
||||
virtual void ResetImpl() { Set(m_sDefault); }
|
||||
virtual void ResetImpl() { Set(m_sDefault.c_str()); }
|
||||
virtual void Set(const char* s)
|
||||
{
|
||||
if ((m_sValue == s) && (m_nFlags & VF_ALWAYSONCHANGE) == 0)
|
||||
@@ -740,14 +739,12 @@ public:
|
||||
}
|
||||
virtual void Set(float f)
|
||||
{
|
||||
stack_string s;
|
||||
s.Format("%g", f);
|
||||
stack_string s = stack_string::format("%g", f);
|
||||
Set(s.c_str());
|
||||
}
|
||||
virtual void Set(int i)
|
||||
{
|
||||
stack_string s;
|
||||
s.Format("%d", i);
|
||||
stack_string s = stack_string::format("%d", i);
|
||||
Set(s.c_str());
|
||||
}
|
||||
virtual int GetType() { return CVAR_STRING; }
|
||||
@@ -755,8 +752,8 @@ public:
|
||||
virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); }
|
||||
private: // --------------------------------------------------------------------------------------------
|
||||
|
||||
string m_sValue;
|
||||
string m_sDefault;
|
||||
AZStd::string m_sValue;
|
||||
AZStd::string m_sDefault;
|
||||
const char*& m_userPtr; //!<
|
||||
};
|
||||
|
||||
@@ -778,7 +775,7 @@ public:
|
||||
|
||||
// Returns:
|
||||
// part of the help string - useful to log out detailed description without additional help text
|
||||
string GetDetailedInfo() const;
|
||||
AZStd::string GetDetailedInfo() const;
|
||||
|
||||
// interface ICVar -----------------------------------------------------------------------------------
|
||||
|
||||
@@ -809,7 +806,7 @@ private: // --------------------------------------------------------------------
|
||||
|
||||
struct SCVarGroup
|
||||
{
|
||||
std::map<string, string> m_KeyValuePair; // e.g. m_KeyValuePair["r_fullscreen"]="0"
|
||||
std::map<AZStd::string, AZStd::string> m_KeyValuePair; // e.g. m_KeyValuePair["r_fullscreen"]="0"
|
||||
void GetMemoryUsage(class ICrySizer* pSizer) const
|
||||
{
|
||||
pSizer->AddObject(m_KeyValuePair);
|
||||
@@ -818,15 +815,15 @@ private: // --------------------------------------------------------------------
|
||||
|
||||
SCVarGroup m_CVarGroupDefault;
|
||||
typedef std::map<int, SCVarGroup*> TCVarGroupStateMap;
|
||||
TCVarGroupStateMap m_CVarGroupStates;
|
||||
string m_sDefaultValue; // used by OnLoadConfigurationEntry_End()
|
||||
TCVarGroupStateMap m_CVarGroupStates;
|
||||
AZStd::string m_sDefaultValue; // used by OnLoadConfigurationEntry_End()
|
||||
|
||||
void ApplyCVars(const SCVarGroup& rGroup, const SCVarGroup* pExclude = 0);
|
||||
|
||||
// Arguments:
|
||||
// sKey - must exist, at least in default
|
||||
// pSpec - can be 0
|
||||
string GetValueSpec(const string& sKey, const int* pSpec = 0) const;
|
||||
AZStd::string GetValueSpec(const AZStd::string& sKey, const int* pSpec = 0) const;
|
||||
|
||||
// should only be used by TestCVars()
|
||||
// Returns:
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
ELSE_LOAD_PROPERTY(Vec3); \
|
||||
ELSE_LOAD_PROPERTY(int); \
|
||||
ELSE_LOAD_PROPERTY(float); \
|
||||
ELSE_LOAD_PROPERTY(string); \
|
||||
ELSE_LOAD_PROPERTY(AZStd::string); \
|
||||
ELSE_LOAD_PROPERTY(bool);
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <ISystem.h>
|
||||
#include <stack>
|
||||
|
||||
typedef std::map<string, XmlNodeRef> IdTable;
|
||||
typedef std::map<AZStd::string, XmlNodeRef> IdTable;
|
||||
struct SParseParams
|
||||
{
|
||||
IdTable idTable;
|
||||
@@ -98,7 +98,7 @@ struct ReadPropertyTyped
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ReadPropertyTyped<string>
|
||||
struct ReadPropertyTyped<AZStd::string>
|
||||
{
|
||||
static bool Load(const SParseParams& parseParams, const char* name, XmlNodeRef& definition, XmlNodeRef& data, IReadXMLSink* pSink)
|
||||
{
|
||||
@@ -235,8 +235,9 @@ bool LoadProperty(const SParseParams& parseParams, XmlNodeRef& definition, XmlNo
|
||||
|
||||
dataToRead = GetISystem()->CreateXmlNode(data->getTag());
|
||||
|
||||
string content = childRef->getContent();
|
||||
dataToRead->setAttr(name, content.Trim().c_str());
|
||||
AZStd::string content = childRef->getContent();
|
||||
AZ::StringFunc::TrimWhiteSpace(content, true, true);
|
||||
dataToRead->setAttr(name, content.c_str());
|
||||
}
|
||||
|
||||
if (!dataToRead->haveAttr(name))
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#define TAG_SCRIPT_TYPE "t"
|
||||
#define TAG_SCRIPT_NAME "n"
|
||||
|
||||
//#define LOG_SERIALIZE_STACK(tag,szName) CryLogAlways( "<%s> %s/%s",tag,GetStackInfo(),szName );
|
||||
//#define LOG_SERIALIZE_STACK(tag,szName) CryLogAlways( "<%s> %s/%s",tag,GetStackInfo().c_str(), szName);
|
||||
#define LOG_SERIALIZE_STACK(tag, szName)
|
||||
|
||||
CSerializeXMLReaderImpl::CSerializeXMLReaderImpl(const XmlNodeRef& nodeRef)
|
||||
@@ -49,7 +49,7 @@ bool CSerializeXMLReaderImpl::Value(const char* name, int8& value)
|
||||
return bResult;
|
||||
}
|
||||
|
||||
bool CSerializeXMLReaderImpl::Value(const char* name, string& value)
|
||||
bool CSerializeXMLReaderImpl::Value(const char* name, AZStd::string& value)
|
||||
{
|
||||
DefaultValue(value); // Set input value to default.
|
||||
if (m_nErrors)
|
||||
@@ -175,10 +175,9 @@ void CSerializeXMLReaderImpl::EndGroup()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* CSerializeXMLReaderImpl::GetStackInfo() const
|
||||
AZStd::string CSerializeXMLReaderImpl::GetStackInfo() const
|
||||
{
|
||||
static string str;
|
||||
str.assign("");
|
||||
AZStd::string str;
|
||||
for (int i = 0; i < (int)m_nodeStack.size(); i++)
|
||||
{
|
||||
const char* name = m_nodeStack[i].m_node->getAttr(TAG_SCRIPT_NAME);
|
||||
@@ -195,7 +194,7 @@ const char* CSerializeXMLReaderImpl::GetStackInfo() const
|
||||
str += "/";
|
||||
}
|
||||
}
|
||||
return str.c_str();
|
||||
return str;
|
||||
}
|
||||
|
||||
void CSerializeXMLReaderImpl::GetMemoryUsage(ICrySizer* pSizer) const
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
g_pXmlStrCmp = pPrevCmpFunc;
|
||||
return bReturn;
|
||||
}
|
||||
ILINE bool GetAttr([[maybe_unused]] XmlNodeRef& node, [[maybe_unused]] const char* name, [[maybe_unused]] const string& value)
|
||||
ILINE bool GetAttr([[maybe_unused]] XmlNodeRef& node, [[maybe_unused]] const char* name, [[maybe_unused]] const AZStd::string& value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
bool Value(const char* name, int8& value);
|
||||
bool Value(const char* name, string& value);
|
||||
bool Value(const char* name, AZStd::string& value);
|
||||
bool Value(const char* name, CTimeValue& value);
|
||||
bool Value(const char* name, XmlNodeRef& value);
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
void BeginGroup(const char* szName);
|
||||
bool BeginOptionalGroup(const char* szName, bool condition);
|
||||
void EndGroup();
|
||||
const char* GetStackInfo() const;
|
||||
AZStd::string GetStackInfo() const;
|
||||
|
||||
void GetMemoryUsage(ICrySizer* pSizer) const;
|
||||
|
||||
@@ -172,8 +172,8 @@ private:
|
||||
void DefaultValue(Quat& v) const { v.w = 1.0f; v.v.x = 0; v.v.y = 0; v.v.z = 0; }
|
||||
void DefaultValue(CTimeValue& v) const { v.SetValue(0); }
|
||||
//void DefaultValue( char *str ) const { if (str) str[0] = 0; }
|
||||
void DefaultValue(string& str) const { str = ""; }
|
||||
void DefaultValue([[maybe_unused]] const string& str) const {}
|
||||
void DefaultValue(AZStd::string& str) const { str = ""; }
|
||||
void DefaultValue([[maybe_unused]] const AZStd::string& str) const {}
|
||||
void DefaultValue([[maybe_unused]] SNetObjectID& id) const {}
|
||||
void DefaultValue([[maybe_unused]] SSerializeString& str) const {}
|
||||
void DefaultValue(XmlNodeRef& ref) const { ref = NULL; }
|
||||
|
||||
@@ -64,14 +64,14 @@ void CSerializeXMLWriterImpl::BeginGroup(const char* szName)
|
||||
if (strchr(szName, ' ') != 0)
|
||||
{
|
||||
assert(0 && "Spaces in group name not supported");
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in group name not supported: %s/%s", GetStackInfo(), szName);
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in group name not supported: %s/%s", GetStackInfo().c_str(), szName);
|
||||
}
|
||||
XmlNodeRef node = CreateNodeNamed(szName);
|
||||
CurNode()->addChild(node);
|
||||
m_nodeStack.push_back(node);
|
||||
if (m_nodeStack.size() > MAX_NODE_STACK_DEPTH)
|
||||
{
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Too Deep Node Stack:\r\n%s", GetStackInfo());
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Too Deep Node Stack:\r\n%s", GetStackInfo().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,10 +112,9 @@ void CSerializeXMLWriterImpl::GetMemoryUsage(ICrySizer* pSizer) const
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* CSerializeXMLWriterImpl::GetStackInfo() const
|
||||
AZStd::string CSerializeXMLWriterImpl::GetStackInfo() const
|
||||
{
|
||||
static string str;
|
||||
str.assign("");
|
||||
AZStd::string str;
|
||||
for (int i = 0; i < (int)m_nodeStack.size(); i++)
|
||||
{
|
||||
const char* name = m_nodeStack[i]->getAttr(TAG_SCRIPT_NAME);
|
||||
@@ -132,14 +131,13 @@ const char* CSerializeXMLWriterImpl::GetStackInfo() const
|
||||
str += "/";
|
||||
}
|
||||
}
|
||||
return str.c_str();
|
||||
return str;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* CSerializeXMLWriterImpl::GetLuaStackInfo() const
|
||||
AZStd::string CSerializeXMLWriterImpl::GetLuaStackInfo() const
|
||||
{
|
||||
static string str;
|
||||
str.assign("");
|
||||
AZStd::string str;
|
||||
for (int i = 0; i < (int)m_luaSaveStack.size(); i++)
|
||||
{
|
||||
const char* name = m_luaSaveStack[i];
|
||||
@@ -149,5 +147,5 @@ const char* CSerializeXMLWriterImpl::GetLuaStackInfo() const
|
||||
str += ".";
|
||||
}
|
||||
}
|
||||
return str.c_str();
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
if (strchr(name, ' ') != 0)
|
||||
{
|
||||
assert(0 && "Spaces in Value name not supported");
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in Value name not supported: %s in Group %s", name, GetStackInfo());
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Spaces in Value name not supported: %s in Group %s", name, GetStackInfo().c_str());
|
||||
return;
|
||||
}
|
||||
if (GetISystem()->IsDevMode() && CurNode())
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
if (CurNode()->haveAttr(name))
|
||||
{
|
||||
assert(0);
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Duplicate tag Value( \"%s\" ) in Group %s", name, GetStackInfo());
|
||||
CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "!Duplicate tag Value( \"%s\" ) in Group %s", name, GetStackInfo().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ private:
|
||||
}
|
||||
|
||||
// Used for printing currebnt stack info for warnings.
|
||||
const char* GetStackInfo() const;
|
||||
const char* GetLuaStackInfo() const;
|
||||
AZStd::string GetStackInfo() const;
|
||||
AZStd::string GetLuaStackInfo() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Check For Defaults.
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
bool IsDefaultValue(const Quat& v) const { return v.w == 1.0f && v.v.x == 0 && v.v.y == 0 && v.v.z == 0; };
|
||||
bool IsDefaultValue(const CTimeValue& v) const { return v.GetValue() == 0; };
|
||||
bool IsDefaultValue(const char* str) const { return !str || !*str; };
|
||||
bool IsDefaultValue(const string& str) const { return str.empty(); };
|
||||
bool IsDefaultValue(const AZStd::string& str) const { return str.empty(); };
|
||||
bool IsDefaultValue(const SSerializeString& str) const { return str.empty(); };
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <stack>
|
||||
|
||||
typedef std::map<string, XmlNodeRef> IdTable;
|
||||
typedef std::map<AZStd::string, XmlNodeRef> IdTable;
|
||||
|
||||
static bool IsOptionalWriteXML(XmlNodeRef& definition);
|
||||
|
||||
@@ -66,7 +66,7 @@ struct WritePropertyTyped
|
||||
};
|
||||
|
||||
template <>
|
||||
struct WritePropertyTyped<string>
|
||||
struct WritePropertyTyped<AZStd::string>
|
||||
: public WritePropertyTyped<const char*>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -189,8 +189,6 @@ public:
|
||||
bool getAttr(const char* key, Vec3d& value) const;
|
||||
bool getAttr(const char* key, Quat& value) const;
|
||||
bool getAttr(const char* key, ColorB& value) const;
|
||||
// bool getAttr( const char *key,CString &value ) const { XmlString v; if (getAttr(key,v)) { value = (const char*)v; return true; } else return false; }
|
||||
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -32,7 +32,7 @@ const char* XMLBinary::XMLBinaryReader::GetErrorDescription() const
|
||||
|
||||
void XMLBinary::XMLBinaryReader::SetErrorDescription(const char* text)
|
||||
{
|
||||
cry_strcpy(m_errorDescription, text);
|
||||
azstrcpy(m_errorDescription, AZ_ARRAY_SIZE(m_errorDescription), text);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ void XMLBinary::XMLBinaryReader::CheckHeader(const BinaryFileHeader& header, siz
|
||||
// Check the signature of the file to make sure that it is a binary XML file.
|
||||
{
|
||||
static const char signature[] = "CryXmlB";
|
||||
COMPILE_TIME_ASSERT(sizeof(signature) == sizeof(header.szSignature));
|
||||
static_assert(sizeof(signature) == sizeof(header.szSignature));
|
||||
if (memcmp(header.szSignature, signature, sizeof(header.szSignature)) != 0)
|
||||
{
|
||||
result = eResult_NotBinXml;
|
||||
|
||||
@@ -84,7 +84,7 @@ static void write(XMLBinary::IDataWriter* const pFile, size_t& nPosition, const
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node, bool bNeedSwapEndian, XMLBinary::IFilter* pFilter, string& error)
|
||||
bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node, bool bNeedSwapEndian, XMLBinary::IFilter* pFilter, AZStd::string& error)
|
||||
{
|
||||
error = "";
|
||||
|
||||
@@ -99,7 +99,7 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node,
|
||||
static const uint nMaxNodeCount = (NodeIndex) ~0;
|
||||
if (m_nodes.size() > nMaxNodeCount)
|
||||
{
|
||||
error.Format("XMLBinary: Too many nodes: %d (max is %i)", m_nodes.size(), nMaxNodeCount);
|
||||
error = AZStd::string::format("XMLBinary: Too many nodes: %zu (max is %i)", m_nodes.size(), nMaxNodeCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node,
|
||||
|
||||
BinaryFileHeader header;
|
||||
static const char signature[] = "CryXmlB";
|
||||
COMPILE_TIME_ASSERT(sizeof(signature) == sizeof(header.szSignature));
|
||||
static_assert(sizeof(signature) == sizeof(header.szSignature));
|
||||
memcpy(header.szSignature, signature, sizeof(header.szSignature));
|
||||
nTheoreticalPosition += sizeof(header);
|
||||
align(nTheoreticalPosition, nAlignment);
|
||||
@@ -192,7 +192,7 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XMLBinary::CXMLBinaryWriter::CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, string& error)
|
||||
bool XMLBinary::CXMLBinaryWriter::CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error)
|
||||
{
|
||||
bool ok = CompileTablesForNode(node, -1, pFilter, error);
|
||||
ok = ok && CompileChildTable(node, pFilter, error);
|
||||
@@ -200,7 +200,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTables(XmlNodeRef node, XMLBinary::IFil
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, string& error)
|
||||
bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, AZStd::string& error)
|
||||
{
|
||||
// Add the tag to the string table.
|
||||
int nTagStringOffset = AddString(node->getTag());
|
||||
@@ -231,7 +231,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar
|
||||
static const int nMaxAttributeCount = (uint16) ~0;
|
||||
if (nAttributeCount > nMaxAttributeCount)
|
||||
{
|
||||
error.Format("XMLBinary: Too many attributes in a node: %d (max is %i)", nAttributeCount, nMaxAttributeCount);
|
||||
error = AZStd::string::format("XMLBinary: Too many attributes in a node: %d (max is %i)", nAttributeCount, nMaxAttributeCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar
|
||||
{
|
||||
if (++nChildCount > nMaxChildCount)
|
||||
{
|
||||
error.Format("XMLBinary: Too many children in node '%s': %d (max is %i)", childNode->getTag(), nChildCount, nMaxChildCount);
|
||||
error = AZStd::string::format("XMLBinary: Too many children in node '%s': %d (max is %i)", childNode->getTag(), nChildCount, nMaxChildCount);
|
||||
return false;
|
||||
}
|
||||
if (!CompileTablesForNode(childNode, nIndex, pFilter, error))
|
||||
@@ -277,7 +277,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool XMLBinary::CXMLBinaryWriter::CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, string& error)
|
||||
bool XMLBinary::CXMLBinaryWriter::CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error)
|
||||
{
|
||||
const int nIndex = m_nodesMap.find(node)->second; // Assume node always exist in map.
|
||||
const int nFirstChildIndex = (int)m_childs.size();
|
||||
@@ -298,7 +298,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileChildTable(XmlNodeRef node, XMLBinary::
|
||||
}
|
||||
if (nChildCount != nd.nChildCount)
|
||||
{
|
||||
error.Format("XMLBinary: Internal error in CompileChildTable()");
|
||||
error = AZStd::string::format("XMLBinary: Internal error in CompileChildTable()");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,25 +25,25 @@ namespace XMLBinary
|
||||
{
|
||||
public:
|
||||
CXMLBinaryWriter();
|
||||
bool WriteNode(IDataWriter* pFile, XmlNodeRef node, bool bNeedSwapEndian, XMLBinary::IFilter* pFilter, string& error);
|
||||
bool WriteNode(IDataWriter* pFile, XmlNodeRef node, bool bNeedSwapEndian, XMLBinary::IFilter* pFilter, AZStd::string & error);
|
||||
|
||||
private:
|
||||
bool CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, string& error);
|
||||
bool CompileTables(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error);
|
||||
|
||||
bool CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, string& error);
|
||||
bool CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, string& error);
|
||||
bool CompileTablesForNode(XmlNodeRef node, int nParentIndex, XMLBinary::IFilter* pFilter, AZStd::string& error);
|
||||
bool CompileChildTable(XmlNodeRef node, XMLBinary::IFilter* pFilter, AZStd::string& error);
|
||||
int AddString(const XmlString& sString);
|
||||
|
||||
private:
|
||||
// tables.
|
||||
typedef std::map<IXmlNode*, int> NodesMap;
|
||||
typedef std::map<string, uint> StringMap;
|
||||
typedef std::map<AZStd::string, uint> StringMap;
|
||||
|
||||
std::vector<Node> m_nodes;
|
||||
NodesMap m_nodesMap;
|
||||
std::vector<Attribute> m_attributes;
|
||||
std::vector<NodeIndex> m_childs;
|
||||
std::vector<string> m_strings;
|
||||
std::vector<AZStd::string> m_strings;
|
||||
StringMap m_stringMap;
|
||||
|
||||
uint m_nStringDataSize;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "CrySystem_precompiled.h"
|
||||
#include "XMLPatcher.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
CXMLPatcher::CXMLPatcher(XmlNodeRef& patchXML)
|
||||
{
|
||||
@@ -84,7 +83,7 @@ XmlNodeRef CXMLPatcher::FindPatchForFile(
|
||||
{
|
||||
const char* pForFile = child->getAttr("forfile");
|
||||
|
||||
if (pForFile && CryStringUtils::stristr(pForFile, pInFileToPatch) != 0)
|
||||
if (pForFile && AZ::StringFunc::Find(pForFile, pInFileToPatch) != AZStd::string::npos)
|
||||
{
|
||||
result = child;
|
||||
break;
|
||||
@@ -345,7 +344,7 @@ void CXMLPatcher::DumpXMLNodes(
|
||||
AZ::IO::HandleType inFileHandle,
|
||||
int inIndent,
|
||||
const XmlNodeRef& inNode,
|
||||
CryFixedStringT<512>* ioTempString)
|
||||
AZStd::fixed_string<512>* ioTempString)
|
||||
{
|
||||
auto pPak = gEnv->pCryPak;
|
||||
|
||||
@@ -353,7 +352,7 @@ void CXMLPatcher::DumpXMLNodes(
|
||||
|
||||
INDENT();
|
||||
|
||||
ioTempString->Format("<%s ", inNode->getTag());
|
||||
*ioTempString = AZStd::fixed_string<512>::format("<%s ", inNode->getTag());
|
||||
|
||||
pPak->FWrite(ioTempString->c_str(), ioTempString->length(), inFileHandle);
|
||||
|
||||
@@ -361,7 +360,7 @@ void CXMLPatcher::DumpXMLNodes(
|
||||
{
|
||||
const char* pKey, * pVal;
|
||||
inNode->getAttributeByIndex(i, &pKey, &pVal);
|
||||
ioTempString->Format("%s=\"%s\" ", pKey, pVal);
|
||||
*ioTempString = AZStd::fixed_string<512>::format("%s=\"%s\" ", pKey, pVal);
|
||||
pPak->FWrite(ioTempString->c_str(), ioTempString->length(), inFileHandle);
|
||||
}
|
||||
pPak->FWrite(">\n", 2, inFileHandle);
|
||||
@@ -372,7 +371,7 @@ void CXMLPatcher::DumpXMLNodes(
|
||||
}
|
||||
|
||||
INDENT();
|
||||
ioTempString->Format("</%s>\n", inNode->getTag());
|
||||
*ioTempString = AZStd::fixed_string<512>::format("</%s>\n", inNode->getTag());
|
||||
pPak->FWrite(ioTempString->c_str(), ioTempString->length(), inFileHandle);
|
||||
}
|
||||
|
||||
@@ -391,12 +390,12 @@ void CXMLPatcher::DumpFiles(
|
||||
{
|
||||
pOrigFileName++;
|
||||
|
||||
DumpXMLFile(string().Format("PATCH_%s", pOrigFileName), inBefore);
|
||||
DumpXMLFile(AZStd::string::format("PATCH_%s", pOrigFileName).c_str(), inBefore);
|
||||
|
||||
CryFixedStringT<128> newFileName(pOrigFileName);
|
||||
newFileName.replace(".xml", "_patched.xml");
|
||||
AZStd::string newFileName(pOrigFileName);
|
||||
AZ::StringFunc::Replace(newFileName, ".xml", "_patched.xml");
|
||||
|
||||
DumpXMLFile(string().Format("PATCH_%s", newFileName.c_str()), inAfter);
|
||||
DumpXMLFile(AZStd::string::format("PATCH_%s", newFileName.c_str()).c_str(), inAfter);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -414,7 +413,7 @@ void CXMLPatcher::DumpXMLFile(
|
||||
|
||||
if (fileHandle != AZ::IO::InvalidHandle)
|
||||
{
|
||||
CryFixedStringT<512> tempStr;
|
||||
AZStd::fixed_string<512> tempStr;
|
||||
|
||||
DumpXMLNodes(fileHandle, 0, inNode, &tempStr);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
AZ::IO::HandleType inFileHandle,
|
||||
int inIndent,
|
||||
const XmlNodeRef& inNode,
|
||||
CryFixedStringT<512>* ioTempString);
|
||||
AZStd::fixed_string<512>* ioTempString);
|
||||
void DumpFiles(
|
||||
const char* pInXMLFileName,
|
||||
const XmlNodeRef& inBefore,
|
||||
|
||||
@@ -313,7 +313,7 @@ bool CXmlUtils::SaveBinaryXmlFile(const char* filename, XmlNodeRef root)
|
||||
return false;
|
||||
}
|
||||
XMLBinary::CXMLBinaryWriter writer;
|
||||
string error;
|
||||
AZStd::string error;
|
||||
return writer.WriteNode(&fileSink, root, false, 0, error);
|
||||
}
|
||||
|
||||
|
||||
@@ -984,13 +984,13 @@ XmlString CXmlNode::MakeValidXmlString(const XmlString& instr) const
|
||||
XmlString str = instr;
|
||||
|
||||
// check if str contains any invalid characters
|
||||
str.replace("&", "&");
|
||||
str.replace("\"", """);
|
||||
str.replace("\'", "'");
|
||||
str.replace("<", "<");
|
||||
str.replace(">", ">");
|
||||
str.replace("...", ">");
|
||||
str.replace("\n", " ");
|
||||
AZ::StringFunc::Replace(str, "&", "&");
|
||||
AZ::StringFunc::Replace(str, "\"", """);
|
||||
AZ::StringFunc::Replace(str, "\'", "'");
|
||||
AZ::StringFunc::Replace(str, "<", "<");
|
||||
AZ::StringFunc::Replace(str, ">", ">");
|
||||
AZ::StringFunc::Replace(str, "...", ">");
|
||||
AZ::StringFunc::Replace(str, "\n", " ");
|
||||
|
||||
return str;
|
||||
}
|
||||
@@ -1390,7 +1390,7 @@ protected:
|
||||
{
|
||||
((XmlParserImp*)userData)->onEndElement(name);
|
||||
}
|
||||
static void characterData(void* userData, const char* s, int len) PREFAST_SUPPRESS_WARNING(6262)
|
||||
static void characterData(void* userData, const char* s, int len)
|
||||
{
|
||||
char str[32700];
|
||||
if (len > sizeof(str) - 1)
|
||||
@@ -1691,8 +1691,8 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString,
|
||||
|
||||
char str[1024];
|
||||
|
||||
CryStackStringT<char, 256> adjustedFilename;
|
||||
CryStackStringT<char, 256> pakPath;
|
||||
AZStd::fixed_string<256> adjustedFilename;
|
||||
AZStd::fixed_string<256> pakPath;
|
||||
if (fileSize <= 0)
|
||||
{
|
||||
CCryFile xmlFile;
|
||||
@@ -1732,9 +1732,9 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString,
|
||||
return 0;
|
||||
}
|
||||
adjustedFilename = xmlFile.GetAdjustedFilename();
|
||||
adjustedFilename.replace('\\', '/');
|
||||
AZStd::replace(adjustedFilename.begin(), adjustedFilename.end(), '\\', '/');
|
||||
pakPath = xmlFile.GetPakPath();
|
||||
pakPath.replace('\\', '/');
|
||||
AZStd::replace(pakPath.begin(), pakPath.end(), '\\', '/');
|
||||
}
|
||||
|
||||
if (g_bEnableBinaryXmlLoading)
|
||||
@@ -1761,7 +1761,7 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString,
|
||||
// not binary XML - refuse to load if in scripts dir and not in bin xml to help reduce hacking
|
||||
// wish we could compile the text xml parser out, but too much work to get everything moved over
|
||||
static const char SCRIPTS_DIR[] = "Scripts/";
|
||||
CryFixedStringT<32> strScripts("S");
|
||||
AZStd::fixed_string<32> strScripts("S");
|
||||
strScripts += "c";
|
||||
strScripts += "r";
|
||||
strScripts += "i";
|
||||
@@ -1770,7 +1770,7 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString,
|
||||
strScripts += "s";
|
||||
strScripts += "/";
|
||||
// exclude files and PAKs from Mods folder
|
||||
CryFixedStringT<8> modsStr("M");
|
||||
AZStd::fixed_string<8> modsStr("M");
|
||||
modsStr += "o";
|
||||
modsStr += "d";
|
||||
modsStr += "s";
|
||||
|
||||
Reference in New Issue
Block a user