mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-14 18:47:39 +01:00
commit
4aa6ae4ef3
@ -66,6 +66,8 @@ if %OP_SEARCH%=="" (
|
|||||||
|
|
||||||
REM # process start
|
REM # process start
|
||||||
set TIME_START=%time%
|
set TIME_START=%time%
|
||||||
|
set FILES_OK=0
|
||||||
|
set FILES_KO=0
|
||||||
echo VRTS: start @%TIME_START%
|
echo VRTS: start @%TIME_START%
|
||||||
|
|
||||||
REM # search for files
|
REM # search for files
|
||||||
@ -97,6 +99,7 @@ set /A TIME_ELAPSED_C=(TIME_END_S-TIME_START_S)%%100
|
|||||||
|
|
||||||
REM # process end (ok)
|
REM # process end (ok)
|
||||||
echo VRTS: done @%TIME_END% (%TIME_ELAPSED_S%,%TIME_ELAPSED_C%s)
|
echo VRTS: done @%TIME_END% (%TIME_ELAPSED_S%,%TIME_ELAPSED_C%s)
|
||||||
|
echo VRTS: ok=%FILES_OK%, ko=%FILES_KO%
|
||||||
|
|
||||||
goto exit
|
goto exit
|
||||||
|
|
||||||
@ -154,6 +157,7 @@ REM # ########################################################################
|
|||||||
) else (
|
) else (
|
||||||
call :echo_color %C_E% "%CMD_FILE%" "wav diffs"
|
call :echo_color %C_E% "%CMD_FILE%" "wav diffs"
|
||||||
)
|
)
|
||||||
|
set /a "FILES_KO+=1"
|
||||||
) else (
|
) else (
|
||||||
if %CMP_TXT_ERROR% EQU 1 (
|
if %CMP_TXT_ERROR% EQU 1 (
|
||||||
call :echo_color %C_W% "%CMD_FILE%" "txt diffs"
|
call :echo_color %C_W% "%CMD_FILE%" "txt diffs"
|
||||||
@ -162,6 +166,7 @@ REM # ########################################################################
|
|||||||
call :echo_color %C_O% "%CMD_FILE%" "no diffs"
|
call :echo_color %C_O% "%CMD_FILE%" "no diffs"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
set /a "FILES_OK+=1"
|
||||||
)
|
)
|
||||||
|
|
||||||
REM # delete temp files
|
REM # delete temp files
|
||||||
|
@ -208,6 +208,7 @@ static const char* extension_list[] = {
|
|||||||
//"mpc", //FFmpeg, not parsed (musepack) //common
|
//"mpc", //FFmpeg, not parsed (musepack) //common
|
||||||
"mpdsp",
|
"mpdsp",
|
||||||
"mpds",
|
"mpds",
|
||||||
|
"mps", //txh/reserved
|
||||||
"ms",
|
"ms",
|
||||||
"msa",
|
"msa",
|
||||||
"msb",
|
"msb",
|
||||||
@ -647,7 +648,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_DSP_STD, "Standard Nintendo DSP header"},
|
{meta_DSP_STD, "Standard Nintendo DSP header"},
|
||||||
{meta_DSP_CSTR, "Namco Cstr header"},
|
{meta_DSP_CSTR, "Namco Cstr header"},
|
||||||
{meta_GCSW, "GCSW header"},
|
{meta_GCSW, "GCSW header"},
|
||||||
{meta_PS2_SShd, "SShd header"},
|
{meta_PS2_SShd, "Sony ADS header"},
|
||||||
{meta_PS2_NPSF, "Namco Production Sound File (NPSF) header"},
|
{meta_PS2_NPSF, "Namco Production Sound File (NPSF) header"},
|
||||||
{meta_RWSD, "Nintendo RWSD header (single stream)"},
|
{meta_RWSD, "Nintendo RWSD header (single stream)"},
|
||||||
{meta_RWAR, "Nintendo RWAR header (single RWAV stream)"},
|
{meta_RWAR, "Nintendo RWAR header (single RWAV stream)"},
|
||||||
@ -661,8 +662,8 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_DSP_STM, "Nintendo STM header"},
|
{meta_DSP_STM, "Nintendo STM header"},
|
||||||
{meta_PS2_EXST, "EXST header"},
|
{meta_PS2_EXST, "EXST header"},
|
||||||
{meta_PS2_SVAG, "Konami SVAG header"},
|
{meta_PS2_SVAG, "Konami SVAG header"},
|
||||||
{meta_PS2_MIB, "assumed MIB Interleaved file by .mib extension"},
|
{meta_PS2_MIB, "Headerless/MIB PS-ADPCM raw header"},
|
||||||
{meta_PS2_MIB_MIH, "assumed MIB with MIH Info Header file by .mib+.mih extension"},
|
{meta_PS2_MIB_MIH, "Sony MultiStream MIH+MIB header"},
|
||||||
{meta_DSP_MPDSP, "Single DSP header stereo by .mpdsp extension"},
|
{meta_DSP_MPDSP, "Single DSP header stereo by .mpdsp extension"},
|
||||||
{meta_PS2_MIC, "assume KOEI MIC file by .mic extension"},
|
{meta_PS2_MIC, "assume KOEI MIC file by .mic extension"},
|
||||||
{meta_DSP_JETTERS, "Double DSP header stereo by _lr.dsp extension"},
|
{meta_DSP_JETTERS, "Double DSP header stereo by _lr.dsp extension"},
|
||||||
@ -762,7 +763,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_NGC_YMF, "YMF DSP Header"},
|
{meta_NGC_YMF, "YMF DSP Header"},
|
||||||
{meta_PS2_CCC, "CCC Header"},
|
{meta_PS2_CCC, "CCC Header"},
|
||||||
{meta_PSX_FAG, "FAG Header"},
|
{meta_PSX_FAG, "FAG Header"},
|
||||||
{meta_PS2_MIHB, "MIH+MIB header"},
|
{meta_PS2_MIHB, "Sony MultiStream MIC header"},
|
||||||
{meta_DSP_WII_MUS, "mus header"},
|
{meta_DSP_WII_MUS, "mus header"},
|
||||||
{meta_WII_SNG, "SNG DSP Header"},
|
{meta_WII_SNG, "SNG DSP Header"},
|
||||||
{meta_RSD2VAG, "Radical RSD2/VAG header"},
|
{meta_RSD2VAG, "Radical RSD2/VAG header"},
|
||||||
@ -1009,7 +1010,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_PCM_SRE, "Capcom .PCM+SRE header"},
|
{meta_PCM_SRE, "Capcom .PCM+SRE header"},
|
||||||
{meta_DSP_MCADPCM, "Bethesda .mcadpcm header"},
|
{meta_DSP_MCADPCM, "Bethesda .mcadpcm header"},
|
||||||
{meta_UBI_LYN, "Ubisoft LyN RIFF header"},
|
{meta_UBI_LYN, "Ubisoft LyN RIFF header"},
|
||||||
{meta_MSB_MSH, "Sony MSB+MSH header"},
|
{meta_MSB_MSH, "Sony MultiStream MSH+MSB header"},
|
||||||
{meta_OGG_RPGMV, "Ogg Vorbis (RPGMV header)"},
|
{meta_OGG_RPGMV, "Ogg Vorbis (RPGMV header)"},
|
||||||
{meta_OGG_ENO, "Ogg Vorbis (ENO header)"},
|
{meta_OGG_ENO, "Ogg Vorbis (ENO header)"},
|
||||||
{meta_TXTP, "TXTP generic header"},
|
{meta_TXTP, "TXTP generic header"},
|
||||||
|
@ -17,11 +17,15 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
|||||||
VGMSTREAM *vgmstream = NULL;
|
VGMSTREAM *vgmstream = NULL;
|
||||||
int loop_flag = 0;
|
int loop_flag = 0;
|
||||||
int32_t loop_start = 0, loop_end = 0, num_samples = 0;
|
int32_t loop_start = 0, loop_end = 0, num_samples = 0;
|
||||||
|
int total_subsongs, target_subsong = streamFile->stream_index;
|
||||||
|
|
||||||
/* init ffmpeg */
|
/* init ffmpeg */
|
||||||
ffmpeg_codec_data *data = init_ffmpeg_offset(streamFile, start, size);
|
ffmpeg_codec_data *data = init_ffmpeg_offset(streamFile, start, size);
|
||||||
if (!data) return NULL;
|
if (!data) return NULL;
|
||||||
|
|
||||||
|
total_subsongs = data->streamCount;
|
||||||
|
if (target_subsong == 0) target_subsong = 1;
|
||||||
|
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
|
||||||
|
|
||||||
/* try to get .pos data */
|
/* try to get .pos data */
|
||||||
{
|
{
|
||||||
|
@ -216,8 +216,9 @@ VGMSTREAM * init_vgmstream_fsb(STREAMFILE *streamFile) {
|
|||||||
s_off += stream_header_size;
|
s_off += stream_header_size;
|
||||||
d_off += fsb.stream_size; /* there is no offset so manually count */
|
d_off += fsb.stream_size; /* there is no offset so manually count */
|
||||||
|
|
||||||
/* IMAs streams have weird end padding (maybe: FSB3=no padding, FSB4=always padding) */
|
/* some subsongs offsets need padding (most FSOUND_IMAADPCM, few MPEG too [Hard Reset (PC) subsong 5])
|
||||||
if ((fsb.mode & FSOUND_IMAADPCM) && (fsb.flags & FMOD_FSB_SOURCE_MPEG_PADDED4)) {
|
* other PADDED4 may set it (ex. XMA) but don't seem to use it and work fine */
|
||||||
|
if (fsb.flags & FMOD_FSB_SOURCE_MPEG_PADDED4) {
|
||||||
if (d_off % 0x20)
|
if (d_off % 0x20)
|
||||||
d_off += 0x20 - (d_off % 0x20);
|
d_off += 0x20 - (d_off % 0x20);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define _FSB_KEYS_H_
|
#define _FSB_KEYS_H_
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int is_fsb5;
|
int is_fsb5; /* FSB5 or FSB4/3*/
|
||||||
int is_alt;
|
int is_alt; /* alt XOR mode (seemingly not tied to FSB version or anything) */
|
||||||
size_t fsbkey_size;
|
size_t fsbkey_size;
|
||||||
const uint8_t *fsbkey;
|
const uint8_t *fsbkey;
|
||||||
} fsbkey_info;
|
} fsbkey_info;
|
||||||
@ -69,6 +69,9 @@ static const uint8_t key_sc2[] = { 0x42,0x32,0x41,0x37,0x42,0x42,0x30,0x30 };
|
|||||||
/* Cookie Run: Ovenbreak */ //"ghfxhslrghfxhslr"
|
/* Cookie Run: Ovenbreak */ //"ghfxhslrghfxhslr"
|
||||||
static const uint8_t key_cro[] = { 0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72,0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72 };
|
static const uint8_t key_cro[] = { 0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72,0x67,0x68,0x66,0x78,0x68,0x73,0x6C,0x72 };
|
||||||
|
|
||||||
|
/* Monster Jam (PS2) */ //"truck/impact/carbody"
|
||||||
|
static const uint8_t key_mtj[] = { 0x74,0x72,0x75,0x63,0x6B,0x2F,0x69,0x6D,0x70,0x61,0x63,0x74,0x2F,0x63,0x61,0x72,0x62,0x6F,0x64,0x79 };
|
||||||
|
|
||||||
// Unknown:
|
// Unknown:
|
||||||
// - Battle: Los Angeles
|
// - Battle: Los Angeles
|
||||||
// - Guitar Hero: Warriors of Rock, DJ hero FSB
|
// - Guitar Hero: Warriors of Rock, DJ hero FSB
|
||||||
@ -129,6 +132,7 @@ static const fsbkey_info fsbkey_list[] = {
|
|||||||
{ 1,0, sizeof(key_sc2),key_sc2 },//untested
|
{ 1,0, sizeof(key_sc2),key_sc2 },//untested
|
||||||
{ 1,1, sizeof(key_sc2),key_sc2 },//untested
|
{ 1,1, sizeof(key_sc2),key_sc2 },//untested
|
||||||
{ 1,0, sizeof(key_cro),key_cro },
|
{ 1,0, sizeof(key_cro),key_cro },
|
||||||
|
{ 0,1, sizeof(key_mtj),key_mtj },// FSB3
|
||||||
|
|
||||||
};
|
};
|
||||||
static const int fsbkey_list_count = sizeof(fsbkey_list) / sizeof(fsbkey_list[0]);
|
static const int fsbkey_list_count = sizeof(fsbkey_list) / sizeof(fsbkey_list[0]);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* MSB+MSH - Sony sfx container companion of MIH+MIB [namCollection - Ace Combat 2 (PS2) sfx, EyeToy Play (PS2)] */
|
/* MSB+MSH - SCEE MultiStream flat bank [namCollection: Ace Combat 2 (PS2) sfx, EyeToy Play (PS2)] */
|
||||||
VGMSTREAM * init_vgmstream_msb_msh(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_msb_msh(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
STREAMFILE * streamHeader = NULL;
|
STREAMFILE * streamHeader = NULL;
|
||||||
|
@ -1,201 +1,172 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
/* Sony .ADS with SShd & SSbd Headers */
|
/* .ADS - Sony's "Audio Stream" format [Edit Racing (PS2), Evergrace II (PS2), Pri-Saga! Portable (PSP)] */
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
char filename[PATH_LIMIT];
|
int loop_flag, channel_count;
|
||||||
|
|
||||||
int loop_flag=0;
|
|
||||||
int channel_count;
|
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
off_t check_offset;
|
size_t stream_size;
|
||||||
int32_t streamSize;
|
uint32_t loop_start, loop_end;
|
||||||
|
|
||||||
uint8_t testBuffer[0x10];
|
|
||||||
uint8_t isPCM = 0;
|
|
||||||
|
|
||||||
off_t readOffset = 0;
|
/* checks */
|
||||||
off_t loopEnd = 0;
|
/* .ads: actual extension
|
||||||
|
* .ss2: demuxed videos (fake?)
|
||||||
int i;
|
* .pcm: Taisho Mononoke Ibunroku (PS2)
|
||||||
|
* .adx: Armored Core 3 (PS2) */
|
||||||
/* check extension, case insensitive */
|
if (!check_extensions(streamFile, "ads,ss2,pcm,adx"))
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("ads",filename_extension(filename)) &&
|
|
||||||
strcasecmp("ss2",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check SShd Header */
|
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x53536864)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* check SSbd Header */
|
if (read_32bitBE(0x00,streamFile) != 0x53536864 && /* "SShd" */
|
||||||
if (read_32bitBE(0x20,streamFile) != 0x53536264)
|
read_32bitBE(0x20,streamFile) != 0x53536264) /* "SSbd" */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
/* 0x04: header size, always 0x20 */
|
||||||
|
|
||||||
/* check if file is not corrupt */
|
|
||||||
|
/* check if file is not corrupt */ //todo ???
|
||||||
/* seems the Gran Turismo 4 ADS files are considered corrupt,*/
|
/* seems the Gran Turismo 4 ADS files are considered corrupt,*/
|
||||||
/* so I changed it to adapt the stream size if that's the case */
|
/* so I changed it to adapt the stream size if that's the case */
|
||||||
/* instead of failing playing them at all*/
|
/* instead of failing playing them at all*/
|
||||||
streamSize = read_32bitLE(0x24,streamFile);
|
stream_size = read_32bitLE(0x24,streamFile); /* body size */
|
||||||
|
if (stream_size + 0x28 >= get_streamfile_size(streamFile)) {
|
||||||
if (get_streamfile_size(streamFile) < (size_t)(streamSize + 0x28))
|
stream_size = get_streamfile_size(streamFile) - 0x28;
|
||||||
{
|
|
||||||
streamSize = get_streamfile_size(streamFile) - 0x28;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check loop */
|
/* check loop */
|
||||||
if ((read_32bitLE(0x1C,streamFile) == 0xFFFFFFFF) ||
|
loop_start = read_32bitLE(0x18,streamFile);
|
||||||
((read_32bitLE(0x18,streamFile) == 0) && (read_32bitLE(0x1C,streamFile) == 0)))
|
loop_end = read_32bitLE(0x1C,streamFile);
|
||||||
{
|
|
||||||
|
//todo should loop if loop_start > 0 and loop_end == -1
|
||||||
|
if ((loop_end == 0xFFFFFFFF) || (loop_start == 0 && loop_end == 0)) {
|
||||||
loop_flag = 0;
|
loop_flag = 0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
loop_flag = 1;
|
loop_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel_count = read_32bitLE(0x10,streamFile);
|
channel_count = read_32bitLE(0x10,streamFile);
|
||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
|
||||||
vgmstream->channels = read_32bitLE(0x10,streamFile);
|
|
||||||
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
|
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
|
||||||
|
|
||||||
/* Check for Compression Scheme */
|
//todo use proper flags
|
||||||
vgmstream->coding_type = coding_PSX;
|
if (read_32bitLE(0x08,streamFile)!=0x10) {
|
||||||
vgmstream->num_samples = ((streamSize-0x40)/16*28)/vgmstream->channels;
|
|
||||||
|
|
||||||
/* SS2 container with RAW Interleaved PCM */
|
|
||||||
if (read_32bitLE(0x08,streamFile)!=0x10)
|
|
||||||
{
|
|
||||||
|
|
||||||
vgmstream->coding_type = coding_PCM16LE;
|
vgmstream->coding_type = coding_PCM16LE;
|
||||||
vgmstream->num_samples = streamSize/2/vgmstream->channels;
|
vgmstream->num_samples = stream_size/2/vgmstream->channels;
|
||||||
|
} else {
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
vgmstream->num_samples = ((stream_size-0x40)/16*28)/vgmstream->channels; //todo don't - 0x40?
|
||||||
}
|
}
|
||||||
|
|
||||||
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
|
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile); /* set even in mono */
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->meta_type = meta_PS2_SShd;
|
vgmstream->meta_type = meta_PS2_SShd;
|
||||||
|
|
||||||
/* Get loop point values */
|
/* loops */
|
||||||
if (vgmstream->loop_flag) {
|
if (vgmstream->loop_flag) {
|
||||||
if((read_32bitLE(0x1C,streamFile)*0x10*vgmstream->channels+0x800)==get_streamfile_size(streamFile))
|
if ((loop_end*0x10*vgmstream->channels+0x800) == get_streamfile_size(streamFile)) {
|
||||||
{
|
/* full loop? */ //todo needed???
|
||||||
// Search for Loop Value
|
uint8_t testBuffer[0x10];
|
||||||
readOffset=(off_t)get_streamfile_size(streamFile)-(4*vgmstream->interleave_block_size);
|
off_t readOffset = 0, loopEndOffset = 0;
|
||||||
|
|
||||||
|
readOffset = (off_t)get_streamfile_size(streamFile)-(4*vgmstream->interleave_block_size);
|
||||||
do {
|
do {
|
||||||
readOffset += (off_t)read_streamfile(testBuffer,readOffset,0x10,streamFile);
|
readOffset += (off_t)read_streamfile(testBuffer,readOffset,0x10,streamFile);
|
||||||
|
|
||||||
// Loop End ...
|
|
||||||
if(testBuffer[0x01]==0x01) {
|
if(testBuffer[0x01]==0x01) {
|
||||||
if(loopEnd==0) loopEnd = readOffset-0x10;
|
if(loopEndOffset==0)
|
||||||
|
loopEndOffset = readOffset-0x10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (streamFile->get_offset(streamFile)<(int32_t)get_streamfile_size(streamFile));
|
} while (streamFile->get_offset(streamFile)<(int32_t)get_streamfile_size(streamFile));
|
||||||
|
|
||||||
vgmstream->loop_start_sample = 0;
|
vgmstream->loop_start_sample = 0;
|
||||||
vgmstream->loop_end_sample = (loopEnd/(vgmstream->interleave_block_size)*vgmstream->interleave_block_size)/16*28;
|
vgmstream->loop_end_sample = (loopEndOffset/(vgmstream->interleave_block_size)*vgmstream->interleave_block_size)/16*28;
|
||||||
vgmstream->loop_end_sample += (loopEnd%vgmstream->interleave_block_size)/16*28;
|
vgmstream->loop_end_sample += (loopEndOffset%vgmstream->interleave_block_size)/16*28;
|
||||||
vgmstream->loop_end_sample /=vgmstream->channels;
|
vgmstream->loop_end_sample /=vgmstream->channels;
|
||||||
|
|
||||||
} else {
|
|
||||||
if(read_32bitLE(0x1C,streamFile)<=vgmstream->num_samples) {
|
|
||||||
vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile);
|
|
||||||
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
|
|
||||||
} else {
|
|
||||||
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*0x10)/16*28/vgmstream->channels;;
|
|
||||||
vgmstream->loop_end_sample = (read_32bitLE(0x1C,streamFile)*0x10)/16*28/vgmstream->channels;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (loop_end <= vgmstream->num_samples) {
|
||||||
|
/* assume loops are samples */
|
||||||
|
vgmstream->loop_start_sample = loop_start;
|
||||||
|
vgmstream->loop_end_sample = loop_end;
|
||||||
|
} else {
|
||||||
|
/* assume loops are addresses (official definition) */ //todo use interleave instead of 0x10?
|
||||||
|
vgmstream->loop_start_sample = (loop_start*0x10)/16*28/vgmstream->channels;
|
||||||
|
vgmstream->loop_end_sample = (loop_end*0x10)/16*28/vgmstream->channels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't know why, but it does happen, in ps2 too :( */
|
/* don't know why, but it does happen, in ps2 too :( */ //todo what
|
||||||
if (vgmstream->loop_end_sample > vgmstream->num_samples)
|
if (vgmstream->loop_end_sample > vgmstream->num_samples)
|
||||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
{
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* adjust */
|
||||||
start_offset = 0x28;
|
start_offset = 0x28;
|
||||||
}
|
|
||||||
|
|
||||||
|
if ((stream_size * 2) == (get_streamfile_size(streamFile) - 0x18)) {
|
||||||
if ((streamSize * 2) == (get_streamfile_size(streamFile) - 0x18))
|
/* True Fortune (PS2) with weird stream size */ //todo try to move
|
||||||
{
|
stream_size = (read_32bitLE(0x24,streamFile) * 2) - 0x10;
|
||||||
// True Fortune PS2
|
vgmstream->num_samples = stream_size / 16 * 28 / vgmstream->channels;
|
||||||
streamSize = (read_32bitLE(0x24,streamFile) * 2) - 0x10;
|
|
||||||
vgmstream->num_samples = streamSize / 16 * 28 / vgmstream->channels;
|
|
||||||
}
|
}
|
||||||
else if(get_streamfile_size(streamFile) - read_32bitLE(0x24,streamFile) >= 0x800)
|
else if(get_streamfile_size(streamFile) - read_32bitLE(0x24,streamFile) >= 0x800) {
|
||||||
{
|
/* Hack for files with start_offset = 0x800 (ex. Taisho Mononoke Ibunroku) */
|
||||||
// Hack for files with start_offset = 0x800
|
|
||||||
start_offset = 0x800;
|
start_offset = 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((vgmstream->coding_type == coding_PSX) && (start_offset==0x28))
|
if (vgmstream->coding_type == coding_PSX && start_offset == 0x28) {
|
||||||
{
|
int i;
|
||||||
start_offset = 0x800;
|
start_offset = 0x800;
|
||||||
|
|
||||||
for(i=0;i<0x1f6;i+=4)
|
for (i=0; i < 0x1f6; i += 4) {
|
||||||
{
|
if (read_32bitLE(0x28+(i*4),streamFile)!=0) {
|
||||||
if(read_32bitLE(0x28+(i*4),streamFile)!=0)
|
|
||||||
{
|
|
||||||
start_offset = 0x28;
|
start_offset = 0x28;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we got a real pcm (ex: Clock Tower 3)
|
//todo should adjust num samples after changing start_offset and stream_size?
|
||||||
if(vgmstream->coding_type==coding_PCM16LE)
|
|
||||||
{
|
|
||||||
|
/* check if we got a real pcm by checking PS-ADPCM flags (ex: Clock Tower 3) */
|
||||||
|
//todo check format 0x02 instead
|
||||||
|
if (vgmstream->coding_type==coding_PCM16LE) {
|
||||||
|
uint8_t isPCM = 0;
|
||||||
|
off_t check_offset;
|
||||||
|
|
||||||
check_offset = start_offset;
|
check_offset = start_offset;
|
||||||
do
|
do {
|
||||||
{
|
if (read_8bit(check_offset+1,streamFile)>7) {
|
||||||
if(read_8bit(check_offset+1,streamFile)>7)
|
|
||||||
{
|
|
||||||
isPCM=1;
|
isPCM=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
check_offset+=0x10;
|
check_offset+=0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (check_offset<get_streamfile_size(streamFile));
|
} while (check_offset<get_streamfile_size(streamFile));
|
||||||
|
|
||||||
if(!isPCM)
|
if (!isPCM) {
|
||||||
{
|
|
||||||
vgmstream->num_samples=(get_streamfile_size(streamFile)-start_offset)/16*28/vgmstream->channels;
|
vgmstream->num_samples=(get_streamfile_size(streamFile)-start_offset)/16*28/vgmstream->channels;
|
||||||
vgmstream->coding_type=coding_PSX;
|
vgmstream->coding_type=coding_PSX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* expect pcm format allways start @ 0x800, don't know if it's true :P */
|
|
||||||
/*if(vgmstream->coding_type == coding_PCM16LE)
|
|
||||||
start_offset=0x800;*/
|
|
||||||
|
|
||||||
/* open the file for reading by each channel */
|
|
||||||
{
|
|
||||||
for (i=0;i<channel_count;i++) {
|
|
||||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
|
|
||||||
|
|
||||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
|
||||||
|
|
||||||
vgmstream->ch[i].channel_start_offset=
|
|
||||||
vgmstream->ch[i].offset=
|
|
||||||
(off_t)(start_offset+vgmstream->interleave_block_size*i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||||
|
goto fail;
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,9 @@ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE *streamFile) {
|
|||||||
}
|
}
|
||||||
else if (data_size == file_size - 0x10
|
else if (data_size == file_size - 0x10
|
||||||
&& unknown1 == 0xCCCCCCCC && unknown2 == 0xCCCCCCCC) { /* The Mummy: The Animated Series */
|
&& unknown1 == 0xCCCCCCCC && unknown2 == 0xCCCCCCCC) { /* The Mummy: The Animated Series */
|
||||||
data_size = data_size / 2;
|
|
||||||
interleave = 0x8000;
|
interleave = 0x8000;
|
||||||
}
|
}
|
||||||
else if (data_size == file_size - 0x4020) { /* CT Special Forces (and all games beyond) */
|
else if (data_size == file_size - 0x4020) { /* CT Special Forces (and all games beyond) */
|
||||||
data_size = data_size / 2;
|
|
||||||
interleave = unknown1; /* always 0? */
|
interleave = unknown1; /* always 0? */
|
||||||
if (!interleave)
|
if (!interleave)
|
||||||
interleave = 0x10;
|
interleave = 0x10;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
static int check_psadpcm(STREAMFILE *streamFile);
|
static int check_psadpcm(STREAMFILE *streamFile);
|
||||||
|
|
||||||
|
|
||||||
/* MIB+MIH - from namCollection: Ace Combat 2 (PS2), Rampage - Total Destruction (PS2) */
|
/* MIB+MIH - SCEE MultiStream interleaved bank (header+data) [namCollection: Ace Combat 2 (PS2), Rampage: Total Destruction (PS2)] */
|
||||||
/* headerless PS-ADPCM - from Katamary Damacy (PS2), Air (PS2), Aladdin: Nasira's Revenge (PS1)
|
/* headerless PS-ADPCM - from Katamary Damacy (PS2), Air (PS2), Aladdin: Nasira's Revenge (PS1)
|
||||||
* (guesses interleave and channels by testing data and using the file extension, and finds
|
* (guesses interleave and channels by testing data and using the file extension, and finds
|
||||||
* loops in PS-ADPCM flags; this is a crutch for convenience, consider using GENH/TXTH instead). */
|
* loops in PS-ADPCM flags; this is a crutch for convenience, consider using GENH/TXTH instead). */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* MIC/MIHB - Merged MIH+MIB [Rogue Trooper (PS2), The Sims 2 (PS2)] */
|
/* MIC/MIHB - SCEE MultiStream interleaved bank (merged MIH+MIB) [Rogue Trooper (PS2), The Sims 2 (PS2)] */
|
||||||
VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
@ -9,7 +9,7 @@ VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) {
|
|||||||
int channel_count, loop_flag;
|
int channel_count, loop_flag;
|
||||||
|
|
||||||
/* check extension */
|
/* check extension */
|
||||||
/* .mic: Rebellion Dev. games, .mihb: assumed? */
|
/* .mic: official extension, .mihb: assumed? */
|
||||||
if (!check_extensions(streamFile, "mic,mihb"))
|
if (!check_extensions(streamFile, "mic,mihb"))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x40000000) /* header size */
|
if (read_32bitBE(0x00,streamFile) != 0x40000000) /* header size */
|
||||||
@ -21,7 +21,7 @@ VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
/* frame_size * frame_count * channels = data_size, but last frame has less usable data */
|
/* frame_size * frame_count * channels = data_size, but last frame has less usable data */
|
||||||
{
|
{
|
||||||
/* 0x04(1): 0x20? */
|
/* 0x04: padding (0x20, MIH header must be multiple of 0x40) */
|
||||||
frame_last = (uint16_t)read_16bitLE(0x05,streamFile);
|
frame_last = (uint16_t)read_16bitLE(0x05,streamFile);
|
||||||
frame_size = read_32bitLE(0x10,streamFile);
|
frame_size = read_32bitLE(0x10,streamFile);
|
||||||
frame_count = read_32bitLE(0x14,streamFile);
|
frame_count = read_32bitLE(0x14,streamFile);
|
||||||
|
@ -122,7 +122,8 @@ VGMSTREAM * init_vgmstream_ubi_jade(STREAMFILE *streamFile) {
|
|||||||
switch(codec) {
|
switch(codec) {
|
||||||
|
|
||||||
case 0x0069: /* Xbox */
|
case 0x0069: /* Xbox */
|
||||||
if (fmt_size != 0x12) goto fail;
|
/* Peter Jackson's King Kong uses 0x14 (other versions don't) */
|
||||||
|
if (fmt_size != 0x12 && fmt_size != 0x14) goto fail;
|
||||||
if (block_size != 0x24*channel_count) goto fail;
|
if (block_size != 0x24*channel_count) goto fail;
|
||||||
|
|
||||||
vgmstream->coding_type = coding_XBOX_IMA;
|
vgmstream->coding_type = coding_XBOX_IMA;
|
||||||
|
Loading…
Reference in New Issue
Block a user