Initial import of updater extension, currently incomplete - just getting it in the tree (bug 3530).
1.1 --- a/core/GameConfigs.cpp Sun Feb 01 20:38:59 2009 -0500
1.2 +++ b/core/GameConfigs.cpp Mon Feb 02 15:41:25 2009 -0500
1.3 @@ -762,11 +762,15 @@
1.4 bShouldBeReadingDefault = true;
1.5 m_ParseState = PSTATE_NONE;
1.6
1.7 + g_GameConfigs.AcquireLock();
1.8 +
1.9 if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
1.10 != SMCError_Okay)
1.11 {
1.12 const char *msg;
1.13
1.14 + g_GameConfigs.ReleaseLock();
1.15 +
1.16 msg = textparsers->GetSMCErrorString(err);
1.17
1.18 g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
1.19 @@ -787,6 +791,8 @@
1.20 return false;
1.21 }
1.22
1.23 + g_GameConfigs.ReleaseLock();
1.24 +
1.25 return true;
1.26 }
1.27
1.28 @@ -854,6 +860,8 @@
1.29
1.30 void GameConfigManager::OnSourceModStartup(bool late)
1.31 {
1.32 + m_FileLock = g_pThreader->MakeMutex();
1.33 +
1.34 LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0);
1.35
1.36 strncopy(g_Game, g_SourceMod.GetGameFolderName(), sizeof(g_Game));
1.37 @@ -888,6 +896,7 @@
1.38 void GameConfigManager::OnSourceModAllShutdown()
1.39 {
1.40 CloseGameConfigFile(g_pGameConf);
1.41 + m_FileLock->DestroyThis();
1.42 }
1.43
1.44 bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
1.45 @@ -956,12 +965,12 @@
1.46 return conf;
1.47 }
1.48
1.49 -void GameConfigManager::AddUserConfigHook( const char *sectionname, ITextListener_SMC *listener )
1.50 +void GameConfigManager::AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
1.51 {
1.52 m_customHandlers.insert(sectionname, listener);
1.53 }
1.54
1.55 -void GameConfigManager::RemoveUserConfigHook( const char *sectionname, ITextListener_SMC *listener )
1.56 +void GameConfigManager::RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
1.57 {
1.58 ITextListener_SMC **pListener = m_customHandlers.retrieve(sectionname);
1.59
1.60 @@ -979,3 +988,13 @@
1.61
1.62 return;
1.63 }
1.64 +
1.65 +void GameConfigManager::AcquireLock()
1.66 +{
1.67 + m_FileLock->Lock();
1.68 +}
1.69 +
1.70 +void GameConfigManager::ReleaseLock()
1.71 +{
1.72 + m_FileLock->Unlock();
1.73 +}
2.1 --- a/core/GameConfigs.h Sun Feb 01 20:38:59 2009 -0500
2.2 +++ b/core/GameConfigs.h Mon Feb 02 15:41:25 2009 -0500
2.3 @@ -39,6 +39,7 @@
2.4 #include "sm_globals.h"
2.5 #include "sm_memtable.h"
2.6 #include "sm_trie_tpl.h"
2.7 +#include "ThreadSupport.h"
2.8
2.9 using namespace SourceMod;
2.10 using namespace SourceHook;
2.11 @@ -110,6 +111,8 @@
2.12 HandleError *err);
2.13 void AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
2.14 void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
2.15 + void AcquireLock();
2.16 + void ReleaseLock();
2.17 public: //SMGlobalClass
2.18 void OnSourceModStartup(bool late);
2.19 void OnSourceModAllInitialized();
2.20 @@ -117,6 +120,7 @@
2.21 private:
2.22 List<CGameConfig *> m_cfgs;
2.23 Trie *m_pLookup;
2.24 + IMutex *m_FileLock;
2.25 public:
2.26 KTrie<ITextListener_SMC *> m_customHandlers;
2.27 };
3.1 --- a/core/frame_hooks.h Sun Feb 01 20:38:59 2009 -0500
3.2 +++ b/core/frame_hooks.h Mon Feb 02 15:41:25 2009 -0500
3.3 @@ -32,10 +32,15 @@
3.4 #ifndef _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
3.5 #define _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
3.6
3.7 -typedef void (*FRAMEACTION)(void *data);
3.8 +#include <ISourceMod.h>
3.9 +
3.10 +using namespace SourceMod;
3.11
3.12 struct FrameAction
3.13 {
3.14 + FrameAction(FRAMEACTION a, void *d) : data(d), action(a)
3.15 + {
3.16 + }
3.17 void *data;
3.18 FRAMEACTION action;
3.19 };
4.1 --- a/core/msvc9/sourcemod_mm.vcproj Sun Feb 01 20:38:59 2009 -0500
4.2 +++ b/core/msvc9/sourcemod_mm.vcproj Mon Feb 02 15:41:25 2009 -0500
4.3 @@ -1492,6 +1492,10 @@
4.4 >
4.5 </File>
4.6 <File
4.7 + RelativePath="..\ThreadSupport.h"
4.8 + >
4.9 + </File>
4.10 + <File
4.11 RelativePath="..\TimerSys.h"
4.12 >
4.13 </File>
5.1 --- a/core/sourcemod.cpp Sun Feb 01 20:38:59 2009 -0500
5.2 +++ b/core/sourcemod.cpp Mon Feb 02 15:41:25 2009 -0500
5.3 @@ -48,6 +48,7 @@
5.4 #include "GameConfigs.h"
5.5 #include "DebugReporter.h"
5.6 #include "Profiler.h"
5.7 +#include "frame_hooks.h"
5.8
5.9 SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
5.10 SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false);
5.11 @@ -379,7 +380,7 @@
5.12 g_Extensions.TryAutoload();
5.13
5.14 /* Fire the extensions ready message */
5.15 - g_SMAPI->MetaFactory(SOURCEMOD_NOTICE_EXTENSIONS, NULL, NULL);
5.16 + g_SMAPI->MetaFactory(SOURCEMOD_NOTICE_EXTENSIONS, NULL, NULL);
5.17
5.18 /* Load any game extension */
5.19 const char *game_ext;
5.20 @@ -690,6 +691,11 @@
5.21 return UTIL_FormatArgs(buffer, maxlength, fmt, ap);
5.22 }
5.23
5.24 +void SourceModBase::AddFrameAction(FRAMEACTION fn, void *data)
5.25 +{
5.26 + ::AddFrameAction(FrameAction(fn, data));
5.27 +}
5.28 +
5.29 SMGlobalClass *SMGlobalClass::head = NULL;
5.30
5.31 SMGlobalClass::SMGlobalClass()
6.1 --- a/core/sourcemod.h Sun Feb 01 20:38:59 2009 -0500
6.2 +++ b/core/sourcemod.h Mon Feb 02 15:41:25 2009 -0500
6.3 @@ -131,6 +131,7 @@
6.4 void ProcessGameFrameHooks(bool simulating);
6.5 size_t Format(char *buffer, size_t maxlength, const char *fmt, ...);
6.6 size_t FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap);
6.7 + void AddFrameAction(FRAMEACTION fn, void *data);
6.8 private:
6.9 CStack<CDataPack *> m_freepacks;
6.10 char m_SMBaseDir[PLATFORM_MAX_PATH];
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/extensions/updater/Makefile Mon Feb 02 15:41:25 2009 -0500
7.3 @@ -0,0 +1,150 @@
7.4 +# (C)2004-2008 SourceMod Development Team
7.5 +# Makefile written by David "BAILOPAN" Anderson
7.6 +
7.7 +SMSDK = ../..
7.8 +SRCDS_BASE = ~/srcds
7.9 +HL2SDK_ORIG = ../../../hl2sdk
7.10 +HL2SDK_OB = ../../../hl2sdk-ob
7.11 +HL2SDK_L4D = ../../../hl2sdk-l4d
7.12 +MMSOURCE17 = ../../../mmsource-1.7
7.13 +
7.14 +#####################################
7.15 +### EDIT BELOW FOR OTHER PROJECTS ###
7.16 +#####################################
7.17 +
7.18 +PROJECT = updater
7.19 +
7.20 +#Uncomment for Metamod: Source enabled extension
7.21 +#USEMETA = true
7.22 +
7.23 +OBJECTS = \
7.24 + sdk/smsdk_ext.cpp \
7.25 + extension.cpp \
7.26 + MemoryDownloader.cpp \
7.27 + md5.cpp \
7.28 + Updater.cpp
7.29 +
7.30 +##############################################
7.31 +### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
7.32 +##############################################
7.33 +
7.34 +C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
7.35 +C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
7.36 +C_GCC4_FLAGS = -fvisibility=hidden
7.37 +CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
7.38 +CPP = gcc
7.39 +
7.40 +override ENGSET = false
7.41 +ifeq "$(ENGINE)" "original"
7.42 + HL2SDK = $(HL2SDK_ORIG)
7.43 + HL2PUB = $(HL2SDK)/public
7.44 + HL2LIB = $(HL2SDK)/linux_sdk
7.45 + CFLAGS += -DSOURCE_ENGINE=2
7.46 + METAMOD = $(MMSOURCE17)/core-legacy
7.47 + INCLUDE += -I$(HL2SDK)/public/dlls
7.48 + SRCDS = $(SRCDS_BASE)
7.49 + override ENGSET = true
7.50 +endif
7.51 +ifeq "$(ENGINE)" "orangebox"
7.52 + HL2SDK = $(HL2SDK_OB)
7.53 + HL2PUB = $(HL2SDK)/public
7.54 + HL2LIB = $(HL2SDK)/lib/linux
7.55 + CFLAGS += -DSOURCE_ENGINE=3
7.56 + METAMOD = $(MMSOURCE17)/core
7.57 + INCLUDE += -I$(HL2SDK)/public/game/server
7.58 + SRCDS = $(SRCDS_BASE)/orangebox
7.59 + override ENGSET = true
7.60 +endif
7.61 +ifeq "$(ENGINE)" "left4dead"
7.62 + HL2SDK = $(HL2SDK_L4D)
7.63 + HL2PUB = $(HL2SDK)/public
7.64 + HL2LIB = $(HL2SDK)/lib/linux
7.65 + CFLAGS += -DSOURCE_ENGINE=4
7.66 + METAMOD = $(MMSOURCE17)/core
7.67 + INCLUDE += -I$(HL2SDK)/public/game/server
7.68 + SRCDS = $(SRCDS_BASE)/l4d
7.69 + override ENGSET = true
7.70 +endif
7.71 +
7.72 +ifeq "$(USEMETA)" "true"
7.73 + LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
7.74 +
7.75 + LINK += $(LINK_HL2)
7.76 +
7.77 + INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
7.78 + -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
7.79 + CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
7.80 +else
7.81 + INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn \
7.82 + -I$(SMSDK)/public/extensions
7.83 +endif
7.84 +
7.85 +LINK += -m32 -lm -ldl
7.86 +
7.87 +CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
7.88 + -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
7.89 + -Wno-unused -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -m32
7.90 +CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
7.91 +
7.92 +################################################
7.93 +### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
7.94 +################################################
7.95 +
7.96 +ifeq "$(DEBUG)" "true"
7.97 + BIN_DIR = Debug
7.98 + CFLAGS += $(C_DEBUG_FLAGS)
7.99 +else
7.100 + BIN_DIR = Release
7.101 + CFLAGS += $(C_OPT_FLAGS)
7.102 +endif
7.103 +
7.104 +ifeq "$(USEMETA)" "true"
7.105 + BIN_DIR := $(BIN_DIR).$(ENGINE)
7.106 +endif
7.107 +
7.108 +OS := $(shell uname -s)
7.109 +ifeq "$(OS)" "Darwin"
7.110 + LINK += -dynamiclib
7.111 + BINARY = $(PROJECT).ext.dylib
7.112 +else
7.113 + LINK += -static-libgcc -shared
7.114 + BINARY = $(PROJECT).ext.so
7.115 +endif
7.116 +
7.117 +GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
7.118 +ifeq "$(GCC_VERSION)" "4"
7.119 + CFLAGS += $(C_GCC4_FLAGS)
7.120 + CPPFLAGS += $(CPP_GCC4_FLAGS)
7.121 +endif
7.122 +
7.123 +OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
7.124 +
7.125 +$(BIN_DIR)/%.o: %.cpp
7.126 + $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
7.127 +
7.128 +all: check
7.129 + mkdir -p $(BIN_DIR)/sdk
7.130 + if [ "$(USEMETA)" = "true" ]; then \
7.131 + ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so; \
7.132 + ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so; \
7.133 + fi
7.134 + $(MAKE) -f Makefile extension
7.135 +
7.136 +check:
7.137 + if [ "$(USEMETA)" = "true" ] && [ "$(ENGSET)" = "false" ]; then \
7.138 + echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
7.139 + exit 1; \
7.140 + fi
7.141 +
7.142 +extension: check $(OBJ_LINUX)
7.143 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
7.144 +
7.145 +debug:
7.146 + $(MAKE) -f Makefile all DEBUG=true
7.147 +
7.148 +default: all
7.149 +
7.150 +clean: check
7.151 + rm -rf $(BIN_DIR)/*.o
7.152 + rm -rf $(BIN_DIR)/sdk/*.o
7.153 + rm -rf $(BIN_DIR)/$(BINARY)
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/extensions/updater/MemoryDownloader.cpp Mon Feb 02 15:41:25 2009 -0500
8.3 @@ -0,0 +1,85 @@
8.4 +/**
8.5 + * vim: set ts=4 :
8.6 + * =============================================================================
8.7 + * SourceMod Updater Extension
8.8 + * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
8.9 + * =============================================================================
8.10 + *
8.11 + * This program is free software; you can redistribute it and/or modify it under
8.12 + * the terms of the GNU General Public License, version 3.0, as published by the
8.13 + * Free Software Foundation.
8.14 + *
8.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
8.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
8.18 + * details.
8.19 + *
8.20 + * You should have received a copy of the GNU General Public License along with
8.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
8.22 + *
8.23 + * As a special exception, AlliedModders LLC gives you permission to link the
8.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
8.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
8.26 + * by the Valve Corporation. You must obey the GNU General Public License in
8.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
8.28 + * this exception to all derivative works. AlliedModders LLC defines further
8.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
8.30 + * or <http://www.sourcemod.net/license.php>.
8.31 + *
8.32 + * Version: $Id$
8.33 + */
8.34 +
8.35 +#include <assert.h>
8.36 +#include <string.h>
8.37 +#include <stdlib.h>
8.38 +#include "MemoryDownloader.h"
8.39 +
8.40 +using namespace SourceMod;
8.41 +
8.42 +MemoryDownloader::MemoryDownloader() : buffer(NULL), bufsize(0), bufpos(0)
8.43 +{
8.44 +}
8.45 +
8.46 +MemoryDownloader::~MemoryDownloader()
8.47 +{
8.48 + free(buffer);
8.49 +}
8.50 +
8.51 +DownloadWriteStatus MemoryDownloader::OnDownloadWrite(IWebTransfer *session,
8.52 + void *userdata,
8.53 + void *ptr,
8.54 + size_t size,
8.55 + size_t nmemb)
8.56 +{
8.57 + size_t total = size * nmemb;
8.58 +
8.59 + if (bufpos + total > bufsize)
8.60 + {
8.61 + size_t rem = (bufpos + total) - bufsize;
8.62 + bufsize += rem + (rem / 2);
8.63 + buffer = (char *)realloc(buffer, bufsize);
8.64 + }
8.65 +
8.66 + assert(bufpos + total <= bufsize);
8.67 +
8.68 + memcpy(&buffer[bufpos], ptr, total);
8.69 + bufpos += total;
8.70 +
8.71 + return DownloadWrite_Okay;
8.72 +}
8.73 +
8.74 +void MemoryDownloader::Reset()
8.75 +{
8.76 + bufpos = 0;
8.77 +}
8.78 +
8.79 +char *MemoryDownloader::GetBuffer()
8.80 +{
8.81 + return buffer;
8.82 +}
8.83 +
8.84 +size_t MemoryDownloader::GetSize()
8.85 +{
8.86 + return bufpos;
8.87 +}
8.88 +
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/extensions/updater/MemoryDownloader.h Mon Feb 02 15:41:25 2009 -0500
9.3 @@ -0,0 +1,62 @@
9.4 +/**
9.5 + * vim: set ts=4 :
9.6 + * =============================================================================
9.7 + * SourceMod Updater Extension
9.8 + * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
9.9 + * =============================================================================
9.10 + *
9.11 + * This program is free software; you can redistribute it and/or modify it under
9.12 + * the terms of the GNU General Public License, version 3.0, as published by the
9.13 + * Free Software Foundation.
9.14 + *
9.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
9.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
9.18 + * details.
9.19 + *
9.20 + * You should have received a copy of the GNU General Public License along with
9.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
9.22 + *
9.23 + * As a special exception, AlliedModders LLC gives you permission to link the
9.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
9.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
9.26 + * by the Valve Corporation. You must obey the GNU General Public License in
9.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
9.28 + * this exception to all derivative works. AlliedModders LLC defines further
9.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
9.30 + * or <http://www.sourcemod.net/license.php>.
9.31 + *
9.32 + * Version: $Id$
9.33 + */
9.34 +
9.35 +#ifndef _INCLUDE_SOURCEMOD_UPDATER_MEMORY_DOWNLOADER_H_
9.36 +#define _INCLUDE_SOURCEMOD_UPDATER_MEMORY_DOWNLOADER_H_
9.37 +
9.38 +#include <IWebternet.h>
9.39 +
9.40 +namespace SourceMod
9.41 +{
9.42 + class MemoryDownloader : public ITransferHandler
9.43 + {
9.44 + public:
9.45 + MemoryDownloader();
9.46 + ~MemoryDownloader();
9.47 + public:
9.48 + DownloadWriteStatus OnDownloadWrite(IWebTransfer *session,
9.49 + void *userdata,
9.50 + void *ptr,
9.51 + size_t size,
9.52 + size_t nmemb);
9.53 + public:
9.54 + void Reset();
9.55 + char *GetBuffer();
9.56 + size_t GetSize();
9.57 + private:
9.58 + char *buffer;
9.59 + size_t bufsize;
9.60 + size_t bufpos;
9.61 + };
9.62 +}
9.63 +
9.64 +#endif /* _INCLUDE_SOURCEMOD_UPDATER_MEMORY_DOWNLOADER_H_ */
9.65 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/extensions/updater/Updater.cpp Mon Feb 02 15:41:25 2009 -0500
10.3 @@ -0,0 +1,383 @@
10.4 +/**
10.5 + * vim: set ts=4 :
10.6 + * =============================================================================
10.7 + * SourceMod Updater Extension
10.8 + * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
10.9 + * =============================================================================
10.10 + *
10.11 + * This program is free software; you can redistribute it and/or modify it under
10.12 + * the terms of the GNU General Public License, version 3.0, as published by the
10.13 + * Free Software Foundation.
10.14 + *
10.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
10.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
10.18 + * details.
10.19 + *
10.20 + * You should have received a copy of the GNU General Public License along with
10.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
10.22 + *
10.23 + * As a special exception, AlliedModders LLC gives you permission to link the
10.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
10.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
10.26 + * by the Valve Corporation. You must obey the GNU General Public License in
10.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
10.28 + * this exception to all derivative works. AlliedModders LLC defines further
10.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
10.30 + * or <http://www.sourcemod.net/license.php>.
10.31 + *
10.32 + * Version: $Id$
10.33 + */
10.34 +
10.35 +#include <stdlib.h>
10.36 +#include "extension.h"
10.37 +#include "Updater.h"
10.38 +#include "md5.h"
10.39 +
10.40 +#define UPDATE_URL "http://www.sourcemod.net/update/"
10.41 +
10.42 +#define USTATE_NONE 0
10.43 +#define USTATE_FOLDERS 1
10.44 +#define USTATE_CHANGED 2
10.45 +#define USTATE_CHANGE_FILE 3
10.46 +
10.47 +using namespace SourceMod;
10.48 +
10.49 +UpdateReader::UpdateReader()
10.50 +{
10.51 +}
10.52 +
10.53 +UpdateReader::~UpdateReader()
10.54 +{
10.55 +}
10.56 +
10.57 +void UpdateReader::ReadSMC_ParseStart()
10.58 +{
10.59 + ignoreLevel = 0;
10.60 + ustate = USTATE_NONE;
10.61 +}
10.62 +
10.63 +SMCResult UpdateReader::ReadSMC_NewSection(const SMCStates *states, const char *name)
10.64 +{
10.65 + if (ignoreLevel)
10.66 + {
10.67 + ignoreLevel++;
10.68 + return SMCResult_Continue;
10.69 + }
10.70 +
10.71 + switch (ustate)
10.72 + {
10.73 + case USTATE_NONE:
10.74 + {
10.75 + if (strcmp(name, "Folders") == 0)
10.76 + {
10.77 + ustate = USTATE_FOLDERS;
10.78 + }
10.79 + else if (strcmp(name, "Changed") == 0)
10.80 + {
10.81 + ustate = USTATE_CHANGED;
10.82 + }
10.83 + else
10.84 + {
10.85 + ignoreLevel++;
10.86 + }
10.87 + break;
10.88 + }
10.89 + case USTATE_FOLDERS:
10.90 + case USTATE_CHANGE_FILE:
10.91 + {
10.92 + ignoreLevel++;
10.93 + break;
10.94 + }
10.95 + case USTATE_CHANGED:
10.96 + {
10.97 + curfile.assign(name);
10.98 + url.clear();
10.99 + checksum[0] = '\0';
10.100 + ustate = USTATE_CHANGE_FILE;
10.101 + break;
10.102 + }
10.103 + }
10.104 +
10.105 + return SMCResult_Continue;
10.106 +}
10.107 +
10.108 +SMCResult UpdateReader::ReadSMC_KeyValue(const SMCStates *states,
10.109 + const char *key,
10.110 + const char *value)
10.111 +{
10.112 + if (ignoreLevel)
10.113 + {
10.114 + return SMCResult_Continue;
10.115 + }
10.116 +
10.117 + switch (ustate)
10.118 + {
10.119 + case USTATE_CHANGE_FILE:
10.120 + {
10.121 + if (strcmp(key, "md5sum") == 0)
10.122 + {
10.123 + if (strlen(value) != 32)
10.124 + {
10.125 + return SMCResult_Continue;
10.126 + }
10.127 + strcpy(checksum, value);
10.128 + }
10.129 + else if (strcmp(key, "location") == 0)
10.130 + {
10.131 + url.assign(UPDATE_URL);
10.132 + url.append(value);
10.133 + }
10.134 + break;
10.135 + }
10.136 + case USTATE_FOLDERS:
10.137 + {
10.138 + HandleFolder(value);
10.139 + break;
10.140 + }
10.141 + }
10.142 +
10.143 + return SMCResult_Continue;
10.144 +}
10.145 +
10.146 +SMCResult UpdateReader::ReadSMC_LeavingSection(const SMCStates *states)
10.147 +{
10.148 + if (ignoreLevel)
10.149 + {
10.150 + ignoreLevel--;
10.151 + return SMCResult_Continue;
10.152 + }
10.153 +
10.154 + switch (ustate)
10.155 + {
10.156 + case USTATE_FOLDERS:
10.157 + case USTATE_CHANGED:
10.158 + {
10.159 + ustate = USTATE_NONE;
10.160 + break;
10.161 + }
10.162 + case USTATE_CHANGE_FILE:
10.163 + {
10.164 + if (url.size() != 0 && checksum[0] != '\0')
10.165 + {
10.166 + HandleFile();
10.167 + }
10.168 + else
10.169 + {
10.170 + AddUpdateError("Incomplete file definition in update manifest");
10.171 + }
10.172 + ustate = USTATE_CHANGED;
10.173 + break;
10.174 + }
10.175 + }
10.176 +
10.177 + return SMCResult_Continue;
10.178 +}
10.179 +
10.180 +void UpdateReader::HandleFile()
10.181 +{
10.182 + MD5 md5;
10.183 + char real_checksum[33];
10.184 +
10.185 + mdl.Reset();
10.186 +
10.187 + if (!xfer->Download(url.c_str(), &mdl, NULL))
10.188 + {
10.189 + AddUpdateError("Could not download \"%s\"", url.c_str());
10.190 + AddUpdateError("Error: %s", xfer->LastErrorMessage());
10.191 + return;
10.192 + }
10.193 +
10.194 + md5.update((unsigned char *)mdl.GetBuffer(), mdl.GetSize());
10.195 + md5.finalize();
10.196 + md5.hex_digest(real_checksum);
10.197 +
10.198 + if (strcasecmp(checksum, real_checksum) != 0)
10.199 + {
10.200 + AddUpdateError("Checksums for file \"%s\" do not match:", curfile.c_str());
10.201 + AddUpdateError("Expected: %s Real: %s", checksum, real_checksum);
10.202 + return;
10.203 + }
10.204 +
10.205 + char path[PLATFORM_MAX_PATH];
10.206 + smutils->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s", curfile.c_str());
10.207 +
10.208 + gameconfs->AcquireLock();
10.209 +
10.210 + FILE *fp = fopen(path, "wt");
10.211 + if (fp == NULL)
10.212 + {
10.213 + gameconfs->ReleaseLock();
10.214 + AddUpdateError("Could not open %s for writing", path);
10.215 + return;
10.216 + }
10.217 +
10.218 + fwrite(mdl.GetBuffer(), 1, mdl.GetSize(), fp);
10.219 + fclose(fp);
10.220 +
10.221 + gameconfs->ReleaseLock();
10.222 +
10.223 + AddUpdateMessage("Successfully updated gamedata file \"%s\"", curfile.c_str());
10.224 +}
10.225 +
10.226 +void UpdateReader::HandleFolder(const char *folder)
10.227 +{
10.228 + char path[PLATFORM_MAX_PATH];
10.229 +
10.230 + smutils->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s", folder);
10.231 + if (libsys->IsPathDirectory(path))
10.232 + {
10.233 + return;
10.234 + }
10.235 +
10.236 + if (!libsys->CreateFolder(path))
10.237 + {
10.238 + AddUpdateError("Could not create folder: %s", path);
10.239 + }
10.240 + else
10.241 + {
10.242 + AddUpdateMessage("Created folder \"%s\" from updater", folder);
10.243 + }
10.244 +}
10.245 +
10.246 +static bool md5_file(const char *file, char checksum[33])
10.247 +{
10.248 + MD5 md5;
10.249 + FILE *fp;
10.250 + long length;
10.251 + void *fdata;
10.252 +
10.253 + if ((fp = fopen(file, "rt")) == NULL)
10.254 + {
10.255 + return false;
10.256 + }
10.257 +
10.258 + fseek(fp, 0, SEEK_END);
10.259 + length = ftell(fp);
10.260 + fseek(fp, 0, SEEK_SET);
10.261 + fdata = malloc(length);
10.262 + if (fread(fdata, 1, length, fp) != size_t(length))
10.263 + {
10.264 + free(fdata);
10.265 + fclose(fp);
10.266 + return false;
10.267 + }
10.268 + fclose(fp);
10.269 +
10.270 + md5.update((unsigned char*)fdata, length);
10.271 + md5.finalize();
10.272 + md5.hex_digest(checksum);
10.273 +
10.274 + free(fdata);
10.275 +
10.276 + return true;
10.277 +}
10.278 +
10.279 +/* Path should be sourcemod relative, not gamedata relative */
10.280 +static bool add_file(IWebForm *form, const char *file, unsigned int &num_files)
10.281 +{
10.282 + char path[PLATFORM_MAX_PATH];
10.283 +
10.284 + smutils->BuildPath(Path_SM, path, sizeof(path), "%s", file);
10.285 +
10.286 + char checksum[33];
10.287 + if (!md5_file(path, checksum))
10.288 + {
10.289 + return false;
10.290 + }
10.291 +
10.292 + char name[32];
10.293 + smutils->Format(name, sizeof(name), "file_%d_name", num_files);
10.294 + form->AddString(name, file);
10.295 + smutils->Format(name, sizeof(name), "file_%d_md5", num_files);
10.296 + form->AddString(name, checksum);
10.297 +
10.298 + num_files++;
10.299 +
10.300 + return true;
10.301 +}
10.302 +
10.303 +static void add_folders(IWebForm *form, const char *root, unsigned int &num_files)
10.304 +{
10.305 + IDirectory *dir;
10.306 + char path[PLATFORM_MAX_PATH];
10.307 + char name[PLATFORM_MAX_PATH];
10.308 +
10.309 + smutils->BuildPath(Path_SM, path, sizeof(path), "%s", root);
10.310 + dir = libsys->OpenDirectory(path);
10.311 + if (dir == NULL)
10.312 + {
10.313 + AddUpdateError("Could not open folder: %s", path);
10.314 + return;
10.315 + }
10.316 +
10.317 + while (dir->MoreFiles())
10.318 + {
10.319 + if (strcmp(dir->GetEntryName(), ".") == 0 ||
10.320 + strcmp(dir->GetEntryName(), "..") == 0)
10.321 + {
10.322 + dir->NextEntry();
10.323 + continue;
10.324 + }
10.325 + smutils->Format(name, sizeof(name), "%s/%s", root, dir->GetEntryName());
10.326 + if (dir->IsEntryDirectory())
10.327 + {
10.328 + add_folders(form, name, num_files);
10.329 + }
10.330 + else if (dir->IsEntryFile())
10.331 + {
10.332 + add_file(form, name, num_files);
10.333 + }
10.334 + dir->NextEntry();
10.335 + }
10.336 +
10.337 + libsys->CloseDirectory(dir);
10.338 +}
10.339 +
10.340 +void UpdateReader::PerformUpdate()
10.341 +{
10.342 + IWebForm *form;
10.343 + MemoryDownloader master;
10.344 + SMCStates states = {0, 0};
10.345 +
10.346 + form = webternet->CreateForm();
10.347 + xfer = webternet->CreateSession();
10.348 + xfer->SetFailOnHTTPError(true);
10.349 +
10.350 + const char *root_url = UPDATE_URL "gamedata.php";
10.351 +
10.352 + form->AddString("version", SVN_FULL_VERSION);
10.353 + form->AddString("build", SM_BUILD_UNIQUEID);
10.354 +
10.355 + unsigned int num_files = 0;
10.356 + add_folders(form, "gamedata", num_files);
10.357 +
10.358 + char temp[24];
10.359 + smutils->Format(temp, sizeof(temp), "%d", num_files);
10.360 + form->AddString("files", temp);
10.361 +
10.362 + if (!xfer->PostAndDownload(root_url, form, &master, NULL))
10.363 + {
10.364 + AddUpdateError("Could not download \"%s\"", root_url);
10.365 + AddUpdateError("Error: %s", xfer->LastErrorMessage());
10.366 + goto cleanup;
10.367 + }
10.368 +
10.369 + SMCError error;
10.370 + char errbuf[256];
10.371 + error = textparsers->ParseSMCStream(master.GetBuffer(),
10.372 + master.GetSize(),
10.373 + this,
10.374 + &states,
10.375 + errbuf,
10.376 + sizeof(errbuf));
10.377 + if (error != SMCError_Okay)
10.378 + {
10.379 + AddUpdateError("Parse error in update manifest: %s", errbuf);
10.380 + goto cleanup;
10.381 + }
10.382 +
10.383 +cleanup:
10.384 + delete xfer;
10.385 + delete form;
10.386 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/extensions/updater/Updater.h Mon Feb 02 15:41:25 2009 -0500
11.3 @@ -0,0 +1,70 @@
11.4 +/**
11.5 + * vim: set ts=4 :
11.6 + * =============================================================================
11.7 + * SourceMod Updater Extension
11.8 + * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
11.9 + * =============================================================================
11.10 + *
11.11 + * This program is free software; you can redistribute it and/or modify it under
11.12 + * the terms of the GNU General Public License, version 3.0, as published by the
11.13 + * Free Software Foundation.
11.14 + *
11.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
11.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11.18 + * details.
11.19 + *
11.20 + * You should have received a copy of the GNU General Public License along with
11.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
11.22 + *
11.23 + * As a special exception, AlliedModders LLC gives you permission to link the
11.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
11.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
11.26 + * by the Valve Corporation. You must obey the GNU General Public License in
11.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
11.28 + * this exception to all derivative works. AlliedModders LLC defines further
11.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
11.30 + * or <http://www.sourcemod.net/license.php>.
11.31 + *
11.32 + * Version: $Id$
11.33 + */
11.34 +
11.35 +#ifndef _INCLUDE_SOURCEMOD_UPDATER_H_
11.36 +#define _INCLUDE_SOURCEMOD_UPDATER_H_
11.37 +
11.38 +#include <IWebternet.h>
11.39 +#include <ITextParsers.h>
11.40 +#include <sh_string.h>
11.41 +#include "MemoryDownloader.h"
11.42 +
11.43 +namespace SourceMod
11.44 +{
11.45 + class UpdateReader :
11.46 + public ITextListener_SMC
11.47 + {
11.48 + public:
11.49 + UpdateReader();
11.50 + ~UpdateReader();
11.51 + public: /* ITextListener_SMC */
11.52 + void ReadSMC_ParseStart();
11.53 + SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
11.54 + SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
11.55 + SMCResult ReadSMC_LeavingSection(const SMCStates *states);
11.56 + public:
11.57 + void PerformUpdate();
11.58 + private:
11.59 + void HandleFile();
11.60 + void HandleFolder(const char *folder);
11.61 + private:
11.62 + IWebTransfer *xfer;
11.63 + MemoryDownloader mdl;
11.64 + unsigned int ustate;
11.65 + unsigned int ignoreLevel;
11.66 + SourceHook::String curfile;
11.67 + SourceHook::String url;
11.68 + char checksum[33];
11.69 + };
11.70 +}
11.71 +
11.72 +#endif /* _INCLUDE_SOURCEMOD_UPDATER_H_ */
11.73 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/extensions/updater/extension.cpp Mon Feb 02 15:41:25 2009 -0500
12.3 @@ -0,0 +1,182 @@
12.4 +/**
12.5 + * vim: set ts=4 :
12.6 + * =============================================================================
12.7 + * SourceMod Updater Extension
12.8 + * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
12.9 + * =============================================================================
12.10 + *
12.11 + * This program is free software; you can redistribute it and/or modify it under
12.12 + * the terms of the GNU General Public License, version 3.0, as published by the
12.13 + * Free Software Foundation.
12.14 + *
12.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
12.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12.18 + * details.
12.19 + *
12.20 + * You should have received a copy of the GNU General Public License along with
12.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
12.22 + *
12.23 + * As a special exception, AlliedModders LLC gives you permission to link the
12.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
12.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
12.26 + * by the Valve Corporation. You must obey the GNU General Public License in
12.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
12.28 + * this exception to all derivative works. AlliedModders LLC defines further
12.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
12.30 + * or <http://www.sourcemod.net/license.php>.
12.31 + *
12.32 + * Version: $Id$
12.33 + */
12.34 +
12.35 +#include <stdio.h>
12.36 +#include <stdarg.h>
12.37 +#include <string.h>
12.38 +#include <stdlib.h>
12.39 +#include "extension.h"
12.40 +#include "Updater.h"
12.41 +#include <sh_list.h>
12.42 +#include <sh_string.h>
12.43 +
12.44 +using namespace SourceHook;
12.45 +
12.46 +SmUpdater g_Updater; /**< Global singleton for extension's main interface */
12.47 +SMEXT_LINK(&g_Updater);
12.48 +
12.49 +IWebternet *webternet;
12.50 +static List<String *> update_errors;
12.51 +static List<String *> update_messages;
12.52 +static IThreadHandle *update_thread;
12.53 +
12.54 +bool SmUpdater::SDK_OnLoad(char *error, size_t maxlength, bool late)
12.55 +{
12.56 + sharesys->AddDependency(myself, "webternet.ext", true, true);
12.57 +
12.58 + SM_GET_IFACE(WEBTERNET, webternet);
12.59 +
12.60 + ThreadParams params;
12.61 + params.flags = Thread_Default;
12.62 + params.prio = ThreadPrio_Low;
12.63 + update_thread = threader->MakeThread(this, ¶ms);
12.64 +
12.65 + if (update_thread == NULL)
12.66 + {
12.67 + smutils->Format(error, maxlength, "Could not create thread");
12.68 + return false;
12.69 + }
12.70 +
12.71 + return true;
12.72 +}
12.73 +
12.74 +void SmUpdater::SDK_OnUnload()
12.75 +{
12.76 + /* An interface drop might have killed this thread.
12.77 + * But if the handle is still there, we have to wait.
12.78 + */
12.79 + if (update_thread != NULL)
12.80 + {
12.81 + update_thread->WaitForThread();
12.82 + update_thread->DestroyThis();
12.83 + }
12.84 +
12.85 + /* Clear message tables */
12.86 + List<String *>::iterator iter;
12.87 + while (iter != update_errors.end())
12.88 + {
12.89 + iter = update_errors.erase(iter);
12.90 + }
12.91 + while (iter != update_messages.end())
12.92 + {
12.93 + iter = update_messages.erase(iter);
12.94 + }
12.95 +}
12.96 +
12.97 +bool SmUpdater::QueryInterfaceDrop(SourceMod::SMInterface *pInterface)
12.98 +{
12.99 + if (pInterface == webternet)
12.100 + {
12.101 + return false;
12.102 + }
12.103 +
12.104 + return true;
12.105 +}
12.106 +
12.107 +void SmUpdater::NotifyInterfaceDrop(SMInterface *pInterface)
12.108 +{
12.109 + if (pInterface == webternet)
12.110 + {
12.111 + /* Can't be in the thread if we're losing this extension. */
12.112 + update_thread->WaitForThread();
12.113 + update_thread->DestroyThis();
12.114 + update_thread = NULL;
12.115 + }
12.116 +}
12.117 +
12.118 +static void LogAllMessages(void *data)
12.119 +{
12.120 + String *str;
12.121 + List<String *>::iterator iter;
12.122 +
12.123 + if (update_errors.size())
12.124 + {
12.125 + smutils->LogError(myself, "--- BEGIN ERRORS FROM AUTOMATIC UPDATER ---");
12.126 +
12.127 + for (iter = update_errors.begin();
12.128 + iter != update_errors.end();
12.129 + iter++)
12.130 + {
12.131 + str = (*iter);
12.132 + smutils->LogError(myself, "%s", str->c_str());
12.133 + }
12.134 +
12.135 + smutils->LogError(myself, "--- END ERRORS FROM AUTOMATIC UPDATER ---");
12.136 + }
12.137 +
12.138 + for (iter = update_messages.begin();
12.139 + iter != update_messages.end();
12.140 + iter++)
12.141 + {
12.142 + str = (*iter);
12.143 + smutils->LogMessage(myself, "%s", str->c_str());
12.144 + }
12.145 +}
12.146 +
12.147 +void SmUpdater::RunThread(IThreadHandle *pHandle)
12.148 +{
12.149 + UpdateReader ur;
12.150 +
12.151 + ur.PerformUpdate();
12.152 +
12.153 + if (update_errors.size() || update_messages.size())
12.154 + {
12.155 + smutils->AddFrameAction(LogAllMessages, NULL);
12.156 + }
12.157 +}
12.158 +
12.159 +void SmUpdater::OnTerminate(IThreadHandle *pHandle, bool cancel)
12.160 +{
12.161 +}
12.162 +
12.163 +void AddUpdateMessage(const char *fmt, ...)
12.164 +{
12.165 + va_list ap;
12.166 + char buffer[2048];
12.167 +
12.168 + va_start(ap, fmt);
12.169 + smutils->FormatArgs(buffer, sizeof(buffer), fmt, ap);
12.170 + va_end(ap);
12.171 +
12.172 + update_messages.push_back(new String(buffer));
12.173 +}
12.174 +
12.175 +void AddUpdateError(const char *fmt, ...)
12.176 +{
12.177 + va_list ap;
12.178 + char buffer[2048];
12.179 +
12.180 + va_start(ap, fmt);
12.181 + smutils->FormatArgs(buffer, sizeof(buffer), fmt, ap);
12.182 + va_end(ap);
12.183 +
12.184 + update_errors.push_back(new String(buffer));
12.185 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/extensions/updater/extension.h Mon Feb 02 15:41:25 2009 -0500
13.3 @@ -0,0 +1,87 @@
13.4 +/**
13.5 + * vim: set ts=4 :
13.6 + * =============================================================================
13.7 + * SourceMod Updater Extension
13.8 + * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
13.9 + * =============================================================================
13.10 + *
13.11 + * This program is free software; you can redistribute it and/or modify it under
13.12 + * the terms of the GNU General Public License, version 3.0, as published by the
13.13 + * Free Software Foundation.
13.14 + *
13.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
13.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13.18 + * details.
13.19 + *
13.20 + * You should have received a copy of the GNU General Public License along with
13.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
13.22 + *
13.23 + * As a special exception, AlliedModders LLC gives you permission to link the
13.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
13.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
13.26 + * by the Valve Corporation. You must obey the GNU General Public License in
13.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
13.28 + * this exception to all derivative works. AlliedModders LLC defines further
13.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
13.30 + * or <http://www.sourcemod.net/license.php>.
13.31 + *
13.32 + * Version: $Id$
13.33 + */
13.34 +
13.35 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
13.36 +#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
13.37 +
13.38 +/**
13.39 + * @file extension.h
13.40 + * @brief Sample extension code header.
13.41 + */
13.42 +
13.43 +#include "smsdk_ext.h"
13.44 +#include <IWebternet.h>
13.45 +
13.46 +/**
13.47 + * @brief Sample implementation of the SDK Extension.
13.48 + * Note: Uncomment one of the pre-defined virtual functions in order to use it.
13.49 + */
13.50 +class SmUpdater :
13.51 + public SDKExtension,
13.52 + public IThread
13.53 +{
13.54 +public: /* SDKExtension */
13.55 + bool SDK_OnLoad(char *error, size_t maxlength, bool late);
13.56 + void SDK_OnUnload();
13.57 +public: /* IExtension */
13.58 + bool QueryInterfaceDrop(SMInterface *pInterface);
13.59 + void NotifyInterfaceDrop(SMInterface *pInterface);
13.60 +public: /* IThread */
13.61 + void RunThread(IThreadHandle *pHandle);
13.62 + void OnTerminate(IThreadHandle *pHandle, bool cancel);
13.63 +
13.64 + /**
13.65 + * @brief This is called once all known extensions have been loaded.
13.66 + * Note: It is is a good idea to add natives here, if any are provided.
13.67 + */
13.68 + //virtual void SDK_OnAllLoaded();
13.69 +
13.70 + /**
13.71 + * @brief Called when the pause state is changed.
13.72 + */
13.73 + //virtual void SDK_OnPauseChange(bool paused);
13.74 +
13.75 + /**
13.76 + * @brief this is called when Core wants to know if your extension is working.
13.77 + *
13.78 + * @param error Error message buffer.
13.79 + * @param maxlength Size of error message buffer.
13.80 + * @return True if working, false otherwise.
13.81 + */
13.82 + //virtual bool QueryRunning(char *error, size_t maxlength);
13.83 +};
13.84 +
13.85 +extern void AddUpdateMessage(const char *fmt, ...);
13.86 +extern void AddUpdateError(const char *fmt, ...);
13.87 +
13.88 +extern IWebternet *webternet;
13.89 +
13.90 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/extensions/updater/md5.cpp Mon Feb 02 15:41:25 2009 -0500
14.3 @@ -0,0 +1,476 @@
14.4 +// MD5.CC - source code for the C++/object oriented translation and
14.5 +// modification of MD5.
14.6 +
14.7 +// Translation and modification (c) 1995 by Mordechai T. Abzug
14.8 +
14.9 +// This translation/ modification is provided "as is," without express or
14.10 +// implied warranty of any kind.
14.11 +
14.12 +// The translator/ modifier does not claim (1) that MD5 will do what you think
14.13 +// it does; (2) that this translation/ modification is accurate; or (3) that
14.14 +// this software is "merchantible." (Language for this disclaimer partially
14.15 +// copied from the disclaimer below).
14.16 +
14.17 +/* based on:
14.18 +
14.19 + MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
14.20 + MDDRIVER.C - test driver for MD2, MD4 and MD5
14.21 +
14.22 +
14.23 + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
14.24 +rights reserved.
14.25 +
14.26 +License to copy and use this software is granted provided that it
14.27 +is identified as the "RSA Data Security, Inc. MD5 Message-Digest
14.28 +Algorithm" in all material mentioning or referencing this software
14.29 +or this function.
14.30 +
14.31 +License is also granted to make and use derivative works provided
14.32 +that such works are identified as "derived from the RSA Data
14.33 +Security, Inc. MD5 Message-Digest Algorithm" in all material
14.34 +mentioning or referencing the derived work.
14.35 +
14.36 +RSA Data Security, Inc. makes no representations concerning either
14.37 +the merchantability of this software or the suitability of this
14.38 +software for any particular purpose. It is provided "as is"
14.39 +without express or implied warranty of any kind.
14.40 +
14.41 +These notices must be retained in any copies of any part of this
14.42 +documentation and/or software.
14.43 +
14.44 + */
14.45 +
14.46 +#include "md5.h"
14.47 +
14.48 +#include <assert.h>
14.49 +#include <string.h>
14.50 +
14.51 +// MD5 simple initialization method
14.52 +
14.53 +MD5::MD5(){
14.54 +
14.55 + init();
14.56 +
14.57 +}
14.58 +
14.59 +
14.60 +// MD5 block update operation. Continues an MD5 message-digest
14.61 +// operation, processing another message block, and updating the
14.62 +// context.
14.63 +
14.64 +void MD5::update (uint1 *input, uint4 input_length) {
14.65 +
14.66 + uint4 input_index, buffer_index;
14.67 + uint4 buffer_space; // how much space is left in buffer
14.68 +
14.69 + if (finalized){ // so we can't update!
14.70 + /*cerr << "MD5::update: Can't update a finalized digest!" << endl;*/
14.71 + return;
14.72 + }
14.73 +
14.74 + // Compute number of bytes mod 64
14.75 + buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
14.76 +
14.77 + // Update number of bits
14.78 + if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
14.79 + count[1]++;
14.80 +
14.81 + count[1] += ((uint4)input_length >> 29);
14.82 +
14.83 +
14.84 + buffer_space = 64 - buffer_index; // how much space is left in buffer
14.85 +
14.86 + // Transform as many times as possible.
14.87 + if (input_length >= buffer_space) { // ie. we have enough to fill the buffer
14.88 + // fill the rest of the buffer and transform
14.89 + memcpy (buffer + buffer_index, input, buffer_space);
14.90 + transform (buffer);
14.91 +
14.92 + // now, transform each 64-byte piece of the input, bypassing the buffer
14.93 + for (input_index = buffer_space; input_index + 63 < input_length;
14.94 + input_index += 64)
14.95 + transform (input+input_index);
14.96 +
14.97 + buffer_index = 0; // so we can buffer remaining
14.98 + }
14.99 + else
14.100 + input_index=0; // so we can buffer the whole input
14.101 +
14.102 +
14.103 + // and here we do the buffering:
14.104 + memcpy(buffer+buffer_index, input+input_index, input_length-input_index);
14.105 +}
14.106 +
14.107 +
14.108 +
14.109 +// MD5 update for files.
14.110 +// Like above, except that it works on files (and uses above as a primitive.)
14.111 +
14.112 +void MD5::update(FILE *file){
14.113 +
14.114 + unsigned char buffer[1024];
14.115 + int len;
14.116 +
14.117 + while ((len=fread(buffer, 1, 1024, file)))
14.118 + update(buffer, len);
14.119 +
14.120 + fclose (file);
14.121 +
14.122 +}
14.123 +
14.124 +
14.125 +// MD5 finalization. Ends an MD5 message-digest operation, writing the
14.126 +// the message digest and zeroizing the context.
14.127 +
14.128 +
14.129 +void MD5::finalize (){
14.130 +
14.131 + unsigned char bits[8];
14.132 + unsigned int index, padLen;
14.133 + static uint1 PADDING[64]={
14.134 + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14.135 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14.136 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
14.137 + };
14.138 +
14.139 + if (finalized){
14.140 + /* cerr << "MD5::finalize: Already finalized this digest!" << endl;*/
14.141 + return;
14.142 + }
14.143 +
14.144 + // Save number of bits
14.145 + encode (bits, count, 8);
14.146 +
14.147 + // Pad out to 56 mod 64.
14.148 + index = (uint4) ((count[0] >> 3) & 0x3f);
14.149 + padLen = (index < 56) ? (56 - index) : (120 - index);
14.150 + update (PADDING, padLen);
14.151 +
14.152 + // Append length (before padding)
14.153 + update (bits, 8);
14.154 +
14.155 + // Store state in digest
14.156 + encode (digest, state, 16);
14.157 +
14.158 + // Zeroize sensitive information
14.159 + memset (buffer, 0, sizeof(*buffer));
14.160 +
14.161 + finalized=1;
14.162 +
14.163 +}
14.164 +
14.165 +
14.166 +
14.167 +
14.168 +MD5::MD5(FILE *file){
14.169 +
14.170 + init(); // must be called be all constructors
14.171 + update(file);
14.172 + finalize ();
14.173 +}
14.174 +
14.175 +unsigned char *MD5::raw_digest(){
14.176 +
14.177 + uint1 *s = new uint1[16];
14.178 +
14.179 + if (!finalized){
14.180 +/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
14.181 + "finalized the digest!" <<endl;*/
14.182 + return ( (unsigned char*) "");
14.183 + }
14.184 +
14.185 + memcpy(s, digest, 16);
14.186 + return s;
14.187 +}
14.188 +
14.189 +unsigned char *MD5::raw_digest(unsigned char buffer[16])
14.190 +{
14.191 + if (!finalized)
14.192 + {
14.193 + return ( (unsigned char*) "");
14.194 + }
14.195 +
14.196 + memcpy(buffer, digest, 16);
14.197 + return buffer;
14.198 +}
14.199 +
14.200 +
14.201 +
14.202 +char *MD5::hex_digest(){
14.203 +
14.204 + int i;
14.205 + char *s= new char[33];
14.206 +
14.207 + assert(finalized);
14.208 +
14.209 + for (i=0; i<16; i++)
14.210 + sprintf(s+i*2, "%02x", digest[i]);
14.211 +
14.212 + s[32]='\0';
14.213 +
14.214 + return s;
14.215 +}
14.216 +
14.217 +
14.218 +char *MD5::hex_digest(char buffer[33]){
14.219 +
14.220 + int i;
14.221 +
14.222 + assert(finalized);
14.223 +
14.224 + for (i=0; i<16; i++)
14.225 + sprintf(buffer+i*2, "%02x", digest[i]);
14.226 +
14.227 + buffer[32]='\0';
14.228 +
14.229 + return buffer;
14.230 +}
14.231 +
14.232 +
14.233 +// PRIVATE METHODS:
14.234 +
14.235 +
14.236 +
14.237 +void MD5::init(){
14.238 + finalized=0; // we just started!
14.239 +
14.240 + // Nothing counted, so count=0
14.241 + count[0] = 0;
14.242 + count[1] = 0;
14.243 +
14.244 + // Load magic initialization constants.
14.245 + state[0] = 0x67452301;
14.246 + state[1] = 0xefcdab89;
14.247 + state[2] = 0x98badcfe;
14.248 + state[3] = 0x10325476;
14.249 +}
14.250 +
14.251 +
14.252 +
14.253 +// Constants for MD5Transform routine.
14.254 +// Although we could use C++ style constants, defines are actually better,
14.255 +// since they let us easily evade scope clashes.
14.256 +
14.257 +#define S11 7
14.258 +#define S12 12
14.259 +#define S13 17
14.260 +#define S14 22
14.261 +#define S21 5
14.262 +#define S22 9
14.263 +#define S23 14
14.264 +#define S24 20
14.265 +#define S31 4
14.266 +#define S32 11
14.267 +#define S33 16
14.268 +#define S34 23
14.269 +#define S41 6
14.270 +#define S42 10
14.271 +#define S43 15
14.272 +#define S44 21
14.273 +
14.274 +
14.275 +
14.276 +
14.277 +// MD5 basic transformation. Transforms state based on block.
14.278 +void MD5::transform (uint1 block[64]){
14.279 +
14.280 + uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
14.281 +
14.282 + decode (x, block, 64);
14.283 +
14.284 + assert(!finalized); // not just a user error, since the method is private
14.285 +
14.286 + /* Round 1 */
14.287 + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
14.288 + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
14.289 + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
14.290 + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
14.291 + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
14.292 + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
14.293 + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
14.294 + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
14.295 + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
14.296 + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
14.297 + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
14.298 + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
14.299 + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
14.300 + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
14.301 + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
14.302 + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
14.303 +
14.304 + /* Round 2 */
14.305 + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
14.306 + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
14.307 + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
14.308 + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
14.309 + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
14.310 + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
14.311 + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
14.312 + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
14.313 + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
14.314 + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
14.315 + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
14.316 + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
14.317 + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
14.318 + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
14.319 + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
14.320 + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
14.321 +
14.322 + /* Round 3 */
14.323 + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
14.324 + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
14.325 + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
14.326 + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
14.327 + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
14.328 + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
14.329 + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
14.330 + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
14.331 + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
14.332 + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
14.333 + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
14.334 + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
14.335 + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
14.336 + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
14.337 + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
14.338 + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
14.339 +
14.340 + /* Round 4 */
14.341 + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
14.342 + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
14.343 + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
14.344 + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
14.345 + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
14.346 + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
14.347 + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
14.348 + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
14.349 + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
14.350 + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
14.351 + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
14.352 + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
14.353 + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
14.354 + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
14.355 + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
14.356 + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
14.357 +
14.358 + state[0] += a;
14.359 + state[1] += b;
14.360 + state[2] += c;
14.361 + state[3] += d;
14.362 +
14.363 + // Zeroize sensitive information.
14.364 + memset ( (uint1 *) x, 0, sizeof(x));
14.365 +
14.366 +}
14.367 +
14.368 +
14.369 +
14.370 +// Encodes input (UINT4) into output (unsigned char). Assumes len is
14.371 +// a multiple of 4.
14.372 +void MD5::encode (uint1 *output, uint4 *input, uint4 len) {
14.373 +
14.374 + unsigned int i, j;
14.375 +
14.376 + for (i = 0, j = 0; j < len; i++, j += 4) {
14.377 + output[j] = (uint1) (input[i] & 0xff);
14.378 + output[j+1] = (uint1) ((input[i] >> 8) & 0xff);
14.379 + output[j+2] = (uint1) ((input[i] >> 16) & 0xff);
14.380 + output[j+3] = (uint1) ((input[i] >> 24) & 0xff);
14.381 + }
14.382 +}
14.383 +
14.384 +
14.385 +
14.386 +
14.387 +// Decodes input (unsigned char) into output (UINT4). Assumes len is
14.388 +// a multiple of 4.
14.389 +void MD5::decode (uint4 *output, uint1 *input, uint4 len){
14.390 +
14.391 + unsigned int i, j;
14.392 +
14.393 + for (i = 0, j = 0; j < len; i++, j += 4)
14.394 + output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
14.395 + (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24);
14.396 +}
14.397 +
14.398 +
14.399 +
14.400 +
14.401 +
14.402 +// Note: Replace "for loop" with standard memcpy if possible.
14.403 +void MD5::memcpy (uint1 *output, uint1 *input, uint4 len){
14.404 +
14.405 + unsigned int i;
14.406 +
14.407 + for (i = 0; i < len; i++)
14.408 + output[i] = input[i];
14.409 +}
14.410 +
14.411 +
14.412 +
14.413 +// Note: Replace "for loop" with standard memset if possible.
14.414 +void MD5::memset (uint1 *output, uint1 value, uint4 len){
14.415 +
14.416 + unsigned int i;
14.417 +
14.418 + for (i = 0; i < len; i++)
14.419 + output[i] = value;
14.420 +}
14.421 +
14.422 +
14.423 +
14.424 +// ROTATE_LEFT rotates x left n bits.
14.425 +
14.426 +inline unsigned int MD5::rotate_left (uint4 x, uint4 n){
14.427 + return (x << n) | (x >> (32-n)) ;
14.428 +}
14.429 +
14.430 +
14.431 +
14.432 +
14.433 +// F, G, H and I are basic MD5 functions.
14.434 +
14.435 +inline unsigned int MD5::F (uint4 x, uint4 y, uint4 z){
14.436 + return (x & y) | (~x & z);
14.437 +}
14.438 +
14.439 +inline unsigned int MD5::G (uint4 x, uint4 y, uint4 z){
14.440 + return (x & z) | (y & ~z);
14.441 +}
14.442 +
14.443 +inline unsigned int MD5::H (uint4 x, uint4 y, uint4 z){
14.444 + return x ^ y ^ z;
14.445 +}
14.446 +
14.447 +inline unsigned int MD5::I (uint4 x, uint4 y, uint4 z){
14.448 + return y ^ (x | ~z);
14.449 +}
14.450 +
14.451 +
14.452 +
14.453 +// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
14.454 +// Rotation is separate from addition to prevent recomputation.
14.455 +
14.456 +
14.457 +inline void MD5::FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
14.458 + uint4 s, uint4 ac){
14.459 + a += F(b, c, d) + x + ac;
14.460 + a = rotate_left (a, s) +b;
14.461 +}
14.462 +
14.463 +inline void MD5::GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
14.464 + uint4 s, uint4 ac){
14.465 + a += G(b, c, d) + x + ac;
14.466 + a = rotate_left (a, s) +b;
14.467 +}
14.468 +
14.469 +inline void MD5::HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
14.470 + uint4 s, uint4 ac){
14.471 + a += H(b, c, d) + x + ac;
14.472 + a = rotate_left (a, s) +b;
14.473 +}
14.474 +
14.475 +inline void MD5::II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
14.476 + uint4 s, uint4 ac){
14.477 + a += I(b, c, d) + x + ac;
14.478 + a = rotate_left (a, s) +b;
14.479 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/extensions/updater/md5.h Mon Feb 02 15:41:25 2009 -0500
15.3 @@ -0,0 +1,106 @@
15.4 +// MD5.CC - source code for the C++/object oriented translation and
15.5 +// modification of MD5.
15.6 +
15.7 +// Translation and modification (c) 1995 by Mordechai T. Abzug
15.8 +
15.9 +// This translation/ modification is provided "as is," without express or
15.10 +// implied warranty of any kind.
15.11 +
15.12 +// The translator/ modifier does not claim (1) that MD5 will do what you think
15.13 +// it does; (2) that this translation/ modification is accurate; or (3) that
15.14 +// this software is "merchantible." (Language for this disclaimer partially
15.15 +// copied from the disclaimer below).
15.16 +
15.17 +/* based on:
15.18 +
15.19 + MD5.H - header file for MD5C.C
15.20 + MDDRIVER.C - test driver for MD2, MD4 and MD5
15.21 +
15.22 + Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
15.23 +rights reserved.
15.24 +
15.25 +License to copy and use this software is granted provided that it
15.26 +is identified as the "RSA Data Security, Inc. MD5 Message-Digest
15.27 +Algorithm" in all material mentioning or referencing this software
15.28 +or this function.
15.29 +
15.30 +License is also granted to make and use derivative works provided
15.31 +that such works are identified as "derived from the RSA Data
15.32 +Security, Inc. MD5 Message-Digest Algorithm" in all material
15.33 +mentioning or referencing the derived work.
15.34 +
15.35 +RSA Data Security, Inc. makes no representations concerning either
15.36 +the merchantability of this software or the suitability of this
15.37 +software for any particular purpose. It is provided "as is"
15.38 +without express or implied warranty of any kind.
15.39 +
15.40 +These notices must be retained in any copies of any part of this
15.41 +documentation and/or software.
15.42 +
15.43 +*/
15.44 +
15.45 +#include <stdio.h>
15.46 +//#include <fstream.h>
15.47 +//#include <iostream.h>
15.48 +
15.49 +class MD5 {
15.50 +
15.51 +public:
15.52 +// methods for controlled operation:
15.53 + MD5 (); // simple initializer
15.54 + void update (unsigned char *input, unsigned int input_length);
15.55 + void update (FILE *file);
15.56 + void finalize ();
15.57 +
15.58 +// constructors for special circumstances. All these constructors finalize
15.59 +// the MD5 context.
15.60 + MD5 (unsigned char *string); // digest string, finalize
15.61 + MD5 (FILE *file); // digest file, close, finalize
15.62 +
15.63 +// methods to acquire finalized result
15.64 + unsigned char *raw_digest (); // digest as a 16-byte binary array
15.65 + unsigned char *raw_digest(unsigned char buffer[16]);
15.66 + char * hex_digest (); // digest as a 33-byte ascii-hex string
15.67 + char * hex_digest (char buffer[33]); //same as above, passing buffer
15.68 +
15.69 +
15.70 +
15.71 +private:
15.72 +
15.73 +// first, some types:
15.74 + typedef unsigned int uint4; // assumes integer is 4 words long
15.75 + typedef unsigned short int uint2; // assumes short integer is 2 words long
15.76 + typedef unsigned char uint1; // assumes char is 1 word long
15.77 +
15.78 +// next, the private data:
15.79 + uint4 state[4];
15.80 + uint4 count[2]; // number of *bits*, mod 2^64
15.81 + uint1 buffer[64]; // input buffer
15.82 + uint1 digest[16];
15.83 + uint1 finalized;
15.84 +
15.85 +// last, the private methods, mostly static:
15.86 + void init (); // called by all constructors
15.87 + void transform (uint1 *buffer); // does the real update work. Note
15.88 + // that length is implied to be 64.
15.89 +
15.90 + static void encode (uint1 *dest, uint4 *src, uint4 length);
15.91 + static void decode (uint4 *dest, uint1 *src, uint4 length);
15.92 + static void memcpy (uint1 *dest, uint1 *src, uint4 length);
15.93 + static void memset (uint1 *start, uint1 val, uint4 length);
15.94 +
15.95 + static inline uint4 rotate_left (uint4 x, uint4 n);
15.96 + static inline uint4 F (uint4 x, uint4 y, uint4 z);
15.97 + static inline uint4 G (uint4 x, uint4 y, uint4 z);
15.98 + static inline uint4 H (uint4 x, uint4 y, uint4 z);
15.99 + static inline uint4 I (uint4 x, uint4 y, uint4 z);
15.100 + static inline void FF (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
15.101 + uint4 s, uint4 ac);
15.102 + static inline void GG (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
15.103 + uint4 s, uint4 ac);
15.104 + static inline void HH (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
15.105 + uint4 s, uint4 ac);
15.106 + static inline void II (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
15.107 + uint4 s, uint4 ac);
15.108 +
15.109 +};
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/extensions/updater/msvc9/updater.sln Mon Feb 02 15:41:25 2009 -0500
16.3 @@ -0,0 +1,20 @@
16.4 +
16.5 +Microsoft Visual Studio Solution File, Format Version 10.00
16.6 +# Visual Studio 2008
16.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "updater", "updater.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
16.8 +EndProject
16.9 +Global
16.10 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
16.11 + Debug|Win32 = Debug|Win32
16.12 + Release|Win32 = Release|Win32
16.13 + EndGlobalSection
16.14 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
16.15 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32
16.16 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32
16.17 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32
16.18 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32
16.19 + EndGlobalSection
16.20 + GlobalSection(SolutionProperties) = preSolution
16.21 + HideSolutionNode = FALSE
16.22 + EndGlobalSection
16.23 +EndGlobal
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/extensions/updater/msvc9/updater.vcproj Mon Feb 02 15:41:25 2009 -0500
17.3 @@ -0,0 +1,916 @@
17.4 +<?xml version="1.0" encoding="Windows-1252"?>
17.5 +<VisualStudioProject
17.6 + ProjectType="Visual C++"
17.7 + Version="9.00"
17.8 + Name="updater"
17.9 + ProjectGUID="{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
17.10 + RootNamespace="updater"
17.11 + Keyword="Win32Proj"
17.12 + TargetFrameworkVersion="131072"
17.13 + >
17.14 + <Platforms>
17.15 + <Platform
17.16 + Name="Win32"
17.17 + />
17.18 + </Platforms>
17.19 + <ToolFiles>
17.20 + </ToolFiles>
17.21 + <Configurations>
17.22 + <Configuration
17.23 + Name="Debug|Win32"
17.24 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.25 + IntermediateDirectory="$(ConfigurationName)"
17.26 + ConfigurationType="2"
17.27 + CharacterSet="2"
17.28 + >
17.29 + <Tool
17.30 + Name="VCPreBuildEventTool"
17.31 + />
17.32 + <Tool
17.33 + Name="VCCustomBuildTool"
17.34 + />
17.35 + <Tool
17.36 + Name="VCXMLDataGeneratorTool"
17.37 + />
17.38 + <Tool
17.39 + Name="VCWebServiceProxyGeneratorTool"
17.40 + />
17.41 + <Tool
17.42 + Name="VCMIDLTool"
17.43 + />
17.44 + <Tool
17.45 + Name="VCCLCompilerTool"
17.46 + Optimization="0"
17.47 + AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;"$(MMSOURCE17)\core\sourcehook""
17.48 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;_CRT_NONSTDC_NO_DEPRECATE"
17.49 + MinimalRebuild="true"
17.50 + BasicRuntimeChecks="3"
17.51 + RuntimeLibrary="1"
17.52 + EnableEnhancedInstructionSet="1"
17.53 + RuntimeTypeInfo="false"
17.54 + UsePrecompiledHeader="0"
17.55 + WarningLevel="3"
17.56 + Detect64BitPortabilityProblems="false"
17.57 + DebugInformationFormat="4"
17.58 + />
17.59 + <Tool
17.60 + Name="VCManagedResourceCompilerTool"
17.61 + />
17.62 + <Tool
17.63 + Name="VCResourceCompilerTool"
17.64 + />
17.65 + <Tool
17.66 + Name="VCPreLinkEventTool"
17.67 + />
17.68 + <Tool
17.69 + Name="VCLinkerTool"
17.70 + OutputFile="$(OutDir)\updater.ext.dll"
17.71 + LinkIncremental="2"
17.72 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
17.73 + GenerateDebugInformation="true"
17.74 + SubSystem="2"
17.75 + RandomizedBaseAddress="1"
17.76 + DataExecutionPrevention="0"
17.77 + TargetMachine="1"
17.78 + />
17.79 + <Tool
17.80 + Name="VCALinkTool"
17.81 + />
17.82 + <Tool
17.83 + Name="VCManifestTool"
17.84 + />
17.85 + <Tool
17.86 + Name="VCXDCMakeTool"
17.87 + />
17.88 + <Tool
17.89 + Name="VCBscMakeTool"
17.90 + />
17.91 + <Tool
17.92 + Name="VCFxCopTool"
17.93 + />
17.94 + <Tool
17.95 + Name="VCAppVerifierTool"
17.96 + />
17.97 + <Tool
17.98 + Name="VCPostBuildEventTool"
17.99 + />
17.100 + </Configuration>
17.101 + <Configuration
17.102 + Name="Release|Win32"
17.103 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.104 + IntermediateDirectory="$(ConfigurationName)"
17.105 + ConfigurationType="2"
17.106 + CharacterSet="2"
17.107 + WholeProgramOptimization="1"
17.108 + >
17.109 + <Tool
17.110 + Name="VCPreBuildEventTool"
17.111 + />
17.112 + <Tool
17.113 + Name="VCCustomBuildTool"
17.114 + />
17.115 + <Tool
17.116 + Name="VCXMLDataGeneratorTool"
17.117 + />
17.118 + <Tool
17.119 + Name="VCWebServiceProxyGeneratorTool"
17.120 + />
17.121 + <Tool
17.122 + Name="VCMIDLTool"
17.123 + />
17.124 + <Tool
17.125 + Name="VCCLCompilerTool"
17.126 + FavorSizeOrSpeed="1"
17.127 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.128 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;_CRT_NONSTDC_NO_DEPRECATE"
17.129 + RuntimeLibrary="0"
17.130 + EnableEnhancedInstructionSet="1"
17.131 + RuntimeTypeInfo="false"
17.132 + UsePrecompiledHeader="0"
17.133 + WarningLevel="3"
17.134 + Detect64BitPortabilityProblems="false"
17.135 + DebugInformationFormat="3"
17.136 + />
17.137 + <Tool
17.138 + Name="VCManagedResourceCompilerTool"
17.139 + />
17.140 + <Tool
17.141 + Name="VCResourceCompilerTool"
17.142 + />
17.143 + <Tool
17.144 + Name="VCPreLinkEventTool"
17.145 + />
17.146 + <Tool
17.147 + Name="VCLinkerTool"
17.148 + OutputFile="$(OutDir)\updater.ext.dll"
17.149 + LinkIncremental="1"
17.150 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
17.151 + GenerateDebugInformation="true"
17.152 + SubSystem="2"
17.153 + OptimizeReferences="2"
17.154 + EnableCOMDATFolding="2"
17.155 + RandomizedBaseAddress="1"
17.156 + DataExecutionPrevention="0"
17.157 + TargetMachine="1"
17.158 + />
17.159 + <Tool
17.160 + Name="VCALinkTool"
17.161 + />
17.162 + <Tool
17.163 + Name="VCManifestTool"
17.164 + />
17.165 + <Tool
17.166 + Name="VCXDCMakeTool"
17.167 + />
17.168 + <Tool
17.169 + Name="VCBscMakeTool"
17.170 + />
17.171 + <Tool
17.172 + Name="VCFxCopTool"
17.173 + />
17.174 + <Tool
17.175 + Name="VCAppVerifierTool"
17.176 + />
17.177 + <Tool
17.178 + Name="VCPostBuildEventTool"
17.179 + />
17.180 + </Configuration>
17.181 + <Configuration
17.182 + Name="Debug - Old Metamod|Win32"
17.183 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.184 + IntermediateDirectory="$(ConfigurationName)"
17.185 + ConfigurationType="2"
17.186 + CharacterSet="2"
17.187 + >
17.188 + <Tool
17.189 + Name="VCPreBuildEventTool"
17.190 + />
17.191 + <Tool
17.192 + Name="VCCustomBuildTool"
17.193 + />
17.194 + <Tool
17.195 + Name="VCXMLDataGeneratorTool"
17.196 + />
17.197 + <Tool
17.198 + Name="VCWebServiceProxyGeneratorTool"
17.199 + />
17.200 + <Tool
17.201 + Name="VCMIDLTool"
17.202 + />
17.203 + <Tool
17.204 + Name="VCCLCompilerTool"
17.205 + AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.206 + Optimization="0"
17.207 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
17.208 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
17.209 + MinimalRebuild="true"
17.210 + BasicRuntimeChecks="3"
17.211 + RuntimeLibrary="1"
17.212 + EnableEnhancedInstructionSet="1"
17.213 + RuntimeTypeInfo="false"
17.214 + UsePrecompiledHeader="0"
17.215 + WarningLevel="3"
17.216 + Detect64BitPortabilityProblems="false"
17.217 + DebugInformationFormat="4"
17.218 + />
17.219 + <Tool
17.220 + Name="VCManagedResourceCompilerTool"
17.221 + />
17.222 + <Tool
17.223 + Name="VCResourceCompilerTool"
17.224 + />
17.225 + <Tool
17.226 + Name="VCPreLinkEventTool"
17.227 + />
17.228 + <Tool
17.229 + Name="VCLinkerTool"
17.230 + AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib""
17.231 + OutputFile="$(OutDir)\sample.ext.dll"
17.232 + LinkIncremental="2"
17.233 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
17.234 + GenerateDebugInformation="true"
17.235 + SubSystem="2"
17.236 + RandomizedBaseAddress="1"
17.237 + DataExecutionPrevention="0"
17.238 + TargetMachine="1"
17.239 + />
17.240 + <Tool
17.241 + Name="VCALinkTool"
17.242 + />
17.243 + <Tool
17.244 + Name="VCManifestTool"
17.245 + />
17.246 + <Tool
17.247 + Name="VCXDCMakeTool"
17.248 + />
17.249 + <Tool
17.250 + Name="VCBscMakeTool"
17.251 + />
17.252 + <Tool
17.253 + Name="VCFxCopTool"
17.254 + />
17.255 + <Tool
17.256 + Name="VCAppVerifierTool"
17.257 + />
17.258 + <Tool
17.259 + Name="VCPostBuildEventTool"
17.260 + />
17.261 + </Configuration>
17.262 + <Configuration
17.263 + Name="Release - Old Metamod|Win32"
17.264 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.265 + IntermediateDirectory="$(ConfigurationName)"
17.266 + ConfigurationType="2"
17.267 + CharacterSet="2"
17.268 + WholeProgramOptimization="1"
17.269 + >
17.270 + <Tool
17.271 + Name="VCPreBuildEventTool"
17.272 + />
17.273 + <Tool
17.274 + Name="VCCustomBuildTool"
17.275 + />
17.276 + <Tool
17.277 + Name="VCXMLDataGeneratorTool"
17.278 + />
17.279 + <Tool
17.280 + Name="VCWebServiceProxyGeneratorTool"
17.281 + />
17.282 + <Tool
17.283 + Name="VCMIDLTool"
17.284 + />
17.285 + <Tool
17.286 + Name="VCCLCompilerTool"
17.287 + AdditionalOptions="/MP /D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.288 + FavorSizeOrSpeed="1"
17.289 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
17.290 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
17.291 + RuntimeLibrary="0"
17.292 + EnableEnhancedInstructionSet="1"
17.293 + RuntimeTypeInfo="false"
17.294 + UsePrecompiledHeader="0"
17.295 + WarningLevel="3"
17.296 + Detect64BitPortabilityProblems="false"
17.297 + DebugInformationFormat="3"
17.298 + />
17.299 + <Tool
17.300 + Name="VCManagedResourceCompilerTool"
17.301 + />
17.302 + <Tool
17.303 + Name="VCResourceCompilerTool"
17.304 + />
17.305 + <Tool
17.306 + Name="VCPreLinkEventTool"
17.307 + />
17.308 + <Tool
17.309 + Name="VCLinkerTool"
17.310 + AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib""
17.311 + OutputFile="$(OutDir)\sample.ext.dll"
17.312 + LinkIncremental="1"
17.313 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
17.314 + GenerateDebugInformation="true"
17.315 + SubSystem="2"
17.316 + OptimizeReferences="2"
17.317 + EnableCOMDATFolding="2"
17.318 + RandomizedBaseAddress="1"
17.319 + DataExecutionPrevention="0"
17.320 + TargetMachine="1"
17.321 + />
17.322 + <Tool
17.323 + Name="VCALinkTool"
17.324 + />
17.325 + <Tool
17.326 + Name="VCManifestTool"
17.327 + />
17.328 + <Tool
17.329 + Name="VCXDCMakeTool"
17.330 + />
17.331 + <Tool
17.332 + Name="VCBscMakeTool"
17.333 + />
17.334 + <Tool
17.335 + Name="VCFxCopTool"
17.336 + />
17.337 + <Tool
17.338 + Name="VCAppVerifierTool"
17.339 + />
17.340 + <Tool
17.341 + Name="VCPostBuildEventTool"
17.342 + />
17.343 + </Configuration>
17.344 + <Configuration
17.345 + Name="Debug - Orange Box|Win32"
17.346 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.347 + IntermediateDirectory="$(ConfigurationName)"
17.348 + ConfigurationType="2"
17.349 + CharacterSet="2"
17.350 + >
17.351 + <Tool
17.352 + Name="VCPreBuildEventTool"
17.353 + />
17.354 + <Tool
17.355 + Name="VCCustomBuildTool"
17.356 + />
17.357 + <Tool
17.358 + Name="VCXMLDataGeneratorTool"
17.359 + />
17.360 + <Tool
17.361 + Name="VCWebServiceProxyGeneratorTool"
17.362 + />
17.363 + <Tool
17.364 + Name="VCMIDLTool"
17.365 + />
17.366 + <Tool
17.367 + Name="VCCLCompilerTool"
17.368 + AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.369 + Optimization="0"
17.370 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.371 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=3"
17.372 + MinimalRebuild="true"
17.373 + BasicRuntimeChecks="3"
17.374 + RuntimeLibrary="1"
17.375 + EnableEnhancedInstructionSet="1"
17.376 + RuntimeTypeInfo="false"
17.377 + UsePrecompiledHeader="0"
17.378 + WarningLevel="3"
17.379 + Detect64BitPortabilityProblems="false"
17.380 + DebugInformationFormat="4"
17.381 + />
17.382 + <Tool
17.383 + Name="VCManagedResourceCompilerTool"
17.384 + />
17.385 + <Tool
17.386 + Name="VCResourceCompilerTool"
17.387 + />
17.388 + <Tool
17.389 + Name="VCPreLinkEventTool"
17.390 + />
17.391 + <Tool
17.392 + Name="VCLinkerTool"
17.393 + AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib""
17.394 + OutputFile="$(OutDir)\sample.ext.dll"
17.395 + LinkIncremental="2"
17.396 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
17.397 + GenerateDebugInformation="true"
17.398 + SubSystem="2"
17.399 + RandomizedBaseAddress="1"
17.400 + DataExecutionPrevention="0"
17.401 + TargetMachine="1"
17.402 + />
17.403 + <Tool
17.404 + Name="VCALinkTool"
17.405 + />
17.406 + <Tool
17.407 + Name="VCManifestTool"
17.408 + />
17.409 + <Tool
17.410 + Name="VCXDCMakeTool"
17.411 + />
17.412 + <Tool
17.413 + Name="VCBscMakeTool"
17.414 + />
17.415 + <Tool
17.416 + Name="VCFxCopTool"
17.417 + />
17.418 + <Tool
17.419 + Name="VCAppVerifierTool"
17.420 + />
17.421 + <Tool
17.422 + Name="VCPostBuildEventTool"
17.423 + />
17.424 + </Configuration>
17.425 + <Configuration
17.426 + Name="Release - Orange Box|Win32"
17.427 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.428 + IntermediateDirectory="$(ConfigurationName)"
17.429 + ConfigurationType="2"
17.430 + CharacterSet="2"
17.431 + WholeProgramOptimization="1"
17.432 + >
17.433 + <Tool
17.434 + Name="VCPreBuildEventTool"
17.435 + />
17.436 + <Tool
17.437 + Name="VCCustomBuildTool"
17.438 + />
17.439 + <Tool
17.440 + Name="VCXMLDataGeneratorTool"
17.441 + />
17.442 + <Tool
17.443 + Name="VCWebServiceProxyGeneratorTool"
17.444 + />
17.445 + <Tool
17.446 + Name="VCMIDLTool"
17.447 + />
17.448 + <Tool
17.449 + Name="VCCLCompilerTool"
17.450 + AdditionalOptions="/MP /D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.451 + FavorSizeOrSpeed="1"
17.452 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.453 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=3"
17.454 + RuntimeLibrary="0"
17.455 + EnableEnhancedInstructionSet="1"
17.456 + RuntimeTypeInfo="false"
17.457 + UsePrecompiledHeader="0"
17.458 + WarningLevel="3"
17.459 + Detect64BitPortabilityProblems="false"
17.460 + DebugInformationFormat="3"
17.461 + />
17.462 + <Tool
17.463 + Name="VCManagedResourceCompilerTool"
17.464 + />
17.465 + <Tool
17.466 + Name="VCResourceCompilerTool"
17.467 + />
17.468 + <Tool
17.469 + Name="VCPreLinkEventTool"
17.470 + />
17.471 + <Tool
17.472 + Name="VCLinkerTool"
17.473 + AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib""
17.474 + OutputFile="$(OutDir)\sample.ext.dll"
17.475 + LinkIncremental="1"
17.476 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
17.477 + GenerateDebugInformation="true"
17.478 + SubSystem="2"
17.479 + OptimizeReferences="2"
17.480 + EnableCOMDATFolding="2"
17.481 + RandomizedBaseAddress="1"
17.482 + DataExecutionPrevention="0"
17.483 + TargetMachine="1"
17.484 + />
17.485 + <Tool
17.486 + Name="VCALinkTool"
17.487 + />
17.488 + <Tool
17.489 + Name="VCManifestTool"
17.490 + />
17.491 + <Tool
17.492 + Name="VCXDCMakeTool"
17.493 + />
17.494 + <Tool
17.495 + Name="VCBscMakeTool"
17.496 + />
17.497 + <Tool
17.498 + Name="VCFxCopTool"
17.499 + />
17.500 + <Tool
17.501 + Name="VCAppVerifierTool"
17.502 + />
17.503 + <Tool
17.504 + Name="VCPostBuildEventTool"
17.505 + />
17.506 + </Configuration>
17.507 + <Configuration
17.508 + Name="Debug - Left 4 Dead|Win32"
17.509 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.510 + IntermediateDirectory="$(ConfigurationName)"
17.511 + ConfigurationType="2"
17.512 + CharacterSet="2"
17.513 + >
17.514 + <Tool
17.515 + Name="VCPreBuildEventTool"
17.516 + />
17.517 + <Tool
17.518 + Name="VCCustomBuildTool"
17.519 + />
17.520 + <Tool
17.521 + Name="VCXMLDataGeneratorTool"
17.522 + />
17.523 + <Tool
17.524 + Name="VCWebServiceProxyGeneratorTool"
17.525 + />
17.526 + <Tool
17.527 + Name="VCMIDLTool"
17.528 + />
17.529 + <Tool
17.530 + Name="VCCLCompilerTool"
17.531 + AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.532 + Optimization="0"
17.533 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.534 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4"
17.535 + MinimalRebuild="true"
17.536 + BasicRuntimeChecks="3"
17.537 + RuntimeLibrary="1"
17.538 + EnableEnhancedInstructionSet="1"
17.539 + RuntimeTypeInfo="false"
17.540 + UsePrecompiledHeader="0"
17.541 + WarningLevel="3"
17.542 + Detect64BitPortabilityProblems="false"
17.543 + DebugInformationFormat="4"
17.544 + />
17.545 + <Tool
17.546 + Name="VCManagedResourceCompilerTool"
17.547 + />
17.548 + <Tool
17.549 + Name="VCResourceCompilerTool"
17.550 + />
17.551 + <Tool
17.552 + Name="VCPreLinkEventTool"
17.553 + />
17.554 + <Tool
17.555 + Name="VCLinkerTool"
17.556 + AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib""
17.557 + OutputFile="$(OutDir)\sample.ext.dll"
17.558 + LinkIncremental="2"
17.559 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
17.560 + GenerateDebugInformation="true"
17.561 + SubSystem="2"
17.562 + RandomizedBaseAddress="1"
17.563 + DataExecutionPrevention="0"
17.564 + TargetMachine="1"
17.565 + />
17.566 + <Tool
17.567 + Name="VCALinkTool"
17.568 + />
17.569 + <Tool
17.570 + Name="VCManifestTool"
17.571 + />
17.572 + <Tool
17.573 + Name="VCXDCMakeTool"
17.574 + />
17.575 + <Tool
17.576 + Name="VCBscMakeTool"
17.577 + />
17.578 + <Tool
17.579 + Name="VCFxCopTool"
17.580 + />
17.581 + <Tool
17.582 + Name="VCAppVerifierTool"
17.583 + />
17.584 + <Tool
17.585 + Name="VCPostBuildEventTool"
17.586 + />
17.587 + </Configuration>
17.588 + <Configuration
17.589 + Name="Release - Left 4 Dead|Win32"
17.590 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.591 + IntermediateDirectory="$(ConfigurationName)"
17.592 + ConfigurationType="2"
17.593 + CharacterSet="2"
17.594 + WholeProgramOptimization="1"
17.595 + >
17.596 + <Tool
17.597 + Name="VCPreBuildEventTool"
17.598 + />
17.599 + <Tool
17.600 + Name="VCCustomBuildTool"
17.601 + />
17.602 + <Tool
17.603 + Name="VCXMLDataGeneratorTool"
17.604 + />
17.605 + <Tool
17.606 + Name="VCWebServiceProxyGeneratorTool"
17.607 + />
17.608 + <Tool
17.609 + Name="VCMIDLTool"
17.610 + />
17.611 + <Tool
17.612 + Name="VCCLCompilerTool"
17.613 + AdditionalOptions="/MP /D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.614 + FavorSizeOrSpeed="1"
17.615 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.616 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4"
17.617 + RuntimeLibrary="0"
17.618 + EnableEnhancedInstructionSet="1"
17.619 + RuntimeTypeInfo="false"
17.620 + UsePrecompiledHeader="0"
17.621 + WarningLevel="3"
17.622 + Detect64BitPortabilityProblems="false"
17.623 + DebugInformationFormat="3"
17.624 + />
17.625 + <Tool
17.626 + Name="VCManagedResourceCompilerTool"
17.627 + />
17.628 + <Tool
17.629 + Name="VCResourceCompilerTool"
17.630 + />
17.631 + <Tool
17.632 + Name="VCPreLinkEventTool"
17.633 + />
17.634 + <Tool
17.635 + Name="VCLinkerTool"
17.636 + AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib""
17.637 + OutputFile="$(OutDir)\sample.ext.dll"
17.638 + LinkIncremental="1"
17.639 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
17.640 + GenerateDebugInformation="true"
17.641 + SubSystem="2"
17.642 + OptimizeReferences="2"
17.643 + EnableCOMDATFolding="2"
17.644 + RandomizedBaseAddress="1"
17.645 + DataExecutionPrevention="0"
17.646 + TargetMachine="1"
17.647 + />
17.648 + <Tool
17.649 + Name="VCALinkTool"
17.650 + />
17.651 + <Tool
17.652 + Name="VCManifestTool"
17.653 + />
17.654 + <Tool
17.655 + Name="VCXDCMakeTool"
17.656 + />
17.657 + <Tool
17.658 + Name="VCBscMakeTool"
17.659 + />
17.660 + <Tool
17.661 + Name="VCFxCopTool"
17.662 + />
17.663 + <Tool
17.664 + Name="VCAppVerifierTool"
17.665 + />
17.666 + <Tool
17.667 + Name="VCPostBuildEventTool"
17.668 + />
17.669 + </Configuration>
17.670 + <Configuration
17.671 + Name="Debug - Episode 1|Win32"
17.672 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.673 + IntermediateDirectory="$(ConfigurationName)"
17.674 + ConfigurationType="2"
17.675 + CharacterSet="2"
17.676 + >
17.677 + <Tool
17.678 + Name="VCPreBuildEventTool"
17.679 + />
17.680 + <Tool
17.681 + Name="VCCustomBuildTool"
17.682 + />
17.683 + <Tool
17.684 + Name="VCXMLDataGeneratorTool"
17.685 + />
17.686 + <Tool
17.687 + Name="VCWebServiceProxyGeneratorTool"
17.688 + />
17.689 + <Tool
17.690 + Name="VCMIDLTool"
17.691 + />
17.692 + <Tool
17.693 + Name="VCCLCompilerTool"
17.694 + AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.695 + Optimization="0"
17.696 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.697 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
17.698 + MinimalRebuild="true"
17.699 + BasicRuntimeChecks="3"
17.700 + RuntimeLibrary="1"
17.701 + EnableEnhancedInstructionSet="1"
17.702 + RuntimeTypeInfo="false"
17.703 + UsePrecompiledHeader="0"
17.704 + WarningLevel="3"
17.705 + Detect64BitPortabilityProblems="false"
17.706 + DebugInformationFormat="4"
17.707 + />
17.708 + <Tool
17.709 + Name="VCManagedResourceCompilerTool"
17.710 + />
17.711 + <Tool
17.712 + Name="VCResourceCompilerTool"
17.713 + />
17.714 + <Tool
17.715 + Name="VCPreLinkEventTool"
17.716 + />
17.717 + <Tool
17.718 + Name="VCLinkerTool"
17.719 + AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib""
17.720 + OutputFile="$(OutDir)\sample.ext.dll"
17.721 + LinkIncremental="2"
17.722 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
17.723 + GenerateDebugInformation="true"
17.724 + SubSystem="2"
17.725 + RandomizedBaseAddress="1"
17.726 + DataExecutionPrevention="0"
17.727 + TargetMachine="1"
17.728 + />
17.729 + <Tool
17.730 + Name="VCALinkTool"
17.731 + />
17.732 + <Tool
17.733 + Name="VCManifestTool"
17.734 + />
17.735 + <Tool
17.736 + Name="VCXDCMakeTool"
17.737 + />
17.738 + <Tool
17.739 + Name="VCBscMakeTool"
17.740 + />
17.741 + <Tool
17.742 + Name="VCFxCopTool"
17.743 + />
17.744 + <Tool
17.745 + Name="VCAppVerifierTool"
17.746 + />
17.747 + <Tool
17.748 + Name="VCPostBuildEventTool"
17.749 + />
17.750 + </Configuration>
17.751 + <Configuration
17.752 + Name="Release - Episode 1|Win32"
17.753 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
17.754 + IntermediateDirectory="$(ConfigurationName)"
17.755 + ConfigurationType="2"
17.756 + CharacterSet="2"
17.757 + WholeProgramOptimization="1"
17.758 + >
17.759 + <Tool
17.760 + Name="VCPreBuildEventTool"
17.761 + />
17.762 + <Tool
17.763 + Name="VCCustomBuildTool"
17.764 + />
17.765 + <Tool
17.766 + Name="VCXMLDataGeneratorTool"
17.767 + />
17.768 + <Tool
17.769 + Name="VCWebServiceProxyGeneratorTool"
17.770 + />
17.771 + <Tool
17.772 + Name="VCMIDLTool"
17.773 + />
17.774 + <Tool
17.775 + Name="VCCLCompilerTool"
17.776 + AdditionalOptions="/MP /D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
17.777 + FavorSizeOrSpeed="1"
17.778 + AdditionalIncludeDirectories="..;..\sdk;..\..;..\..\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
17.779 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
17.780 + RuntimeLibrary="0"
17.781 + EnableEnhancedInstructionSet="1"
17.782 + RuntimeTypeInfo="false"
17.783 + UsePrecompiledHeader="0"
17.784 + WarningLevel="3"
17.785 + Detect64BitPortabilityProblems="false"
17.786 + DebugInformationFormat="3"
17.787 + />
17.788 + <Tool
17.789 + Name="VCManagedResourceCompilerTool"
17.790 + />
17.791 + <Tool
17.792 + Name="VCResourceCompilerTool"
17.793 + />
17.794 + <Tool
17.795 + Name="VCPreLinkEventTool"
17.796 + />
17.797 + <Tool
17.798 + Name="VCLinkerTool"
17.799 + AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib""
17.800 + OutputFile="$(OutDir)\sample.ext.dll"
17.801 + LinkIncremental="1"
17.802 + IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
17.803 + GenerateDebugInformation="true"
17.804 + SubSystem="2"
17.805 + OptimizeReferences="2"
17.806 + EnableCOMDATFolding="2"
17.807 + RandomizedBaseAddress="1"
17.808 + DataExecutionPrevention="0"
17.809 + TargetMachine="1"
17.810 + />
17.811 + <Tool
17.812 + Name="VCALinkTool"
17.813 + />
17.814 + <Tool
17.815 + Name="VCManifestTool"
17.816 + />
17.817 + <Tool
17.818 + Name="VCXDCMakeTool"
17.819 + />
17.820 + <Tool
17.821 + Name="VCBscMakeTool"
17.822 + />
17.823 + <Tool
17.824 + Name="VCFxCopTool"
17.825 + />
17.826 + <Tool
17.827 + Name="VCAppVerifierTool"
17.828 + />
17.829 + <Tool
17.830 + Name="VCPostBuildEventTool"
17.831 + />
17.832 + </Configuration>
17.833 + </Configurations>
17.834 + <References>
17.835 + </References>
17.836 + <Files>
17.837 + <Filter
17.838 + Name="Source Files"
17.839 + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
17.840 + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
17.841 + >
17.842 + <File
17.843 + RelativePath="..\extension.cpp"
17.844 + >
17.845 + </File>
17.846 + <File
17.847 + RelativePath="..\md5.cpp"
17.848 + >
17.849 + </File>
17.850 + <File
17.851 + RelativePath="..\MemoryDownloader.cpp"
17.852 + >
17.853 + </File>
17.854 + <File
17.855 + RelativePath="..\Updater.cpp"
17.856 + >
17.857 + </File>
17.858 + </Filter>
17.859 + <Filter
17.860 + Name="Header Files"
17.861 + Filter="h;hpp;hxx;hm;inl;inc;xsd"
17.862 + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
17.863 + >
17.864 + <File
17.865 + RelativePath="..\extension.h"
17.866 + >
17.867 + </File>
17.868 + <File
17.869 + RelativePath="..\md5.h"
17.870 + >
17.871 + </File>
17.872 + <File
17.873 + RelativePath="..\MemoryDownloader.h"
17.874 + >
17.875 + </File>
17.876 + <File
17.877 + RelativePath="..\svn_version.h"
17.878 + >
17.879 + </File>
17.880 + <File
17.881 + RelativePath="..\Updater.h"
17.882 + >
17.883 + </File>
17.884 + </Filter>
17.885 + <Filter
17.886 + Name="Resource Files"
17.887 + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
17.888 + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
17.889 + >
17.890 + <File
17.891 + RelativePath="..\svn_version.tpl"
17.892 + >
17.893 + </File>
17.894 + <File
17.895 + RelativePath="..\version.rc"
17.896 + >
17.897 + </File>
17.898 + </Filter>
17.899 + <Filter
17.900 + Name="SourceMod SDK"
17.901 + UniqueIdentifier="{31958233-BB2D-4e41-A8F9-CE8A4684F436}"
17.902 + >
17.903 + <File
17.904 + RelativePath="..\sdk\smsdk_config.h"
17.905 + >
17.906 + </File>
17.907 + <File
17.908 + RelativePath="..\sdk\smsdk_ext.cpp"
17.909 + >
17.910 + </File>
17.911 + <File
17.912 + RelativePath="..\sdk\smsdk_ext.h"
17.913 + >
17.914 + </File>
17.915 + </Filter>
17.916 + </Files>
17.917 + <Globals>
17.918 + </Globals>
17.919 +</VisualStudioProject>
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/extensions/updater/sdk/smsdk_config.h Mon Feb 02 15:41:25 2009 -0500
18.3 @@ -0,0 +1,83 @@
18.4 +/**
18.5 + * vim: set ts=4 :
18.6 + * =============================================================================
18.7 + * SourceMod Sample Extension
18.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
18.9 + * =============================================================================
18.10 + *
18.11 + * This program is free software; you can redistribute it and/or modify it under
18.12 + * the terms of the GNU General Public License, version 3.0, as published by the
18.13 + * Free Software Foundation.
18.14 + *
18.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
18.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18.18 + * details.
18.19 + *
18.20 + * You should have received a copy of the GNU General Public License along with
18.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
18.22 + *
18.23 + * As a special exception, AlliedModders LLC gives you permission to link the
18.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
18.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
18.26 + * by the Valve Corporation. You must obey the GNU General Public License in
18.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
18.28 + * this exception to all derivative works. AlliedModders LLC defines further
18.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
18.30 + * or <http://www.sourcemod.net/license.php>.
18.31 + *
18.32 + * Version: $Id$
18.33 + */
18.34 +
18.35 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
18.36 +#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
18.37 +#include "svn_version.h"
18.38 +
18.39 +/**
18.40 + * @file smsdk_config.h
18.41 + * @brief Contains macros for configuring basic extension information.
18.42 + */
18.43 +
18.44 +/* Basic information exposed publicly */
18.45 +#define SMEXT_CONF_NAME "Automatic Updater"
18.46 +#define SMEXT_CONF_DESCRIPTION "Updates SourceMod gamedata files"
18.47 +#define SMEXT_CONF_VERSION SVN_FULL_VERSION
18.48 +#define SMEXT_CONF_AUTHOR "AlliedModders LLC"
18.49 +#define SMEXT_CONF_URL "http://www.sourcemod.net/"
18.50 +#define SMEXT_CONF_LOGTAG "UPDATER"
18.51 +#define SMEXT_CONF_LICENSE "GPL"
18.52 +#define SMEXT_CONF_DATESTRING __DATE__
18.53 +
18.54 +/**
18.55 + * @brief Exposes plugin's main interface.
18.56 + */
18.57 +#define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name;
18.58 +
18.59 +/**
18.60 + * @brief Sets whether or not this plugin required Metamod.
18.61 + * NOTE: Uncomment to enable, comment to disable.
18.62 + */
18.63 +//#define SMEXT_CONF_METAMOD
18.64 +
18.65 +/** Enable interfaces you want to use here by uncommenting lines */
18.66 +//#define SMEXT_ENABLE_FORWARDSYS
18.67 +//#define SMEXT_ENABLE_HANDLESYS
18.68 +//#define SMEXT_ENABLE_PLAYERHELPERS
18.69 +//#define SMEXT_ENABLE_DBMANAGER
18.70 +#define SMEXT_ENABLE_GAMECONF
18.71 +//#define SMEXT_ENABLE_MEMUTILS
18.72 +//#define SMEXT_ENABLE_GAMEHELPERS
18.73 +//#define SMEXT_ENABLE_TIMERSYS
18.74 +#define SMEXT_ENABLE_THREADER
18.75 +#define SMEXT_ENABLE_LIBSYS
18.76 +//#define SMEXT_ENABLE_MENUS
18.77 +//#define SMEXT_ENABLE_ADTFACTORY
18.78 +//#define SMEXT_ENABLE_PLUGINSYS
18.79 +//#define SMEXT_ENABLE_ADMINSYS
18.80 +#define SMEXT_ENABLE_TEXTPARSERS
18.81 +//#define SMEXT_ENABLE_USERMSGS
18.82 +//#define SMEXT_ENABLE_TRANSLATOR
18.83 +//#define SMEXT_ENABLE_NINVOKE
18.84 +
18.85 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
18.86 +
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/extensions/updater/sdk/smsdk_ext.cpp Mon Feb 02 15:41:25 2009 -0500
19.3 @@ -0,0 +1,465 @@
19.4 +/**
19.5 + * vim: set ts=4 :
19.6 + * =============================================================================
19.7 + * SourceMod Base Extension Code
19.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
19.9 + * =============================================================================
19.10 + *
19.11 + * This program is free software; you can redistribute it and/or modify it under
19.12 + * the terms of the GNU General Public License, version 3.0, as published by the
19.13 + * Free Software Foundation.
19.14 + *
19.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
19.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19.18 + * details.
19.19 + *
19.20 + * You should have received a copy of the GNU General Public License along with
19.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
19.22 + *
19.23 + * As a special exception, AlliedModders LLC gives you permission to link the
19.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
19.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
19.26 + * by the Valve Corporation. You must obey the GNU General Public License in
19.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
19.28 + * this exception to all derivative works. AlliedModders LLC defines further
19.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
19.30 + * or <http://www.sourcemod.net/license.php>.
19.31 + *
19.32 + * Version: $Id$
19.33 + */
19.34 +
19.35 +#include <stdio.h>
19.36 +#include <stdlib.h>
19.37 +#include "smsdk_ext.h"
19.38 +
19.39 +/**
19.40 + * @file smsdk_ext.cpp
19.41 + * @brief Contains wrappers for making Extensions easier to write.
19.42 + */
19.43 +
19.44 +IExtension *myself = NULL; /**< Ourself */
19.45 +IShareSys *g_pShareSys = NULL; /**< Share system */
19.46 +IShareSys *sharesys = NULL; /**< Share system */
19.47 +ISourceMod *g_pSM = NULL; /**< SourceMod helpers */
19.48 +ISourceMod *smutils = NULL; /**< SourceMod helpers */
19.49 +
19.50 +#if defined SMEXT_ENABLE_FORWARDSYS
19.51 +IForwardManager *g_pForwards = NULL; /**< Forward system */
19.52 +IForwardManager *forwards = NULL; /**< Forward system */
19.53 +#endif
19.54 +#if defined SMEXT_ENABLE_HANDLESYS
19.55 +IHandleSys *g_pHandleSys = NULL; /**< Handle system */
19.56 +IHandleSys *handlesys = NULL; /**< Handle system */
19.57 +#endif
19.58 +#if defined SMEXT_ENABLE_PLAYERHELPERS
19.59 +IPlayerManager *playerhelpers = NULL; /**< Player helpers */
19.60 +#endif //SMEXT_ENABLE_PLAYERHELPERS
19.61 +#if defined SMEXT_ENABLE_DBMANAGER
19.62 +IDBManager *dbi = NULL; /**< DB Manager */
19.63 +#endif //SMEXT_ENABLE_DBMANAGER
19.64 +#if defined SMEXT_ENABLE_GAMECONF
19.65 +IGameConfigManager *gameconfs = NULL; /**< Game config manager */
19.66 +#endif //SMEXT_ENABLE_DBMANAGER
19.67 +#if defined SMEXT_ENABLE_MEMUTILS
19.68 +IMemoryUtils *memutils = NULL;
19.69 +#endif //SMEXT_ENABLE_DBMANAGER
19.70 +#if defined SMEXT_ENABLE_GAMEHELPERS
19.71 +IGameHelpers *gamehelpers = NULL;
19.72 +#endif
19.73 +#if defined SMEXT_ENABLE_TIMERSYS
19.74 +ITimerSystem *timersys = NULL;
19.75 +#endif
19.76 +#if defined SMEXT_ENABLE_ADTFACTORY
19.77 +IADTFactory *adtfactory = NULL;
19.78 +#endif
19.79 +#if defined SMEXT_ENABLE_THREADER
19.80 +IThreader *threader = NULL;
19.81 +#endif
19.82 +#if defined SMEXT_ENABLE_LIBSYS
19.83 +ILibrarySys *libsys = NULL;
19.84 +#endif
19.85 +#if defined SMEXT_ENABLE_PLUGINSYS
19.86 +SourceMod::IPluginManager *plsys;
19.87 +#endif
19.88 +#if defined SMEXT_ENABLE_MENUS
19.89 +IMenuManager *menus = NULL;
19.90 +#endif
19.91 +#if defined SMEXT_ENABLE_ADMINSYS
19.92 +IAdminSystem *adminsys = NULL;
19.93 +#endif
19.94 +#if defined SMEXT_ENABLE_TEXTPARSERS
19.95 +ITextParsers *textparsers = NULL;
19.96 +#endif
19.97 +#if defined SMEXT_ENABLE_USERMSGS
19.98 +IUserMessages *usermsgs = NULL;
19.99 +#endif
19.100 +#if defined SMEXT_ENABLE_TRANSLATOR
19.101 +ITranslator *translator = NULL;
19.102 +#endif
19.103 +#if defined SMEXT_ENABLE_NINVOKE
19.104 +INativeInterface *ninvoke = NULL;
19.105 +#endif
19.106 +
19.107 +/** Exports the main interface */
19.108 +PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
19.109 +{
19.110 + return g_pExtensionIface;
19.111 +}
19.112 +
19.113 +SDKExtension::SDKExtension()
19.114 +{
19.115 +#if defined SMEXT_CONF_METAMOD
19.116 + m_SourceMMLoaded = false;
19.117 + m_WeAreUnloaded = false;
19.118 + m_WeGotPauseChange = false;
19.119 +#endif
19.120 +}
19.121 +
19.122 +bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late)
19.123 +{
19.124 + g_pShareSys = sharesys = sys;
19.125 + myself = me;
19.126 +
19.127 +#if defined SMEXT_CONF_METAMOD
19.128 + m_WeAreUnloaded = true;
19.129 +
19.130 + if (!m_SourceMMLoaded)
19.131 + {
19.132 + if (error)
19.133 + {
19.134 + snprintf(error, maxlength, "Metamod attach failed");
19.135 + }
19.136 + return false;
19.137 + }
19.138 +#endif
19.139 + SM_GET_IFACE(SOURCEMOD, g_pSM);
19.140 + smutils = g_pSM;
19.141 +#if defined SMEXT_ENABLE_HANDLESYS
19.142 + SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys);
19.143 + handlesys = g_pHandleSys;
19.144 +#endif
19.145 +#if defined SMEXT_ENABLE_FORWARDSYS
19.146 + SM_GET_IFACE(FORWARDMANAGER, g_pForwards);
19.147 + forwards = g_pForwards;
19.148 +#endif
19.149 +#if defined SMEXT_ENABLE_PLAYERHELPERS
19.150 + SM_GET_IFACE(PLAYERMANAGER, playerhelpers);
19.151 +#endif
19.152 +#if defined SMEXT_ENABLE_DBMANAGER
19.153 + SM_GET_IFACE(DBI, dbi);
19.154 +#endif
19.155 +#if defined SMEXT_ENABLE_GAMECONF
19.156 + SM_GET_IFACE(GAMECONFIG, gameconfs);
19.157 +#endif
19.158 +#if defined SMEXT_ENABLE_MEMUTILS
19.159 + SM_GET_IFACE(MEMORYUTILS, memutils);
19.160 +#endif
19.161 +#if defined SMEXT_ENABLE_GAMEHELPERS
19.162 + SM_GET_IFACE(GAMEHELPERS, gamehelpers);
19.163 +#endif
19.164 +#if defined SMEXT_ENABLE_TIMERSYS
19.165 + SM_GET_IFACE(TIMERSYS, timersys);
19.166 +#endif
19.167 +#if defined SMEXT_ENABLE_ADTFACTORY
19.168 + SM_GET_IFACE(ADTFACTORY, adtfactory);
19.169 +#endif
19.170 +#if defined SMEXT_ENABLE_THREADER
19.171 + SM_GET_IFACE(THREADER, threader);
19.172 +#endif
19.173 +#if defined SMEXT_ENABLE_LIBSYS
19.174 + SM_GET_IFACE(LIBRARYSYS, libsys);
19.175 +#endif
19.176 +#if defined SMEXT_ENABLE_PLUGINSYS
19.177 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
19.178 +#endif
19.179 +#if defined SMEXT_ENABLE_MENUS
19.180 + SM_GET_IFACE(MENUMANAGER, menus);
19.181 +#endif
19.182 +#if defined SMEXT_ENABLE_ADMINSYS
19.183 + SM_GET_IFACE(ADMINSYS, adminsys);
19.184 +#endif
19.185 +#if defined SMEXT_ENABLE_TEXTPARSERS
19.186 + SM_GET_IFACE(TEXTPARSERS, textparsers);
19.187 +#endif
19.188 +#if defined SMEXT_ENABLE_USERMSGS
19.189 + SM_GET_IFACE(USERMSGS, usermsgs);
19.190 +#endif
19.191 +#if defined SMEXT_ENABLE_TRANSLATOR
19.192 + SM_GET_IFACE(TRANSLATOR, translator);
19.193 +#endif
19.194 +
19.195 + if (SDK_OnLoad(error, maxlength, late))
19.196 + {
19.197 +#if defined SMEXT_CONF_METAMOD
19.198 + m_WeAreUnloaded = true;
19.199 +#endif
19.200 + return true;
19.201 + }
19.202 +
19.203 + return false;
19.204 +}
19.205 +
19.206 +bool SDKExtension::IsMetamodExtension()
19.207 +{
19.208 +#if defined SMEXT_CONF_METAMOD
19.209 + return true;
19.210 +#else
19.211 + return false;
19.212 +#endif
19.213 +}
19.214 +
19.215 +void SDKExtension::OnExtensionPauseChange(bool state)
19.216 +{
19.217 +#if defined SMEXT_CONF_METAMOD
19.218 + m_WeGotPauseChange = true;
19.219 +#endif
19.220 + SDK_OnPauseChange(state);
19.221 +}
19.222 +
19.223 +void SDKExtension::OnExtensionsAllLoaded()
19.224 +{
19.225 + SDK_OnAllLoaded();
19.226 +}
19.227 +
19.228 +void SDKExtension::OnExtensionUnload()
19.229 +{
19.230 +#if defined SMEXT_CONF_METAMOD
19.231 + m_WeAreUnloaded = true;
19.232 +#endif
19.233 + SDK_OnUnload();
19.234 +}
19.235 +
19.236 +const char *SDKExtension::GetExtensionAuthor()
19.237 +{
19.238 + return SMEXT_CONF_AUTHOR;
19.239 +}
19.240 +
19.241 +const char *SDKExtension::GetExtensionDateString()
19.242 +{
19.243 + return SMEXT_CONF_DATESTRING;
19.244 +}
19.245 +
19.246 +const char *SDKExtension::GetExtensionDescription()
19.247 +{
19.248 + return SMEXT_CONF_DESCRIPTION;
19.249 +}
19.250 +
19.251 +const char *SDKExtension::GetExtensionVerString()
19.252 +{
19.253 + return SMEXT_CONF_VERSION;
19.254 +}
19.255 +
19.256 +const char *SDKExtension::GetExtensionName()
19.257 +{
19.258 + return SMEXT_CONF_NAME;
19.259 +}
19.260 +
19.261 +const char *SDKExtension::GetExtensionTag()
19.262 +{
19.263 + return SMEXT_CONF_LOGTAG;
19.264 +}
19.265 +
19.266 +const char *SDKExtension::GetExtensionURL()
19.267 +{
19.268 + return SMEXT_CONF_URL;
19.269 +}
19.270 +
19.271 +bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late)
19.272 +{
19.273 + return true;
19.274 +}
19.275 +
19.276 +void SDKExtension::SDK_OnUnload()
19.277 +{
19.278 +}
19.279 +
19.280 +void SDKExtension::SDK_OnPauseChange(bool paused)
19.281 +{
19.282 +}
19.283 +
19.284 +void SDKExtension::SDK_OnAllLoaded()
19.285 +{
19.286 +}
19.287 +
19.288 +#if defined SMEXT_CONF_METAMOD
19.289 +
19.290 +PluginId g_PLID = 0; /**< Metamod plugin ID */
19.291 +ISmmPlugin *g_PLAPI = NULL; /**< Metamod plugin API */
19.292 +SourceHook::ISourceHook *g_SHPtr = NULL; /**< SourceHook pointer */
19.293 +ISmmAPI *g_SMAPI = NULL; /**< SourceMM API pointer */
19.294 +
19.295 +IVEngineServer *engine = NULL; /**< IVEngineServer pointer */
19.296 +IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
19.297 +
19.298 +/** Exposes the extension to Metamod */
19.299 +SMM_API void *PL_EXPOSURE(const char *name, int *code)
19.300 +{
19.301 +#if defined METAMOD_PLAPI_VERSION
19.302 + if (name && !strcmp(name, METAMOD_PLAPI_NAME))
19.303 +#else
19.304 + if (name && !strcmp(name, PLAPI_NAME))
19.305 +#endif
19.306 + {
19.307 + if (code)
19.308 + {
19.309 + *code = IFACE_OK;
19.310 + }
19.311 + return static_cast<void *>(g_pExtensionIface);
19.312 + }
19.313 +
19.314 + if (code)
19.315 + {
19.316 + *code = IFACE_FAILED;
19.317 + }
19.318 +
19.319 + return NULL;
19.320 +}
19.321 +
19.322 +bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
19.323 +{
19.324 + PLUGIN_SAVEVARS();
19.325 +
19.326 +#if !defined METAMOD_PLAPI_VERSION
19.327 + GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
19.328 + GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
19.329 +#else
19.330 + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
19.331 + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
19.332 +#endif
19.333 +
19.334 + m_SourceMMLoaded = true;
19.335 +
19.336 + return SDK_OnMetamodLoad(ismm, error, maxlen, late);
19.337 +}
19.338 +
19.339 +bool SDKExtension::Unload(char *error, size_t maxlen)
19.340 +{
19.341 + if (!m_WeAreUnloaded)
19.342 + {
19.343 + if (error)
19.344 + {
19.345 + snprintf(error, maxlen, "This extension must be unloaded by SourceMod.");
19.346 + }
19.347 + return false;
19.348 + }
19.349 +
19.350 + return SDK_OnMetamodUnload(error, maxlen);
19.351 +}
19.352 +
19.353 +bool SDKExtension::Pause(char *error, size_t maxlen)
19.354 +{
19.355 + if (!m_WeGotPauseChange)
19.356 + {
19.357 + if (error)
19.358 + {
19.359 + snprintf(error, maxlen, "This extension must be paused by SourceMod.");
19.360 + }
19.361 + return false;
19.362 + }
19.363 +
19.364 + m_WeGotPauseChange = false;
19.365 +
19.366 + return SDK_OnMetamodPauseChange(true, error, maxlen);
19.367 +}
19.368 +
19.369 +bool SDKExtension::Unpause(char *error, size_t maxlen)
19.370 +{
19.371 + if (!m_WeGotPauseChange)
19.372 + {
19.373 + if (error)
19.374 + {
19.375 + snprintf(error, maxlen, "This extension must be unpaused by SourceMod.");
19.376 + }
19.377 + return false;
19.378 + }
19.379 +
19.380 + m_WeGotPauseChange = false;
19.381 +
19.382 + return SDK_OnMetamodPauseChange(false, error, maxlen);
19.383 +}
19.384 +
19.385 +const char *SDKExtension::GetAuthor()
19.386 +{
19.387 + return GetExtensionAuthor();
19.388 +}
19.389 +
19.390 +const char *SDKExtension::GetDate()
19.391 +{
19.392 + return GetExtensionDateString();
19.393 +}
19.394 +
19.395 +const char *SDKExtension::GetDescription()
19.396 +{
19.397 + return GetExtensionDescription();
19.398 +}
19.399 +
19.400 +const char *SDKExtension::GetLicense()
19.401 +{
19.402 + return SMEXT_CONF_LICENSE;
19.403 +}
19.404 +
19.405 +const char *SDKExtension::GetLogTag()
19.406 +{
19.407 + return GetExtensionTag();
19.408 +}
19.409 +
19.410 +const char *SDKExtension::GetName()
19.411 +{
19.412 + return GetExtensionName();
19.413 +}
19.414 +
19.415 +const char *SDKExtension::GetURL()
19.416 +{
19.417 + return GetExtensionURL();
19.418 +}
19.419 +
19.420 +const char *SDKExtension::GetVersion()
19.421 +{
19.422 + return GetExtensionVerString();
19.423 +}
19.424 +
19.425 +bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late)
19.426 +{
19.427 + return true;
19.428 +}
19.429 +
19.430 +bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength)
19.431 +{
19.432 + return true;
19.433 +}
19.434 +
19.435 +bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength)
19.436 +{
19.437 + return true;
19.438 +}
19.439 +
19.440 +#endif
19.441 +
19.442 +/* Overload a few things to prevent libstdc++ linking */
19.443 +#if defined __linux__ || defined __APPLE__
19.444 +extern "C" void __cxa_pure_virtual(void)
19.445 +{
19.446 +}
19.447 +
19.448 +void *operator new(size_t size)
19.449 +{
19.450 + return malloc(size);
19.451 +}
19.452 +
19.453 +void *operator new[](size_t size)
19.454 +{
19.455 + return malloc(size);
19.456 +}
19.457 +
19.458 +void operator delete(void *ptr)
19.459 +{
19.460 + free(ptr);
19.461 +}
19.462 +
19.463 +void operator delete[](void * ptr)
19.464 +{
19.465 + free(ptr);
19.466 +}
19.467 +#endif
19.468 +
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/extensions/updater/sdk/smsdk_ext.h Mon Feb 02 15:41:25 2009 -0500
20.3 @@ -0,0 +1,339 @@
20.4 +/**
20.5 + * vim: set ts=4 :
20.6 + * =============================================================================
20.7 + * SourceMod Base Extension Code
20.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
20.9 + * =============================================================================
20.10 + *
20.11 + * This program is free software; you can redistribute it and/or modify it under
20.12 + * the terms of the GNU General Public License, version 3.0, as published by the
20.13 + * Free Software Foundation.
20.14 + *
20.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
20.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20.18 + * details.
20.19 + *
20.20 + * You should have received a copy of the GNU General Public License along with
20.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
20.22 + *
20.23 + * As a special exception, AlliedModders LLC gives you permission to link the
20.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
20.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
20.26 + * by the Valve Corporation. You must obey the GNU General Public License in
20.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
20.28 + * this exception to all derivative works. AlliedModders LLC defines further
20.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
20.30 + * or <http://www.sourcemod.net/license.php>.
20.31 + *
20.32 + * Version: $Id$
20.33 + */
20.34 +
20.35 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
20.36 +#define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
20.37 +
20.38 +/**
20.39 + * @file smsdk_ext.h
20.40 + * @brief Contains wrappers for making Extensions easier to write.
20.41 + */
20.42 +
20.43 +#include "smsdk_config.h"
20.44 +#include <IExtensionSys.h>
20.45 +#include <IHandleSys.h>
20.46 +#include <sp_vm_api.h>
20.47 +#include <sm_platform.h>
20.48 +#include <ISourceMod.h>
20.49 +#if defined SMEXT_ENABLE_FORWARDSYS
20.50 +#include <IForwardSys.h>
20.51 +#endif //SMEXT_ENABLE_FORWARDSYS
20.52 +#if defined SMEXT_ENABLE_PLAYERHELPERS
20.53 +#include <IPlayerHelpers.h>
20.54 +#endif //SMEXT_ENABLE_PlAYERHELPERS
20.55 +#if defined SMEXT_ENABLE_DBMANAGER
20.56 +#include <IDBDriver.h>
20.57 +#endif //SMEXT_ENABLE_DBMANAGER
20.58 +#if defined SMEXT_ENABLE_GAMECONF
20.59 +#include <IGameConfigs.h>
20.60 +#endif
20.61 +#if defined SMEXT_ENABLE_MEMUTILS
20.62 +#include <IMemoryUtils.h>
20.63 +#endif
20.64 +#if defined SMEXT_ENABLE_GAMEHELPERS
20.65 +#include <IGameHelpers.h>
20.66 +#endif
20.67 +#if defined SMEXT_ENABLE_TIMERSYS
20.68 +#include <ITimerSystem.h>
20.69 +#endif
20.70 +#if defined SMEXT_ENABLE_ADTFACTORY
20.71 +#include <IADTFactory.h>
20.72 +#endif
20.73 +#if defined SMEXT_ENABLE_THREADER
20.74 +#include <IThreader.h>
20.75 +#endif
20.76 +#if defined SMEXT_ENABLE_LIBSYS
20.77 +#include <ILibrarySys.h>
20.78 +#endif
20.79 +#if defined SMEXT_ENABLE_PLUGINSYS
20.80 +#include <IPluginSys.h>
20.81 +#endif
20.82 +#if defined SMEXT_ENABLE_MENUS
20.83 +#include <IMenuManager.h>
20.84 +#endif
20.85 +#if defined SMEXT_ENABLE_ADMINSYS
20.86 +#include <IAdminSystem.h>
20.87 +#endif
20.88 +#if defined SMEXT_ENABLE_TEXTPARSERS
20.89 +#include <ITextParsers.h>
20.90 +#endif
20.91 +#if defined SMEXT_ENABLE_USERMSGS
20.92 +#include <IUserMessages.h>
20.93 +#endif
20.94 +#if defined SMEXT_ENABLE_TRANSLATOR
20.95 +#include <ITranslator.h>
20.96 +#endif
20.97 +#if defined SMEXT_ENABLE_NINVOKE
20.98 +#include <INativeInvoker.h>
20.99 +#endif
20.100 +
20.101 +#if defined SMEXT_CONF_METAMOD
20.102 +#include <ISmmPlugin.h>
20.103 +#include <eiface.h>
20.104 +#endif
20.105 +
20.106 +using namespace SourceMod;
20.107 +using namespace SourcePawn;
20.108 +
20.109 +class SDKExtension :
20.110 +#if defined SMEXT_CONF_METAMOD
20.111 + public ISmmPlugin,
20.112 +#endif
20.113 + public IExtensionInterface
20.114 +{
20.115 +public:
20.116 + /** Constructor */
20.117 + SDKExtension();
20.118 +public:
20.119 + /**
20.120 + * @brief This is called after the initial loading sequence has been processed.
20.121 + *
20.122 + * @param error Error message buffer.
20.123 + * @param maxlength Size of error message buffer.
20.124 + * @param late Whether or not the module was loaded after map load.
20.125 + * @return True to succeed loading, false to fail.
20.126 + */
20.127 + virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
20.128 +
20.129 + /**
20.130 + * @brief This is called right before the extension is unloaded.
20.131 + */
20.132 + virtual void SDK_OnUnload();
20.133 +
20.134 + /**
20.135 + * @brief This is called once all known extensions have been loaded.
20.136 + */
20.137 + virtual void SDK_OnAllLoaded();
20.138 +
20.139 + /**
20.140 + * @brief Called when the pause state is changed.
20.141 + */
20.142 + virtual void SDK_OnPauseChange(bool paused);
20.143 +
20.144 +#if defined SMEXT_CONF_METAMOD
20.145 + /**
20.146 + * @brief Called when Metamod is attached, before the extension version is called.
20.147 + *
20.148 + * @param error Error buffer.
20.149 + * @param maxlength Maximum size of error buffer.
20.150 + * @param late Whether or not Metamod considers this a late load.
20.151 + * @return True to succeed, false to fail.
20.152 + */
20.153 + virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
20.154 +
20.155 + /**
20.156 + * @brief Called when Metamod is detaching, after the extension version is called.
20.157 + * NOTE: By default this is blocked unless sent from SourceMod.
20.158 + *
20.159 + * @param error Error buffer.
20.160 + * @param maxlength Maximum size of error buffer.
20.161 + * @return True to succeed, false to fail.
20.162 + */
20.163 + virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
20.164 +
20.165 + /**
20.166 + * @brief Called when Metamod's pause state is changing.
20.167 + * NOTE: By default this is blocked unless sent from SourceMod.
20.168 + *
20.169 + * @param paused Pause state being set.
20.170 + * @param error Error buffer.
20.171 + * @param maxlength Maximum size of error buffer.
20.172 + * @return True to succeed, false to fail.
20.173 + */
20.174 + virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
20.175 +#endif
20.176 +
20.177 +public: //IExtensionInterface
20.178 + virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late);
20.179 + virtual void OnExtensionUnload();
20.180 + virtual void OnExtensionsAllLoaded();
20.181 +
20.182 + /** Returns whether or not this is a Metamod-based extension */
20.183 + virtual bool IsMetamodExtension();
20.184 +
20.185 + /**
20.186 + * @brief Called when the pause state changes.
20.187 + *
20.188 + * @param state True if being paused, false if being unpaused.
20.189 + */
20.190 + virtual void OnExtensionPauseChange(bool state);
20.191 +
20.192 + /** Returns name */
20.193 + virtual const char *GetExtensionName();
20.194 + /** Returns URL */
20.195 + virtual const char *GetExtensionURL();
20.196 + /** Returns log tag */
20.197 + virtual const char *GetExtensionTag();
20.198 + /** Returns author */
20.199 + virtual const char *GetExtensionAuthor();
20.200 + /** Returns version string */
20.201 + virtual const char *GetExtensionVerString();
20.202 + /** Returns description string */
20.203 + virtual const char *GetExtensionDescription();
20.204 + /** Returns date string */
20.205 + virtual const char *GetExtensionDateString();
20.206 +#if defined SMEXT_CONF_METAMOD
20.207 +public: //ISmmPlugin
20.208 + /** Called when the extension is attached to Metamod. */
20.209 + virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late);
20.210 + /** Returns the author to MM */
20.211 + virtual const char *GetAuthor();
20.212 + /** Returns the name to MM */
20.213 + virtual const char *GetName();
20.214 + /** Returns the description to MM */
20.215 + virtual const char *GetDescription();
20.216 + /** Returns the URL to MM */
20.217 + virtual const char *GetURL();
20.218 + /** Returns the license to MM */
20.219 + virtual const char *GetLicense();
20.220 + /** Returns the version string to MM */
20.221 + virtual const char *GetVersion();
20.222 + /** Returns the date string to MM */
20.223 + virtual const char *GetDate();
20.224 + /** Returns the logtag to MM */
20.225 + virtual const char *GetLogTag();
20.226 + /** Called on unload */
20.227 + virtual bool Unload(char *error, size_t maxlength);
20.228 + /** Called on pause */
20.229 + virtual bool Pause(char *error, size_t maxlength);
20.230 + /** Called on unpause */
20.231 + virtual bool Unpause(char *error, size_t maxlength);
20.232 +private:
20.233 + bool m_SourceMMLoaded;
20.234 + bool m_WeAreUnloaded;
20.235 + bool m_WeGotPauseChange;
20.236 +#endif
20.237 +};
20.238 +
20.239 +extern SDKExtension *g_pExtensionIface;
20.240 +extern IExtension *myself;
20.241 +
20.242 +extern IShareSys *g_pShareSys;
20.243 +extern IShareSys *sharesys; /* Note: Newer name */
20.244 +extern ISourceMod *g_pSM;
20.245 +extern ISourceMod *smutils; /* Note: Newer name */
20.246 +
20.247 +/* Optional interfaces are below */
20.248 +#if defined SMEXT_ENABLE_FORWARDSYS
20.249 +extern IForwardManager *g_pForwards;
20.250 +extern IForwardManager *forwards; /* Note: Newer name */
20.251 +#endif //SMEXT_ENABLE_FORWARDSYS
20.252 +#if defined SMEXT_ENABLE_HANDLESYS
20.253 +extern IHandleSys *g_pHandleSys;
20.254 +extern IHandleSys *handlesys; /* Note: Newer name */
20.255 +#endif //SMEXT_ENABLE_HANDLESYS
20.256 +#if defined SMEXT_ENABLE_PLAYERHELPERS
20.257 +extern IPlayerManager *playerhelpers;
20.258 +#endif //SMEXT_ENABLE_PLAYERHELPERS
20.259 +#if defined SMEXT_ENABLE_DBMANAGER
20.260 +extern IDBManager *dbi;
20.261 +#endif //SMEXT_ENABLE_DBMANAGER
20.262 +#if defined SMEXT_ENABLE_GAMECONF
20.263 +extern IGameConfigManager *gameconfs;
20.264 +#endif //SMEXT_ENABLE_DBMANAGER
20.265 +#if defined SMEXT_ENABLE_MEMUTILS
20.266 +extern IMemoryUtils *memutils;
20.267 +#endif
20.268 +#if defined SMEXT_ENABLE_GAMEHELPERS
20.269 +extern IGameHelpers *gamehelpers;
20.270 +#endif
20.271 +#if defined SMEXT_ENABLE_TIMERSYS
20.272 +extern ITimerSystem *timersys;
20.273 +#endif
20.274 +#if defined SMEXT_ENABLE_ADTFACTORY
20.275 +extern IADTFactory *adtfactory;
20.276 +#endif
20.277 +#if defined SMEXT_ENABLE_THREADER
20.278 +extern IThreader *threader;
20.279 +#endif
20.280 +#if defined SMEXT_ENABLE_LIBSYS
20.281 +extern ILibrarySys *libsys;
20.282 +#endif
20.283 +#if defined SMEXT_ENABLE_PLUGINSYS
20.284 +extern SourceMod::IPluginManager *plsys;
20.285 +#endif
20.286 +#if defined SMEXT_ENABLE_MENUS
20.287 +extern IMenuManager *menus;
20.288 +#endif
20.289 +#if defined SMEXT_ENABLE_ADMINSYS
20.290 +extern IAdminSystem *adminsys;
20.291 +#endif
20.292 +#if defined SMEXT_ENABLE_USERMSGS
20.293 +extern IUserMessages *usermsgs;
20.294 +#endif
20.295 +#if defined SMEXT_ENABLE_TRANSLATOR
20.296 +extern ITranslator *translator;
20.297 +#endif
20.298 +#if defined SMEXT_ENABLE_NINVOKE
20.299 +extern INativeInterface *ninvoke;
20.300 +#endif
20.301 +
20.302 +#if defined SMEXT_CONF_METAMOD
20.303 +PLUGIN_GLOBALVARS();
20.304 +extern IVEngineServer *engine;
20.305 +extern IServerGameDLL *gamedll;
20.306 +#endif
20.307 +
20.308 +/** Creates a SourceMod interface macro pair */
20.309 +#define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION
20.310 +/** Automates retrieving SourceMod interfaces */
20.311 +#define SM_GET_IFACE(prefix, addr) \
20.312 + if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \
20.313 + { \
20.314 + if (error != NULL && maxlength) \
20.315 + { \
20.316 + size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
20.317 + if (len >= maxlength) \
20.318 + { \
20.319 + error[maxlength - 1] = '\0'; \
20.320 + } \
20.321 + } \
20.322 + return false; \
20.323 + }
20.324 +/** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */
20.325 +#define SM_GET_LATE_IFACE(prefix, addr) \
20.326 + g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)
20.327 +/** Validates a SourceMod interface pointer */
20.328 +#define SM_CHECK_IFACE(prefix, addr) \
20.329 + if (!addr) \
20.330 + { \
20.331 + if (error != NULL && maxlength) \
20.332 + { \
20.333 + size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
20.334 + if (len >= maxlength) \
20.335 + { \
20.336 + error[maxlength - 1] = '\0'; \
20.337 + } \
20.338 + } \
20.339 + return false; \
20.340 + }
20.341 +
20.342 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/extensions/updater/svn_version.h Mon Feb 02 15:41:25 2009 -0500
21.3 @@ -0,0 +1,44 @@
21.4 +/**
21.5 + * vim: set ts=4 :
21.6 + * =============================================================================
21.7 + * SourceMod GeoIP Extension
21.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
21.9 + * =============================================================================
21.10 + *
21.11 + * This program is free software; you can redistribute it and/or modify it under
21.12 + * the terms of the GNU General Public License, version 3.0, as published by the
21.13 + * Free Software Foundation.
21.14 + *
21.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
21.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21.18 + * details.
21.19 + *
21.20 + * You should have received a copy of the GNU General Public License along with
21.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
21.22 + *
21.23 + * As a special exception, AlliedModders LLC gives you permission to link the
21.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
21.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
21.26 + * by the Valve Corporation. You must obey the GNU General Public License in
21.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
21.28 + * this exception to all derivative works. AlliedModders LLC defines further
21.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
21.30 + * or <http://www.sourcemod.net/license.php>.
21.31 + *
21.32 + * Version: $Id$
21.33 + */
21.34 +
21.35 +/**
21.36 + * Autogenerated by build scripts
21.37 + */
21.38 +
21.39 +#ifndef _INCLUDE_UPDATER_VERSION_H_
21.40 +#define _INCLUDE_UPDATER_VERSION_H_
21.41 +
21.42 +#define SM_BUILD_STRING "-dev"
21.43 +#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
21.44 +#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
21.45 +#define SVN_FILE_VERSION 1,2,0,0
21.46 +
21.47 +#endif //_INCLUDE_UPDATER_VERSION_H_
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/extensions/updater/svn_version.tpl Mon Feb 02 15:41:25 2009 -0500
22.3 @@ -0,0 +1,44 @@
22.4 +/**
22.5 + * vim: set ts=4 :
22.6 + * =============================================================================
22.7 + * SourceMod GeoIP Extension
22.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
22.9 + * =============================================================================
22.10 + *
22.11 + * This program is free software; you can redistribute it and/or modify it under
22.12 + * the terms of the GNU General Public License, version 3.0, as published by the
22.13 + * Free Software Foundation.
22.14 + *
22.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
22.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22.18 + * details.
22.19 + *
22.20 + * You should have received a copy of the GNU General Public License along with
22.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
22.22 + *
22.23 + * As a special exception, AlliedModders LLC gives you permission to link the
22.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
22.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
22.26 + * by the Valve Corporation. You must obey the GNU General Public License in
22.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
22.28 + * this exception to all derivative works. AlliedModders LLC defines further
22.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
22.30 + * or <http://www.sourcemod.net/license.php>.
22.31 + *
22.32 + * Version: $Id$
22.33 + */
22.34 +
22.35 +/**
22.36 + * Autogenerated by build scripts
22.37 + */
22.38 +
22.39 +#ifndef _INCLUDE_UPDATER_VERSION_H_
22.40 +#define _INCLUDE_UPDATER_VERSION_H_
22.41 +
22.42 +#define SM_BUILD_STRING "$BUILD_STRING$"
22.43 +#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
22.44 +#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
22.45 +#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
22.46 +
22.47 +#endif //_INCLUDE_UPDATER_VERSION_H_
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/extensions/updater/version.rc Mon Feb 02 15:41:25 2009 -0500
23.3 @@ -0,0 +1,104 @@
23.4 +// Microsoft Visual C++ generated resource script.
23.5 +//
23.6 +//#include "resource.h"
23.7 +
23.8 +#define APSTUDIO_READONLY_SYMBOLS
23.9 +/////////////////////////////////////////////////////////////////////////////
23.10 +//
23.11 +// Generated from the TEXTINCLUDE 2 resource.
23.12 +//
23.13 +#include "winres.h"
23.14 +
23.15 +#include "svn_version.h"
23.16 +
23.17 +/////////////////////////////////////////////////////////////////////////////
23.18 +#undef APSTUDIO_READONLY_SYMBOLS
23.19 +
23.20 +/////////////////////////////////////////////////////////////////////////////
23.21 +// English (U.S.) resources
23.22 +
23.23 +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
23.24 +#ifdef _WIN32
23.25 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
23.26 +#pragma code_page(1252)
23.27 +#endif //_WIN32
23.28 +
23.29 +/////////////////////////////////////////////////////////////////////////////
23.30 +//
23.31 +// Version
23.32 +//
23.33 +
23.34 +VS_VERSION_INFO VERSIONINFO
23.35 + FILEVERSION SVN_FILE_VERSION
23.36 + PRODUCTVERSION SVN_FILE_VERSION
23.37 + FILEFLAGSMASK 0x17L
23.38 +#ifdef _DEBUG
23.39 + FILEFLAGS 0x1L
23.40 +#else
23.41 + FILEFLAGS 0x0L
23.42 +#endif
23.43 + FILEOS 0x4L
23.44 + FILETYPE 0x2L
23.45 + FILESUBTYPE 0x0L
23.46 +BEGIN
23.47 + BLOCK "StringFileInfo"
23.48 + BEGIN
23.49 + BLOCK "000004b0"
23.50 + BEGIN
23.51 + VALUE "Comments", "Automatic Updater"
23.52 + VALUE "FileDescription", "SourceMod Automatic Updater"
23.53 + VALUE "FileVersion", SVN_FILE_VERSION
23.54 + VALUE "InternalName", "SourceMod Updater Extension"
23.55 + VALUE "LegalCopyright", "Copyright (c) 2004-2009, AlliedModders LLC"
23.56 + VALUE "OriginalFilename", "updater.ext.dll"
23.57 + VALUE "ProductName", "SourceMod Updater Extension"
23.58 + VALUE "ProductVersion", SVN_FULL_VERSION
23.59 + END
23.60 + END
23.61 + BLOCK "VarFileInfo"
23.62 + BEGIN
23.63 + VALUE "Translation", 0x0, 1200
23.64 + END
23.65 +END
23.66 +
23.67 +
23.68 +#ifdef APSTUDIO_INVOKED
23.69 +/////////////////////////////////////////////////////////////////////////////
23.70 +//
23.71 +// TEXTINCLUDE
23.72 +//
23.73 +
23.74 +1 TEXTINCLUDE
23.75 +BEGIN
23.76 + "resource.h\0"
23.77 +END
23.78 +
23.79 +2 TEXTINCLUDE
23.80 +BEGIN
23.81 + "#include ""winres.h""\r\n"
23.82 + "\0"
23.83 +END
23.84 +
23.85 +3 TEXTINCLUDE
23.86 +BEGIN
23.87 + "\r\n"
23.88 + "\0"
23.89 +END
23.90 +
23.91 +#endif // APSTUDIO_INVOKED
23.92 +
23.93 +#endif // English (U.S.) resources
23.94 +/////////////////////////////////////////////////////////////////////////////
23.95 +
23.96 +
23.97 +
23.98 +#ifndef APSTUDIO_INVOKED
23.99 +/////////////////////////////////////////////////////////////////////////////
23.100 +//
23.101 +// Generated from the TEXTINCLUDE 3 resource.
23.102 +//
23.103 +
23.104 +
23.105 +/////////////////////////////////////////////////////////////////////////////
23.106 +#endif // not APSTUDIO_INVOKED
23.107 +
24.1 --- a/public/IGameConfigs.h Sun Feb 01 20:38:59 2009 -0500
24.2 +++ b/public/IGameConfigs.h Mon Feb 02 15:41:25 2009 -0500
24.3 @@ -42,7 +42,7 @@
24.4 */
24.5
24.6 #define SMINTERFACE_GAMECONFIG_NAME "IGameConfigManager"
24.7 -#define SMINTERFACE_GAMECONFIG_VERSION 4
24.8 +#define SMINTERFACE_GAMECONFIG_VERSION 5
24.9
24.10 class SendProp;
24.11
24.12 @@ -161,6 +161,16 @@
24.13 * @noreturn
24.14 */
24.15 virtual void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener) =0;
24.16 +
24.17 + /**
24.18 + * @brief Acquires a file reading lock on the gamedata system.
24.19 + */
24.20 + virtual void AcquireLock() = 0;
24.21 +
24.22 + /**
24.23 + * @brief Releases the file reading lock.
24.24 + */
24.25 + virtual void ReleaseLock() = 0;
24.26 };
24.27 }
24.28
25.1 --- a/public/ISourceMod.h Sun Feb 01 20:38:59 2009 -0500
25.2 +++ b/public/ISourceMod.h Mon Feb 02 15:41:25 2009 -0500
25.3 @@ -43,7 +43,7 @@
25.4 #include <time.h>
25.5
25.6 #define SMINTERFACE_SOURCEMOD_NAME "ISourceMod"
25.7 -#define SMINTERFACE_SOURCEMOD_VERSION 8
25.8 +#define SMINTERFACE_SOURCEMOD_VERSION 9
25.9
25.10 /**
25.11 * @brief Forward declaration of the KeyValues class.
25.12 @@ -71,6 +71,13 @@
25.13 typedef void (*GAME_FRAME_HOOK)(bool simulating);
25.14
25.15 /**
25.16 + * @brief Function type for FrameAction callbacks.
25.17 + *
25.18 + * @param data User data pointer.
25.19 + */
25.20 + typedef void (*FRAMEACTION)(void *data);
25.21 +
25.22 + /**
25.23 * @brief Contains miscellaneous helper functions.
25.24 */
25.25 class ISourceMod : public SMInterface
25.26 @@ -270,6 +277,16 @@
25.27 * @return Number of bytes (not including null terminator) written.
25.28 */
25.29 virtual size_t FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap) = 0;
25.30 +
25.31 + /**
25.32 + * @brief Adds an action to be executed on the next available frame.
25.33 + *
25.34 + * This function is thread safe.
25.35 + *
25.36 + * @param fn Function to execute.
25.37 + * @param data Data to pass to function.
25.38 + */
25.39 + virtual void AddFrameAction(FRAMEACTION fn, void *data) = 0;
25.40 };
25.41 }
25.42