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

Method ExecSymbolMappingAction

CoreLib/SymbolMapper.cpp:772–806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770}
771
772SymbolMapper::MappingResult SymbolMapper::ExecSymbolMappingAction(SymbolMappings::Target const & target, uint8_t const * match)
773{
774 if (target.Ref.Type == SymbolMappings::ReferenceType::kNone) return MappingResult::Success;
775
776 auto pptr = ResolveRef(target.Ref, match);
777
778 if (!pptr) {
779 ERR("Could not map match to symbol address while resolving '%s'", target.Name.c_str());
780 return MappingResult::Fail;
781 }
782
783 auto ptr = *pptr;
784 auto targetPtr = target.TargetRef.Get();
785 if (targetPtr != nullptr) {
786 *targetPtr = const_cast<uint8_t *>(ptr);
787 }
788
789 if (!target.NextSymbol.empty()) {
790 if (!MapSymbol(mappings_.Mappings[target.NextSymbol], ptr, target.NextSymbolSeekSize)) {
791 return MappingResult::Fail;
792 }
793 }
794
795 if (!target.EngineCallback.empty()) {
796 auto cb = engineCallbacks_.find(target.EngineCallback);
797 if (cb == engineCallbacks_.end()) {
798 ERR("Target references nonexistent engine callback: '%s'", target.EngineCallback.c_str());
799 return MappingResult::Fail;
800 } else {
801 return cb->second(ptr);
802 }
803 }
804
805 return MappingResult::Success;
806}
807
808bool SymbolMapper::UpdatePatchReference(SymbolMappings::Patch& patch, uint8_t const* match)
809{

Callers

nothing calls this directly

Calls 4

GetMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected