//Injects a relative CALL to [target] at the [position].
//Original function from BWAPI by Kovarex; Modified by pastelmind
void callPatch(const void* target, void* position, const unsigned int nops) {
	u8* const data = new u8[5 + nops];
	data[0] = 0xE8; //Relative CALL instruction
	const u32 address = (u32)target - (u32)position - 5;  //Relative address
	*(u32*)(&data[1]) = address;
	for (unsigned int i = 0; i < nops; ++i)
		data[5 + i] = 0x90; //NOP instruction
	memoryPatch(position, data, 5 + nops);
	delete[] data;
}
	void injectDetectorHooks() {
		jmpPatch(unitCanDetectWrapper, Func_CanDetect);
		memoryPatch(0x0044118E, &getCloakedTargetVisibilityWrapper);
		memoryPatch(0x004411A6, &getCloakedTargetVisibilityWrapper);
	}