--- SheepShaver/src/Unix/prefs_unix.cpp 2005/03/28 09:05:28 1.9 +++ 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-2005 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 @@ -54,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"); @@ -107,12 +119,15 @@ void AddPlatformPrefsDefaults(void) PrefsReplaceInt32("mousewheelmode", 1); PrefsReplaceInt32("mousewheellines", 3); #ifdef __linux__ - if (access("/dev/.devfsd", F_OK) < 0) { - PrefsReplaceString("dsp", "/dev/dsp"); - PrefsReplaceString("mixer", "/dev/mixer"); - } else { + 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");