mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-01 01:27:20 +01:00
Merge pull request #1474 from bnnm/scd
- Fix some .scd [Drakengard 3 (PS3)] - Fix .dic crash
This commit is contained in:
commit
836f0eeaff
@ -450,5 +450,8 @@ int get_vgmstream_average_bitrate(VGMSTREAM* vgmstream) {
|
||||
bitrate_info_t br = {0};
|
||||
br.count_max = BITRATE_FILES_MAX;
|
||||
|
||||
if (vgmstream->coding_type == coding_SILENCE)
|
||||
return 0;
|
||||
|
||||
return get_vgmstream_file_bitrate_main(vgmstream, &br, NULL);
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ ogg_vorbis_codec_data* init_ogg_vorbis(STREAMFILE* sf, off_t start, off_t size,
|
||||
ov_callbacks callbacks = {0};
|
||||
|
||||
//todo clean up
|
||||
if (!sf)
|
||||
return NULL;
|
||||
|
||||
callbacks.read_func = ov_read_func;
|
||||
callbacks.seek_func = ov_seek_func;
|
||||
|
@ -84,7 +84,7 @@ VGMSTREAM* init_vgmstream_ego_dic(STREAMFILE* sf) {
|
||||
if (sb == NULL) {
|
||||
vgm_logi("DIC1: external file '%s' not found (put together)\n", resource_name);
|
||||
/* allow missing as silence since some game use huge .dic that is a bit hard to get */
|
||||
//goto fail;
|
||||
codec = 0xFFFFFFFF; //goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,6 +100,13 @@ VGMSTREAM* init_vgmstream_ego_dic(STREAMFILE* sf) {
|
||||
|
||||
|
||||
switch(codec) {
|
||||
case 0xFFFFFFFF: //fake
|
||||
vgmstream->coding_type = coding_SILENCE;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
vgmstream->num_samples = sample_rate;
|
||||
break;
|
||||
|
||||
case 0x57495000: //WIP\0
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
@ -143,10 +150,6 @@ VGMSTREAM* init_vgmstream_ego_dic(STREAMFILE* sf) {
|
||||
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
if (!sb) {
|
||||
vgmstream->coding_type = coding_SILENCE;
|
||||
vgmstream->layout_type = layout_none;
|
||||
}
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sb, stream_offset))
|
||||
goto fail;
|
||||
|
@ -24,14 +24,13 @@ VGMSTREAM* init_vgmstream_sqex_scd(STREAMFILE* sf) {
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(sf, "scd"))
|
||||
goto fail;
|
||||
|
||||
/** main header **/
|
||||
if (!is_id32be(0x00,sf, "SEDB") &&
|
||||
!is_id32be(0x04,sf, "SSCF"))
|
||||
goto fail;
|
||||
return NULL;
|
||||
if (!check_extensions(sf, "scd"))
|
||||
return NULL;
|
||||
|
||||
/** main header **/
|
||||
big_endian = read_u8(0x0c,sf) == 0x01;
|
||||
if (big_endian) { /* big endian flag */
|
||||
//size_offset = 0x14;
|
||||
@ -216,15 +215,16 @@ VGMSTREAM* init_vgmstream_sqex_scd(STREAMFILE* sf) {
|
||||
read_string(vgmstream->stream_name, STREAM_NAME_SIZE, name_offset, sf);
|
||||
|
||||
switch (codec) {
|
||||
case 0x01: /* PCM */
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
case 0x00: /* PCM BE [Drakengard 3 (PS3)] */
|
||||
case 0x01: /* PCM LE */
|
||||
vgmstream->coding_type = codec == 0x00 ? coding_PCM16BE : coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x02;
|
||||
|
||||
vgmstream->num_samples = pcm_bytes_to_samples(stream_size, channels, 16);
|
||||
vgmstream->num_samples = pcm16_bytes_to_samples(stream_size, channels);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = pcm_bytes_to_samples(loop_start, channels, 16);
|
||||
vgmstream->loop_end_sample = pcm_bytes_to_samples(loop_end, channels, 16);
|
||||
vgmstream->loop_start_sample = pcm16_bytes_to_samples(loop_start, channels);
|
||||
vgmstream->loop_end_sample = pcm16_bytes_to_samples(loop_end, channels);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user