From d230711e4dc3829b3f3d2c701f5b451b2077fb74 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 23 Aug 2014 19:26:51 -0700 Subject: [PATCH] Bump SourcePawn version to 1.7 to match SourceMod. --- sourcepawn/compiler/sc6.cpp | 4 ++-- sourcepawn/include/smx/smx-headers.h | 14 ++++++++------ sourcepawn/include/smx/{smx-v2.h => smx-rtti.h} | 0 sourcepawn/include/smx/smx-v1.h | 4 ++++ sourcepawn/jit/BaseRuntime.cpp | 4 ++-- sourcepawn/jit/engine2.cpp | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) rename sourcepawn/include/smx/{smx-v2.h => smx-rtti.h} (100%) diff --git a/sourcepawn/compiler/sc6.cpp b/sourcepawn/compiler/sc6.cpp index 782da306..042aa8e3 100644 --- a/sourcepawn/compiler/sc6.cpp +++ b/sourcepawn/compiler/sc6.cpp @@ -882,8 +882,8 @@ static void assemble_to_buffer(MemoryBuffer *buffer, void *fin) // Set up the code section. code->header().codesize = code_buffer.length() * sizeof(cell); code->header().cellsize = sizeof(cell); - code->header().codeversion = SmxConsts::CODE_VERSION_JIT2; - code->header().flags = 0; // :TODO: CODEFLAG_DEBUG; + code->header().codeversion = SmxConsts::CODE_VERSION_JIT_1_1; + code->header().flags = CODEFLAG_DEBUG; code->header().main = 0; code->header().code = sizeof(sp_file_code_t); code->setBlob((uint8_t *)code_buffer.buffer(), code_buffer.length() * sizeof(cell)); diff --git a/sourcepawn/include/smx/smx-headers.h b/sourcepawn/include/smx/smx-headers.h index 325f16c8..2fb94235 100644 --- a/sourcepawn/include/smx/smx-headers.h +++ b/sourcepawn/include/smx/smx-headers.h @@ -50,8 +50,9 @@ struct SmxConsts // version higher than the current version should be rejected. static const uint16_t SP1_VERSION_1_0 = 0x0101; static const uint16_t SP1_VERSION_1_1 = 0x0102; + static const uint16_t SP1_VERSION_1_7 = 0x0107; static const uint16_t SP1_VERSION_MIN = SP1_VERSION_1_0; - static const uint16_t SP1_VERSION_MAX = SP1_VERSION_1_1; + static const uint16_t SP1_VERSION_MAX = SP1_VERSION_1_7; static const uint16_t SP2_VERSION_MIN = 0x0200; static const uint16_t SP2_VERSION_MAX = 0x0200; @@ -59,11 +60,12 @@ struct SmxConsts static const uint8_t FILE_COMPRESSION_NONE = 0; static const uint8_t FILE_COMPRESSION_GZ = 1; - // SourcePawn 1.0. - static const uint8_t CODE_VERSION_JIT1 = 9; - - // SourcePawn 1.1. - static const uint8_t CODE_VERSION_JIT2 = 10; + // SourcePawn 1. + static const uint8_t CODE_VERSION_JIT_1_0 = 9; + static const uint8_t CODE_VERSION_JIT_1_1 = 10; + static const uint8_t CODE_VERSION_JIT_1_7 = 11; + static const uint8_t CODE_VERSION_SP1_MIN = CODE_VERSION_JIT_1_0; + static const uint8_t CODE_VERSION_SP1_MAX = CODE_VERSION_JIT_1_1; // For SP1 consumers, the container version may not be checked, but usually // the code version is. This constant allows newer containers to be rejected diff --git a/sourcepawn/include/smx/smx-v2.h b/sourcepawn/include/smx/smx-rtti.h similarity index 100% rename from sourcepawn/include/smx/smx-v2.h rename to sourcepawn/include/smx/smx-rtti.h diff --git a/sourcepawn/include/smx/smx-v1.h b/sourcepawn/include/smx/smx-v1.h index 3ae95029..7ea2392e 100644 --- a/sourcepawn/include/smx/smx-v1.h +++ b/sourcepawn/include/smx/smx-v1.h @@ -161,6 +161,10 @@ typedef struct sp_fdbg_ntvarg_s uint32_t name; /**< Offset into debug nametable */ } sp_fdbg_ntvarg_t; +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// DO NOT DEFINE NEW STRUCTURES BELOW. +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #if defined __GNUC__ # pragma pack() /* reset default packing */ #else diff --git a/sourcepawn/jit/BaseRuntime.cpp b/sourcepawn/jit/BaseRuntime.cpp index fcf7fbf7..2fade850 100644 --- a/sourcepawn/jit/BaseRuntime.cpp +++ b/sourcepawn/jit/BaseRuntime.cpp @@ -172,9 +172,9 @@ int BaseRuntime::CreateFromMemory(sp_file_hdr_t *hdr, uint8_t *base) if (!(m_plugin.pcode) && !strcmp(nameptr, ".code")) { sp_file_code_t *cod = (sp_file_code_t *)(base + secptr->dataoffs); - if (cod->codeversion < SmxConsts::CODE_VERSION_JIT1) + if (cod->codeversion < SmxConsts::CODE_VERSION_SP1_MIN) return SP_ERROR_CODE_TOO_OLD; - if (cod->codeversion > SmxConsts::CODE_VERSION_JIT2) + if (cod->codeversion > SmxConsts::CODE_VERSION_SP1_MAX) return SP_ERROR_CODE_TOO_NEW; m_plugin.pcode = base + secptr->dataoffs + cod->code; diff --git a/sourcepawn/jit/engine2.cpp b/sourcepawn/jit/engine2.cpp index e5a8b8c2..2c1b73f9 100644 --- a/sourcepawn/jit/engine2.cpp +++ b/sourcepawn/jit/engine2.cpp @@ -147,7 +147,7 @@ void SourcePawnEngine2::DestroyFakeNative(SPVM_NATIVE_FUNC func) const char *SourcePawnEngine2::GetEngineName() { - return "SourcePawn 1.3, jit-x86"; + return "SourcePawn 1.7, jit-x86"; } const char *SourcePawnEngine2::GetVersionString()