- made the project compile for Linux
@@ -21,7 +21,9 @@ | ||
21 | 21 | #define MODULE_AUTHOR "The_GTA" |
22 | 22 | #define MODULE_VERSION 2.0 |
23 | 23 | |
24 | +#ifdef _MSC_VER | |
24 | 25 | #pragma warning(disable: 4996) |
26 | +#endif //_MSC_VER | |
25 | 27 | |
26 | 28 | #include "Common.h" |
27 | 29 | #include <CFileSystem.h> |
@@ -14,6 +14,8 @@ | ||
14 | 14 | #include <StdInc.h> |
15 | 15 | #include "luafile.Utils.hxx" |
16 | 16 | |
17 | +#include <cstring> | |
18 | + | |
17 | 19 | static int luafile_read( lua_State *L ) |
18 | 20 | { |
19 | 21 | CFile *file = fsLuaGetFile( L, 1 ); |
@@ -99,7 +101,7 @@ | ||
99 | 101 | numberType out_num; |
100 | 102 | |
101 | 103 | bool success; |
102 | - | |
104 | + | |
103 | 105 | LUAFILE_GUARDFSCALL_BEGIN |
104 | 106 | success = file->ReadStruct( out_num ); |
105 | 107 | LUAFILE_GUARDFSCALL_END |
@@ -160,7 +162,7 @@ | ||
160 | 162 | bool out_b; |
161 | 163 | |
162 | 164 | bool successful; |
163 | - | |
165 | + | |
164 | 166 | LUAFILE_GUARDFSCALL_BEGIN |
165 | 167 | successful = file->ReadBool( out_b ); |
166 | 168 | LUAFILE_GUARDFSCALL_END |
@@ -194,7 +196,7 @@ | ||
194 | 196 | numberType realNum = (numberType)number; |
195 | 197 | |
196 | 198 | size_t numWrite; |
197 | - | |
199 | + | |
198 | 200 | LUAFILE_GUARDFSCALL_BEGIN |
199 | 201 | numWrite = file->WriteStruct( realNum ); |
200 | 202 | LUAFILE_GUARDFSCALL_END |
@@ -269,7 +271,7 @@ | ||
269 | 271 | luaL_checktype( L, 2, LUA_TBOOLEAN ); |
270 | 272 | |
271 | 273 | size_t numWrite; |
272 | - | |
274 | + | |
273 | 275 | LUAFILE_GUARDFSCALL_BEGIN |
274 | 276 | numWrite = file->WriteBool( |
275 | 277 | ( lua_toboolean( L, 2 ) != 0 ) |
@@ -15,6 +15,8 @@ | ||
15 | 15 | |
16 | 16 | #include "luafile.Utils.hxx" |
17 | 17 | |
18 | +#include <cstring> | |
19 | + | |
18 | 20 | extern CFileSystemInterface *pubFileSystem; |
19 | 21 | |
20 | 22 | #ifndef FU_CLASS |
@@ -469,7 +471,7 @@ | ||
469 | 471 | lua_pushlstring( L, "file", 4 ); |
470 | 472 | luafile_makemeta( L, -4 ); |
471 | 473 | lua_rawset( L, -3 ); |
472 | - | |
474 | + | |
473 | 475 | // Initialize the file-translator metatable. |
474 | 476 | lua_pushlstring( L, "ftrans", 6 ); |
475 | 477 | luaftrans_makemeta( L, -4 ); |
@@ -506,7 +508,7 @@ | ||
506 | 508 | lua_pushvalue( L, -2 ); |
507 | 509 | luaL_openlib( L, nullptr, fsysLib, 1 ); |
508 | 510 | lua_pop( L, 1 ); |
509 | - | |
511 | + | |
510 | 512 | // Cache the root translator into the lib. |
511 | 513 | lua_pushvalue( L, -1 ); |
512 | 514 | lua_pushcclosure( L, luafsys_init, 1 ); |
@@ -18,11 +18,17 @@ | ||
18 | 18 | |
19 | 19 | #include "StdInc.h" |
20 | 20 | |
21 | +#include <cstring> | |
22 | + | |
23 | +#ifndef __linux__ | |
21 | 24 | #include <NativeExecutive/CExecutiveManager.h> |
25 | +#endif //__linux__ | |
22 | 26 | |
23 | 27 | ILuaModuleManager10 *pModuleManager = nullptr; |
24 | 28 | CFileSystemInterface *pubFileSystem = nullptr; |
29 | +#ifndef __linux__ | |
25 | 30 | NativeExecutive::CExecutiveManager *natExecMan = nullptr; |
31 | +#endif //__linux__ | |
26 | 32 | |
27 | 33 | bool _global_doBufferAllRaw; |
28 | 34 |
@@ -30,11 +36,15 @@ | ||
30 | 36 | MTAEXPORT bool InitModule ( ILuaModuleManager10 *pManager, char *szModuleName, char *szAuthor, float *fVersion ) |
31 | 37 | { |
32 | 38 | pModuleManager = pManager; |
39 | +#ifndef __linux__ | |
33 | 40 | natExecMan = NativeExecutive::CExecutiveManager::Create(); |
41 | +#endif //__linux__ | |
34 | 42 | try |
35 | 43 | { |
36 | 44 | fs_construction_params fsparams; |
45 | +#ifndef __linux__ | |
37 | 46 | fsparams.nativeExecMan = natExecMan; |
47 | +#endif //__linux__ | |
38 | 48 | // TODO: anything left to configure for the Eir FileSystem module here? |
39 | 49 | |
40 | 50 | pubFileSystem = CFileSystem::Create( fsparams ); |
@@ -46,7 +56,9 @@ | ||
46 | 56 | } |
47 | 57 | catch( ... ) |
48 | 58 | { |
59 | +#ifndef __linux__ | |
49 | 60 | NativeExecutive::CExecutiveManager::Delete( natExecMan ); |
61 | +#endif //__linux__ | |
50 | 62 | return false; |
51 | 63 | } |
52 | 64 |
@@ -86,9 +98,11 @@ | ||
86 | 98 | { |
87 | 99 | CFileSystem::Destroy( (CFileSystem*)pubFileSystem ); |
88 | 100 | } |
101 | +#ifndef __linux__ | |
89 | 102 | if ( natExecMan != nullptr ) |
90 | 103 | { |
91 | 104 | NativeExecutive::CExecutiveManager::Delete( natExecMan ); |
92 | 105 | } |
106 | +#endif //__linux__ | |
93 | 107 | return true; |
94 | 108 | } |