From 1dceedaa55fe8bcbd442b3f3b5d8d1da85089621 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 12 Jul 2019 17:02:28 -0700 Subject: [PATCH] Updated VGMStream to r1050-2361-ga2d54810 --- .../libvgmstream.xcodeproj/project.pbxproj | 4 +++ Frameworks/vgmstream/vgmstream/src/formats.c | 2 ++ .../vgmstream/vgmstream/src/meta/meta.h | 2 ++ Frameworks/vgmstream/vgmstream/src/meta/rad.c | 35 +++++++++++++++++++ .../vgmstream/vgmstream/src/vgmstream.c | 1 + .../vgmstream/vgmstream/src/vgmstream.h | 1 + 6 files changed, 45 insertions(+) create mode 100644 Frameworks/vgmstream/vgmstream/src/meta/rad.c diff --git a/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj b/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj index 55e22ad15..37e41a1df 100644 --- a/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj +++ b/Frameworks/vgmstream/libvgmstream.xcodeproj/project.pbxproj @@ -467,6 +467,7 @@ 838BDB7B1D3B1FC20022CA6F /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838BDB7A1D3B1FC20022CA6F /* CoreMedia.framework */; }; 838BDB7D1D3B1FCC0022CA6F /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838BDB7C1D3B1FCC0022CA6F /* CoreVideo.framework */; }; 838BDB7F1D3B1FD10022CA6F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838BDB7E1D3B1FD10022CA6F /* Cocoa.framework */; }; + 83997F5B22D9569E00633184 /* rad.c in Sources */ = {isa = PBXBuildFile; fileRef = 83997F5722D9569E00633184 /* rad.c */; }; 839B54521EEE1D9600048A2D /* ngc_ulw.c in Sources */ = {isa = PBXBuildFile; fileRef = 831BD11F1EEE1CF200198540 /* ngc_ulw.c */; }; 839E21E01F2EDAF100EE54D7 /* vorbis_custom_data_fsb.h in Headers */ = {isa = PBXBuildFile; fileRef = 839E21D61F2EDAF000EE54D7 /* vorbis_custom_data_fsb.h */; }; 839E21E11F2EDAF100EE54D7 /* vorbis_custom_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 839E21D71F2EDAF000EE54D7 /* vorbis_custom_decoder.c */; }; @@ -1132,6 +1133,7 @@ 838BDB7A1D3B1FC20022CA6F /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 838BDB7C1D3B1FCC0022CA6F /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; 838BDB7E1D3B1FD10022CA6F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 83997F5722D9569E00633184 /* rad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rad.c; sourceTree = ""; }; 839E21D61F2EDAF000EE54D7 /* vorbis_custom_data_fsb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vorbis_custom_data_fsb.h; sourceTree = ""; }; 839E21D71F2EDAF000EE54D7 /* vorbis_custom_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vorbis_custom_decoder.c; sourceTree = ""; }; 839E21D81F2EDAF000EE54D7 /* vorbis_custom_utils_wwise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vorbis_custom_utils_wwise.c; sourceTree = ""; }; @@ -1751,6 +1753,7 @@ 836F6ED618BDC2190095E648 /* ps3_ivag.c */, 836F6ED918BDC2190095E648 /* ps3_past.c */, 836F6EDF18BDC2190095E648 /* psx_gms.c */, + 83997F5722D9569E00633184 /* rad.c */, 836F6EE118BDC2190095E648 /* raw.c */, 836F6EE218BDC2190095E648 /* redspark.c */, 834FE0D9215C79EA000A5D3D /* rfrm.c */, @@ -2168,6 +2171,7 @@ 836F6FB218BDC2190095E648 /* ngc_gcub.c in Sources */, 836F702818BDC2190095E648 /* sat_dvi.c in Sources */, 832BF82D21E0514B006F50F1 /* nus3audio.c in Sources */, + 83997F5B22D9569E00633184 /* rad.c in Sources */, 836F6F2F18BDC2190095E648 /* mtaf_decoder.c in Sources */, 83AA5D161F6E2F600020821C /* ea_xa_decoder.c in Sources */, 836F6F9B18BDC2190095E648 /* mn_str.c in Sources */, diff --git a/Frameworks/vgmstream/vgmstream/src/formats.c b/Frameworks/vgmstream/vgmstream/src/formats.c index 5d8015d50..2b45dd1a2 100644 --- a/Frameworks/vgmstream/vgmstream/src/formats.c +++ b/Frameworks/vgmstream/vgmstream/src/formats.c @@ -333,6 +333,7 @@ static const char* extension_list[] = { "r", "rac", //txth/reserved [Manhunt (Xbox)] + "rad", "rak", "ras", "raw", @@ -1195,6 +1196,7 @@ static const meta_info meta_info_list[] = { {meta_XWMA_KONAMI, "Konami XWMA header"}, {meta_9TAV, "Konami 9TAV header"}, {meta_BWAV, "Nintendo BWAV header"}, + {meta_RAD, "Traveller's Tales RAD header"}, }; diff --git a/Frameworks/vgmstream/vgmstream/src/meta/meta.h b/Frameworks/vgmstream/vgmstream/src/meta/meta.h index 512362813..7789dd098 100644 --- a/Frameworks/vgmstream/vgmstream/src/meta/meta.h +++ b/Frameworks/vgmstream/vgmstream/src/meta/meta.h @@ -861,4 +861,6 @@ VGMSTREAM * init_vgmstream_opus_prototype(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_awb(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_rad(STREAMFILE * streamFile); + #endif /*_META_H*/ diff --git a/Frameworks/vgmstream/vgmstream/src/meta/rad.c b/Frameworks/vgmstream/vgmstream/src/meta/rad.c new file mode 100644 index 000000000..e6bcb3478 --- /dev/null +++ b/Frameworks/vgmstream/vgmstream/src/meta/rad.c @@ -0,0 +1,35 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* RAD - from Traveller's Tales' Bionicle Heroes */ +VGMSTREAM * init_vgmstream_rad(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + off_t start_offset; + int channel_count, loop_flag = 0; + + /* checks */ + if (!check_extensions(streamFile, "rad")) + goto fail; + + start_offset = read_32bitLE(0x00, streamFile); + channel_count = read_8bit(0x0D, streamFile); + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count, loop_flag); + if (!vgmstream) goto fail; + + vgmstream->sample_rate = read_32bitLE(0x04, streamFile); + vgmstream->num_samples = read_32bitLE(0x08, streamFile); + vgmstream->meta_type = meta_RAD; + vgmstream->layout_type = layout_none; + vgmstream->coding_type = coding_PCM16LE; + + if (!vgmstream_open_stream(vgmstream, streamFile, start_offset)) + goto fail; + + return vgmstream; + +fail: + close_vgmstream(vgmstream); + return NULL; +} \ No newline at end of file diff --git a/Frameworks/vgmstream/vgmstream/src/vgmstream.c b/Frameworks/vgmstream/vgmstream/src/vgmstream.c index 669864b8c..5fbfb0411 100644 --- a/Frameworks/vgmstream/vgmstream/src/vgmstream.c +++ b/Frameworks/vgmstream/vgmstream/src/vgmstream.c @@ -483,6 +483,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = { init_vgmstream_bwav, init_vgmstream_opus_prototype, init_vgmstream_awb, + init_vgmstream_rad, /* 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 */ diff --git a/Frameworks/vgmstream/vgmstream/src/vgmstream.h b/Frameworks/vgmstream/vgmstream/src/vgmstream.h index 5d5dde7cc..1ae890325 100644 --- a/Frameworks/vgmstream/vgmstream/src/vgmstream.h +++ b/Frameworks/vgmstream/vgmstream/src/vgmstream.h @@ -743,6 +743,7 @@ typedef enum { meta_XWMA_KONAMI, meta_9TAV, meta_BWAV, + meta_RAD, } meta_t;