mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-07 07:01:16 +01:00
cleanup: fix recent issue with certain meta
This commit is contained in:
parent
85c78d7d37
commit
7d967a2b49
@ -88,8 +88,8 @@ VGMSTREAM* init_vgmstream_hd_bd(STREAMFILE* sf) {
|
||||
|
||||
h.coding = coding_PSX;
|
||||
h.layout = layout_none;
|
||||
|
||||
h.open_stream = true;
|
||||
h.has_subsongs = true;
|
||||
|
||||
// detect hdb pasted together (handle as a separate meta?)
|
||||
if (get_streamfile_size(sf) == hd_size + bd_size) {
|
||||
|
@ -69,8 +69,8 @@ VGMSTREAM* init_vgmstream_pphd(STREAMFILE* sf) {
|
||||
|
||||
h.coding = coding_PSX;
|
||||
h.layout = layout_none;
|
||||
|
||||
h.open_stream = true;
|
||||
h.has_subsongs = true;
|
||||
|
||||
h.sf_head = sf;
|
||||
h.sf_body = open_streamfile_by_ext(sf,"pbd");
|
||||
|
@ -40,6 +40,7 @@ VGMSTREAM* init_vgmstream_xabp(STREAMFILE* sf) {
|
||||
h.coding = coding_PSX;
|
||||
h.layout = layout_none;
|
||||
h.open_stream = true;
|
||||
h.has_subsongs = true;
|
||||
|
||||
h.sf_head = sf;
|
||||
h.sf_body = open_streamfile_by_ext(sf,"bd");
|
||||
@ -47,10 +48,9 @@ VGMSTREAM* init_vgmstream_xabp(STREAMFILE* sf) {
|
||||
|
||||
// Entries/offsets aren't ordered .bd not it seems to have sizes (maybe mixes notes+streams into one)
|
||||
// Since PS-ADPCM is wired to play until end frame end or loop, it's probably designed like that.
|
||||
// It also repeats entries (different ID but same config) but for now just prints it as is.
|
||||
// It also repeats entries (different ID but same config) but for now just prints it as is; this also happens in bigfiles.
|
||||
h.loop_flag = ps_find_stream_info(h.sf_body, h.stream_offset, bd_size - h.stream_offset, h.channels, h.interleave, &h.loop_start, &h.loop_end, &h.stream_size);
|
||||
h.num_samples = ps_bytes_to_samples(h.stream_size, h.channels);
|
||||
VGM_LOG("s=%x, %x\n", h.stream_offset, h.stream_size);
|
||||
|
||||
vgmstream = alloc_metastream(&h);
|
||||
close_streamfile(h.sf_body);
|
||||
|
@ -15,7 +15,7 @@ VGMSTREAM* alloc_metastream(meta_header_t* h) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (h->target_subsong < 0 || h->target_subsong > h->total_subsongs || h->total_subsongs < 1) {
|
||||
if (h->has_subsongs && (h->target_subsong < 0 || h->target_subsong > h->total_subsongs || h->total_subsongs < 1)) {
|
||||
VGM_LOG("meta: wrong subsongs %i vs %i\n", h->target_subsong, h->total_subsongs);
|
||||
return NULL;
|
||||
}
|
||||
@ -36,6 +36,7 @@ VGMSTREAM* alloc_metastream(meta_header_t* h) {
|
||||
vgmstream->num_streams = h->total_subsongs;
|
||||
vgmstream->stream_size = h->stream_size;
|
||||
vgmstream->interleave_block_size = h->interleave;
|
||||
vgmstream->interleave_last_block_size = h->interleave_last;
|
||||
vgmstream->allow_dual_stereo = h->allow_dual_stereo;
|
||||
|
||||
if (h->name_offset)
|
||||
|
@ -24,6 +24,7 @@ typedef struct {
|
||||
int total_subsongs;
|
||||
|
||||
int32_t interleave;
|
||||
int32_t interleave_last;
|
||||
|
||||
/* common helpers */
|
||||
uint32_t stream_offset; /* where current stream starts */
|
||||
@ -54,6 +55,7 @@ typedef struct {
|
||||
|
||||
bool open_stream;
|
||||
|
||||
bool has_subsongs;
|
||||
bool allow_dual_stereo;
|
||||
} meta_header_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user