mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-29 23:15:56 -04:00
some more static analyzer suggestions
This commit is contained in:
@@ -30,7 +30,7 @@ namespace DataLintNamespace
|
||||
typedef stdvector<std::string>::fwd StringList;
|
||||
typedef std::pair<std::string, std::pair<DataLint::AssetType, StringList> > WarningPair;
|
||||
typedef stdvector<WarningPair>::fwd WarningList;
|
||||
typedef bool (*AssetFunction)(char const *);
|
||||
typedef bool(*AssetFunction)(char const *);
|
||||
|
||||
bool ms_installed = false;
|
||||
DataLint::AssetType m_currentAssetType = DataLint::AT_invalid;
|
||||
@@ -80,7 +80,7 @@ void DataLint::install()
|
||||
m_warningList = new WarningList();
|
||||
m_warningList->reserve(4096);
|
||||
|
||||
m_assetStack = new StringList ();
|
||||
m_assetStack = new StringList();
|
||||
|
||||
m_assetList = new StringPairList();
|
||||
m_assetList->reserve(4096);
|
||||
@@ -116,10 +116,10 @@ void DataLint::report()
|
||||
|
||||
// Server/client
|
||||
|
||||
FILE *assetErrorFileAll = fopen(dataLintErrorsAll.c_str(), "wt");
|
||||
FILE *assetErrorFileAllFatal = fopen(dataLintErrorsAllFatal.c_str(), "wt");
|
||||
FILE *assetErrorFileAllWarning = fopen(dataLintErrorsAllWarning.c_str(), "wt");
|
||||
FILE *assetErrorFileObjectTemplate = fopen(dataLintErrorsAllObjectTemplate.c_str(), "wt");
|
||||
FILE *assetErrorFileAll = fopen(dataLintErrorsAll.c_str(), "wt");
|
||||
FILE *assetErrorFileAllFatal = fopen(dataLintErrorsAllFatal.c_str(), "wt");
|
||||
FILE *assetErrorFileAllWarning = fopen(dataLintErrorsAllWarning.c_str(), "wt");
|
||||
FILE *assetErrorFileObjectTemplate = fopen(dataLintErrorsAllObjectTemplate.c_str(), "wt");
|
||||
|
||||
// Client only
|
||||
|
||||
@@ -137,17 +137,17 @@ void DataLint::report()
|
||||
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
assetErrorFileAppearance = fopen("DataLint_Errors_Appearance.txt", "wt");
|
||||
assetErrorFileAppearance = fopen("DataLint_Errors_Appearance.txt", "wt");
|
||||
assetErrorFileArrangementDescriptor = fopen("DataLint_Errors_ArrangementDescriptor.txt", "wt");
|
||||
assetErrorFileLocalizedStringTable = fopen("DataLint_Errors_LocalizedStringTable.txt", "wt");
|
||||
assetErrorFilePortalProperty = fopen("DataLint_Errors_PortalProperty.txt", "wt");
|
||||
assetErrorFileShaderTemplate = fopen("DataLint_Errors_ShaderTemplate.txt", "wt");
|
||||
assetErrorFileSkyBox = fopen("DataLint_Errors_SkyBox.txt", "wt");
|
||||
assetErrorFileSlotDescriptor = fopen("DataLint_Errors_SlotDescriptor.txt", "wt");
|
||||
assetErrorFileSoundTemplate = fopen("DataLint_Errors_SoundTemplate.txt", "wt");
|
||||
assetErrorFileTerrain = fopen("DataLint_Errors_Terrain.txt", "wt");
|
||||
assetErrorFileTexture = fopen("DataLint_Errors_Texture.txt", "wt");
|
||||
assetErrorFileTextureRenderer = fopen("DataLint_Errors_TextureRenderer.txt", "wt");
|
||||
assetErrorFileLocalizedStringTable = fopen("DataLint_Errors_LocalizedStringTable.txt", "wt");
|
||||
assetErrorFilePortalProperty = fopen("DataLint_Errors_PortalProperty.txt", "wt");
|
||||
assetErrorFileShaderTemplate = fopen("DataLint_Errors_ShaderTemplate.txt", "wt");
|
||||
assetErrorFileSkyBox = fopen("DataLint_Errors_SkyBox.txt", "wt");
|
||||
assetErrorFileSlotDescriptor = fopen("DataLint_Errors_SlotDescriptor.txt", "wt");
|
||||
assetErrorFileSoundTemplate = fopen("DataLint_Errors_SoundTemplate.txt", "wt");
|
||||
assetErrorFileTerrain = fopen("DataLint_Errors_Terrain.txt", "wt");
|
||||
assetErrorFileTexture = fopen("DataLint_Errors_Texture.txt", "wt");
|
||||
assetErrorFileTextureRenderer = fopen("DataLint_Errors_TextureRenderer.txt", "wt");
|
||||
}
|
||||
|
||||
// Might want to think of a better way to keep track of the number of errors for each specific asset type.
|
||||
@@ -205,104 +205,104 @@ void DataLint::report()
|
||||
|
||||
switch (warningListIter->second.first)
|
||||
{
|
||||
case AT_appearance:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileAppearance, *warningListIter, totalErrorCountAppearance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_arrangementDescriptor:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileArrangementDescriptor, *warningListIter, totalErrorCountArrangementDescriptor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_localizedStringTable:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileLocalizedStringTable, *warningListIter, totalErrorCountLocalizedStringTable);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_objectTemplate:
|
||||
{
|
||||
writeError(assetErrorFileObjectTemplate, *warningListIter, totalErrorCountObjectTemplate);
|
||||
}
|
||||
break;
|
||||
case AT_portalProperty:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFilePortalProperty, *warningListIter, totalErrorCountPortalProperty);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_shaderTemplate:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileShaderTemplate, *warningListIter, totalErrorCountShaderTemplate);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_skyBox:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileSkyBox, *warningListIter, totalErrorCountSkyBox);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_slotDescriptor:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileSlotDescriptor, *warningListIter, totalErrorCountSlotDescriptor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_soundTemplate:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileSoundTemplate, *warningListIter, totalErrorCountSoundTemplate);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_terrain:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileTerrain, *warningListIter, totalErrorCountTerrain);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_texture:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileTexture, *warningListIter, totalErrorCountTexture);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_textureRendererTemplate:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileTextureRenderer, *warningListIter, totalErrorCountTextureRenderer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DEBUG_REPORT_LOG_PRINT(true, ("DataLint::remove() - Unsupported asset type: %s", warningListIter->first.c_str()));
|
||||
}
|
||||
break;
|
||||
case AT_appearance:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileAppearance, *warningListIter, totalErrorCountAppearance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_arrangementDescriptor:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileArrangementDescriptor, *warningListIter, totalErrorCountArrangementDescriptor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_localizedStringTable:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileLocalizedStringTable, *warningListIter, totalErrorCountLocalizedStringTable);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_objectTemplate:
|
||||
{
|
||||
writeError(assetErrorFileObjectTemplate, *warningListIter, totalErrorCountObjectTemplate);
|
||||
}
|
||||
break;
|
||||
case AT_portalProperty:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFilePortalProperty, *warningListIter, totalErrorCountPortalProperty);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_shaderTemplate:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileShaderTemplate, *warningListIter, totalErrorCountShaderTemplate);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_skyBox:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileSkyBox, *warningListIter, totalErrorCountSkyBox);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_slotDescriptor:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileSlotDescriptor, *warningListIter, totalErrorCountSlotDescriptor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_soundTemplate:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileSoundTemplate, *warningListIter, totalErrorCountSoundTemplate);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_terrain:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileTerrain, *warningListIter, totalErrorCountTerrain);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_texture:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileTexture, *warningListIter, totalErrorCountTexture);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AT_textureRendererTemplate:
|
||||
{
|
||||
if (m_mode == M_client)
|
||||
{
|
||||
writeError(assetErrorFileTextureRenderer, *warningListIter, totalErrorCountTextureRenderer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DEBUG_REPORT_LOG_PRINT(true, ("DataLint::remove() - Unsupported asset type: %s", warningListIter->first.c_str()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Write the error to the master error file
|
||||
@@ -483,13 +483,13 @@ std::string DataLintNamespace::formatErrorMessage(WarningPair &warningPair, int
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(formatedError, "%3d Error: %s\n", currentErrorCount, assetError);
|
||||
snprintf(formatedError, 4096, "%3d Error: %s\n", currentErrorCount, assetError);
|
||||
result += formatedError;
|
||||
}
|
||||
|
||||
if (lineOfCode)
|
||||
{
|
||||
sprintf(formatedError, " Line of Code: %s\n", lineOfCode);
|
||||
snprintf(formatedError, 4096, " Line of Code: %s\n", lineOfCode);
|
||||
result += formatedError;
|
||||
}
|
||||
|
||||
@@ -499,10 +499,10 @@ std::string DataLintNamespace::formatErrorMessage(WarningPair &warningPair, int
|
||||
{
|
||||
std::string stackString(*stringListIter);
|
||||
|
||||
sprintf(text, " Loaded From: %s\n", stackString.c_str());
|
||||
snprintf(text, 4096, " Loaded From: %s\n", stackString.c_str());
|
||||
fixUpSlashes(text);
|
||||
|
||||
sprintf(formatedError, "%s", text);
|
||||
snprintf(formatedError, 4096, "%s", text);
|
||||
result += formatedError;
|
||||
}
|
||||
|
||||
@@ -731,17 +731,17 @@ bool DataLintNamespace::isAnUnSupportedAsset(char const *text)
|
||||
bool const textureRendererTemplateAsset = isATextureRendererTemplateAsset(text);
|
||||
|
||||
bool const result = !(appearanceAsset ||
|
||||
arrangementDescriptorAsset ||
|
||||
localizedStringAsset ||
|
||||
objectTemplateAsset ||
|
||||
portalPropertyAsset ||
|
||||
shaderTemplateAsset ||
|
||||
skyBoxAsset ||
|
||||
slotDescriptorAsset ||
|
||||
soundAsset ||
|
||||
terrainAsset ||
|
||||
textureAsset ||
|
||||
textureRendererTemplateAsset);
|
||||
arrangementDescriptorAsset ||
|
||||
localizedStringAsset ||
|
||||
objectTemplateAsset ||
|
||||
portalPropertyAsset ||
|
||||
shaderTemplateAsset ||
|
||||
skyBoxAsset ||
|
||||
slotDescriptorAsset ||
|
||||
soundAsset ||
|
||||
terrainAsset ||
|
||||
textureAsset ||
|
||||
textureRendererTemplateAsset);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -777,75 +777,75 @@ DataLint::StringPairList DataLint::getList(AssetType const assetType)
|
||||
{
|
||||
switch (assetType)
|
||||
{
|
||||
case AT_appearance:
|
||||
{
|
||||
return DataLintNamespace::getList(8192, isAnAppearanceAsset);
|
||||
}
|
||||
break;
|
||||
case AT_arrangementDescriptor:
|
||||
{
|
||||
return DataLintNamespace::getList(1024, isAnArrangementDescriptorAsset);
|
||||
}
|
||||
break;
|
||||
case AT_localizedStringTable:
|
||||
{
|
||||
return DataLintNamespace::getList(1024, isALocalizedStringAsset);
|
||||
}
|
||||
break;
|
||||
case AT_objectTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(8192, isAnObjectTemplateAsset);
|
||||
}
|
||||
break;
|
||||
case AT_portalProperty:
|
||||
{
|
||||
return DataLintNamespace::getList(512, isAPortalProprtyAsset);
|
||||
}
|
||||
break;
|
||||
case AT_shaderTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(4096, isAShaderTemplateAsset);
|
||||
}
|
||||
break;
|
||||
case AT_skyBox:
|
||||
{
|
||||
return DataLintNamespace::getList(256, isASkyBoxAsset);
|
||||
}
|
||||
break;
|
||||
case AT_slotDescriptor:
|
||||
{
|
||||
return DataLintNamespace::getList(1024, isASlotDescriptorAsset);
|
||||
}
|
||||
break;
|
||||
case AT_soundTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(4096, isASoundAsset);
|
||||
}
|
||||
break;
|
||||
case AT_terrain:
|
||||
{
|
||||
return DataLintNamespace::getList(32, isATerrainAsset);
|
||||
}
|
||||
break;
|
||||
case AT_texture:
|
||||
{
|
||||
return DataLintNamespace::getList(8192, isATextureAsset);
|
||||
}
|
||||
break;
|
||||
case AT_textureRendererTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(512, isATextureRendererTemplateAsset);
|
||||
}
|
||||
break;
|
||||
case AT_unSupported:
|
||||
{
|
||||
return DataLintNamespace::getList(4096, isAnUnSupportedAsset);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DEBUG_FATAL(true, ("DataLint::getList() - Unknown list type."));
|
||||
}
|
||||
case AT_appearance:
|
||||
{
|
||||
return DataLintNamespace::getList(8192, isAnAppearanceAsset);
|
||||
}
|
||||
break;
|
||||
case AT_arrangementDescriptor:
|
||||
{
|
||||
return DataLintNamespace::getList(1024, isAnArrangementDescriptorAsset);
|
||||
}
|
||||
break;
|
||||
case AT_localizedStringTable:
|
||||
{
|
||||
return DataLintNamespace::getList(1024, isALocalizedStringAsset);
|
||||
}
|
||||
break;
|
||||
case AT_objectTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(8192, isAnObjectTemplateAsset);
|
||||
}
|
||||
break;
|
||||
case AT_portalProperty:
|
||||
{
|
||||
return DataLintNamespace::getList(512, isAPortalProprtyAsset);
|
||||
}
|
||||
break;
|
||||
case AT_shaderTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(4096, isAShaderTemplateAsset);
|
||||
}
|
||||
break;
|
||||
case AT_skyBox:
|
||||
{
|
||||
return DataLintNamespace::getList(256, isASkyBoxAsset);
|
||||
}
|
||||
break;
|
||||
case AT_slotDescriptor:
|
||||
{
|
||||
return DataLintNamespace::getList(1024, isASlotDescriptorAsset);
|
||||
}
|
||||
break;
|
||||
case AT_soundTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(4096, isASoundAsset);
|
||||
}
|
||||
break;
|
||||
case AT_terrain:
|
||||
{
|
||||
return DataLintNamespace::getList(32, isATerrainAsset);
|
||||
}
|
||||
break;
|
||||
case AT_texture:
|
||||
{
|
||||
return DataLintNamespace::getList(8192, isATextureAsset);
|
||||
}
|
||||
break;
|
||||
case AT_textureRendererTemplate:
|
||||
{
|
||||
return DataLintNamespace::getList(512, isATextureRendererTemplateAsset);
|
||||
}
|
||||
break;
|
||||
case AT_unSupported:
|
||||
{
|
||||
return DataLintNamespace::getList(4096, isAnUnSupportedAsset);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DEBUG_FATAL(true, ("DataLint::getList() - Unknown list type."));
|
||||
}
|
||||
}
|
||||
|
||||
return StringPairList();
|
||||
@@ -904,4 +904,4 @@ void DataLint::setServerMode()
|
||||
m_mode = M_server;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ============================================================================
|
||||
@@ -29,9 +29,9 @@ uint32 RemoteDebugServer::ms_inputTarget;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
RemoteDebug::Channel::Channel(const std::string& name, Channel *parent)
|
||||
: m_name(nullptr),
|
||||
m_parent(parent)
|
||||
RemoteDebug::Channel::Channel(const std::string& name, Channel *parent)
|
||||
: m_name(nullptr),
|
||||
m_parent(parent)
|
||||
{
|
||||
m_name = new std::string(name);
|
||||
m_children = new NodeList;
|
||||
@@ -42,7 +42,7 @@ RemoteDebug::Channel::Channel(const std::string& name, Channel *parent)
|
||||
RemoteDebug::Channel::~Channel()
|
||||
{
|
||||
m_parent = nullptr;
|
||||
if(m_name)
|
||||
if (m_name)
|
||||
{
|
||||
delete m_name;
|
||||
m_name = nullptr;
|
||||
@@ -71,33 +71,32 @@ const std::string& RemoteDebug::Channel::name()
|
||||
// ======================================================================
|
||||
|
||||
RemoteDebug::Variable::Variable(const std::string& name, void *memLoc, VARIABLE_TYPES type)
|
||||
: m_memLoc(memLoc),
|
||||
m_name(nullptr),
|
||||
m_type(type)
|
||||
: m_memLoc(memLoc),
|
||||
m_name(nullptr),
|
||||
m_type(type)
|
||||
{
|
||||
m_name = new std::string(name);
|
||||
|
||||
int32 i = 0;
|
||||
float f = 0.0;
|
||||
char s = '\0';
|
||||
int32 b = 0;
|
||||
switch(m_type)
|
||||
switch (m_type)
|
||||
{
|
||||
case INT:
|
||||
m_value.intValue = i;
|
||||
break;
|
||||
case INT:
|
||||
m_value.intValue = i;
|
||||
break;
|
||||
|
||||
case FLOAT:
|
||||
m_value.floatValue = f;
|
||||
break;
|
||||
case FLOAT:
|
||||
m_value.floatValue = f;
|
||||
break;
|
||||
|
||||
case CSTRING:
|
||||
m_value.stringValue = &s;
|
||||
break;
|
||||
case CSTRING:
|
||||
m_value.stringValue = nullptr;
|
||||
break;
|
||||
|
||||
case BOOL:
|
||||
m_value.boolValue = b;
|
||||
break;
|
||||
case BOOL:
|
||||
m_value.boolValue = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +104,10 @@ RemoteDebug::Variable::Variable(const std::string& name, void *memLoc, VARIABLE_
|
||||
|
||||
RemoteDebug::Variable::~Variable()
|
||||
{
|
||||
if(m_type == CSTRING)
|
||||
if (m_type == CSTRING)
|
||||
delete m_value.stringValue;
|
||||
|
||||
if(m_name)
|
||||
|
||||
if (m_name)
|
||||
{
|
||||
delete m_name;
|
||||
m_name = nullptr;
|
||||
@@ -119,23 +118,23 @@ RemoteDebug::Variable::~Variable()
|
||||
|
||||
void RemoteDebug::Variable::setValue(VARIABLEVALUE v)
|
||||
{
|
||||
switch(m_type)
|
||||
switch (m_type)
|
||||
{
|
||||
case INT:
|
||||
m_value.intValue = v.intValue;
|
||||
break;
|
||||
case INT:
|
||||
m_value.intValue = v.intValue;
|
||||
break;
|
||||
|
||||
case FLOAT:
|
||||
m_value.floatValue = v.floatValue;
|
||||
break;
|
||||
case FLOAT:
|
||||
m_value.floatValue = v.floatValue;
|
||||
break;
|
||||
|
||||
case CSTRING:
|
||||
m_value.stringValue = v.stringValue;
|
||||
break;
|
||||
case CSTRING:
|
||||
m_value.stringValue = v.stringValue;
|
||||
break;
|
||||
|
||||
case BOOL:
|
||||
m_value.boolValue = v.boolValue;
|
||||
break;
|
||||
case BOOL:
|
||||
m_value.boolValue = v.boolValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,27 +142,27 @@ void RemoteDebug::Variable::setValue(VARIABLEVALUE v)
|
||||
|
||||
void RemoteDebug::Variable::setValue(void *memLoc)
|
||||
{
|
||||
if(memLoc)
|
||||
if (memLoc)
|
||||
{
|
||||
switch(m_type)
|
||||
switch (m_type)
|
||||
{
|
||||
case INT:
|
||||
memcpy(&m_value.intValue, memLoc, sizeof(int32));
|
||||
break;
|
||||
case INT:
|
||||
memcpy(&m_value.intValue, memLoc, sizeof(int32));
|
||||
break;
|
||||
|
||||
case FLOAT:
|
||||
memcpy(&m_value.floatValue, memLoc, sizeof(float));
|
||||
break;
|
||||
case FLOAT:
|
||||
memcpy(&m_value.floatValue, memLoc, sizeof(float));
|
||||
break;
|
||||
|
||||
case CSTRING:
|
||||
delete[] m_value.stringValue;
|
||||
m_value.stringValue = new char[strlen(static_cast<char *>(memLoc))];
|
||||
strcpy(m_value.stringValue, const_cast<const char *>(static_cast<char *>(memLoc)));
|
||||
break;
|
||||
case CSTRING:
|
||||
delete[] m_value.stringValue;
|
||||
m_value.stringValue = new char[strlen(static_cast<char *>(memLoc))];
|
||||
strcpy(m_value.stringValue, const_cast<const char *>(static_cast<char *>(memLoc)));
|
||||
break;
|
||||
|
||||
case BOOL:
|
||||
memcpy(&m_value.boolValue, memLoc, sizeof(int32));
|
||||
break;
|
||||
case BOOL:
|
||||
memcpy(&m_value.boolValue, memLoc, sizeof(int32));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,8 +192,8 @@ void RemoteDebug::Variable::setType(VARIABLE_TYPES type)
|
||||
void RemoteDebug::Variable::pushValue()
|
||||
{
|
||||
if (m_memLoc)
|
||||
switch (m_type)
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case BOOL:
|
||||
case INT:
|
||||
memcpy(m_memLoc, &m_value, sizeof(int32));
|
||||
@@ -207,7 +206,7 @@ void RemoteDebug::Variable::pushValue()
|
||||
case FLOAT:
|
||||
memcpy(m_memLoc, &m_value, sizeof(float));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -219,24 +218,24 @@ RemoteDebug::VARIABLE_TYPES RemoteDebug::Variable::type()
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void RemoteDebugClient::install(RemoveFunction rf, OpenFunction of,
|
||||
CloseFunction cf, SendFunction sf,
|
||||
IsReadyFunction irf, NewStreamFunction ncf,
|
||||
StreamMessageFunction cmf, NewVariableFunction nvf,
|
||||
VariableValueFunction vvf, VariableTypeFunction vtf,
|
||||
BeginFrameFunction bff, EndFrameFunction eff,
|
||||
NewStaticViewFunction nsvf, LineFunction lf)
|
||||
void RemoteDebugClient::install(RemoveFunction rf, OpenFunction of,
|
||||
CloseFunction cf, SendFunction sf,
|
||||
IsReadyFunction irf, NewStreamFunction ncf,
|
||||
StreamMessageFunction cmf, NewVariableFunction nvf,
|
||||
VariableValueFunction vvf, VariableTypeFunction vtf,
|
||||
BeginFrameFunction bff, EndFrameFunction eff,
|
||||
NewStaticViewFunction nsvf, LineFunction lf)
|
||||
{
|
||||
RemoteDebug::install(rf, of, cf, sf, irf);
|
||||
ms_newStreamFunction = ncf;
|
||||
ms_streamMessageFunction = cmf;
|
||||
ms_newVariableFunction = nvf;
|
||||
ms_variableValueFunction = vvf;
|
||||
ms_variableTypeFunction = vtf;
|
||||
ms_beginFrameFunction = bff;
|
||||
ms_endFrameFunction = eff;
|
||||
ms_newStaticViewFunction = nsvf;
|
||||
ms_lineFunction = lf;
|
||||
ms_newStreamFunction = ncf;
|
||||
ms_streamMessageFunction = cmf;
|
||||
ms_newVariableFunction = nvf;
|
||||
ms_variableValueFunction = vvf;
|
||||
ms_variableTypeFunction = vtf;
|
||||
ms_beginFrameFunction = bff;
|
||||
ms_endFrameFunction = eff;
|
||||
ms_newStaticViewFunction = nsvf;
|
||||
ms_lineFunction = lf;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -256,7 +255,7 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3
|
||||
//convert to a const char[] for conveinence
|
||||
const char * const charMessage = reinterpret_cast<const char * const>(message);
|
||||
//these values are known based on the packet protocol (see RemoteDebug.h for more info
|
||||
const int sizeOfMessageType = 1;
|
||||
const int sizeOfMessageType = 1;
|
||||
const int sizeOfChannelNumber = 4;
|
||||
const int sizeOfSizeofPayload = 4;
|
||||
//this value is filled in from the packet
|
||||
@@ -264,7 +263,7 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3
|
||||
//this value if filled in from the packet
|
||||
uint32 sizeOfPayload = 0;
|
||||
|
||||
//get the message type
|
||||
//get the message type
|
||||
RemoteDebug::MESSAGE_TYPE type = static_cast<RemoteDebug::MESSAGE_TYPE>(charMessage[0]);
|
||||
|
||||
//grab the channelNumber
|
||||
@@ -272,12 +271,12 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3
|
||||
|
||||
//build the payload if needed
|
||||
if (type == RemoteDebug::STREAM ||
|
||||
type == RemoteDebug::STATIC_LINE ||
|
||||
type == RemoteDebug::NEW_STATIC ||
|
||||
type == RemoteDebug::NEW_STREAM ||
|
||||
type == RemoteDebug::VARIABLE_TYPE ||
|
||||
type == RemoteDebug::VARIABLE_VALUE ||
|
||||
type == RemoteDebug::NEW_VARIABLE)
|
||||
type == RemoteDebug::STATIC_LINE ||
|
||||
type == RemoteDebug::NEW_STATIC ||
|
||||
type == RemoteDebug::NEW_STREAM ||
|
||||
type == RemoteDebug::VARIABLE_TYPE ||
|
||||
type == RemoteDebug::VARIABLE_VALUE ||
|
||||
type == RemoteDebug::NEW_VARIABLE)
|
||||
{
|
||||
memcpy(&sizeOfPayload, charMessage + sizeOfMessageType + sizeOfChannelNumber, sizeOfSizeofPayload);
|
||||
memcpy(ms_buffer, charMessage + sizeOfMessageType + sizeOfChannelNumber + sizeOfSizeofPayload, sizeOfPayload);
|
||||
@@ -287,81 +286,81 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3
|
||||
int32 t;
|
||||
VARIABLE_TYPES varType;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case RemoteDebug::STREAM:
|
||||
//see if we're redefining an already existing stream
|
||||
if(ms_streamMessageFunction)
|
||||
ms_streamMessageFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
case RemoteDebug::STREAM:
|
||||
//see if we're redefining an already existing stream
|
||||
if (ms_streamMessageFunction)
|
||||
ms_streamMessageFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
|
||||
case RemoteDebug::NEW_STREAM:
|
||||
if (channelNumber < ms_nextStream)
|
||||
return;
|
||||
registerStream(ms_buffer);
|
||||
if (ms_newStreamFunction)
|
||||
ms_newStreamFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
case RemoteDebug::NEW_STREAM:
|
||||
if (channelNumber < ms_nextStream)
|
||||
return;
|
||||
registerStream(ms_buffer);
|
||||
if (ms_newStreamFunction)
|
||||
ms_newStreamFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
|
||||
case RemoteDebug::NEW_VARIABLE:
|
||||
if (channelNumber < ms_nextVariable)
|
||||
return;
|
||||
//do not send value back to server (hence the "false")
|
||||
registerVariable(ms_buffer, nullptr, BOOL, false);
|
||||
if (ms_newVariableFunction)
|
||||
ms_newVariableFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
case RemoteDebug::NEW_VARIABLE:
|
||||
if (channelNumber < ms_nextVariable)
|
||||
return;
|
||||
//do not send value back to server (hence the "false")
|
||||
registerVariable(ms_buffer, nullptr, BOOL, false);
|
||||
if (ms_newVariableFunction)
|
||||
ms_newVariableFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
|
||||
case RemoteDebug::VARIABLE_TYPE:
|
||||
t = atoi(ms_buffer);
|
||||
varType = static_cast<VARIABLE_TYPES>(t);
|
||||
(*ms_variableValues)[channelNumber]->setType(varType);
|
||||
if(ms_variableTypeFunction)
|
||||
ms_variableTypeFunction(channelNumber, varType);
|
||||
break;
|
||||
|
||||
case RemoteDebug::VARIABLE_VALUE:
|
||||
(*ms_variableValues)[channelNumber]->setValue(ms_buffer);
|
||||
if(ms_variableValueFunction)
|
||||
ms_variableValueFunction(channelNumber, ms_buffer);
|
||||
break;
|
||||
case RemoteDebug::VARIABLE_TYPE:
|
||||
t = atoi(ms_buffer);
|
||||
varType = static_cast<VARIABLE_TYPES>(t);
|
||||
(*ms_variableValues)[channelNumber]->setType(varType);
|
||||
if (ms_variableTypeFunction)
|
||||
ms_variableTypeFunction(channelNumber, varType);
|
||||
break;
|
||||
|
||||
case RemoteDebug::NEW_STATIC:
|
||||
if (channelNumber < ms_nextStaticView)
|
||||
return;
|
||||
registerStaticView(ms_buffer);
|
||||
if (ms_newStaticViewFunction)
|
||||
ms_newStaticViewFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
case RemoteDebug::VARIABLE_VALUE:
|
||||
(*ms_variableValues)[channelNumber]->setValue(ms_buffer);
|
||||
if (ms_variableValueFunction)
|
||||
ms_variableValueFunction(channelNumber, ms_buffer);
|
||||
break;
|
||||
|
||||
case RemoteDebug::STATIC_LINE:
|
||||
if (ms_lineFunction)
|
||||
ms_lineFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
case RemoteDebug::NEW_STATIC:
|
||||
if (channelNumber < ms_nextStaticView)
|
||||
return;
|
||||
registerStaticView(ms_buffer);
|
||||
if (ms_newStaticViewFunction)
|
||||
ms_newStaticViewFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
|
||||
case RemoteDebug::STATIC_BEGIN_FRAME:
|
||||
if (ms_beginFrameFunction)
|
||||
ms_beginFrameFunction(channelNumber);
|
||||
break;
|
||||
case RemoteDebug::STATIC_LINE:
|
||||
if (ms_lineFunction)
|
||||
ms_lineFunction(channelNumber, const_cast<const char*>(ms_buffer));
|
||||
break;
|
||||
|
||||
case RemoteDebug::STATIC_END_FRAME:
|
||||
if (ms_endFrameFunction)
|
||||
ms_endFrameFunction(channelNumber);
|
||||
break;
|
||||
case RemoteDebug::STATIC_BEGIN_FRAME:
|
||||
if (ms_beginFrameFunction)
|
||||
ms_beginFrameFunction(channelNumber);
|
||||
break;
|
||||
|
||||
case RemoteDebug::STREAM_SQUELCH:
|
||||
case RemoteDebug::STREAM_UNSQUELCH:
|
||||
case RemoteDebug::STATIC_SQUELCH:
|
||||
case RemoteDebug::STATIC_UNSQUELCH:
|
||||
case RemoteDebug::STATIC_INPUT_TARGET:
|
||||
case RemoteDebug::STATIC_UP:
|
||||
case RemoteDebug::STATIC_DOWN:
|
||||
case RemoteDebug::STATIC_LEFT:
|
||||
case RemoteDebug::STATIC_RIGHT:
|
||||
case RemoteDebug::STATIC_ENTER:
|
||||
case RemoteDebug::REQUEST_ALL_CHANNELS:
|
||||
default:
|
||||
break;
|
||||
case RemoteDebug::STATIC_END_FRAME:
|
||||
if (ms_endFrameFunction)
|
||||
ms_endFrameFunction(channelNumber);
|
||||
break;
|
||||
|
||||
case RemoteDebug::STREAM_SQUELCH:
|
||||
case RemoteDebug::STREAM_UNSQUELCH:
|
||||
case RemoteDebug::STATIC_SQUELCH:
|
||||
case RemoteDebug::STATIC_UNSQUELCH:
|
||||
case RemoteDebug::STATIC_INPUT_TARGET:
|
||||
case RemoteDebug::STATIC_UP:
|
||||
case RemoteDebug::STATIC_DOWN:
|
||||
case RemoteDebug::STATIC_LEFT:
|
||||
case RemoteDebug::STATIC_RIGHT:
|
||||
case RemoteDebug::STATIC_ENTER:
|
||||
case RemoteDebug::REQUEST_ALL_CHANNELS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,9 +372,9 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3
|
||||
void RemoteDebugClient::close()
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("remoteDebug not installed"));
|
||||
|
||||
|
||||
//don't need to do anything if we're already closed
|
||||
if(!ms_opened)
|
||||
if (!ms_opened)
|
||||
return;
|
||||
|
||||
if (ms_closeFunction)
|
||||
@@ -402,9 +401,9 @@ void RemoteDebugClient::close()
|
||||
ms_squelchedStream->clear();
|
||||
ms_squelchedStatic->clear();
|
||||
|
||||
ms_nextStream = 0;
|
||||
ms_nextStream = 0;
|
||||
ms_nextStaticView = 0;
|
||||
ms_nextVariable = 0;
|
||||
ms_nextVariable = 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -419,9 +418,9 @@ void RemoteDebugClient::isReady()
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void RemoteDebugServer::install(RemoveFunction rmf, OpenFunction of ,
|
||||
CloseFunction cf , SendFunction sf,
|
||||
IsReadyFunction irf)
|
||||
void RemoteDebugServer::install(RemoveFunction rmf, OpenFunction of,
|
||||
CloseFunction cf, SendFunction sf,
|
||||
IsReadyFunction irf)
|
||||
{
|
||||
RemoteDebug::install(rmf, of, cf, sf, irf);
|
||||
ms_inputTarget = 0;
|
||||
@@ -452,7 +451,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3
|
||||
//convert to a const char[] for conveinence
|
||||
const char * const charMessage = reinterpret_cast<const char * const>(message);
|
||||
//these values are known based on the packet protocol (see RemoteDebug.h for more info
|
||||
const int sizeOfMessageType = 1;
|
||||
const int sizeOfMessageType = 1;
|
||||
const int sizeOfChannelNumber = 4;
|
||||
const int sizeOfSizeofPayload = 4;
|
||||
//this value is filled in from the packet
|
||||
@@ -460,7 +459,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3
|
||||
//this value if filled in from the packet
|
||||
uint32 sizeOfPayload = 0;
|
||||
|
||||
//get the message type
|
||||
//get the message type
|
||||
RemoteDebug::MESSAGE_TYPE type = static_cast<RemoteDebug::MESSAGE_TYPE>(charMessage[0]);
|
||||
|
||||
//grab the channelNumber
|
||||
@@ -468,92 +467,92 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3
|
||||
|
||||
//build the payload if needed
|
||||
if (type == RemoteDebug::STREAM ||
|
||||
type == RemoteDebug::NEW_STREAM ||
|
||||
type == RemoteDebug::VARIABLE_TYPE ||
|
||||
type == RemoteDebug::VARIABLE_VALUE ||
|
||||
type == RemoteDebug::NEW_VARIABLE)
|
||||
type == RemoteDebug::NEW_STREAM ||
|
||||
type == RemoteDebug::VARIABLE_TYPE ||
|
||||
type == RemoteDebug::VARIABLE_VALUE ||
|
||||
type == RemoteDebug::NEW_VARIABLE)
|
||||
{
|
||||
memcpy(&sizeOfPayload, charMessage + sizeOfMessageType + sizeOfChannelNumber, sizeOfSizeofPayload);
|
||||
memcpy(ms_buffer, charMessage + sizeOfMessageType + sizeOfChannelNumber + sizeOfSizeofPayload, sizeOfPayload);
|
||||
}
|
||||
|
||||
Variable* v = nullptr;
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case STREAM:
|
||||
case NEW_STREAM:
|
||||
case VARIABLE_TYPE:
|
||||
case NEW_VARIABLE:
|
||||
break;
|
||||
case STREAM:
|
||||
case NEW_STREAM:
|
||||
case VARIABLE_TYPE:
|
||||
case NEW_VARIABLE:
|
||||
break;
|
||||
|
||||
case STREAM_SQUELCH:
|
||||
(*ms_squelchedStream)[channelNumber] = true;
|
||||
break;
|
||||
case STREAM_SQUELCH:
|
||||
(*ms_squelchedStream)[channelNumber] = true;
|
||||
break;
|
||||
|
||||
case STREAM_UNSQUELCH:
|
||||
(*ms_squelchedStream)[channelNumber] = false;
|
||||
break;
|
||||
case STREAM_UNSQUELCH:
|
||||
(*ms_squelchedStream)[channelNumber] = false;
|
||||
break;
|
||||
|
||||
case VARIABLE_VALUE:
|
||||
//set the new value into the variable on the server side
|
||||
v = (*ms_variableValues)[channelNumber];
|
||||
if(!v)
|
||||
{
|
||||
DEBUG_FATAL(true, ("message on undefined variable"));
|
||||
return; //lint !e527 unreachable code
|
||||
}
|
||||
v->setValue(ms_buffer);
|
||||
//put that new value back into the game object
|
||||
v->pushValue();
|
||||
break;
|
||||
case VARIABLE_VALUE:
|
||||
//set the new value into the variable on the server side
|
||||
v = (*ms_variableValues)[channelNumber];
|
||||
if (!v)
|
||||
{
|
||||
DEBUG_FATAL(true, ("message on undefined variable"));
|
||||
return; //lint !e527 unreachable code
|
||||
}
|
||||
v->setValue(ms_buffer);
|
||||
//put that new value back into the game object
|
||||
v->pushValue();
|
||||
break;
|
||||
|
||||
case STATIC_SQUELCH:
|
||||
(*ms_squelchedStatic)[channelNumber] = true;
|
||||
break;
|
||||
case STATIC_SQUELCH:
|
||||
(*ms_squelchedStatic)[channelNumber] = true;
|
||||
break;
|
||||
|
||||
case STATIC_UNSQUELCH:
|
||||
(*ms_squelchedStatic)[channelNumber] = false;
|
||||
break;
|
||||
case STATIC_UNSQUELCH:
|
||||
(*ms_squelchedStatic)[channelNumber] = false;
|
||||
break;
|
||||
|
||||
case REQUEST_ALL_CHANNELS:
|
||||
sendAllChannels();
|
||||
break;
|
||||
case REQUEST_ALL_CHANNELS:
|
||||
sendAllChannels();
|
||||
break;
|
||||
|
||||
case STATIC_INPUT_TARGET:
|
||||
ms_inputTarget = channelNumber;
|
||||
break;
|
||||
case STATIC_INPUT_TARGET:
|
||||
ms_inputTarget = channelNumber;
|
||||
break;
|
||||
|
||||
case STATIC_UP:
|
||||
if ((*ms_upFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_upFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
case STATIC_UP:
|
||||
if ((*ms_upFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_upFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
|
||||
case STATIC_DOWN:
|
||||
if ((*ms_downFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_downFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
case STATIC_DOWN:
|
||||
if ((*ms_downFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_downFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
|
||||
case STATIC_LEFT:
|
||||
if ((*ms_leftFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_leftFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
case STATIC_LEFT:
|
||||
if ((*ms_leftFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_leftFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
|
||||
case STATIC_RIGHT:
|
||||
if ((*ms_rightFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_rightFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
case STATIC_RIGHT:
|
||||
if ((*ms_rightFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_rightFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
|
||||
case STATIC_ENTER:
|
||||
if ((*ms_enterFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_enterFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
case STATIC_ENTER:
|
||||
if ((*ms_enterFunctionMap)[ms_inputTarget] != nullptr)
|
||||
(*ms_enterFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment)
|
||||
break;
|
||||
|
||||
case NEW_STATIC:
|
||||
case STATIC_BEGIN_FRAME:
|
||||
case STATIC_END_FRAME:
|
||||
case STATIC_LINE:
|
||||
default:
|
||||
break;
|
||||
case NEW_STATIC:
|
||||
case STATIC_BEGIN_FRAME:
|
||||
case STATIC_END_FRAME:
|
||||
case STATIC_LINE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +564,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3
|
||||
void RemoteDebugServer::close()
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("remoteDebug not installed"));
|
||||
|
||||
|
||||
if (ms_closeFunction)
|
||||
ms_closeFunction();
|
||||
ms_opened = false;
|
||||
@@ -575,16 +574,16 @@ void RemoteDebugServer::close()
|
||||
|
||||
void RemoteDebugServer::sendAllChannels()
|
||||
{
|
||||
for(StreamMap::iterator it = ms_streams->begin(); it != ms_streams->end(); ++it)
|
||||
for (StreamMap::iterator it = ms_streams->begin(); it != ms_streams->end(); ++it)
|
||||
send(NEW_STREAM, it->second->name().c_str());
|
||||
for(VariableMap::iterator itr = ms_variables->begin(); itr != ms_variables->end(); ++itr)
|
||||
for (VariableMap::iterator itr = ms_variables->begin(); itr != ms_variables->end(); ++itr)
|
||||
{
|
||||
send(NEW_VARIABLE, itr->second->name().c_str());
|
||||
send(VARIABLE_TYPE, itr->second->name().c_str());
|
||||
send(VARIABLE_VALUE, itr->second->name().c_str());
|
||||
}
|
||||
for(StaticViewMap::iterator iter = ms_staticViews->begin(); iter != ms_staticViews->end(); ++iter)
|
||||
for (StaticViewMap::iterator iter = ms_staticViews->begin(); iter != ms_staticViews->end(); ++iter)
|
||||
send(NEW_STATIC, iter->second->name().c_str());
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// ======================================================================
|
||||
@@ -111,7 +111,7 @@ namespace AssetCustomizationManagerNamespace
|
||||
void getIntRangeFromIntRangeId(int intRangeId, IntRange &intRange);
|
||||
void getRangeTypeInfoFromRangeId(int rangeId, bool &isPalette, int &idForRealType);
|
||||
VariableUsage const *getVariableUsageFromId(int variableUsageId);
|
||||
|
||||
|
||||
UsageIndexEntry const *lookupVariableUsageIndexEntry(int assetId);
|
||||
LinkIndexEntry const *lookupAssetLinkIndexEntry(int assetId);
|
||||
int lookupAssetId(CrcString const &assetName);
|
||||
@@ -123,19 +123,19 @@ namespace AssetCustomizationManagerNamespace
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Tag const TAG_ACST = TAG(A,C,S,T);
|
||||
Tag const TAG_CIDX = TAG(C,I,D,X);
|
||||
Tag const TAG_DEFV = TAG(D,E,F,V);
|
||||
Tag const TAG_IRNG = TAG(I,R,N,G);
|
||||
Tag const TAG_LIDX = TAG(L,I,D,X);
|
||||
Tag const TAG_LLST = TAG(L,L,S,T);
|
||||
Tag const TAG_NAME = TAG(N,A,M,E);
|
||||
Tag const TAG_PNOF = TAG(P,N,O,F);
|
||||
Tag const TAG_RTYP = TAG(R,T,Y,P);
|
||||
Tag const TAG_UCMP = TAG(U,C,M,P);
|
||||
Tag const TAG_UIDX = TAG(U,I,D,X);
|
||||
Tag const TAG_ULST = TAG(U,L,S,T);
|
||||
Tag const TAG_VNOF = TAG(V,N,O,F);
|
||||
Tag const TAG_ACST = TAG(A, C, S, T);
|
||||
Tag const TAG_CIDX = TAG(C, I, D, X);
|
||||
Tag const TAG_DEFV = TAG(D, E, F, V);
|
||||
Tag const TAG_IRNG = TAG(I, R, N, G);
|
||||
Tag const TAG_LIDX = TAG(L, I, D, X);
|
||||
Tag const TAG_LLST = TAG(L, L, S, T);
|
||||
Tag const TAG_NAME = TAG(N, A, M, E);
|
||||
Tag const TAG_PNOF = TAG(P, N, O, F);
|
||||
Tag const TAG_RTYP = TAG(R, T, Y, P);
|
||||
Tag const TAG_UCMP = TAG(U, C, M, P);
|
||||
Tag const TAG_UIDX = TAG(U, I, D, X);
|
||||
Tag const TAG_ULST = TAG(U, L, S, T);
|
||||
Tag const TAG_VNOF = TAG(V, N, O, F);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -191,52 +191,52 @@ void AssetCustomizationManagerNamespace::remove()
|
||||
DEBUG_FATAL(!s_installed, ("AssetCustomizationManager not installed."));
|
||||
s_installed = false;
|
||||
|
||||
delete [] s_nameDataBlock;
|
||||
s_nameDataBlock = nullptr;
|
||||
delete[] s_nameDataBlock;
|
||||
s_nameDataBlock = nullptr;
|
||||
s_nameDataBlockSize = 0;
|
||||
|
||||
delete [] s_paletteIdNameOffsetMap;
|
||||
delete[] s_paletteIdNameOffsetMap;
|
||||
s_paletteIdNameOffsetMap = nullptr;
|
||||
s_maxValidPaletteId = 0;
|
||||
s_maxValidPaletteId = 0;
|
||||
|
||||
delete [] s_variableIdNameOffsetMap;
|
||||
delete[] s_variableIdNameOffsetMap;
|
||||
s_variableIdNameOffsetMap = nullptr;
|
||||
s_maxValidVariableId = 0;
|
||||
s_maxValidVariableId = 0;
|
||||
|
||||
delete [] s_defaultValueMap;
|
||||
s_defaultValueMap = nullptr;
|
||||
delete[] s_defaultValueMap;
|
||||
s_defaultValueMap = nullptr;
|
||||
s_maxValidDefaultId = 0;
|
||||
|
||||
delete [] s_intRangeMap;
|
||||
s_intRangeMap = nullptr;
|
||||
delete[] s_intRangeMap;
|
||||
s_intRangeMap = nullptr;
|
||||
s_maxValidIntRangeId = 0;
|
||||
|
||||
delete [] s_rangeTypeMap;
|
||||
s_rangeTypeMap = nullptr;
|
||||
delete[] s_rangeTypeMap;
|
||||
s_rangeTypeMap = nullptr;
|
||||
s_maxValidRangeId = 0;
|
||||
|
||||
delete [] s_variableUsageMap;
|
||||
s_variableUsageMap = nullptr;
|
||||
delete[] s_variableUsageMap;
|
||||
s_variableUsageMap = nullptr;
|
||||
s_maxValidVariableUsageId = 0;
|
||||
|
||||
delete [] s_variableUsageList;
|
||||
s_variableUsageList = 0;
|
||||
delete[] s_variableUsageList;
|
||||
s_variableUsageList = 0;
|
||||
s_variableUsageListEntryCount = 0;
|
||||
|
||||
delete [] s_usageIndex;
|
||||
s_usageIndex = nullptr;
|
||||
delete[] s_usageIndex;
|
||||
s_usageIndex = nullptr;
|
||||
s_usageIndexEntryCount = 0;
|
||||
|
||||
delete [] s_linkList;
|
||||
s_linkList = nullptr;
|
||||
delete[] s_linkList;
|
||||
s_linkList = nullptr;
|
||||
s_linkListEntryCount = 0;
|
||||
|
||||
delete [] s_linkIndex;
|
||||
s_linkIndex = nullptr;
|
||||
delete[] s_linkIndex;
|
||||
s_linkIndex = nullptr;
|
||||
s_linkIndexEntryCount = 0;
|
||||
|
||||
delete [] s_crcLookupTable;
|
||||
s_crcLookupTable = nullptr;
|
||||
delete[] s_crcLookupTable;
|
||||
s_crcLookupTable = nullptr;
|
||||
s_crcLookupEntryCount = 0;
|
||||
}
|
||||
|
||||
@@ -245,21 +245,21 @@ void AssetCustomizationManagerNamespace::remove()
|
||||
void AssetCustomizationManagerNamespace::load(Iff &iff)
|
||||
{
|
||||
iff.enterForm(TAG_ACST);
|
||||
|
||||
Tag const version = iff.getCurrentName();
|
||||
switch (version)
|
||||
{
|
||||
case TAG_0000:
|
||||
load_0000(iff);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char buffer[5];
|
||||
ConvertTagToString(version, buffer);
|
||||
FATAL(true, ("unsupported AssetCustomizationManager file version [%s].", buffer));
|
||||
}
|
||||
}
|
||||
Tag const version = iff.getCurrentName();
|
||||
switch (version)
|
||||
{
|
||||
case TAG_0000:
|
||||
load_0000(iff);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char buffer[5];
|
||||
ConvertTagToString(version, buffer);
|
||||
FATAL(true, ("unsupported AssetCustomizationManager file version [%s].", buffer));
|
||||
}
|
||||
}
|
||||
|
||||
iff.exitForm(TAG_ACST);
|
||||
}
|
||||
@@ -270,113 +270,113 @@ void AssetCustomizationManagerNamespace::load_0000(Iff &iff)
|
||||
{
|
||||
iff.enterForm(TAG_0000);
|
||||
|
||||
//-- Read name data as one big block.
|
||||
iff.enterChunk(TAG_NAME);
|
||||
//-- Read name data as one big block.
|
||||
iff.enterChunk(TAG_NAME);
|
||||
|
||||
s_nameDataBlockSize = iff.getChunkLengthLeft();
|
||||
s_nameDataBlock = new char[static_cast<size_t>(s_nameDataBlockSize)];
|
||||
iff.read_char(s_nameDataBlockSize, s_nameDataBlock);
|
||||
s_nameDataBlockSize = iff.getChunkLengthLeft();
|
||||
s_nameDataBlock = new char[static_cast<size_t>(s_nameDataBlockSize)];
|
||||
iff.read_char(s_nameDataBlockSize, s_nameDataBlock);
|
||||
|
||||
iff.exitChunk(TAG_NAME);
|
||||
iff.exitChunk(TAG_NAME);
|
||||
|
||||
//-- Read palette id to palette name offset block. Palette IDs start at 1.
|
||||
iff.enterChunk(TAG_PNOF);
|
||||
|
||||
s_maxValidPaletteId = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_paletteIdNameOffsetMap = new uint16[static_cast<size_t>(s_maxValidPaletteId)];
|
||||
iff.read_uint16(s_maxValidPaletteId, s_paletteIdNameOffsetMap);
|
||||
//-- Read palette id to palette name offset block. Palette IDs start at 1.
|
||||
iff.enterChunk(TAG_PNOF);
|
||||
|
||||
iff.exitChunk(TAG_PNOF);
|
||||
s_maxValidPaletteId = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_paletteIdNameOffsetMap = new uint16[static_cast<size_t>(s_maxValidPaletteId)];
|
||||
iff.read_uint16(s_maxValidPaletteId, s_paletteIdNameOffsetMap);
|
||||
|
||||
//-- Read variable id to variable name offset block. Variable IDs start at 1.
|
||||
iff.enterChunk(TAG_VNOF);
|
||||
|
||||
s_maxValidVariableId = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_variableIdNameOffsetMap = new uint16[static_cast<size_t>(s_maxValidVariableId)];
|
||||
iff.read_uint16(s_maxValidVariableId, s_variableIdNameOffsetMap);
|
||||
iff.exitChunk(TAG_PNOF);
|
||||
|
||||
iff.exitChunk(TAG_VNOF);
|
||||
//-- Read variable id to variable name offset block. Variable IDs start at 1.
|
||||
iff.enterChunk(TAG_VNOF);
|
||||
|
||||
//-- Read default value id.
|
||||
iff.enterChunk(TAG_DEFV);
|
||||
s_maxValidVariableId = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_variableIdNameOffsetMap = new uint16[static_cast<size_t>(s_maxValidVariableId)];
|
||||
iff.read_uint16(s_maxValidVariableId, s_variableIdNameOffsetMap);
|
||||
|
||||
s_maxValidDefaultId = iff.getChunkLengthLeft(sizeof(int32));
|
||||
s_defaultValueMap = new int32[static_cast<size_t>(s_maxValidDefaultId)];
|
||||
iff.read_int32(s_maxValidDefaultId, s_defaultValueMap);
|
||||
iff.exitChunk(TAG_VNOF);
|
||||
|
||||
iff.exitChunk(TAG_DEFV);
|
||||
//-- Read default value id.
|
||||
iff.enterChunk(TAG_DEFV);
|
||||
|
||||
//-- Read the integer range table.
|
||||
iff.enterChunk(TAG_IRNG);
|
||||
|
||||
s_maxValidIntRangeId = iff.getChunkLengthLeft(sizeof(IntRange));
|
||||
s_intRangeMap = new IntRange[static_cast<size_t>(s_maxValidIntRangeId)];
|
||||
iff.read_int32(2 * s_maxValidIntRangeId, reinterpret_cast<int32*>(s_intRangeMap)); //lint !e740 // unusual pointer cast. // Yes; its fine and is worth the bug savings over handling directly as array of int32.
|
||||
s_maxValidDefaultId = iff.getChunkLengthLeft(sizeof(int32));
|
||||
s_defaultValueMap = new int32[static_cast<size_t>(s_maxValidDefaultId)];
|
||||
iff.read_int32(s_maxValidDefaultId, s_defaultValueMap);
|
||||
|
||||
iff.exitChunk(TAG_IRNG);
|
||||
iff.exitChunk(TAG_DEFV);
|
||||
|
||||
//-- Read the range type table.
|
||||
iff.enterChunk(TAG_RTYP);
|
||||
//-- Read the integer range table.
|
||||
iff.enterChunk(TAG_IRNG);
|
||||
|
||||
s_maxValidRangeId = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_rangeTypeMap = new uint16[static_cast<size_t>(s_maxValidRangeId)];
|
||||
iff.read_uint16(s_maxValidRangeId, s_rangeTypeMap);
|
||||
s_maxValidIntRangeId = iff.getChunkLengthLeft(sizeof(IntRange));
|
||||
s_intRangeMap = new IntRange[static_cast<size_t>(s_maxValidIntRangeId)];
|
||||
iff.read_int32(2 * s_maxValidIntRangeId, reinterpret_cast<int32*>(s_intRangeMap)); //lint !e740 // unusual pointer cast. // Yes; its fine and is worth the bug savings over handling directly as array of int32.
|
||||
|
||||
iff.exitChunk(TAG_RTYP);
|
||||
iff.exitChunk(TAG_IRNG);
|
||||
|
||||
//-- Read the variable usage composition table.
|
||||
iff.enterChunk(TAG_UCMP);
|
||||
//-- Read the range type table.
|
||||
iff.enterChunk(TAG_RTYP);
|
||||
|
||||
s_maxValidVariableUsageId = iff.getChunkLengthLeft(sizeof(VariableUsage));
|
||||
s_variableUsageMap = new VariableUsage[static_cast<size_t>(s_maxValidVariableUsageId)];
|
||||
iff.read_uint16(3 * s_maxValidVariableUsageId, reinterpret_cast<uint16*>(s_variableUsageMap));
|
||||
s_maxValidRangeId = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_rangeTypeMap = new uint16[static_cast<size_t>(s_maxValidRangeId)];
|
||||
iff.read_uint16(s_maxValidRangeId, s_rangeTypeMap);
|
||||
|
||||
iff.exitChunk(TAG_UCMP);
|
||||
iff.exitChunk(TAG_RTYP);
|
||||
|
||||
//-- Read variable usage list.
|
||||
iff.enterChunk(TAG_ULST);
|
||||
|
||||
s_variableUsageListEntryCount = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_variableUsageList = new uint16[static_cast<size_t>(s_variableUsageListEntryCount)];
|
||||
iff.read_uint16(s_variableUsageListEntryCount, s_variableUsageList);
|
||||
//-- Read the variable usage composition table.
|
||||
iff.enterChunk(TAG_UCMP);
|
||||
|
||||
iff.exitChunk(TAG_ULST);
|
||||
s_maxValidVariableUsageId = iff.getChunkLengthLeft(sizeof(VariableUsage));
|
||||
s_variableUsageMap = new VariableUsage[static_cast<size_t>(s_maxValidVariableUsageId)];
|
||||
iff.read_uint16(3 * s_maxValidVariableUsageId, reinterpret_cast<uint16*>(s_variableUsageMap));
|
||||
|
||||
//-- Read variable usage index.
|
||||
iff.enterChunk(TAG_UIDX);
|
||||
iff.exitChunk(TAG_UCMP);
|
||||
|
||||
s_usageIndexEntryCount = iff.getChunkLengthLeft(sizeof(UsageIndexEntry));
|
||||
s_usageIndex = new UsageIndexEntry[static_cast<size_t>(s_usageIndexEntryCount)];
|
||||
iff.read_uint8(isizeof(UsageIndexEntry) * s_usageIndexEntryCount, reinterpret_cast<uint8*>(s_usageIndex));
|
||||
//-- Read variable usage list.
|
||||
iff.enterChunk(TAG_ULST);
|
||||
|
||||
iff.exitChunk(TAG_UIDX);
|
||||
s_variableUsageListEntryCount = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_variableUsageList = new uint16[static_cast<size_t>(s_variableUsageListEntryCount)];
|
||||
iff.read_uint16(s_variableUsageListEntryCount, s_variableUsageList);
|
||||
|
||||
//-- Read asset linkage list.
|
||||
iff.enterChunk(TAG_LLST);
|
||||
|
||||
s_linkListEntryCount = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_linkList = new uint16[static_cast<size_t>(s_linkListEntryCount)];
|
||||
iff.read_uint16(s_linkListEntryCount, s_linkList);
|
||||
iff.exitChunk(TAG_ULST);
|
||||
|
||||
iff.exitChunk(TAG_LLST);
|
||||
//-- Read variable usage index.
|
||||
iff.enterChunk(TAG_UIDX);
|
||||
|
||||
//-- Read asset linkage index.
|
||||
iff.enterChunk(TAG_LIDX);
|
||||
s_usageIndexEntryCount = iff.getChunkLengthLeft(sizeof(UsageIndexEntry));
|
||||
s_usageIndex = new UsageIndexEntry[static_cast<size_t>(s_usageIndexEntryCount)];
|
||||
iff.read_uint8(isizeof(UsageIndexEntry) * s_usageIndexEntryCount, reinterpret_cast<uint8*>(s_usageIndex));
|
||||
|
||||
s_linkIndexEntryCount = iff.getChunkLengthLeft(sizeof(LinkIndexEntry));
|
||||
s_linkIndex = new LinkIndexEntry[static_cast<size_t>(s_linkIndexEntryCount)];
|
||||
iff.read_uint8(isizeof(LinkIndexEntry) * s_linkIndexEntryCount, reinterpret_cast<uint8*>(s_linkIndex));
|
||||
iff.exitChunk(TAG_UIDX);
|
||||
|
||||
iff.exitChunk(TAG_LIDX);
|
||||
//-- Read asset linkage list.
|
||||
iff.enterChunk(TAG_LLST);
|
||||
|
||||
//-- Read crc name -> asset id lookup table.
|
||||
iff.enterChunk(TAG_CIDX);
|
||||
s_linkListEntryCount = iff.getChunkLengthLeft(sizeof(uint16));
|
||||
s_linkList = new uint16[static_cast<size_t>(s_linkListEntryCount)];
|
||||
iff.read_uint16(s_linkListEntryCount, s_linkList);
|
||||
|
||||
s_crcLookupEntryCount = iff.getChunkLengthLeft(sizeof(CrcLookupEntry));
|
||||
s_crcLookupTable = new CrcLookupEntry[static_cast<size_t>(s_crcLookupEntryCount)];
|
||||
iff.read_uint8(isizeof(CrcLookupEntry) * s_crcLookupEntryCount, reinterpret_cast<uint8*>(s_crcLookupTable));
|
||||
iff.exitChunk(TAG_LLST);
|
||||
|
||||
iff.exitChunk(TAG_CIDX);
|
||||
//-- Read asset linkage index.
|
||||
iff.enterChunk(TAG_LIDX);
|
||||
|
||||
s_linkIndexEntryCount = iff.getChunkLengthLeft(sizeof(LinkIndexEntry));
|
||||
s_linkIndex = new LinkIndexEntry[static_cast<size_t>(s_linkIndexEntryCount)];
|
||||
iff.read_uint8(isizeof(LinkIndexEntry) * s_linkIndexEntryCount, reinterpret_cast<uint8*>(s_linkIndex));
|
||||
|
||||
iff.exitChunk(TAG_LIDX);
|
||||
|
||||
//-- Read crc name -> asset id lookup table.
|
||||
iff.enterChunk(TAG_CIDX);
|
||||
|
||||
s_crcLookupEntryCount = iff.getChunkLengthLeft(sizeof(CrcLookupEntry));
|
||||
s_crcLookupTable = new CrcLookupEntry[static_cast<size_t>(s_crcLookupEntryCount)];
|
||||
iff.read_uint8(isizeof(CrcLookupEntry) * s_crcLookupEntryCount, reinterpret_cast<uint8*>(s_crcLookupTable));
|
||||
|
||||
iff.exitChunk(TAG_CIDX);
|
||||
|
||||
iff.exitForm(TAG_0000);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ void AssetCustomizationManagerNamespace::getRangeTypeInfoFromRangeId(int rangeId
|
||||
//-- Get range type from range id. Range ids start at 1 and need to be shifted down one
|
||||
// index to lookup int range type info.
|
||||
uint16 const rangeType = s_rangeTypeMap[rangeId - 1];
|
||||
isPalette = ((rangeType & 0x8000) != 0);
|
||||
isPalette = ((rangeType & 0x8000) != 0);
|
||||
idForRealType = (rangeType & 0x7fff);
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ AssetCustomizationManagerNamespace::LinkIndexEntry const *AssetCustomizationMana
|
||||
|
||||
int AssetCustomizationManagerNamespace::lookupAssetId(CrcString const &assetName)
|
||||
{
|
||||
uint32 const key = assetName.getCrc();
|
||||
uint32 const key = assetName.getCrc();
|
||||
CrcLookupEntry const *entry = static_cast<CrcLookupEntry*>(bsearch(&key, s_crcLookupTable, static_cast<size_t>(s_crcLookupEntryCount), sizeof(CrcLookupEntry), compare_uint32));
|
||||
|
||||
return (entry != nullptr) ? entry->assetId : 0;
|
||||
@@ -579,7 +579,7 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI
|
||||
int const defaultValue = getDefaultValueFromDefaultId(variableUsage->defaultId);
|
||||
|
||||
//-- Get variable type.
|
||||
bool isPalette = false;
|
||||
bool isPalette = false;
|
||||
int idForRealType = 0;
|
||||
getRangeTypeInfoFromRangeId(variableUsage->rangeId, isPalette, idForRealType);
|
||||
|
||||
@@ -589,7 +589,7 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI
|
||||
{
|
||||
//-- Get palette.
|
||||
char const *const paletteName = getPaletteNameFromPaletteId(idForRealType);
|
||||
PaletteArgb const *const palette = PaletteArgbList::fetch(TemporaryCrcString(paletteName, true));
|
||||
PaletteArgb const *const palette = PaletteArgbList::fetch(TemporaryCrcString(paletteName, true));
|
||||
if (!palette)
|
||||
{
|
||||
DEBUG_WARNING(true, ("failed to load palette [%s], skipping variable [%s]", paletteName, variablePathName));
|
||||
@@ -605,18 +605,16 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI
|
||||
{
|
||||
IntRange intRange;
|
||||
getIntRangeFromIntRangeId(idForRealType, intRange);
|
||||
|
||||
|
||||
variable = new BasicRangedIntCustomizationVariable(intRange.minRangeInclusive, defaultValue, intRange.maxRangeExclusive);
|
||||
}
|
||||
|
||||
//-- Add the variable to the CustomizationData.
|
||||
NOT_NULL(variable);
|
||||
customizationData.addVariableTakeOwnership(variablePathName2, variable);
|
||||
|
||||
++addedVariableCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-- Recursively call on assets that this asset is dependent upon. These assets
|
||||
// could be providing additional variables.
|
||||
@@ -687,4 +685,4 @@ int AssetCustomizationManager::addCustomizationVariablesForAsset(CrcString const
|
||||
return addedVariableCount;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// ======================================================================
|
||||
+22
-22
@@ -99,7 +99,7 @@ void TemplateDefinitionFile::setWriteForCompiler(bool flag)
|
||||
*/
|
||||
const std::string & TemplateDefinitionFile::getTemplateNameFilter(void) const
|
||||
{
|
||||
static const std::string wildcard = "*";
|
||||
static const std::string wildcard = "*";
|
||||
|
||||
if (!m_templateNameFilter.empty())
|
||||
return m_templateNameFilter;
|
||||
@@ -127,7 +127,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const
|
||||
return true;
|
||||
}
|
||||
|
||||
int const maxCaptureCount = 10;
|
||||
int const maxCaptureCount = 10;
|
||||
int const matchDataElementCount = maxCaptureCount * 3;
|
||||
int matchData[matchDataElementCount];
|
||||
|
||||
@@ -188,11 +188,11 @@ void TemplateDefinitionFile::writeClassHeaderBegin(File &fp) const
|
||||
baseNamePath = "sharedObject/";
|
||||
baseName = ROOT_TEMPLATE_NAME;
|
||||
}
|
||||
else if(_stricmp(baseName, "tpfTemplate") == 0)
|
||||
else if (_stricmp(baseName, "tpfTemplate") == 0)
|
||||
{
|
||||
baseNamePath = "sharedTemplateDefinition/";
|
||||
}
|
||||
|
||||
|
||||
fp.print("//========================================================================\n");
|
||||
fp.print("//\n");
|
||||
fp.print("// %s.h\n", name);
|
||||
@@ -366,10 +366,10 @@ void TemplateDefinitionFile::writeClassSourceBegin(File &fp, const TemplateData
|
||||
fp.print(" * Class constructor.\n");
|
||||
fp.print(" */\n");
|
||||
fp.print("%s::%s(const std::string & filename)\n", name, name);
|
||||
// if (sourceTemplate.hasList())
|
||||
// if (sourceTemplate.hasList())
|
||||
sourceTemplate.writeSourceLoadedFlagInit(fp);
|
||||
fp.print("{\n");
|
||||
// fp.print("\tsetId(%s);\n", getTemplateId().tagString.c_str());
|
||||
// fp.print("\tsetId(%s);\n", getTemplateId().tagString.c_str());
|
||||
fp.print("} // %s::%s\n", name, name);
|
||||
fp.print("\n");
|
||||
fp.print("/**\n");
|
||||
@@ -445,11 +445,11 @@ void TemplateDefinitionFile::writeClassSourceBegin(File &fp, const TemplateData
|
||||
*/
|
||||
int TemplateDefinitionFile::parse(File &fp)
|
||||
{
|
||||
static const int BUFFER_SIZE = 1024;
|
||||
int lineLen;
|
||||
char buffer[BUFFER_SIZE];
|
||||
char token[BUFFER_SIZE];
|
||||
TemplateData *currentTemplate = nullptr;
|
||||
static const int BUFFER_SIZE = 1024;
|
||||
int lineLen;
|
||||
char buffer[BUFFER_SIZE];
|
||||
char token[BUFFER_SIZE];
|
||||
TemplateData *currentTemplate = nullptr;
|
||||
|
||||
cleanup();
|
||||
|
||||
@@ -490,8 +490,8 @@ TemplateData *currentTemplate = nullptr;
|
||||
fp.printError("no compiler path defined");
|
||||
return -1;
|
||||
}
|
||||
// if (m_baseName.size() == 0 && m_templateName != ROOT_TEMPLATE_NAME)
|
||||
// m_baseName = ROOT_TEMPLATE_NAME;
|
||||
// if (m_baseName.size() == 0 && m_templateName != ROOT_TEMPLATE_NAME)
|
||||
// m_baseName = ROOT_TEMPLATE_NAME;
|
||||
line = getNextWhitespaceToken(line, token);
|
||||
int version = atoi(token);
|
||||
if (version < 0 || version > 9999)
|
||||
@@ -506,7 +506,7 @@ TemplateData *currentTemplate = nullptr;
|
||||
}
|
||||
if (version > m_highestVersion)
|
||||
m_highestVersion = version;
|
||||
|
||||
|
||||
currentTemplate = new TemplateData(version, *this);
|
||||
m_templateMap[version] = currentTemplate;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ TemplateData *currentTemplate = nullptr;
|
||||
}
|
||||
line = getNextWhitespaceToken(line, token);
|
||||
setBaseFilename(token);
|
||||
|
||||
|
||||
// load and parse the base template
|
||||
Filename baseFileName = fp.getFilename();
|
||||
baseFileName.setName(token);
|
||||
@@ -585,8 +585,8 @@ TemplateData *currentTemplate = nullptr;
|
||||
WARNING(m_filterCompiledRegex == nullptr, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str()));
|
||||
}
|
||||
else if (strcmp(token, "clientpath") == 0 ||
|
||||
strcmp(token, "serverpath") == 0 ||
|
||||
strcmp(token, "sharedpath") == 0)
|
||||
strcmp(token, "serverpath") == 0 ||
|
||||
strcmp(token, "sharedpath") == 0)
|
||||
{
|
||||
if (m_path.getPath().size() != 0)
|
||||
{
|
||||
@@ -595,14 +595,14 @@ TemplateData *currentTemplate = nullptr;
|
||||
}
|
||||
if (strcmp(token, "clientpath") == 0)
|
||||
m_templateLocation = LOC_CLIENT;
|
||||
else if (strcmp(token, "serverpath") == 0)
|
||||
else if (strcmp(token, "serverpath") == 0)
|
||||
m_templateLocation = LOC_SERVER;
|
||||
else
|
||||
else
|
||||
m_templateLocation = LOC_SHARED;
|
||||
line = getNextWhitespaceToken(line, token);
|
||||
m_path.setPath(token);
|
||||
m_path.prependPath(fp.getFilename());
|
||||
// reset the template name to add the corrent prefix to the template
|
||||
// reset the template name to add the corrent prefix to the template
|
||||
// name
|
||||
setTemplateFilename(m_templateFilename);
|
||||
if (!m_baseFilename.empty())
|
||||
@@ -622,11 +622,11 @@ TemplateData *currentTemplate = nullptr;
|
||||
else
|
||||
{
|
||||
char errbuf[2048];
|
||||
sprintf(errbuf, "I don't know how to handle this line!: <%s>. "
|
||||
snprintf(errbuf, 2048, "I don't know how to handle this line!: <%s>. "
|
||||
"Barfed on token <%s>.", buffer, token);
|
||||
fp.printError(errbuf);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} // TemplateDefinitionFile::parse
|
||||
} // TemplateDefinitionFile::parse
|
||||
Reference in New Issue
Block a user