summaryrefslogtreecommitdiffhomepage
path: root/patches/sdl1/cdrom.patch
blob: 9c23cbb9ea595653041250f98dbf6620b85d70d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
diff -ru SDL-1.2.15.orig/src/cdrom/win32/SDL_syscdrom.c SDL-1.2.15/src/cdrom/win32/SDL_syscdrom.c
--- SDL-1.2.15.orig/src/cdrom/win32/SDL_syscdrom.c	2012-01-19 07:30:06.000000000 +0100
+++ SDL-1.2.15/src/cdrom/win32/SDL_syscdrom.c	2020-09-25 13:17:09.363163539 +0200
@@ -29,6 +29,187 @@
 #include <windows.h>
 #include <mmsystem.h>
 
+/* oh dear */
+typedef UINT MCIDEVICEID;
+
+typedef struct tagMCI_PLAY_PARMS {
+    DWORD_PTR dwCallback;
+    DWORD dwFrom;
+    DWORD dwTo;
+} MCI_PLAY_PARMS,*PMCI_PLAY_PARMS,*LPMCI_PLAY_PARMS;
+
+typedef struct tagMCI_STATUS_PARMS {
+    DWORD_PTR dwCallback;
+    DWORD_PTR dwReturn;
+    DWORD dwItem;
+    DWORD dwTrack;
+} MCI_STATUS_PARMS,*PMCI_STATUS_PARMS,*LPMCI_STATUS_PARMS;
+
+typedef struct tagMCI_SET_PARMS {
+    DWORD_PTR dwCallback;
+    DWORD dwTimeFormat;
+    DWORD dwAudio;
+} MCI_SET_PARMS,*PMCI_SET_PARMS,*LPMCI_SET_PARMS;
+
+typedef struct tagMCI_OPEN_PARMSA {
+    DWORD_PTR dwCallback;
+    MCIDEVICEID wDeviceID;
+    LPCSTR lpstrDeviceType;
+    LPCSTR lpstrElementName;
+    LPCSTR lpstrAlias;
+} MCI_OPEN_PARMSA,*PMCI_OPEN_PARMSA,*LPMCI_OPEN_PARMSA;
+
+#define MCI_OPEN_PARMS MCI_OPEN_PARMSA
+
+__dllimport UINT __stdcall GetDriveTypeA (LPCSTR lpRootPathName);
+#define GetDriveType GetDriveTypeA
+
+__dllimport MCIERROR __stdcall mciSendCommandA(MCIDEVICEID mciId,UINT uMsg,DWORD_PTR dwParam1,DWORD_PTR dwParam2);
+#define mciSendCommand mciSendCommandA
+
+__dllimport BOOL __stdcall mciGetErrorStringA(MCIERROR mcierr,LPSTR pszText,UINT cchText);
+#define mciGetErrorString mciGetErrorStringA
+
+#ifndef MCI_MSF_MINUTE
+#define MCI_MSF_MINUTE(msf) ((BYTE)(msf))
+#endif
+
+#ifndef MCI_MSF_SECOND
+#define MCI_MSF_SECOND(msf) ((BYTE)(((WORD)(msf)) >> 8))
+#endif
+
+#ifndef MCI_MSF_FRAME
+#define MCI_MSF_FRAME(msf) ((BYTE)((msf)>>16))
+#endif
+
+#ifndef MCI_MAKE_MSF
+#define MCI_MAKE_MSF(m,s,f) ((DWORD)(((BYTE)(m) | ((WORD)(s)<<8)) | (((DWORD)(BYTE)(f))<<16)))
+#endif
+
+#ifndef DRIVE_CDROM
+#define DRIVE_CDROM 5
+#endif
+
+#ifndef MCI_DEVTYPE_CD_AUDIO
+#define MCI_DEVTYPE_CD_AUDIO 516
+#endif
+
+#ifndef MCI_OPEN_TYPE
+#define MCI_OPEN_TYPE (uint32_t)0x00002000
+#endif
+
+#ifndef MCI_OPEN_TYPE_ID
+#define MCI_OPEN_TYPE_ID (uint32_t)0x00001000
+#endif
+
+#ifndef MCI_OPEN_SHAREABLE
+#define MCI_OPEN_SHAREABLE (uint32_t)0x00000100
+#endif
+
+#ifndef MCI_OPEN_ELEMENT
+#define MCI_OPEN_ELEMENT (uint32_t)0x00000200
+#endif
+
+#ifndef MCI_OPEN
+#define MCI_OPEN 0x0803
+#endif
+
+#ifndef MCI_CLOSE
+#define MCI_CLOSE 0x0804
+#endif
+
+#ifndef MCI_WAIT
+#define MCI_WAIT (uint32_t)0x00000002
+#endif
+
+#ifndef MCI_SET
+#define MCI_SET 0x080D
+#endif
+
+#ifndef MCI_PLAY
+#define MCI_PLAY 0x0806
+#endif
+
+#ifndef MCI_STOP
+#define MCI_STOP 0x0808
+#endif
+
+#ifndef MCI_STATUS
+#define MCI_STATUS 0x0814
+#endif
+
+#ifndef MCI_PAUSE
+#define MCI_PAUSE 0x0809
+#endif
+
+#ifndef MCI_TO
+#define MCI_TO (uint32_t)0x00000008
+#endif
+
+#ifndef MCI_FROM
+#define MCI_FROM (uint32_t)0x00000004
+#endif
+
+#ifndef MCI_NOTIFY
+#define MCI_NOTIFY (uint32_t)0x00000001
+#endif
+
+#ifndef MCI_STATUS_POSITION
+#define MCI_STATUS_POSITION (uint32_t)0x00000002
+#endif
+
+#ifndef MCI_STATUS_ITEM
+#define MCI_STATUS_ITEM (uint32_t)0x00000100
+#endif
+
+#ifndef MCI_STATUS_MODE
+#define MCI_STATUS_MODE (uint32_t)0x00000004
+#endif
+
+#ifndef MCI_STATUS_LENGTH
+#define MCI_STATUS_LENGTH (uint32_t)0x00000001
+#endif
+
+#ifndef MCI_STATUS_NUMBER_OF_TRACKS
+#define MCI_STATUS_NUMBER_OF_TRACKS (uint32_t)0x00000003
+#endif
+
+#ifndef MCI_TRACK
+#define MCI_TRACK (uint32_t)0x00000010
+#endif
+
+#ifndef MCI_SET_DOOR_OPEN
+#define MCI_SET_DOOR_OPEN (uint32_t)0x00000100
+#endif
+
+#ifndef MCI_MODE_NOT_READY
+#define MCI_MODE_NOT_READY 524
+#endif
+
+#ifndef MCI_MODE_OPEN
+#define MCI_MODE_OPEN 530
+#endif
+
+#ifndef MCI_MODE_STOP
+#define MCI_MODE_STOP 525
+#endif
+
+#ifndef MCI_MODE_PLAY
+#define MCI_MODE_PLAY 526
+#endif
+
+#ifndef MCI_MODE_PAUSE
+#define MCI_MODE_PAUSE 529
+#endif
+
+#ifndef MCI_SET_TIME_FORMAT
+#define MCI_SET_TIME_FORMAT (uint32_t)0x00000400
+#endif
+
+#ifndef MCI_FORMAT_MSF
+#define MCI_FORMAT_MSF 2
+#endif
+
 #include "SDL_cdrom.h"
 #include "../SDL_syscdrom.h"