mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Fix some .acx [12Riven (PC)]
This commit is contained in:
parent
94282e0514
commit
9721fa22e9
@ -5,31 +5,49 @@
|
||||
VGMSTREAM* init_vgmstream_acx(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* temp_sf = NULL;
|
||||
off_t subfile_offset;
|
||||
size_t subfile_size;
|
||||
uint32_t subfile_offset, subfile_size, subfile_id;
|
||||
int total_subsongs, target_subsong = sf->stream_index;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(sf,"acx"))
|
||||
goto fail;
|
||||
if (read_u32be(0x00,sf) != 0x00000000)
|
||||
goto fail;
|
||||
return NULL;
|
||||
|
||||
/* simple container for sfx and rarely music [Burning Rangers (SAT)],
|
||||
* mainly used until .csb was introduced */
|
||||
|
||||
total_subsongs = read_u32be(0x04,sf);
|
||||
if (total_subsongs > 256 || total_subsongs == 0) /* arbitrary max */
|
||||
return NULL;
|
||||
|
||||
if (!check_extensions(sf,"acx"))
|
||||
return NULL;
|
||||
|
||||
init_vgmstream_t init_vgmstream = NULL;
|
||||
const char* fake_ext = NULL;
|
||||
|
||||
if (target_subsong == 0) target_subsong = 1;
|
||||
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
|
||||
|
||||
subfile_offset = read_u32be(0x08 + (target_subsong-1) * 0x08 + 0x00,sf);
|
||||
subfile_size = read_u32be(0x08 + (target_subsong-1) * 0x08 + 0x04,sf);
|
||||
|
||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, "adx");
|
||||
subfile_id = read_u32be(subfile_offset,sf);
|
||||
if (subfile_id == get_id32be("OggS")) { /* 12Riven (PC) */
|
||||
init_vgmstream = init_vgmstream_ogg_vorbis;
|
||||
fake_ext = "ogg";
|
||||
}
|
||||
else if ((subfile_id & 0xFFFF0000) == 0x80000000) {
|
||||
init_vgmstream = init_vgmstream_adx;
|
||||
fake_ext = "adx";
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, fake_ext);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_adx(temp_sf);
|
||||
vgmstream = init_vgmstream(temp_sf);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->num_streams = total_subsongs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user