1433 |
|
static GtkWidget *w_ramsize; |
1434 |
|
static GtkWidget *w_rom_file; |
1435 |
|
|
1436 |
+ |
// Don't use CPU when idle? |
1437 |
+ |
static void tb_idlewait(GtkWidget *widget) |
1438 |
+ |
{ |
1439 |
+ |
PrefsReplaceBool("idlewait", GTK_TOGGLE_BUTTON(widget)->active); |
1440 |
+ |
} |
1441 |
+ |
|
1442 |
|
// "Ignore SEGV" button toggled |
1443 |
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1444 |
|
static void tb_ignoresegv(GtkWidget *widget) |
1531 |
|
|
1532 |
|
w_rom_file = table_make_file_entry(table, 4, STR_ROM_FILE_CTRL, "rom"); |
1533 |
|
|
1534 |
+ |
make_checkbox(box, STR_IDLEWAIT_CTRL, "idlewait", GTK_SIGNAL_FUNC(tb_idlewait)); |
1535 |
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1536 |
|
make_checkbox(box, STR_IGNORESEGV_CTRL, "ignoresegv", GTK_SIGNAL_FUNC(tb_ignoresegv)); |
1537 |
|
#endif |
1685 |
|
{ |
1686 |
|
D(bug("Child %d exitted with status = %x\n", sip->si_pid, sip->si_status)); |
1687 |
|
|
1688 |
< |
int status = sip->si_status; |
1688 |
> |
// XXX perform a new wait because sip->si_status is sometimes not |
1689 |
> |
// the exit _value_ on MacOS X but rather the usual status field |
1690 |
> |
// from waitpid() -- we could arrange this code in some other way... |
1691 |
> |
int status; |
1692 |
> |
if (waitpid(sip->si_pid, &status, 0) < 0) |
1693 |
> |
status = sip->si_status; |
1694 |
> |
if (WIFEXITED(status)) |
1695 |
> |
status = WEXITSTATUS(status); |
1696 |
|
if (status & 0x80) |
1697 |
|
status |= -1 ^0xff; |
1698 |
|
|
1755 |
|
} |
1756 |
|
|
1757 |
|
// Search and run the BasiliskII executable |
1758 |
< |
// XXX it can be in a bundle on MacOS X |
1758 |
> |
char *p; |
1759 |
|
strcpy(g_app_path, argv[0]); |
1760 |
< |
char *p = strrchr(g_app_path, '/'); |
1761 |
< |
p = p ? p + 1 : g_app_path; |
1762 |
< |
*p = '\0'; |
1763 |
< |
strcat(g_app_path, "BasiliskII"); |
1760 |
> |
if ((p = strstr(g_app_path, "BasiliskIIGUI.app/Contents/MacOS")) != NULL) { |
1761 |
> |
strcpy(p, "BasiliskII.app/Contents/MacOS/BasiliskII"); |
1762 |
> |
if (access(g_app_path, X_OK) < 0) { |
1763 |
> |
char str[256]; |
1764 |
> |
sprintf(str, GetString(STR_NO_B2_EXE_FOUND), g_app_path, strerror(errno)); |
1765 |
> |
WarningAlert(str); |
1766 |
> |
strcpy(g_app_path, "/Applications/BasiliskII.app/Contents/MacOS/BasiliskII"); |
1767 |
> |
} |
1768 |
> |
} else { |
1769 |
> |
p = strrchr(g_app_path, '/'); |
1770 |
> |
p = p ? p + 1 : g_app_path; |
1771 |
> |
strcpy(p, "BasiliskII"); |
1772 |
> |
} |
1773 |
|
|
1774 |
|
int pid = fork(); |
1775 |
|
if (pid == 0) { |
1776 |
+ |
D(bug("Trying to execute %s\n", g_app_path)); |
1777 |
|
execlp(g_app_path, g_app_path, "--gui-connection", gui_connection_path, (char *)NULL); |
1778 |
|
#ifdef _POSIX_PRIORITY_SCHEDULING |
1779 |
|
// XXX get a chance to run the parent process so that to not confuse/upset GTK... |