1 |
|
/* |
2 |
|
* prefs_unix.cpp - Preferences handling, Unix specific things |
3 |
|
* |
4 |
< |
* SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig |
4 |
> |
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig |
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 |
29 |
|
|
30 |
|
// Platform-specific preferences items |
31 |
|
prefs_desc platform_prefs_items[] = { |
32 |
< |
{"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, |
32 |
> |
{"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, |
33 |
> |
{"etherconfig", TYPE_STRING, false, "path of network config script"}, |
34 |
> |
{"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, |
35 |
> |
{"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, |
36 |
> |
{"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, |
37 |
> |
{"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, |
38 |
> |
{"dsp", TYPE_STRING, false, "audio output (dsp) device name"}, |
39 |
> |
{"mixer", TYPE_STRING, false, "audio mixer device name"}, |
40 |
> |
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
41 |
> |
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, |
42 |
> |
#endif |
43 |
> |
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, |
44 |
|
{NULL, TYPE_END, false, NULL} // End of list |
45 |
|
}; |
46 |
|
|
54 |
|
* Load preferences from settings file |
55 |
|
*/ |
56 |
|
|
57 |
< |
void LoadPrefs(void) |
57 |
> |
void LoadPrefs(const char *vmdir) |
58 |
|
{ |
59 |
+ |
if (vmdir) { |
60 |
+ |
snprintf(prefs_path, sizeof(prefs_path), "%s/prefs", vmdir); |
61 |
+ |
FILE *prefs = fopen(prefs_path, "r"); |
62 |
+ |
if (!prefs) { |
63 |
+ |
printf("No file at %s found.\n", prefs_path); |
64 |
+ |
exit(1); |
65 |
+ |
} |
66 |
+ |
LoadPrefsFromStream(prefs); |
67 |
+ |
fclose(prefs); |
68 |
+ |
return; |
69 |
+ |
} |
70 |
+ |
|
71 |
|
// Construct prefs path |
72 |
|
prefs_path[0] = 0; |
73 |
|
char *home = getenv("HOME"); |
114 |
|
|
115 |
|
void AddPlatformPrefsDefaults(void) |
116 |
|
{ |
117 |
+ |
PrefsAddBool("keycodes", false); |
118 |
|
PrefsReplaceString("extfs", "/"); |
119 |
< |
PrefsAddInt32("windowmodes", 3); |
120 |
< |
PrefsAddInt32("screenmodes", 0x3f); |
119 |
> |
PrefsReplaceInt32("mousewheelmode", 1); |
120 |
> |
PrefsReplaceInt32("mousewheellines", 3); |
121 |
> |
#ifdef __linux__ |
122 |
> |
if (access("/dev/sound/dsp", F_OK) == 0) { |
123 |
> |
PrefsReplaceString("dsp", "/dev/sound/dsp"); |
124 |
> |
} else { |
125 |
> |
PrefsReplaceString("dsp", "/dev/dsp"); |
126 |
> |
} |
127 |
> |
if (access("/dev/sound/mixer", F_OK) == 0) { |
128 |
> |
PrefsReplaceString("mixer", "/dev/sound/mixer"); |
129 |
> |
} else { |
130 |
> |
PrefsReplaceString("mixer", "/dev/mixer"); |
131 |
> |
} |
132 |
> |
#else |
133 |
> |
PrefsReplaceString("dsp", "/dev/dsp"); |
134 |
> |
PrefsReplaceString("mixer", "/dev/mixer"); |
135 |
> |
#endif |
136 |
> |
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
137 |
> |
PrefsAddBool("ignoresegv", false); |
138 |
> |
#endif |
139 |
> |
PrefsAddBool("idlewait", true); |
140 |
|
} |