mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-18 11:29:47 +00:00
- added fbdev DGA preferences to GTK prefs editor
This commit is contained in:
parent
733f3a7335
commit
d6b83e4715
@ -525,15 +525,31 @@ static GtkWidget *l_frameskip, *l_display_x, *l_display_y;
|
||||
static int display_type;
|
||||
static int dis_width, dis_height;
|
||||
|
||||
#if ENABLE_FBDEV_DGA
|
||||
static GtkWidget *w_fbdev_name, *w_fbdevice_file;
|
||||
static GtkWidget *l_fbdev_name, *l_fbdevice_file;
|
||||
static char fbdev_name[256];
|
||||
#endif
|
||||
|
||||
// Hide/show graphics widgets
|
||||
static void hide_show_graphics_widgets(void)
|
||||
{
|
||||
switch (display_type) {
|
||||
case DISPLAY_WINDOW:
|
||||
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip);
|
||||
#if ENABLE_FBDEV_DGA
|
||||
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x);
|
||||
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y);
|
||||
gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name);
|
||||
#endif
|
||||
break;
|
||||
case DISPLAY_SCREEN:
|
||||
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip);
|
||||
#if ENABLE_FBDEV_DGA
|
||||
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x);
|
||||
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y);
|
||||
gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -572,12 +588,19 @@ static void parse_graphics_prefs(void)
|
||||
display_type = DISPLAY_WINDOW;
|
||||
dis_width = 512;
|
||||
dis_height = 384;
|
||||
#if ENABLE_FBDEV_DGA
|
||||
fbdev_name[0] = 0;
|
||||
#endif
|
||||
|
||||
const char *str = PrefsFindString("screen");
|
||||
if (str) {
|
||||
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
|
||||
display_type = DISPLAY_WINDOW;
|
||||
#if ENABLE_FBDEV_DGA
|
||||
else if (sscanf(str, "dga/%255s", fbdev_name) == 1)
|
||||
#else
|
||||
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2)
|
||||
#endif
|
||||
display_type = DISPLAY_SCREEN;
|
||||
}
|
||||
}
|
||||
@ -599,7 +622,12 @@ static void read_graphics_settings(void)
|
||||
sprintf(pref, "win/%d/%d", dis_width, dis_height);
|
||||
break;
|
||||
case DISPLAY_SCREEN:
|
||||
#if ENABLE_FBDEV_DGA
|
||||
str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name));
|
||||
sprintf(pref, "dga/%s", str);
|
||||
#else
|
||||
sprintf(pref, "dga/%d/%d", dis_width, dis_height);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
PrefsRemoveItem("screen");
|
||||
@ -617,7 +645,7 @@ static void create_graphics_pane(GtkWidget *top)
|
||||
parse_graphics_prefs();
|
||||
|
||||
box = make_pane(top, STR_GRAPHICS_SOUND_PANE_TITLE);
|
||||
table = make_table(box, 2, 4);
|
||||
table = make_table(box, 2, 5);
|
||||
|
||||
label = gtk_label_new(GetString(STR_VIDEO_TYPE_CTRL));
|
||||
gtk_widget_show(label);
|
||||
@ -718,6 +746,19 @@ static void create_graphics_pane(GtkWidget *top)
|
||||
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
|
||||
w_display_y = GTK_COMBO(combo)->entry;
|
||||
|
||||
#if ENABLE_FBDEV_DGA
|
||||
l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL));
|
||||
gtk_widget_show(l_fbdev_name);
|
||||
gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
|
||||
|
||||
w_fbdev_name = gtk_entry_new();
|
||||
gtk_widget_show(w_fbdev_name);
|
||||
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name);
|
||||
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
|
||||
|
||||
w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile");
|
||||
#endif
|
||||
|
||||
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
|
||||
|
||||
hide_show_graphics_widgets();
|
||||
|
@ -30,6 +30,7 @@
|
||||
prefs_desc platform_prefs_items[] = {
|
||||
{"keycodes", TYPE_BOOLEAN, false}, // Use keycodes rather than keysyms to decode keyboard (video_x.cpp)
|
||||
{"keycodefile", TYPE_STRING, false}, // File name of keycode translation table (video_x.cpp)
|
||||
{"fbdevicefile", TYPE_STRING, false}, // File name of frame buffer device specifications
|
||||
{NULL, TYPE_END, false} // End of list
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,7 @@ user_string_def platform_strings[] = {
|
||||
{STR_NO_FBDEVICE_FILE_ERR, "Cannot open frame buffer device specification file %s (%s)."},
|
||||
{STR_FBDEV_NAME_ERR, "The %s frame buffer is not supported in %d bit mode."},
|
||||
{STR_FBDEV_MMAP_ERR, "Cannot mmap() the frame buffer memory (%s)."},
|
||||
|
||||
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
|
||||
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
|
||||
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
|
||||
@ -45,6 +46,7 @@ user_string_def platform_strings[] = {
|
||||
{STR_AUDIO_FORMAT_WARN, "Audio hardware doesn't support signed 16 bit format. Audio output will be disabled."},
|
||||
{STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."},
|
||||
{STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},
|
||||
|
||||
{STR_PREFS_MENU_FILE_GTK, "/_File"},
|
||||
{STR_PREFS_ITEM_START_GTK, "/File/_Start Basilisk II"},
|
||||
{STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
|
||||
@ -53,6 +55,9 @@ user_string_def platform_strings[] = {
|
||||
{STR_HELP_MENU_GTK, "/_Help"},
|
||||
{STR_HELP_ITEM_ABOUT_GTK, "/Help/_About Basilisk II"},
|
||||
|
||||
{STR_FBDEV_NAME_CTRL, "Frame Buffer Name"},
|
||||
{STR_FBDEVICE_FILE_CTRL, "Frame Buffer Spec File"},
|
||||
|
||||
{-1, NULL} // End marker
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,10 @@ enum {
|
||||
STR_PREFS_ITEM_SEPL_GTK,
|
||||
STR_PREFS_ITEM_QUIT_GTK,
|
||||
STR_HELP_MENU_GTK,
|
||||
STR_HELP_ITEM_ABOUT_GTK
|
||||
STR_HELP_ITEM_ABOUT_GTK,
|
||||
|
||||
STR_FBDEV_NAME_CTRL,
|
||||
STR_FBDEVICE_FILE_CTRL
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -350,7 +350,7 @@ static bool init_fbdev_dga(char *in_fb_name)
|
||||
}
|
||||
|
||||
// Get fbdevices file path from preferences
|
||||
const char *fbd_path = PrefsFindString("fbdevices");
|
||||
const char *fbd_path = PrefsFindString("fbdevicefile");
|
||||
|
||||
// Open fbdevices file
|
||||
FILE *fp = fopen(fbd_path ? fbd_path : FBDEVICES_FILE_NAME, "r");
|
||||
@ -377,7 +377,7 @@ static bool init_fbdev_dga(char *in_fb_name)
|
||||
if ((line[0] == '#') || (line[0] == ';') || (line[0] == '\0'))
|
||||
continue;
|
||||
|
||||
if ((sscanf(line, "%s %d %x", &fb_name, &fb_depth, &fb_offset) == 3)
|
||||
if ((sscanf(line, "%19s %d %x", &fb_name, &fb_depth, &fb_offset) == 3)
|
||||
&& (strcmp(fb_name, in_fb_name) == 0) && (fb_depth == max_depth)) {
|
||||
device_found = true;
|
||||
break;
|
||||
@ -708,7 +708,7 @@ bool VideoInit(bool classic)
|
||||
if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2)
|
||||
display_type = DISPLAY_WINDOW;
|
||||
#if ENABLE_FBDEV_DGA
|
||||
else if (has_dga && sscanf(mode_str, "dga/%s", fb_name) == 1) {
|
||||
else if (has_dga && sscanf(mode_str, "dga/%19s", fb_name) == 1) {
|
||||
#else
|
||||
else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) {
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user