From b9b0b5248b74e8fb2a34b8064c0ce379a7f8016c Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sat, 27 Dec 2003 10:02:33 +0000 Subject: [PATCH] Merge in dsp, mixer, ignoresegv prefs items from Basilisk II. Audio output does not work with NewWorld ROMs yet. --- SheepShaver/src/Unix/prefs_editor_gtk.cpp | 18 +++++++++++++++ SheepShaver/src/Unix/prefs_unix.cpp | 26 +++++++++++++++++++--- SheepShaver/src/Unix/user_strings_unix.cpp | 2 ++ SheepShaver/src/Unix/user_strings_unix.h | 2 ++ 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/SheepShaver/src/Unix/prefs_editor_gtk.cpp b/SheepShaver/src/Unix/prefs_editor_gtk.cpp index 55da4ff7..e9f044e0 100644 --- a/SheepShaver/src/Unix/prefs_editor_gtk.cpp +++ b/SheepShaver/src/Unix/prefs_editor_gtk.cpp @@ -546,6 +546,8 @@ static void create_jit_pane(GtkWidget *top) static GtkWidget *w_frameskip; +static GtkWidget *w_dspdevice_file, *w_mixerdevice_file; + // "5 Hz".."60Hz" selected static void mn_5hz(...) {PrefsReplaceInt32("frameskip", 12);} static void mn_7hz(...) {PrefsReplaceInt32("frameskip", 8);} @@ -619,15 +621,26 @@ static void tb_fs1600x1200(GtkWidget *widget) PrefsReplaceInt32("screenmodes", PrefsFindInt32("screenmodes") & ~32); } +// Set sensitivity of widgets +static void set_graphics_sensitive(void) +{ + const bool sound_enabled = !PrefsFindBool("nosound"); + gtk_widget_set_sensitive(w_dspdevice_file, sound_enabled); + gtk_widget_set_sensitive(w_mixerdevice_file, sound_enabled); +} + // "Disable Sound Output" button toggled static void tb_nosound(GtkWidget *widget) { PrefsReplaceBool("nosound", GTK_TOGGLE_BUTTON(widget)->active); + set_graphics_sensitive(); } // Read settings from widgets and set preferences static void read_graphics_settings(void) { + PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file)); + PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file)); } // Create "Graphics/Sound" pane @@ -675,7 +688,12 @@ static void create_graphics_pane(GtkWidget *top) make_checkbox(vbox, STR_1280x1024_CTRL, PrefsFindInt32("screenmodes") & 16, GTK_SIGNAL_FUNC(tb_fs1280x1024)); make_checkbox(vbox, STR_1600x1200_CTRL, PrefsFindInt32("screenmodes") & 32, GTK_SIGNAL_FUNC(tb_fs1600x1200)); + make_separator(box); make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); + w_dspdevice_file = make_entry(box, STR_DSPDEVICE_FILE_CTRL, "dsp"); + w_mixerdevice_file = make_entry(box, STR_MIXERDEVICE_FILE_CTRL, "mixer"); + + set_graphics_sensitive(); } diff --git a/SheepShaver/src/Unix/prefs_unix.cpp b/SheepShaver/src/Unix/prefs_unix.cpp index 1d2583e6..be802718 100644 --- a/SheepShaver/src/Unix/prefs_unix.cpp +++ b/SheepShaver/src/Unix/prefs_unix.cpp @@ -29,9 +29,14 @@ // Platform-specific preferences items prefs_desc platform_prefs_items[] = { - {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, - {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, - {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, + {"ether", TYPE_STRING, false, "device name of Mac ethernet adapter"}, + {"keycodes", TYPE_BOOLEAN, false, "use keycodes rather than keysyms to decode keyboard"}, + {"keycodefile", TYPE_STRING, false, "path of keycode translation file"}, + {"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 {NULL, TYPE_END, false, NULL} // End of list }; @@ -97,4 +102,19 @@ void AddPlatformPrefsDefaults(void) PrefsReplaceString("extfs", "/"); PrefsAddInt32("windowmodes", 3); PrefsAddInt32("screenmodes", 0x3f); +#ifdef __linux__ + if (access("/dev/.devfsd", F_OK) < 0) { + PrefsReplaceString("dsp", "/dev/dsp"); + PrefsReplaceString("mixer", "/dev/mixer"); + } else { + PrefsReplaceString("dsp", "/dev/sound/dsp"); + PrefsReplaceString("mixer", "/dev/sound/mixer"); + } +#else + PrefsReplaceString("dsp", "/dev/dsp"); + PrefsReplaceString("mixer", "/dev/mixer"); +#endif +#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION + PrefsAddBool("ignoresegv", false); +#endif } diff --git a/SheepShaver/src/Unix/user_strings_unix.cpp b/SheepShaver/src/Unix/user_strings_unix.cpp index f85bd24d..05beedd5 100644 --- a/SheepShaver/src/Unix/user_strings_unix.cpp +++ b/SheepShaver/src/Unix/user_strings_unix.cpp @@ -64,6 +64,8 @@ user_string_def platform_strings[] = { {STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit SheepShaver"}, {STR_HELP_MENU_GTK, "/_Help"}, {STR_HELP_ITEM_ABOUT_GTK, "/Help/_About SheepShaver"}, + {STR_DSPDEVICE_FILE_CTRL, "Audio Output Device"}, + {STR_MIXERDEVICE_FILE_CTRL, "Audio Mixer Device"}, {STR_INPUT_PANE_TITLE, "Keyboard"}, {STR_KEYCODES_CTRL, "Use Raw Keycodes"}, {STR_KEYCODE_FILE_CTRL, "Keycode Translation File"}, diff --git a/SheepShaver/src/Unix/user_strings_unix.h b/SheepShaver/src/Unix/user_strings_unix.h index bc432fd8..ba0e1c88 100644 --- a/SheepShaver/src/Unix/user_strings_unix.h +++ b/SheepShaver/src/Unix/user_strings_unix.h @@ -59,6 +59,8 @@ enum { STR_HELP_MENU_GTK, STR_HELP_ITEM_ABOUT_GTK, STR_SUSPEND_WINDOW_TITLE, + STR_DSPDEVICE_FILE_CTRL, + STR_MIXERDEVICE_FILE_CTRL, STR_INPUT_PANE_TITLE, STR_KEYCODES_CTRL, STR_KEYCODE_FILE_CTRL