Updated VGMStream to r1050-3714-g82dd9a7d
parent
95a63327fa
commit
7181656ae9
|
@ -16,7 +16,7 @@ static void decode_mpeg_custom_stream(VGMSTREAMCHANNEL *stream, mpeg_codec_data
|
||||||
|
|
||||||
|
|
||||||
/* Inits regular MPEG */
|
/* Inits regular MPEG */
|
||||||
mpeg_codec_data *init_mpeg(STREAMFILE *streamfile, off_t start_offset, coding_t *coding_type, int channels) {
|
mpeg_codec_data* init_mpeg(STREAMFILE* sf, off_t start_offset, coding_t* coding_type, int channels) {
|
||||||
mpeg_codec_data* data = NULL;
|
mpeg_codec_data* data = NULL;
|
||||||
|
|
||||||
/* init codec */
|
/* init codec */
|
||||||
|
@ -41,14 +41,16 @@ mpeg_codec_data *init_mpeg(STREAMFILE *streamfile, off_t start_offset, coding_t
|
||||||
size_t samples_per_frame;
|
size_t samples_per_frame;
|
||||||
struct mpg123_frameinfo mi;
|
struct mpg123_frameinfo mi;
|
||||||
|
|
||||||
|
//todo read single big buffer then add +1 up to a few max bytes, or just read once only
|
||||||
/* read first frame(s) */
|
/* read first frame(s) */
|
||||||
do {
|
do {
|
||||||
size_t bytes_done;
|
size_t bytes_read, bytes_done;
|
||||||
if (read_streamfile(data->buffer, start_offset+read_offset, data->buffer_size, streamfile) != data->buffer_size)
|
|
||||||
goto fail;
|
/* don't check max as sfx can be smaller than buffer */
|
||||||
|
bytes_read = read_streamfile(data->buffer, start_offset + read_offset, data->buffer_size, sf);
|
||||||
read_offset += 1;
|
read_offset += 1;
|
||||||
|
|
||||||
rc = mpg123_decode(main_m, data->buffer,data->buffer_size, NULL,0, &bytes_done);
|
rc = mpg123_decode(main_m, data->buffer, bytes_read, NULL,0, &bytes_done);
|
||||||
if (rc != MPG123_OK && rc != MPG123_NEW_FORMAT && rc != MPG123_NEED_MORE) {
|
if (rc != MPG123_OK && rc != MPG123_NEW_FORMAT && rc != MPG123_NEED_MORE) {
|
||||||
VGM_LOG("MPEG: unable to set up mpg123 at start offset\n");
|
VGM_LOG("MPEG: unable to set up mpg123 at start offset\n");
|
||||||
goto fail; //handle MPG123_DONE?
|
goto fail; //handle MPG123_DONE?
|
||||||
|
@ -111,7 +113,7 @@ fail:
|
||||||
|
|
||||||
|
|
||||||
/* Init custom MPEG, with given type and config */
|
/* Init custom MPEG, with given type and config */
|
||||||
mpeg_codec_data *init_mpeg_custom(STREAMFILE *streamFile, off_t start_offset, coding_t *coding_type, int channels, mpeg_custom_t type, mpeg_custom_config *config) {
|
mpeg_codec_data* init_mpeg_custom(STREAMFILE* sf, off_t start_offset, coding_t* coding_type, int channels, mpeg_custom_t type, mpeg_custom_config* config) {
|
||||||
mpeg_codec_data* data = NULL;
|
mpeg_codec_data* data = NULL;
|
||||||
int i, ok;
|
int i, ok;
|
||||||
|
|
||||||
|
@ -132,10 +134,10 @@ mpeg_codec_data *init_mpeg_custom(STREAMFILE *streamFile, off_t start_offset, co
|
||||||
case MPEG_EAL31:
|
case MPEG_EAL31:
|
||||||
case MPEG_EAL31b:
|
case MPEG_EAL31b:
|
||||||
case MPEG_EAL32P:
|
case MPEG_EAL32P:
|
||||||
case MPEG_EAL32S: ok = mpeg_custom_setup_init_ealayer3(streamFile, start_offset, data, coding_type); break;
|
case MPEG_EAL32S: ok = mpeg_custom_setup_init_ealayer3(sf, start_offset, data, coding_type); break;
|
||||||
case MPEG_AWC: ok = mpeg_custom_setup_init_awc(streamFile, start_offset, data, coding_type); break;
|
case MPEG_AWC: ok = mpeg_custom_setup_init_awc(sf, start_offset, data, coding_type); break;
|
||||||
case MPEG_EAMP3: ok = mpeg_custom_setup_init_eamp3(streamFile, start_offset, data, coding_type); break;
|
case MPEG_EAMP3: ok = mpeg_custom_setup_init_eamp3(sf, start_offset, data, coding_type); break;
|
||||||
default: ok = mpeg_custom_setup_init_default(streamFile, start_offset, data, coding_type); break;
|
default: ok = mpeg_custom_setup_init_default(sf, start_offset, data, coding_type); break;
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -219,7 +221,7 @@ fail:
|
||||||
/************/
|
/************/
|
||||||
|
|
||||||
void decode_mpeg(VGMSTREAM* vgmstream, sample_t* outbuf, int32_t samples_to_do, int channels) {
|
void decode_mpeg(VGMSTREAM* vgmstream, sample_t* outbuf, int32_t samples_to_do, int channels) {
|
||||||
mpeg_codec_data * data = (mpeg_codec_data *) vgmstream->codec_data;
|
mpeg_codec_data* data = vgmstream->codec_data;
|
||||||
|
|
||||||
if (!data->custom) {
|
if (!data->custom) {
|
||||||
decode_mpeg_standard(&vgmstream->ch[0], data, outbuf, samples_to_do, channels);
|
decode_mpeg_standard(&vgmstream->ch[0], data, outbuf, samples_to_do, channels);
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ static const meta_info meta_info_list[] = {
|
||||||
{meta_CAFF, "Apple Core Audio Format File header"},
|
{meta_CAFF, "Apple Core Audio Format File header"},
|
||||||
{meta_PC_MXST, "Lego Island MxSt Header"},
|
{meta_PC_MXST, "Lego Island MxSt Header"},
|
||||||
{meta_SAB, "Sensaura SAB header"},
|
{meta_SAB, "Sensaura SAB header"},
|
||||||
{meta_MAXIS_XA, "Maxis XAI/XAJ Header"},
|
{meta_MAXIS_XA, "Maxis XA Header"},
|
||||||
{meta_EXAKT_SC, "assumed Activision / EXAKT SC by extension"},
|
{meta_EXAKT_SC, "assumed Activision / EXAKT SC by extension"},
|
||||||
{meta_WII_BNS, "Nintendo BNS header"},
|
{meta_WII_BNS, "Nintendo BNS header"},
|
||||||
{meta_WII_WAS, "Sumo Digital iSWS header"},
|
{meta_WII_WAS, "Sumo Digital iSWS header"},
|
||||||
|
|
|
@ -231,15 +231,26 @@ VGMSTREAM* init_vgmstream_bnk_sony(STREAMFILE* sf) {
|
||||||
case 0xB9: sample_rate = 30000; break; //?
|
case 0xB9: sample_rate = 30000; break; //?
|
||||||
case 0xB8: sample_rate = 28000; break; //?
|
case 0xB8: sample_rate = 28000; break; //?
|
||||||
case 0xB6: sample_rate = 22050; break;
|
case 0xB6: sample_rate = 22050; break;
|
||||||
|
case 0xB4: sample_rate = 18000; break; //?
|
||||||
|
case 0xB2: sample_rate = 16000; break; //?
|
||||||
case 0xB0: sample_rate = 15000; break; //?
|
case 0xB0: sample_rate = 15000; break; //?
|
||||||
case 0xAF: sample_rate = 14000; break; //?
|
case 0xAF: sample_rate = 14000; break; //?
|
||||||
case 0xAE: sample_rate = 13000; break; //?
|
case 0xAE: sample_rate = 13000; break; //?
|
||||||
|
case 0xAD: sample_rate = 12500; break; //?
|
||||||
case 0xAC: sample_rate = 12000; break; //?
|
case 0xAC: sample_rate = 12000; break; //?
|
||||||
case 0xAB: sample_rate = 11050; break; //?
|
case 0xAB: sample_rate = 11050; break; //?
|
||||||
case 0xAA: sample_rate = 11025; break;
|
case 0xAA: sample_rate = 11025; break;
|
||||||
case 0xA9: sample_rate = 10000; break; //?
|
case 0xA9: sample_rate = 10000; break; //?
|
||||||
|
case 0xA8: sample_rate = 9000; break; //?
|
||||||
|
case 0xA7: sample_rate = 8000; break; //?
|
||||||
|
case 0xA6: sample_rate = 7000; break; //?
|
||||||
|
case 0xA5: sample_rate = 6500; break; //?
|
||||||
case 0xA4: sample_rate = 6000; break; //?
|
case 0xA4: sample_rate = 6000; break; //?
|
||||||
|
case 0xA3: sample_rate = 5800; break; //?
|
||||||
|
case 0xA2: sample_rate = 5400; break; //?
|
||||||
|
case 0xA1: sample_rate = 5000; break; //?
|
||||||
case 0x9d: sample_rate = 4000; break; //?
|
case 0x9d: sample_rate = 4000; break; //?
|
||||||
|
case 0x9c: sample_rate = 3500; break; //?
|
||||||
default:
|
default:
|
||||||
VGM_LOG("BNK: unknown pitch %x\n", pitch);
|
VGM_LOG("BNK: unknown pitch %x\n", pitch);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -1,32 +1,46 @@
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
/* Maxis XA - found in Sim City 3000 (PC) */
|
/* Maxis XA - found in Sim City 3000 (PC), The Sims 2 (PC) */
|
||||||
VGMSTREAM * init_vgmstream_maxis_xa(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_maxis_xa(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag, channel_count;
|
int avg_byte_rate, channel_count, loop_flag, resolution, sample_align, sample_rate;
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
/* check extension, case insensitive */
|
||||||
if (!check_extensions(streamFile,"xa"))
|
if (!check_extensions(streamFile,"xa"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* check header */
|
/* check header */
|
||||||
if ((read_32bitBE(0x00,streamFile) != 0x58414900) && /* "XAI\0" (sound/speech) */
|
if ((read_16bitBE(0x00,streamFile) != 0x5841)) /* "XA" */
|
||||||
(read_32bitBE(0x00,streamFile) != 0x58414A00) && /* "XAJ\0" (music, no apparent diffs) */
|
goto fail;
|
||||||
(read_32bitBE(0x00,streamFile) != 0x58410000) && /* "XA\0\0" (sound/speech from The Sims 2, no apparent diffs) */
|
|
||||||
(read_32bitBE(0x00,streamFile) != 0x58411200)) /* "XA\x12\0" (music from The Sims 2, no apparent diffs) */
|
/* check format tag */
|
||||||
|
if ((read_16bitLE(0x08,streamFile) != 0x0001))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
channel_count = read_16bitLE(0x0A,streamFile);
|
||||||
|
sample_rate = read_32bitLE(0x0C,streamFile);
|
||||||
|
avg_byte_rate = read_32bitLE(0x10,streamFile);
|
||||||
|
sample_align = read_16bitLE(0x14,streamFile);
|
||||||
|
resolution = read_16bitLE(0x16,streamFile);
|
||||||
|
|
||||||
|
/* check alignment */
|
||||||
|
if (sample_align != (resolution/8)*channel_count)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* check average byte rate */
|
||||||
|
if (avg_byte_rate != sample_rate*sample_align)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
loop_flag = 0;
|
loop_flag = 0;
|
||||||
channel_count = read_16bitLE(0x0A,streamFile);
|
|
||||||
start_offset = 0x18;
|
start_offset = 0x18;
|
||||||
|
|
||||||
/* 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;
|
||||||
|
|
||||||
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
|
vgmstream->sample_rate = sample_rate;
|
||||||
vgmstream->num_samples = read_32bitLE(0x04,streamFile)/2/channel_count;
|
vgmstream->num_samples = read_32bitLE(0x04,streamFile)/2/channel_count;
|
||||||
|
|
||||||
vgmstream->meta_type = meta_MAXIS_XA;
|
vgmstream->meta_type = meta_MAXIS_XA;
|
||||||
|
|
|
@ -3366,12 +3366,14 @@ static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf) {
|
||||||
/* Splinter Cell: Pandora Tomorrow-online (2004)(PS2)-bank 0x000A0008 */
|
/* Splinter Cell: Pandora Tomorrow-online (2004)(PS2)-bank 0x000A0008 */
|
||||||
/* Prince of Persia: Warrior Within (Demo)(2004)(PS2)-bank 0x00100000 */
|
/* Prince of Persia: Warrior Within (Demo)(2004)(PS2)-bank 0x00100000 */
|
||||||
/* Prince of Persia: Warrior Within (2004)(PS2)-bank 0x00120009 */
|
/* Prince of Persia: Warrior Within (2004)(PS2)-bank 0x00120009 */
|
||||||
|
/* Horsez / Champion Dreams: First to Ride / Pipa Funnell: Take the Reins (2006)(PS2)-bank 0x0012000c */
|
||||||
if ((sb->version == 0x000A0002 && sb->platform == UBI_PS2) ||
|
if ((sb->version == 0x000A0002 && sb->platform == UBI_PS2) ||
|
||||||
(sb->version == 0x000A0004 && sb->platform == UBI_PS2) ||
|
(sb->version == 0x000A0004 && sb->platform == UBI_PS2) ||
|
||||||
(sb->version == 0x000A0007 && sb->platform == UBI_PS2 && !is_bia_ps2) ||
|
(sb->version == 0x000A0007 && sb->platform == UBI_PS2 && !is_bia_ps2) ||
|
||||||
(sb->version == 0x000A0008 && sb->platform == UBI_PS2) ||
|
(sb->version == 0x000A0008 && sb->platform == UBI_PS2) ||
|
||||||
(sb->version == 0x00100000 && sb->platform == UBI_PS2) ||
|
(sb->version == 0x00100000 && sb->platform == UBI_PS2) ||
|
||||||
(sb->version == 0x00120009 && sb->platform == UBI_PS2)) {
|
(sb->version == 0x00120009 && sb->platform == UBI_PS2) ||
|
||||||
|
(sb->version == 0x0012000c && sb->platform == UBI_PS2)) {
|
||||||
config_sb_entry(sb, 0x48, 0x6c);
|
config_sb_entry(sb, 0x48, 0x6c);
|
||||||
|
|
||||||
config_sb_audio_fb(sb, 0x18, (1 << 2), (1 << 3), (1 << 4));
|
config_sb_audio_fb(sb, 0x18, (1 << 2), (1 << 3), (1 << 4));
|
||||||
|
|
Loading…
Reference in New Issue