diff --git a/src/formats.c b/src/formats.c index 3d27fd46..3d31de06 100644 --- a/src/formats.c +++ b/src/formats.c @@ -39,6 +39,7 @@ static const char* extension_list[] = { //"ac3", //common, FFmpeg/not parsed (AC3) "acb", "acm", + "acx", "ad", //txth/reserved [Xenosaga Freaks (PS2)] "adc", //txth/reserved [Tomb Raider The Last Revelation (DC), Tomb Raider Chronicles (DC)] "adm", diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index d8410760..a6f34814 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -500,6 +500,10 @@ RelativePath=".\meta\acm.c" > + + diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index e7e5698f..ed9c59f6 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -282,6 +282,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 65c92f9a..0bbf0d2a 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -364,6 +364,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/acx.c b/src/meta/acx.c new file mode 100644 index 00000000..430ea448 --- /dev/null +++ b/src/meta/acx.c @@ -0,0 +1,43 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* .acx - CRI container [Baroque (SAT), Persona 3 (PS2), THE iDOLM@STER: Live For You (X360)] */ +VGMSTREAM* init_vgmstream_acx(STREAMFILE* sf) { + VGMSTREAM* vgmstream = NULL; + STREAMFILE* temp_sf = NULL; + off_t subfile_offset; + size_t subfile_size; + int total_subsongs, target_subsong = sf->stream_index; + + + /* checks */ + if (!check_extensions(sf,"acx")) + goto fail; + if (read_u32be(0x00,sf) != 0x00000000) + goto fail; + + /* simple container for sfx and rarely music [Burning Rangers (SAT)], + * mainly used until .csb was introduced */ + + total_subsongs = read_u32be(0x04,sf); + 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"); + if (!temp_sf) goto fail; + + vgmstream = init_vgmstream_adx(temp_sf); + if (!vgmstream) goto fail; + + vgmstream->num_streams = total_subsongs; + close_streamfile(temp_sf); + return vgmstream; + +fail: + close_streamfile(temp_sf); + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/meta/meta.h b/src/meta/meta.h index 95b37232..361d28aa 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -934,4 +934,6 @@ VGMSTREAM *init_vgmstream_sbk(STREAMFILE *sf); VGMSTREAM* init_vgmstream_ifs(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_acx(STREAMFILE* sf); + #endif /*_META_H*/ diff --git a/src/vgmstream.c b/src/vgmstream.c index dac2703c..bcf888c0 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -516,6 +516,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_dsp_wiiadpcm, init_vgmstream_dsp_cwac, init_vgmstream_ifs, + init_vgmstream_acx, /* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */ init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */