summaryrefslogtreecommitdiff
path: root/pcr/supermodel/multiuser.patch
blob: 9cb93e02c67456851c9b20571a922329f48c47f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp
--- a/Src/OSD/SDL/Main.cpp
+++ b/Src/OSD/SDL/Main.cpp
@@ -307,7 +307,6 @@
  Configuration file management and input settings.
 ******************************************************************************/
 
-#define CONFIG_FILE_PATH	"Config/Supermodel.ini"
 #define CONFIG_FILE_COMMENT	";\n" \
 							"; Supermodel Configuration File\n" \
 							";\n"
@@ -315,9 +314,13 @@
 // Create and configure inputs
 static bool ConfigureInputs(CInputs *Inputs, bool configure)
 {
+	char		configFilePath[512];
+	
+	sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
+	
 	// Open and parse configuration file
 	CINIFile INI;
-	INI.Open(CONFIG_FILE_PATH);	// doesn't matter if it exists or not, will get overwritten
+	INI.Open(configFilePath);	// doesn't matter if it exists or not, will get overwritten
 	INI.SetDefaultSectionName("Global");
 	INI.Parse();
 	
@@ -338,9 +341,9 @@
 			Inputs->WriteToINIFile(&INI, "Global");
 		
 			if (OKAY != INI.Write(CONFIG_FILE_COMMENT))
-				ErrorLog("Unable to save configuration to '%s'.", CONFIG_FILE_PATH);
+				ErrorLog("Unable to save configuration to '%s'.", configFilePath);
 			else
-				printf("Configuration successfully saved to '%s'.\n", CONFIG_FILE_PATH);
+				printf("Configuration successfully saved to '%s'.\n", configFilePath);
 		}
 		else
 			puts("Configuration aborted...");
@@ -412,9 +415,13 @@
 // Read settings (from a specific section) from the config file
 static void ReadConfigFile(const char *section)
 {
+	char		configFilePath[512];
+	
+	sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
+	
 	CINIFile	INI;	
 	
-	INI.Open(CONFIG_FILE_PATH);
+	INI.Open(configFilePath);
 	INI.SetDefaultSectionName("Global");	// required to read settings not associated with a specific section
 	INI.Parse();
 	ApplySettings(&INI, section);
@@ -498,10 +505,10 @@
 static void SaveState(CModel3 *Model3)
 {
 	CBlockFile	SaveState;
-	char		filePath[24];
+	char		filePath[512];
 	int			fileVersion = STATE_FILE_VERSION;
 	
-	sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
+	sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
 	if (OKAY != SaveState.Create(filePath, "Supermodel Save State", "Supermodel Version " SUPERMODEL_VERSION))
 	{
 		ErrorLog("Unable to save state to '%s'.", filePath);
@@ -522,11 +529,11 @@
 static void LoadState(CModel3 *Model3)
 {
 	CBlockFile	SaveState;
-	char		filePath[24];
+	char		filePath[512];
 	int			fileVersion;
 	
 	// Generate file path
-	sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
+	sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
 	
 	// Open and check to make sure format is correct
 	if (OKAY != SaveState.Load(filePath))
@@ -558,10 +565,10 @@
 static void SaveNVRAM(CModel3 *Model3)
 {
 	CBlockFile	NVRAM;
-	char		filePath[24];
+	char		filePath[512];
 	int			fileVersion = NVRAM_FILE_VERSION;
 	
-	sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
+	sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
 	if (OKAY != NVRAM.Create(filePath, "Supermodel NVRAM State", "Supermodel Version " SUPERMODEL_VERSION))
 	{
 		ErrorLog("Unable to save NVRAM to '%s'. Make sure directory exists!", filePath);
@@ -581,11 +588,11 @@
 static void LoadNVRAM(CModel3 *Model3)
 {
 	CBlockFile	NVRAM;
-	char		filePath[24];
+	char		filePath[512];
 	int			fileVersion;
 	
 	// Generate file path
-	sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
+	sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
 	
 	// Open and check to make sure format is correct
 	if (OKAY != NVRAM.Load(filePath))