1 #ifndef __MODULE_LOAD_H__
2 #define __MODULE_LOAD_H__
3
4 // Module definitions for inclusion into core CHDK files.
5
6 #include "module_def.h"
7
8 #define MAX_NUM_LOADED_MODULES 10
9
10 // Base typedefs
11 //-------------------
12
13 // Handler structure for module loading / unloading
14 // The 'default_lib' value points to the 'unloaded' interface functions
15 // These can then auto-load the module when called and redirect to the loaded
16 // interface functions.
17 typedef struct
18 {
19 base_interface_t** lib;
20 base_interface_t* default_lib;
21 _version_t version; // Should match module_version in ModuleInfo
22 // For simple modules like games set to {0,0} to skip version check
23 char* name;
24 } module_handler_t;
25
26 typedef struct
27 {
28 flat_hdr* hdr; // memory allocated for module, 0 if not used
29 unsigned int hName; // hash of the module path name, for finding loaded modules
30 module_handler_t* hMod; // handler info
31 } module_entry;
32
33 // Common module functions
34 //-------------------------
35
36 flat_hdr* module_preload(const char *path, const char *name, _version_t ver);
37 int module_load(module_handler_t* hMod);
38 void module_unload(const char* name);
39
40 void get_module_info(const char *name, ModuleInfo *mi, char *modName, int modNameLen);
41
42 int module_run(char* name);
43
44 module_entry* module_get_adr(unsigned int idx);
45
46 // Asynchronous unloading
47 //-------------------------
48 void module_exit_alt();
49 void module_tick_unloader();
50
51 // Logging
52 void module_log_clear();
53
54 #endif /* __MODULE_LOAD_H__ */