opentyrian: use latest sources from github
* old version did not build with hardened security flage * they moved to sdl2 * many nasty patches can go * data moved Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
48
recipes-games/opentyrian/opentyrian.bb
Normal file
48
recipes-games/opentyrian/opentyrian.bb
Normal file
@@ -0,0 +1,48 @@
|
||||
SUMMARY = "OpenTyrian is a port of the DOS shoot-em-up Tyrian"
|
||||
HOMEPAGE = "https://bitbucket.org/opentyrian/opentyrian/wiki/Home"
|
||||
SECTION = "games"
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
|
||||
|
||||
DEPENDS = "libsdl2 libsdl2-net"
|
||||
|
||||
inherit autotools-brokensep pkgconfig
|
||||
|
||||
SRC_URI = " \
|
||||
git://github.com/opentyrian/opentyrian.git \
|
||||
http://camanis.net/opentyrian/tyrian21.zip;name=data \
|
||||
file://0001-increase-buffer-size-to-avoid-gcc7-format-overflow-e.patch \
|
||||
file://0002-fix-build-with-gcc8.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
SRCREV = "822c71943f6a06bc2599a0478ea41b6d413648d6"
|
||||
PV = "2.1.20130907+git${SRCPV}"
|
||||
|
||||
SRC_URI[data.md5sum] = "2a3b206a6de25ed4b771af073f8ca904"
|
||||
SRC_URI[data.sha256sum] = "7790d09a2a3addcd33c66ef063d5900eb81cc9c342f4807eb8356364dd1d9277"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install ${BPN} ${D}${bindir}
|
||||
|
||||
install -d ${D}${mandir}/man6
|
||||
install linux/man/${BPN}.6 ${D}${mandir}/man6
|
||||
|
||||
install -d ${D}${datadir}/applications
|
||||
install linux/${BPN}.desktop ${D}${datadir}/applications
|
||||
|
||||
install -d ${D}${datadir}/pixmaps
|
||||
install linux/icons/tyrian-128.png ${D}${datadir}/pixmaps/${BPN}.png
|
||||
|
||||
install -d ${D}${datadir}/games/tyrian
|
||||
install ${WORKDIR}/tyrian21/* ${D}${datadir}/games/tyrian
|
||||
|
||||
# remove unneeded DOS stuff
|
||||
find ${D}${datadir}/games/tyrian -name '*.exe' -exec rm -f {} \;
|
||||
find ${D}${datadir}/games/tyrian -name '*.ovl' -exec rm -f {} \;
|
||||
find ${D}${datadir}/games/tyrian -name 'setup.*' -exec rm -f {} \;
|
||||
find ${D}${datadir}/games/tyrian -name '*.doc' -exec rm -f {} \;
|
||||
find ${D}${datadir}/games/tyrian -name '*.tfp' -exec rm -f {} \;
|
||||
}
|
||||
|
||||
FILES_${PN} += "${datadir}/games"
|
||||
@@ -1,42 +0,0 @@
|
||||
From de64bf5798755f4ea24cc1b8f1d6197b8a0fc7c7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Sun, 16 Aug 2015 15:43:44 +0200
|
||||
Subject: [PATCH 1/2] Makefile: use pkgconfig to find sdl
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstream-Status: Inappropriate [Configuration]
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
---
|
||||
Makefile | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 88a8bd6..63c2983 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -14,8 +14,6 @@ WITH_NETWORK := true
|
||||
|
||||
STRIP := strip
|
||||
|
||||
-SDL_CONFIG := sdl-config
|
||||
-
|
||||
SRCS := $(wildcard src/*.c)
|
||||
OBJS := $(SRCS:src/%.c=obj/%.o)
|
||||
|
||||
@@ -39,8 +37,8 @@ endif
|
||||
|
||||
EXTRA_LDLIBS += -lm
|
||||
|
||||
-SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
|
||||
-SDL_LDLIBS := $(shell $(SDL_CONFIG) --libs)
|
||||
+SDL_CFLAGS := $(shell pkg-config --cflags sdl)
|
||||
+SDL_LDLIBS := $(shell pkg-config --libs sdl)
|
||||
ifeq ($(WITH_NETWORK), true)
|
||||
SDL_LDLIBS += -lSDL_net
|
||||
endif
|
||||
--
|
||||
2.1.0
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
From 7e1c9fb3c30d12139ad531b6b14c53fb5764b24c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Sun, 16 Aug 2015 16:04:41 +0200
|
||||
Subject: [PATCH 2/2] Fix several uninitialized variable warnings
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstream-Status: Backport [1]
|
||||
|
||||
[1] https://bitbucket.org/opentyrian/opentyrian/commits/03cdbc8922f7856378f2e4b51f9adb5073f6fc9e/raw/
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
---
|
||||
src/mainint.c | 2 +-
|
||||
src/shots.c | 2 +-
|
||||
src/tyrian2.c | 4 ++--
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/mainint.c b/src/mainint.c
|
||||
index 2805752..b00074e 100644
|
||||
--- a/src/mainint.c
|
||||
+++ b/src/mainint.c
|
||||
@@ -3635,7 +3635,7 @@ redo:
|
||||
blit_sprite2x2(VGAScreen, this_player->x - 17, this_player->y - 7, *shapes9ptr_, 220);
|
||||
blit_sprite2x2(VGAScreen, this_player->x + 7, this_player->y - 7, *shapes9ptr_, 222);
|
||||
|
||||
- int ship_banking;
|
||||
+ int ship_banking = 0;
|
||||
switch (ship_sprite)
|
||||
{
|
||||
case 5:
|
||||
diff --git a/src/shots.c b/src/shots.c
|
||||
index 606a19f..7aa6ac5 100644
|
||||
--- a/src/shots.c
|
||||
+++ b/src/shots.c
|
||||
@@ -319,7 +319,7 @@ JE_integer player_shot_create( JE_word portNum, uint bay_i, JE_word PX, JE_word
|
||||
if (weapon->sound > 0)
|
||||
soundQueue[soundChannel[bay_i]] = weapon->sound;
|
||||
|
||||
- int shot_id;
|
||||
+ int shot_id = MAX_PWEAPON;
|
||||
/*Rot*/
|
||||
for (int multi_i = 1; multi_i <= weapon->multi; multi_i++)
|
||||
{
|
||||
diff --git a/src/tyrian2.c b/src/tyrian2.c
|
||||
index 3a0a101..4d528cf 100644
|
||||
--- a/src/tyrian2.c
|
||||
+++ b/src/tyrian2.c
|
||||
@@ -4325,8 +4325,8 @@ void JE_eventSystem( void )
|
||||
|
||||
case 19: /* Enemy Global Move */
|
||||
{
|
||||
- int initial_i, max_i;
|
||||
- bool all_enemies;
|
||||
+ int initial_i = 0, max_i = 0;
|
||||
+ bool all_enemies = false;
|
||||
|
||||
if (eventRec[eventLoc-1].eventdat3 > 79 && eventRec[eventLoc-1].eventdat3 < 90)
|
||||
{
|
||||
--
|
||||
2.1.0
|
||||
|
||||
@@ -53,21 +53,6 @@ diff --git a/src/tyrian2.c b/src/tyrian2.c
|
||||
index 4d528cf..411d8b6 100644
|
||||
--- a/src/tyrian2.c
|
||||
+++ b/src/tyrian2.c
|
||||
@@ -2088,12 +2088,12 @@ draw_player_shot_loop_end:
|
||||
if (debug)
|
||||
{
|
||||
strcpy(tempStr, "");
|
||||
- for (temp = 0; temp < 9; temp++)
|
||||
+ /*for (temp = 0; temp < 9; temp++)
|
||||
{
|
||||
sprintf(tempStr, "%s%c", tempStr, smoothies[temp] + 48);
|
||||
}
|
||||
sprintf(buffer, "SM = %s", tempStr);
|
||||
- JE_outText(VGAScreen, 30, 70, buffer, 4, 0);
|
||||
+ JE_outText(VGAScreen, 30, 70, buffer, 4, 0);*/
|
||||
|
||||
sprintf(buffer, "Memory left = %d", -1);
|
||||
JE_outText(VGAScreen, 30, 80, buffer, 4, 0);
|
||||
@@ -2608,7 +2608,7 @@ new_game:
|
||||
read_encrypted_pascal_string(s, sizeof(s), ep_f);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From 95788b1b09b0bd8e89cc3c7e5ed769ae3e87ac34 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Sun, 31 Jul 2016 04:02:51 +0200
|
||||
Subject: [PATCH] fix build with pedantic gcc6
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
---
|
||||
src/joystick.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/joystick.c b/src/joystick.c
|
||||
index 63dd75d..bf99647 100644
|
||||
--- a/src/joystick.c
|
||||
+++ b/src/joystick.c
|
||||
@@ -42,7 +42,6 @@ bool ignore_joystick = false;
|
||||
int joysticks = 0;
|
||||
Joystick *joystick = NULL;
|
||||
|
||||
-static const char joystick_cfg_version = 1;
|
||||
static const int joystick_analog_max = 32767;
|
||||
|
||||
// eliminates axis movement below the threshold
|
||||
--
|
||||
2.5.5
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
From 28a0682bf3af1433ffdcd3c0458fdf4ebd5cc11a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
|
||||
Date: Fri, 7 Jun 2019 21:49:17 +0200
|
||||
Subject: [PATCH] Fix build with gcc 9
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
|
||||
---
|
||||
src/destruct.c | 2 +-
|
||||
src/game_menu.c | 4 ++--
|
||||
src/video_scale_hqNx.c | 4 ++--
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/destruct.c b/src/destruct.c
|
||||
index 873c76b..1150ab5 100644
|
||||
--- a/src/destruct.c
|
||||
+++ b/src/destruct.c
|
||||
@@ -2240,7 +2240,7 @@ static void DE_RunTickAI( void )
|
||||
ptrUnit = ptrTarget->unit;
|
||||
for (j = 0; j < config.max_installations; j++, ptrUnit++)
|
||||
{
|
||||
- if (abs(ptrUnit->unitX - ptrCurUnit->unitX) < 8)
|
||||
+ if (abs(((Sint32)ptrUnit->unitX) - ((Sint32)ptrCurUnit->unitX)) < 8)
|
||||
{
|
||||
/* I get it. This makes helicoptors hover over
|
||||
* their enemies. */
|
||||
diff --git a/src/game_menu.c b/src/game_menu.c
|
||||
index 7d24ad7..438c247 100644
|
||||
--- a/src/game_menu.c
|
||||
+++ b/src/game_menu.c
|
||||
@@ -1992,9 +1992,9 @@ void JE_updateNavScreen( void )
|
||||
navX = navX + (newNavX - navX) / 2.0f;
|
||||
navY = navY + (newNavY - navY) / 2.0f;
|
||||
|
||||
- if (abs(newNavX - navX) < 1)
|
||||
+ if (fabs(newNavX - navX) < 1)
|
||||
navX = newNavX;
|
||||
- if (abs(newNavY - navY) < 1)
|
||||
+ if (fabs(newNavY - navY) < 1)
|
||||
navY = newNavY;
|
||||
|
||||
fill_rectangle_xy(VGAScreen, 314, 0, 319, 199, 230);
|
||||
diff --git a/src/video_scale_hqNx.c b/src/video_scale_hqNx.c
|
||||
index 51836e6..6c7b5a5 100644
|
||||
--- a/src/video_scale_hqNx.c
|
||||
+++ b/src/video_scale_hqNx.c
|
||||
@@ -120,8 +120,8 @@ inline void interp10(Uint32 *pc, Uint32 c1, Uint32 c2, Uint32 c3)
|
||||
|
||||
inline bool diff(unsigned int w1, unsigned int w2)
|
||||
{
|
||||
- Uint32 YUV1 = yuv_palette[w1];
|
||||
- Uint32 YUV2 = yuv_palette[w2];
|
||||
+ Sint32 YUV1 = yuv_palette[w1];
|
||||
+ Sint32 YUV2 = yuv_palette[w2];
|
||||
return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
||||
( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
||||
( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) );
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@@ -1,367 +0,0 @@
|
||||
From 962ee8fc46ca51691bde1c8c1022dacbe8a037ed Mon Sep 17 00:00:00 2001
|
||||
From: Carl Reinke <carlreinke@users.noreply.github.com>
|
||||
Date: Sun, 14 Jun 2020 14:11:00 -0600
|
||||
Subject: [PATCH] Move definitions that don't need to be exposed from opl.h to
|
||||
opl.c
|
||||
|
||||
Upstream-Status: Accepted[https://github.com/opentyrian/opentyrian/commit/962ee8fc46ca51691bde1c8c1022dacbe8a037ed]
|
||||
|
||||
---
|
||||
src/opl.c | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
src/opl.h | 157 ++----------------------------------------------------
|
||||
2 files changed, 154 insertions(+), 156 deletions(-)
|
||||
|
||||
diff --git a/src/opl.c b/src/opl.c
|
||||
index a4071c5..f15474c 100644
|
||||
--- a/src/opl.c
|
||||
+++ b/src/opl.c
|
||||
@@ -23,12 +23,161 @@
|
||||
* Copyright (C) 1998-2001 Ken Silverman
|
||||
* Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
*/
|
||||
-
|
||||
+#include "opl.h"
|
||||
|
||||
#include <math.h>
|
||||
+#include <stdbool.h>
|
||||
#include <stdlib.h> // rand()
|
||||
#include <string.h> // memset()
|
||||
-#include "opl.h"
|
||||
+
|
||||
+#define fltype double
|
||||
+
|
||||
+ /*
|
||||
+ define attribution that inlines/forces inlining of a function (optional)
|
||||
+ */
|
||||
+#define OPL_INLINE inline
|
||||
+
|
||||
+
|
||||
+#undef NUM_CHANNELS
|
||||
+#if defined(OPLTYPE_IS_OPL3)
|
||||
+#define NUM_CHANNELS 18
|
||||
+#else
|
||||
+#define NUM_CHANNELS 9
|
||||
+#endif
|
||||
+
|
||||
+#define MAXOPERATORS (NUM_CHANNELS*2)
|
||||
+
|
||||
+
|
||||
+#define FL05 ((fltype)0.5)
|
||||
+#define FL2 ((fltype)2.0)
|
||||
+#define PI ((fltype)3.1415926535897932384626433832795)
|
||||
+
|
||||
+
|
||||
+#define FIXEDPT 0x10000 // fixed-point calculations using 16+16
|
||||
+#define FIXEDPT_LFO 0x1000000 // fixed-point calculations using 8+24
|
||||
+
|
||||
+#define WAVEPREC 1024 // waveform precision (10 bits)
|
||||
+
|
||||
+#define INTFREQU ((fltype)(14318180.0 / 288.0)) // clocking of the chip
|
||||
+
|
||||
+
|
||||
+#define OF_TYPE_ATT 0
|
||||
+#define OF_TYPE_DEC 1
|
||||
+#define OF_TYPE_REL 2
|
||||
+#define OF_TYPE_SUS 3
|
||||
+#define OF_TYPE_SUS_NOKEEP 4
|
||||
+#define OF_TYPE_OFF 5
|
||||
+
|
||||
+#define ARC_CONTROL 0x00
|
||||
+#define ARC_TVS_KSR_MUL 0x20
|
||||
+#define ARC_KSL_OUTLEV 0x40
|
||||
+#define ARC_ATTR_DECR 0x60
|
||||
+#define ARC_SUSL_RELR 0x80
|
||||
+#define ARC_FREQ_NUM 0xa0
|
||||
+#define ARC_KON_BNUM 0xb0
|
||||
+#define ARC_PERC_MODE 0xbd
|
||||
+#define ARC_FEEDBACK 0xc0
|
||||
+#define ARC_WAVE_SEL 0xe0
|
||||
+
|
||||
+#define ARC_SECONDSET 0x100 // second operator set for OPL3
|
||||
+
|
||||
+
|
||||
+#define OP_ACT_OFF 0x00
|
||||
+#define OP_ACT_NORMAL 0x01 // regular channel activated (bitmasked)
|
||||
+#define OP_ACT_PERC 0x02 // percussion channel activated (bitmasked)
|
||||
+
|
||||
+#define BLOCKBUF_SIZE 512
|
||||
+
|
||||
+
|
||||
+ // vibrato constants
|
||||
+#define VIBTAB_SIZE 8
|
||||
+#define VIBFAC 70/50000 // no braces, integer mul/div
|
||||
+
|
||||
+ // tremolo constants and table
|
||||
+#define TREMTAB_SIZE 53
|
||||
+#define TREM_FREQ ((fltype)(3.7)) // tremolo at 3.7hz
|
||||
+
|
||||
+
|
||||
+ /* operator struct definition
|
||||
+ For OPL2 all 9 channels consist of two operators each, carrier and modulator.
|
||||
+ Channel x has operators x as modulator and operators (9+x) as carrier.
|
||||
+ For OPL3 all 18 channels consist either of two operators (2op mode) or four
|
||||
+ operators (4op mode) which is determined through register4 of the second
|
||||
+ adlib register set.
|
||||
+ Only the channels 0,1,2 (first set) and 9,10,11 (second set) can act as
|
||||
+ 4op channels. The two additional operators for a channel y come from the
|
||||
+ 2op channel y+3 so the operatorss y, (9+y), y+3, (9+y)+3 make up a 4op
|
||||
+ channel.
|
||||
+ */
|
||||
+typedef struct operator_struct {
|
||||
+ Bit32s cval, lastcval; // current output/last output (used for feedback)
|
||||
+ Bit32u tcount, wfpos, tinc; // time (position in waveform) and time increment
|
||||
+ fltype amp, step_amp; // and amplification (envelope)
|
||||
+ fltype vol; // volume
|
||||
+ fltype sustain_level; // sustain level
|
||||
+ Bit32s mfbi; // feedback amount
|
||||
+ fltype a0, a1, a2, a3; // attack rate function coefficients
|
||||
+ fltype decaymul, releasemul; // decay/release rate functions
|
||||
+ Bit32u op_state; // current state of operator (attack/decay/sustain/release/off)
|
||||
+ Bit32u toff;
|
||||
+ Bit32s freq_high; // highest three bits of the frequency, used for vibrato calculations
|
||||
+ Bit16s* cur_wform; // start of selected waveform
|
||||
+ Bit32u cur_wmask; // mask for selected waveform
|
||||
+ Bit32u act_state; // activity state (regular, percussion)
|
||||
+ bool sus_keep; // keep sustain level when decay finished
|
||||
+ bool vibrato,tremolo; // vibrato/tremolo enable bits
|
||||
+
|
||||
+ // variables used to provide non-continuous envelopes
|
||||
+ Bit32u generator_pos; // for non-standard sample rates we need to determine how many samples have passed
|
||||
+ Bits cur_env_step; // current (standardized) sample position
|
||||
+ Bits env_step_a,env_step_d,env_step_r; // number of std samples of one step (for attack/decay/release mode)
|
||||
+ Bit8u step_skip_pos_a; // position of 8-cyclic step skipping (always 2^x to check against mask)
|
||||
+ Bits env_step_skip_a; // bitmask that determines if a step is skipped (respective bit is zero then)
|
||||
+
|
||||
+#if defined(OPLTYPE_IS_OPL3)
|
||||
+ bool is_4op,is_4op_attached; // base of a 4op channel/part of a 4op channel
|
||||
+ Bit32s left_pan,right_pan; // opl3 stereo panning amount
|
||||
+#endif
|
||||
+} op_type;
|
||||
+
|
||||
+// per-chip variables
|
||||
+static op_type op[MAXOPERATORS];
|
||||
+
|
||||
+static Bits int_samplerate;
|
||||
+
|
||||
+static Bit8u status;
|
||||
+static Bit32u opl_index;
|
||||
+#if defined(OPLTYPE_IS_OPL3)
|
||||
+static Bit8u adlibreg[512]; // adlib register set (including second set)
|
||||
+static Bit8u wave_sel[44]; // waveform selection
|
||||
+#else
|
||||
+static Bit8u adlibreg[256]; // adlib register set
|
||||
+static Bit8u wave_sel[22]; // waveform selection
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+ // vibrato/tremolo increment/counter
|
||||
+static Bit32u vibtab_pos;
|
||||
+static Bit32u vibtab_add;
|
||||
+static Bit32u tremtab_pos;
|
||||
+static Bit32u tremtab_add;
|
||||
+
|
||||
+
|
||||
+// enable an operator
|
||||
+void enable_operator(Bitu regbase, op_type* op_pt, Bit32u act_type);
|
||||
+
|
||||
+// functions to change parameters of an operator
|
||||
+void change_frequency(Bitu chanbase, Bitu regbase, op_type* op_pt);
|
||||
+
|
||||
+void change_attackrate(Bitu regbase, op_type* op_pt);
|
||||
+void change_decayrate(Bitu regbase, op_type* op_pt);
|
||||
+void change_releaserate(Bitu regbase, op_type* op_pt);
|
||||
+void change_sustainlevel(Bitu regbase, op_type* op_pt);
|
||||
+void change_waveform(Bitu regbase, op_type* op_pt);
|
||||
+void change_keepsustain(Bitu regbase, op_type* op_pt);
|
||||
+void change_vibrato(Bitu regbase, op_type* op_pt);
|
||||
+void change_feedback(Bitu chanbase, op_type* op_pt);
|
||||
+
|
||||
|
||||
static Bit32u generator_add; // should be a chip parameter
|
||||
|
||||
diff --git a/src/opl.h b/src/opl.h
|
||||
index c8e643b..cbb56ad 100644
|
||||
--- a/src/opl.h
|
||||
+++ b/src/opl.h
|
||||
@@ -25,11 +25,8 @@
|
||||
* Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
*/
|
||||
|
||||
-
|
||||
-#define fltype double
|
||||
-
|
||||
-#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
+
|
||||
typedef uintptr_t Bitu;
|
||||
typedef intptr_t Bits;
|
||||
typedef uint32_t Bit32u;
|
||||
@@ -39,154 +36,6 @@ typedef int16_t Bit16s;
|
||||
typedef uint8_t Bit8u;
|
||||
typedef int8_t Bit8s;
|
||||
|
||||
-
|
||||
-/*
|
||||
- define attribution that inlines/forces inlining of a function (optional)
|
||||
-*/
|
||||
-#define OPL_INLINE inline
|
||||
-
|
||||
-
|
||||
-#undef NUM_CHANNELS
|
||||
-#if defined(OPLTYPE_IS_OPL3)
|
||||
-#define NUM_CHANNELS 18
|
||||
-#else
|
||||
-#define NUM_CHANNELS 9
|
||||
-#endif
|
||||
-
|
||||
-#define MAXOPERATORS (NUM_CHANNELS*2)
|
||||
-
|
||||
-
|
||||
-#define FL05 ((fltype)0.5)
|
||||
-#define FL2 ((fltype)2.0)
|
||||
-#define PI ((fltype)3.1415926535897932384626433832795)
|
||||
-
|
||||
-
|
||||
-#define FIXEDPT 0x10000 // fixed-point calculations using 16+16
|
||||
-#define FIXEDPT_LFO 0x1000000 // fixed-point calculations using 8+24
|
||||
-
|
||||
-#define WAVEPREC 1024 // waveform precision (10 bits)
|
||||
-
|
||||
-#define INTFREQU ((fltype)(14318180.0 / 288.0)) // clocking of the chip
|
||||
-
|
||||
-
|
||||
-#define OF_TYPE_ATT 0
|
||||
-#define OF_TYPE_DEC 1
|
||||
-#define OF_TYPE_REL 2
|
||||
-#define OF_TYPE_SUS 3
|
||||
-#define OF_TYPE_SUS_NOKEEP 4
|
||||
-#define OF_TYPE_OFF 5
|
||||
-
|
||||
-#define ARC_CONTROL 0x00
|
||||
-#define ARC_TVS_KSR_MUL 0x20
|
||||
-#define ARC_KSL_OUTLEV 0x40
|
||||
-#define ARC_ATTR_DECR 0x60
|
||||
-#define ARC_SUSL_RELR 0x80
|
||||
-#define ARC_FREQ_NUM 0xa0
|
||||
-#define ARC_KON_BNUM 0xb0
|
||||
-#define ARC_PERC_MODE 0xbd
|
||||
-#define ARC_FEEDBACK 0xc0
|
||||
-#define ARC_WAVE_SEL 0xe0
|
||||
-
|
||||
-#define ARC_SECONDSET 0x100 // second operator set for OPL3
|
||||
-
|
||||
-
|
||||
-#define OP_ACT_OFF 0x00
|
||||
-#define OP_ACT_NORMAL 0x01 // regular channel activated (bitmasked)
|
||||
-#define OP_ACT_PERC 0x02 // percussion channel activated (bitmasked)
|
||||
-
|
||||
-#define BLOCKBUF_SIZE 512
|
||||
-
|
||||
-
|
||||
-// vibrato constants
|
||||
-#define VIBTAB_SIZE 8
|
||||
-#define VIBFAC 70/50000 // no braces, integer mul/div
|
||||
-
|
||||
-// tremolo constants and table
|
||||
-#define TREMTAB_SIZE 53
|
||||
-#define TREM_FREQ ((fltype)(3.7)) // tremolo at 3.7hz
|
||||
-
|
||||
-
|
||||
-/* operator struct definition
|
||||
- For OPL2 all 9 channels consist of two operators each, carrier and modulator.
|
||||
- Channel x has operators x as modulator and operators (9+x) as carrier.
|
||||
- For OPL3 all 18 channels consist either of two operators (2op mode) or four
|
||||
- operators (4op mode) which is determined through register4 of the second
|
||||
- adlib register set.
|
||||
- Only the channels 0,1,2 (first set) and 9,10,11 (second set) can act as
|
||||
- 4op channels. The two additional operators for a channel y come from the
|
||||
- 2op channel y+3 so the operatorss y, (9+y), y+3, (9+y)+3 make up a 4op
|
||||
- channel.
|
||||
-*/
|
||||
-typedef struct operator_struct {
|
||||
- Bit32s cval, lastcval; // current output/last output (used for feedback)
|
||||
- Bit32u tcount, wfpos, tinc; // time (position in waveform) and time increment
|
||||
- fltype amp, step_amp; // and amplification (envelope)
|
||||
- fltype vol; // volume
|
||||
- fltype sustain_level; // sustain level
|
||||
- Bit32s mfbi; // feedback amount
|
||||
- fltype a0, a1, a2, a3; // attack rate function coefficients
|
||||
- fltype decaymul, releasemul; // decay/release rate functions
|
||||
- Bit32u op_state; // current state of operator (attack/decay/sustain/release/off)
|
||||
- Bit32u toff;
|
||||
- Bit32s freq_high; // highest three bits of the frequency, used for vibrato calculations
|
||||
- Bit16s* cur_wform; // start of selected waveform
|
||||
- Bit32u cur_wmask; // mask for selected waveform
|
||||
- Bit32u act_state; // activity state (regular, percussion)
|
||||
- bool sus_keep; // keep sustain level when decay finished
|
||||
- bool vibrato,tremolo; // vibrato/tremolo enable bits
|
||||
-
|
||||
- // variables used to provide non-continuous envelopes
|
||||
- Bit32u generator_pos; // for non-standard sample rates we need to determine how many samples have passed
|
||||
- Bits cur_env_step; // current (standardized) sample position
|
||||
- Bits env_step_a,env_step_d,env_step_r; // number of std samples of one step (for attack/decay/release mode)
|
||||
- Bit8u step_skip_pos_a; // position of 8-cyclic step skipping (always 2^x to check against mask)
|
||||
- Bits env_step_skip_a; // bitmask that determines if a step is skipped (respective bit is zero then)
|
||||
-
|
||||
-#if defined(OPLTYPE_IS_OPL3)
|
||||
- bool is_4op,is_4op_attached; // base of a 4op channel/part of a 4op channel
|
||||
- Bit32s left_pan,right_pan; // opl3 stereo panning amount
|
||||
-#endif
|
||||
-} op_type;
|
||||
-
|
||||
-// per-chip variables
|
||||
-Bitu chip_num;
|
||||
-op_type op[MAXOPERATORS];
|
||||
-
|
||||
-Bits int_samplerate;
|
||||
-
|
||||
-Bit8u status;
|
||||
-Bit32u opl_index;
|
||||
-#if defined(OPLTYPE_IS_OPL3)
|
||||
-Bit8u adlibreg[512]; // adlib register set (including second set)
|
||||
-Bit8u wave_sel[44]; // waveform selection
|
||||
-#else
|
||||
-Bit8u adlibreg[256]; // adlib register set
|
||||
-Bit8u wave_sel[22]; // waveform selection
|
||||
-#endif
|
||||
-
|
||||
-
|
||||
-// vibrato/tremolo increment/counter
|
||||
-Bit32u vibtab_pos;
|
||||
-Bit32u vibtab_add;
|
||||
-Bit32u tremtab_pos;
|
||||
-Bit32u tremtab_add;
|
||||
-
|
||||
-
|
||||
-// enable an operator
|
||||
-void enable_operator(Bitu regbase, op_type* op_pt, Bit32u act_type);
|
||||
-
|
||||
-// functions to change parameters of an operator
|
||||
-void change_frequency(Bitu chanbase, Bitu regbase, op_type* op_pt);
|
||||
-
|
||||
-void change_attackrate(Bitu regbase, op_type* op_pt);
|
||||
-void change_decayrate(Bitu regbase, op_type* op_pt);
|
||||
-void change_releaserate(Bitu regbase, op_type* op_pt);
|
||||
-void change_sustainlevel(Bitu regbase, op_type* op_pt);
|
||||
-void change_waveform(Bitu regbase, op_type* op_pt);
|
||||
-void change_keepsustain(Bitu regbase, op_type* op_pt);
|
||||
-void change_vibrato(Bitu regbase, op_type* op_pt);
|
||||
-void change_feedback(Bitu chanbase, op_type* op_pt);
|
||||
-
|
||||
// general functions
|
||||
void adlib_init(Bit32u samplerate);
|
||||
void adlib_write(Bitu idx, Bit8u val);
|
||||
@@ -195,8 +44,8 @@ void adlib_getsample(Bit16s* sndptr, Bits numsamples);
|
||||
Bitu adlib_reg_read(Bitu port);
|
||||
void adlib_write_index(Bitu port, Bit8u val);
|
||||
|
||||
-#endif /* OPL_H */
|
||||
-
|
||||
#define opl_init() adlib_init(OUTPUT_QUALITY * 11025)
|
||||
#define opl_write(reg, val) adlib_write(reg, val)
|
||||
#define opl_update(buf, num) adlib_getsample(buf, num)
|
||||
+
|
||||
+#endif /* OPL_H */
|
||||
--
|
||||
2.21.3
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
SUMMARY = "OpenTyrian is a port of the DOS shoot-em-up Tyrian"
|
||||
HOMEPAGE = "https://bitbucket.org/opentyrian/opentyrian/wiki/Home"
|
||||
SECTION = "games"
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
|
||||
|
||||
DEPENDS = "libsdl libsdl-net"
|
||||
|
||||
inherit autotools-brokensep pkgconfig
|
||||
|
||||
SRC_URI = " \
|
||||
http://www.camanis.net/opentyrian/releases/${BPN}-${PV}-src.tar.gz \
|
||||
http://camanis.net/opentyrian/tyrian21.zip;name=data \
|
||||
file://0001-Makefile-use-pkgconfig-to-find-sdl.patch \
|
||||
file://0002-Fix-several-uninitialized-variable-warnings.patch \
|
||||
file://0003-fix-build-with-pedantic-gcc6.patch \
|
||||
file://0004-increase-buffer-size-to-avoid-gcc7-format-overflow-e.patch \
|
||||
file://0005-fix-build-with-gcc8.patch \
|
||||
file://0006-Fix-build-with-gcc-9.patch \
|
||||
file://0007-Move-definitions-that-don-t-need-to-be-exposed-from-.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "978686c5a1dfbac69a2161aadf084c2b"
|
||||
SRC_URI[sha256sum] = "f54b6b3cedcefa187c9f605d6164aae29ec46a731a6df30d351af4c008dee45f"
|
||||
|
||||
SRC_URI[data.md5sum] = "2a3b206a6de25ed4b771af073f8ca904"
|
||||
SRC_URI[data.sha256sum] = "7790d09a2a3addcd33c66ef063d5900eb81cc9c342f4807eb8356364dd1d9277"
|
||||
|
||||
# Hack to build - yes this is bad but I sometimes still like to play
|
||||
# opentyrian at the risk it is going to kill me
|
||||
CFLAGS += "-Wimplicit-fallthrough=0 -Wno-error=format-truncation -Wno-error=format-overflow"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install ${BPN} ${D}${bindir}
|
||||
|
||||
install -d ${D}${mandir}/man6
|
||||
install linux/man/${BPN}.6 ${D}${mandir}/man6
|
||||
|
||||
install -d ${D}${datadir}/applications
|
||||
install linux/${BPN}.desktop ${D}${datadir}/applications
|
||||
|
||||
install -d ${D}${datadir}/pixmaps
|
||||
install linux/icons/tyrian-128.png ${D}${datadir}/pixmaps/${BPN}.png
|
||||
|
||||
install -d ${D}${datadir}/${BPN}/data
|
||||
install ${WORKDIR}/tyrian21/* ${D}${datadir}/${BPN}/data
|
||||
|
||||
# remove unneeded DOS stuff
|
||||
find ${D}${datadir}/${BPN}/data -name '*.exe' -exec rm -f {} \;
|
||||
find ${D}${datadir}/${BPN}/data -name '*.ovl' -exec rm -f {} \;
|
||||
find ${D}${datadir}/${BPN}/data -name 'setup.*' -exec rm -f {} \;
|
||||
find ${D}${datadir}/${BPN}/data -name '*.doc' -exec rm -f {} \;
|
||||
find ${D}${datadir}/${BPN}/data -name '*.tfp' -exec rm -f {} \;
|
||||
}
|
||||
Reference in New Issue
Block a user