--- SheepShaver/src/Unix/prefs_unix.cpp 2002/02/04 16:58:13 1.1 +++ SheepShaver/src/Unix/prefs_unix.cpp 2009/07/23 19:12:51 1.12 @@ -1,7 +1,7 @@ /* * prefs_unix.cpp - Preferences handling, Unix specific things * - * SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig + * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,18 @@ // Platform-specific preferences items prefs_desc platform_prefs_items[] = { - {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, + {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, + {"etherconfig", TYPE_STRING, false, "path of network config script"}, + {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, + {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, + {"mousewheelmode", TYPE_INT32, false, "mouse wheel support mode (0=page up/down, 1=cursor up/down)"}, + {"mousewheellines", TYPE_INT32, false, "number of lines to scroll in mouse wheel mode 1"}, + {"dsp", TYPE_STRING, false, "audio output (dsp) device name"}, + {"mixer", TYPE_STRING, false, "audio mixer device name"}, +#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION + {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, +#endif + {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, {NULL, TYPE_END, false, NULL} // End of list }; @@ -43,8 +54,20 @@ static char prefs_path[1024]; * Load preferences from settings file */ -void LoadPrefs(void) +void LoadPrefs(const char *vmdir) { + if (vmdir) { + snprintf(prefs_path, sizeof(prefs_path), "%s/prefs", vmdir); + FILE *prefs = fopen(prefs_path, "r"); + if (!prefs) { + printf("No file at %s found.\n", prefs_path); + exit(1); + } + LoadPrefsFromStream(prefs); + fclose(prefs); + return; + } + // Construct prefs path prefs_path[0] = 0; char *home = getenv("HOME"); @@ -91,7 +114,27 @@ void SavePrefs(void) void AddPlatformPrefsDefaults(void) { + PrefsAddBool("keycodes", false); PrefsReplaceString("extfs", "/"); - PrefsAddInt32("windowmodes", 3); - PrefsAddInt32("screenmodes", 0x3f); + PrefsReplaceInt32("mousewheelmode", 1); + PrefsReplaceInt32("mousewheellines", 3); +#ifdef __linux__ + if (access("/dev/sound/dsp", F_OK) == 0) { + PrefsReplaceString("dsp", "/dev/sound/dsp"); + } else { + PrefsReplaceString("dsp", "/dev/dsp"); + } + if (access("/dev/sound/mixer", F_OK) == 0) { + PrefsReplaceString("mixer", "/dev/sound/mixer"); + } else { + PrefsReplaceString("mixer", "/dev/mixer"); + } +#else + PrefsReplaceString("dsp", "/dev/dsp"); + PrefsReplaceString("mixer", "/dev/mixer"); +#endif +#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION + PrefsAddBool("ignoresegv", false); +#endif + PrefsAddBool("idlewait", true); }