3f59fc8b77
This is a port of Wolf4SDL, which is derived from the original id software source release. The port runs on top of the SDL plugin runtime and is loaded as an overlay. Licensing of the game code is not an issue, as discussed below (essentially, the Debian project treats Wolf4SDL as GPLv2, with an email from John Carmack backing it up): http://forums.rockbox.org/index.php?topic=52872 Included is a copy of MAME's Yamaha OPL sound chip emulator (fmopl_gpl.c). This file was not part of the original Wolf4SDL source (which includes a non-GPL'd version), but was rather rebased from from a later MAME source which had been relicensed to GPLv2. Change-Id: I64c2ba035e0be7e2f49252f40640641416613439
117 lines
3.6 KiB
C
117 lines
3.6 KiB
C
#ifndef __FMOPL_H_
|
|
#define __FMOPL_H_
|
|
|
|
#include "wl_def.h"
|
|
|
|
#define HAS_YM3812 1
|
|
|
|
/* --- select emulation chips --- */
|
|
#define BUILD_YM3812 (HAS_YM3812)
|
|
#define BUILD_YM3526 (HAS_YM3526)
|
|
#define BUILD_Y8950 (HAS_Y8950)
|
|
|
|
/* select output bits size of output : 8 or 16 */
|
|
#define OPL_SAMPLE_BITS 16
|
|
|
|
/* compiler dependence */
|
|
#ifndef OSD_CPU_H
|
|
#define OSD_CPU_H
|
|
typedef unsigned char UINT8; /* unsigned 8bit */
|
|
typedef unsigned short UINT16; /* unsigned 16bit */
|
|
typedef unsigned int UINT32; /* unsigned 32bit */
|
|
typedef signed char INT8; /* signed 8bit */
|
|
typedef signed short INT16; /* signed 16bit */
|
|
typedef signed int INT32; /* signed 32bit */
|
|
#endif
|
|
|
|
#if (OPL_SAMPLE_BITS==16)
|
|
typedef INT16 OPLSAMPLE;
|
|
#endif
|
|
#if (OPL_SAMPLE_BITS==8)
|
|
typedef INT8 OPLSAMPLE;
|
|
#endif
|
|
|
|
|
|
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
|
|
typedef void (*OPL_IRQHANDLER)(int param,int irq);
|
|
typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
|
|
typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
|
|
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
|
|
|
|
|
|
#if BUILD_YM3812
|
|
|
|
|
|
typedef void device_t;
|
|
void *YM3812Init(device_t *junk, UINT32 clock, UINT32 rate);
|
|
void YM3812Shutdown(void *chip);
|
|
void YM3812ResetChip(void *chip);
|
|
int YM3812Write(void *chip, int a, int v);
|
|
unsigned char YM3812Read(void *chip, int a);
|
|
void YM3812Mute(void *chip,int channel,bool mute);
|
|
int YM3812TimerOver(void *chip, int c);
|
|
void YM3812UpdateOne(void *chip, INT16 *buffer, int length);
|
|
|
|
// not used
|
|
//void YM3812SetTimerHandler(void *chip, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
|
//void YM3812SetIRQHandler(void *chip, OPL_IRQHANDLER IRQHandler, int param);
|
|
//void YM3812SetUpdateHandler(void *chip, OPL_UPDATEHANDLER UpdateHandler, int param);
|
|
|
|
#endif
|
|
|
|
|
|
#if BUILD_YM3526
|
|
|
|
/*
|
|
** Initialize YM3526 emulator(s).
|
|
**
|
|
** 'num' is the number of virtual YM3526's to allocate
|
|
** 'clock' is the chip clock in Hz
|
|
** 'rate' is sampling rate
|
|
*/
|
|
int YM3526Init(int num, int clock, int rate);
|
|
/* shutdown the YM3526 emulators*/
|
|
void YM3526Shutdown(void);
|
|
void YM3526ResetChip(int which);
|
|
int YM3526Write(int which, int a, int v);
|
|
unsigned char YM3526Read(int which, int a);
|
|
int YM3526TimerOver(int which, int c);
|
|
/*
|
|
** Generate samples for one of the YM3526's
|
|
**
|
|
** 'which' is the virtual YM3526 number
|
|
** '*buffer' is the output buffer pointer
|
|
** 'length' is the number of samples that should be generated
|
|
*/
|
|
void YM3526UpdateOne(int which, INT16 *buffer, int length);
|
|
|
|
void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
|
void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
|
|
void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
|
|
|
|
#endif
|
|
|
|
|
|
#if BUILD_Y8950
|
|
|
|
/* Y8950 port handlers */
|
|
void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param);
|
|
void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param);
|
|
void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size );
|
|
|
|
int Y8950Init (int num, int clock, int rate);
|
|
void Y8950Shutdown (void);
|
|
void Y8950ResetChip (int which);
|
|
int Y8950Write (int which, int a, int v);
|
|
unsigned char Y8950Read (int which, int a);
|
|
int Y8950TimerOver (int which, int c);
|
|
void Y8950UpdateOne (int which, INT16 *buffer, int length);
|
|
|
|
void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
|
void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param);
|
|
void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param);
|
|
|
|
#endif
|
|
|
|
|
|
#endif /* __FMOPL_H_ */
|