1.1 --- a/sourcehook/sourcehook_impl.h Sat Oct 08 01:15:02 2005 +0000
1.2 +++ b/sourcehook/sourcehook_impl.h Wed Oct 12 20:25:15 2005 +0000
1.3 @@ -15,6 +15,7 @@
1.4 #include "sh_list.h"
1.5 #include "sh_vector.h"
1.6 #include "sh_tinyhash.h"
1.7 +#include "sh_stack.h"
1.8
1.9 // Set this to 1 to enable runtime code generation (faster)
1.10 // (unused at the moment, but may come back, so I'm leaving it in here!)
1.11 @@ -217,6 +218,21 @@
1.12 Impl_CallClassList m_CallClasses; //!< A list of already generated callclasses
1.13 HookManInfoList m_HookMans; //!< A list of hook managers
1.14
1.15 + struct HookLoopInfo
1.16 + {
1.17 + META_RES *pStatus;
1.18 + META_RES *pPrevRes;
1.19 + META_RES *pCurRes;
1.20 +
1.21 + bool shouldContinue;
1.22 +
1.23 + IIface *pCurIface;
1.24 + const void *pOrigRet;
1.25 + const void *pOverrideRet;
1.26 + void **pIfacePtrPtr;
1.27 + };
1.28 + typedef CStack<HookLoopInfo> HookLoopInfoStack;
1.29 +
1.30 /**
1.31 * @brief Finds a hook manager for a function based on a text-prototype, a vtable offset and a vtable index
1.32 */
1.33 @@ -229,12 +245,7 @@
1.34
1.35 void SetPluginPaused(Plugin plug, bool paused);
1.36
1.37 - META_RES m_Status, m_PrevRes, m_CurRes;
1.38 - HookLoopStatus m_HLS;
1.39 - IIface *m_CurIface;
1.40 - const void *m_OrigRet;
1.41 - const void *m_OverrideRet;
1.42 - void *m_IfacePtr;
1.43 + HookLoopInfoStack m_HLIStack;
1.44 public:
1.45 CSourceHookImpl();
1.46 virtual ~CSourceHookImpl();
1.47 @@ -341,14 +352,15 @@
1.48
1.49 //////////////////////////////////////////////////////////////////////////
1.50 // For hook managers
1.51 - virtual META_RES &GetCurResRef(); //!< Gets the reference to the current meta result
1.52 - virtual META_RES &GetPrevResRef(); //!< Gets the reference to the previous meta result
1.53 - virtual META_RES &GetStatusRef(); //!< Gets the reference to the status variable
1.54 - virtual void* &GetIfacePtrRef(); //!< Gets the reference to the iface ptr
1.55 - virtual void SetOrigRet(const void *ptr); //!< Sets the original return pointer
1.56 - virtual void SetOverrideRet(const void *ptr); //!< Sets the override result pointer
1.57 - HookLoopStatus &GetStatusVarRef(IIface *pIface);
1.58 - void HookLoopDone();
1.59 + void HookLoopBegin(IIface *pIface); //!< Should be called when a hook loop begins
1.60 + void HookLoopEnd(); //!< Should be called when a hook loop exits
1.61 + void SetCurResPtr(META_RES *mres); //!< Sets pointer to the current meta result
1.62 + void SetPrevResPtr(META_RES *mres); //!< Sets pointer to previous meta result
1.63 + void SetStatusPtr(META_RES *mres); //!< Sets pointer to the status variable
1.64 + void SetIfacePtrPtr(void **pp); //!< Sets pointer to the interface this pointer
1.65 + void SetOrigRetPtr(const void *ptr); //!< Sets the original return pointer
1.66 + void SetOverrideRetPtr(const void *ptr); //!< Sets the override result pointer
1.67 + bool ShouldContinue(); //!< Returns false if the hook loop should exit
1.68 };
1.69 }
1.70