예제 #1
0
void HolidayManager::UnhookIfNecessary()
{
	// Not hooked
	if (!m_iHookID)
		return;

	// We're still wanted
	if (m_isHolidayForward->GetFunctionCount() > 0)
		return;

	SH_REMOVE_HOOK_ID(m_iHookID);
	m_iHookID = 0;
}
예제 #2
0
	void UnhookCommand(ConCommandBase *pBase)
	{
		if (!pBase->IsCommand())
			return;

		ConCommand *cmd = (ConCommand*)pBase;
		void **vtable = GetVirtualTable(cmd);

		size_t index;
		if (!FindVtable(vtable, index))
		{
			logger->LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
			return;
		}

		assert(vtables[index].refcount > 0);
		vtables[index].refcount--;
		if (vtables[index].refcount == 0)
		{
			SH_REMOVE_HOOK_ID(vtables[index].hook);
			vtables.erase(vtables.iterAt(index));
		}
	}
예제 #3
0
파일: Console.cpp 프로젝트: Dreae/SourceLua
CommandHook::~CommandHook() {
  if(this->hook_id) {
    SH_REMOVE_HOOK_ID(this->hook_id);
  }
}