diff --git a/.travis.yml b/.travis.yml index 0e8467d..dd293e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ compiler: - clang before_script: - cd .. - - git clone --depth=1 --branch=1.7-dev https://github.com/alliedmodders/sourcemod sourcemod-1.7 - - git clone --depth=1 --branch=master https://github.com/alliedmodders/ambuild + - git clone --depth=1 --branch=1.8-dev --recursive https://github.com/alliedmodders/sourcemod sourcemod-1.8 + - git clone --depth=1 --branch=master --recursive https://github.com/alliedmodders/ambuild - cd ambuild && python setup.py install --user - cd $TRAVIS_BUILD_DIR - git fetch --unshallow || true diff --git a/AMBuildScript b/AMBuildScript index 74093f4..e92c894 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -32,7 +32,7 @@ class SM: self.compiler.DetectAll(AMBuild) #Detect variables - envvars = { 'SOURCEMOD': 'sourcemod-1.7' } + envvars = { 'SOURCEMOD': 'sourcemod-1.8' } # Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary` def findDictByKey(dictionary, key, value): diff --git a/appveyor.yml b/appveyor.yml index 09a2e3f..690eba4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ environment: GYP_MSVS_VERSION: '2015' install: - cd .. - - git clone --depth=1 --branch=1.7-dev https://github.com/alliedmodders/sourcemod sourcemod-1.7 + - git clone --depth=1 --branch=1.8-dev --recursive https://github.com/alliedmodders/sourcemod sourcemod-1.8 - git clone --depth=1 --branch=master https://github.com/alliedmodders/ambuild - cd ambuild - C:\python27\python.exe setup.py install diff --git a/extension/AMBuilder b/extension/AMBuilder index 53b927e..bca0acb 100644 --- a/extension/AMBuilder +++ b/extension/AMBuilder @@ -15,7 +15,7 @@ def BuildEverything(): compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public')) compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'extensions')) - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'sourcepawn')) + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'sourcepawn', 'include')) if AMBuild.target['platform'] in ['linux']: compiler['POSTLINKFLAGS'].append('-lm') diff --git a/extension/extension.cpp b/extension/extension.cpp index 76238ae..8237d4e 100644 --- a/extension/extension.cpp +++ b/extension/extension.cpp @@ -19,6 +19,12 @@ #include "extension.h" +#ifndef PLATFORM_ARCH_FOLDER +#define PLATFORM_ARCH_FOLDER "" +#endif + +#include + #include #include "MemoryDownloader.h" @@ -122,6 +128,7 @@ char crashGamePath[512]; char crashCommandLine[1024]; char crashSourceModPath[512]; char crashGameDirectory[256]; +char crashSourceModVersion[32]; char steamInf[1024]; char dumpStoragePath[512]; @@ -129,22 +136,6 @@ char logPath[512]; google_breakpad::ExceptionHandler *handler = NULL; -# if 0 -struct PluginInfo { - unsigned int serial; - PluginStatus status; - char filename[256]; - char name[256]; - char author[256]; - char description[256]; - char version[256]; - char url[256]; -}; - -unsigned int plugin_count; -PluginInfo plugins[256]; -#endif - #if defined _LINUX void terminateHandler() { @@ -212,6 +203,10 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, sys_write(extra, crashSourceModPath, my_strlen(crashSourceModPath)); sys_write(extra, "\nGameDirectory=", 15); sys_write(extra, crashGameDirectory, my_strlen(crashGameDirectory)); + if (crashSourceModVersion[0]) { + sys_write(extra, "\nSourceModVersion=", 18); + sys_write(extra, crashSourceModVersion, my_strlen(crashSourceModVersion)); + } sys_write(extra, "\nExtensionVersion=", 18); sys_write(extra, SM_VERSION, my_strlen(SM_VERSION)); sys_write(extra, "\nExtensionBuild=", 16); @@ -1188,6 +1183,38 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) #error Bad platform. #endif + do { + char spJitPath[512]; + g_pSM->BuildPath(Path_SM, spJitPath, sizeof(spJitPath), "bin/" PLATFORM_ARCH_FOLDER "sourcepawn.jit.x86." PLATFORM_LIB_EXT); + + char spJitError[255]; + std::unique_ptr spJit(libsys->OpenLibrary(spJitPath, spJitError, sizeof(spJitError))); + if (!spJit) { + smutils->LogMessage(myself, "WARNING: Failed to load SourcePawn library %s: %s", spJitPath, spJitError); + break; + } + + GetSourcePawnFactoryFn factoryFn = (GetSourcePawnFactoryFn)spJit->GetSymbolAddress("GetSourcePawnFactory"); + if (!factoryFn) { + smutils->LogMessage(myself, "WARNING: SourcePawn library is out of date: No factory function."); + break; + } + + ISourcePawnFactory *spFactory = factoryFn(0x0207); + if (!spFactory) { + smutils->LogMessage(myself, "WARNING: SourcePawn library is out of date: Failed to get version 2.7", 0x0207); + break; + } + + ISourcePawnEnvironment *spEnvironment = spFactory->CurrentEnvironment(); + if (!spEnvironment) { + smutils->LogMessage(myself, "WARNING: Could not get SourcePawn environment."); + break; + } + + strncpy(crashSourceModVersion, spEnvironment->APIv2()->GetVersionString(), sizeof(crashSourceModVersion)); + } while(false); + plsys->AddPluginsListener(this); IPluginIterator *iterator = plsys->GetPluginIterator();