- refactored the project directory layout to be more manageable
@@ -18,19 +18,30 @@ | ||
18 | 18 | |
19 | 19 | #include "StdInc.h" |
20 | 20 | |
21 | +#include <NativeExecutive/CExecutiveManager.h> | |
22 | + | |
21 | 23 | ILuaModuleManager10 *pModuleManager = nullptr; |
22 | 24 | CFileSystemInterface *pubFileSystem = nullptr; |
25 | +NativeExecutive::CExecutiveManager *natExecMan = nullptr; | |
23 | 26 | |
24 | 27 | // Initialisation function (module entrypoint) |
25 | 28 | MTAEXPORT bool InitModule ( ILuaModuleManager10 *pManager, char *szModuleName, char *szAuthor, float *fVersion ) |
26 | 29 | { |
27 | 30 | pModuleManager = pManager; |
31 | + natExecMan = NativeExecutive::CExecutiveManager::Create(); | |
32 | + try | |
28 | 33 | { |
29 | 34 | fs_construction_params fsparams; |
30 | - // TODO: properly configure the Eir FileSystem module here. | |
35 | + fsparams.nativeExecMan = natExecMan; | |
36 | + // TODO: anything left to configure for the Eir FileSystem module here? | |
31 | 37 | |
32 | 38 | pubFileSystem = CFileSystem::Create( fsparams ); |
33 | 39 | } |
40 | + catch( ... ) | |
41 | + { | |
42 | + NativeExecutive::CExecutiveManager::Delete( natExecMan ); | |
43 | + return false; | |
44 | + } | |
34 | 45 | |
35 | 46 | // Set the module info |
36 | 47 | strncpy ( szModuleName, MODULE_NAME, MAX_INFO_LENGTH ); |
@@ -60,6 +71,13 @@ | ||
60 | 71 | |
61 | 72 | MTAEXPORT bool ShutdownModule ( void ) |
62 | 73 | { |
63 | - | |
74 | + if ( pubFileSystem != nullptr ) | |
75 | + { | |
76 | + CFileSystem::Destroy( (CFileSystem*)pubFileSystem ); | |
77 | + } | |
78 | + if ( natExecMan != nullptr ) | |
79 | + { | |
80 | + NativeExecutive::CExecutiveManager::Delete( natExecMan ); | |
81 | + } | |
64 | 82 | return true; |
65 | 83 | } |