Remove reference asset names from info strings

This commit is contained in:
Jan 2021-03-06 21:20:13 +01:00
parent 78107b74e0
commit 313e9e9f1a
5 changed files with 20 additions and 11 deletions

View File

@ -68,7 +68,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
const auto* fx = *reinterpret_cast<FxEffectDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (fx)
m_info_string.SetValueForKey(std::string(field.szName), std::string(fx->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(fx->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -79,7 +79,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
const auto* model = *reinterpret_cast<XModel**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (model)
m_info_string.SetValueForKey(std::string(field.szName), std::string(model->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(model->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -91,7 +91,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
iOffset);
if (material)
m_info_string.SetValueForKey(std::string(field.szName), std::string(material->info.name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -103,7 +103,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
iOffset);
if (physCollMap)
m_info_string.SetValueForKey(std::string(field.szName), std::string(physCollMap->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(physCollMap->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -127,7 +127,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
iOffset);
if (tracer)
m_info_string.SetValueForKey(std::string(field.szName), std::string(tracer->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(tracer->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;

View File

@ -65,7 +65,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
const auto* fx = *reinterpret_cast<FxEffectDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (fx)
m_info_string.SetValueForKey(std::string(field.szName), std::string(fx->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(fx->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -76,7 +76,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
const auto* model = *reinterpret_cast<XModel**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (model)
m_info_string.SetValueForKey(std::string(field.szName), std::string(model->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(model->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -89,7 +89,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
iOffset);
if (material)
m_info_string.SetValueForKey(std::string(field.szName), std::string(material->info.name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -101,7 +101,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
iOffset);
if (physPreset)
m_info_string.SetValueForKey(std::string(field.szName), std::string(physPreset->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(physPreset->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
@ -116,7 +116,7 @@ void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
const auto* tracer = *reinterpret_cast<TracerDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (tracer)
m_info_string.SetValueForKey(std::string(field.szName), std::string(tracer->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(tracer->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;

View File

@ -144,6 +144,14 @@ InfoString InfoStringFromStructConverterBase::Convert()
return std::move(m_info_string);
}
const char* InfoStringFromStructConverterBase::AssetName(const char* name)
{
if (name && name[0] == ',')
return &name[1];
return name;
}
void InfoStringFromStructConverterBase::FillFromString(const std::string& key, const size_t offset)
{
const auto* str = *reinterpret_cast<const char**>(reinterpret_cast<uintptr_t>(m_structure) + offset);

View File

@ -54,6 +54,7 @@ protected:
const void* m_structure;
const std::function<std::string(scr_string_t)> m_get_scr_string;
static const char* AssetName(const char* name);
void FillFromString(const std::string& key, size_t offset);
void FillFromStringBuffer(const std::string& key, size_t offset, size_t bufferSize);
void FillFromInt(const std::string& key, size_t offset);

View File

@ -1481,7 +1481,7 @@ namespace T6
.iOffset);
if (camo)
m_info_string.SetValueForKey(std::string(field.szName), std::string(camo->name));
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(camo->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;