|
1 | 1 | /***************************************************************************** |
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 | + *****************************************************************************/ |
11 | 11 |
|
12 | 12 | // INTERFACE for Lua dynamic modules |
13 | 13 |
|
14 | | -#ifndef __ILUAMODULEMANAGER_H |
15 | | -#define __ILUAMODULEMANAGER_H |
| 14 | +#pragma once |
16 | 15 |
|
17 | 16 | #define MAX_INFO_LENGTH 128 |
18 | 17 |
|
19 | 18 | extern "C" |
20 | 19 | { |
21 | | - #include "lua.h" |
22 | | - #include "lualib.h" |
23 | | - #include "lauxlib.h" |
| 20 | +#include <lua.h> |
| 21 | +#include <lualib.h> |
| 22 | +#include <lauxlib.h> |
24 | 23 | } |
| 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 |
25 | 34 |
|
26 | 35 | /* Interface for modules until DP2.3 */ |
27 | 36 | class ILuaModuleManager |
28 | 37 | { |
29 | 38 | 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; |
38 | 48 | }; |
39 | 49 |
|
40 | 50 | /* Interface for modules until 1.0 */ |
41 | 51 | class ILuaModuleManager10 : public ILuaModuleManager |
42 | 52 | { |
43 | 53 | 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; |
49 | 59 |
|
50 | | - virtual lua_State* GetResourceFromName ( const char* szResourceName ) = 0; |
51 | | -}; |
| 60 | + virtual lua_State* GetResourceFromName(const char* szResourceName) = 0; |
52 | 61 |
|
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 | +}; |
0 commit comments