1 module m64p_config;
2 
3 import m64p_frontend;
4 import m64p_types;
5 
6 @nogc nothrow __gshared extern(C):
7 
8     /* ConfigListSections()
9     *
10     * This function is called to enumerate the list of Sections in the Mupen64Plus
11     * configuration file. It is expected that there will be a section named "Core"
12     * for core-specific configuration data, "Graphics" for common graphics options,
13     * and one or more sections for each plugin library. 
14     */
15     m64p_error function(void*, void function(void*, const char*)) ConfigListSections;
16 
17     /* ConfigOpenSection()
18     *
19     * This function is used to give a configuration section handle to the front-end
20     * which may be used to read or write configuration parameter values in a given
21     * section of the configuration file.
22     */
23     m64p_error function(const char*, m64p_handle*) ConfigOpenSection;
24 
25     /* ConfigListParameters()
26     *
27     * This function is called to enumerate the list of Parameters in a given
28     * Section of the Mupen64Plus configuration file. 
29     */
30     m64p_error function(m64p_handle, void*, void function(void*, const char*, m64p_type)) ConfigListParameters;
31 
32     /* ConfigSaveFile()
33     *
34     * This function saves the entire current Mupen64Plus configuration to disk.
35     */
36     m64p_error function() ConfigSaveFile;
37 
38     /* ConfigSaveSection()
39     *
40     * This function saves one section of the current Mupen64Plus configuration to disk.
41     */
42     m64p_error function(const char*) ConfigSaveSection;
43 
44     /* ConfigHasUnsavedChanges()
45     *
46     * This function determines if a given Section (or all sections) of the Mupen64Plus Core configuration file has been modified since it was last saved or loaded.
47     */
48     int function(const char*) ConfigHasUnsavedChanges;
49 
50     /* ConfigDeleteSection()
51     *
52     * This function deletes a section from the Mupen64Plus configuration data.
53     */
54     m64p_error function(const char* SectionName) ConfigDeleteSection;
55 
56     /* ConfigRevertChanges()
57     *
58     * This function reverts changes previously made to one section of the configuration file, so that it will match with the configuration at the last time that it was loaded from or saved to disk.
59     */
60     m64p_error function(const char *SectionName) ConfigRevertChanges;
61     
62     /* ConfigSetParameter()
63     *
64     * This function sets the value of one of the emulator's configuration
65     * parameters.
66     */
67     m64p_error function(m64p_handle, const char*, m64p_type, const void*) ConfigSetParameter;
68 
69     /* ConfigSetParameterHelp()
70     *
71     * This function sets the help string of one of the emulator's configuration
72     * parameters.
73     */
74     m64p_error function(m64p_handle, const char*, const char*) ConfigSetParameterHelp;
75     
76     /* ConfigGetParameter()
77     *
78     * This function retrieves the value of one of the emulator's parameters. 
79     */
80     m64p_error function(m64p_handle, const char*, m64p_type, void*, int) ConfigGetParameter;
81 
82     /* ConfigGetParameterType()
83     *
84     * This function retrieves the type of one of the emulator's parameters. 
85     */
86     m64p_error function(m64p_handle, const char*, m64p_type*) ConfigGetParameterType;
87 
88     /* ConfigGetParameterHelp()
89     *
90     * This function retrieves the help information about one of the emulator's
91     * parameters.
92     */
93     const(char)* function(m64p_handle, const char*) ConfigGetParameterHelp;
94 
95     /* ConfigSetDefault***()
96     *
97     * These functions are used to set the value of a configuration parameter if it
98     * is not already present in the configuration file. This may happen if a new
99     * user runs the emulator, or an upgraded module uses a new parameter, or the
100     * user deletes his or her configuration file. If the parameter is already
101     * present in the given section of the configuration file, then no action will
102     * be taken and this function will return successfully.
103     */
104     m64p_error function(m64p_handle, const char*, int, const char*) ConfigSetDefaultInt;
105     m64p_error function(m64p_handle, const char*, float, const char*) ConfigSetDefaultFloat;
106     m64p_error function(m64p_handle, const char*, int, const char*) ConfigSetDefaultBool;
107     m64p_error function(m64p_handle, const char*, const char*, const char*) ConfigSetDefaultString;
108 
109     /* ConfigGetParam***()
110     *
111     * These functions retrieve the value of one of the emulator's parameters in
112     * the given section, and return the value directly to the calling function. If
113     * an errors occurs (such as an invalid Section handle, or invalid
114     * configuration parameter name), then an error will be sent to the front-end
115     * via the DebugCallback() function, and either a 0 (zero) or an empty string
116     * will be returned.
117     */
118     int function(m64p_handle, const char*) ConfigGetParamInt;
119     float function(m64p_handle, const char*) ConfigGetParamFloat;
120     int function(m64p_handle, const char*) ConfigGetParamBool;
121     const(char)* function(m64p_handle, const char*) ConfigGetParamString;
122 
123     /* ConfigGetSharedDataFilepath()
124     *
125     * This function is provided to allow a plugin to retrieve a full pathname to a
126     * given shared data file. This type of file is intended to be shared among
127     * multiple users on a system, so it is likely to be read-only.
128     */
129     const(char)* function(const char*) ConfigGetSharedDataFilepath;
130 
131     /* ConfigGetUserConfigPath()
132     *
133     * This function may be used by the plugins or front-end to get a path to the
134     * directory for storing user-specific configuration files. This will be the
135     * directory where "mupen64plus.cfg" is located.
136     */
137     const(char)* function() ConfigGetUserConfigPath;
138 
139     /* ConfigGetUserDataPath()
140     *
141     * This function may be used by the plugins or front-end to get a path to the
142     * directory for storing user-specific data files. This may be used to store
143     * files such as screenshots, saved game states, or hi-res textures.
144     */
145     const(char)* function() ConfigGetUserDataPath;
146 
147     /* ConfigGetUserCachePath()
148     *
149     * This function may be used by the plugins or front-end to get a path to the
150     * directory for storing cached user-specific data files. Files in this
151     * directory may be deleted by the user to save space, so critical information
152     * should not be stored here.  This directory may be used to store files such
153     * as the ROM browser cache.
154     */
155     const(char)* function() ConfigGetUserCachePath;
156 
157     /* ConfigExternalOpen()
158     *
159     * This function reads the contents of the config file into memory
160     * and returns M64ERR_SUCCESS if successful.
161     */
162     m64p_error function(const char*, m64p_handle*) ConfigExternalOpen;
163 
164     /* ConfigExternalClose()
165     *
166     * Frees the memory pointer created by ConfigExternalOpen.
167     */
168     m64p_error function(m64p_handle) ConfigExternalClose;
169 
170     /* ConfigExternalGetParameter()
171     *
172     * This functions allows a plugin to leverage the built-in ini parser to read
173     * any cfg/ini file. It will return M64ERR_SUCCESS if the item was found.
174     */
175     m64p_error function(m64p_handle, const char*, const char*, char*, int) ConfigExternalGetParameter;
176 
177     /* ConfigSendNetplayConfig()
178     *
179     * This function allows plugins to take advantage of the netplay TCP connection
180     * to send configuration data to the netplay server.
181     */
182     m64p_error function(char*, int) ConfigSendNetplayConfig;
183 
184     /* ConfigReceiveNetplayConfig()
185     *
186     * This function allows plugins to take advantage of the netplay TCP connection
187     * to receive configuration data from the netplay server.
188     */
189     m64p_error function(char*, int) ConfigReceiveNetplayConfig;
190 
191     /* ConfigOverrideUserPaths()
192     *
193     * This function allows overriding the paths returned by
194     * ConfigGetUserDataPath and ConfigGetUserCachePath
195     */
196     m64p_error function(const char*, const char*) ConfigOverrideUserPaths;