mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-26 16:31:11 +00:00
- CD-ROM under Linux only worked when a CD was in the drive when B2 was
started - Unix/main_unix.cpp: 1Hz interrupt wasn't triggered
This commit is contained in:
parent
1e8598eefa
commit
b248b687db
@ -717,7 +717,7 @@ static void one_second(void)
|
||||
// Pseudo Mac 1Hz interrupt, update local time
|
||||
WriteMacInt32(0x20c, TimerDateTime());
|
||||
|
||||
SetInterruptFlag(INTFLAG_60HZ);
|
||||
SetInterruptFlag(INTFLAG_1HZ);
|
||||
TriggerInterrupt();
|
||||
|
||||
#ifndef HAVE_PTHREADS
|
||||
|
@ -273,7 +273,7 @@ void *Sys_open(const char *name, bool read_only)
|
||||
}
|
||||
|
||||
// Open file/device
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
int fd = open(name, (read_only ? O_RDONLY : O_RDWR) | (is_cdrom ? O_NONBLOCK : 0));
|
||||
#else
|
||||
int fd = open(name, read_only ? O_RDONLY : O_RDWR);
|
||||
@ -549,6 +549,17 @@ bool SysIsDiskInserted(void *arg)
|
||||
lseek(fh->fd, 0, SEEK_SET);
|
||||
return read(fh->fd, block, 512) == 512;
|
||||
} else if (fh->is_cdrom) {
|
||||
#ifdef CDROM_MEDIA_CHANGED
|
||||
if (fh->cdrom_cap & CDC_MEDIA_CHANGED) {
|
||||
// If we don't do this, all attempts to read from a disc fail
|
||||
// once the tray has been open (altough the TOC reads fine).
|
||||
// Can somebody explain this to me?
|
||||
if (ioctl(fh->fd, CDROM_MEDIA_CHANGED) == 1) {
|
||||
close(fh->fd);
|
||||
fh->fd = open(fh->name, O_RDONLY | O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef CDROM_DRIVE_STATUS
|
||||
if (fh->cdrom_cap & CDC_DRIVE_STATUS) {
|
||||
return ioctl(fh->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) == CDS_DISC_OK;
|
||||
|
@ -185,16 +185,12 @@ static void find_hfs_partition(DriveInfo *info)
|
||||
if (Sys_read(info->fh, map, i * 512, 512) != 512)
|
||||
break;
|
||||
|
||||
// Skip driver descriptor
|
||||
uint16 sig = ntohs(((uint16 *)map)[0]);
|
||||
if (sig == 0x4552)
|
||||
continue;
|
||||
|
||||
// No partition map? Then look at next block
|
||||
// Not a partition map block? Then look at next block
|
||||
uint16 sig = (map[0] << 8) | map[1];
|
||||
if (sig != 0x504d)
|
||||
continue;
|
||||
|
||||
// Partition map found, Apple HFS partition?
|
||||
// Partition map block found, Apple HFS partition?
|
||||
if (strcmp((char *)(map + 48), "Apple_HFS") == 0) {
|
||||
info->start_byte = ntohl(((uint32 *)map)[2]) << 9;
|
||||
D(bug(" HFS partition found at %d, %d blocks\n", info->start_byte, ntohl(((uint32 *)map)[3])));
|
||||
|
Loading…
x
Reference in New Issue
Block a user