annotate src/cdrom/macosx/SDL_syscdrom.c @ 4190:386181851388 SDL-1.2

Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 12 Sep 2009 15:06:16 +0000
parents a1b03ba2fcd0
children
rev   line source
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 1793
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1126
diff changeset
6 modify it under the terms of the GNU Lesser General Public
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1126
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1126
diff changeset
13 Lesser General Public License for more details.
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1126
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1126
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1126
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
22 #include "SDL_config.h"
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
1635
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
24 #ifdef SDL_CDROM_MACOSX
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
25
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include "SDL_syscdrom_c.h"
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #pragma mark -- Globals --
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 static FSRef** tracks;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 static FSVolumeRefNum* volumes;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 static CDstatus status;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 static int nextTrackFrame;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 static int nextTrackFramesRemaining;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 static int fakeCD;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 static int currentTrack;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 static int didReadTOC;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 static int cacheTOCNumTracks;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 static int currentDrive; /* Only allow 1 drive in use at a time */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #pragma mark -- Prototypes --
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 static const char *SDL_SYS_CDName (int drive);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 static int SDL_SYS_CDOpen (int drive);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 static int SDL_SYS_CDGetTOC (SDL_CD *cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 static CDstatus SDL_SYS_CDStatus (SDL_CD *cdrom, int *position);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 static int SDL_SYS_CDPlay (SDL_CD *cdrom, int start, int length);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 static int SDL_SYS_CDPause (SDL_CD *cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 static int SDL_SYS_CDResume (SDL_CD *cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 static int SDL_SYS_CDStop (SDL_CD *cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 static int SDL_SYS_CDEject (SDL_CD *cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 static void SDL_SYS_CDClose (SDL_CD *cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 #pragma mark -- Helper Functions --
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 /* Read a list of tracks from the volume */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 static int LoadTracks (SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 /* Check if tracks are already loaded */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 if ( tracks[cdrom->id] != NULL )
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 /* Allocate memory for tracks */
1338
604d73db6802 Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
64 tracks[cdrom->id] = (FSRef*) SDL_calloc (1, sizeof(**tracks) * cdrom->numtracks);
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 if (tracks[cdrom->id] == NULL) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 SDL_OutOfMemory ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 /* Load tracks */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 if (ListTrackFiles (volumes[cdrom->id], tracks[cdrom->id], cdrom->numtracks) < 0)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 /* Find a file for a given start frame and length */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 static FSRef* GetFileForOffset (SDL_CD *cdrom, int start, int length, int *outStartFrame, int *outStopFrame)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 int i;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 for (i = 0; i < cdrom->numtracks; i++) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 if (cdrom->track[i].offset <= start &&
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 start < (cdrom->track[i].offset + cdrom->track[i].length))
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 break;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 if (i == cdrom->numtracks)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 return NULL;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 currentTrack = i;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 *outStartFrame = start - cdrom->track[i].offset;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 if ((*outStartFrame + length) < cdrom->track[i].length) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 *outStopFrame = *outStartFrame + length;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 length = 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 nextTrackFrame = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 nextTrackFramesRemaining = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 else {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 *outStopFrame = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 length -= cdrom->track[i].length - *outStartFrame;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 nextTrackFrame = cdrom->track[i+1].offset;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 nextTrackFramesRemaining = length;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 return &tracks[cdrom->id][i];
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 /* Setup another file for playback, or stop playback (called from another thread) */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 static void CompletionProc (SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 Lock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 if (nextTrackFrame > 0 && nextTrackFramesRemaining > 0) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 /* Load the next file to play */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 int startFrame, stopFrame;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 FSRef *file;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 PauseFile ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 ReleaseFile ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 file = GetFileForOffset (cdrom, nextTrackFrame,
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 nextTrackFramesRemaining, &startFrame, &stopFrame);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 if (file == NULL) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 status = CD_STOPPED;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 Unlock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 return;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 LoadFile (file, startFrame, stopFrame);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 SetCompletionProc (CompletionProc, cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 PlayFile ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 else {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 /* Release the current file */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 PauseFile ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 ReleaseFile ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 status = CD_STOPPED;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 Unlock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 #pragma mark -- Driver Functions --
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 /* Initialize */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 int SDL_SYS_CDInit (void)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 /* Initialize globals */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 volumes = NULL;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 tracks = NULL;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 status = CD_STOPPED;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 nextTrackFrame = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 nextTrackFramesRemaining = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 fakeCD = SDL_FALSE;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 currentTrack = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 didReadTOC = SDL_FALSE;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 cacheTOCNumTracks = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 currentDrive = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 /* Fill in function pointers */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 SDL_CDcaps.Name = SDL_SYS_CDName;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 SDL_CDcaps.Open = SDL_SYS_CDOpen;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 SDL_CDcaps.Status = SDL_SYS_CDStatus;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 SDL_CDcaps.Play = SDL_SYS_CDPlay;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 SDL_CDcaps.Pause = SDL_SYS_CDPause;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 SDL_CDcaps.Resume = SDL_SYS_CDResume;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 SDL_CDcaps.Stop = SDL_SYS_CDStop;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 SDL_CDcaps.Eject = SDL_SYS_CDEject;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 SDL_CDcaps.Close = SDL_SYS_CDClose;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 /*
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 Read the list of "drives"
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 This is currently a hack that infers drives from
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 mounted audio CD volumes, rather than
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 actual CD-ROM devices - which means it may not
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 act as expected sometimes.
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 /* Find out how many cd volumes are mounted */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 SDL_numcds = DetectAudioCDVolumes (NULL, 0);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 /*
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 If there are no volumes, fake a cd device
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 so tray empty can be reported.
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 if (SDL_numcds == 0) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 fakeCD = SDL_TRUE;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 SDL_numcds = 1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 status = CD_TRAYEMPTY;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 /* Allocate space for volumes */
1338
604d73db6802 Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
209 volumes = (FSVolumeRefNum*) SDL_calloc (1, sizeof(*volumes) * SDL_numcds);
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 if (volumes == NULL) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 SDL_OutOfMemory ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 /* Allocate space for tracks */
1338
604d73db6802 Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
216 tracks = (FSRef**) SDL_calloc (1, sizeof(*tracks) * (SDL_numcds + 1));
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 if (tracks == NULL) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 SDL_OutOfMemory ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 /* Mark the end of the tracks array */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 tracks[ SDL_numcds ] = (FSRef*)-1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 /*
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 Redetect, now save all volumes for later
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 Update SDL_numcds just in case it changed
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 int numVolumes = SDL_numcds;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 SDL_numcds = DetectAudioCDVolumes (volumes, numVolumes);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 /* If more cds suddenly show up, ignore them */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 if (SDL_numcds > numVolumes) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 SDL_SetError ("Some CD's were added but they will be ignored");
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 SDL_numcds = numVolumes;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 /* Shutdown and cleanup */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 void SDL_SYS_CDQuit(void)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 ReleaseFile();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 if (volumes != NULL)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 free (volumes);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 if (tracks != NULL) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 FSRef **ptr;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 for (ptr = tracks; *ptr != (FSRef*)-1; ptr++)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 if (*ptr != NULL)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 free (*ptr);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259 free (tracks);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 /* Get the Unix disk name of the volume */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 static const char *SDL_SYS_CDName (int drive)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 {
4190
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
266 /*
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
267 * !!! FIXME: PBHGetVolParmsSync() is gone in 10.6,
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
268 * !!! FIXME: replaced with FSGetVolumeParms(), which
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
269 * !!! FIXME: isn't available before 10.5. :/
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
270 */
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
271 return "Mac OS X CD-ROM Device";
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
272
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
273 #if 0
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 OSStatus err = noErr;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
275 HParamBlockRec pb;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
276 GetVolParmsInfoBuffer volParmsInfo;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
277
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 if (fakeCD)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 return "Fake CD-ROM Device";
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
280
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
281 pb.ioParam.ioNamePtr = NULL;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
282 pb.ioParam.ioVRefNum = volumes[drive];
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
283 pb.ioParam.ioBuffer = (Ptr)&volParmsInfo;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
284 pb.ioParam.ioReqCount = (SInt32)sizeof(volParmsInfo);
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
285 err = PBHGetVolParmsSync(&pb);
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
286
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 if (err != noErr) {
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
288 SDL_SetError ("PBHGetVolParmsSync returned %d", err);
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 return NULL;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 }
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
291
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
292 return volParmsInfo.vMDeviceID;
4190
386181851388 Fixed CD-ROM code to work with Mac OS X 10.6 SDK and 64-bit targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 4159
diff changeset
293 #endif
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 /* Open the "device" */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 static int SDL_SYS_CDOpen (int drive)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 /* Only allow 1 device to be open */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 if (currentDrive >= 0) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 SDL_SetError ("Only one cdrom is supported");
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 else
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 currentDrive = drive;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 return drive;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310 /* Get the table of contents */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 static int SDL_SYS_CDGetTOC (SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 if (fakeCD) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 SDL_SetError (kErrorFakeDevice);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 if (didReadTOC) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 cdrom->numtracks = cacheTOCNumTracks;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 ReadTOCData (volumes[cdrom->id], cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 didReadTOC = SDL_TRUE;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326 cacheTOCNumTracks = cdrom->numtracks;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 /* Get CD-ROM status */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 static CDstatus SDL_SYS_CDStatus (SDL_CD *cdrom, int *position)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 {
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
334 if (position) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
335 int trackFrame;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
336
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
337 Lock ();
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
338 trackFrame = GetCurrentFrame ();
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
339 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
341 *position = cdrom->track[currentTrack].offset + trackFrame;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
342 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344 return status;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 /* Start playback */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 int startFrame, stopFrame;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 FSRef *ref;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353 if (fakeCD) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354 SDL_SetError (kErrorFakeDevice);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 Lock();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 if (LoadTracks (cdrom) < 0)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361 return -2;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 if (PauseFile () < 0)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 return -3;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 if (ReleaseFile () < 0)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 return -4;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 ref = GetFileForOffset (cdrom, start, length, &startFrame, &stopFrame);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 if (ref == NULL) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 SDL_SetError ("SDL_SYS_CDPlay: No file for start=%d, length=%d", start, length);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 return -5;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375 if (LoadFile (ref, startFrame, stopFrame) < 0)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376 return -6;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 SetCompletionProc (CompletionProc, cdrom);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
380 if (PlayFile () < 0)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 return -7;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 status = CD_PLAYING;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385 Unlock();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 /* Pause playback */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 static int SDL_SYS_CDPause(SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 if (fakeCD) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 SDL_SetError (kErrorFakeDevice);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 Lock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
400 if (PauseFile () < 0) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
401 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 return -2;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
403 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 status = CD_PAUSED;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407 Unlock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
408
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
409 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
410 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
411
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
412 /* Resume playback */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
413 static int SDL_SYS_CDResume(SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
414 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
415 if (fakeCD) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
416 SDL_SetError (kErrorFakeDevice);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
417 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
418 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
419
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
420 Lock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
421
1126
d581fe3f36db Fix for bug reported by Michael Benfield on the SDL mailing list:
Ryan C. Gordon <icculus@icculus.org>
parents: 769
diff changeset
422 if (PlayFile () < 0) {
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
423 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
424 return -2;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
425 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
426
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
427 status = CD_PLAYING;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
428
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
429 Unlock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
430
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
431 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
432 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
433
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
434 /* Stop playback */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
435 static int SDL_SYS_CDStop(SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
436 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
437 if (fakeCD) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
438 SDL_SetError (kErrorFakeDevice);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
439 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
440 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
441
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
442 Lock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
443
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
444 if (PauseFile () < 0) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
445 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
446 return -2;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
447 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
448
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
449 if (ReleaseFile () < 0) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
450 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
451 return -3;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
452 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
453
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
454 status = CD_STOPPED;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
455
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
456 Unlock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
457
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
458 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
459 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
460
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
461 /* Eject the CD-ROM (Unmount the volume) */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
462 static int SDL_SYS_CDEject(SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
463 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
464 OSStatus err;
1793
4d66375c2012 Date: Mon, 8 May 2006 14:19:30 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 1635
diff changeset
465 pid_t dissenter;
4d66375c2012 Date: Mon, 8 May 2006 14:19:30 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 1635
diff changeset
466
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
467 if (fakeCD) {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
468 SDL_SetError (kErrorFakeDevice);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
469 return -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
470 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
471
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
472 Lock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
473
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
474 if (PauseFile () < 0) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
475 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
476 return -2;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
477 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
478
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
479 if (ReleaseFile () < 0) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
480 Unlock ();
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
481 return -3;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
482 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
483
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
484 status = CD_STOPPED;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
485
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
486 /* Eject the volume */
1793
4d66375c2012 Date: Mon, 8 May 2006 14:19:30 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 1635
diff changeset
487 err = FSEjectVolumeSync(volumes[cdrom->id], kNilOptions, &dissenter);
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
488
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
489 if (err != noErr) {
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
490 Unlock ();
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
491 SDL_SetError ("PBUnmountVol returned %d", err);
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
492 return -4;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 616
diff changeset
493 }
616
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
494
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
495 status = CD_TRAYEMPTY;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
496
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
497 /* Invalidate volume and track info */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
498 volumes[cdrom->id] = 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
499 free (tracks[cdrom->id]);
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
500 tracks[cdrom->id] = NULL;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
501
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
502 Unlock ();
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
503
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
504 return 0;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
505 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
506
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
507 /* Close the CD-ROM */
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
508 static void SDL_SYS_CDClose(SDL_CD *cdrom)
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
509 {
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
510 currentDrive = -1;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
511 return;
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
512 }
12c746afbc27 Oops...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
513
1635
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
514 #endif /* SDL_CDROM_MACOSX */