Fix .dic crash

This commit is contained in:
bnnm 2024-01-14 20:36:30 +01:00
parent 1f5bbeccdb
commit 18689e314c
3 changed files with 467 additions and 459 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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;