MCPcopy Create free account
hub / github.com/Norbyte/ositools / OnAfterGetFunctionMappings

Method OnAfterGetFunctionMappings

OsiInterface/CustomFunctions.cpp:326–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326void CustomFunctionInjector::OnAfterGetFunctionMappings(void * Osiris, MappingInfo ** Mappings, uint32_t * MappingCount)
327{
328 Debug("CustomFunctionInjector::OnAfterGetFunctionMappings(): No. funcs: %d", *MappingCount);
329
330 CreateOsirisSymbolMap(Mappings, MappingCount);
331 gOsirisProxy->GetExtensionState().Reset();
332
333 // Remove local functions
334 auto outputIndex = 0;
335 osiToDivMappings_.clear();
336 divToOsiMappings_.clear();
337 for (unsigned i = 0; i < *MappingCount; i++) {
338 auto const & mapping = (*Mappings)[i];
339 FunctionNameAndArity sig{ mapping.Name, mapping.NumParams };
340 auto mapped = functions_.Find(sig);
341 if (mapped == nullptr) {
342 (*Mappings)[outputIndex++] = mapping;
343 } else {
344 osiToDivMappings_.insert(std::make_pair(mapping.Id, mapped->Handle()));
345 divToOsiMappings_.insert(std::make_pair(mapped->Handle(), mapping.Id));
346 Debug("Function mapping (%s): %08x --> %08x", mapping.Name, mapping.Id, (unsigned int)mapped->Handle());
347 }
348 }
349
350 *MappingCount = outputIndex;
351 Debug("CustomFunctionInjector::OnAfterGetFunctionMappings(): No. funcs after filtering: %d", *MappingCount);
352}
353
354bool CustomFunctionInjector::CallWrapper(std::function<bool (uint32_t, OsiArgumentDesc *)> const & next, uint32_t handle, OsiArgumentDesc * params)
355{

Callers

nothing calls this directly

Calls 4

DebugFunction · 0.85
ResetMethod · 0.80
HandleMethod · 0.80
FindMethod · 0.45

Tested by

no test coverage detected