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.
2 // hello pm how are you
3 // I'm fine, what about you?
4 // not bad, just looking for mem leaks
5 // mem leaks in my code!? never! I have to preserve binary compatibility :(
14 #include "sourcehook_impl.h"
15 #include "sourcehook.h"
16 #include "sourcehook_hookmangen.h"
21 #define DECL_TEST(x) bool Test##x(std::string &error);
28 cout << "Test" << #x << " passed" << endl; \
33 cout << "Test" << #x << " FAILED: " << error << endl; \
39 DECL_TEST(VafmtAndOverload);
40 DECL_TEST(ThisPtrOffs);
50 DECL_TEST(CPageAlloc); // in testhookmangen.cpp
51 DECL_TEST(HookManGen);
53 int main(int argc, char *argv[])
57 g_Verbose = argc > 1 && strcmp(argv[1], "-v") == 0;
59 int passed = 0, failed = 0;
63 DO_TEST(VafmtAndOverload);
77 cout << endl << "----" << endl << "Passed: " << passed << endl << "Failed: " << failed << endl;
78 cout << "Total: " << passed + failed << endl;
80 cout << "Press enter to continue" << endl;
86 SourceHook::ISourceHook *Test_Factory()
88 return new SourceHook::Impl::CSourceHookImpl();
91 void Test_Delete(SourceHook::ISourceHook *shptr)
93 delete static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr);
96 void Test_CompleteShutdown(SourceHook::ISourceHook *shptr)
98 static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr)->CompleteShutdown();
101 void Test_UnloadPlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
103 static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr)->UnloadPlugin(plug);
106 void Test_PausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
108 static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr)->PausePlugin(plug);
111 void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
113 static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr)->UnpausePlugin(plug);
116 SourceHook::IHookManagerAutoGen *Test_HMAG_Factory(SourceHook::ISourceHook *shptr)
118 return new SourceHook::Impl::CHookManagerAutoGen(shptr);
121 void Test_HMAG_Delete(SourceHook::IHookManagerAutoGen *ptr)
123 delete static_cast<SourceHook::Impl::CHookManagerAutoGen*>(ptr);