258 |
|
|
259 |
|
// Menu item descriptions |
260 |
|
static GtkItemFactoryEntry menu_items[] = { |
261 |
< |
{GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
262 |
< |
{GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
263 |
< |
{GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
264 |
< |
{GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
265 |
< |
{GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
266 |
< |
{GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, "<LastBranch>"}, |
267 |
< |
{GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} |
261 |
> |
{(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
262 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
263 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
264 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
265 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
266 |
> |
{(gchar *)GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, "<LastBranch>"}, |
267 |
> |
{(gchar *)GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} |
268 |
|
}; |
269 |
|
|
270 |
|
bool PrefsEditor(void) |
291 |
|
GtkWidget *notebook = gtk_notebook_new(); |
292 |
|
gtk_widget_show(notebook); |
293 |
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); |
294 |
< |
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE); |
294 |
> |
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), FALSE); |
295 |
|
gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, 0); |
296 |
|
|
297 |
|
create_volumes_pane(notebook); |
318 |
|
* "Volumes" pane |
319 |
|
*/ |
320 |
|
|
321 |
< |
static GtkWidget *volume_list; |
321 |
> |
static GtkWidget *volume_list, *w_extfs; |
322 |
|
static int selected_volume; |
323 |
|
|
324 |
|
// Volume in list selected |
420 |
|
gtk_clist_get_text(GTK_CLIST(volume_list), i, 0, &str); |
421 |
|
PrefsAddString("disk", str); |
422 |
|
} |
423 |
+ |
|
424 |
+ |
PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs))); |
425 |
|
} |
426 |
|
|
427 |
|
// Create "Volumes" pane |
438 |
|
gtk_widget_show(volume_list); |
439 |
|
gtk_clist_set_selection_mode(GTK_CLIST(volume_list), GTK_SELECTION_SINGLE); |
440 |
|
gtk_clist_set_shadow_type(GTK_CLIST(volume_list), GTK_SHADOW_NONE); |
441 |
+ |
gtk_clist_set_reorderable(GTK_CLIST(volume_list), true); |
442 |
|
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL); |
443 |
|
char *str; |
444 |
|
int32 index = 0; |
457 |
|
make_button_box(box, 0, buttons); |
458 |
|
make_separator(box); |
459 |
|
|
460 |
+ |
w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs"); |
461 |
+ |
|
462 |
|
static const opt_desc options[] = { |
463 |
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)}, |
464 |
|
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)}, |
525 |
|
static int display_type; |
526 |
|
static int dis_width, dis_height; |
527 |
|
|
528 |
+ |
#if ENABLE_FBDEV_DGA |
529 |
+ |
static GtkWidget *w_fbdev_name, *w_fbdevice_file; |
530 |
+ |
static GtkWidget *l_fbdev_name, *l_fbdevice_file; |
531 |
+ |
static char fbdev_name[256]; |
532 |
+ |
#endif |
533 |
+ |
|
534 |
|
// Hide/show graphics widgets |
535 |
|
static void hide_show_graphics_widgets(void) |
536 |
|
{ |
537 |
|
switch (display_type) { |
538 |
|
case DISPLAY_WINDOW: |
539 |
|
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip); |
540 |
+ |
#if ENABLE_FBDEV_DGA |
541 |
|
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x); |
542 |
|
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y); |
543 |
+ |
gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name); |
544 |
+ |
#endif |
545 |
|
break; |
546 |
|
case DISPLAY_SCREEN: |
547 |
|
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip); |
548 |
+ |
#if ENABLE_FBDEV_DGA |
549 |
|
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x); |
550 |
|
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y); |
551 |
+ |
gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name); |
552 |
+ |
#endif |
553 |
|
break; |
554 |
|
} |
555 |
|
} |
588 |
|
display_type = DISPLAY_WINDOW; |
589 |
|
dis_width = 512; |
590 |
|
dis_height = 384; |
591 |
+ |
#if ENABLE_FBDEV_DGA |
592 |
+ |
fbdev_name[0] = 0; |
593 |
+ |
#endif |
594 |
|
|
595 |
|
const char *str = PrefsFindString("screen"); |
596 |
|
if (str) { |
597 |
|
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) |
598 |
|
display_type = DISPLAY_WINDOW; |
599 |
< |
else if (strcmp(str, "dga") == 0) |
599 |
> |
#if ENABLE_FBDEV_DGA |
600 |
> |
else if (sscanf(str, "dga/%255s", fbdev_name) == 1) |
601 |
> |
#else |
602 |
> |
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) |
603 |
> |
#endif |
604 |
|
display_type = DISPLAY_SCREEN; |
605 |
|
} |
606 |
|
} |
622 |
|
sprintf(pref, "win/%d/%d", dis_width, dis_height); |
623 |
|
break; |
624 |
|
case DISPLAY_SCREEN: |
625 |
< |
strcpy(pref, "dga"); |
625 |
> |
#if ENABLE_FBDEV_DGA |
626 |
> |
str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name)); |
627 |
> |
sprintf(pref, "dga/%s", str); |
628 |
> |
#else |
629 |
> |
sprintf(pref, "dga/%d/%d", dis_width, dis_height); |
630 |
> |
#endif |
631 |
|
break; |
632 |
|
default: |
633 |
|
PrefsRemoveItem("screen"); |
639 |
|
// Create "Graphics/Sound" pane |
640 |
|
static void create_graphics_pane(GtkWidget *top) |
641 |
|
{ |
642 |
< |
GtkWidget *box, *table, *label, *opt, *menu; |
642 |
> |
GtkWidget *box, *table, *label, *opt, *menu, *combo; |
643 |
|
char str[32]; |
644 |
|
|
645 |
|
parse_graphics_prefs(); |
646 |
|
|
647 |
|
box = make_pane(top, STR_GRAPHICS_SOUND_PANE_TITLE); |
648 |
< |
table = make_table(box, 2, 4); |
648 |
> |
table = make_table(box, 2, 5); |
649 |
|
|
650 |
|
label = gtk_label_new(GetString(STR_VIDEO_TYPE_CTRL)); |
651 |
|
gtk_widget_show(label); |
708 |
|
gtk_widget_show(l_display_x); |
709 |
|
gtk_table_attach(GTK_TABLE(table), l_display_x, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
710 |
|
|
711 |
< |
w_display_x = gtk_entry_new(); |
712 |
< |
gtk_widget_show(w_display_x); |
713 |
< |
sprintf(str, "%d", dis_width); |
714 |
< |
gtk_entry_set_text(GTK_ENTRY(w_display_x), str); |
715 |
< |
gtk_table_attach(GTK_TABLE(table), w_display_x, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
711 |
> |
combo = gtk_combo_new(); |
712 |
> |
gtk_widget_show(combo); |
713 |
> |
GList *glist1 = NULL; |
714 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_512_LAB)); |
715 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_640_LAB)); |
716 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_800_LAB)); |
717 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_1024_LAB)); |
718 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_MAX_LAB)); |
719 |
> |
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist1); |
720 |
> |
if (dis_width) |
721 |
> |
sprintf(str, "%d", dis_width); |
722 |
> |
else |
723 |
> |
strcpy(str, GetString(STR_SIZE_MAX_LAB)); |
724 |
> |
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
725 |
> |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
726 |
> |
w_display_x = GTK_COMBO(combo)->entry; |
727 |
|
|
728 |
|
l_display_y = gtk_label_new(GetString(STR_DISPLAY_Y_CTRL)); |
729 |
|
gtk_widget_show(l_display_y); |
730 |
|
gtk_table_attach(GTK_TABLE(table), l_display_y, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
731 |
|
|
732 |
< |
w_display_y = gtk_entry_new(); |
733 |
< |
gtk_widget_show(w_display_y); |
734 |
< |
sprintf(str, "%d", dis_height); |
735 |
< |
gtk_entry_set_text(GTK_ENTRY(w_display_y), str); |
736 |
< |
gtk_table_attach(GTK_TABLE(table), w_display_y, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
732 |
> |
combo = gtk_combo_new(); |
733 |
> |
gtk_widget_show(combo); |
734 |
> |
GList *glist2 = NULL; |
735 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_384_LAB)); |
736 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_480_LAB)); |
737 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_600_LAB)); |
738 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_768_LAB)); |
739 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_MAX_LAB)); |
740 |
> |
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist2); |
741 |
> |
if (dis_height) |
742 |
> |
sprintf(str, "%d", dis_height); |
743 |
> |
else |
744 |
> |
strcpy(str, GetString(STR_SIZE_MAX_LAB)); |
745 |
> |
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
746 |
> |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
747 |
> |
w_display_y = GTK_COMBO(combo)->entry; |
748 |
> |
|
749 |
> |
#if ENABLE_FBDEV_DGA |
750 |
> |
l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL)); |
751 |
> |
gtk_widget_show(l_fbdev_name); |
752 |
> |
gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
753 |
> |
|
754 |
> |
w_fbdev_name = gtk_entry_new(); |
755 |
> |
gtk_widget_show(w_fbdev_name); |
756 |
> |
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name); |
757 |
> |
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
758 |
> |
|
759 |
> |
w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
760 |
> |
#endif |
761 |
|
|
762 |
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); |
763 |
|
|
808 |
|
if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) { |
809 |
|
#elif defined(__FreeBSD__) |
810 |
|
if (strncmp(de->d_name, "cuaa", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { |
811 |
+ |
#elif defined(__NetBSD__) |
812 |
+ |
if (strncmp(de->d_name, "tty0", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { |
813 |
|
#elif defined(sgi) |
814 |
|
if (strncmp(de->d_name, "ttyf", 4) == 0 || strncmp(de->d_name, "plp", 3) == 0) { |
815 |
|
#else |
825 |
|
if (glist) |
826 |
|
g_list_sort(glist, gl_str_cmp); |
827 |
|
else |
828 |
< |
glist = g_list_append(glist, "<none>"); |
828 |
> |
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
829 |
|
return glist; |
830 |
|
} |
831 |
|
|
845 |
|
struct ifreq req, *ifr = ifc.ifc_req; |
846 |
|
for (int i=0; i<ifc.ifc_len; i+=sizeof(ifreq), ifr++) { |
847 |
|
req = *ifr; |
848 |
< |
#if defined(__FreeBSD__) || defined(sgi) |
848 |
> |
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(sgi) |
849 |
|
if (ioctl(s, SIOCGIFADDR, &req) == 0 && (req.ifr_addr.sa_family == ARPHRD_ETHER || req.ifr_addr.sa_family == ARPHRD_ETHER+1)) { |
850 |
< |
#else |
850 |
> |
#elif defined(__linux__) |
851 |
|
if (ioctl(s, SIOCGIFHWADDR, &req) == 0 && req.ifr_hwaddr.sa_family == ARPHRD_ETHER) { |
852 |
+ |
#else |
853 |
+ |
if (false) { |
854 |
|
#endif |
855 |
|
char *str = new char[64]; |
856 |
|
strncpy(str, ifr->ifr_name, 63); |
863 |
|
if (glist) |
864 |
|
g_list_sort(glist, gl_str_cmp); |
865 |
|
else |
866 |
< |
glist = g_list_append(glist, "<none>"); |
866 |
> |
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
867 |
|
return glist; |
868 |
|
} |
869 |
|
|
933 |
|
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);} |
934 |
|
static void mn_modelid_14(...) {PrefsReplaceInt32("modelid", 14);} |
935 |
|
|
936 |
+ |
// CPU/FPU type |
937 |
+ |
static void mn_cpu_68020(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", false);} |
938 |
+ |
static void mn_cpu_68020_fpu(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", true);} |
939 |
+ |
static void mn_cpu_68030(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", false);} |
940 |
+ |
static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);} |
941 |
+ |
static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);} |
942 |
+ |
|
943 |
|
// "Use Raw Keycodes" button toggled |
944 |
|
static void tb_keycodes(GtkWidget *widget) |
945 |
|
{ |
967 |
|
// Create "Memory/Misc" pane |
968 |
|
static void create_memory_pane(GtkWidget *top) |
969 |
|
{ |
970 |
< |
GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *opt, *menu; |
970 |
> |
GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *menu; |
971 |
|
|
972 |
|
box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); |
973 |
|
|
1009 |
|
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
1010 |
|
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1011 |
|
|
1012 |
< |
static const opt_desc options[] = { |
1012 |
> |
static const opt_desc model_options[] = { |
1013 |
|
{STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)}, |
1014 |
|
{STR_MODELID_14_LAB, GTK_SIGNAL_FUNC(mn_modelid_14)}, |
1015 |
|
{0, NULL} |
1019 |
|
case 5: active = 0; break; |
1020 |
|
case 14: active = 1; break; |
1021 |
|
} |
1022 |
< |
menu = make_option_menu(box, STR_MODELID_CTRL, options, active); |
1022 |
> |
make_option_menu(box, STR_MODELID_CTRL, model_options, active); |
1023 |
> |
|
1024 |
> |
static const opt_desc cpu_options[] = { |
1025 |
> |
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)}, |
1026 |
> |
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)}, |
1027 |
> |
{STR_CPU_68030_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030)}, |
1028 |
> |
{STR_CPU_68030_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030_fpu)}, |
1029 |
> |
{STR_CPU_68040_LAB, GTK_SIGNAL_FUNC(mn_cpu_68040)}, |
1030 |
> |
{0, NULL} |
1031 |
> |
}; |
1032 |
> |
int cpu = PrefsFindInt32("cpu"); |
1033 |
> |
bool fpu = PrefsFindBool("fpu"); |
1034 |
> |
active = 0; |
1035 |
> |
switch (cpu) { |
1036 |
> |
case 2: active = fpu ? 1 : 0; break; |
1037 |
> |
case 3: active = fpu ? 3 : 2; break; |
1038 |
> |
case 4: active = 4; |
1039 |
> |
} |
1040 |
> |
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1041 |
|
|
1042 |
|
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1043 |
|
|