1 |
/* |
2 |
* prefs_amiga.cpp - Preferences handling, AmigaOS specifix stuff |
3 |
* |
4 |
* Basilisk II (C) 1997-1999 Christian Bauer |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#include <stdio.h> |
22 |
|
23 |
#include "sysdeps.h" |
24 |
#include "prefs.h" |
25 |
|
26 |
|
27 |
// Platform-specific preferences items |
28 |
prefs_desc platform_prefs_items[] = { |
29 |
{"sound", TYPE_STRING, false}, // Sound output mode description (audio_amiga.cpp) |
30 |
{NULL, TYPE_END, false} // End of list |
31 |
}; |
32 |
|
33 |
|
34 |
// Prefs file name |
35 |
const char PREFS_FILE_NAME[] = "ENV:BasiliskII_prefs"; |
36 |
const char PREFS_FILE_NAME_ARC[] = "ENVARC:BasiliskII_prefs"; |
37 |
|
38 |
|
39 |
/* |
40 |
* Load preferences from settings file |
41 |
*/ |
42 |
|
43 |
void LoadPrefs(void) |
44 |
{ |
45 |
// Read preferences from settings file |
46 |
FILE *f = fopen(PREFS_FILE_NAME, "r"); |
47 |
if (f != NULL) { |
48 |
|
49 |
// Prefs file found, load settings |
50 |
LoadPrefsFromStream(f); |
51 |
fclose(f); |
52 |
|
53 |
} else { |
54 |
|
55 |
// No prefs file, save defaults |
56 |
SavePrefs(); |
57 |
} |
58 |
} |
59 |
|
60 |
|
61 |
/* |
62 |
* Save preferences to settings file |
63 |
*/ |
64 |
|
65 |
void SavePrefs(void) |
66 |
{ |
67 |
FILE *f; |
68 |
if ((f = fopen(PREFS_FILE_NAME, "w")) != NULL) { |
69 |
SavePrefsToStream(f); |
70 |
fclose(f); |
71 |
} |
72 |
if ((f = fopen(PREFS_FILE_NAME_ARC, "w")) != NULL) { |
73 |
SavePrefsToStream(f); |
74 |
fclose(f); |
75 |
} |
76 |
} |
77 |
|
78 |
|
79 |
/* |
80 |
* Add defaults of platform-specific prefs items |
81 |
* You may also override the defaults set in PrefsInit() |
82 |
*/ |
83 |
|
84 |
void AddPlatformPrefsDefaults(void) |
85 |
{ |
86 |
} |