mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
remove mtaf blocking support, new extractor produces clean files
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@944 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
e1eefdaadb
commit
3f1f45ba07
@ -53,8 +53,7 @@ LAYOUT_OBJS=layout/ast_blocked.o \
|
||||
layout/bdsp_blocked.o \
|
||||
layout/tra_blocked.o \
|
||||
layout/ps2_iab_blocked.o \
|
||||
layout/ps2_strlr_blocked.o \
|
||||
layout/mtaf_blocked.o
|
||||
layout/ps2_strlr_blocked.o
|
||||
|
||||
META_OBJS=meta/adx_header.o \
|
||||
meta/afc_header.o \
|
||||
|
@ -36,6 +36,5 @@ liblayout_la_SOURCES += bdsp_blocked.c
|
||||
liblayout_la_SOURCES += tra_blocked.c
|
||||
liblayout_la_SOURCES += ps2_iab_blocked.c
|
||||
liblayout_la_SOURCES += ps2_strlr_blocked.c
|
||||
liblayout_la_SOURCES += mtaf_blocked.c
|
||||
|
||||
EXTRA_DIST = layout.h
|
||||
|
@ -130,9 +130,6 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
|
||||
case layout_ps2_strlr_blocked:
|
||||
ps2_strlr_block_update(vgmstream->next_block_offset,vgmstream);
|
||||
break;
|
||||
case layout_mtaf_blocked:
|
||||
mtaf_block_update(vgmstream->next_block_offset, vgmstream);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
//#include <stdio.h>
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* set up for the block at the given offset */
|
||||
void mtaf_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_size = read_32bitLE(vgmstream->current_block_offset+4, vgmstream->ch[0].streamfile) * vgmstream->interleave_block_size;
|
||||
vgmstream->next_block_offset = block_offset + 8 + vgmstream->current_block_size * (vgmstream->channels/2);
|
||||
|
||||
//printf("block at 0x%08lx has size %08lx\n", (unsigned long)block_offset, (unsigned long)vgmstream->current_block_size);
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = vgmstream->current_block_offset +
|
||||
8 + vgmstream->interleave_block_size * (i/2);
|
||||
}
|
||||
|
||||
}
|
@ -1310,10 +1310,6 @@
|
||||
RelativePath=".\layout\ivaud_layout.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\mtaf_blocked.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\mus_acm_layout.c"
|
||||
>
|
||||
|
@ -1,6 +1,5 @@
|
||||
//#include <stdlib.h>
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* MTAF (Metal Gear Solid 3: Snake Eater) */
|
||||
@ -23,15 +22,9 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
|
||||
/* check header */
|
||||
|
||||
if (read_32bitLE(0, streamFile) != 0 || read_32bitLE(4, streamFile) != 0)
|
||||
{
|
||||
//fprintf(stderr, "expected 0s at start\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// master MTAF header (mostly useless)
|
||||
|
||||
if (read_32bitBE(8, streamFile) != 0x4d544146) // "MTAF"
|
||||
if (read_32bitBE(0, streamFile) != 0x4d544146) // "MTAF"
|
||||
{
|
||||
//fprintf(stderr, "no MTAF header at 0x%08lx\n", cur_off);
|
||||
goto fail;
|
||||
@ -40,7 +33,7 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
//const uint32_t pseudo_size = readint32(&mtaf_header_buf[4]);
|
||||
|
||||
// check the rest is clear
|
||||
for (i = 0x10; i < 0x28; i++)
|
||||
for (i = 0x8; i < 0x20; i++)
|
||||
{
|
||||
if (read_8bit(i, streamFile) != 0)
|
||||
{
|
||||
@ -53,14 +46,14 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
|
||||
// HEAD chunk header
|
||||
|
||||
if (read_32bitBE(0x48, streamFile) != 0x48454144) // "HEAD"
|
||||
if (read_32bitBE(0x40, streamFile) != 0x48454144) // "HEAD"
|
||||
{
|
||||
//fprintf(stderr, "no HEAD chunk at 0x%08lx\n", cur_off);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
{
|
||||
uint32_t mtaf_head_chunk_size = read_32bitLE(0x4c, streamFile);
|
||||
uint32_t mtaf_head_chunk_size = read_32bitLE(0x44, streamFile);
|
||||
if (mtaf_head_chunk_size != 0xB0)
|
||||
{
|
||||
//fprintf(stderr, "unexpected size for MTAF header at 0x%08lx\n", cur_off);
|
||||
@ -68,14 +61,14 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
}
|
||||
}
|
||||
|
||||
stream_count = read_8bit(0x69, streamFile);
|
||||
stream_count = read_8bit(0x61, streamFile);
|
||||
|
||||
// check some standard stuff
|
||||
if ( 0 != read_32bitLE(0x50, streamFile) ||
|
||||
0x7F != read_32bitLE(0x58, streamFile) ||
|
||||
0x40 != read_32bitLE(0x5C, streamFile) ||
|
||||
0 != read_16bitLE(0x6a, streamFile) ||
|
||||
0 != read_32bitLE(0x74, streamFile)) // ||
|
||||
if ( 0 != read_32bitLE(0x48, streamFile) ||
|
||||
0x7F != read_32bitLE(0x50, streamFile) ||
|
||||
0x40 != read_32bitLE(0x54, streamFile) ||
|
||||
0 != read_16bitLE(0x62, streamFile) ||
|
||||
0 != read_32bitLE(0x6c, streamFile)) // ||
|
||||
//5 != readint32(&mtaf_header_buf[0x68])) ||
|
||||
//(dc.streams==3 ? 12:0) != readint32(&mtaf_header_buf[0x7c]))
|
||||
{
|
||||
@ -91,7 +84,7 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
}
|
||||
|
||||
// check the other stream count indicator
|
||||
if (stream_count*0x10 != read_8bit(0x68, streamFile))
|
||||
if (stream_count*0x10 != read_8bit(0x60, streamFile))
|
||||
{
|
||||
//fprintf(stderr, "secondary stream count mismatch at 0x%08lx\n", cur_off);
|
||||
goto fail;
|
||||
@ -100,7 +93,7 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
#if 0
|
||||
// maybe this is how to compute channels per stream?
|
||||
// check total channel count
|
||||
if (2*stream_count != read_32bitLE(0x54, streamFile))
|
||||
if (2*stream_count != read_32bitLE(0x4c, streamFile))
|
||||
{
|
||||
//fprintf(stderr, "total channel count does not match stream count at 0x%08lx\n", cur_off);
|
||||
goto fail;
|
||||
@ -108,15 +101,15 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
#endif
|
||||
|
||||
// check loop points as frame counts
|
||||
if (read_32bitLE(0x6C, streamFile) != read_32bitLE(0x60, streamFile)/0x100 ||
|
||||
read_32bitLE(0x70, streamFile) != read_32bitLE(0x64, streamFile)/0x100)
|
||||
if (read_32bitLE(0x64, streamFile) != read_32bitLE(0x58, streamFile)/0x100 ||
|
||||
read_32bitLE(0x68, streamFile) != read_32bitLE(0x5c, streamFile)/0x100)
|
||||
{
|
||||
//fprintf(stderr, "loop frame count mismatch at 0x%lx\n", cur_off);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// check that rest is clear
|
||||
for (i = 0x80; i < 0x100; i++)
|
||||
for (i = 0x78; i < 0xf8; i++)
|
||||
{
|
||||
if (read_8bit(i, streamFile) != 0)
|
||||
{
|
||||
@ -128,8 +121,8 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
// check TRKP chunks
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (read_32bitBE(0x100+0x70*i, streamFile) != 0x54524b50 || // "TRKP"
|
||||
read_32bitLE(0x100+0x70*i+4, streamFile) != 0x68)
|
||||
if (read_32bitBE(0xf8+0x70*i, streamFile) != 0x54524b50 || // "TRKP"
|
||||
read_32bitLE(0xf8+0x70*i+4, streamFile) != 0x68)
|
||||
{
|
||||
//fprintf(stderr, "missing or unusual TRKP chunk #%d at 0x%lx\n", i, cur_off);
|
||||
goto fail;
|
||||
@ -137,19 +130,19 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
}
|
||||
|
||||
// check for grand finale, DATA
|
||||
if (read_32bitBE(0x800, streamFile) != 0x44415441) // "DATA"
|
||||
if (read_32bitBE(0x7f8, streamFile) != 0x44415441) // "DATA"
|
||||
{
|
||||
//fprintf(stderr, "missing DATA header at 0x%lx\n", cur_off);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
start_offset = 0x808;
|
||||
start_offset = 0x800;
|
||||
|
||||
// seems to always be the case
|
||||
channel_count = 2 * stream_count;
|
||||
|
||||
loop_start = read_32bitLE(0x60, streamFile);
|
||||
loop_end = read_32bitLE(0x64, streamFile);
|
||||
loop_start = read_32bitLE(0x58, streamFile);
|
||||
loop_end = read_32bitLE(0x5c, streamFile);
|
||||
if (loop_start == loop_end) loop_flag = 0;
|
||||
|
||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||
@ -159,14 +152,14 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 48000;
|
||||
vgmstream->coding_type = coding_MTAF;
|
||||
vgmstream->num_samples = read_32bitLE(0x64, streamFile);
|
||||
vgmstream->num_samples = read_32bitLE(0x5c, streamFile);
|
||||
|
||||
vgmstream->loop_start_sample = loop_start;
|
||||
vgmstream->loop_end_sample = loop_end;
|
||||
|
||||
vgmstream->interleave_block_size = 0x110;
|
||||
vgmstream->interleave_block_size = 0x110/2;
|
||||
|
||||
vgmstream->layout_type = layout_mtaf_blocked;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->meta_type = meta_PS2_MTAF;
|
||||
|
||||
//const uint32_t pseudo_data_size = readint32(&mtaf_header_buf[4]);
|
||||
@ -178,12 +171,9 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
STREAMFILE * file = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
if (!file) goto fail;
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
vgmstream->ch[i].channel_start_offset = vgmstream->ch[i].offset = start_offset + vgmstream->interleave_block_size*2*(i/2);
|
||||
}
|
||||
|
||||
|
||||
/* start me up */
|
||||
mtaf_block_update(start_offset,vgmstream);
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
|
@ -755,7 +755,6 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
|
||||
case layout_tra_blocked:
|
||||
case layout_ps2_iab_blocked:
|
||||
case layout_ps2_strlr_blocked:
|
||||
case layout_mtaf_blocked:
|
||||
render_vgmstream_blocked(buffer,sample_count,vgmstream);
|
||||
break;
|
||||
case layout_interleave_byte:
|
||||
@ -1919,9 +1918,6 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case layout_ivaud_blocked:
|
||||
snprintf(temp,TEMPSIZE,"GTA IV blocked");
|
||||
break;
|
||||
case layout_mtaf_blocked:
|
||||
snprintf(temp,TEMPSIZE,"MTAF blocked");
|
||||
break;
|
||||
case layout_ps2_iab_blocked:
|
||||
snprintf(temp,TEMPSIZE,"IAB blocked");
|
||||
|
@ -11,7 +11,7 @@
|
||||
* removing these defines (and the references to the libraries in the
|
||||
* Makefile) */
|
||||
#define VGM_USE_VORBIS
|
||||
#define VGM_USE_MPEG
|
||||
//#define VGM_USE_MPEG
|
||||
/* disabled by default, defined for builds that support it */
|
||||
//#define VGM_USE_G7221
|
||||
|
||||
@ -160,7 +160,6 @@ typedef enum {
|
||||
layout_ps2_adm_blocked,
|
||||
layout_dsp_bdsp_blocked,
|
||||
layout_mxch_blocked,
|
||||
layout_mtaf_blocked,
|
||||
|
||||
#if 0
|
||||
layout_strm_blocked, /* */
|
||||
|
Loading…
x
Reference in New Issue
Block a user