00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <stdio.h>
00033 #include "stub_mm.h"
00034 #include "stub_util.h"
00035 #include "sm_ext.h"
00036
00037 MyExtension g_SMExt;
00038
00039 bool SM_LoadExtension(char *error, size_t maxlength)
00040 {
00041 if ((smexts = (IExtensionManager *)g_SMAPI->MetaFactory(
00042 SOURCEMOD_INTERFACE_EXTENSIONS,
00043 NULL,
00044 NULL))
00045 == NULL)
00046 {
00047 if (error && maxlength)
00048 {
00049 UTIL_Format(error, maxlength, SOURCEMOD_INTERFACE_EXTENSIONS " interface not found");
00050 }
00051 return false;
00052 }
00053
00054
00055 char path[256];
00056 g_SMAPI->PathFormat(path,
00057 sizeof(path),
00058 "addons/myplugin/bin/myplugin%s",
00059 #if defined __linux__
00060 "_i486.so"
00061 #else
00062 ".dll"
00063 #endif
00064 );
00065
00066 if ((myself = smexts->LoadExternal(&g_SMExt,
00067 path,
00068 "myplugin_mm.ext",
00069 error,
00070 maxlength))
00071 == NULL)
00072 {
00073 SM_UnsetInterfaces();
00074 return false;
00075 }
00076
00077 return true;
00078 }
00079
00080 void SM_UnloadExtension()
00081 {
00082 smexts->UnloadExtension(myself);
00083 }
00084
00085 bool MyExtension::OnExtensionLoad(IExtension *me,
00086 IShareSys *sys,
00087 char *error,
00088 size_t maxlength,
00089 bool late)
00090 {
00091 sharesys = sys;
00092 myself = me;
00093
00094
00095 if (!SM_AcquireInterfaces(error, maxlength))
00096 {
00097 return false;
00098 }
00099
00100 return true;
00101 }
00102
00103 void MyExtension::OnExtensionUnload()
00104 {
00105
00106
00107
00108
00109
00110
00111
00112
00113 SM_UnsetInterfaces();
00114 }
00115
00116 void MyExtension::OnExtensionsAllLoaded()
00117 {
00118
00119
00120
00121 }
00122
00123 void MyExtension::OnExtensionPauseChange(bool pause)
00124 {
00125 }
00126
00127 bool MyExtension::QueryRunning(char *error, size_t maxlength)
00128 {
00129
00130
00131
00132
00133 return true;
00134 }
00135
00136 bool MyExtension::IsMetamodExtension()
00137 {
00138
00139 return false;
00140 }
00141
00142 const char *MyExtension::GetExtensionName()
00143 {
00144 return mmsplugin->GetName();
00145 }
00146
00147 const char *MyExtension::GetExtensionURL()
00148 {
00149 return mmsplugin->GetURL();
00150 }
00151
00152 const char *MyExtension::GetExtensionTag()
00153 {
00154 return mmsplugin->GetLogTag();
00155 }
00156
00157 const char *MyExtension::GetExtensionAuthor()
00158 {
00159 return mmsplugin->GetAuthor();
00160 }
00161
00162 const char *MyExtension::GetExtensionVerString()
00163 {
00164 return mmsplugin->GetVersion();
00165 }
00166
00167 const char *MyExtension::GetExtensionDescription()
00168 {
00169 return mmsplugin->GetDescription();
00170 }
00171
00172 const char *MyExtension::GetExtensionDateString()
00173 {
00174 return mmsplugin->GetDate();
00175 }
00176