52 |
|
|
53 |
|
|
54 |
|
/* |
55 |
+ |
* SheepShaver glue |
56 |
+ |
*/ |
57 |
+ |
|
58 |
+ |
#ifdef SHEEPSHAVER |
59 |
+ |
#define DISABLE_SCSI 1 |
60 |
+ |
#define PROGRAM_NAME "SheepShaver" |
61 |
+ |
enum { |
62 |
+ |
STR_WINDOW_LAB = STR_WINDOW_CTRL, |
63 |
+ |
STR_FULLSCREEN_LAB = STR_FULLSCREEN_CTRL, |
64 |
+ |
STR_SERIALA_CTRL = STR_SERPORTA_CTRL, |
65 |
+ |
STR_SERIALB_CTRL = STR_SERPORTB_CTRL, |
66 |
+ |
}; |
67 |
+ |
#else |
68 |
+ |
#define PROGRAM_NAME "BasiliskII" |
69 |
+ |
#endif |
70 |
+ |
|
71 |
+ |
|
72 |
+ |
/* |
73 |
|
* Utility functions |
74 |
|
*/ |
75 |
|
|
408 |
|
|
409 |
|
char str[512]; |
410 |
|
sprintf(str, |
411 |
< |
"Basilisk II\nVersion %d.%d\n\n" |
411 |
> |
PROGRAM_NAME "\nVersion %d.%d\n\n" |
412 |
|
"Copyright (C) 1997-2005 Christian Bauer et al.\n" |
413 |
< |
"E-mail: Christian.Bauer@uni-mainz.de\n" |
414 |
< |
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" |
415 |
< |
"Basilisk II comes with ABSOLUTELY NO\n" |
413 |
> |
"E-mail: cb@cebix.net\n" |
414 |
> |
#ifdef SHEEPSHAVER |
415 |
> |
"http://sheepshaver.cebix.net/\n\n" |
416 |
> |
#else |
417 |
> |
"http://basilisk.cebix.net/\n\n" |
418 |
> |
#endif |
419 |
> |
PROGRAM_NAME " comes with ABSOLUTELY NO\n" |
420 |
|
"WARRANTY. This is free software, and\n" |
421 |
|
"you are welcome to redistribute it\n" |
422 |
|
"under the terms of the GNU General\n" |
695 |
|
* "JIT Compiler" pane |
696 |
|
*/ |
697 |
|
|
698 |
+ |
#ifndef SHEEPSHAVER |
699 |
|
static GtkWidget *w_jit_fpu; |
700 |
|
static GtkWidget *w_jit_atraps; |
701 |
|
static GtkWidget *w_jit_cache_size; |
702 |
|
static GtkWidget *w_jit_lazy_flush; |
703 |
|
static GtkWidget *w_jit_follow_const_jumps; |
704 |
+ |
#endif |
705 |
|
|
706 |
|
// Set sensitivity of widgets |
707 |
|
static void set_jit_sensitive(void) |
708 |
|
{ |
709 |
+ |
#ifndef SHEEPSHAVER |
710 |
|
const bool jit_enabled = PrefsFindBool("jit"); |
711 |
|
gtk_widget_set_sensitive(w_jit_fpu, jit_enabled); |
712 |
|
gtk_widget_set_sensitive(w_jit_cache_size, jit_enabled); |
713 |
|
gtk_widget_set_sensitive(w_jit_lazy_flush, jit_enabled); |
714 |
|
gtk_widget_set_sensitive(w_jit_follow_const_jumps, jit_enabled); |
715 |
+ |
#endif |
716 |
|
} |
717 |
|
|
718 |
|
// "Use JIT Compiler" button toggled |
723 |
|
} |
724 |
|
|
725 |
|
// "Compile FPU Instructions" button toggled |
726 |
+ |
#ifndef SHEEPSHAVER |
727 |
|
static void tb_jit_fpu(GtkWidget *widget) |
728 |
|
{ |
729 |
|
PrefsReplaceBool("jitfpu", GTK_TOGGLE_BUTTON(widget)->active); |
730 |
|
} |
731 |
+ |
#endif |
732 |
|
|
733 |
|
// "Lazy translation cache invalidation" button toggled |
734 |
+ |
#ifndef SHEEPSHAVER |
735 |
|
static void tb_jit_lazy_flush(GtkWidget *widget) |
736 |
|
{ |
737 |
|
PrefsReplaceBool("jitlazyflush", GTK_TOGGLE_BUTTON(widget)->active); |
738 |
|
} |
739 |
+ |
#endif |
740 |
|
|
741 |
|
// "Translate through constant jumps (inline blocks)" button toggled |
742 |
+ |
#ifndef SHEEPSHAVER |
743 |
|
static void tb_jit_follow_const_jumps(GtkWidget *widget) |
744 |
|
{ |
745 |
|
PrefsReplaceBool("jitinline", GTK_TOGGLE_BUTTON(widget)->active); |
746 |
|
} |
747 |
+ |
#endif |
748 |
|
|
749 |
|
// Read settings from widgets and set preferences |
750 |
|
static void read_jit_settings(void) |
752 |
|
#if USE_JIT |
753 |
|
bool jit_enabled = PrefsFindBool("jit"); |
754 |
|
if (jit_enabled) { |
755 |
+ |
#ifndef SHEEPSHAVER |
756 |
|
const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_jit_cache_size)->entry)); |
757 |
|
PrefsReplaceInt32("jitcachesize", atoi(str)); |
758 |
+ |
#endif |
759 |
|
} |
760 |
|
#endif |
761 |
|
} |
762 |
|
|
763 |
+ |
// "Use built-in 68k DR emulator" button toggled |
764 |
+ |
#ifdef SHEEPSHAVER |
765 |
+ |
static void tb_jit_68k(GtkWidget *widget) |
766 |
+ |
{ |
767 |
+ |
PrefsReplaceBool("jit68k", GTK_TOGGLE_BUTTON(widget)->active); |
768 |
+ |
} |
769 |
+ |
#endif |
770 |
+ |
|
771 |
|
// Create "JIT Compiler" pane |
772 |
|
static void create_jit_pane(GtkWidget *top) |
773 |
|
{ |
778 |
|
box = make_pane(top, STR_JIT_PANE_TITLE); |
779 |
|
make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit)); |
780 |
|
|
781 |
+ |
#ifndef SHEEPSHAVER |
782 |
|
w_jit_fpu = make_checkbox(box, STR_JIT_FPU_CTRL, "jitfpu", GTK_SIGNAL_FUNC(tb_jit_fpu)); |
783 |
|
|
784 |
|
// Translation cache size |
796 |
|
|
797 |
|
// Follow constant jumps (inline basic blocks) |
798 |
|
w_jit_follow_const_jumps = make_checkbox(box, STR_JIT_FOLLOW_CONST_JUMPS, "jitinline", GTK_SIGNAL_FUNC(tb_jit_follow_const_jumps)); |
799 |
+ |
#endif |
800 |
|
|
801 |
|
set_jit_sensitive(); |
802 |
|
#endif |
803 |
+ |
|
804 |
+ |
#ifdef SHEEPSHAVER |
805 |
+ |
make_checkbox(box, STR_JIT_68K_CTRL, "jit68k", GTK_SIGNAL_FUNC(tb_jit_68k)); |
806 |
+ |
#endif |
807 |
|
} |
808 |
|
|
809 |
|
/* |
815 |
|
// Read settings from widgets and set preferences |
816 |
|
static void read_scsi_settings(void) |
817 |
|
{ |
818 |
+ |
#ifndef DISABLE_SCSI |
819 |
|
for (int id=0; id<7; id++) { |
820 |
|
char prefs_name[32]; |
821 |
|
sprintf(prefs_name, "scsi%d", id); |
825 |
|
else |
826 |
|
PrefsRemoveItem(prefs_name); |
827 |
|
} |
828 |
+ |
#endif |
829 |
|
} |
830 |
|
|
831 |
|
// Create "SCSI" pane |
832 |
|
static void create_scsi_pane(GtkWidget *top) |
833 |
|
{ |
834 |
+ |
#ifndef DISABLE_SCSI |
835 |
|
GtkWidget *box; |
836 |
|
|
837 |
|
box = make_pane(top, STR_SCSI_PANE_TITLE); |
841 |
|
sprintf(prefs_name, "scsi%d", id); |
842 |
|
w_scsi[id] = make_file_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
843 |
|
} |
844 |
+ |
#endif |
845 |
|
} |
846 |
|
|
847 |
|
|
897 |
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} |
898 |
|
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);} |
899 |
|
|
900 |
+ |
// QuickDraw acceleration |
901 |
+ |
#ifdef SHEEPSHAVER |
902 |
+ |
static void tb_gfxaccel(GtkWidget *widget) |
903 |
+ |
{ |
904 |
+ |
PrefsReplaceBool("gfxaccel", GTK_TOGGLE_BUTTON(widget)->active); |
905 |
+ |
} |
906 |
+ |
#endif |
907 |
+ |
|
908 |
|
// Set sensitivity of widgets |
909 |
|
static void set_graphics_sensitive(void) |
910 |
|
{ |
922 |
|
static void parse_graphics_prefs(void) |
923 |
|
{ |
924 |
|
display_type = DISPLAY_WINDOW; |
925 |
+ |
#ifdef SHEEPSHAVER |
926 |
+ |
dis_width = 640; |
927 |
+ |
dis_height = 480; |
928 |
+ |
#else |
929 |
|
dis_width = 512; |
930 |
|
dis_height = 384; |
931 |
+ |
#endif |
932 |
|
|
933 |
|
const char *str = PrefsFindString("screen"); |
934 |
|
if (str) { |
1068 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
1069 |
|
w_display_y = GTK_COMBO(combo)->entry; |
1070 |
|
|
1071 |
+ |
#ifdef SHEEPSHAVER |
1072 |
+ |
make_checkbox(box, STR_GFXACCEL_CTRL, "gfxaccel", GTK_SIGNAL_FUNC(tb_gfxaccel)); |
1073 |
+ |
#endif |
1074 |
+ |
|
1075 |
|
make_separator(box); |
1076 |
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); |
1077 |
|
|
1329 |
|
GList *glist = NULL; |
1330 |
|
|
1331 |
|
// TODO: Get list of all Ethernet interfaces |
1263 |
– |
#ifdef HAVE_SLIRP |
1264 |
– |
static const char s_slirp[] = "slirp"; |
1265 |
– |
glist = g_list_append(glist, (void *)s_slirp); |
1266 |
– |
#endif |
1332 |
|
glist = g_list_append(glist, (void *)s_nat_router); |
1333 |
|
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
1334 |
|
return glist; |
1404 |
|
static GtkWidget *w_ramsize; |
1405 |
|
static GtkWidget *w_rom_file; |
1406 |
|
|
1407 |
+ |
// Don't use CPU when idle? |
1408 |
+ |
#ifdef SHEEPSHAVER |
1409 |
+ |
static void tb_idlewait(GtkWidget *widget) |
1410 |
+ |
{ |
1411 |
+ |
PrefsReplaceBool("idlewait", GTK_TOGGLE_BUTTON(widget)->active); |
1412 |
+ |
} |
1413 |
+ |
#endif |
1414 |
+ |
|
1415 |
|
// "Ignore SEGV" button toggled |
1416 |
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1417 |
|
static void tb_ignoresegv(GtkWidget *widget) |
1454 |
|
table = make_table(box, 2, 5); |
1455 |
|
|
1456 |
|
static const combo_desc options[] = { |
1457 |
+ |
#ifndef SHEEPSHAVER |
1458 |
|
STR_RAMSIZE_2MB_LAB, |
1459 |
+ |
#endif |
1460 |
|
STR_RAMSIZE_4MB_LAB, |
1461 |
|
STR_RAMSIZE_8MB_LAB, |
1462 |
|
STR_RAMSIZE_16MB_LAB, |
1465 |
|
STR_RAMSIZE_128MB_LAB, |
1466 |
|
STR_RAMSIZE_256MB_LAB, |
1467 |
|
STR_RAMSIZE_512MB_LAB, |
1468 |
+ |
#ifndef SHEEPSHAVER |
1469 |
|
STR_RAMSIZE_1024MB_LAB, |
1470 |
+ |
#endif |
1471 |
|
0 |
1472 |
|
}; |
1473 |
|
char default_ramsize[10]; |
1474 |
|
sprintf(default_ramsize, "%d", PrefsFindInt32("ramsize") >> 20); |
1475 |
|
w_ramsize = table_make_combobox(table, 0, STR_RAMSIZE_CTRL, default_ramsize, options); |
1476 |
|
|
1477 |
+ |
#ifndef SHEEPSHAVER |
1478 |
|
static const opt_desc model_options[] = { |
1479 |
|
{STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)}, |
1480 |
|
{STR_MODELID_14_LAB, GTK_SIGNAL_FUNC(mn_modelid_14)}, |
1486 |
|
case 14: active = 1; break; |
1487 |
|
} |
1488 |
|
table_make_option_menu(table, 2, STR_MODELID_CTRL, model_options, active); |
1489 |
+ |
#endif |
1490 |
|
|
1491 |
|
#if EMULATED_68K |
1492 |
|
static const opt_desc cpu_options[] = { |
1513 |
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1514 |
|
make_checkbox(box, STR_IGNORESEGV_CTRL, "ignoresegv", GTK_SIGNAL_FUNC(tb_ignoresegv)); |
1515 |
|
#endif |
1516 |
+ |
|
1517 |
+ |
#ifdef SHEEPSHAVER |
1518 |
+ |
make_checkbox(box, STR_IDLEWAIT_CTRL, "idlewait", GTK_SIGNAL_FUNC(tb_idlewait)); |
1519 |
+ |
#endif |
1520 |
|
} |
1521 |
|
|
1522 |
|
|
1592 |
|
// Exit preferences |
1593 |
|
PrefsExit(); |
1594 |
|
|
1595 |
< |
// Transfer control to the Basilisk II executable |
1595 |
> |
// Transfer control to the executable |
1596 |
|
if (start) { |
1597 |
|
char path[_MAX_PATH]; |
1598 |
|
bool ok = GetModuleFileName(NULL, path, sizeof(path)) != 0; |
1602 |
|
*++p = '\0'; |
1603 |
|
SetCurrentDirectory(path); |
1604 |
|
strcpy(b2_path, path); |
1605 |
< |
strcat(b2_path, "BasiliskII.exe"); |
1605 |
> |
strcat(b2_path, PROGRAM_NAME); |
1606 |
> |
strcat(b2_path, ".exe"); |
1607 |
|
HINSTANCE h = ShellExecute(GetDesktopWindow(), "open", |
1608 |
|
b2_path, "", path, SW_SHOWNORMAL); |
1609 |
|
if ((int)h <= 32) |
1610 |
|
ok = false; |
1611 |
|
} |
1612 |
|
if (!ok) { |
1613 |
< |
ErrorAlert("Coult not start BasiliskII executable"); |
1613 |
> |
ErrorAlert("Coult not start " PROGRAM_NAME " executable"); |
1614 |
|
return 1; |
1615 |
|
} |
1616 |
|
} |