1999-10-03 14:16:26 +00:00
|
|
|
/*
|
|
|
|
* prefs_amiga.cpp - Preferences handling, AmigaOS specifix stuff
|
|
|
|
*
|
2002-01-15 14:58:43 +00:00
|
|
|
* Basilisk II (C) 1997-2002 Christian Bauer
|
1999-10-03 14:16:26 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "sysdeps.h"
|
|
|
|
#include "prefs.h"
|
|
|
|
|
|
|
|
|
|
|
|
// Platform-specific preferences items
|
|
|
|
prefs_desc platform_prefs_items[] = {
|
2001-04-01 12:11:45 +00:00
|
|
|
{"sound", TYPE_STRING, false, "sound output mode description"},
|
2001-05-24 14:31:07 +00:00
|
|
|
{"scsimemtype", TYPE_INT32, false, "SCSI buffer memory type"},
|
2001-04-01 12:11:45 +00:00
|
|
|
{NULL, TYPE_END, false, NULL} // End of list
|
1999-10-03 14:16:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Prefs file name
|
|
|
|
const char PREFS_FILE_NAME[] = "ENV:BasiliskII_prefs";
|
|
|
|
const char PREFS_FILE_NAME_ARC[] = "ENVARC:BasiliskII_prefs";
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Load preferences from settings file
|
|
|
|
*/
|
|
|
|
|
|
|
|
void LoadPrefs(void)
|
|
|
|
{
|
|
|
|
// Read preferences from settings file
|
|
|
|
FILE *f = fopen(PREFS_FILE_NAME, "r");
|
|
|
|
if (f != NULL) {
|
|
|
|
|
|
|
|
// Prefs file found, load settings
|
|
|
|
LoadPrefsFromStream(f);
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// No prefs file, save defaults
|
|
|
|
SavePrefs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save preferences to settings file
|
|
|
|
*/
|
|
|
|
|
|
|
|
void SavePrefs(void)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
if ((f = fopen(PREFS_FILE_NAME, "w")) != NULL) {
|
|
|
|
SavePrefsToStream(f);
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
if ((f = fopen(PREFS_FILE_NAME_ARC, "w")) != NULL) {
|
|
|
|
SavePrefsToStream(f);
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add defaults of platform-specific prefs items
|
|
|
|
* You may also override the defaults set in PrefsInit()
|
|
|
|
*/
|
|
|
|
|
|
|
|
void AddPlatformPrefsDefaults(void)
|
|
|
|
{
|
1999-10-21 22:40:04 +00:00
|
|
|
PrefsReplaceString("extfs", "WORK:");
|
2001-05-24 14:31:07 +00:00
|
|
|
PrefsAddInt32("scsimemtype", 0);
|
1999-10-03 14:16:26 +00:00
|
|
|
}
|