annotate src/cdrom/mint/SDL_syscdrom.c @ 3900:ce3a2bd11305 SDL-1.2

Wrapped some macro params in parentheses for alloca wrappers. Thansk, Suzuki Masahiro.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 29 Nov 2006 10:30:05 +0000
parents 92947e3a18db
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
rev   line source
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
1 /*
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
769
b8d311d90021 Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents: 727
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
4
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
9
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
13 Library General Public License for more details.
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
14
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
18
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
19 Sam Lantinga
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
23
1635
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
24 #ifdef SDL_CDROM_MINT
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
25
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
26 /*
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27 Atari MetaDOS CD-ROM functions
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
28
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
29 Patrice Mandin
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30 */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
31
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
32 #include <errno.h>
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
33
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
34 #include <cdromio.h>
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
35 #include <metados.h>
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
36
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
37 #include "SDL_cdrom.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
38 #include "../SDL_syscdrom.h"
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
39
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
40 /* Some ioctl() errno values which occur when the tray is empty */
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
41 #ifndef ENOMEDIUM
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
42 #define ENOMEDIUM ENOENT
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
43 #endif
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
44 #define ERRNO_TRAYEMPTY(errno) \
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
45 ((errno == EIO) || (errno == ENOENT) || \
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
46 (errno == EINVAL) || (errno == ENOMEDIUM))
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
48 /* The maximum number of CD-ROM drives we'll detect */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
49 #define MAX_DRIVES 32
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
50
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
51 typedef struct {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
52 unsigned char device[3]; /* Physical device letter + ':' + '\0' */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
53 metaopen_t metaopen; /* Infos on opened drive */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
54 } metados_drive_t;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
55
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
56 static metados_drive_t metados_drives[MAX_DRIVES];
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
57
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
58 /* The system-dependent CD control functions */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
59 static const char *SDL_SYS_CDName(int drive);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
60 static int SDL_SYS_CDOpen(int drive);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
61 static void SDL_SYS_CDClose(SDL_CD *cdrom);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
62 static int SDL_SYS_CDioctl(int id, int command, void *arg);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
63 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
64 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
65 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
66 static int SDL_SYS_CDPause(SDL_CD *cdrom);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
67 static int SDL_SYS_CDResume(SDL_CD *cdrom);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
68 static int SDL_SYS_CDStop(SDL_CD *cdrom);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
69 static int SDL_SYS_CDEject(SDL_CD *cdrom);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
70
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
71 int SDL_SYS_CDInit(void)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
72 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
73 metainit_t metainit={0,0,0,0};
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
74 metaopen_t metaopen;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
75 int i, handle;
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
76 struct cdrom_subchnl info;
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
77
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
78 Metainit(&metainit);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
79 if (metainit.version == NULL) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
80 #ifdef DEBUG_CDROM
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
81 fprintf(stderr, "MetaDOS not installed\n");
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
82 #endif
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
83 return -1;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
84 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
85
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
86 if (metainit.drives_map == 0) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
87 #ifdef DEBUG_CDROM
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
88 fprintf(stderr, "No MetaDOS devices present\n");
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
89 #endif
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
90 return -1;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
91 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
92
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
93 SDL_numcds = 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
94
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
95 for (i='A'; i<='Z'; i++) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
96 metados_drives[SDL_numcds].device[0] = 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
97 metados_drives[SDL_numcds].device[1] = ':';
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
98 metados_drives[SDL_numcds].device[2] = 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
99
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
100 if (metainit.drives_map & (1<<(i-'A'))) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
101 handle = Metaopen(i, &metaopen);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
102 if (handle == 0) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
103
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
104 info.cdsc_format = CDROM_MSF;
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
105 if ( (Metaioctl(i, METADOS_IOCTL_MAGIC, CDROMSUBCHNL, &info) == 0) || ERRNO_TRAYEMPTY(errno) ) {
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
106 metados_drives[SDL_numcds].device[0] = i;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
107 ++SDL_numcds;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
108 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
109
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
110 Metaclose(i);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
111 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
112 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
113 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
114
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
115 /* Fill in our driver capabilities */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
116 SDL_CDcaps.Name = SDL_SYS_CDName;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
117 SDL_CDcaps.Open = SDL_SYS_CDOpen;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
118 SDL_CDcaps.Close = SDL_SYS_CDClose;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
119
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
120 SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
121 SDL_CDcaps.Status = SDL_SYS_CDStatus;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
122 SDL_CDcaps.Play = SDL_SYS_CDPlay;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
123 SDL_CDcaps.Pause = SDL_SYS_CDPause;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
124 SDL_CDcaps.Resume = SDL_SYS_CDResume;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
125 SDL_CDcaps.Stop = SDL_SYS_CDStop;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
126 SDL_CDcaps.Eject = SDL_SYS_CDEject;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
127
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
128 return 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
129 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
130
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
131 void SDL_SYS_CDQuit(void)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
132 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
133 SDL_numcds = 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
134 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
135
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
136 static const char *SDL_SYS_CDName(int drive)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
137 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
138 return(metados_drives[drive].device);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
139 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
140
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
141 static int SDL_SYS_CDOpen(int drive)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
142 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
143 int handle;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
144
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
145 handle = Metaopen(metados_drives[drive].device[0], &(metados_drives[drive].metaopen));
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
146 if (handle == 0) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
147 return drive;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
148 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
149
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
150 return -1;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
151 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
152
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
153 static void SDL_SYS_CDClose(SDL_CD *cdrom)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
154 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
155 Metaclose(metados_drives[cdrom->id].device[0]);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
156 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
157
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
158 static int SDL_SYS_CDioctl(int id, int command, void *arg)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
159 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
160 int retval;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
161
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
162 retval = Metaioctl(metados_drives[id].device[0], METADOS_IOCTL_MAGIC, command, arg);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
163 if ( retval < 0 ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
164 SDL_SetError("ioctl() error: %s", strerror(errno));
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
165 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
166 return(retval);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
167 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
168
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
169 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
170 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
171 int i,okay;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
172 struct cdrom_tochdr toc;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
173 struct cdrom_tocentry entry;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
174
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
175 /* Use standard ioctl() */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
176 if (SDL_SYS_CDioctl(cdrom->id, CDROMREADTOCHDR, &toc)<0) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
177 return -1;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
178 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
179
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
180 cdrom->numtracks = toc.cdth_trk1-toc.cdth_trk0+1;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
181 if ( cdrom->numtracks > SDL_MAX_TRACKS ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
182 cdrom->numtracks = SDL_MAX_TRACKS;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
183 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
184
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
185 /* Read all the track TOC entries */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
186 okay=1;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
187 for ( i=0; i<=cdrom->numtracks; ++i ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
188 if ( i == cdrom->numtracks ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
189 cdrom->track[i].id = CDROM_LEADOUT;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
190 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
191 cdrom->track[i].id = toc.cdth_trk0+i;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
192 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
193 entry.cdte_track = cdrom->track[i].id;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
194 entry.cdte_format = CDROM_MSF;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
195 if ( SDL_SYS_CDioctl(cdrom->id, CDROMREADTOCENTRY, &entry) < 0 ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
196 okay=0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
197 break;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
198 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
199 if ( entry.cdte_ctrl & CDROM_DATA_TRACK ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
200 cdrom->track[i].type = SDL_DATA_TRACK;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
201 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
202 cdrom->track[i].type = SDL_AUDIO_TRACK;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
203 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
204 cdrom->track[i].offset = MSF_TO_FRAMES(
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
205 entry.cdte_addr.msf.minute,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
206 entry.cdte_addr.msf.second,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
207 entry.cdte_addr.msf.frame);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
208 cdrom->track[i].length = 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
209 if ( i > 0 ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
210 cdrom->track[i-1].length = cdrom->track[i].offset-cdrom->track[i-1].offset;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
211 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
212 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
213 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
214
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
215 return(okay ? 0 : -1);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
216 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
217
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
218 /* Get CD-ROM status */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
219 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
220 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
221 CDstatus status;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
222 struct cdrom_tochdr toc;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
223 struct cdrom_subchnl info;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
224
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
225 info.cdsc_format = CDROM_MSF;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
226 if ( SDL_SYS_CDioctl(cdrom->id, CDROMSUBCHNL, &info) < 0 ) {
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
227 if ( ERRNO_TRAYEMPTY(errno) ) {
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
228 status = CD_TRAYEMPTY;
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
229 } else {
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
230 status = CD_ERROR;
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
231 }
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
232 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
233 switch (info.cdsc_audiostatus) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
234 case CDROM_AUDIO_INVALID:
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
235 case CDROM_AUDIO_NO_STATUS:
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
236 /* Try to determine if there's a CD available */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
237 if (SDL_SYS_CDioctl(cdrom->id, CDROMREADTOCHDR, &toc)==0) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
238 status = CD_STOPPED;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
239 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
240 status = CD_TRAYEMPTY;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
241 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
242 break;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
243 case CDROM_AUDIO_COMPLETED:
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
244 status = CD_STOPPED;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
245 break;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
246 case CDROM_AUDIO_PLAY:
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
247 status = CD_PLAYING;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
248 break;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
249 case CDROM_AUDIO_PAUSED:
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
250 /* Workaround buggy CD-ROM drive */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
251 if ( info.cdsc_trk == CDROM_LEADOUT ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
252 status = CD_STOPPED;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
253 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
254 status = CD_PAUSED;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
255 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
256 break;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
257 default:
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
258 status = CD_ERROR;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
259 break;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
260 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
261 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
262 if ( position ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
263 if ( status == CD_PLAYING || (status == CD_PAUSED) ) {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
264 *position = MSF_TO_FRAMES(
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
265 info.cdsc_absaddr.msf.minute,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
266 info.cdsc_absaddr.msf.second,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
267 info.cdsc_absaddr.msf.frame);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
268 } else {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
269 *position = 0;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
270 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
271 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
272 return(status);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
273 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
274
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
275 /* Start play */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
276 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
277 {
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
278 struct cdrom_msf playtime;
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
279
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
280 FRAMES_TO_MSF(start,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
281 &playtime.cdmsf_min0, &playtime.cdmsf_sec0, &playtime.cdmsf_frame0);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
282 FRAMES_TO_MSF(start+length,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
283 &playtime.cdmsf_min1, &playtime.cdmsf_sec1, &playtime.cdmsf_frame1);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
284 #ifdef DEBUG_CDROM
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
285 fprintf(stderr, "Trying to play from %d:%d:%d to %d:%d:%d\n",
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
286 playtime.cdmsf_min0, playtime.cdmsf_sec0, playtime.cdmsf_frame0,
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
287 playtime.cdmsf_min1, playtime.cdmsf_sec1, playtime.cdmsf_frame1);
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
288 #endif
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
289
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
290 return SDL_SYS_CDioctl(cdrom->id, CDROMPLAYMSF, &playtime);
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
291 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
292
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
293 /* Pause play */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
294 static int SDL_SYS_CDPause(SDL_CD *cdrom)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
295 {
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
296 return SDL_SYS_CDioctl(cdrom->id, CDROMPAUSE, 0);
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
297 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
298
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
299 /* Resume play */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
300 static int SDL_SYS_CDResume(SDL_CD *cdrom)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
301 {
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
302 return SDL_SYS_CDioctl(cdrom->id, CDROMRESUME, 0);
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
303 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
304
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
305 /* Stop play */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
306 static int SDL_SYS_CDStop(SDL_CD *cdrom)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
307 {
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
308 return SDL_SYS_CDioctl(cdrom->id, CDROMSTOP, 0);
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
309 }
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
310
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
311 /* Eject the CD-ROM */
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
312 static int SDL_SYS_CDEject(SDL_CD *cdrom)
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
313 {
727
cb1208fcd946 Update MiNT CD-ROM driver
Patrice Mandin <patmandin@gmail.com>
parents: 724
diff changeset
314 return SDL_SYS_CDioctl(cdrom->id, CDROMEJECT, 0);
724
6b3dfe0198bb Atari CD-ROM support
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
315 }
1635
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
316
92947e3a18db Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
317 #endif /* SDL_CDROM_MINT */