core/sourcehook/test/testbail.h
author Scott Ehlert <ds@alliedmods.net>
Thu Dec 10 00:59:50 2009 -0600 (2009-12-10)
changeset 689 4065ba5e9155
parent 539 db914129ae01
permissions -rw-r--r--
Rewrote user message caching code to always use IServerGameDLL::GetUserMessageInfo (bug 4117, r=dvander).

Games where the above function can crash are handled by detouring tier0's Error() function and jumping back to our own code. So in theory this should work on all games now.
     1 //////////////////////////////////////////////////////////////////////////
     2 // Shared data for testbail
     3 
     4 #include <string>
     5 #include "testevents.h"
     6 
     7 namespace N_TestBail
     8 {
     9 	extern StateList g_States;
    10 	extern SourceHook::ISourceHook *g_SHPtr;
    11 	
    12 	MAKE_STATE_1(State_EatYams_Called, int);
    13 	MAKE_STATE_1(State_EatYams_Handler1_Called, int);
    14 	MAKE_STATE_1(State_EatYams_Handler2_Called, int);
    15 	MAKE_STATE_1(State_EatYams_Handler3_Called, int);
    16 	MAKE_STATE_1(State_EatYams_Return, int);
    17 
    18 	class IGaben
    19 	{
    20 	public:
    21 		virtual int EatYams(int a)
    22 		{
    23 			ADD_STATE(State_EatYams_Called(a));
    24 			return 5;
    25 		}
    26 	};
    27 
    28 	extern IGaben *g_Gabgab;
    29 
    30 	bool TestBail2(std::string &error);
    31 }
    32 
    33 using namespace N_TestBail;
    34 
    35 namespace
    36 {
    37 	SourceHook::Plugin g_PLID;
    38 	SH_DECL_HOOK1(IGaben, EatYams, SH_NOATTRIB, 0, int, int);
    39 }