1 |
|
/* |
2 |
|
* cdrom.cpp - CD-ROM driver |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2002 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
28 |
|
* Technote FL 36: "Apple Extensions to ISO 9660" |
29 |
|
*/ |
30 |
|
|
31 |
+ |
#include "sysdeps.h" |
32 |
+ |
|
33 |
|
#include <string.h> |
34 |
|
#include <vector> |
35 |
|
|
37 |
|
using std::vector; |
38 |
|
#endif |
39 |
|
|
38 |
– |
#include "sysdeps.h" |
40 |
|
#include "cpu_emulation.h" |
41 |
|
#include "main.h" |
42 |
|
#include "macos_util.h" |
133 |
|
void *fh; // File handle |
134 |
|
int block_size; // CD-ROM block size |
135 |
|
int twok_offset; // Offset of beginning of 2K block to last Prime position |
136 |
< |
uint32 start_byte; // Start of HFS partition on disk |
136 |
> |
loff_t start_byte; // Start of HFS partition on disk |
137 |
|
bool to_be_mounted; // Flag: drive must be mounted in accRun |
138 |
|
bool mount_non_hfs; // Flag: Issue disk-inserted events for non-HFS disks |
139 |
|
|
193 |
|
|
194 |
|
// Partition map block found, Apple HFS partition? |
195 |
|
if (strcmp((char *)(map + 48), "Apple_HFS") == 0) { |
196 |
< |
info.start_byte = ntohl(((uint32 *)map)[2]) << 9; |
197 |
< |
D(bug(" HFS partition found at %d, %d blocks\n", info.start_byte, ntohl(((uint32 *)map)[3]))); |
196 |
> |
info.start_byte = (loff_t)((map[8] << 24) | (map[9] << 16) | (map[10] << 8) | map[11]) << 9; |
197 |
> |
uint32 num_blocks = (map[12] << 24) | (map[13] << 16) | (map[14] << 8) | map[15]; |
198 |
> |
D(bug(" HFS partition found at %d, %d blocks\n", info.start_byte, num_blocks)); |
199 |
|
break; |
200 |
|
} |
201 |
|
} |
666 |
|
return offLinErr; |
667 |
|
|
668 |
|
uint8 start_m, start_s, start_f; |
669 |
< |
if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) |
669 |
> |
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) |
670 |
|
return paramErr; |
671 |
|
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f; |
672 |
|
if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2])) |
683 |
|
|
684 |
|
if (ReadMacInt16(pb + csParam + 6)) { |
685 |
|
// Given stopping address |
686 |
< |
if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) |
686 |
> |
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) |
687 |
|
return paramErr; |
688 |
|
} else { |
689 |
|
// Given starting address |
690 |
|
uint8 start_m, start_s, start_f; |
691 |
< |
if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) |
691 |
> |
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) |
692 |
|
return paramErr; |
693 |
|
info->play_mode = ReadMacInt8(pb + csParam + 9) & 0x0f; |
694 |
|
if (!SysCDPlay(info->fh, start_m, start_s, start_f, info->stop_at[0], info->stop_at[1], info->stop_at[2])) |
725 |
|
return paramErr; |
726 |
|
} else { |
727 |
|
// Given stopping address |
728 |
< |
if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) |
728 |
> |
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), true, info->stop_at[0], info->stop_at[1], info->stop_at[2])) |
729 |
|
return paramErr; |
730 |
|
} |
731 |
|
return noErr; |
770 |
|
return offLinErr; |
771 |
|
|
772 |
|
uint8 start_m, start_s, start_f; |
773 |
< |
if (!position2msf(info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) |
773 |
> |
if (!position2msf(*info, ReadMacInt16(pb + csParam), ReadMacInt32(pb + csParam + 2), false, start_m, start_s, start_f)) |
774 |
|
return paramErr; |
775 |
|
|
776 |
|
if (!SysCDScan(info->fh, start_m, start_s, start_f, ReadMacInt16(pb + csParam + 6))) |