Save input map files to /config/inputs/

* Save input map files to /config/inputs/
(old folder is still compatible, will revert if file not found)

* Reverted label to "undefine"
This commit is contained in:
Newsdee
2019-11-07 22:53:16 +08:00
committed by sorgelig
parent e8290adc5e
commit bbbc20f7eb
3 changed files with 24 additions and 3 deletions

View File

@@ -543,6 +543,14 @@ int FileSaveConfig(const char *name, void *pBuffer, int size)
return FileSave(path, pBuffer, size);
}
int FileSaveJoymap(const char *name, void *pBuffer, int size)
{
char path[256] = { CONFIG_DIR"/inputs/" };
FileCreatePath(path);
strcat(path, name);
return FileSave(path, pBuffer, size);
}
int FileLoad(const char *name, void *pBuffer, int size)
{
if (name[0] != '/') sprintf(full_path, "%s/%s", getRootDir(), name);
@@ -589,6 +597,16 @@ int FileLoadConfig(const char *name, void *pBuffer, int size)
return FileLoad(path, pBuffer, size);
}
int FileLoadJoymap(const char *name, void *pBuffer, int size)
{
char path[256] = { CONFIG_DIR"/inputs/" };
strcat(path, name);
int ret = FileLoad(path, pBuffer, size);
if (!ret)
return FileLoadConfig(name, pBuffer, size);
return ret;
}
int FileExists(const char *name)
{
return isPathRegularFile(name);