--- BasiliskII/src/cdrom.cpp 2001/07/01 14:38:02 1.12 +++ BasiliskII/src/cdrom.cpp 2002/02/07 16:10:54 1.17 @@ -1,7 +1,7 @@ /* * cdrom.cpp - CD-ROM driver * - * Basilisk II (C) 1997-2001 Christian Bauer + * Basilisk II (C) 1997-2002 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,8 @@ * Technote FL 36: "Apple Extensions to ISO 9660" */ +#include "sysdeps.h" + #include #include @@ -35,7 +37,6 @@ using std::vector; #endif -#include "sysdeps.h" #include "cpu_emulation.h" #include "main.h" #include "macos_util.h" @@ -132,7 +133,7 @@ struct cdrom_drive_info { void *fh; // File handle int block_size; // CD-ROM block size int twok_offset; // Offset of beginning of 2K block to last Prime position - uint32 start_byte; // Start of HFS partition on disk + loff_t start_byte; // Start of HFS partition on disk bool to_be_mounted; // Flag: drive must be mounted in accRun bool mount_non_hfs; // Flag: Issue disk-inserted events for non-HFS disks @@ -192,8 +193,9 @@ static void find_hfs_partition(cdrom_dri // 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]))); + info.start_byte = (loff_t)((map[8] << 24) | (map[9] << 16) | (map[10] << 8) | map[11]) << 9; + uint32 num_blocks = (map[12] << 24) | (map[13] << 16) | (map[14] << 8) | map[15]; + D(bug(" HFS partition found at %d, %d blocks\n", info.start_byte, num_blocks)); break; } } @@ -664,7 +666,7 @@ int16 CDROMControl(uint32 pb, uint32 dce return offLinErr; uint8 start_m, start_s, start_f; - if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) + if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) return paramErr; info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f; if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2])) @@ -681,12 +683,12 @@ int16 CDROMControl(uint32 pb, uint32 dce if (ReadMacInt16(pb + csParam + 6)) { // Given stopping address - if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) + if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) return paramErr; } else { // Given starting address uint8 start_m, start_s, start_f; - if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) + if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) return paramErr; info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f; if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2])) @@ -723,7 +725,7 @@ int16 CDROMControl(uint32 pb, uint32 dce return paramErr; } else { // Given stopping address - if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) + if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) return paramErr; } return noErr; @@ -768,7 +770,7 @@ int16 CDROMControl(uint32 pb, uint32 dce return offLinErr; uint8 start_m, start_s, start_f; - if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) + if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) return paramErr; if (!SysCDScan(info->fh, start_m, start_s, start_f, ReadMacInt16(pb + csParam + 6)))