1 diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp
2 --- a/Src/OSD/SDL/Main.cpp
3 +++ b/Src/OSD/SDL/Main.cpp
5 Configuration file management and input settings.
6 ******************************************************************************/
8 -#define CONFIG_FILE_PATH "Config/Supermodel.ini"
9 #define CONFIG_FILE_COMMENT ";\n" \
10 "; Supermodel Configuration File\n" \
13 // Create and configure inputs
14 static bool ConfigureInputs(CInputs *Inputs, bool configure)
16 + char configFilePath[512];
18 + sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
20 // Open and parse configuration file
22 - INI.Open(CONFIG_FILE_PATH); // doesn't matter if it exists or not, will get overwritten
23 + INI.Open(configFilePath); // doesn't matter if it exists or not, will get overwritten
24 INI.SetDefaultSectionName("Global");
28 Inputs->WriteToINIFile(&INI, "Global");
30 if (OKAY != INI.Write(CONFIG_FILE_COMMENT))
31 - ErrorLog("Unable to save configuration to '%s'.", CONFIG_FILE_PATH);
32 + ErrorLog("Unable to save configuration to '%s'.", configFilePath);
34 - printf("Configuration successfully saved to '%s'.\n", CONFIG_FILE_PATH);
35 + printf("Configuration successfully saved to '%s'.\n", configFilePath);
38 puts("Configuration aborted...");
40 // Read settings (from a specific section) from the config file
41 static void ReadConfigFile(const char *section)
43 + char configFilePath[512];
45 + sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
49 - INI.Open(CONFIG_FILE_PATH);
50 + INI.Open(configFilePath);
51 INI.SetDefaultSectionName("Global"); // required to read settings not associated with a specific section
53 ApplySettings(&INI, section);
55 static void SaveState(CModel3 *Model3)
60 int fileVersion = STATE_FILE_VERSION;
62 - sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
63 + sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
64 if (OKAY != SaveState.Create(filePath, "Supermodel Save State", "Supermodel Version " SUPERMODEL_VERSION))
66 ErrorLog("Unable to save state to '%s'.", filePath);
68 static void LoadState(CModel3 *Model3)
76 - sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
77 + sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
79 // Open and check to make sure format is correct
80 if (OKAY != SaveState.Load(filePath))
82 static void SaveNVRAM(CModel3 *Model3)
87 int fileVersion = NVRAM_FILE_VERSION;
89 - sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
90 + sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
91 if (OKAY != NVRAM.Create(filePath, "Supermodel NVRAM State", "Supermodel Version " SUPERMODEL_VERSION))
93 ErrorLog("Unable to save NVRAM to '%s'. Make sure directory exists!", filePath);
95 static void LoadNVRAM(CModel3 *Model3)
102 // Generate file path
103 - sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
104 + sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
106 // Open and check to make sure format is correct
107 if (OKAY != NVRAM.Load(filePath))