Difference between revisions of "Metamod:Source"
m (SourceMM moved to Metamod:Source over redirect) |
m (sourcemm -> mm:s) |
||
Line 4: | Line 4: | ||
[[Category:Half-Life 2]] | [[Category:Half-Life 2]] | ||
− | [[Category: | + | [[Category:Metamod:Source]] |
==Where to Download== | ==Where to Download== | ||
− | + | Metamod:Source is hosted on [http://sourceforge.net/projects/sourcemm Source Forge] or can be accessed via the [http://www.sourcemm.net/ Metamod:Source Home Page]. | |
==Naming Conventions== | ==Naming Conventions== | ||
− | + | The name "SourceMM" is no longer used. | |
==History== | ==History== | ||
Line 24: | Line 24: | ||
====Version 1.0==== | ====Version 1.0==== | ||
− | On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend. GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces. Once the true GameDLL location was known it would be loaded by | + | On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend. GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces. Once the true GameDLL location was known it would be loaded by Metamod:Source. The fake interface then directly wrapped calls to the real GameDLL. |
====Version 1.1==== | ====Version 1.1==== | ||
Line 30: | Line 30: | ||
====Version 1.2==== | ====Version 1.2==== | ||
− | On January 7th, 2006, | + | On January 7th, 2006, Metamod:Source was updated for SourceHook v4.3, but received no major API changes. |
====Version 1.3==== | ====Version 1.3==== | ||
− | On August 16th, 2006, | + | On August 16th, 2006, Metamod:Source was updated for SourceHook v4.4, minor API changes, bug fixes, and a sync to the latest HL2SDK. |
====Version 1.4==== | ====Version 1.4==== | ||
− | On April 5th, 2007, | + | On April 5th, 2007, Metamod:Source was updated with API for [[Valve Server Plugin]] interface hooking and crash-safe user message enumeration. An experimental gameinfo.txt update tool was also added. No SourceHook changes were made in this release. |
+ | |||
+ | ====Version 1.6==== | ||
+ | Currently in development, Metamod:Source received a near complete overhaul to abstract engine-specific code to support Orange Box. Additionally, SourceHook received a massive overhaul and is now v4.5, adding global hooks and various major API simplifications. | ||
==Design Considerations== | ==Design Considerations== | ||
====Metamod==== | ====Metamod==== | ||
− | Originally, | + | Originally, Metamod:Source was a plugin co-existing with SourceMod. However, there are factories, pointers, and certain capabilities not possible from a [[Valve Server Plugin]]. Furthermore, the [[Half-Life 2]] engine does not properly unload VSPs, making debugging and resource unloading more difficult. Eventually it was decided the added functionality and fine-tuned control outweighed the extra cost of having to configure an intercepting binary. |
====Plugins==== | ====Plugins==== | ||
− | Plugins are specific to Metamod:Source. This means that [[Valve Server Plugin]]s and [[SourceMM Plugins]] are entirely separate in the API characteristics. While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that | + | Plugins are specific to Metamod:Source. This means that [[Valve Server Plugin]]s and [[SourceMM Plugins]] are entirely separate in the API characteristics. While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that Metamod:Source might not directly control. For example, when a Metamod:Source plugin is removed at runtime, all of the necessary hooks are also removed. A VSP has no clear callback for detecting this event, therefore it would be more difficult to ensure proper unloading. VSP and MM:S plugins also have different ways of attaching and detaching server [[Cvars|cvars]] and [[Console commands|concmds]]. |
− | By keeping the plugin system isolated, | + | By keeping the plugin system isolated, Metamod:Source can also provide a unique set of console commands and API. For example, plugins can listen for certain Metamod:Source-specific events and provide communication channels with other plugins. |
====Hooking==== | ====Hooking==== | ||
− | + | Metamod:Source is powered by [[SourceHook]], a versatile library for hooking virtual functions. The original [[Half-Life 1]] engine used structs of function pointers which could easily be modified as they passed from one library to another. However, HL2 is comprised almost entirely of pure virtual interfaces. SourceHook was designed for declaring single hooks against a given virtual function and a this pointer, which is not only faster than a blanket hooking system like Metamod's, but more flexible and precise. | |
− | Hooking under | + | Hooking under Metamod:Source has a number of features that don't exist in a hooking system style like Metamod's, and it achieves something closer to [[Detours|detours]], rather than Metamod, which is hardcoded. For example |
*You can change parent parameters during a hooked call | *You can change parent parameters during a hooked call | ||
*You can hook member functions, both by a pre-existing declaration or given vtable offset | *You can hook member functions, both by a pre-existing declaration or given vtable offset | ||
Line 56: | Line 59: | ||
==Documentation== | ==Documentation== | ||
− | For more information on installing, configuring, and coding for | + | For more information on installing, configuring, and coding for Metamod:Source, see [[:Category:Documentation (SourceMM)|Documentation]]. |
==The Future== | ==The Future== | ||
− | While | + | While Metamod:Source is a stable/production product, more features are on the horizon. There are distant plans for a [[Detours|detouring]] library and a library for efficiently automated [[Signature Scanning|signature scanning]]. |
==License== | ==License== | ||
− | + | Metamod:Source is licensed under the [[zLib/libpng License]]. It is free to use for both open-source and proprietary projects. | |
==External Links== | ==External Links== | ||
Line 68: | Line 71: | ||
*[http://www.metamod.org/ Metamod Website] | *[http://www.metamod.org/ Metamod Website] | ||
*[http://www.sourcemod.net/ SourceMod Website] | *[http://www.sourcemod.net/ SourceMod Website] | ||
− | *[http://resonus.net/doxygen_sourcemm/ Doxygen of | + | *[http://resonus.net/doxygen_sourcemm/ Doxygen of Metamod:Source] |
Revision as of 23:50, 5 October 2007
Contents
Introduction
Metamod:Source is an API manager and interception handler that sits in between the Half-Life 2 Engine (Source) and a subsequent Game Modification (MOD). It can dynamically load "SourceMM Plugins", written in C++, to intercept, override, and hook Engine and GameDLL API interfaces. It also allows for inter-plugin communication. As a backend it contains SourceHook, a powerful library for safely manipulating virtual table hooks.
Where to Download
Metamod:Source is hosted on Source Forge or can be accessed via the Metamod:Source Home Page.
Naming Conventions
The name "SourceMM" is no longer used.
History
Metamod:Source is derived from the Metamod concept of intercepting calls between a game's engine and mod library. While not based on the same code, the API is designed to be similar and familiar to Half-Life 1 programmers.
SourceMod Core1
Initially, the SourceMod project was started as the next-generation continuation of the AMX Mod X project. It was designed to be a meta-interface layer for inter-communicating plugins. However, as development continued, it was soon realized that the Valve Server Plugin interface would not be sufficient to provide proper engine access.
Pavol Marko (core1 developer) decided to add "SourceHook" to SourceMod core1. It was embedded as a large library for hooking specific virtual table functions. After multiple revisions (see SourceHook history), it became apparent that 1)SourceHook needed to be game and interface generic, and 2)SourceMod and SourceHook needed to be split into two separate projects. The logic behind this was that SourceHook needed to be a layer above Valve Server Plugins, in order to properly manage hooks with the least possibility of conflicts. Furthermore, SourceMod should be a plugin to the SourceHook interface, rather than managing it. This decision can be likened to Admin-Mod's early decision to split into the first Metamod project.
SourceHook Finalized
After four major revisions, SourceHook was mature enough to be used in a production environment. While PM concentrated on fleshing out SourceHook, BAILOPAN and DS created the GameDLL wrapper portion.
Version 1.0
On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend. GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces. Once the true GameDLL location was known it would be loaded by Metamod:Source. The fake interface then directly wrapped calls to the real GameDLL.
Version 1.1
On October 21, 2005, the first major revision of SourceMM was released, featuring SourceHook v4.4, internal event listeners, dropped reliance on STL, and rewritten GameDLL hooking code. The Day of Defeat:Source release by Valve Software revealed that the binary interface between the engine and mod wasn't necessarily public or current, and SourceMM's detection was improved for compatibility and speed. Furthermore, SourceMM stopped wrapping the GameDLL interfaces and began using SourceHook to hook them.
Version 1.2
On January 7th, 2006, Metamod:Source was updated for SourceHook v4.3, but received no major API changes.
Version 1.3
On August 16th, 2006, Metamod:Source was updated for SourceHook v4.4, minor API changes, bug fixes, and a sync to the latest HL2SDK.
Version 1.4
On April 5th, 2007, Metamod:Source was updated with API for Valve Server Plugin interface hooking and crash-safe user message enumeration. An experimental gameinfo.txt update tool was also added. No SourceHook changes were made in this release.
Version 1.6
Currently in development, Metamod:Source received a near complete overhaul to abstract engine-specific code to support Orange Box. Additionally, SourceHook received a massive overhaul and is now v4.5, adding global hooks and various major API simplifications.
Design Considerations
Metamod
Originally, Metamod:Source was a plugin co-existing with SourceMod. However, there are factories, pointers, and certain capabilities not possible from a Valve Server Plugin. Furthermore, the Half-Life 2 engine does not properly unload VSPs, making debugging and resource unloading more difficult. Eventually it was decided the added functionality and fine-tuned control outweighed the extra cost of having to configure an intercepting binary.
Plugins
Plugins are specific to Metamod:Source. This means that Valve Server Plugins and SourceMM Plugins are entirely separate in the API characteristics. While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that Metamod:Source might not directly control. For example, when a Metamod:Source plugin is removed at runtime, all of the necessary hooks are also removed. A VSP has no clear callback for detecting this event, therefore it would be more difficult to ensure proper unloading. VSP and MM:S plugins also have different ways of attaching and detaching server cvars and concmds.
By keeping the plugin system isolated, Metamod:Source can also provide a unique set of console commands and API. For example, plugins can listen for certain Metamod:Source-specific events and provide communication channels with other plugins.
Hooking
Metamod:Source is powered by SourceHook, a versatile library for hooking virtual functions. The original Half-Life 1 engine used structs of function pointers which could easily be modified as they passed from one library to another. However, HL2 is comprised almost entirely of pure virtual interfaces. SourceHook was designed for declaring single hooks against a given virtual function and a this pointer, which is not only faster than a blanket hooking system like Metamod's, but more flexible and precise.
Hooking under Metamod:Source has a number of features that don't exist in a hooking system style like Metamod's, and it achieves something closer to detours, rather than Metamod, which is hardcoded. For example
- You can change parent parameters during a hooked call
- You can hook member functions, both by a pre-existing declaration or given vtable offset
- You can call the original function and still fire its associated hooks, or you can call it without firing hooks in order to prevent infinite recursion
Documentation
For more information on installing, configuring, and coding for Metamod:Source, see Documentation.
The Future
While Metamod:Source is a stable/production product, more features are on the horizon. There are distant plans for a detouring library and a library for efficiently automated signature scanning.
License
Metamod:Source is licensed under the zLib/libpng License. It is free to use for both open-source and proprietary projects.