1 /*
2 * MAME �� ������ɥɥ饤�Ф�ɬ�פ�����Τ褻���Ĥ�
3 */
4
5 #ifndef MAME_QUASI88_H_INCLUDED
6 #define MAME_QUASI88_H_INCLUDED
7
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12
13 #include "quasi88.h"
14 #include "snddrv.h" /* VOL_MAX */
15 #include "z80.h"
16 #include "pc88cpu.h" /* z80main_cpu */
17 #include "intr.h" /* state_of_cpu */
18 #include "initval.h" /* SOUND_I */
19 #include "soundbd.h" /* sound_board */
20 #include "file-op.h" /* OSD_FILE, ... */
21
22
23
24 /* src/mame.mak
25 src/sound/sound.mak ===================================================== */
26
27 #define HAS_YM2203 (1)
28 #define HAS_YM2608 (1)
29 #define HAS_SAMPLES (1)
30
31 #define HAS_BEEP88 (1)
32
33 #ifdef USE_FMGEN
34 #define HAS_FMGEN2203 (1)
35 #define HAS_FMGEN2608 (1)
36 #endif
37
38
39
40 /* src/windows/osd_cpu.h
41 src/unix/osd_cpu.h ====================================================== */
42
43 #ifdef _MSC_VER
44 #ifndef CLIB_DECL
45 #define CLIB_DECL
46 #endif
47 #endif
48
49 typedef unsigned char UINT8;
50 typedef signed char INT8;
51
52 typedef unsigned short UINT16;
53 typedef signed short INT16;
54
55 typedef unsigned int UINT32;
56 typedef signed int INT32;
57
58 #if defined(DENY_LONG_LONG)
59 /* can't use 64bit-int */
60 typedef double UINT64; /* avoid compiler error */
61 typedef double INT64; /* avoid compiler error */
62 #else
63 #ifdef _MSC_VER
64 typedef unsigned __int64 UINT64;
65 typedef signed __int64 INT64;
66 #else
67 typedef unsigned long long UINT64;
68 typedef signed long long INT64;
69 #endif
70 #endif
71
72
73 #ifdef macintosh /* SC depend */
74 #define CLIB_DECL
75 #endif
76
77
78
79 /* src/mamecore.h ========================================================== */
80
81 /* Suppress warnings about redefining the macro 'PPC' on LinuxPPC. */
82 #ifdef PPC
83 #undef PPC
84 #endif
85
86
87 /* Some optimizations/warnings cleanups for GCC */
88 #if defined(__GNUC__) && (__GNUC__ >= 3)
89 #define ATTR_UNUSED __attribute__((__unused__))
90 #define ATTR_NORETURN __attribute__((noreturn))
91 #define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
92 #define ATTR_MALLOC __attribute__((malloc))
93 #define ATTR_PURE __attribute__((pure))
94 #define ATTR_CONST __attribute__((const))
95 #define UNEXPECTED(exp) __builtin_expect((exp), 0)
96 #define TYPES_COMPATIBLE(a,b) __builtin_types_compatible_p(a, b)
97 #define RESTRICT __restrict__
98 #else
99 #define ATTR_UNUSED
100 #define ATTR_NORETURN
101 #define ATTR_PRINTF(x,y)
102 #define ATTR_MALLOC
103 #define ATTR_PURE
104 #define ATTR_CONST
105 #define UNEXPECTED(exp) (exp)
106 #define TYPES_COMPATIBLE(a,b) 1
107 #define RESTRICT
108 #endif
109
110
111 /* And some MSVC optimizations/warnings */
112 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
113 #define DECL_NORETURN __declspec(noreturn)
114 #else
115 #define DECL_NORETURN
116 #endif
117
118
119
120 /* genf is a type that can be used for function pointer casting in a way
121 that doesn't confuse some compilers */
122 typedef void genf(void);
123
124
125 /* These are forward struct declarations that are used to break
126 circular dependencies in the code */
127 typedef struct _running_machine running_machine;
128 typedef struct _machine_config machine_config;
129
130 #define mame_file OSD_FILE
131
132
133 /* stream_sample_t is used to represent a single sample in a sound stream */
134 typedef INT32 stream_sample_t;
135
136
137 /* Make sure we have a path separator (default to /) */
138 #define PATH_SEPARATOR ""
139
140
141 /* Standard MAME assertion macros */
142 #undef assert
143 #undef assert_always
144
145 #define assert(x)
146 #define assert_always(x, msg) do { if (!(x)) fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0)
147
148
149
150 /* Macros for normalizing data into big or little endian formats */
151 #define FLIPENDIAN_INT16(x) (((((UINT16) (x)) >> 8) | ((x) << 8)) & 0xffff)
152
153 #ifdef LSB_FIRST
154 #define LITTLE_ENDIANIZE_INT16(x) (x)
155 #else
156 #define LITTLE_ENDIANIZE_INT16(x) (FLIPENDIAN_INT16(x))
157 #endif /* LSB_FIRST */
158
159
160
161
162
163 /* Used by assert(), so definition here instead of mame.h */
164 DECL_NORETURN void CLIB_DECL fatalerror(const char *text,...) ATTR_PRINTF(1,2) ATTR_NORETURN;
165 /* INLINE DECL_NORETURN void CLIB_DECL fatalerror(const char *text,...) { exit(-1); } */
166 /* #define fatalerror exit(-1) */
167
168
169
170 /* src/memory.h ============================================================ */
171
172 /* ----- typedefs for data and offset types ----- */
173 typedef UINT32 offs_t;
174
175 /* ----- typedefs for the various common data access handlers ----- */
176 typedef UINT8 (*read8_handler) (ATTR_UNUSED offs_t offset);
177 typedef void (*write8_handler) (ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data);
178
179 /* ----- macros for declaring the various common data access handlers ----- */
180 #define READ8_HANDLER(name) UINT8 name(ATTR_UNUSED offs_t offset)
181 #define WRITE8_HANDLER(name) void name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data)
182 #define READ16_HANDLER(name) UINT16 name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask)
183 #define WRITE16_HANDLER(name) void name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask)
184
185 /* ----- 16-bit memory accessing ----- */
186 #define ACCESSING_LSB16 ((mem_mask & 0x00ff) == 0)
187 #define ACCESSING_MSB16 ((mem_mask & 0xff00) == 0)
188 #define ACCESSING_LSB ACCESSING_LSB16
189 #define ACCESSING_MSB ACCESSING_MSB16
190
191
192
193 /* src/mame.h ============================================================== */
194
195 struct _running_machine
196 {
197 const machine_config * drv; /* points to the constructed machine_config */
198
199 float refresh_rate; /* current video refresh rate */
200 int sample_rate; /* the digital audio sample rate */
201 };
202
203 typedef struct _global_options global_options;
204 struct _global_options
205 {
206 int samplerate; /* sound sample playback rate, in Hz */
207 int use_samples; /* 1 to enable external .wav samples */
208 };
209
210 extern global_options options;
211 extern running_machine *Machine;
212
213
214 /* get the current pause state */
215 #define mame_is_paused(dummy) (quasi88_is_paused)
216
217
218 /* log to the standard error.log file */
219 /* void CLIB_DECL logerror(const char *text,...); */
logerror(ATTR_UNUSED const char * text,...)220 INLINE void CLIB_DECL logerror(ATTR_UNUSED const char *text,...){}
221 /* #define logerror (void) */
222 /* #define logerror if(1){}else printf */
223
224
225
226 /* src/restrack.h ========================================================== */
227
228 /* initialize the resource tracking system */
229 void init_resource_tracking(void);
230
231 /* tear down the resource tracking system */
232 void exit_resource_tracking(void);
233
234 /* begin tracking resources */
235 void begin_resource_tracking(void);
236
237 /* stop tracking resources and free everything since the last begin */
238 void end_resource_tracking(void);
239
240
241 /* allocate memory and fatalerror if there's a problem */
242 #define malloc_or_die(s) _malloc_or_die(s, __FILE__, __LINE__)
243 void *_malloc_or_die(size_t size, const char *file, int line) ATTR_MALLOC;
244
245 /* allocate memory that will be freed at the next end_resource_tracking */
246 #define auto_malloc(s) _auto_malloc(s, __FILE__, __LINE__)
247 void *_auto_malloc(size_t size, const char *file, int line) ATTR_MALLOC;
248
249 /* allocate memory and duplicate a string that will be freed at the next end_resource_tracking */
250 #define auto_strdup(s) _auto_strdup(s, __FILE__, __LINE__)
251 char *_auto_strdup(const char *str, const char *file, int line) ATTR_MALLOC;
252
253
254
255 /* src/state.h ============================================================= */
256
257 #define state_save_register_item(_mod, _inst, _val)
258 #define state_save_register_item_array(_mod, _inst, _val)
259
260 #define state_save_get_reg_count() (0)
261 #define state_save_register_func_postload_ptr(f,p)
262
263
264
265 /* src/driver.h ============================================================ */
266
267 #include "sndintrf.h"
268 #ifdef QUASI88_CLASSIC
269 #include "sound-alias.h"
270 /* Classic Mac OS �Ǥ� ��sound.h�� �������ƥ�Υإå��ե�����̾����äƤ��ޤ�
271 �Τǡ���̾�Ǥ��Τ����Ȥˤ��褦��
272 ����Ū�ˤϡ��ӥ������ͽ�ᡢ�ե����� ��src/snddrv/src/sound.h�� ��
273 ��͡��ष�ơ� ��src/snddrv/src/sound-alias.h�� ���Ѥ��Ƥ�����
274 �ʤ������롼�ɥѥ���ˡ� sound.h �Ȥ����ե�����̾��¸�ߤ���ȡ�
275 ��������ǥӥ�ɤ˼��Ԥ���Τ���� */
276 #else
277 #include "sound.h"
278 #endif
279
280 /* maxima */
281 #define MAX_SOUND 32
282 #define MAX_SPEAKER 4
283
284 /* In mamecore.h: typedef struct _machine_config machine_config; */
285 struct _machine_config
286 {
287 float frames_per_second; /* number of frames per second */
288
289 sound_config sound[MAX_SOUND]; /* array of sound chips in the system */
290 speaker_config speaker[MAX_SPEAKER]; /* array of speakers in the system */
291
292 int (*sound_start)(void); /* one-time sound start callback */
293 void (*sound_reset)(void); /* sound reset callback */
294 };
295
296
297 speaker_config *driver_add_speaker(machine_config *machine, const char *tag, float x, float y, float z);
298 speaker_config *driver_find_speaker(machine_config *machine, const char *tag);
299 void driver_remove_speaker(machine_config *machine, const char *tag);
300
301 sound_config *driver_add_sound(machine_config *machine, const char *tag, int type, int clock);
302 sound_config *driver_find_sound(machine_config *machine, const char *tag);
303 void driver_remove_sound(machine_config *machine, const char *tag);
304
305
306
307 /* src/timer.h ============================================================= */
308
309 /* opaque type for representing a timer */
310 typedef void mame_timer;
311
312 #define mame_timer_alloc(c) (NULL)
313
314 #define timer_alloc_ptr(c,p) (NULL)
315 #define timer_adjust_ptr(w,d,e)
316 #define timer_enable(w,e) (1)
317
318 #define mame_timer_adjust(w,d,pa,pe)
319
320
321
322 /* src/osdepend.h ========================================================== */
323
324 void osd_update_video_and_audio(void);
325
326 int osd_start_audio_stream(int stereo);
327 int osd_update_audio_stream(INT16 *buffer);
328 void osd_stop_audio_stream(void);
329
330 void osd_set_mastervolume(int attenuation);
331 int osd_get_mastervolume(void);
332
333 void osd_sound_enable(int enable);
334
335
336
337 /* src/cpuintrf.h ========================================================== */
338
339 #define activecpu_get_pc() 0
340
341
342
343 /* src/profiler.h ========================================================== */
344
345 #define PROFILER_SOUND (0)
346 #define profiler_mark(type)
347
348
349
350 /* src/osdcore.h ============================================================ */
351
352 #define OPEN_FLAG_READ 0x0001 /* open for read */
353 #define FILERR_NONE (0)
354
355 typedef int mame_file_error;
356
357
358
359 /* src/fileio.h ============================================================ */
360
361 #define SEARCHPATH_SAMPLE NULL
362
363 /* open a file in the given search path with the specified filename */
364 mame_file_error mame_fopen(const char *dummypath, char *filename, UINT32 dummyflags, mame_file **file);
365
366 #define mame_fclose(file) osd_fclose(file)
367 #define mame_fseek(file, offset, whence) osd_fseek(file, offset, whence)
368 #define mame_fread(file, buffer, length) osd_fread(buffer, 1, length, file)
369
370 char *assemble_3_strings(const char *dummy1, const char *summy2, const char *s3);
371
372
373
374 /****************************************************************************
375 * QUASI88
376 *****************************************************************************/
377
378 extern int use_sound; /* 1:use sound / 0:not use */
379 extern int close_device; /* 1:close audio device at menu mode / 0:not */
380 extern int fmvol; /* level of FM (0-100)[%] */
381 extern int psgvol; /* level of PSG (0-100)[%] */
382 extern int beepvol; /* level of BEEP (0-100)[%] */
383 extern int rhythmvol; /* level of RHYTHM (0-100)[%] depend on fmvol */
384 extern int adpcmvol; /* level of ADPCM (0-100)[%] depend on fmvol */
385 extern int fmgenvol; /* level of fmgen (0-100)[%] */
386 extern int samplevol; /* level of SAMPLE (0-100)[%] */
387 extern int use_fmgen; /* 1:use fmgen / 0:not use */
388 extern int has_samples; /* 1:use samples / 0:not use */
389 extern int quasi88_is_paused; /* for mame_is_paused() */
390
391 #endif /* MAME_QUASI88_H_INCLUDED */
392