1.1 --- a/sourcehook/sourcehook_impl_chookidman.h Sun Nov 25 01:22:41 2007 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,81 +0,0 @@
1.4 -/* ======== SourceHook ========
1.5 -* Copyright (C) 2004-2007 Metamod:Source Development Team
1.6 -* No warranties of any kind
1.7 -*
1.8 -* License: zlib/libpng
1.9 -*
1.10 -* Author(s): Pavol "PM OnoTo" Marko
1.11 -* ============================
1.12 -*/
1.13 -
1.14 -#ifndef __SOURCEHOOK_IMPL_CHOOKIDMAN_H__
1.15 -#define __SOURCEHOOK_IMPL_CHOOKIDMAN_H__
1.16 -
1.17 -#include "sh_vector.h"
1.18 -
1.19 -namespace SourceHook
1.20 -{
1.21 - namespace Impl
1.22 - {
1.23 - // Associates hook ids with info about the hooks
1.24 - // Also used to keep track of used hook ids
1.25 - class CHookIDManager
1.26 - {
1.27 - public:
1.28 - struct Entry
1.29 - {
1.30 - bool isfree;
1.31 -
1.32 - // hookman info
1.33 - CProto proto;
1.34 - int vtbl_offs;
1.35 - int vtbl_idx;
1.36 -
1.37 - // vfnptr
1.38 - void *vfnptr;
1.39 -
1.40 - // iface
1.41 - void* adjustediface;
1.42 -
1.43 - // hook
1.44 - Plugin plug;
1.45 - int thisptr_offs;
1.46 - ISHDelegate *handler;
1.47 - bool post;
1.48 -
1.49 - Entry(const CProto &pprt, int pvo, int pvi, void *pvp, void *pai, Plugin pplug, int pto,
1.50 - ISHDelegate *ph, bool ppost)
1.51 - : isfree(false), proto(pprt), vtbl_offs(pvo), vtbl_idx(pvi), vfnptr(pvp),
1.52 - adjustediface(pai), plug(pplug), thisptr_offs(pto), handler(ph), post(ppost)
1.53 - {
1.54 - }
1.55 - Entry()
1.56 - {
1.57 - }
1.58 - };
1.59 - private:
1.60 - // Internally, hookid 1 is stored as m_Entries[0]
1.61 -
1.62 - CVector<Entry> m_Entries;
1.63 - public:
1.64 - CHookIDManager();
1.65 - int New(const CProto &proto, int vtbl_offs, int vtbl_idx, void *vfnptr, void *adjustediface,
1.66 - Plugin plug, int thisptr_offs, ISHDelegate *handler, bool post);
1.67 - bool Remove(int hookid);
1.68 - const Entry * QueryHook(int hookid);
1.69 -
1.70 - // Finds all hooks with the given info, and fills the hookids into output.
1.71 - void FindAllHooks(CVector<int> &output, const CProto &proto, int vtbl_offs, int vtbl_idx,
1.72 - void *adjustediface, Plugin plug, int thisptr_offs, ISHDelegate *handler, bool post);
1.73 -
1.74 - // Removes all hooks with a specified vfnptr
1.75 - void RemoveAll(void *vfnptr);
1.76 -
1.77 - void FindAllHooks(CVector<int> &output);
1.78 - void FindAllHooks(CVector<int> &output, Plugin plug);
1.79 - };
1.80 - }
1.81 -}
1.82 -
1.83 -#endif
1.84 -