summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2019-07-07 22:00:20 -0400
committerFranklin Wei <git@fwei.tk>2019-07-09 11:20:55 -0400
commit3f59fc8b771625aca9c3aefe03cf1038d8461963 (patch)
treee0623a323613baa0b0993411b38bcaed144b27ed /apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h
parent439a0d1d91fa040d261fc39b87278bc9f5391dcc (diff)
downloadrockbox-3f59fc8b771625aca9c3aefe03cf1038d8461963.tar.gz
rockbox-3f59fc8b771625aca9c3aefe03cf1038d8461963.zip
Wolfenstein 3-D!
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
Diffstat (limited to 'apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h')
-rw-r--r--apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h b/apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h
new file mode 100644
index 0000000000..c340a17a7d
--- /dev/null
+++ b/apps/plugins/sdl/progs/wolf3d/fmopl_gpl.h
@@ -0,0 +1,117 @@
1#ifndef __FMOPL_H_
2#define __FMOPL_H_
3
4#include "wl_def.h"
5
6#define HAS_YM3812 1
7
8/* --- select emulation chips --- */
9#define BUILD_YM3812 (HAS_YM3812)
10#define BUILD_YM3526 (HAS_YM3526)
11#define BUILD_Y8950 (HAS_Y8950)
12
13/* select output bits size of output : 8 or 16 */
14#define OPL_SAMPLE_BITS 16
15
16/* compiler dependence */
17#ifndef OSD_CPU_H
18#define OSD_CPU_H
19typedef unsigned char UINT8; /* unsigned 8bit */
20typedef unsigned short UINT16; /* unsigned 16bit */
21typedef unsigned int UINT32; /* unsigned 32bit */
22typedef signed char INT8; /* signed 8bit */
23typedef signed short INT16; /* signed 16bit */
24typedef signed int INT32; /* signed 32bit */
25#endif
26
27#if (OPL_SAMPLE_BITS==16)
28typedef INT16 OPLSAMPLE;
29#endif
30#if (OPL_SAMPLE_BITS==8)
31typedef INT8 OPLSAMPLE;
32#endif
33
34
35typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
36typedef void (*OPL_IRQHANDLER)(int param,int irq);
37typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
38typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
39typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
40
41
42#if BUILD_YM3812
43
44
45typedef void device_t;
46void *YM3812Init(device_t *junk, UINT32 clock, UINT32 rate);
47void YM3812Shutdown(void *chip);
48void YM3812ResetChip(void *chip);
49int YM3812Write(void *chip, int a, int v);
50unsigned char YM3812Read(void *chip, int a);
51void YM3812Mute(void *chip,int channel,bool mute);
52int YM3812TimerOver(void *chip, int c);
53void YM3812UpdateOne(void *chip, INT16 *buffer, int length);
54
55// not used
56//void YM3812SetTimerHandler(void *chip, OPL_TIMERHANDLER TimerHandler, int channelOffset);
57//void YM3812SetIRQHandler(void *chip, OPL_IRQHANDLER IRQHandler, int param);
58//void YM3812SetUpdateHandler(void *chip, OPL_UPDATEHANDLER UpdateHandler, int param);
59
60#endif
61
62
63#if BUILD_YM3526
64
65/*
66** Initialize YM3526 emulator(s).
67**
68** 'num' is the number of virtual YM3526's to allocate
69** 'clock' is the chip clock in Hz
70** 'rate' is sampling rate
71*/
72int YM3526Init(int num, int clock, int rate);
73/* shutdown the YM3526 emulators*/
74void YM3526Shutdown(void);
75void YM3526ResetChip(int which);
76int YM3526Write(int which, int a, int v);
77unsigned char YM3526Read(int which, int a);
78int YM3526TimerOver(int which, int c);
79/*
80** Generate samples for one of the YM3526's
81**
82** 'which' is the virtual YM3526 number
83** '*buffer' is the output buffer pointer
84** 'length' is the number of samples that should be generated
85*/
86void YM3526UpdateOne(int which, INT16 *buffer, int length);
87
88void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
89void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
90void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
91
92#endif
93
94
95#if BUILD_Y8950
96
97/* Y8950 port handlers */
98void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param);
99void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param);
100void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size );
101
102int Y8950Init (int num, int clock, int rate);
103void Y8950Shutdown (void);
104void Y8950ResetChip (int which);
105int Y8950Write (int which, int a, int v);
106unsigned char Y8950Read (int which, int a);
107int Y8950TimerOver (int which, int c);
108void Y8950UpdateOne (int which, INT16 *buffer, int length);
109
110void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
111void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param);
112void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param);
113
114#endif
115
116
117#endif /* __FMOPL_H_ */