Skip to content

Commit 750c5e5

Browse files
authored
Merge branch 'develop' into feature/range-loops
2 parents 2f1c235 + c8bc5eb commit 750c5e5

File tree

14 files changed

+2725
-2259
lines changed

14 files changed

+2725
-2259
lines changed

amx-deps/src/CFunctions.cpp

Lines changed: 698 additions & 686 deletions
Large diffs are not rendered by default.

amx-deps/src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CPP = gcc
1010
# Compiler flags
1111
# NOTE: add -g for debug, remove for release!
1212
ASMFLAGS = -O1 -f elf -I./amx/
13-
CPPFLAGS = -MD -O2 -Wall -I./ -I/usr/local/include/boost-1_35 -I./amx -I./include -I./linux -DAMX_DONT_RELOCATE -DFLOATPOINT -DASM32
13+
CPPFLAGS = -MD -O2 -Wall -I./ -I/usr/local/include/boost-1_35 -I./amx -I./include -I./linux -DAMX_DONT_RELOCATE -DFLOATPOINT
1414
LDFLAGS = -fPIC -s -shared -Wl,-soname,$(PROG).1,-R./
1515
LIBS = -lpthread -lstdc++ -llua5.1 -lsqlite3 -lboost_filesystem-gcc41-mt-s -lboost_system-gcc41-mt-s
1616

amx-deps/src/amx/amxexec.obj

-18.5 KB
Binary file not shown.
Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,65 @@
11
/*****************************************************************************
2-
*
3-
* PROJECT: Multi Theft Auto v1.0
4-
* LICENSE: See LICENSE in the top level directory
5-
* FILE: publicsdk/include/ILuaModuleManager.h
6-
* PURPOSE: Lua dynamic module interface
7-
*
8-
* Multi Theft Auto is available from http://www.multitheftauto.com/
9-
*
10-
*****************************************************************************/
2+
*
3+
* PROJECT: Multi Theft Auto v1.0
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: publicsdk/include/ILuaModuleManager.h
6+
* PURPOSE: Lua dynamic module interface
7+
*
8+
* Multi Theft Auto is available from http://www.multitheftauto.com/
9+
*
10+
*****************************************************************************/
1111

1212
// INTERFACE for Lua dynamic modules
1313

14-
#ifndef __ILUAMODULEMANAGER_H
15-
#define __ILUAMODULEMANAGER_H
14+
#pragma once
1615

1716
#define MAX_INFO_LENGTH 128
1817

1918
extern "C"
2019
{
21-
#include "lua.h"
22-
#include "lualib.h"
23-
#include "lauxlib.h"
20+
#include <lua.h>
21+
#include <lualib.h>
22+
#include <lauxlib.h>
2423
}
24+
#include <string>
25+
26+
#ifndef __CChecksum_H
27+
class CChecksum
28+
{
29+
public:
30+
unsigned long ulCRC;
31+
unsigned char mD5[16];
32+
};
33+
#endif
2534

2635
/* Interface for modules until DP2.3 */
2736
class ILuaModuleManager
2837
{
2938
public:
30-
virtual void ErrorPrintf ( const char* szFormat, ... ) = 0;
31-
virtual void DebugPrintf ( lua_State * luaVM, const char* szFormat, ... ) = 0;
32-
virtual void Printf ( const char* szFormat, ... ) = 0;
33-
34-
virtual bool RegisterFunction ( lua_State * luaVM, const char *szFunctionName, lua_CFunction Func ) = 0;
35-
virtual bool GetResourceName ( lua_State * luaVM, std::string &strName ) = 0;
36-
virtual unsigned long GetResourceMetaCRC ( lua_State * luaVM ) = 0;
37-
virtual unsigned long GetResourceFileCRC ( lua_State * luaVM, const char* szFile ) = 0;
39+
virtual void ErrorPrintf(const char* szFormat, ...) = 0;
40+
virtual void DebugPrintf(lua_State* luaVM, const char* szFormat, ...) = 0;
41+
virtual void Printf(const char* szFormat, ...) = 0;
42+
43+
virtual bool RegisterFunction(lua_State* luaVM, const char* szFunctionName, lua_CFunction Func) = 0;
44+
virtual bool GetResourceName(
45+
lua_State* luaVM, std::string& strName) = 0; // This function might not work if module and MTA were compiled with different compiler versions
46+
virtual CChecksum GetResourceMetaChecksum(lua_State* luaVM) = 0;
47+
virtual CChecksum GetResourceFileChecksum(lua_State* luaVM, const char* szFile) = 0;
3848
};
3949

4050
/* Interface for modules until 1.0 */
4151
class ILuaModuleManager10 : public ILuaModuleManager
4252
{
4353
public:
44-
virtual unsigned long GetVersion ( ) = 0;
45-
virtual const char* GetVersionString ( ) = 0;
46-
virtual const char* GetVersionName ( ) = 0;
47-
virtual unsigned long GetNetcodeVersion ( ) = 0;
48-
virtual const char* GetOperatingSystemName ( ) = 0;
54+
virtual unsigned long GetVersion() = 0;
55+
virtual const char* GetVersionString() = 0;
56+
virtual const char* GetVersionName() = 0;
57+
virtual unsigned long GetNetcodeVersion() = 0;
58+
virtual const char* GetOperatingSystemName() = 0;
4959

50-
virtual lua_State* GetResourceFromName ( const char* szResourceName ) = 0;
51-
};
60+
virtual lua_State* GetResourceFromName(const char* szResourceName) = 0;
5261

53-
#endif
62+
// GetResourceName above doesn't work if module and MTA were compiled with different compiler versions
63+
virtual bool GetResourceName(lua_State* luaVM, char* szName, size_t length) = 0;
64+
virtual bool GetResourceFilePath(lua_State* luaVM, const char* fileName, char* path, size_t length) = 0;
65+
};

amx-deps/src/lib/lua5.1d.exp

-16.9 KB
Binary file not shown.

amx-deps/src/lib/lua5.1d.lib

-26.3 KB
Binary file not shown.

amx-deps/src/ml_base.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ MTAEXPORT void RegisterFunctions ( lua_State * luaVM )
150150
pModuleManager->RegisterFunction(luaVM, "amxVersion", CFunctions::amxVersion);
151151
pModuleManager->RegisterFunction(luaVM, "amxVersionString", CFunctions::amxVersionString);
152152

153-
string resName;
154-
if(!pModuleManager->GetResourceName(luaVM, resName) || resName.compare("amx"))
153+
char resNameBuf[4];
154+
bool ok = pModuleManager->GetResourceName(luaVM, resNameBuf, 4);
155+
if (!ok || std::string(resNameBuf) != "amx")
155156
return;
156157

157158
mainVM = luaVM;

amx-deps/src/ml_base.vcxproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<ClCompile>
6464
<Optimization>Disabled</Optimization>
6565
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
66-
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;__WIN32__;AMX_DONT_RELOCATE;FLOATPOINT;ASM32;%(PreprocessorDefinitions);HAVE_INTTYPES_H;HAVE_MALLOC_H;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
66+
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;__WIN32__;FLOATPOINT;%(PreprocessorDefinitions);HAVE_INTTYPES_H;HAVE_MALLOC_H;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
6767
<MinimalRebuild>true</MinimalRebuild>
6868
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
6969
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -79,7 +79,6 @@
7979
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
8080
</ResourceCompile>
8181
<Link>
82-
<AdditionalOptions>amx\amxexec.obj %(AdditionalOptions)</AdditionalOptions>
8382
<AdditionalDependencies>./lib/lua5.1.lib;./lib/sqlite3.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
8483
<IgnoreSpecificDefaultLibraries>MSVCRT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
8584
<ModuleDefinitionFile />
@@ -101,7 +100,7 @@
101100
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
102101
<OmitFramePointers>true</OmitFramePointers>
103102
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
104-
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;__WIN32__;AMX_DONT_RELOCATE;FLOATPOINT;ASM32;%(PreprocessorDefinitions);HAVE_INTTYPES_H;HAVE_MALLOC_H;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
103+
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;__WIN32__;FLOATPOINT;%(PreprocessorDefinitions);HAVE_INTTYPES_H;HAVE_MALLOC_H;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
105104
<StringPooling>true</StringPooling>
106105
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
107106
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
@@ -116,7 +115,6 @@
116115
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
117116
</ResourceCompile>
118117
<Link>
119-
<AdditionalOptions>amx\amxexec.obj %(AdditionalOptions)</AdditionalOptions>
120118
<AdditionalDependencies>./lib/lua5.1.lib;./lib/sqlite3.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
121119
<ModuleDefinitionFile />
122120
<GenerateDebugInformation>true</GenerateDebugInformation>

0 commit comments

Comments
 (0)