mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Fix config save-load.
This commit is contained in:
parent
306f02911b
commit
c38bd35251
|
@ -93,14 +93,24 @@ void Config_LoadConfig()
|
|||
Config_SetDefault();
|
||||
|
||||
// read configuration
|
||||
const char *filename = ConfigGetSharedDataFilepath("GLideN64.conf");
|
||||
f = fopen(filename, "r");
|
||||
const char * pConfigName = "GLideN64.cfg";
|
||||
const char * pConfigPath = ConfigGetUserConfigPath();
|
||||
const size_t nPathLen = strlen(pConfigPath);
|
||||
const size_t configNameLen = nPathLen + strlen(pConfigName) + 2;
|
||||
char * pConfigFullName = new char[configNameLen];
|
||||
strcpy(pConfigFullName, pConfigPath);
|
||||
if (pConfigPath[nPathLen-1] != '/')
|
||||
strcat(pConfigFullName, "/");
|
||||
strcat(pConfigFullName, pConfigName);
|
||||
f = fopen(pConfigFullName, "r");
|
||||
if (!f) {
|
||||
fprintf( stderr, "[GLideN64]: (WW) Couldn't open config file '%s' for reading: %s\n", filename, strerror( errno ) );
|
||||
fprintf( stderr, "[GLideN64]: (WW) Couldn't open config file '%s' for reading: %s\n", pConfigFullName, strerror( errno ) );
|
||||
fprintf( stderr, "[GLideN64]: Attempting to write new Config \n");
|
||||
Config_WriteConfig(filename);
|
||||
Config_WriteConfig(pConfigFullName);
|
||||
delete[] pConfigFullName;
|
||||
return;
|
||||
}
|
||||
delete[] pConfigFullName;
|
||||
|
||||
while (!feof( f )) {
|
||||
char *val;
|
||||
|
|
|
@ -144,6 +144,7 @@ EXPORT void CALL ReadScreen (void **dest, long *width, long *height)
|
|||
#include "m64p_plugin.h"
|
||||
|
||||
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL;
|
||||
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL;
|
||||
|
||||
void (*CheckInterrupts)( void );
|
||||
void (*renderCallback)() = NULL;
|
||||
|
@ -153,6 +154,7 @@ extern "C" {
|
|||
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context, void (*DebugCallback)(void *, int, const char *))
|
||||
{
|
||||
ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) dlsym(CoreLibHandle, "ConfigGetSharedDataFilepath");
|
||||
ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) dlsym(CoreLibHandle, "ConfigGetUserConfigPath");
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user