mirror of
https://github.com/mupen64plus/mupen64plus-ui-console.git
synced 2025-04-02 10:52:34 -04:00
save configuration (if desired) right before running game
Currently, plugins frequently call ConfigSaveSection(), which results in the configuration being rewritten. I intend to submit patches to remove these calls. In exchange, the front-end should save the configuration at the latest safe opportunity, to capture any changes before most chances of crashes, power outages, kill -9, etc.
This commit is contained in:
parent
5c1e2e8f0a
commit
0bb63fe6f5
3 changed files with 10 additions and 0 deletions
|
@ -80,6 +80,7 @@ ptr_ConfigGetParamString ConfigGetParamString = NULL;
|
|||
ptr_ConfigExternalOpen ConfigExternalOpen = NULL;
|
||||
ptr_ConfigExternalClose ConfigExternalClose = NULL;
|
||||
ptr_ConfigExternalGetParameter ConfigExternalGetParameter = NULL;
|
||||
ptr_ConfigHasUnsavedChanges ConfigHasUnsavedChanges = NULL;
|
||||
|
||||
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL;
|
||||
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL;
|
||||
|
@ -268,6 +269,7 @@ m64p_error AttachCoreLib(const char *CoreLibFilepath)
|
|||
ConfigExternalOpen = (ptr_ConfigExternalOpen) osal_dynlib_getproc(CoreHandle, "ConfigExternalOpen");
|
||||
ConfigExternalClose = (ptr_ConfigExternalClose) osal_dynlib_getproc(CoreHandle, "ConfigExternalClose");
|
||||
ConfigExternalGetParameter = (ptr_ConfigExternalGetParameter) osal_dynlib_getproc(CoreHandle, "ConfigExternalGetParameter");
|
||||
ConfigHasUnsavedChanges = (ptr_ConfigHasUnsavedChanges) osal_dynlib_getproc(CoreHandle, "ConfigHasUnsavedChanges");
|
||||
|
||||
ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) osal_dynlib_getproc(CoreHandle, "ConfigGetSharedDataFilepath");
|
||||
ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserConfigPath");
|
||||
|
@ -337,6 +339,7 @@ m64p_error DetachCoreLib(void)
|
|||
ConfigExternalOpen = NULL;
|
||||
ConfigExternalClose = NULL;
|
||||
ConfigExternalGetParameter = NULL;
|
||||
ConfigHasUnsavedChanges = NULL;
|
||||
|
||||
ConfigGetSharedDataFilepath = NULL;
|
||||
ConfigGetUserDataPath = NULL;
|
||||
|
|
|
@ -73,6 +73,7 @@ extern ptr_ConfigGetParamString ConfigGetParamString;
|
|||
extern ptr_ConfigExternalOpen ConfigExternalOpen;
|
||||
extern ptr_ConfigExternalClose ConfigExternalClose;
|
||||
extern ptr_ConfigExternalGetParameter ConfigExternalGetParameter;
|
||||
extern ptr_ConfigHasUnsavedChanges ConfigHasUnsavedChanges;
|
||||
|
||||
extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath;
|
||||
extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath;
|
||||
|
|
|
@ -1065,6 +1065,12 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Save the configuration file again, if necessary, to capture updated
|
||||
parameters from plugins. This is the last opportunity to save changes
|
||||
before the relatively long-running game. */
|
||||
if (l_SaveOptions && (*ConfigHasUnsavedChanges)(NULL))
|
||||
(*ConfigSaveFile)();
|
||||
|
||||
/* run the game */
|
||||
(*CoreDoCommand)(M64CMD_EXECUTE, 0, NULL);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue