MCPcopy Create free account
hub / github.com/WheretIB/nullc / nullcSetFunction

Function nullcSetFunction

NULLC/nullc.cpp:731–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731nullres nullcSetFunction(const char* name, NULLCFuncPtr func)
732{
733 using namespace NULLC;
734 NULLC_CHECK_INITIALIZED(false);
735
736 unsigned int index = nullcFindFunctionIndex(name);
737 if(index == ~0u)
738 return false;
739 if(linker->exFunctions[func.id].funcCat != ExternFuncInfo::NORMAL)
740 {
741 nullcLastError = "ERROR: source function uses context, which is unavailable";
742 return false;
743 }
744 if(nullcGetCurrentExecutor(NULL) == NULLC_X86)
745 {
746 linker->UpdateFunctionPointer(index, func.id);
747 if(linker->exFunctions[index].funcPtr && !linker->exFunctions[func.id].funcPtr)
748 {
749 nullcLastError = "Internal function cannot be overridden with external function on x86";
750 return false;
751 }
752 if(linker->exFunctions[func.id].funcPtr && !linker->exFunctions[index].funcPtr)
753 {
754 nullcLastError = "External function cannot be overridden with internal function on x86";
755 return false;
756 }
757 }
758 linker->exFunctions[index].address = linker->exFunctions[func.id].address;
759 linker->exFunctions[index].funcPtr = linker->exFunctions[func.id].funcPtr;
760 linker->exFunctions[index].codeSize = linker->exFunctions[func.id].codeSize;
761 return true;
762}
763
764nullres nullcIsStackPointer(void* ptr)
765{

Callers 1

RunInterfaceTestsFunction · 0.85

Calls 3

nullcFindFunctionIndexFunction · 0.85
nullcGetCurrentExecutorFunction · 0.85
UpdateFunctionPointerMethod · 0.80

Tested by 1

RunInterfaceTestsFunction · 0.68