updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / supermodel / multiuser.patch
blob9cb93e02c67456851c9b20571a922329f48c47f2
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
4 @@ -307,7 +307,6 @@
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" \
11 ";\n"
12 @@ -315,9 +314,13 @@
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
21 CINIFile INI;
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");
25 INI.Parse();
27 @@ -338,9 +341,9 @@
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);
33 else
34 - printf("Configuration successfully saved to '%s'.\n", CONFIG_FILE_PATH);
35 + printf("Configuration successfully saved to '%s'.\n", configFilePath);
37 else
38 puts("Configuration aborted...");
39 @@ -412,9 +415,13 @@
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"));
47 CINIFile INI;
49 - INI.Open(CONFIG_FILE_PATH);
50 + INI.Open(configFilePath);
51 INI.SetDefaultSectionName("Global"); // required to read settings not associated with a specific section
52 INI.Parse();
53 ApplySettings(&INI, section);
54 @@ -498,10 +505,10 @@
55 static void SaveState(CModel3 *Model3)
57 CBlockFile SaveState;
58 - char filePath[24];
59 + char filePath[512];
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);
67 @@ -522,11 +529,11 @@
68 static void LoadState(CModel3 *Model3)
70 CBlockFile SaveState;
71 - char filePath[24];
72 + char filePath[512];
73 int fileVersion;
75 // Generate file path
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))
81 @@ -558,10 +565,10 @@
82 static void SaveNVRAM(CModel3 *Model3)
84 CBlockFile NVRAM;
85 - char filePath[24];
86 + char filePath[512];
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);
94 @@ -581,11 +588,11 @@
95 static void LoadNVRAM(CModel3 *Model3)
97 CBlockFile NVRAM;
98 - char filePath[24];
99 + char filePath[512];
100 int fileVersion;
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))