MCPcopy Create free account
hub / github.com/Norbyte/bg3se / LoadCondition

Method LoadCondition

CoreLib/SymbolMapper.cpp:637–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635}
636
637bool SymbolMappingLoader::LoadCondition(tinyxml2::XMLElement* ele, Pattern const& pattern, SymbolMappings::Condition& condition)
638{
639 auto type = ele->Attribute("Type");
640 if (strcmp(type, "String") == 0) {
641 condition.Type = SymbolMappings::MatchType::kString;
642 } else if (strcmp(type, "WString") == 0) {
643 condition.Type = SymbolMappings::MatchType::kWString;
644 } else if (strcmp(type, "FixedString") == 0) {
645 condition.Type = SymbolMappings::MatchType::kFixedString;
646 } else if (strcmp(type, "FixedStringIndirect") == 0) {
647 condition.Type = SymbolMappings::MatchType::kFixedStringIndirect;
648 } else {
649 ERR("Unsupported mapping condition type: %s", type);
650 return false;
651 }
652
653 auto offset = GetOffsetAttribute(ele, pattern, "Offset");
654 if (offset) {
655 condition.Offset = *offset;
656 } else {
657 return false;
658 }
659
660 auto str = ele->Attribute("Value");
661 if (!str) {
662 ERR("String value missing from condition");
663 return false;
664 }
665 condition.String = str;
666
667 if (condition.Type == SymbolMappings::MatchType::kWString) {
668 condition.WString = FromStdUTF8(str).c_str();
669 }
670
671 return true;
672}
673
674
675bool SymbolMapper::IsValidModulePtr(uint8_t const * ref) const

Callers

nothing calls this directly

Calls 3

GetOffsetAttributeFunction · 0.85
FromStdUTF8Function · 0.85
AttributeMethod · 0.45

Tested by

no test coverage detected