Fix some Full Throttle smush problems from implementing the new Dig codecs.
Added preliminary FT smush sound by jah - This needs work, it has to be able to STREAM audio to the mixer and append an existing buffer, not just create a new sample for each audio packet. svn-id: r4289
This commit is contained in:
parent
83b90577ed
commit
f9b44db5b0
2 changed files with 111 additions and 16 deletions
119
insane.cpp
119
insane.cpp
|
@ -311,7 +311,7 @@ void codec37_proc4(byte *dst, byte *src, int next_offs, int bw, int bh,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void codec37_proc5(byte *dst, byte *src, int next_offs, int bw, int bh,
|
void codec37_proc5(int game, byte *dst, byte *src, int next_offs, int bw, int bh,
|
||||||
int pitch, int16 * table)
|
int pitch, int16 * table)
|
||||||
{
|
{
|
||||||
byte code, *tmp;
|
byte code, *tmp;
|
||||||
|
@ -327,16 +327,18 @@ void codec37_proc5(byte *dst, byte *src, int next_offs, int bw, int bh,
|
||||||
i = bw;
|
i = bw;
|
||||||
do {
|
do {
|
||||||
code = *src++;
|
code = *src++;
|
||||||
if (code == 0xFD) {
|
|
||||||
|
// FIXME: Full Throttle has different FD and FEs?
|
||||||
|
if ((game == GID_DIG) && (code == 0xFD)) {
|
||||||
t = src[0];
|
t = src[0];
|
||||||
t += (t << 8) + (t << 16) + (t << 24);
|
t += (t << 8) + (t << 16) + (t << 24);
|
||||||
*(uint32 *)(dst + 0) = t;
|
*(uint32 *)(dst + 0) = t;
|
||||||
*(uint32 *)(dst + 320) = t;
|
*(uint32 *)(dst + 320) = t;
|
||||||
*(uint32 *)(dst + 320 * 2) = t;
|
*(uint32 *)(dst + 320 * 2) = t;
|
||||||
*(uint32 *)(dst + 320 * 3) = t;
|
*(uint32 *)(dst + 320 * 3) = t;
|
||||||
src += 1;
|
src += 1;
|
||||||
dst += 4;
|
dst += 4;
|
||||||
} else if (code == 0xFE) {
|
} else if ((game == GID_DIG) && (code == 0xFE)) {
|
||||||
t = src[0];
|
t = src[0];
|
||||||
t += (t << 8) + (t << 16) + (t << 24);
|
t += (t << 8) + (t << 16) + (t << 24);
|
||||||
*(uint32 *)(dst + 0) = t;
|
*(uint32 *)(dst + 0) = t;
|
||||||
|
@ -493,7 +495,7 @@ void codec37_maketable(PersistentCodecData37 * pcd, int pitch, byte idx)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int codec37(CodecData * cd, PersistentCodecData37 * pcd)
|
int codec37(int game, CodecData * cd, PersistentCodecData37 * pcd)
|
||||||
{
|
{
|
||||||
int width_in_blocks, height_in_blocks;
|
int width_in_blocks, height_in_blocks;
|
||||||
int src_pitch;
|
int src_pitch;
|
||||||
|
@ -550,10 +552,10 @@ int codec37(CodecData * cd, PersistentCodecData37 * pcd)
|
||||||
pcd->curtable ^= 1;
|
pcd->curtable ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec37_proc5(pcd->deltaBufs[pcd->curtable], cd->src + 16,
|
codec37_proc5(game, pcd->deltaBufs[pcd->curtable], cd->src + 16,
|
||||||
pcd->deltaBufs[pcd->curtable ^ 1] -
|
pcd->deltaBufs[pcd->curtable ^ 1] -
|
||||||
pcd->deltaBufs[pcd->curtable], width_in_blocks,
|
pcd->deltaBufs[pcd->curtable], width_in_blocks,
|
||||||
height_in_blocks, src_pitch, pcd->table1);
|
height_in_blocks, src_pitch, pcd->table1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -633,16 +635,101 @@ void SmushPlayer::parseFOBJ()
|
||||||
codec1(&cd);
|
codec1(&cd);
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
_frameChanged = codec37(&cd, &pcd37);
|
_frameChanged = codec37(sm->_gameId, &cd, &pcd37);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("invalid codec %d", codec);
|
error("invalid codec %d", codec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmushPlayer::parsePSAD()
|
void SmushPlayer::parsePSAD() // FIXME: Needs to append to
|
||||||
{
|
{ // a sound buffer
|
||||||
//printf("parse PSAD\n");
|
unsigned int pos, sublen, tag, idx, trk;
|
||||||
|
byte * buf;
|
||||||
|
|
||||||
|
pos = 0;
|
||||||
|
|
||||||
|
trk = READ_LE_UINT16(_cur + pos); /* FIXME: is this correct ? */
|
||||||
|
pos += 2;
|
||||||
|
|
||||||
|
/* FIXME: number 8 should be replaced with a sensible literal */
|
||||||
|
|
||||||
|
for (idx = 0; idx < 8; idx++) {
|
||||||
|
if (_psadTrk[idx] == trk)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx == 8) {
|
||||||
|
for (idx = 0; idx < 8; idx++) {
|
||||||
|
if (_psadTrk[idx] == 0) {
|
||||||
|
_psadTrk[idx] = trk;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx == 8) {
|
||||||
|
warning("PSAD table full\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos += 8; /* FIXME: what are these ? */
|
||||||
|
|
||||||
|
while (pos < _frmeSize) {
|
||||||
|
|
||||||
|
if (_saudSize[idx] == 0) {
|
||||||
|
tag = READ_BE_UINT32(_cur + pos);
|
||||||
|
pos += 4;
|
||||||
|
if (tag != 'SAUD')
|
||||||
|
error("trk %d: SAUD tag not found", trk);
|
||||||
|
_saudSize[idx] = READ_BE_UINT32(_cur + pos);
|
||||||
|
pos += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_saudSubSize[idx] == 0) {
|
||||||
|
_saudSubTag[idx] = READ_BE_UINT32(_cur + pos);
|
||||||
|
pos += 4;
|
||||||
|
_saudSubSize[idx] = READ_BE_UINT32(_cur + pos);
|
||||||
|
pos += 4;
|
||||||
|
_saudSize[idx] -= 8;
|
||||||
|
debug(3, "trk %d: tag '%4s' size %x",
|
||||||
|
trk, _cur + pos - 8, _saudSubSize[idx]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sublen = _saudSubSize[idx] < (_frmeSize - pos) ?
|
||||||
|
_saudSubSize[idx] : (_frmeSize - pos);
|
||||||
|
|
||||||
|
switch (_saudSubTag[idx]) {
|
||||||
|
case 'STRK' :
|
||||||
|
/* FIXME: what is this stuff ? */
|
||||||
|
_strkRate[idx] = 22050;
|
||||||
|
break;
|
||||||
|
case 'SDAT' :
|
||||||
|
buf = (byte *) malloc(sublen);
|
||||||
|
|
||||||
|
memcpy(buf, _cur + pos, sublen);
|
||||||
|
|
||||||
|
debug(3, "trk %d: SDAT part len 0x%x rate %d",
|
||||||
|
trk, sublen, _strkRate[idx]);
|
||||||
|
|
||||||
|
g_scumm->_mixer->play_raw(NULL, buf,
|
||||||
|
sublen, _strkRate[idx],
|
||||||
|
SoundMixer::FLAG_UNSIGNED |
|
||||||
|
SoundMixer::FLAG_AUTOFREE);
|
||||||
|
break;
|
||||||
|
case 'SMRK' :
|
||||||
|
_psadTrk[idx] = 0;
|
||||||
|
break;
|
||||||
|
case 'SHDR' :
|
||||||
|
/* FIXME: what is this stuff ? */
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
error("trk %d: unknown tag inside PSAD", trk);
|
||||||
|
}
|
||||||
|
_saudSubSize[idx] -= sublen;
|
||||||
|
_saudSize[idx] -= sublen;
|
||||||
|
pos += sublen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmushPlayer::parseTRES()
|
void SmushPlayer::parseTRES()
|
||||||
|
@ -720,6 +807,10 @@ void SmushPlayer::init()
|
||||||
{
|
{
|
||||||
_renderBitmap = sm->_videoBuffer;
|
_renderBitmap = sm->_videoBuffer;
|
||||||
codec37_init(&pcd37, 320, 200);
|
codec37_init(&pcd37, 320, 200);
|
||||||
|
|
||||||
|
memset(_saudSize, 0, sizeof(_saudSize));
|
||||||
|
memset(_saudSubSize, 0, sizeof(_saudSubSize));
|
||||||
|
memset(_psadTrk, 0, sizeof(_psadTrk));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmushPlayer::go()
|
void SmushPlayer::go()
|
||||||
|
|
8
smush.h
8
smush.h
|
@ -65,6 +65,11 @@ struct SmushPlayer {
|
||||||
uint16 _fluPalMul129[768];
|
uint16 _fluPalMul129[768];
|
||||||
uint16 _fluPalWords[768];
|
uint16 _fluPalWords[768];
|
||||||
|
|
||||||
|
/* PSAD: Full Throttle audio */
|
||||||
|
uint32 _saudSize[8], _saudSubSize[8];
|
||||||
|
uint16 _psadTrk[8], _strkRate[8];
|
||||||
|
uint32 _saudSubTag[8];
|
||||||
|
|
||||||
void openFile(byte* fileName);
|
void openFile(byte* fileName);
|
||||||
void nextBlock();
|
void nextBlock();
|
||||||
|
|
||||||
|
@ -72,8 +77,7 @@ struct SmushPlayer {
|
||||||
uint32 fileReadLE32();
|
uint32 fileReadLE32();
|
||||||
void go();
|
void go();
|
||||||
|
|
||||||
bool parseTag();
|
bool parseTag();
|
||||||
|
|
||||||
void parseAHDR();
|
void parseAHDR();
|
||||||
void parseFRME();
|
void parseFRME();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue