2 ;; (C)2005-2007 AlliedModders LLC
3 ;; By the Metamod:Source Development Team
4 ;; This software is licensed under the zlib/libpng free software license.
6 ;; This assembly file is a short thunk wrapper to let us load as a VSP and exit quietly,
7 ;; without any overhead of the rest of the interface, and also to prevent linking against
12 ;; void GetBaseDir(char *buffer, maxlength);
13 ;; void *GetThisPointer();
15 ;; void LoadFunction();
19 global GetThisPointer, GetGameDir, ServerCommand
20 global _GetThisPointer, _GetGameDir, _ServerCommand
30 mov eax, GLOBAL_POINTER
38 mov ecx, [engine] ;get this pointer
39 mov edx, [ecx] ;get the vtable
40 push dword [ebp+12] ;push maxlenth
41 push dword [ebp+8] ;push buffer
43 push ecx ;push this pointer
45 call dword [edx+216] ;call IVEngineServer::GetGameDir
47 add esp, 12 ;correct stack
58 mov ecx, [engine] ;get this pointer
59 mov edx, [ecx] ;get the vtable
60 push dword [ebp+8] ;push string
62 push ecx ;push this pointer
64 call dword [edx+144] ;call IVEngineServer::ServerCommand
66 add esp, 8 ;correct stack
86 push dword VENGINESERVER ;iface name
87 call edi ;call factory
88 add esp, 8 ;correct stack
90 test eax, eax ;do we have a valid pointer?
93 mov [engine], eax ;store the engine pointer
96 push dword VENGINECVAR ;iface name
97 call edi ;call factory
98 add esp, 8 ;correct stack
100 test eax, eax ;do we have a valid pointer?
101 jz .end ;no, bail out
103 mov [icvar], eax ;store the icvar pointer
108 ;We never load, never ever ever!
124 INTERFACE_NAME DB "ISERVERPLUGINCALLBACKS001", 0
125 VENGINESERVER DB "VEngineServer021", 0
126 VENGINECVAR DB "VEngineCvar003", 0
128 VIRTUAL_TABLE DD thisLoadFunction
129 DD thisUnloadFunction
130 ;We don't need any more of the vtable here
132 GLOBAL_POINTER DD VIRTUAL_TABLE