raw has moved to pkgsrc
This commit is contained in:
parent
eaf9461d40
commit
6b8402ad9c
18 changed files with 2 additions and 873 deletions
5
Makefile
5
Makefile
|
@ -1,5 +1,5 @@
|
|||
# $Id: Makefile,v 1.1279 2004/05/14 14:41:52 thomasklausner Exp $
|
||||
# $NetBSD: Makefile,v 1.1279 2004/05/14 14:41:52 thomasklausner Exp $
|
||||
# $Id: Makefile,v 1.1280 2004/05/14 15:46:59 dillo Exp $
|
||||
# $NetBSD: Makefile,v 1.1280 2004/05/14 15:46:59 dillo Exp $
|
||||
|
||||
COMMENT= WIP pkgsrc packages
|
||||
|
||||
|
@ -601,7 +601,6 @@ SUBDIR+= qinx
|
|||
SUBDIR+= qn-x11
|
||||
SUBDIR+= quagga-devel
|
||||
SUBDIR+= rar3
|
||||
SUBDIR+= raw
|
||||
SUBDIR+= rc.subr
|
||||
SUBDIR+= rcorder
|
||||
SUBDIR+= regexxer
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
raw is a rewrite of the engine used in the action/adventure game
|
||||
Another World/Out of this World released for DOS and Amiga. This
|
||||
program is designed as a cross-platform replacement for the original
|
||||
executable and uses the SDL library. You will need the data files
|
||||
from the DOS version of the game to play.
|
32
raw/Makefile
32
raw/Makefile
|
@ -1,32 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.2 2004/05/14 15:40:38 dillo Exp $
|
||||
#
|
||||
|
||||
DISTNAME= raw-0.1.0
|
||||
CATEGORIES= games
|
||||
MASTER_SITES= http://membres.lycos.fr/cyxdown/raw/
|
||||
EXTRACT_SUFX= .tar.bz2
|
||||
|
||||
MAINTAINER= dillo@NetBSD.org
|
||||
HOMEPAGE= http://membres.lycos.fr/cyxdown/raw/
|
||||
COMMENT= Engine for playing Another World
|
||||
|
||||
USE_BUILDLINK3= yes
|
||||
ALL_TARGET= raw
|
||||
|
||||
.include "../../mk/endian.mk"
|
||||
.if ${MACHINE_ENDIAN} == "big"
|
||||
CFLAGS+= -DSYS_BIG_ENDIAN
|
||||
.elif ${MACHINE_ENDIAN} == "little"
|
||||
CFLAGS+= -DSYS_LITTLE_ENDIAN
|
||||
.else
|
||||
BROKEN= "Unknown endianness"
|
||||
.endif
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/raw ${PREFIX}/bin
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/raw
|
||||
${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/raw
|
||||
|
||||
.include "../../devel/SDL/buildlink3.mk"
|
||||
.include "../../devel/zlib/buildlink3.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
|
@ -1,4 +0,0 @@
|
|||
@comment $NetBSD: PLIST,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
bin/raw
|
||||
share/doc/raw/README
|
||||
@dirrm share/doc/raw
|
17
raw/distinfo
17
raw/distinfo
|
@ -1,17 +0,0 @@
|
|||
$NetBSD: distinfo,v 1.2 2004/05/14 15:40:40 dillo Exp $
|
||||
|
||||
SHA1 (raw-0.1.0.tar.bz2) = 81072215bd88e5e214516e569e5df24c3b4cc5e0
|
||||
Size (raw-0.1.0.tar.bz2) = 26331 bytes
|
||||
SHA1 (patch-aa) = 8f8ac043d5e600388d15aae01cd3c0968cdfd1af
|
||||
SHA1 (patch-ab) = 4a9143b003884c7e3f320a80c9f1b3619eef3cfb
|
||||
SHA1 (patch-ac) = b67f0d5700291720c7d4fa88738e3af0e31f8856
|
||||
SHA1 (patch-ad) = a5ba4c8da7905bdad41f693c6d097061178730e7
|
||||
SHA1 (patch-ae) = b05eff9ac667666103a97c5cab944638a01f2ab2
|
||||
SHA1 (patch-af) = 9c47bdb96b26e44e2e9d5397d84b6250cfbca8f7
|
||||
SHA1 (patch-ag) = 13d29579e2d398b20c7cffd6fc8e3ea0f10db183
|
||||
SHA1 (patch-ah) = 27684e304edac6f155a1512fcc177d545c89e461
|
||||
SHA1 (patch-ai) = ce8d58ffeb58f766a3678693850c51be2d65dfcb
|
||||
SHA1 (patch-aj) = 48e1860506c9252ea4c12ab735559c13be81a909
|
||||
SHA1 (patch-ak) = adc6bc051193e9f54cc1bc80aa94da7965357d66
|
||||
SHA1 (patch-al) = 1e2879f83f816a3ac2a4a95766c0eb069ddd9242
|
||||
SHA1 (patch-am) = e55e7e7fcb0b36147088c916625f5e24249f415d
|
|
@ -1,26 +0,0 @@
|
|||
$NetBSD: patch-aa,v 1.2 2004/05/14 15:40:49 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- Makefile.orig Wed Apr 21 20:52:50 2004
|
||||
+++ Makefile
|
||||
@@ -2,14 +2,14 @@
|
||||
SDL_CFLAGS = `sdl-config --cflags`
|
||||
SDL_LIBS = `sdl-config --libs`
|
||||
|
||||
-DEFINES = -DLITTLE_ENDIAN
|
||||
+DEFINES = -DBYPASS_PROTECTION
|
||||
|
||||
-CXX = g++
|
||||
-CXXFLAGS:= -g -O2 -Wall -Wuninitialized -Wno-unknown-pragmas -Wshadow -Wstrict-prototypes
|
||||
-CXXFLAGS+= -Wimplicit -Wundef -Wreorder -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar
|
||||
+#CXX = g++
|
||||
+#CXXFLAGS:= -g -O -Wall -Wuninitialized -Wno-unknown-pragmas -Wshadow -Wstrict-prototypes
|
||||
+#CXXFLAGS+= -Wimplicit -Wundef -Wreorder -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar
|
||||
CXXFLAGS+= $(SDL_CFLAGS) $(DEFINES)
|
||||
|
||||
-SRCS = bank.cpp file.cpp engine.cpp logic.cpp resource.cpp sdlstub.cpp \
|
||||
+SRCS = bank.cpp file.cpp engine.cpp logic.cpp mixer.cpp resource.cpp sdlstub.cpp \
|
||||
serializer.cpp staticres.cpp util.cpp video.cpp main.cpp
|
||||
|
||||
OBJS = $(SRCS:.cpp=.o)
|
|
@ -1,51 +0,0 @@
|
|||
$NetBSD: patch-ab,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- engine.cpp.orig Mon Apr 19 21:01:30 2004
|
||||
+++ engine.cpp
|
||||
@@ -23,14 +23,13 @@
|
||||
|
||||
|
||||
Engine::Engine(SystemStub *stub, const char *dataDir, const char *saveDir)
|
||||
- : _stub(stub), _log(&_res, &_vid, stub), _res(&_vid, dataDir), _vid(&_res, stub),
|
||||
+ : _stub(stub), _log(&_mix, &_res, &_vid, stub), _mix(_stub), _res(&_vid, dataDir), _vid(&_res, stub),
|
||||
_dataDir(dataDir), _saveDir(saveDir), _stateSlot(0) {
|
||||
}
|
||||
|
||||
void Engine::run() {
|
||||
_stub->init("Out Of This World");
|
||||
setup();
|
||||
- // XXX
|
||||
_log.restartAt(0x3E80); // demo starts at 0x3E81
|
||||
while (!_stub->_pi.quit) {
|
||||
_log.setupScripts();
|
||||
@@ -47,10 +46,11 @@ void Engine::setup() {
|
||||
_res.allocMemBlock();
|
||||
_res.readEntries();
|
||||
_log.init();
|
||||
+ _mix.init();
|
||||
}
|
||||
|
||||
void Engine::finish() {
|
||||
- // XXX
|
||||
+ _mix.free();
|
||||
_res.freeMemBlock();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ void Engine::saveGameState(uint8 slot, c
|
||||
_log.saveOrLoad(s);
|
||||
_res.saveOrLoad(s);
|
||||
_vid.saveOrLoad(s);
|
||||
+ // XXX _mix.saveOrLoad(s);
|
||||
if (f.ioErr()) {
|
||||
warning("I/O error when saving game state");
|
||||
} else {
|
||||
@@ -128,6 +129,7 @@ void Engine::loadGameState(uint8 slot) {
|
||||
_log.saveOrLoad(s);
|
||||
_res.saveOrLoad(s);
|
||||
_vid.saveOrLoad(s);
|
||||
+ // XXX _mix.saveOrLoad(s);
|
||||
}
|
||||
if (f.ioErr()) {
|
||||
warning("I/O error when loading game state");
|
|
@ -1,22 +0,0 @@
|
|||
$NetBSD: patch-ac,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- engine.h.orig Sun Apr 18 19:42:26 2004
|
||||
+++ engine.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "intern.h"
|
||||
#include "logic.h"
|
||||
+#include "mixer.h"
|
||||
#include "resource.h"
|
||||
#include "video.h"
|
||||
|
||||
@@ -33,6 +34,7 @@ struct Engine {
|
||||
|
||||
SystemStub *_stub;
|
||||
Logic _log;
|
||||
+ Mixer _mix;
|
||||
Resource _res;
|
||||
Video _vid;
|
||||
const char *_dataDir, *_saveDir;
|
|
@ -1,219 +0,0 @@
|
|||
$NetBSD: patch-ad,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff and txhf-20040426.diff from the
|
||||
master site.
|
||||
|
||||
--- logic.cpp.orig Wed Apr 21 20:20:36 2004
|
||||
+++ logic.cpp
|
||||
@@ -18,14 +18,15 @@
|
||||
|
||||
#include <ctime>
|
||||
#include "logic.h"
|
||||
+#include "mixer.h"
|
||||
#include "resource.h"
|
||||
#include "video.h"
|
||||
#include "serializer.h"
|
||||
#include "systemstub.h"
|
||||
|
||||
|
||||
-Logic::Logic(Resource *res, Video *vid, SystemStub *stub)
|
||||
- : _res(res), _vid(vid), _stub(stub) {
|
||||
+Logic::Logic(Mixer *mix, Resource *res, Video *vid, SystemStub *stub)
|
||||
+ : _mix(mix), _res(res), _vid(vid), _stub(stub) {
|
||||
}
|
||||
|
||||
void Logic::init() {
|
||||
@@ -57,6 +58,16 @@ void Logic::op_add() {
|
||||
}
|
||||
|
||||
void Logic::op_addConst() {
|
||||
+ if (_res->_curPtrsId == 0x3E86 && _scriptPtr.pc == _res->_segCode + 0x6D48) {
|
||||
+ warning("Logic::op_addConst() hack for non-stop looping gun bug");
|
||||
+ // the script 0x27 slot 0x17 doesn't stop the gun sound from looping, I
|
||||
+ // don't really know why ; for now, let's play the 'stopping sound' like
|
||||
+ // the other scripts do
|
||||
+ // (0x6D43) jmp(0x6CE5)
|
||||
+ // (0x6D46) break
|
||||
+ // (0x6D47) VAR(6) += -50
|
||||
+ snd_playSound(0x5B, 1, 64, 1);
|
||||
+ }
|
||||
uint8 i = _scriptPtr.fetchByte();
|
||||
int16 n = _scriptPtr.fetchWord();
|
||||
debug(DBG_LOGIC, "Logic::op_addConst(0x%02X, %d)", i, n);
|
||||
@@ -68,12 +79,18 @@ void Logic::op_call() {
|
||||
uint8 sp = _stackPtr;
|
||||
debug(DBG_LOGIC, "Logic::op_call(0x%X)", off);
|
||||
_scriptStackCalls[sp] = _scriptPtr.pc - _res->_segCode;
|
||||
+ if (_stackPtr == 0xFF) {
|
||||
+ error("Logic::op_call() ec=0x%X stack overflow", 0x8F);
|
||||
+ }
|
||||
++_stackPtr;
|
||||
_scriptPtr.pc = _res->_segCode + off;
|
||||
}
|
||||
|
||||
void Logic::op_ret() {
|
||||
debug(DBG_LOGIC, "Logic::op_ret()");
|
||||
+ if (_stackPtr == 0) {
|
||||
+ error("Logic::op_ret() ec=0x%X stack underflow", 0x8F);
|
||||
+ }
|
||||
--_stackPtr;
|
||||
uint8 sp = _stackPtr;
|
||||
_scriptPtr.pc = _res->_segCode + _scriptStackCalls[sp];
|
||||
@@ -123,13 +140,14 @@ void Logic::op_condJmp() {
|
||||
#endif
|
||||
uint8 op = _scriptPtr.fetchByte();
|
||||
int16 b = _scriptVars[_scriptPtr.fetchByte()];
|
||||
- int16 a = _scriptPtr.fetchByte();
|
||||
+ uint8 c = _scriptPtr.fetchByte();
|
||||
+ int16 a;
|
||||
if (op & 0x80) {
|
||||
- a = _scriptVars[a];
|
||||
+ a = _scriptVars[c];
|
||||
+ } else if (op & 0x40) {
|
||||
+ a = c * 256 + _scriptPtr.fetchByte();
|
||||
} else {
|
||||
- if (op & 0x40) {
|
||||
- a = (a << 8) | _scriptPtr.fetchByte();
|
||||
- }
|
||||
+ a = c;
|
||||
}
|
||||
debug(DBG_LOGIC, "Logic::op_condJmp(%d, 0x%02X, 0x%02X)", op, b, a);
|
||||
bool expr = false;
|
||||
@@ -178,21 +196,19 @@ void Logic::op_resetScript() {
|
||||
return;
|
||||
}
|
||||
++n;
|
||||
- uint8 _al = _scriptPtr.fetchByte();
|
||||
+ uint8 a = _scriptPtr.fetchByte();
|
||||
|
||||
- debug(DBG_LOGIC, "Logic::op_resetScript(%d, %d, %d)", j, i, _al);
|
||||
+ debug(DBG_LOGIC, "Logic::op_resetScript(%d, %d, %d)", j, i, a);
|
||||
|
||||
- if (_al == 2) {
|
||||
- uint16 *_si = &_scriptPos[1][j];
|
||||
+ if (a == 2) {
|
||||
+ uint16 *p = &_scriptPos[1][j];
|
||||
while (n--) {
|
||||
- *_si = 0xFFFE;
|
||||
- ++_si;
|
||||
+ *p++ = 0xFFFE;
|
||||
}
|
||||
- } else if (_al < 2) {
|
||||
- uint8 *_si = &_scriptPaused[1][j];
|
||||
+ } else if (a < 2) {
|
||||
+ uint8 *p = &_scriptPaused[1][j];
|
||||
while (n--) {
|
||||
- *_si = _al;
|
||||
- ++_si;
|
||||
+ *p++ = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,54 +283,60 @@ void Logic::op_and() {
|
||||
uint8 i = _scriptPtr.fetchByte();
|
||||
uint16 n = _scriptPtr.fetchWord();
|
||||
debug(DBG_LOGIC, "Logic::op_and(0x%02X, %d)", i, n);
|
||||
- _scriptVars[i] &= n;
|
||||
+ _scriptVars[i] = (uint16)_scriptVars[i] & n;
|
||||
}
|
||||
|
||||
void Logic::op_or() {
|
||||
uint8 i = _scriptPtr.fetchByte();
|
||||
uint16 n = _scriptPtr.fetchWord();
|
||||
debug(DBG_LOGIC, "Logic::op_or(0x%02X, %d)", i, n);
|
||||
- _scriptVars[i] |= n;
|
||||
+ _scriptVars[i] = (uint16)_scriptVars[i] | n;
|
||||
}
|
||||
|
||||
void Logic::op_shl() {
|
||||
uint8 i = _scriptPtr.fetchByte();
|
||||
uint16 n = _scriptPtr.fetchWord();
|
||||
debug(DBG_LOGIC, "Logic::op_shl(0x%02X, %d)", i, n);
|
||||
- _scriptVars[i] <<= n;
|
||||
+ _scriptVars[i] = (uint16)_scriptVars[i] << n;
|
||||
}
|
||||
|
||||
void Logic::op_shr() {
|
||||
uint8 i = _scriptPtr.fetchByte();
|
||||
uint16 n = _scriptPtr.fetchWord();
|
||||
debug(DBG_LOGIC, "Logic::op_shr(0x%02X, %d)", i, n);
|
||||
- _scriptVars[i] >>= n;
|
||||
+ _scriptVars[i] = (uint16)_scriptVars[i] >> n;
|
||||
}
|
||||
|
||||
-void Logic::op_soundUnk1() {
|
||||
- uint16 b = _scriptPtr.fetchWord();
|
||||
- uint16 c = _scriptPtr.fetchWord();
|
||||
- uint8 a = _scriptPtr.fetchByte();
|
||||
- debug(DBG_LOGIC, "Logic::op_soundUnk1(0x%X, 0x%X, %d)", b, c, a);
|
||||
- // XXX
|
||||
+void Logic::op_playSound() {
|
||||
+ uint16 resNum = _scriptPtr.fetchWord();
|
||||
+ uint8 freq = _scriptPtr.fetchByte();
|
||||
+ uint8 vol = _scriptPtr.fetchByte();
|
||||
+ uint8 channel = _scriptPtr.fetchByte();
|
||||
+ debug(DBG_LOGIC, "Logic::op_playSound(0x%X, %d, %d, %d)", resNum, freq, vol, channel);
|
||||
+ snd_playSound(resNum, freq, vol, channel);
|
||||
}
|
||||
|
||||
void Logic::op_updateMemList() {
|
||||
uint16 num = _scriptPtr.fetchWord();
|
||||
debug(DBG_LOGIC, "Logic::op_updateMemList(%d)", num);
|
||||
- _res->update(num);
|
||||
+ if (num == 0) {
|
||||
+ _mix->stopAll();
|
||||
+ _res->invalidateRes();
|
||||
+ } else {
|
||||
+ _res->update(num);
|
||||
+ }
|
||||
}
|
||||
|
||||
-void Logic::op_soundUnk2() {
|
||||
- uint16 b = _scriptPtr.fetchWord();
|
||||
- uint16 c = _scriptPtr.fetchWord();
|
||||
- uint8 a = _scriptPtr.fetchByte();
|
||||
- debug(DBG_LOGIC, "Logic::op_soundUnk2(0x%X, 0x%X, %d)", b, c, a);
|
||||
- // XXX
|
||||
+void Logic::op_playMusic() {
|
||||
+ uint16 resNum = _scriptPtr.fetchWord();
|
||||
+ uint16 delay = _scriptPtr.fetchWord();
|
||||
+ uint8 pos = _scriptPtr.fetchByte();
|
||||
+ debug(DBG_LOGIC, "Logic::op_playMusic(0x%X, %d, %d)", resNum, delay, pos);
|
||||
+// snd_playMusic(resNum, delay, pos);
|
||||
}
|
||||
|
||||
void Logic::restartAt(uint16 ptrId) {
|
||||
- // XXX
|
||||
+ _mix->stopAll();
|
||||
_scriptVars[0xE4] = 0x14;
|
||||
_res->setupPtrs(ptrId);
|
||||
memset((uint8 *)_scriptPos, 0xFF, sizeof(_scriptPos));
|
||||
@@ -489,6 +511,28 @@ void Logic::inp_handleSpecialKeys() {
|
||||
// XXX
|
||||
if (_scriptVars[0xC9] == 1) {
|
||||
warning("Logic::inp_handleSpecialKeys() unhandled case (_scriptVars[0xC9] == 1)");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void Logic::snd_playSound(uint16 resNum, uint8 freq, uint8 vol, uint8 channel) {
|
||||
+ debug(DBG_SND, "snd_playSound(0x%X, %d, %d, %d)", resNum, freq, vol, channel);
|
||||
+ // XXX if (_res->_curPtrsId != 0x3E80 && _scriptVar_0xBF != _scriptVars[0xBF])
|
||||
+ MemEntry *me = &_res->_memList[resNum];
|
||||
+ if (me->valid == 1) {
|
||||
+ if (vol == 0) {
|
||||
+ _mix->stopChannel(channel);
|
||||
+ } else {
|
||||
+ MixerChunk mc;
|
||||
+ memset(&mc, 0, sizeof(mc));
|
||||
+ mc.data = me->bufPtr + 8; // skip header
|
||||
+ mc.len = READ_BE_UINT16(me->bufPtr) * 2;
|
||||
+ mc.loopLen = READ_BE_UINT16(me->bufPtr + 2) * 2;
|
||||
+ if (mc.loopLen != 0) {
|
||||
+ mc.loopPos = mc.len;
|
||||
+ }
|
||||
+ assert(freq < 40);
|
||||
+ _mix->playChannel(channel & 3, &mc, _freqTable[freq], MIN(vol, 0x3F));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
$NetBSD: patch-ae,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- logic.h.orig Sun Apr 18 19:30:48 2004
|
||||
+++ logic.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "intern.h"
|
||||
|
||||
+struct Mixer;
|
||||
struct Resource;
|
||||
struct Serializer;
|
||||
struct SystemStub;
|
||||
@@ -46,7 +47,9 @@ struct Logic {
|
||||
};
|
||||
|
||||
static const OpcodeStub _opTable[];
|
||||
+ static const uint16 _freqTable[];
|
||||
|
||||
+ Mixer *_mix;
|
||||
Resource *_res;
|
||||
Video *_vid;
|
||||
SystemStub *_stub;
|
||||
@@ -61,7 +64,7 @@ struct Logic {
|
||||
bool _scriptHalted;
|
||||
bool _fastMode;
|
||||
|
||||
- Logic(Resource *res, Video *vid, SystemStub *stub);
|
||||
+ Logic(Mixer *mix, Resource *res, Video *vid, SystemStub *stub);
|
||||
void init();
|
||||
|
||||
void op_movConst();
|
||||
@@ -88,9 +91,9 @@ struct Logic {
|
||||
void op_or();
|
||||
void op_shl();
|
||||
void op_shr();
|
||||
- void op_soundUnk1();
|
||||
+ void op_playSound();
|
||||
void op_updateMemList();
|
||||
- void op_soundUnk2();
|
||||
+ void op_playMusic();
|
||||
|
||||
void restartAt(uint16 ptrId);
|
||||
void setupPtrs(uint16 ptrId);
|
||||
@@ -100,6 +103,8 @@ struct Logic {
|
||||
|
||||
void inp_updatePlayer();
|
||||
void inp_handleSpecialKeys();
|
||||
+
|
||||
+ void snd_playSound(uint16 resNum, uint8 freq, uint8 vol, uint8 channel);
|
||||
|
||||
void saveOrLoad(Serializer &ser);
|
||||
};
|
|
@ -1,124 +0,0 @@
|
|||
$NetBSD: patch-af,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- mixer.cpp.orig Sun May 9 21:04:46 2004
|
||||
+++ mixer.cpp
|
||||
@@ -0,0 +1,117 @@
|
||||
+/* Raw - Another World Interpreter
|
||||
+ * Copyright (C) 2004 Gregory Montoir
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2
|
||||
+ * of the License, or (at your option) any later version.
|
||||
+
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+ */
|
||||
+
|
||||
+#include "mixer.h"
|
||||
+#include "systemstub.h"
|
||||
+
|
||||
+
|
||||
+static int8 addclamp(int a, int b) {
|
||||
+ int add = a + b;
|
||||
+ if (add < -128) {
|
||||
+ add = -128;
|
||||
+ }
|
||||
+ else if (add > 127) {
|
||||
+ add = 127;
|
||||
+ }
|
||||
+ return (int8)add;
|
||||
+}
|
||||
+
|
||||
+Mixer::Mixer(SystemStub *stub)
|
||||
+ : _stub(stub) {
|
||||
+}
|
||||
+
|
||||
+void Mixer::init() {
|
||||
+ memset(_channels, 0, sizeof(_channels));
|
||||
+ _stub->startAudio(Mixer::mixCallback, this);
|
||||
+}
|
||||
+
|
||||
+void Mixer::free() {
|
||||
+ _stub->stopAudio();
|
||||
+}
|
||||
+
|
||||
+void Mixer::playChannel(uint8 channel, const MixerChunk *mc, uint16 freq, uint8 volume) {
|
||||
+ debug(DBG_SND, "Mixer::playChannel(%d, %d, %d)", channel, freq, volume);
|
||||
+ assert(channel < NUM_CHANNELS);
|
||||
+ _stub->lockAudio();
|
||||
+ MixerChannel *ch = &_channels[channel];
|
||||
+ ch->active = true;
|
||||
+ ch->volume = volume;
|
||||
+ ch->chunk = *mc;
|
||||
+ ch->chunkPos = 0;
|
||||
+ ch->chunkInc = (freq << 8) / _stub->getOutputSampleRate();
|
||||
+ _stub->unlockAudio();
|
||||
+}
|
||||
+
|
||||
+void Mixer::stopChannel(uint8 channel) {
|
||||
+ debug(DBG_SND, "Mixer::stopChannel(%d)", channel);
|
||||
+ assert(channel < NUM_CHANNELS);
|
||||
+ _stub->lockAudio();
|
||||
+ _channels[channel].active = false;
|
||||
+ _stub->unlockAudio();
|
||||
+}
|
||||
+
|
||||
+void Mixer::stopAll() {
|
||||
+ debug(DBG_SND, "Mixer::stopAll()");
|
||||
+ _stub->lockAudio();
|
||||
+ for (uint8 i = 0; i < NUM_CHANNELS; ++i) {
|
||||
+ _channels[i].active = false;
|
||||
+ }
|
||||
+ _stub->unlockAudio();
|
||||
+}
|
||||
+
|
||||
+void Mixer::mix(int8 *buf, int len) {
|
||||
+ memset(buf, 0, len);
|
||||
+ for (uint8 i = 0; i < NUM_CHANNELS; ++i) {
|
||||
+ MixerChannel *ch = &_channels[i];
|
||||
+ if (ch->active) {
|
||||
+ int8 *pBuf = buf;
|
||||
+ for (int j = 0; j < len; ++j, ++pBuf) {
|
||||
+ uint16 p1, p2;
|
||||
+ uint16 ilc = (ch->chunkPos & 0xFF);
|
||||
+ p1 = ch->chunkPos >> 8;
|
||||
+ ch->chunkPos += ch->chunkInc;
|
||||
+ if (ch->chunk.loopLen != 0) {
|
||||
+ if (p1 == ch->chunk.loopPos + ch->chunk.loopLen - 1) {
|
||||
+ debug(DBG_SND, "Looping sample on channel %d", i);
|
||||
+ ch->chunkPos = p2 = ch->chunk.loopPos;
|
||||
+ } else {
|
||||
+ p2 = p1 + 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (p1 == ch->chunk.len - 1) {
|
||||
+ debug(DBG_SND, "Stopping sample on channel %d", i);
|
||||
+ ch->active = false;
|
||||
+ break;
|
||||
+ } else {
|
||||
+ p2 = p1 + 1;
|
||||
+ }
|
||||
+ }
|
||||
+ // interpolate
|
||||
+ int8 b1 = *(int8 *)(ch->chunk.data + p1);
|
||||
+ int8 b2 = *(int8 *)(ch->chunk.data + p2);
|
||||
+ int8 b = (int8)((b1 * (0xFF - ilc) + b2 * ilc) >> 8);
|
||||
+ // set volume and clamp
|
||||
+ *pBuf = addclamp(*pBuf, (int)b * ch->volume / 0x40);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void Mixer::mixCallback(void *param, uint8 *buf, int len) {
|
||||
+ ((Mixer *)param)->mix((int8 *)buf, len);
|
||||
+}
|
|
@ -1,68 +0,0 @@
|
|||
$NetBSD: patch-ag,v 1.1.1.1 2004/05/09 19:25:46 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- mixer.h.orig Sun May 9 21:04:49 2004
|
||||
+++ mixer.h
|
||||
@@ -0,0 +1,61 @@
|
||||
+/* Raw - Another World Interpreter
|
||||
+ * Copyright (C) 2004 Gregory Montoir
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2
|
||||
+ * of the License, or (at your option) any later version.
|
||||
+
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __MIXER_H__
|
||||
+#define __MIXER_H__
|
||||
+
|
||||
+#include "intern.h"
|
||||
+
|
||||
+struct MixerChunk {
|
||||
+ const uint8 *data;
|
||||
+ uint16 len;
|
||||
+ uint16 loopPos;
|
||||
+ uint16 loopLen;
|
||||
+};
|
||||
+
|
||||
+struct MixerChannel {
|
||||
+ bool active;
|
||||
+ uint8 volume;
|
||||
+ MixerChunk chunk;
|
||||
+ uint32 chunkPos;
|
||||
+ uint32 chunkInc;
|
||||
+};
|
||||
+
|
||||
+struct SystemStub;
|
||||
+
|
||||
+struct Mixer {
|
||||
+ enum {
|
||||
+ NUM_CHANNELS = 4
|
||||
+ };
|
||||
+
|
||||
+ SystemStub *_stub;
|
||||
+ MixerChannel _channels[NUM_CHANNELS];
|
||||
+
|
||||
+ Mixer(SystemStub *stub);
|
||||
+ void init();
|
||||
+ void free();
|
||||
+
|
||||
+ void playChannel(uint8 channel, const MixerChunk *mc, uint16 freq, uint8 volume);
|
||||
+ void stopChannel(uint8 channel);
|
||||
+ void stopAll();
|
||||
+ void mix(int8 *buf, int len);
|
||||
+
|
||||
+ static void mixCallback(void *param, uint8 *buf, int len);
|
||||
+};
|
||||
+
|
||||
+#endif
|
|
@ -1,49 +0,0 @@
|
|||
$NetBSD: patch-ah,v 1.1.1.1 2004/05/09 19:25:47 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- resource.cpp.orig Wed Apr 21 20:29:26 2004
|
||||
+++ resource.cpp
|
||||
@@ -127,7 +127,6 @@ void Resource::load() {
|
||||
}
|
||||
|
||||
void Resource::invalidateRes() {
|
||||
- // XXX call ds:sound_stub_1_ptr
|
||||
MemEntry *me = _memList;
|
||||
uint16 i = _numMemList;
|
||||
while (i--) {
|
||||
@@ -150,23 +149,19 @@ void Resource::invalidateAll() {
|
||||
}
|
||||
|
||||
void Resource::update(uint16 num) {
|
||||
- if (num == 0) {
|
||||
- invalidateRes();
|
||||
+ if (num > _numMemList) {
|
||||
+ _newPtrsId = num;
|
||||
} else {
|
||||
- if (num > _numMemList) {
|
||||
- _newPtrsId = num;
|
||||
- } else {
|
||||
- if (false) { // XXX (_audio_use_pro_or_adlib == 1 || _audio_use_spk == 1) {
|
||||
- for (const uint16 *ml = _memListAudio; *ml != 0xFFFF; ++ml) {
|
||||
- if (*ml == num)
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- MemEntry *me = &_memList[num];
|
||||
- if (me->valid == 0) {
|
||||
- me->valid = 2;
|
||||
- load();
|
||||
+ if (false) { // XXX (_audio_use_pro_or_adlib == 1 || _audio_use_spk == 1) {
|
||||
+ for (const uint16 *ml = _memListAudio; *ml != 0xFFFF; ++ml) {
|
||||
+ if (*ml == num)
|
||||
+ return;
|
||||
}
|
||||
+ }
|
||||
+ MemEntry *me = &_memList[num];
|
||||
+ if (me->valid == 0) {
|
||||
+ me->valid = 2;
|
||||
+ load();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
$NetBSD: patch-ai,v 1.1.1.1 2004/05/09 19:25:47 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- sdlstub.cpp.orig Wed Apr 21 20:29:56 2004
|
||||
+++ sdlstub.cpp
|
||||
@@ -26,7 +26,8 @@ struct SDLStub : SystemStub {
|
||||
|
||||
enum {
|
||||
SCREEN_W = 320,
|
||||
- SCREEN_H = 200
|
||||
+ SCREEN_H = 200,
|
||||
+ SOUND_SAMPLE_RATE = 22050
|
||||
};
|
||||
|
||||
struct Scaler {
|
||||
@@ -52,6 +53,11 @@ struct SDLStub : SystemStub {
|
||||
virtual void processEvents();
|
||||
virtual void sleep(uint32 duration);
|
||||
virtual uint32 getTimeStamp();
|
||||
+ virtual void lockAudio();
|
||||
+ virtual void unlockAudio();
|
||||
+ virtual void startAudio(AudioCallback callback, void *param);
|
||||
+ virtual void stopAudio();
|
||||
+ virtual uint32 getOutputSampleRate();
|
||||
|
||||
void prepareGfxMode();
|
||||
void cleanupGfxMode();
|
||||
@@ -73,7 +79,7 @@ SystemStub *SystemStub_SDL_create() {
|
||||
}
|
||||
|
||||
void SDLStub::init(const char *title) {
|
||||
- SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
|
||||
+ SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER);
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
SDL_WM_SetCaption(title, NULL);
|
||||
@@ -89,6 +95,7 @@ void SDLStub::init(const char *title) {
|
||||
|
||||
void SDLStub::destroy() {
|
||||
cleanupGfxMode();
|
||||
+ SDL_Quit();
|
||||
}
|
||||
|
||||
void SDLStub::setPalette(uint8 s, uint8 n, const uint8 *buf) {
|
||||
@@ -128,7 +135,7 @@ void SDLStub::processEvents() {
|
||||
while(SDL_PollEvent(&ev)) {
|
||||
switch (ev.type) {
|
||||
case SDL_QUIT:
|
||||
- exit(0);
|
||||
+ _pi.quit = true;
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
switch(ev.key.keysym.sym) {
|
||||
@@ -224,6 +231,39 @@ void SDLStub::sleep(uint32 duration) {
|
||||
|
||||
uint32 SDLStub::getTimeStamp() {
|
||||
return SDL_GetTicks();
|
||||
+}
|
||||
+
|
||||
+void SDLStub::lockAudio() {
|
||||
+ SDL_LockAudio();
|
||||
+}
|
||||
+
|
||||
+void SDLStub::unlockAudio() {
|
||||
+ SDL_UnlockAudio();
|
||||
+}
|
||||
+
|
||||
+void SDLStub::startAudio(AudioCallback callback, void *param) {
|
||||
+ SDL_AudioSpec desired;
|
||||
+ memset(&desired, 0, sizeof(desired));
|
||||
+
|
||||
+ desired.freq = SOUND_SAMPLE_RATE;
|
||||
+ desired.format = AUDIO_S8;
|
||||
+ desired.channels = 1;
|
||||
+ desired.samples = 2048;
|
||||
+ desired.callback = callback;
|
||||
+ desired.userdata = param;
|
||||
+ if (SDL_OpenAudio(&desired, NULL) == 0) {
|
||||
+ SDL_PauseAudio(0);
|
||||
+ } else {
|
||||
+ error("SDLStub::startAudio() unable to open sound device");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void SDLStub::stopAudio() {
|
||||
+ SDL_CloseAudio();
|
||||
+}
|
||||
+
|
||||
+uint32 SDLStub::getOutputSampleRate() {
|
||||
+ return SOUND_SAMPLE_RATE;
|
||||
}
|
||||
|
||||
void SDLStub::prepareGfxMode() {
|
|
@ -1,26 +0,0 @@
|
|||
$NetBSD: patch-aj,v 1.1.1.1 2004/05/09 19:25:47 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- staticres.cpp.orig Sat Apr 17 19:07:36 2004
|
||||
+++ staticres.cpp
|
||||
@@ -53,9 +53,17 @@ const Logic::OpcodeStub Logic::_opTable[
|
||||
&Logic::op_shl,
|
||||
&Logic::op_shr,
|
||||
/* 0x18 */
|
||||
- &Logic::op_soundUnk1,
|
||||
+ &Logic::op_playSound,
|
||||
&Logic::op_updateMemList,
|
||||
- &Logic::op_soundUnk2
|
||||
+ &Logic::op_playMusic
|
||||
+};
|
||||
+
|
||||
+const uint16 Logic::_freqTable[] = {
|
||||
+ 0x0CFF, 0x0DC3, 0x0E91, 0x0F6F, 0x1056, 0x114E, 0x1259, 0x136C,
|
||||
+ 0x149F, 0x15D9, 0x1726, 0x1888, 0x19FD, 0x1B86, 0x1D21, 0x1EDE,
|
||||
+ 0x20AB, 0x229C, 0x24B3, 0x26D7, 0x293F, 0x2BB2, 0x2E4C, 0x3110,
|
||||
+ 0x33FB, 0x370D, 0x3A43, 0x3DDF, 0x4157, 0x4538, 0x4998, 0x4DAE,
|
||||
+ 0x5240, 0x5764, 0x5C9A, 0x61C8, 0x6793, 0x6E19, 0x7485, 0x7BBD
|
||||
};
|
||||
|
||||
const uint16 Resource::_memListAudio[] = {
|
|
@ -1,35 +0,0 @@
|
|||
$NetBSD: patch-ak,v 1.1.1.1 2004/05/09 19:25:47 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- sys.h.orig Sat Apr 17 19:06:50 2004
|
||||
+++ sys.h
|
||||
@@ -26,7 +26,7 @@ typedef signed short int16;
|
||||
typedef unsigned long uint32;
|
||||
typedef signed long int32;
|
||||
|
||||
-#if defined LITTLE_ENDIAN
|
||||
+#if defined SYS_LITTLE_ENDIAN
|
||||
|
||||
inline uint16 READ_BE_UINT16(const void *ptr) {
|
||||
const uint8 *b = (const uint8 *)ptr;
|
||||
@@ -38,16 +38,14 @@ inline uint32 READ_BE_UINT32(const void
|
||||
return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
|
||||
}
|
||||
|
||||
-#elif defined BIG_ENDIAN
|
||||
+#elif defined SYS_BIG_ENDIAN
|
||||
|
||||
inline uint16 READ_BE_UINT16(const void *ptr) {
|
||||
- return (const uint8 *)ptr;
|
||||
- return (b[1] << 8) | b[0];
|
||||
+ return *(const uint16 *)ptr;
|
||||
}
|
||||
|
||||
inline uint32 READ_BE_UINT32(const void *ptr) {
|
||||
- const uint8 *b = (const uint8 *)ptr;
|
||||
- return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0];
|
||||
+ return *(const uint32 *)ptr;
|
||||
}
|
||||
|
||||
#else
|
|
@ -1,28 +0,0 @@
|
|||
$NetBSD: patch-al,v 1.1.1.1 2004/05/09 19:25:47 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- systemstub.h.orig Sun Apr 18 16:17:32 2004
|
||||
+++ systemstub.h
|
||||
@@ -41,6 +41,8 @@ struct PlayerInput {
|
||||
};
|
||||
|
||||
struct SystemStub {
|
||||
+ typedef void (*AudioCallback)(void *param, uint8 *stream, int len);
|
||||
+
|
||||
PlayerInput _pi;
|
||||
|
||||
virtual ~SystemStub() {}
|
||||
@@ -54,6 +56,12 @@ struct SystemStub {
|
||||
virtual void processEvents() = 0;
|
||||
virtual void sleep(uint32 duration) = 0;
|
||||
virtual uint32 getTimeStamp() = 0;
|
||||
+
|
||||
+ virtual void lockAudio() = 0;
|
||||
+ virtual void unlockAudio() = 0;
|
||||
+ virtual void startAudio(AudioCallback callback, void *param) = 0;
|
||||
+ virtual void stopAudio() = 0;
|
||||
+ virtual uint32 getOutputSampleRate() = 0;
|
||||
};
|
||||
|
||||
extern SystemStub *SystemStub_SDL_create();
|
|
@ -1,16 +0,0 @@
|
|||
$NetBSD: patch-am,v 1.1.1.1 2004/05/09 19:25:47 dillo Exp $
|
||||
|
||||
This includes sound-20040508.diff from the master site.
|
||||
|
||||
--- util.h.orig Wed Apr 21 20:17:42 2004
|
||||
+++ util.h
|
||||
@@ -25,7 +25,8 @@ enum {
|
||||
DBG_LOGIC = 1 << 0,
|
||||
DBG_BANK = 1 << 1,
|
||||
DBG_VIDEO = 1 << 2,
|
||||
- DBG_INFO = 1 << 3
|
||||
+ DBG_INFO = 1 << 3,
|
||||
+ DBG_SND = 1 << 4
|
||||
};
|
||||
|
||||
extern uint16 g_debugMask;
|
Loading…
Reference in a new issue