1 |
/* |
2 |
* prefs_amiga.cpp - Preferences handling, AmigaOS specifix stuff |
3 |
* |
4 |
* Basilisk II (C) 1997-2001 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"}, |
30 |
{"scsimemtype", TYPE_INT32, false, "SCSI buffer memory type"}, |
31 |
{NULL, TYPE_END, false, NULL} // End of list |
32 |
}; |
33 |
|
34 |
|
35 |
// Prefs file name |
36 |
const char PREFS_FILE_NAME[] = "ENV:BasiliskII_prefs"; |
37 |
const char PREFS_FILE_NAME_ARC[] = "ENVARC:BasiliskII_prefs"; |
38 |
|
39 |
|
40 |
/* |
41 |
* Load preferences from settings file |
42 |
*/ |
43 |
|
44 |
void LoadPrefs(void) |
45 |
{ |
46 |
// Read preferences from settings file |
47 |
FILE *f = fopen(PREFS_FILE_NAME, "r"); |
48 |
if (f != NULL) { |
49 |
|
50 |
// Prefs file found, load settings |
51 |
LoadPrefsFromStream(f); |
52 |
fclose(f); |
53 |
|
54 |
} else { |
55 |
|
56 |
// No prefs file, save defaults |
57 |
SavePrefs(); |
58 |
} |
59 |
} |
60 |
|
61 |
|
62 |
/* |
63 |
* Save preferences to settings file |
64 |
*/ |
65 |
|
66 |
void SavePrefs(void) |
67 |
{ |
68 |
FILE *f; |
69 |
if ((f = fopen(PREFS_FILE_NAME, "w")) != NULL) { |
70 |
SavePrefsToStream(f); |
71 |
fclose(f); |
72 |
} |
73 |
if ((f = fopen(PREFS_FILE_NAME_ARC, "w")) != NULL) { |
74 |
SavePrefsToStream(f); |
75 |
fclose(f); |
76 |
} |
77 |
} |
78 |
|
79 |
|
80 |
/* |
81 |
* Add defaults of platform-specific prefs items |
82 |
* You may also override the defaults set in PrefsInit() |
83 |
*/ |
84 |
|
85 |
void AddPlatformPrefsDefaults(void) |
86 |
{ |
87 |
PrefsReplaceString("extfs", "WORK:"); |
88 |
PrefsAddInt32("scsimemtype", 0); |
89 |
} |