Updated VGMStream to r1843-0-gb158e812

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2023-05-31 22:31:44 -07:00
parent 1ef7853488
commit 7640c869de
No known key found for this signature in database
101 changed files with 2548 additions and 2187 deletions

View File

@ -181,6 +181,33 @@
8339B326280FDF4B0076F74B /* text_reader.c in Sources */ = {isa = PBXBuildFile; fileRef = 8339B324280FDF4B0076F74B /* text_reader.c */; };
8339B327280FDF4B0076F74B /* text_reader.h in Headers */ = {isa = PBXBuildFile; fileRef = 8339B325280FDF4B0076F74B /* text_reader.h */; };
833A7A2E1ED11961003EC53E /* xau.c in Sources */ = {isa = PBXBuildFile; fileRef = 833A7A2D1ED11961003EC53E /* xau.c */; };
833E82C62A28562E00CD0580 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82C52A28562E00CD0580 /* info.c */; };
833E82C82A28566700CD0580 /* channel_mappings.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82C72A28566700CD0580 /* channel_mappings.h */; };
833E82CF2A2856B200CD0580 /* reader_get_nibbles.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82C92A2856B200CD0580 /* reader_get_nibbles.h */; };
833E82D02A2856B200CD0580 /* reader_get.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82CA2A2856B200CD0580 /* reader_get.h */; settings = {ATTRIBUTES = (Public, ); }; };
833E82D12A2856B200CD0580 /* reader_put.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82CB2A2856B200CD0580 /* reader_put.h */; settings = {ATTRIBUTES = (Public, ); }; };
833E82D22A2856B200CD0580 /* reader_put.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82CC2A2856B200CD0580 /* reader_put.c */; };
833E82D32A2856B200CD0580 /* samples_ops.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82CD2A2856B200CD0580 /* samples_ops.c */; };
833E82D42A2856B200CD0580 /* samples_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82CE2A2856B200CD0580 /* samples_ops.h */; };
833E82D62A2856E500CD0580 /* vgmstream_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82D52A2856E500CD0580 /* vgmstream_types.h */; settings = {ATTRIBUTES = (Public, ); }; };
833E82D82A28572100CD0580 /* api.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82D72A28572100CD0580 /* api.h */; settings = {ATTRIBUTES = (Public, ); }; };
833E82E22A2857F700CD0580 /* decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82D92A2857F700CD0580 /* decode.c */; };
833E82E32A2857F700CD0580 /* render.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82DA2A2857F700CD0580 /* render.c */; };
833E82E42A2857F700CD0580 /* seek.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82DB2A2857F700CD0580 /* seek.c */; };
833E82E52A2857F700CD0580 /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82DC2A2857F700CD0580 /* decode.h */; };
833E82E62A2857F700CD0580 /* mixing.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82DD2A2857F700CD0580 /* mixing.h */; };
833E82E72A2857F700CD0580 /* plugins.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82DE2A2857F700CD0580 /* plugins.c */; };
833E82E82A2857F700CD0580 /* plugins.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82DF2A2857F700CD0580 /* plugins.h */; settings = {ATTRIBUTES = (Public, ); }; };
833E82E92A2857F700CD0580 /* mixing.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82E02A2857F700CD0580 /* mixing.c */; };
833E82EA2A2857F700CD0580 /* render.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82E12A2857F700CD0580 /* render.h */; };
833E82F02A28587D00CD0580 /* companion_files.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82EB2A28587D00CD0580 /* companion_files.c */; };
833E82F12A28587D00CD0580 /* paths.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82EC2A28587D00CD0580 /* paths.c */; };
833E82F22A28587D00CD0580 /* paths.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82ED2A28587D00CD0580 /* paths.h */; };
833E82F32A28587D00CD0580 /* reader_sf.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82EE2A28587D00CD0580 /* reader_sf.h */; };
833E82F42A28587D00CD0580 /* companion_files.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82EF2A28587D00CD0580 /* companion_files.h */; };
833E82F72A2858EF00CD0580 /* reader.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E82F52A2858EF00CD0580 /* reader.c */; };
833E82F82A2858EF00CD0580 /* reader_text.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82F62A2858EF00CD0580 /* reader_text.h */; };
833E82FA2A28595A00CD0580 /* bitstream_lsb.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E82F92A28595A00CD0580 /* bitstream_lsb.h */; };
8342469420C4D23000926E48 /* h4m.c in Sources */ = {isa = PBXBuildFile; fileRef = 8342469020C4D22F00926E48 /* h4m.c */; };
8342469620C4D23D00926E48 /* blocked_h4m.c in Sources */ = {isa = PBXBuildFile; fileRef = 8342469520C4D23D00926E48 /* blocked_h4m.c */; };
8346D97925BF838C00D1A8B0 /* idtech.c in Sources */ = {isa = PBXBuildFile; fileRef = 8346D97425BF838C00D1A8B0 /* idtech.c */; };
@ -193,8 +220,6 @@
8346D98525BF83B300D1A8B0 /* compresswave_decoder_lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 8346D98025BF83B300D1A8B0 /* compresswave_decoder_lib.c */; };
8346D98625BF83B300D1A8B0 /* compresswave_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8346D98125BF83B300D1A8B0 /* compresswave_decoder.c */; };
8346D98725BF83B300D1A8B0 /* compresswave_decoder_lib.h in Headers */ = {isa = PBXBuildFile; fileRef = 8346D98225BF83B300D1A8B0 /* compresswave_decoder_lib.h */; };
8347C7482796D76700FA8A7D /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 8347C7432796D76700FA8A7D /* info.c */; };
8347C7492796D76700FA8A7D /* seek.c in Sources */ = {isa = PBXBuildFile; fileRef = 8347C7472796D76700FA8A7D /* seek.c */; };
8349A8DF1FE6251F00E26435 /* vorbis_custom_utils_vid1.c in Sources */ = {isa = PBXBuildFile; fileRef = 8349A8DC1FE6251E00E26435 /* vorbis_custom_utils_vid1.c */; };
8349A8E11FE6251F00E26435 /* ea_mt_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8349A8DE1FE6251F00E26435 /* ea_mt_decoder.c */; };
8349A8E81FE6253900E26435 /* blocked_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8349A8E21FE6253800E26435 /* blocked_dec.c */; };
@ -629,7 +654,6 @@
83AA7D18279EBD0900087AA4 /* libavformat.59.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 83AA7D14279EBCF900087AA4 /* libavformat.59.dylib */; };
83AA7D19279EBD0B00087AA4 /* libavutil.57.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 83AA7D16279EBCF900087AA4 /* libavutil.57.dylib */; };
83AA7D1A279EBD0D00087AA4 /* libswresample.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 83AA7D15279EBCF900087AA4 /* libswresample.4.dylib */; };
83AA7F722519BFEA004C5298 /* vorbis_bitreader.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AA7F6D2519BFEA004C5298 /* vorbis_bitreader.h */; };
83AA7F7D2519C042004C5298 /* dsb.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F742519C041004C5298 /* dsb.c */; };
83AA7F7E2519C042004C5298 /* svag_kcet.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F752519C041004C5298 /* svag_kcet.c */; };
83AA7F7F2519C042004C5298 /* bsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F762519C042004C5298 /* bsf.c */; };
@ -639,10 +663,6 @@
83AA7F832519C042004C5298 /* adp_konami.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F7A2519C042004C5298 /* adp_konami.c */; };
83AA7F842519C042004C5298 /* svag_snk.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F7B2519C042004C5298 /* svag_snk.c */; };
83AA7F852519C042004C5298 /* zwv.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F7C2519C042004C5298 /* zwv.c */; };
83AA7F8A2519C076004C5298 /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AA7F862519C076004C5298 /* decode.h */; };
83AA7F8B2519C076004C5298 /* render.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AA7F872519C076004C5298 /* render.h */; };
83AA7F8C2519C076004C5298 /* render.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F882519C076004C5298 /* render.c */; };
83AA7F8D2519C076004C5298 /* decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AA7F892519C076004C5298 /* decode.c */; };
83AB8C761E8072A100086084 /* astb.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AB8C741E8072A100086084 /* astb.c */; };
83AF2CC926226BA500538240 /* gcub.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AF2CC526226BA400538240 /* gcub.c */; };
83AF2CCA26226BA500538240 /* exst.c in Sources */ = {isa = PBXBuildFile; fileRef = 83AF2CC626226BA400538240 /* exst.c */; };
@ -675,10 +695,6 @@
83C7282022BC893D00678B4A /* dcs_wav.c in Sources */ = {isa = PBXBuildFile; fileRef = 83C7280C22BC893D00678B4A /* dcs_wav.c */; };
83C7282122BC893D00678B4A /* msf_konami.c in Sources */ = {isa = PBXBuildFile; fileRef = 83C7280D22BC893D00678B4A /* msf_konami.c */; };
83C7282222BC893D00678B4A /* mta2_streamfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C7280E22BC893D00678B4A /* mta2_streamfile.h */; };
83C7282722BC8C1500678B4A /* plugins.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C7282322BC8C1300678B4A /* plugins.h */; settings = {ATTRIBUTES = (Public, ); }; };
83C7282822BC8C1500678B4A /* mixing.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C7282422BC8C1400678B4A /* mixing.h */; };
83C7282922BC8C1500678B4A /* mixing.c in Sources */ = {isa = PBXBuildFile; fileRef = 83C7282522BC8C1400678B4A /* mixing.c */; };
83C7282A22BC8C1500678B4A /* plugins.c in Sources */ = {isa = PBXBuildFile; fileRef = 83C7282622BC8C1400678B4A /* plugins.c */; };
83D0381824A4129A004CF90F /* swav.c in Sources */ = {isa = PBXBuildFile; fileRef = 83D0381724A4129A004CF90F /* swav.c */; };
83D1189328B2F33400AF3370 /* vab.c in Sources */ = {isa = PBXBuildFile; fileRef = 83D1189228B2F33400AF3370 /* vab.c */; };
83D2007A248DDB770048BD24 /* fsb_encrypted_streamfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D20072248DDB760048BD24 /* fsb_encrypted_streamfile.h */; };
@ -1007,6 +1023,33 @@
8339B324280FDF4B0076F74B /* text_reader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = text_reader.c; sourceTree = "<group>"; };
8339B325280FDF4B0076F74B /* text_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = text_reader.h; sourceTree = "<group>"; };
833A7A2D1ED11961003EC53E /* xau.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xau.c; sourceTree = "<group>"; };
833E82C52A28562E00CD0580 /* info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = info.c; sourceTree = "<group>"; };
833E82C72A28566700CD0580 /* channel_mappings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = channel_mappings.h; sourceTree = "<group>"; };
833E82C92A2856B200CD0580 /* reader_get_nibbles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reader_get_nibbles.h; sourceTree = "<group>"; };
833E82CA2A2856B200CD0580 /* reader_get.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reader_get.h; sourceTree = "<group>"; };
833E82CB2A2856B200CD0580 /* reader_put.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reader_put.h; sourceTree = "<group>"; };
833E82CC2A2856B200CD0580 /* reader_put.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = reader_put.c; sourceTree = "<group>"; };
833E82CD2A2856B200CD0580 /* samples_ops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = samples_ops.c; sourceTree = "<group>"; };
833E82CE2A2856B200CD0580 /* samples_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = samples_ops.h; sourceTree = "<group>"; };
833E82D52A2856E500CD0580 /* vgmstream_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vgmstream_types.h; sourceTree = "<group>"; };
833E82D72A28572100CD0580 /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api.h; sourceTree = "<group>"; };
833E82D92A2857F700CD0580 /* decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = decode.c; sourceTree = "<group>"; };
833E82DA2A2857F700CD0580 /* render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = render.c; sourceTree = "<group>"; };
833E82DB2A2857F700CD0580 /* seek.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = seek.c; sourceTree = "<group>"; };
833E82DC2A2857F700CD0580 /* decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = decode.h; sourceTree = "<group>"; };
833E82DD2A2857F700CD0580 /* mixing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mixing.h; sourceTree = "<group>"; };
833E82DE2A2857F700CD0580 /* plugins.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = plugins.c; sourceTree = "<group>"; };
833E82DF2A2857F700CD0580 /* plugins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = plugins.h; sourceTree = "<group>"; };
833E82E02A2857F700CD0580 /* mixing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mixing.c; sourceTree = "<group>"; };
833E82E12A2857F700CD0580 /* render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = render.h; sourceTree = "<group>"; };
833E82EB2A28587D00CD0580 /* companion_files.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = companion_files.c; sourceTree = "<group>"; };
833E82EC2A28587D00CD0580 /* paths.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = paths.c; sourceTree = "<group>"; };
833E82ED2A28587D00CD0580 /* paths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = paths.h; sourceTree = "<group>"; };
833E82EE2A28587D00CD0580 /* reader_sf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reader_sf.h; sourceTree = "<group>"; };
833E82EF2A28587D00CD0580 /* companion_files.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = companion_files.h; sourceTree = "<group>"; };
833E82F52A2858EF00CD0580 /* reader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = reader.c; sourceTree = "<group>"; };
833E82F62A2858EF00CD0580 /* reader_text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reader_text.h; sourceTree = "<group>"; };
833E82F92A28595A00CD0580 /* bitstream_lsb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitstream_lsb.h; sourceTree = "<group>"; };
8342469020C4D22F00926E48 /* h4m.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = h4m.c; sourceTree = "<group>"; };
8342469520C4D23D00926E48 /* blocked_h4m.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = blocked_h4m.c; sourceTree = "<group>"; };
8346D97425BF838C00D1A8B0 /* idtech.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = idtech.c; sourceTree = "<group>"; };
@ -1019,8 +1062,6 @@
8346D98025BF83B300D1A8B0 /* compresswave_decoder_lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compresswave_decoder_lib.c; sourceTree = "<group>"; };
8346D98125BF83B300D1A8B0 /* compresswave_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compresswave_decoder.c; sourceTree = "<group>"; };
8346D98225BF83B300D1A8B0 /* compresswave_decoder_lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compresswave_decoder_lib.h; sourceTree = "<group>"; };
8347C7432796D76700FA8A7D /* info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = info.c; sourceTree = "<group>"; };
8347C7472796D76700FA8A7D /* seek.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = seek.c; sourceTree = "<group>"; };
8349A8DC1FE6251E00E26435 /* vorbis_custom_utils_vid1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vorbis_custom_utils_vid1.c; sourceTree = "<group>"; };
8349A8DE1FE6251F00E26435 /* ea_mt_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ea_mt_decoder.c; sourceTree = "<group>"; };
8349A8E21FE6253800E26435 /* blocked_dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = blocked_dec.c; sourceTree = "<group>"; };
@ -1457,7 +1498,6 @@
83AA7D14279EBCF900087AA4 /* libavformat.59.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.59.dylib; path = ../../ThirdParty/ffmpeg/lib/libavformat.59.dylib; sourceTree = "<group>"; };
83AA7D15279EBCF900087AA4 /* libswresample.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libswresample.4.dylib; path = ../../ThirdParty/ffmpeg/lib/libswresample.4.dylib; sourceTree = "<group>"; };
83AA7D16279EBCF900087AA4 /* libavutil.57.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.57.dylib; path = ../../ThirdParty/ffmpeg/lib/libavutil.57.dylib; sourceTree = "<group>"; };
83AA7F6D2519BFEA004C5298 /* vorbis_bitreader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vorbis_bitreader.h; sourceTree = "<group>"; };
83AA7F742519C041004C5298 /* dsb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dsb.c; sourceTree = "<group>"; };
83AA7F752519C041004C5298 /* svag_kcet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svag_kcet.c; sourceTree = "<group>"; };
83AA7F762519C042004C5298 /* bsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bsf.c; sourceTree = "<group>"; };
@ -1467,10 +1507,6 @@
83AA7F7A2519C042004C5298 /* adp_konami.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = adp_konami.c; sourceTree = "<group>"; };
83AA7F7B2519C042004C5298 /* svag_snk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svag_snk.c; sourceTree = "<group>"; };
83AA7F7C2519C042004C5298 /* zwv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zwv.c; sourceTree = "<group>"; };
83AA7F862519C076004C5298 /* decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = decode.h; sourceTree = "<group>"; };
83AA7F872519C076004C5298 /* render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = render.h; sourceTree = "<group>"; };
83AA7F882519C076004C5298 /* render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = render.c; sourceTree = "<group>"; };
83AA7F892519C076004C5298 /* decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = decode.c; sourceTree = "<group>"; };
83AB8C741E8072A100086084 /* astb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = astb.c; sourceTree = "<group>"; };
83AF2CC526226BA400538240 /* gcub.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gcub.c; sourceTree = "<group>"; };
83AF2CC626226BA400538240 /* exst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exst.c; sourceTree = "<group>"; };
@ -1503,10 +1539,6 @@
83C7280C22BC893D00678B4A /* dcs_wav.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dcs_wav.c; sourceTree = "<group>"; };
83C7280D22BC893D00678B4A /* msf_konami.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msf_konami.c; sourceTree = "<group>"; };
83C7280E22BC893D00678B4A /* mta2_streamfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mta2_streamfile.h; sourceTree = "<group>"; };
83C7282322BC8C1300678B4A /* plugins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = plugins.h; sourceTree = "<group>"; };
83C7282422BC8C1400678B4A /* mixing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mixing.h; sourceTree = "<group>"; };
83C7282522BC8C1400678B4A /* mixing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mixing.c; sourceTree = "<group>"; };
83C7282622BC8C1400678B4A /* plugins.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = plugins.c; sourceTree = "<group>"; };
83D0381724A4129A004CF90F /* swav.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = swav.c; sourceTree = "<group>"; };
83D1189228B2F33400AF3370 /* vab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vab.c; sourceTree = "<group>"; };
83D20072248DDB760048BD24 /* fsb_encrypted_streamfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fsb_encrypted_streamfile.h; sourceTree = "<group>"; };
@ -1668,6 +1700,23 @@
path = mpg123;
sourceTree = "<group>";
};
833E82C42A28562E00CD0580 /* base */ = {
isa = PBXGroup;
children = (
833E82D92A2857F700CD0580 /* decode.c */,
833E82DC2A2857F700CD0580 /* decode.h */,
833E82E02A2857F700CD0580 /* mixing.c */,
833E82DD2A2857F700CD0580 /* mixing.h */,
833E82DE2A2857F700CD0580 /* plugins.c */,
833E82DF2A2857F700CD0580 /* plugins.h */,
833E82DA2A2857F700CD0580 /* render.c */,
833E82E12A2857F700CD0580 /* render.h */,
833E82DB2A2857F700CD0580 /* seek.c */,
833E82C52A28562E00CD0580 /* info.c */,
);
path = base;
sourceTree = "<group>";
};
835FC6C223F62AEE006960FA /* Products */ = {
isa = PBXGroup;
children = (
@ -1755,26 +1804,19 @@
836F6DDE18BDC2180095E648 /* src */ = {
isa = PBXGroup;
children = (
833E82D72A28572100CD0580 /* api.h */,
833E82C42A28562E00CD0580 /* base */,
836F6DDF18BDC2180095E648 /* coding */,
83A3F0711E3AD8B900D6A794 /* formats.c */,
836F6DFF18BDC2180095E648 /* layout */,
836F6E2718BDC2180095E648 /* meta */,
83D26A7C26E66DC2001A9475 /* util */,
83AA7F892519C076004C5298 /* decode.c */,
83AA7F862519C076004C5298 /* decode.h */,
83A3F0711E3AD8B900D6A794 /* formats.c */,
8347C7432796D76700FA8A7D /* info.c */,
83C7282522BC8C1400678B4A /* mixing.c */,
83C7282422BC8C1400678B4A /* mixing.h */,
83C7282622BC8C1400678B4A /* plugins.c */,
83C7282322BC8C1300678B4A /* plugins.h */,
83AA7F882519C076004C5298 /* render.c */,
83AA7F872519C076004C5298 /* render.h */,
8347C7472796D76700FA8A7D /* seek.c */,
836F6F1718BDC2190095E648 /* streamfile.c */,
836F6F1818BDC2190095E648 /* streamfile.h */,
836F6F1918BDC2190095E648 /* streamtypes.h */,
83D26A7C26E66DC2001A9475 /* util */,
836F6F1A18BDC2190095E648 /* util.c */,
836F6F1B18BDC2190095E648 /* util.h */,
833E82D52A2856E500CD0580 /* vgmstream_types.h */,
836F6F1C18BDC2190095E648 /* vgmstream.c */,
836F6F1D18BDC2190095E648 /* vgmstream.h */,
);
@ -1873,7 +1915,6 @@
8373341023F60C7A00DE14DC /* tgcadpcm_decoder.c */,
837CEA7623487E2400E62A4A /* ubi_adpcm_decoder.c */,
83F1EE2C245D4FB20076E182 /* vadpcm_decoder.c */,
83AA7F6D2519BFEA004C5298 /* vorbis_bitreader.h */,
839E21D61F2EDAF000EE54D7 /* vorbis_custom_data_fsb.h */,
839E21DC1F2EDAF000EE54D7 /* vorbis_custom_data_wwise.h */,
839E21D71F2EDAF000EE54D7 /* vorbis_custom_decoder.c */,
@ -2434,9 +2475,13 @@
83D26A7C26E66DC2001A9475 /* util */ = {
isa = PBXGroup;
children = (
833E82F92A28595A00CD0580 /* bitstream_lsb.h */,
836DF620298F83F400CD0580 /* bitstream_msb.h */,
833E82C72A28566700CD0580 /* channel_mappings.h */,
83D26A8026E66DC2001A9475 /* chunks.c */,
83D26A7E26E66DC2001A9475 /* chunks.h */,
833E82EB2A28587D00CD0580 /* companion_files.c */,
833E82EF2A28587D00CD0580 /* companion_files.h */,
836DF621298F83F400CD0580 /* cri_keys.c */,
836DF61F298F83F400CD0580 /* cri_keys.h */,
836F46B5282087A6005B9B87 /* cri_utf.c */,
@ -2448,6 +2493,17 @@
8315868926F586F900803A3A /* m2_psb.h */,
8319017A28F67EE100B70711 /* miniz.c */,
8319017928F67EE000B70711 /* miniz.h */,
833E82EC2A28587D00CD0580 /* paths.c */,
833E82ED2A28587D00CD0580 /* paths.h */,
833E82C92A2856B200CD0580 /* reader_get_nibbles.h */,
833E82CA2A2856B200CD0580 /* reader_get.h */,
833E82CC2A2856B200CD0580 /* reader_put.c */,
833E82CB2A2856B200CD0580 /* reader_put.h */,
833E82EE2A28587D00CD0580 /* reader_sf.h */,
833E82F62A2858EF00CD0580 /* reader_text.h */,
833E82F52A2858EF00CD0580 /* reader.c */,
833E82CD2A2856B200CD0580 /* samples_ops.c */,
833E82CE2A2856B200CD0580 /* samples_ops.h */,
8339B324280FDF4B0076F74B /* text_reader.c */,
8339B325280FDF4B0076F74B /* text_reader.h */,
);
@ -2487,10 +2543,16 @@
files = (
83D26A8226E66DC2001A9475 /* chunks.h in Headers */,
836F705518BDC2190095E648 /* streamtypes.h in Headers */,
833E82CF2A2856B200CD0580 /* reader_get_nibbles.h in Headers */,
836F6F3518BDC2190095E648 /* nwa_decoder.h in Headers */,
833E82D12A2856B200CD0580 /* reader_put.h in Headers */,
833E82E82A2857F700CD0580 /* plugins.h in Headers */,
83256CC328666C620036D9C0 /* reader.h in Headers */,
83256CCA28666C620036D9C0 /* synths.h in Headers */,
833E82D82A28572100CD0580 /* api.h in Headers */,
83031EC9243C50A800C3F3E0 /* circus_decoder_lzxpcm.h in Headers */,
833E82D62A2856E500CD0580 /* vgmstream_types.h in Headers */,
833E82D02A2856B200CD0580 /* reader_get.h in Headers */,
8346D97A25BF838C00D1A8B0 /* idtech_streamfile.h in Headers */,
8346D98425BF83B300D1A8B0 /* coding_utils_samples.h in Headers */,
83256CE228666C620036D9C0 /* init_costabs.h in Headers */,
@ -2513,24 +2575,23 @@
8349A90F1FE6258200E26435 /* aix_streamfile.h in Headers */,
83B46FD52707FB9A00847FC9 /* endianness.h in Headers */,
836F705718BDC2190095E648 /* util.h in Headers */,
83C7282722BC8C1500678B4A /* plugins.h in Headers */,
83256CC128666C620036D9C0 /* index.h in Headers */,
834FE0ED215C79ED000A5D3D /* fsb_interleave_streamfile.h in Headers */,
836DF622298F83F400CD0580 /* cri_keys.h in Headers */,
8351F32E2212B57000A606E4 /* ubi_bao_streamfile.h in Headers */,
833E82F22A28587D00CD0580 /* paths.h in Headers */,
8349A9111FE6258200E26435 /* bar_streamfile.h in Headers */,
83256CE128666C620036D9C0 /* sample.h in Headers */,
83D2007A248DDB770048BD24 /* fsb_encrypted_streamfile.h in Headers */,
833E82E52A2857F700CD0580 /* decode.h in Headers */,
836F6F2718BDC2190095E648 /* g72x_state.h in Headers */,
83256CE628666C620036D9C0 /* id3.h in Headers */,
83C7282822BC8C1500678B4A /* mixing.h in Headers */,
832BF82C21E0514B006F50F1 /* hca_keys_awb.h in Headers */,
839933602591E8C1001855AF /* ubi_sb_garbage_streamfile.h in Headers */,
83256CDE28666C620036D9C0 /* dither_impl.h in Headers */,
8306B0E020984590000302D4 /* ppst_streamfile.h in Headers */,
83256CC228666C620036D9C0 /* synth_ntom.h in Headers */,
83256CCD28666C620036D9C0 /* frame.h in Headers */,
83AA7F722519BFEA004C5298 /* vorbis_bitreader.h in Headers */,
83256CD628666C620036D9C0 /* newhuffman.h in Headers */,
834FE0BA215C798C000A5D3D /* ea_mt_decoder_utk.h in Headers */,
835C883722CC17BE001B4B3F /* ogg_vorbis_streamfile.h in Headers */,
@ -2538,9 +2599,11 @@
832BF82021E0514B006F50F1 /* zsnd_streamfile.h in Headers */,
8375737721F950ED00F01AF5 /* ubi_sb_streamfile.h in Headers */,
839E21E01F2EDAF100EE54D7 /* vorbis_custom_data_fsb.h in Headers */,
833E82F42A28587D00CD0580 /* companion_files.h in Headers */,
83031EDB243C510500C3F3E0 /* xnb_lz4mg.h in Headers */,
836F705418BDC2190095E648 /* streamfile.h in Headers */,
835B9B922730BF2D00F87EE3 /* hca_bf.h in Headers */,
833E82E62A2857F700CD0580 /* mixing.h in Headers */,
836DF623298F83F400CD0580 /* bitstream_msb.h in Headers */,
83256CDD28666C620036D9C0 /* l3tabs.h in Headers */,
8373342723F60CDC00DE14DC /* lrmd_streamfile.h in Headers */,
@ -2556,7 +2619,9 @@
83C7281622BC893D00678B4A /* xwma_konami_streamfile.h in Headers */,
839E21E81F2EDAF100EE54D7 /* mpeg_decoder.h in Headers */,
839E21E51F2EDAF100EE54D7 /* vorbis_custom_decoder.h in Headers */,
833E82C82A28566700CD0580 /* channel_mappings.h in Headers */,
83256CC028666C620036D9C0 /* synth_8bit.h in Headers */,
833E82F32A28587D00CD0580 /* reader_sf.h in Headers */,
837CEADB23487E8300E62A4A /* bgw_streamfile.h in Headers */,
837CEB0323487F2C00E62A4A /* xavs_streamfile.h in Headers */,
836F705918BDC2190095E648 /* vgmstream.h in Headers */,
@ -2567,29 +2632,30 @@
834FE0B5215C798C000A5D3D /* acm_decoder_libacm.h in Headers */,
83256CE528666C620036D9C0 /* true.h in Headers */,
839E21E61F2EDAF100EE54D7 /* vorbis_custom_data_wwise.h in Headers */,
83AA7F8A2519C076004C5298 /* decode.h in Headers */,
8346D98725BF83B300D1A8B0 /* compresswave_decoder_lib.h in Headers */,
83256CDB28666C620036D9C0 /* swap_bytes_impl.h in Headers */,
8373342D23F60CDC00DE14DC /* bnsf_keys.h in Headers */,
834FE103215C79ED000A5D3D /* ea_schl_streamfile.h in Headers */,
83256CC528666C620036D9C0 /* mpg123.h in Headers */,
833E82F82A2858EF00CD0580 /* reader_text.h in Headers */,
83F0AA6021E2028C004BBC04 /* vsv_streamfile.h in Headers */,
8396BE7B2935FC2F00CD0580 /* sscf_encrypted.h in Headers */,
83FBD506235D31F800D35BCD /* riff_ogg_streamfile.h in Headers */,
8339B327280FDF4B0076F74B /* text_reader.h in Headers */,
836F6F9A18BDC2190095E648 /* meta.h in Headers */,
8319017B28F67EE100B70711 /* miniz.h in Headers */,
833E82FA2A28595A00CD0580 /* bitstream_lsb.h in Headers */,
83A8BAE625667AA8000F5F3F /* ps2_enth_streamfile.h in Headers */,
83256CE428666C620036D9C0 /* abi_align.h in Headers */,
8306B0D820984590000302D4 /* ea_eaac_streamfile.h in Headers */,
837CEB0523487F2C00E62A4A /* sqex_streamfile.h in Headers */,
833E82EA2A2857F700CD0580 /* render.h in Headers */,
83031ED9243C510500C3F3E0 /* ubi_lyn_streamfile.h in Headers */,
8373341D23F60C7B00DE14DC /* g7221_decoder_lib.h in Headers */,
8306B0E820984590000302D4 /* opus_interleave_streamfile.h in Headers */,
839FBFF626C354CE0016A78A /* relic_decoder_lib.h in Headers */,
83031EDD243C510500C3F3E0 /* xnb_streamfile.h in Headers */,
83D2007B248DDB770048BD24 /* mups_streamfile.h in Headers */,
83AA7F8B2519C076004C5298 /* render.h in Headers */,
83FC417026D32FF5009A2022 /* hca_decoder_clhca.h in Headers */,
8373341623F60C7B00DE14DC /* g7221_decoder_aes.h in Headers */,
8373341923F60C7B00DE14DC /* g7221_decoder_lib_data.h in Headers */,
@ -2618,6 +2684,7 @@
83256CC828666C620036D9C0 /* getbits.h in Headers */,
83256CC728666C620036D9C0 /* optimize.h in Headers */,
83031ED3243C50DF00C3F3E0 /* fsb5_streamfile.h in Headers */,
833E82D42A2856B200CD0580 /* samples_ops.h in Headers */,
83256CE328666C620036D9C0 /* decode.h in Headers */,
836F6F2318BDC2190095E648 /* coding.h in Headers */,
);
@ -2898,6 +2965,7 @@
836F6F8718BDC2190095E648 /* ffw.c in Sources */,
8349A9141FE6258200E26435 /* omu.c in Sources */,
836F6FE418BDC2190095E648 /* ps2_leg.c in Sources */,
833E82E32A2857F700CD0580 /* render.c in Sources */,
836F705618BDC2190095E648 /* util.c in Sources */,
8306B0A820984552000302D4 /* blocked_ps2_iab.c in Sources */,
8306B0EA20984590000302D4 /* caf.c in Sources */,
@ -2907,6 +2975,7 @@
836F6F7818BDC2190095E648 /* cstr.c in Sources */,
83FC417126D32FF5009A2022 /* hca_decoder_clhca.c in Sources */,
83F1EE30245D4FC10076E182 /* imuse.c in Sources */,
833E82F02A28587D00CD0580 /* companion_files.c in Sources */,
8346D98625BF83B300D1A8B0 /* compresswave_decoder.c in Sources */,
836F6F1E18BDC2190095E648 /* acm_decoder.c in Sources */,
836F6FD818BDC2190095E648 /* ps2_gbts.c in Sources */,
@ -2934,6 +3003,7 @@
83A21F85201D8981000F04B9 /* atx.c in Sources */,
83A8BADF256679E3000F5F3F /* blocked_xwav.c in Sources */,
836F6F6518BDC2190095E648 /* 2dx9.c in Sources */,
833E82C62A28562E00CD0580 /* info.c in Sources */,
830EBE102004655D0023AA10 /* atrac9_decoder.c in Sources */,
836F700818BDC2190095E648 /* ps2_vms.c in Sources */,
8319018428F67F2B00B70711 /* bigrp.c in Sources */,
@ -3025,7 +3095,6 @@
836F702C18BDC2190095E648 /* seg.c in Sources */,
836F700918BDC2190095E648 /* ps2_voi.c in Sources */,
836F6FE018BDC2190095E648 /* ps2_joe.c in Sources */,
83C7282A22BC8C1500678B4A /* plugins.c in Sources */,
832BF82721E0514B006F50F1 /* xa.c in Sources */,
837CEAD823487E8300E62A4A /* bmp_konami.c in Sources */,
8306B0A220984552000302D4 /* blocked_bdsp.c in Sources */,
@ -3041,7 +3110,6 @@
836F705218BDC2190095E648 /* zwdsp.c in Sources */,
836F6FFB18BDC2190095E648 /* ps2_sps.c in Sources */,
836F6F2018BDC2190095E648 /* adx_decoder.c in Sources */,
83AA7F8D2519C076004C5298 /* decode.c in Sources */,
834FE0EA215C79ED000A5D3D /* aif_asobo.c in Sources */,
836F700418BDC2190095E648 /* ps2_vas.c in Sources */,
836F6F9818BDC2190095E648 /* mattel_hyperscan.c in Sources */,
@ -3058,7 +3126,6 @@
834FE0BB215C798C000A5D3D /* celt_fsb_decoder.c in Sources */,
836F702518BDC2190095E648 /* rwx.c in Sources */,
836F6F3A18BDC2190095E648 /* sdx2_decoder.c in Sources */,
8347C7482796D76700FA8A7D /* info.c in Sources */,
836F6FAF18BDC2190095E648 /* ngc_dsp_std.c in Sources */,
836F6F7118BDC2190095E648 /* ast.c in Sources */,
834FE0BF215C79A9000A5D3D /* flat.c in Sources */,
@ -3097,7 +3164,6 @@
837CEAFF23487F2C00E62A4A /* raw_snds.c in Sources */,
83031EDC243C510500C3F3E0 /* vid1.c in Sources */,
836F700218BDC2190095E648 /* ps2_tk5.c in Sources */,
83AA7F8C2519C076004C5298 /* render.c in Sources */,
83AA5D271F6E2F9C0020821C /* stm.c in Sources */,
831BA61D1EAC61A500CF89B0 /* ubi_raki.c in Sources */,
8306B0A520984552000302D4 /* blocked_ea_wve_au00.c in Sources */,
@ -3142,6 +3208,7 @@
836F6F8018BDC2190095E648 /* dsp_bdsp.c in Sources */,
836F6F9618BDC2190095E648 /* lsf.c in Sources */,
8306B0AB20984552000302D4 /* layered.c in Sources */,
833E82E92A2857F700CD0580 /* mixing.c in Sources */,
8306B0EC20984590000302D4 /* pcm_sre.c in Sources */,
836F6FC818BDC2190095E648 /* pos.c in Sources */,
836F6F8918BDC2190095E648 /* gca.c in Sources */,
@ -3161,6 +3228,7 @@
836F703318BDC2190095E648 /* str_snds.c in Sources */,
832BF82221E0514B006F50F1 /* vs_str.c in Sources */,
8349A9191FE6258200E26435 /* afc.c in Sources */,
833E82E72A2857F700CD0580 /* plugins.c in Sources */,
836F703718BDC2190095E648 /* alp.c in Sources */,
83031ECD243C50CC00C3F3E0 /* blocked_vid1.c in Sources */,
836F700B18BDC2190095E648 /* ps2_wad.c in Sources */,
@ -3192,6 +3260,7 @@
8385D4E6245174C700FF8E67 /* diva.c in Sources */,
836F6FF418BDC2190095E648 /* rws.c in Sources */,
834FE100215C79ED000A5D3D /* svg.c in Sources */,
833E82D22A2856B200CD0580 /* reader_put.c in Sources */,
836F6F2518BDC2190095E648 /* g721_decoder.c in Sources */,
836F6FE818BDC2190095E648 /* ps2_mic.c in Sources */,
836F46B22820874D005B9B87 /* tt_ad.c in Sources */,
@ -3215,7 +3284,6 @@
836F6FB118BDC2190095E648 /* ngc_ffcc_str.c in Sources */,
8306B0B620984552000302D4 /* blocked_hwas.c in Sources */,
836F6FC218BDC2190095E648 /* pc_mxst.c in Sources */,
83C7282922BC8C1500678B4A /* mixing.c in Sources */,
8375737621F950ED00F01AF5 /* gin.c in Sources */,
836F6FC918BDC2190095E648 /* ps2_2pfs.c in Sources */,
83AFABBC23795202002F3947 /* xssb.c in Sources */,
@ -3237,6 +3305,7 @@
83AA5D1D1F6E2F800020821C /* blocked_vgs.c in Sources */,
836F702E18BDC2190095E648 /* sli.c in Sources */,
8339B323280FDF250076F74B /* sspf.c in Sources */,
833E82D32A2856B200CD0580 /* samples_ops.c in Sources */,
83AA7F822519C042004C5298 /* ktsc.c in Sources */,
836F6FDE18BDC2190095E648 /* ps2_ild.c in Sources */,
836F703E18BDC2190095E648 /* wii_ras.c in Sources */,
@ -3258,6 +3327,7 @@
836F6FA918BDC2190095E648 /* ngc_adpdtk.c in Sources */,
836F6FDC18BDC2190095E648 /* ps2_iab.c in Sources */,
83C7282122BC893D00678B4A /* msf_konami.c in Sources */,
833E82F72A2858EF00CD0580 /* reader.c in Sources */,
83B69B222845A26600D2435A /* bw_mp3_riff.c in Sources */,
8315958920FEC83F007002F0 /* asf.c in Sources */,
83C7281222BC893D00678B4A /* 9tav.c in Sources */,
@ -3268,9 +3338,11 @@
836F6FA218BDC2190095E648 /* naomi_adpcm.c in Sources */,
837CEAF123487F2C00E62A4A /* xvas.c in Sources */,
836F6FBF18BDC2190095E648 /* otm.c in Sources */,
833E82E42A2857F700CD0580 /* seek.c in Sources */,
834FE0B8215C798C000A5D3D /* acm_decoder_decode.c in Sources */,
8399335F2591E8C1001855AF /* ifs.c in Sources */,
8373342A23F60CDC00DE14DC /* lrmd.c in Sources */,
833E82E22A2857F700CD0580 /* decode.c in Sources */,
836F6FBD18BDC2190095E648 /* nwa.c in Sources */,
837CEAFC23487F2C00E62A4A /* raw_wavm.c in Sources */,
834FE0F7215C79ED000A5D3D /* vis.c in Sources */,
@ -3291,10 +3363,10 @@
836F6F3418BDC2190095E648 /* nwa_decoder.c in Sources */,
836F6F2E18BDC2190095E648 /* msadpcm_decoder.c in Sources */,
836F6F9218BDC2190095E648 /* ish_isd.c in Sources */,
833E82F12A28587D00CD0580 /* paths.c in Sources */,
836F6F2A18BDC2190095E648 /* lsf_decoder.c in Sources */,
8349A9151FE6258200E26435 /* ps2_xa2_rrp.c in Sources */,
836F703518BDC2190095E648 /* svs.c in Sources */,
8347C7492796D76700FA8A7D /* seek.c in Sources */,
836F6FA318BDC2190095E648 /* spsd.c in Sources */,
8306B0B920984552000302D4 /* blocked_matx.c in Sources */,
83A21F7B201D895B000F04B9 /* blocked_xvag.c in Sources */,

View File

@ -0,0 +1,136 @@
#ifndef _API_H_
#define _API_H_
#ifdef BUILD_VGMSTREAM
#include "base/plugins.h"
#else
#include <libvgmstream/plugins.h>
#endif
//possible future public/opaque API
#if 0
#include <stdint.h>
#include "api_streamfile.h"
/* Current API version (major=breaking API/ABI changes, minor=compatible ABI changes).
* Internal bug fixes or added formats don't change these (see commit revision).
* Regular vgmstream features or formats are stable and are rarely removed, while this API may change from time to time */
#define LIBVGMSTREAM_API_VERSION_MAJOR 0
#define LIBVGMSTREAM_API_VERSION_MINOR 0
/* define standard C param call and name mangling (to avoid __stdcall / .defs) */
//#define LIBVGMSTREAM_CALL __cdecl //needed?
/* define external function types (during compilation) */
//LIBVGMSTREAM_API void LIBVGMSTREAM_CALL vgmstream_function(void);
#if defined(LIBVGMSTREAM_EXPORT)
#define LIBVGMSTREAM_API __declspec(dllexport) /* when exporting/creating vgmstream DLL */
#elif defined(LIBVGMSTREAM_IMPORT)
#define LIBVGMSTREAM_API __declspec(dllimport) /* when importing/linking vgmstream DLL */
#else
#define LIBVGMSTREAM_API /* nothing, internal/default */
#endif
/* opaque vgmstream context/handle */
typedef struct libvgmstream_t libvgmstream_t;
/* init base vgmstream context */
libvgmstream_t* libvgmstream_init(void);
typedef struct {
int downmix_max_channels; // max number of channels
//int upmix_min_channels; // adds channels until min
} libvgmstream_config_t;
/* pass default config, that will be applied to song on open (some formats like TXTP may override
* these settings).
* May only be called without song loaded (before _open or after _close), otherwise ignored. */
void libvgmstream_setup(libvgmstream_t* vctx, libvgmstream_config_t* vcfg);
//void libvgmstream_buffer(libvgmstream_t* vctx, int samples, int max_samples);
/* Opens a new STREAMFILE to play. Returns < 0 on error when the file isn't recogniced.
* If file has subsongs, first open usually loads first subsong. get_info then can be used to check
* whether file has more subsongs (total_subsongs > 1), and call others.
* */
int libvgmstream_open(libvgmstream_t* vctx, STREAMFILE* sf);
int libvgmstream_open_subsong(libvgmstream_t* vctx, STREAMFILE* sf, int subsong);
typedef struct {
const int channels;
const int sample_rate;
const int sample_count; /* file's samples (not final duration) */
const int loop_start_sample;
const int loop_end_sample;
const int loop_flag;
const int current_subsong; /* 0=not set, N=loaded subsong N */
const int total_subsongs; /* 0=format has no subsongs, N=has N subsongs */
const int file_bitrate; /* file's average bitrate */
//const int codec_bitrate; /* codec's average bitrate */
/* descriptions */
//const char* codec;
//const char* layout;
//const char* metadata;
//int type; /* 0=pcm16, 1=float32, always interleaved: [0]=ch0, [1]=ch1 ... */
} libvgmstream_into_t;
/* Get info from current song. */
void libvgmstream_t_get_info(libvgmstream_t* vctx, libvgmstream_into_t* vinfo);
libvgmstream_sbuf_t* libgstream_get_sbuf(libvgmstream_t* vctx);
/* Converts samples. returns number of rendered samples, or <=0 if no more
* samples left (will fill buffer with silence) */
int libvgmstream_play(libvgmstream_t* vctx);
/* Gets final time based on config and current song. If config is set to "play forever"
* this still returns final time based on config as a reference. Returns > 0 on success. */
int32_t libvgmstream_get_total_time(libvgmstream_t* vctx);
double libvgmstream_get_total_samples(libvgmstream_t* vctx);
/* Gets current position within song. When "play forever" is set, it'll clamp results to total_time. */
int32_t libvgmstream_get_current_time(libvgmstream_t* vctx);
double libvgmstream_get_current_samples(libvgmstream_t* vctx);
/* Seeks to position */
libvgmstream_t* libvgmstream_seek_absolute_sample(libvgmstream_t* vctx, int32_t sample);
libvgmstream_t* libvgmstream_seek_absolute_time(libvgmstream_t* vctx, double time);
libvgmstream_t* libvgmstream_seek_current_sample(libvgmstream_t* vctx, int32_t sample);
libvgmstream_t* libvgmstream_seek_current_time(libvgmstream_t* vctx, double time);
/* Closes current song. */
void libvgmstream_close(libvgmstream_t* vctx);
/* Frees vgmstream context. */
void libvgmstream_free(libvgmstream_t* vctx);
#if 0
void vgmstream_get_buffer(...);
void vgmstream_format_check(...);
void vgmstream_set_format_whilelist(...);
void vgmstream_set_format_blacklist(...);
const char* vgmstream_describe(...);
const char* vgmstream_get_title(...);
VGMSTREAM_TAGS* vgmstream_get_tagfile(...);
#endif
#endif
#endif

View File

@ -1,14 +1,14 @@
#include "vgmstream.h"
#include "../vgmstream.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "decode.h"
#include "layout/layout.h"
#include "coding/coding.h"
#include "mixing.h"
#include "plugins.h"
/* custom codec handling, not exactly "decode" stuff but here to simplify adding new codecs */
void free_codec(VGMSTREAM* vgmstream) {
void decode_free(VGMSTREAM* vgmstream) {
#ifdef VGM_USE_VORBIS
if (vgmstream->coding_type == coding_OGG_VORBIS) {
@ -119,7 +119,7 @@ void free_codec(VGMSTREAM* vgmstream) {
}
void seek_codec(VGMSTREAM* vgmstream) {
void decode_seek(VGMSTREAM* vgmstream) {
if (vgmstream->coding_type == coding_CIRCUS_VQ) {
seek_circus_vq(vgmstream->codec_data, vgmstream->loop_current_sample);
}
@ -213,7 +213,7 @@ void seek_codec(VGMSTREAM* vgmstream) {
}
void reset_codec(VGMSTREAM* vgmstream) {
void decode_reset(VGMSTREAM* vgmstream) {
#ifdef VGM_USE_VORBIS
if (vgmstream->coding_type == coding_OGG_VORBIS) {
@ -325,7 +325,7 @@ void reset_codec(VGMSTREAM* vgmstream) {
/* Get the number of samples of a single frame (smallest self-contained sample group, 1/N channels) */
int get_vgmstream_samples_per_frame(VGMSTREAM* vgmstream) {
int decode_get_samples_per_frame(VGMSTREAM* vgmstream) {
/* Value returned here is the max (or less) that vgmstream will ask a decoder per
* "decode_x" call. Decoders with variable samples per frame or internal discard
* may return 0 here and handle arbitrary samples_to_do values internally
@ -555,7 +555,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM* vgmstream) {
}
/* Get the number of bytes of a single frame (smallest self-contained byte group, 1/N channels) */
int get_vgmstream_frame_size(VGMSTREAM* vgmstream) {
int decode_get_frame_size(VGMSTREAM* vgmstream) {
switch (vgmstream->coding_type) {
case coding_SILENCE:
return 0;
@ -747,21 +747,21 @@ int get_vgmstream_frame_size(VGMSTREAM* vgmstream) {
}
/* In NDS IMA the frame size is the block size, so the last one is short */
int get_vgmstream_samples_per_shortframe(VGMSTREAM* vgmstream) {
int decode_get_samples_per_shortframe(VGMSTREAM* vgmstream) {
switch (vgmstream->coding_type) {
case coding_NDS_IMA:
return (vgmstream->interleave_last_block_size-4)*2;
default:
return get_vgmstream_samples_per_frame(vgmstream);
return decode_get_samples_per_frame(vgmstream);
}
}
int get_vgmstream_shortframe_size(VGMSTREAM* vgmstream) {
int decode_get_shortframe_size(VGMSTREAM* vgmstream) {
switch (vgmstream->coding_type) {
case coding_NDS_IMA:
return vgmstream->interleave_last_block_size;
default:
return get_vgmstream_frame_size(vgmstream);
return decode_get_frame_size(vgmstream);
}
}
@ -1488,7 +1488,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
/* Calculate number of consecutive samples we can decode. Takes into account hitting
* a loop start or end, or going past a single frame. */
int get_vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, VGMSTREAM* vgmstream) {
int decode_get_samples_to_do(int samples_this_block, int samples_per_frame, VGMSTREAM* vgmstream) {
int samples_to_do;
int samples_left_this_block;
@ -1521,7 +1521,7 @@ int get_vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, V
/* Detect loop start and save values, or detect loop end and restore (loop back).
* Returns 1 if loop was done. */
int vgmstream_do_loop(VGMSTREAM* vgmstream) {
int decode_do_loop(VGMSTREAM* vgmstream) {
/*if (!vgmstream->loop_flag) return 0;*/
/* is this the loop end? = new loop, continue from loop_start_sample */
@ -1557,7 +1557,7 @@ int vgmstream_do_loop(VGMSTREAM* vgmstream) {
* - loop_ch[] is copied to ch[] (with custom value)
* - then codec will use ch[]'s offset
* regular codecs may use copied loop_ch[] offset without issue */
seek_codec(vgmstream);
decode_seek(vgmstream);
/* restore! */
memcpy(vgmstream->ch, vgmstream->loop_ch, sizeof(VGMSTREAMCHANNEL) * vgmstream->channels);

View File

@ -1,32 +1,32 @@
#ifndef _DECODE_H
#define _DECODE_H
#include "vgmstream.h"
#include "../vgmstream.h"
void free_codec(VGMSTREAM* vgmstream);
void seek_codec(VGMSTREAM* vgmstream);
void reset_codec(VGMSTREAM* vgmstream);
void decode_free(VGMSTREAM* vgmstream);
void decode_seek(VGMSTREAM* vgmstream);
void decode_reset(VGMSTREAM* vgmstream);
/* Decode samples into the buffer. Assume that we have written samples_written into the
* buffer already, and we have samples_to_do consecutive samples ahead of us. */
void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_do, sample_t* buffer);
/* Detect loop start and save values, or detect loop end and restore (loop back). Returns 1 if loop was done. */
int vgmstream_do_loop(VGMSTREAM* vgmstream);
int decode_do_loop(VGMSTREAM* vgmstream);
/* Calculate number of consecutive samples to do (taking into account stopping for loop start and end) */
int get_vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, VGMSTREAM* vgmstream);
int decode_get_samples_to_do(int samples_this_block, int samples_per_frame, VGMSTREAM* vgmstream);
/* Get the number of samples of a single frame (smallest self-contained sample group, 1/N channels) */
int get_vgmstream_samples_per_frame(VGMSTREAM* vgmstream);
int decode_get_samples_per_frame(VGMSTREAM* vgmstream);
/* Get the number of bytes of a single frame (smallest self-contained byte group, 1/N channels) */
int get_vgmstream_frame_size(VGMSTREAM* vgmstream);
int decode_get_frame_size(VGMSTREAM* vgmstream);
/* In NDS IMA the frame size is the block size, but last one is shorter */
int get_vgmstream_samples_per_shortframe(VGMSTREAM* vgmstream);
int get_vgmstream_shortframe_size(VGMSTREAM* vgmstream);
int decode_get_samples_per_shortframe(VGMSTREAM* vgmstream);
int decode_get_shortframe_size(VGMSTREAM* vgmstream);
#endif

View File

@ -1,7 +1,8 @@
#include <ctype.h>
#include "vgmstream.h"
#include "coding/coding.h"
#include "../vgmstream.h"
#include "../coding/coding.h"
#include "mixing.h"
#include "../util/channel_mappings.h"
/*******************************************************************************/

View File

@ -1,4 +1,5 @@
#include "vgmstream.h"
#include "../vgmstream.h"
#include "../util/channel_mappings.h"
#include "mixing.h"
#include "plugins.h"
#include <math.h>
@ -1187,7 +1188,7 @@ typedef enum {
void mixing_macro_downmix(VGMSTREAM* vgmstream, int max /*, mapping_t output_mapping*/) {
mixing_data *data = vgmstream->mixing_data;
int ch, output_channels, mp_in, mp_out, ch_in, ch_out;
mapping_t input_mapping, output_mapping;
channel_mapping_t input_mapping, output_mapping;
const double vol_max = 1.0;
const double vol_sqrt = 1 / sqrt(2);
const double vol_half = 1 / 2;

View File

@ -1,7 +1,7 @@
#ifndef _MIXING_H_
#define _MIXING_H_
#include "vgmstream.h"
#include "../vgmstream.h"
/* Applies mixing commands to the sample buffer. Mixing must be externally enabled and
* outbuf must big enough to hold output_channels*samples_to_do */

View File

@ -1,7 +1,9 @@
#include "vgmstream.h"
#include "../vgmstream.h"
#include "../util/log.h"
#include "../util/reader_sf.h"
#include "../util/reader_text.h"
#include "plugins.h"
#include "mixing.h"
#include "util/log.h"
/* ****************************************** */

View File

@ -4,24 +4,12 @@
#ifndef _PLUGINS_H_
#define _PLUGINS_H_
#include "streamfile.h"
//todo rename to api.h once public enough
#if 0
/* define standard C param call and name mangling (to avoid __stdcall / .defs) */
//#define VGMSTREAM_CALL __cdecl //needed?
/* define external function types (during compilation) */
#if defined(VGMSTREAM_EXPORT)
#define VGMSTREAM_API __declspec(dllexport) /* when exporting/creating vgmstream DLL */
#elif defined(VGMSTREAM_IMPORT)
#define VGMSTREAM_API __declspec(dllimport) /* when importing/linking vgmstream DLL */
#ifdef BUILD_VGMSTREAM
#include "../streamfile.h"
#include "../vgmstream.h"
#else
#define VGMSTREAM_API /* nothing, internal/default */
#endif
//VGMSTREAM_API void VGMSTREAM_CALL vgmstream_function(void);
#include <libvgmstream/streamfile.h>
#include <libvgmstream/vgmstream.h>
#endif
@ -88,106 +76,6 @@ void vgmstream_set_log_callback(int level, void* callback);
void vgmstream_set_log_stdout(int level);
#if 0
//possible future public/opaque API
/* opaque player state */
//#define VGMSTREAM_CTX_VERSION 1
typedef struct VGMSTREAM_CTX VGMSTREAM_CTX;
/* Setups base vgmstream player context. */
VGMSTREAM_CTX* vgmstream_init_ctx(void);
/* Sets default config, that will be applied to song on open (some formats like TXTP may override
* these settings).
* May only be called without song loaded (before _open or after _close), otherwise ignored. */
void vgmstream_set_config(VGMSTREAM_CTX* vctx, VGMSTREAM_CFG* vcfg);
void vgmstream_set_buffer(VGMSTREAM_CTX* vctx, int samples, int max_samples);
/* Opens a new STREAMFILE to play. Returns < 0 on error when the file isn't recogniced.
* If file has subsongs, first open usually loads first subsong. get_info then can be used to check
* whether file has more subsongs (total_subsongs > 1), and call others.
* */
int vgmstream_open(STREAMFILE* sf);
int vgmstream_open_subsong(STREAMFILE* sf, int subsong);
typedef struct {
const int channels;
const int sample_rate;
const int sample_count; /* file's samples (not final duration) */
const int loop_start_sample;
const int loop_end_sample;
const int loop_flag;
const int current_subsong; /* 0=not set, N=loaded subsong N */
const int total_subsongs; /* 0=format has no subsongs, N=has N subsongs */
const int file_bitrate; /* file's average bitrate */
//const int codec_bitrate; /* codec's average bitrate */
/* descriptions */
//const char* codec;
//const char* layout;
//const char* metadata;
//int type; /* 0=pcm16, 1=float32, always interleaved: [0]=ch0, [1]=ch1 ... */
} VGMSTREAM_INFO;
/* Get info from current song. */
void vgmstream_ctx_get_info(VGMSTREAM_CTX* vctx, VGMSTREAM_INFO* vinfo);
/* Gets final time based on config and current song. If config is set to "play forever"
* this still returns final time based on config as a reference. Returns > 0 on success. */
int32_t vgmstream_get_total_time(VGMSTREAM_CTX* vctx);
double vgmstream_get_total_samples(VGMSTREAM_CTX* vctx);
/* Gets current position within song. When "play forever" is set, it'll clamp results to total_time. */
int32_t vgmstream_get_current_time(VGMSTREAM_CTX* vctx);
double vgmstream_get_current_samples(VGMSTREAM_CTX* vctx);
/* Seeks to position */
VGMSTREAM_CTX* vgmstream_seek_absolute_sample(VGMSTREAM_CTX* vctx, int32_t sample);
VGMSTREAM_CTX* vgmstream_seek_absolute_time(VGMSTREAM_CTX* vctx, double time);
VGMSTREAM_CTX* vgmstream_seek_current_sample(VGMSTREAM_CTX* vctx, int32_t sample);
VGMSTREAM_CTX* vgmstream_seek_current_time(VGMSTREAM_CTX* vctx, double time);
/* Closes current song. */
void vgmstream_close(VGMSTREAM_CTX* vctx);
/* Frees vgmstream context. */
void vgmstream_free_ctx(VGMSTREAM_CTX* vctx);
/* Converts samples. returns number of rendered samples, or <=0 if no more
* samples left (will fill buffer with silence) */
int vgmstream_play(VGMSTREAM_CTX* vctx);
#if 0
void vgmstream_get_buffer(...);
void vgmstream_format_check(...);
void vgmstream_set_format_whilelist(...);
void vgmstream_set_format_blacklist(...);
const char* vgmstream_describe(...);
const char* vgmstream_get_title(...);
VGMSTREAM_TAGS* vgmstream_get_tagfile(...);
#endif
#endif
/* ****************************************** */
/* TAGS: loads key=val tags from a file */
/* ****************************************** */

View File

@ -1,5 +1,5 @@
#include "vgmstream.h"
#include "layout/layout.h"
#include "../vgmstream.h"
#include "../layout/layout.h"
#include "render.h"
#include "decode.h"
#include "mixing.h"
@ -222,7 +222,7 @@ void setup_state_vgmstream(VGMSTREAM* vgmstream) {
/*****************************************************************************/
void free_layout(VGMSTREAM* vgmstream) {
void render_free(VGMSTREAM* vgmstream) {
if (vgmstream->layout_type == layout_segmented) {
free_layout_segmented(vgmstream->layout_data);
@ -233,7 +233,7 @@ void free_layout(VGMSTREAM* vgmstream) {
}
}
void reset_layout(VGMSTREAM* vgmstream) {
void render_reset(VGMSTREAM* vgmstream) {
if (vgmstream->layout_type == layout_segmented) {
reset_layout_segmented(vgmstream->layout_data);

View File

@ -1,10 +1,10 @@
#ifndef _RENDER_H
#define _RENDER_H
#include "vgmstream.h"
#include "../vgmstream.h"
void free_layout(VGMSTREAM* vgmstream);
void reset_layout(VGMSTREAM* vgmstream);
void render_free(VGMSTREAM* vgmstream);
void render_reset(VGMSTREAM* vgmstream);
int render_layout(sample_t* buf, int32_t sample_count, VGMSTREAM* vgmstream);

View File

@ -1,5 +1,5 @@
#include "vgmstream.h"
#include "layout/layout.h"
#include "../vgmstream.h"
#include "../layout/layout.h"
#include "render.h"
#include "decode.h"
#include "mixing.h"
@ -14,7 +14,7 @@ static void seek_force_loop(VGMSTREAM* vgmstream, int loop_count) {
/* pretend decoder reached loop end so state is set to loop start */
vgmstream->loop_count = loop_count - 1; /* seeking to first loop must become ++ > 0 */
vgmstream->current_sample = vgmstream->loop_end_sample;
vgmstream_do_loop(vgmstream);
decode_do_loop(vgmstream);
}
static void seek_force_decode(VGMSTREAM* vgmstream, int samples) {

View File

@ -4,6 +4,14 @@
/* libacm 1.2 (despite what libacm.h says) from: https://github.com/markokr/libacm */
/* libacm interface */
struct acm_codec_data {
STREAMFILE* streamfile;
void* handle;
void* io_config;
};
typedef struct {
STREAMFILE* streamfile; /* reference */
int offset;
@ -145,3 +153,18 @@ static int acm_get_length_streamfile(void *arg) {
return get_streamfile_size(config->streamfile);
}
void get_info_acm(acm_codec_data* data, int* p_channels, int* p_sample_rate, int* p_samples) {
if (!data || !data->handle) {
*p_channels = 0;
*p_sample_rate = 0;
*p_samples = 0;
return;
}
ACMStream* handle = data->handle;
*p_channels = handle->info.channels;
*p_sample_rate = handle->info.rate;
*p_samples = handle->total_values / handle->info.channels;
}

View File

@ -2,6 +2,8 @@
#define _CODING_H
#include "../vgmstream.h"
#include "../util/reader_sf.h"
#include "../util/reader_get_nibbles.h"
//todo remove
#include "hca_decoder_clhca.h"
@ -145,10 +147,13 @@ void decode_ws(VGMSTREAM* vgmstream, int channel, sample * outbuf, int channelsp
/* acm_decoder */
typedef struct acm_codec_data acm_codec_data;
acm_codec_data* init_acm(STREAMFILE* sf, int force_channel_number);
void decode_acm(acm_codec_data* data, sample_t* outbuf, int32_t samples_to_do, int channelspacing);
void reset_acm(acm_codec_data* data);
void free_acm(acm_codec_data* data);
void get_info_acm(acm_codec_data* data, int* p_channels, int* p_sample_rate, int* p_samples);
STREAMFILE* acm_get_streamfile(acm_codec_data* data);

View File

@ -1,4 +1,6 @@
#include "coding.h"
#include "../util/channel_mappings.h"
#include "../util/chunks.h"
#ifdef VGM_USE_FFMPEG

View File

@ -1317,9 +1317,11 @@ size_t xbox_ima_bytes_to_samples(size_t bytes, int channels) {
size_t dat4_ima_bytes_to_samples(size_t bytes, int channels) {
int block_align = 0x20 * channels;
if (channels <= 0) return 0;
int mod = bytes % block_align;
/* DAT4 IMA blocks have a 4 byte header per channel; 2 samples per byte (2 nibbles) */
return (bytes / block_align) * (block_align - 4 * channels) * 2 / channels
+ ((bytes % block_align) ? ((bytes % block_align) - 4 * channels) * 2 / channels : 0); /* unlikely (encoder aligns) */
+ ((mod > 0 && mod > 0x04*channels) ? (mod - 0x04*channels) * 2 / channels : 0); /* unlikely (encoder aligns) */
}
size_t apple_ima4_bytes_to_samples(size_t bytes, int channels) {

View File

@ -61,7 +61,7 @@
#include <stdlib.h>
#include "nwa_decoder.h"
#include "../util/reader_sf.h"
//NWAInfo::UseRunLength
static int is_use_runlength(NWAData* nwa) {

View File

@ -1,8 +1,7 @@
#include "vorbis_custom_decoder.h"
#ifdef VGM_USE_VORBIS
#define BITSTREAM_READ_ONLY /* config */
#include "vorbis_bitreader.h"
#include "../util/bitstream_lsb.h"
#include <vorbis/codec.h>
@ -108,12 +107,12 @@ static int build_header_comment(uint8_t* buf, size_t bufsize) {
if (bytes > bufsize) return 0;
put_8bit (buf+0x00, 0x03); /* packet_type (comments) */
memcpy (buf+0x01, "vorbis", 6); /* id */
put_32bitLE(buf+0x07, 0x09); /* vendor_length */
memcpy (buf+0x0b, "vgmstream", 9); /* vendor_string */
put_32bitLE(buf+0x14, 0x00); /* user_comment_list_length */
put_8bit (buf+0x18, 0x01); /* framing_flag (fixed) */
put_u8 (buf+0x00, 0x03); /* packet_type (comments) */
memcpy (buf+0x01, "vorbis", 6); /* id */
put_u32le(buf+0x07, 0x09); /* vendor_length */
memcpy (buf+0x0b, "vgmstream", 9); /* vendor_string */
put_u32le(buf+0x14, 0x00); /* user_comment_list_length */
put_u8 (buf+0x18, 0x01); /* framing_flag (fixed) */
return bytes;
}
@ -129,11 +128,11 @@ static int get_packet_header(STREAMFILE* sf, off_t* offset, size_t* size) {
if (read_streamfile(ibuf,(*offset),ibufsize, sf) != ibufsize)
goto fail;
init_bitstream(&ib, ibuf, ibufsize);
bl_setup(&ib, ibuf, ibufsize);
/* read using Vorbis weird LSF */
rv_bits(&ib, 4,&size_bits);
rv_bits(&ib, (size_bits+1),(uint32_t*)size);
bl_get(&ib, 4,&size_bits);
bl_get(&ib, (size_bits+1),(uint32_t*)size);
/* special meaning, seen in silent frames */
if (size_bits == 0 && *size == 0 && (uint8_t)read_8bit(*offset, sf) == 0x80) {

View File

@ -1,8 +1,8 @@
#include "vorbis_custom_decoder.h"
#ifdef VGM_USE_VORBIS
#include "vorbis_bitreader.h"
#include <vorbis/codec.h>
#include "../util/bitstream_lsb.h"
#define WWISE_VORBIS_USE_PRECOMPILED_WVC 1 /* if enabled vgmstream weights ~150kb more but doesn't need external .wvc packets */
#if WWISE_VORBIS_USE_PRECOMPILED_WVC
@ -212,8 +212,8 @@ static size_t rebuild_packet(uint8_t* obuf, size_t obufsize, wpacket_t* wp, STRE
ok = read_packet(wp, ibuf, ibufsize, sf, offset, data, 0);
if (!ok) goto fail;
init_bitstream(&ow, obuf, obufsize);
init_bitstream(&iw, ibuf, ibufsize);
bl_setup(&ow, obuf, obufsize);
bl_setup(&iw, ibuf, ibufsize);
ok = ww2ogg_generate_vorbis_packet(&ow, &iw, wp, data);
if (!ok) goto fail;
@ -242,8 +242,8 @@ static size_t rebuild_setup(uint8_t* obuf, size_t obufsize, wpacket_t* wp, STREA
ok = read_packet(wp, ibuf, ibufsize, sf, offset, data, 1);
if (!ok) goto fail;
init_bitstream(&ow, obuf, obufsize);
init_bitstream(&iw, ibuf, ibufsize);
bl_setup(&ow, obuf, obufsize);
bl_setup(&iw, ibuf, ibufsize);
ok = ww2ogg_generate_vorbis_setup(&ow,&iw, data, wp->packet_size, sf);
if (!ok) goto fail;
@ -267,16 +267,16 @@ static size_t build_header_identification(uint8_t* buf, size_t bufsize, vorbis_c
blocksizes = (cfg->blocksize_0_exp << 4) | (cfg->blocksize_1_exp);
put_8bit (buf+0x00, 0x01); /* packet_type (id) */
memcpy (buf+0x01, "vorbis", 6); /* id */
put_32bitLE(buf+0x07, 0x00); /* vorbis_version (fixed) */
put_8bit (buf+0x0b, cfg->channels); /* audio_channels */
put_32bitLE(buf+0x0c, cfg->sample_rate);/* audio_sample_rate */
put_32bitLE(buf+0x10, 0x00); /* bitrate_maximum (optional hint) */
put_32bitLE(buf+0x14, 0x00); /* bitrate_nominal (optional hint) */
put_32bitLE(buf+0x18, 0x00); /* bitrate_minimum (optional hint) */
put_8bit (buf+0x1c, blocksizes); /* blocksize_0 + blocksize_1 nibbles */
put_8bit (buf+0x1d, 0x01); /* framing_flag (fixed) */
put_u8 (buf+0x00, 0x01); /* packet_type (id) */
memcpy (buf+0x01, "vorbis", 6); /* id */
put_u32le(buf+0x07, 0x00); /* vorbis_version (fixed) */
put_u8 (buf+0x0b, cfg->channels); /* audio_channels */
put_u32le(buf+0x0c, cfg->sample_rate);/* audio_sample_rate */
put_u32le(buf+0x10, 0x00); /* bitrate_maximum (optional hint) */
put_u32le(buf+0x14, 0x00); /* bitrate_nominal (optional hint) */
put_u32le(buf+0x18, 0x00); /* bitrate_minimum (optional hint) */
put_u8 (buf+0x1c, blocksizes); /* blocksize_0 + blocksize_1 nibbles */
put_u8 (buf+0x1d, 0x01); /* framing_flag (fixed) */
return bytes;
}
@ -286,12 +286,12 @@ static size_t build_header_comment(uint8_t* buf, size_t bufsize) {
if (bytes > bufsize) return 0;
put_8bit (buf+0x00, 0x03); /* packet_type (comments) */
memcpy (buf+0x01, "vorbis", 6); /* id */
put_32bitLE(buf+0x07, 0x09); /* vendor_length */
memcpy (buf+0x0b, "vgmstream", 9); /* vendor_string */
put_32bitLE(buf+0x14, 0x00); /* user_comment_list_length */
put_8bit (buf+0x18, 0x01); /* framing_flag (fixed) */
put_u8 (buf+0x00, 0x03); /* packet_type (comments) */
memcpy (buf+0x01, "vorbis", 6); /* id */
put_u32le(buf+0x07, 0x09); /* vendor_length */
memcpy (buf+0x0b, "vgmstream", 9); /* vendor_string */
put_u32le(buf+0x14, 0x00); /* user_comment_list_length */
put_u8 (buf+0x18, 0x01); /* framing_flag (fixed) */
return bytes;
}
@ -306,14 +306,14 @@ static int copy_bytes(bitstream_t* ob, bitstream_t* ib, uint32_t bytes) {
for (i = 0; i < bytes / 4; i++) {
uint32_t c = 0;
rv_bits(ib, 32, &c);
wv_bits(ob, 32, c);
bl_get(ib, 32, &c);
bl_put(ob, 32, c);
}
for (i = 0; i < bytes % 4; i++) {
uint32_t c = 0;
rv_bits(ib, 8, &c);
wv_bits(ob, 8, c);
bl_get(ib, 8, &c);
bl_put(ob, 8, c);
}
#endif
@ -325,8 +325,8 @@ static int copy_bytes(bitstream_t* ob, bitstream_t* ib, uint32_t bytes) {
for (i = 0; i < bytes; i++, iw_pos++) {
uint32_t c = ib->buf[iw_pos];
//rv_bits(ib, 8, &c);
wv_bits(ob, 8, c);
//bl_get(ib, 8, &c);
bl_put(ob, 8, c);
}
ib->b_off += bytes * 8;
@ -337,8 +337,8 @@ static int copy_bytes(bitstream_t* ob, bitstream_t* ib, uint32_t bytes) {
for (i = 0; i < bytes; i++) {
uint32_t c = 0;
rv_bits(ib, 8, &c);
wv_bits(ob, 8, c);
bl_get(ib, 8, &c);
bl_put(ob, 8, c);
}
return 1;
@ -369,13 +369,13 @@ static int ww2ogg_generate_vorbis_packet(bitstream_t* ow, bitstream_t* iw, wpack
/* audio packet type */
packet_type = 0;
wv_bits(ow, 1, packet_type);
bl_put(ow, 1, packet_type);
/* collect this packet mode from the first byte */
rv_bits(iw, data->mode_bits,&mode_number); /* max 6b */
wv_bits(ow, data->mode_bits, mode_number);
bl_get(iw, data->mode_bits,&mode_number); /* max 6b */
bl_put(ow, data->mode_bits, mode_number);
rv_bits(iw, 8-data->mode_bits,&remainder);
bl_get(iw, 8-data->mode_bits,&remainder);
/* adjust window info */
if (data->mode_blockflag[mode_number]) {
@ -387,9 +387,9 @@ static int ww2ogg_generate_vorbis_packet(bitstream_t* ow, bitstream_t* iw, wpack
uint32_t next_mode_number;
bitstream_t nw;
init_bitstream(&nw, wp->inxt, sizeof(wp->inxt));
bl_setup(&nw, wp->inxt, sizeof(wp->inxt));
rv_bits(&nw, data->mode_bits,&next_mode_number); /* max 6b */
bl_get(&nw, data->mode_bits,&next_mode_number); /* max 6b */
next_blockflag = data->mode_blockflag[next_mode_number];
}
@ -399,15 +399,15 @@ static int ww2ogg_generate_vorbis_packet(bitstream_t* ow, bitstream_t* iw, wpack
}
prev_window_type = data->prev_blockflag;
wv_bits(ow, 1, prev_window_type);
bl_put(ow, 1, prev_window_type);
next_window_type = next_blockflag;
wv_bits(ow, 1, next_window_type);
bl_put(ow, 1, next_window_type);
}
data->prev_blockflag = data->mode_blockflag[mode_number]; /* save for next packet */
wv_bits(ow, 8-data->mode_bits, remainder);
bl_put(ow, 8-data->mode_bits, remainder);
/* rest of the packet (input/output bytes aren't byte aligned here, so no memcpy) */
copy_bytes(ow, iw, wp->packet_size - 1);
@ -417,7 +417,7 @@ static int ww2ogg_generate_vorbis_packet(bitstream_t* ow, bitstream_t* iw, wpack
uint32_t padding = 0;
int padding_bits = 8 - (ow->b_off % 8);
wv_bits(ow, padding_bits, padding);
bl_put(ow, padding_bits, padding);
}
}
else {
@ -480,12 +480,12 @@ static int ww2ogg_codebook_library_copy(bitstream_t* ow, bitstream_t* iw) {
uint32_t id = 0, dimensions = 0, entries = 0;
uint32_t ordered = 0, lookup_type = 0;
rv_bits(iw, 24,&id);
wv_bits(ow, 24, id);
rv_bits(iw, 16,&dimensions);
wv_bits(ow, 16, dimensions);
rv_bits(iw, 24,&entries);
wv_bits(ow, 24, entries);
bl_get(iw, 24,&id);
bl_put(ow, 24, id);
bl_get(iw, 16,&dimensions);
bl_put(ow, 16, dimensions);
bl_get(iw, 24,&entries);
bl_put(ow, 24, entries);
if (0x564342 != id) { /* "VCB" */
VGM_LOG("Wwise Vorbis: invalid codebook identifier\n");
@ -493,21 +493,21 @@ static int ww2ogg_codebook_library_copy(bitstream_t* ow, bitstream_t* iw) {
}
/* codeword lengths */
rv_bits(iw, 1,&ordered);
wv_bits(ow, 1, ordered);
bl_get(iw, 1,&ordered);
bl_put(ow, 1, ordered);
if (ordered) {
uint32_t initial_length = 0, current_entry = 0;
rv_bits(iw, 5,&initial_length);
wv_bits(ow, 5, initial_length);
bl_get(iw, 5,&initial_length);
bl_put(ow, 5, initial_length);
current_entry = 0;
while (current_entry < entries) {
uint32_t number = 0;
int numberv_bits = ww2ogg_tremor_ilog(entries-current_entry);
int numbebl_get = ww2ogg_tremor_ilog(entries-current_entry);
rv_bits(iw, numberv_bits,&number);
wv_bits(ow, numberv_bits, number);
bl_get(iw, numbebl_get,&number);
bl_put(ow, numbebl_get, number);
current_entry += number;
}
if (current_entry > entries) {
@ -518,8 +518,8 @@ static int ww2ogg_codebook_library_copy(bitstream_t* ow, bitstream_t* iw) {
else {
uint32_t sparse = 0;
rv_bits(iw, 1,&sparse);
wv_bits(ow, 1, sparse);
bl_get(iw, 1,&sparse);
bl_put(ow, 1, sparse);
for (i = 0; i < entries; i++) {
uint32_t present_bool = 0;
@ -528,8 +528,8 @@ static int ww2ogg_codebook_library_copy(bitstream_t* ow, bitstream_t* iw) {
if (sparse) {
uint32_t present = 0;
rv_bits(iw, 1,&present);
wv_bits(ow, 1, present);
bl_get(iw, 1,&present);
bl_put(ow, 1, present);
present_bool = (0 != present);
}
@ -537,16 +537,16 @@ static int ww2ogg_codebook_library_copy(bitstream_t* ow, bitstream_t* iw) {
if (present_bool) {
uint32_t codeword_length = 0;
rv_bits(iw, 5,&codeword_length);
wv_bits(ow, 5, codeword_length);
bl_get(iw, 5,&codeword_length);
bl_put(ow, 5, codeword_length);
}
}
}
/* lookup table */
rv_bits(iw, 4,&lookup_type);
wv_bits(ow, 4, lookup_type);
bl_get(iw, 4,&lookup_type);
bl_put(ow, 4, lookup_type);
if (0 == lookup_type) {
//VGM_LOG("Wwise Vorbis: no lookup table\n");
@ -556,22 +556,22 @@ static int ww2ogg_codebook_library_copy(bitstream_t* ow, bitstream_t* iw) {
uint32_t quantvals = 0, min = 0, max = 0;
uint32_t value_length = 0, sequence_flag = 0;
rv_bits(iw, 32,&min);
wv_bits(ow, 32, min);
rv_bits(iw, 32,&max);
wv_bits(ow, 32, max);
rv_bits(iw, 4,&value_length);
wv_bits(ow, 4, value_length);
rv_bits(iw, 1,&sequence_flag);
wv_bits(ow, 1, sequence_flag);
bl_get(iw, 32,&min);
bl_put(ow, 32, min);
bl_get(iw, 32,&max);
bl_put(ow, 32, max);
bl_get(iw, 4,&value_length);
bl_put(ow, 4, value_length);
bl_get(iw, 1,&sequence_flag);
bl_put(ow, 1, sequence_flag);
quantvals = ww2ogg_tremor_book_maptype1_quantvals(entries, dimensions);
for (i = 0; i < quantvals; i++) {
uint32_t val = 0, val_bits = 0;
val_bits = value_length+1;
rv_bits(iw, val_bits,&val);
wv_bits(ow, val_bits, val);
bl_get(iw, val_bits,&val);
bl_put(ow, val_bits, val);
}
}
else if (2 == lookup_type) {
@ -596,28 +596,28 @@ static int ww2ogg_codebook_library_rebuild(bitstream_t* ow, bitstream_t* iw, siz
id = 0x564342; /* "VCB" */
wv_bits(ow, 24, id);
rv_bits(iw, 4,&dimensions);
wv_bits(ow, 16, dimensions); /* 4 to 16 */
rv_bits(iw, 14,&entries);
wv_bits(ow, 24, entries); /* 14 to 24*/
bl_put(ow, 24, id);
bl_get(iw, 4,&dimensions);
bl_put(ow, 16, dimensions); /* 4 to 16 */
bl_get(iw, 14,&entries);
bl_put(ow, 24, entries); /* 14 to 24*/
/* codeword lengths */
rv_bits(iw, 1,&ordered);
wv_bits(ow, 1, ordered);
bl_get(iw, 1,&ordered);
bl_put(ow, 1, ordered);
if (ordered) {
uint32_t initial_length = 0, current_entry = 0;
rv_bits(iw, 5,&initial_length);
wv_bits(ow, 5, initial_length);
bl_get(iw, 5,&initial_length);
bl_put(ow, 5, initial_length);
current_entry = 0;
while (current_entry < entries) {
uint32_t number = 0;
int numberv_bits = ww2ogg_tremor_ilog(entries-current_entry);
int numbebl_get = ww2ogg_tremor_ilog(entries-current_entry);
rv_bits(iw, numberv_bits,&number);
wv_bits(ow, numberv_bits, number);
bl_get(iw, numbebl_get,&number);
bl_put(ow, numbebl_get, number);
current_entry += number;
}
if (current_entry > entries) {
@ -628,9 +628,9 @@ static int ww2ogg_codebook_library_rebuild(bitstream_t* ow, bitstream_t* iw, siz
else {
uint32_t codeword_length_length = 0, sparse = 0;
rv_bits(iw, 3,&codeword_length_length);
rv_bits(iw, 1,&sparse);
wv_bits(ow, 1, sparse);
bl_get(iw, 3,&codeword_length_length);
bl_get(iw, 1,&sparse);
bl_put(ow, 1, sparse);
if (0 == codeword_length_length || 5 < codeword_length_length) {
VGM_LOG("Wwise Vorbis: nonsense codeword length\n");
@ -644,8 +644,8 @@ static int ww2ogg_codebook_library_rebuild(bitstream_t* ow, bitstream_t* iw, siz
if (sparse) {
uint32_t present = 0;
rv_bits(iw, 1,&present);
wv_bits(ow, 1, present);
bl_get(iw, 1,&present);
bl_put(ow, 1, present);
present_bool = (0 != present);
}
@ -653,16 +653,16 @@ static int ww2ogg_codebook_library_rebuild(bitstream_t* ow, bitstream_t* iw, siz
if (present_bool) {
uint32_t codeword_length = 0;
rv_bits(iw, codeword_length_length,&codeword_length);
wv_bits(ow, 5, codeword_length); /* max 7 (3b) to 5 */
bl_get(iw, codeword_length_length,&codeword_length);
bl_put(ow, 5, codeword_length); /* max 7 (3b) to 5 */
}
}
}
/* lookup table */
rv_bits(iw, 1,&lookup_type);
wv_bits(ow, 4, lookup_type); /* 1 to 4 */
bl_get(iw, 1,&lookup_type);
bl_put(ow, 4, lookup_type); /* 1 to 4 */
if (0 == lookup_type) {
//VGM_LOG("Wwise Vorbis: no lookup table\n");
@ -672,22 +672,22 @@ static int ww2ogg_codebook_library_rebuild(bitstream_t* ow, bitstream_t* iw, siz
uint32_t quantvals = 0, min = 0, max = 0;
uint32_t value_length = 0, sequence_flag = 0;
rv_bits(iw, 32,&min);
wv_bits(ow, 32, min);
rv_bits(iw, 32,&max);
wv_bits(ow, 32, max);
rv_bits(iw, 4,&value_length);
wv_bits(ow, 4, value_length);
rv_bits(iw, 1,&sequence_flag);
wv_bits(ow, 1, sequence_flag);
bl_get(iw, 32,&min);
bl_put(ow, 32, min);
bl_get(iw, 32,&max);
bl_put(ow, 32, max);
bl_get(iw, 4,&value_length);
bl_put(ow, 4, value_length);
bl_get(iw, 1,&sequence_flag);
bl_put(ow, 1, sequence_flag);
quantvals = ww2ogg_tremor_book_maptype1_quantvals(entries, dimensions);
for (i = 0; i < quantvals; i++) {
uint32_t val = 0, val_bits = 0;
val_bits = value_length+1;
rv_bits(iw, val_bits,&val);
wv_bits(ow, val_bits, val);
bl_get(iw, val_bits,&val);
bl_put(ow, val_bits, val);
}
}
else if (2 == lookup_type) {
@ -722,7 +722,7 @@ static int ww2ogg_codebook_library_rebuild_by_id(bitstream_t* ow, uint32_t codeb
cb_size = load_wvc(ibuf,ibufsize, codebook_id, setup_type, sf);
if (cb_size == 0) goto fail;
init_bitstream(&iw, ibuf, ibufsize);
bl_setup(&iw, ibuf, ibufsize);
return ww2ogg_codebook_library_rebuild(ow, &iw, cb_size, sf);
fail:
@ -746,8 +746,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
/* Codebooks */
rv_bits(iw, 8,&codebook_count_less1);
wv_bits(ow, 8, codebook_count_less1);
bl_get(iw, 8,&codebook_count_less1);
bl_put(ow, 8, codebook_count_less1);
codebook_count = codebook_count_less1 + 1;
if (data->config.setup_type == WWV_FULL_SETUP) {
@ -770,7 +770,7 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
int rc;
uint32_t codebook_id = 0;
rv_bits(iw, 10,&codebook_id);
bl_get(iw, 10,&codebook_id);
rc = ww2ogg_codebook_library_rebuild_by_id(ow, codebook_id, data->config.setup_type, sf);
if (!rc) goto fail;
@ -780,9 +780,9 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
/* Time domain transforms */
time_count_less1 = 0;
wv_bits(ow, 6, time_count_less1);
bl_put(ow, 6, time_count_less1);
dummy_time_value = 0;
wv_bits(ow, 16, dummy_time_value);
bl_put(ow, 16, dummy_time_value);
if (data->config.setup_type == WWV_FULL_SETUP) {
@ -792,8 +792,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
uint32_t setup_packet_size_bits = packet_size * 8;
while (total_bits_read < setup_packet_size_bits) {
rv_bits(iw, 1,&bitly);
wv_bits(ow, 1, bitly);
bl_get(iw, 1,&bitly);
bl_put(ow, 1, bitly);
total_bits_read = iw->b_off;
}
}
@ -806,8 +806,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
/* Floors */
rv_bits(iw, 6,&floor_count_less1);
wv_bits(ow, 6, floor_count_less1);
bl_get(iw, 6,&floor_count_less1);
bl_put(ow, 6, floor_count_less1);
floor_count = floor_count_less1 + 1;
for (i = 0; i < floor_count; i++) {
@ -818,10 +818,10 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
// Always floor type 1
floor_type = 1;
wv_bits(ow, 16, floor_type);
bl_put(ow, 16, floor_type);
rv_bits(iw, 5,&floor1_partitions);
wv_bits(ow, 5, floor1_partitions);
bl_get(iw, 5,&floor1_partitions);
bl_put(ow, 5, floor1_partitions);
memset(floor1_partition_class_list, 0, sizeof(uint32_t)*32);
@ -829,8 +829,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
for (j = 0; j < floor1_partitions; j++) {
uint32_t floor1_partition_class = 0;
rv_bits(iw, 4,&floor1_partition_class);
wv_bits(ow, 4, floor1_partition_class);
bl_get(iw, 4,&floor1_partition_class);
bl_put(ow, 4, floor1_partition_class);
floor1_partition_class_list[j] = floor1_partition_class;
@ -843,19 +843,19 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
for (j = 0; j <= maximum_class; j++) {
uint32_t class_dimensions_less1 = 0, class_subclasses = 0;
rv_bits(iw, 3,&class_dimensions_less1);
wv_bits(ow, 3, class_dimensions_less1);
bl_get(iw, 3,&class_dimensions_less1);
bl_put(ow, 3, class_dimensions_less1);
floor1_class_dimensions_list[j] = class_dimensions_less1 + 1;
rv_bits(iw, 2,&class_subclasses);
wv_bits(ow, 2, class_subclasses);
bl_get(iw, 2,&class_subclasses);
bl_put(ow, 2, class_subclasses);
if (0 != class_subclasses) {
uint32_t masterbook = 0;
rv_bits(iw, 8,&masterbook);
wv_bits(ow, 8, masterbook);
bl_get(iw, 8,&masterbook);
bl_put(ow, 8, masterbook);
if (masterbook >= codebook_count) {
VGM_LOG("Wwise Vorbis: invalid floor1 masterbook\n");
@ -867,8 +867,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
uint32_t subclass_book_plus1 = 0;
int subclass_book = 0; /* this MUST be int */
rv_bits(iw, 8,&subclass_book_plus1);
wv_bits(ow, 8, subclass_book_plus1);
bl_get(iw, 8,&subclass_book_plus1);
bl_put(ow, 8, subclass_book_plus1);
subclass_book = subclass_book_plus1 - 1;
if (subclass_book >= 0 && subclass_book >= codebook_count) {
@ -878,11 +878,11 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
}
}
rv_bits(iw, 2,&floor1_multiplier_less1);
wv_bits(ow, 2, floor1_multiplier_less1);
bl_get(iw, 2,&floor1_multiplier_less1);
bl_put(ow, 2, floor1_multiplier_less1);
rv_bits(iw, 4,&rangebits);
wv_bits(ow, 4, rangebits);
bl_get(iw, 4,&rangebits);
bl_put(ow, 4, rangebits);
for (j = 0; j < floor1_partitions; j++) {
uint32_t current_class_number = 0;
@ -891,16 +891,16 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
for (k = 0; k < floor1_class_dimensions_list[current_class_number]; k++) {
uint32_t X = 0; /* max 4b (15) */
rv_bits(iw, rangebits,&X);
wv_bits(ow, rangebits, X);
bl_get(iw, rangebits,&X);
bl_put(ow, rangebits, X);
}
}
}
/* Residues */
rv_bits(iw, 6,&residue_count_less1);
wv_bits(ow, 6, residue_count_less1);
bl_get(iw, 6,&residue_count_less1);
bl_put(ow, 6, residue_count_less1);
residue_count = residue_count_less1 + 1;
for (i = 0; i < residue_count; i++) {
@ -908,24 +908,24 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
uint32_t residue_begin = 0, residue_end = 0, residue_partition_size_less1 = 0, residue_classifications_less1 = 0, residue_classbook = 0;
uint32_t residue_cascade[64+1]; /* 6b +1 */
rv_bits(iw, 2,&residue_type);
wv_bits(ow, 16, residue_type); /* 2b to 16b */
bl_get(iw, 2,&residue_type);
bl_put(ow, 16, residue_type); /* 2b to 16b */
if (residue_type > 2) {
VGM_LOG("Wwise Vorbis: invalid residue type\n");
goto fail;
}
rv_bits(iw, 24,&residue_begin);
wv_bits(ow, 24, residue_begin);
rv_bits(iw, 24,&residue_end);
wv_bits(ow, 24, residue_end);
rv_bits(iw, 24,&residue_partition_size_less1);
wv_bits(ow, 24, residue_partition_size_less1);
rv_bits(iw, 6,&residue_classifications_less1);
wv_bits(ow, 6, residue_classifications_less1);
rv_bits(iw, 8,&residue_classbook);
wv_bits(ow, 8, residue_classbook);
bl_get(iw, 24,&residue_begin);
bl_put(ow, 24, residue_begin);
bl_get(iw, 24,&residue_end);
bl_put(ow, 24, residue_end);
bl_get(iw, 24,&residue_partition_size_less1);
bl_put(ow, 24, residue_partition_size_less1);
bl_get(iw, 6,&residue_classifications_less1);
bl_put(ow, 6, residue_classifications_less1);
bl_get(iw, 8,&residue_classbook);
bl_put(ow, 8, residue_classbook);
residue_classifications = residue_classifications_less1 + 1;
if (residue_classbook >= codebook_count) {
@ -936,21 +936,21 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
memset(residue_cascade, 0, sizeof(uint32_t)*(64+1));
for (j = 0; j < residue_classifications; j++) {
uint32_t high_bits = 0, lowv_bits = 0, bitflag = 0;
uint32_t high_bits = 0, lobl_put = 0, bitflag = 0;
high_bits = 0;
rv_bits(iw, 3,&lowv_bits);
wv_bits(ow, 3, lowv_bits);
bl_get(iw, 3,&lobl_put);
bl_put(ow, 3, lobl_put);
rv_bits(iw, 1,&bitflag);
wv_bits(ow, 1, bitflag);
bl_get(iw, 1,&bitflag);
bl_put(ow, 1, bitflag);
if (bitflag) {
rv_bits(iw, 5,&high_bits);
wv_bits(ow, 5, high_bits);
bl_get(iw, 5,&high_bits);
bl_put(ow, 5, high_bits);
}
residue_cascade[j] = high_bits * 8 + lowv_bits;
residue_cascade[j] = high_bits * 8 + lobl_put;
}
for (j = 0; j < residue_classifications; j++) {
@ -958,8 +958,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
if (residue_cascade[j] & (1 << k)) {
uint32_t residue_book = 0;
rv_bits(iw, 8,&residue_book);
wv_bits(ow, 8, residue_book);
bl_get(iw, 8,&residue_book);
bl_put(ow, 8, residue_book);
if (residue_book >= codebook_count) {
VGM_LOG("Wwise Vorbis: invalid residue book\n");
@ -972,8 +972,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
/* Mappings */
rv_bits(iw, 6,&mapping_count_less1);
wv_bits(ow, 6, mapping_count_less1);
bl_get(iw, 6,&mapping_count_less1);
bl_put(ow, 6, mapping_count_less1);
mapping_count = mapping_count_less1 + 1;
for (i = 0; i < mapping_count; i++) {
@ -982,28 +982,28 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
// always mapping type 0, the only one
mapping_type = 0;
wv_bits(ow, 16, mapping_type);
bl_put(ow, 16, mapping_type);
rv_bits(iw, 1,&submaps_flag);
wv_bits(ow, 1, submaps_flag);
bl_get(iw, 1,&submaps_flag);
bl_put(ow, 1, submaps_flag);
submaps = 1;
if (submaps_flag) {
uint32_t submaps_less1 = 0;
rv_bits(iw, 4,&submaps_less1);
wv_bits(ow, 4, submaps_less1);
bl_get(iw, 4,&submaps_less1);
bl_put(ow, 4, submaps_less1);
submaps = submaps_less1 + 1;
}
rv_bits(iw, 1,&square_polar_flag);
wv_bits(ow, 1, square_polar_flag);
bl_get(iw, 1,&square_polar_flag);
bl_put(ow, 1, square_polar_flag);
if (square_polar_flag) {
uint32_t coupling_steps_less1 = 0, coupling_steps = 0;
rv_bits(iw, 8,&coupling_steps_less1);
wv_bits(ow, 8, coupling_steps_less1);
bl_get(iw, 8,&coupling_steps_less1);
bl_put(ow, 8, coupling_steps_less1);
coupling_steps = coupling_steps_less1 + 1;
for (j = 0; j < coupling_steps; j++) {
@ -1011,10 +1011,10 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
int magnitude_bits = ww2ogg_tremor_ilog(channels-1);
int angle_bits = ww2ogg_tremor_ilog(channels-1);
rv_bits(iw, magnitude_bits,&magnitude);
wv_bits(ow, magnitude_bits, magnitude);
rv_bits(iw, angle_bits,&angle);
wv_bits(ow, angle_bits, angle);
bl_get(iw, magnitude_bits,&magnitude);
bl_put(ow, magnitude_bits, magnitude);
bl_get(iw, angle_bits,&angle);
bl_put(ow, angle_bits, angle);
if (angle == magnitude || magnitude >= channels || angle >= channels) {
VGM_LOG("Wwise Vorbis: invalid coupling (angle=%i, mag=%i, ch=%i)\n", angle, magnitude,channels);
@ -1024,8 +1024,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
}
// a rare reserved field not removed by Ak!
rv_bits(iw, 2,&mapping_reserved);
wv_bits(ow, 2, mapping_reserved);
bl_get(iw, 2,&mapping_reserved);
bl_put(ow, 2, mapping_reserved);
if (0 != mapping_reserved) {
VGM_LOG("Wwise Vorbis: mapping reserved field nonzero\n");
goto fail;
@ -1035,8 +1035,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
for (j = 0; j < channels; j++) {
uint32_t mapping_mux = 0;
rv_bits(iw, 4,&mapping_mux);
wv_bits(ow, 4, mapping_mux);
bl_get(iw, 4,&mapping_mux);
bl_put(ow, 4, mapping_mux);
if (mapping_mux >= submaps) {
VGM_LOG("Wwise Vorbis: mapping_mux >= submaps\n");
goto fail;
@ -1048,18 +1048,18 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
uint32_t time_config = 0, floor_number = 0, residue_number = 0;
// Another! Unused time domain transform configuration placeholder!
rv_bits(iw, 8,&time_config);
wv_bits(ow, 8, time_config);
bl_get(iw, 8,&time_config);
bl_put(ow, 8, time_config);
rv_bits(iw, 8,&floor_number);
wv_bits(ow, 8, floor_number);
bl_get(iw, 8,&floor_number);
bl_put(ow, 8, floor_number);
if (floor_number >= floor_count) {
VGM_LOG("Wwise Vorbis: invalid floor mapping\n");
goto fail;
}
rv_bits(iw, 8,&residue_number);
wv_bits(ow, 8, residue_number);
bl_get(iw, 8,&residue_number);
bl_put(ow, 8, residue_number);
if (residue_number >= residue_count) {
VGM_LOG("Wwise Vorbis: invalid residue mapping\n");
goto fail;
@ -1069,8 +1069,8 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
/* Modes */
rv_bits(iw, 6,&mode_count_less1);
wv_bits(ow, 6, mode_count_less1);
bl_get(iw, 6,&mode_count_less1);
bl_put(ow, 6, mode_count_less1);
mode_count = mode_count_less1 + 1;
memset(data->mode_blockflag, 0, sizeof(uint8_t)*(64+1)); /* up to max mode_count */
@ -1079,18 +1079,18 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
for (i = 0; i < mode_count; i++) {
uint32_t block_flag = 0, windowtype = 0, transformtype = 0, mapping = 0;
rv_bits(iw, 1,&block_flag);
wv_bits(ow, 1, block_flag);
bl_get(iw, 1,&block_flag);
bl_put(ow, 1, block_flag);
data->mode_blockflag[i] = (block_flag != 0); /* for mod_packets */
windowtype = 0;
transformtype = 0;
wv_bits(ow, 16, windowtype);
wv_bits(ow, 16, transformtype);
bl_put(ow, 16, windowtype);
bl_put(ow, 16, transformtype);
rv_bits(iw, 8,&mapping);
wv_bits(ow, 8, mapping);
bl_get(iw, 8,&mapping);
bl_put(ow, 8, mapping);
if (mapping >= mapping_count) {
VGM_LOG("Wwise Vorbis: invalid mode mapping\n");
goto fail;
@ -1104,7 +1104,7 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
uint32_t framing = 0;
framing = 1;
wv_bits(ow, 1, framing);
bl_put(ow, 1, framing);
}
/* remove trailing garbage bits */
@ -1112,7 +1112,7 @@ static int ww2ogg_generate_vorbis_setup(bitstream_t* ow, bitstream_t* iw, vorbis
uint32_t padding = 0;
int padding_bits = 8 - (ow->b_off % 8);
wv_bits(ow, padding_bits, padding);
bl_put(ow, padding_bits, padding);
}

View File

@ -116,7 +116,7 @@ static const char* extension_list[] = {
"bk2",
"bkr", //txth/reserved [P.N.03 (GC), Viewtiful Joe (GC)]
"blk",
"bmdx",
"bmdx", //fake extension (to be removed?)
"bms",
"bnk",
"bnm",
@ -393,6 +393,7 @@ static const char* extension_list[] = {
"ogv",
"oma", //FFmpeg/not parsed (ATRAC3/ATRAC3PLUS/MP3/LPCM/WMA)
"omu",
"opu",
//"opus", //common
"opusx",
"otm",
@ -638,6 +639,7 @@ static const char* extension_list[] = {
"wua",
"wv2",
"wv6",
"wvd", //txth/reserved [Donkey Kong Barrel Blast (Wii)]
"wve",
"wvs",
"wvx",

View File

@ -1,6 +1,6 @@
#include "layout.h"
#include "../vgmstream.h"
#include "../decode.h"
#include "../base/decode.h"
#include "../coding/coding.h"
@ -11,13 +11,13 @@ void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM*
int samples_written = 0;
int frame_size, samples_per_frame, samples_this_block;
frame_size = get_vgmstream_frame_size(vgmstream);
samples_per_frame = get_vgmstream_samples_per_frame(vgmstream);
frame_size = decode_get_frame_size(vgmstream);
samples_per_frame = decode_get_samples_per_frame(vgmstream);
samples_this_block = 0;
if (vgmstream->current_block_samples) {
samples_this_block = vgmstream->current_block_samples;
} else if (frame_size == 0) { /* assume 4 bit */ //TODO: get_vgmstream_frame_size() really should return bits... */
} else if (frame_size == 0) { /* assume 4 bit */ //TODO: decode_get_frame_size() really should return bits... */
samples_this_block = vgmstream->current_block_size * 2 * samples_per_frame;
} else {
samples_this_block = vgmstream->current_block_size / frame_size * samples_per_frame;
@ -28,11 +28,11 @@ void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM*
int samples_to_do;
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
if (vgmstream->loop_flag && decode_do_loop(vgmstream)) {
/* handle looping, readjust back to loop start values */
if (vgmstream->current_block_samples) {
samples_this_block = vgmstream->current_block_samples;
} else if (frame_size == 0) { /* assume 4 bit */ //TODO: get_vgmstream_frame_size() really should return bits... */
} else if (frame_size == 0) { /* assume 4 bit */ //TODO: decode_get_frame_size() really should return bits... */
samples_this_block = vgmstream->current_block_size * 2 * samples_per_frame;
} else {
samples_this_block = vgmstream->current_block_size / frame_size * samples_per_frame;
@ -54,7 +54,7 @@ void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM*
break;
}
samples_to_do = get_vgmstream_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
samples_to_do = decode_get_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
if (samples_to_do > sample_count - samples_written)
samples_to_do = sample_count - samples_written;
@ -74,11 +74,11 @@ void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM*
block_update(vgmstream->next_block_offset,vgmstream);
/* update since these may change each block */
frame_size = get_vgmstream_frame_size(vgmstream);
samples_per_frame = get_vgmstream_samples_per_frame(vgmstream);
frame_size = decode_get_frame_size(vgmstream);
samples_per_frame = decode_get_samples_per_frame(vgmstream);
if (vgmstream->current_block_samples) {
samples_this_block = vgmstream->current_block_samples;
} else if (frame_size == 0) { /* assume 4 bit */ //TODO: get_vgmstream_frame_size() really should return bits... */
} else if (frame_size == 0) { /* assume 4 bit */ //TODO: decode_get_frame_size() really should return bits... */
samples_this_block = vgmstream->current_block_size * 2 * samples_per_frame;
} else {
samples_this_block = vgmstream->current_block_size / frame_size * samples_per_frame;

View File

@ -1,6 +1,6 @@
#include "layout.h"
#include "../vgmstream.h"
#include "../decode.h"
#include "../base/decode.h"
/* Decodes samples for flat streams.
@ -9,19 +9,19 @@ void render_vgmstream_flat(sample_t* outbuf, int32_t sample_count, VGMSTREAM* vg
int samples_written = 0;
int samples_per_frame, samples_this_block;
samples_per_frame = get_vgmstream_samples_per_frame(vgmstream);
samples_per_frame = decode_get_samples_per_frame(vgmstream);
samples_this_block = vgmstream->num_samples; /* do all samples if possible */
while (samples_written < sample_count) {
int samples_to_do;
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
if (vgmstream->loop_flag && decode_do_loop(vgmstream)) {
/* handle looping */
continue;
}
samples_to_do = get_vgmstream_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
samples_to_do = decode_get_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
if (samples_to_do > sample_count - samples_written)
samples_to_do = sample_count - samples_written;

View File

@ -1,6 +1,6 @@
#include "layout.h"
#include "../vgmstream.h"
#include "../decode.h"
#include "../base/decode.h"
/* Decodes samples for interleaved streams.
@ -19,20 +19,20 @@ void render_vgmstream_interleave(sample_t * buffer, int32_t sample_count, VGMSTR
/* setup */
{
int frame_size_d = get_vgmstream_frame_size(vgmstream);
samples_per_frame_d = get_vgmstream_samples_per_frame(vgmstream);
int frame_size_d = decode_get_frame_size(vgmstream);
samples_per_frame_d = decode_get_samples_per_frame(vgmstream);
if (frame_size_d == 0 || samples_per_frame_d == 0) goto fail;
samples_this_block_d = vgmstream->interleave_block_size / frame_size_d * samples_per_frame_d;
}
if (has_interleave_first) {
int frame_size_f = get_vgmstream_frame_size(vgmstream);
samples_per_frame_f = get_vgmstream_samples_per_frame(vgmstream); //todo samples per shortframe
int frame_size_f = decode_get_frame_size(vgmstream);
samples_per_frame_f = decode_get_samples_per_frame(vgmstream); //todo samples per shortframe
if (frame_size_f == 0 || samples_per_frame_f == 0) goto fail;
samples_this_block_f = vgmstream->interleave_first_block_size / frame_size_f * samples_per_frame_f;
}
if (has_interleave_last) {
int frame_size_l = get_vgmstream_shortframe_size(vgmstream);
samples_per_frame_l = get_vgmstream_samples_per_shortframe(vgmstream);
int frame_size_l = decode_get_shortframe_size(vgmstream);
samples_per_frame_l = decode_get_samples_per_shortframe(vgmstream);
if (frame_size_l == 0 || samples_per_frame_l == 0) goto fail;
samples_this_block_l = vgmstream->interleave_last_block_size / frame_size_l * samples_per_frame_l;
}
@ -62,7 +62,7 @@ void render_vgmstream_interleave(sample_t * buffer, int32_t sample_count, VGMSTR
while (samples_written < sample_count) {
int samples_to_do;
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
if (vgmstream->loop_flag && decode_do_loop(vgmstream)) {
/* handle looping, restore standard interleave sizes */
if (has_interleave_first &&
@ -83,7 +83,7 @@ void render_vgmstream_interleave(sample_t * buffer, int32_t sample_count, VGMSTR
continue;
}
samples_to_do = get_vgmstream_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
samples_to_do = decode_get_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
if (samples_to_do > sample_count - samples_written)
samples_to_do = sample_count - samples_written;

View File

@ -1,8 +1,8 @@
#include "layout.h"
#include "../vgmstream.h"
#include "../decode.h"
#include "../mixing.h"
#include "../plugins.h"
#include "../base/decode.h"
#include "../base/mixing.h"
#include "../base/plugins.h"
#define VGMSTREAM_MAX_LAYERS 255
#define VGMSTREAM_LAYER_SAMPLE_BUFFER 8192
@ -25,12 +25,12 @@ void render_vgmstream_layered(sample_t* outbuf, int32_t sample_count, VGMSTREAM*
int layer, ch;
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
if (vgmstream->loop_flag && decode_do_loop(vgmstream)) {
/* handle looping (loop_layout has been called below) */
continue;
}
samples_to_do = get_vgmstream_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
samples_to_do = decode_get_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
if (samples_to_do > sample_count - samples_written)
samples_to_do = sample_count - samples_written;
@ -105,7 +105,7 @@ void loop_layout_layered(VGMSTREAM* vgmstream, int32_t loop_sample) {
* calls to do_loop work (used in seek_vgmstream) */
if (data->layers[layer]->loop_flag) { /* mixing looping and non-looping layers is allowed */
data->layers[layer]->current_sample = data->layers[layer]->loop_end_sample; /* forces do loop */
vgmstream_do_loop(data->layers[layer]); /* guaranteed to work should loop_layout be called */
decode_do_loop(data->layers[layer]); /* guaranteed to work should loop_layout be called */
}
else {
/* needed when mixing non-looping layers and installing loop externally */

View File

@ -3,6 +3,7 @@
#include "../streamtypes.h"
#include "../vgmstream.h"
#include "../util/reader_sf.h"
/* blocked layouts */
void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM* vgmstream);

View File

@ -1,8 +1,8 @@
#include "layout.h"
#include "../vgmstream.h"
#include "../decode.h"
#include "../mixing.h"
#include "../plugins.h"
#include "../base/decode.h"
#include "../base/mixing.h"
#include "../base/plugins.h"
#define VGMSTREAM_MAX_SEGMENTS 1024
#define VGMSTREAM_SEGMENT_SAMPLE_BUFFER 8192
@ -34,7 +34,7 @@ void render_vgmstream_segmented(sample_t* outbuf, int32_t sample_count, VGMSTREA
while (samples_written < sample_count) {
int samples_to_do;
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
if (vgmstream->loop_flag && decode_do_loop(vgmstream)) {
/* handle looping (loop_layout has been called below, changes segments/state) */
samples_this_block = vgmstream_get_samples(data->segments[data->current_segment]);
mixing_info(data->segments[data->current_segment], NULL, &current_channels);
@ -60,7 +60,7 @@ void render_vgmstream_segmented(sample_t* outbuf, int32_t sample_count, VGMSTREA
}
samples_to_do = get_vgmstream_samples_to_do(samples_this_block, sample_count, vgmstream);
samples_to_do = decode_get_samples_to_do(samples_this_block, sample_count, vgmstream);
if (samples_to_do > sample_count - samples_written)
samples_to_do = sample_count - samples_written;
if (samples_to_do > VGMSTREAM_SEGMENT_SAMPLE_BUFFER /*&& use_internal_buffer*/) /* always for fade/etc mixes */

View File

@ -4,10 +4,10 @@
/* ACM - InterPlay infinity engine games [Planescape: Torment (PC), Baldur's Gate (PC)] */
VGMSTREAM* init_vgmstream_acm(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL;
VGMSTREAM* vgmstream = NULL;
int loop_flag = 0, channels, sample_rate, num_samples;
int force_channel_number = 0;
acm_codec_data *data = NULL;
acm_codec_data* data = NULL;
/* checks */
@ -37,14 +37,10 @@ VGMSTREAM* init_vgmstream_acm(STREAMFILE* sf) {
/* init decoder */
{
ACMStream *handle;
data = init_acm(sf, force_channel_number);
if (!data) goto fail;
handle = data->handle;
channels = handle->info.channels;
sample_rate = handle->info.rate;
num_samples = handle->total_values / handle->info.channels;
get_info_acm(data, &channels, &sample_rate, &num_samples);
}

View File

@ -7,6 +7,7 @@
#include "adx_keys.h"
#include "../coding/coding.h"
#include "../util/cri_keys.h"
#include "../util/companion_files.h"
#ifdef VGM_DEBUG_OUTPUT

View File

@ -2,6 +2,7 @@
#include "../coding/coding.h"
#include "ahx_keys.h"
#include "../util/cri_keys.h"
#include "../util/companion_files.h"
#ifdef VGM_USE_MPEG
static int find_ahx_key(STREAMFILE* sf, off_t offset, crikey_t* crikey);

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/companion_files.h"
//typedef enum { ADX, HCA, VAG, RIFF, CWAV, DSP, CWAC, M4A } awb_type_t;

View File

@ -1,5 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
/* .BAF - Bizarre Creations bank file [Blur (PS3), Project Gotham Racing 4 (X360), Geometry Wars (PC)] */
VGMSTREAM * init_vgmstream_baf(STREAMFILE *sf) {
@ -8,7 +10,7 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *sf) {
size_t stream_size;
uint32_t channel_count, sample_rate, num_samples, version, codec, tracks;
int loop_flag, total_subsongs, target_subsong = sf->stream_index;
uint32_t (*read_u32)(off_t,STREAMFILE*);
read_u32_t read_u32;
/* checks */
if (!is_id32be(0x00, sf, "BANK"))
@ -18,7 +20,7 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *sf) {
goto fail;
/* use BANK size to check endianness */
if (guess_endianness32bit(0x04,sf)) {
if (guess_endian32(0x04,sf)) {
read_u32 = read_u32be;
} else {
read_u32 = read_u32le;

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
#include "../util/endianness.h"
/* BKHD - Wwise soundbank container */
@ -10,8 +11,8 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
uint32_t subfile_offset, subfile_size, base_offset = 0;
uint32_t subfile_id, version;
int big_endian, is_dummy = 0, is_wmid = 0;
uint32_t (*read_u32)(off_t,STREAMFILE*);
float (*read_f32)(off_t,STREAMFILE*);
read_u32_t read_u32;
read_f32_t read_f32;
int total_subsongs, target_subsong = sf->stream_index;
int prefetch = 0;
@ -24,7 +25,7 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
base_offset = 0x0c;
if (!is_id32be(base_offset + 0x00, sf, "BKHD"))
goto fail;
big_endian = guess_endianness32bit(base_offset + 0x04, sf);
big_endian = guess_endian32(base_offset + 0x04, sf);
read_u32 = big_endian ? read_u32be : read_u32le;
read_f32 = big_endian ? read_f32be : read_f32le;
@ -200,7 +201,7 @@ VGMSTREAM* init_vgmstream_bkhd_fx(STREAMFILE* sf) {
/* .wem: used when (rarely) external */
if (!check_extensions(sf,"wem,bnk"))
goto fail;
big_endian = guess_endianness32bit(0x00, sf);
big_endian = guess_endian32(0x00, sf);
read_u32 = big_endian ? read_u32be : read_u32le;
/* Not an actual stream but typically convolution reverb models and other FX plugin helpers.

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
#include "../util/companion_files.h"
#include "bnsf_keys.h"

View File

@ -1,5 +1,8 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../layout/layout.h"
static layered_layout_data* build_layered_data(STREAMFILE* sf, int channels);
/* BWAV - NintendoWare wavs [Super Mario Maker 2 (Switch)] */
VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) {
@ -29,15 +32,13 @@ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) {
sample_rate = read_s32le(0x10 + 0x04, sf);
/* 0x08: num_samples for full (non-prefetch) file, same as below if not prefetch */
num_samples = read_s32le(0x10 + 0x0c, sf);
/* 0x10: coefs */
/* 0x10: coefs (empty for non-DSP codecs) */
/* 0x30: offset for full (non-prefetch) file? */
start_offset = read_u32le(0x10 + 0x34, sf);
/* 0x38: flag? (always 1) */
loop_end = read_s32le(0x10 + 0x3C, sf);
loop_start = read_s32le(0x10 + 0x40, sf);
/* 0x44: start predictor */
/* 0x46: hist1 sample */
/* 0x48: hist2 sample */
/* 0x44: start predictor + hist1 + hist2 (empty for non-DSP codecs) */
/* 0x4a: null? */
loop_flag = (loop_end != -1);
@ -56,7 +57,6 @@ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) {
vgmstream->num_samples = num_samples;
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
vgmstream->allow_dual_stereo = 1; /* Animal Crossing: Happy Home Paradise */
switch(codec) {
case 0x0000: /* Ring Fit Adventure (Switch) */
@ -71,8 +71,17 @@ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) {
vgmstream->interleave_block_size = interleave;
dsp_read_coefs_le(vgmstream, sf, 0x10 + 0x10, 0x4C);
dsp_read_hist_le(vgmstream, sf, 0x10 + 0x46, 0x4C);
vgmstream->allow_dual_stereo = 1; /* Animal Crossing: Happy Home Paradise */
break;
case 0x0002: /* Zelda TOTK (Switch) */
vgmstream->layout_data = build_layered_data(sf, channels);
if (!vgmstream->layout_data) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_layered;
break;
default:
goto fail;
}
@ -85,3 +94,37 @@ fail:
close_vgmstream(vgmstream);
return NULL;
}
static layered_layout_data* build_layered_data(STREAMFILE* sf, int channels) {
layered_layout_data* data = NULL;
STREAMFILE* temp_sf = NULL;
data = init_layout_layered(channels);
if (!data) goto fail;
for (int ch = 0; ch < channels; ch++) {
uint32_t subfile_offset = read_u32le(0x10 + 0x4c * ch + 0x34, sf);
uint32_t subfile_size = 0x28 + read_u32le(subfile_offset + 0x24, sf); /* NXOpus size, abridged (fails if non-common chunks are found, let's see) */
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, "opus");
if (!temp_sf) goto fail;
data->layers[ch] = init_vgmstream_opus_std(temp_sf);
if (!data->layers[ch]) goto fail;
data->layers[ch]->stream_size = get_streamfile_size(temp_sf);
close_streamfile(temp_sf);
temp_sf = NULL;
}
if (!setup_layout_layered(data))
goto fail;
return data;
fail:
free_layout_layered(data);
close_streamfile(temp_sf);
return NULL;
}

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/cri_utf.h"
#include "../util/companion_files.h"
typedef enum { HCA, CWAV, ADX } cpk_type_t;

View File

@ -1,8 +1,9 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* CSMP - Retro Studios sample [Metroid Prime 3 (Wii), Donkey Kong Country Returns (Wii)] */
/* CSMP - Retro Studios sample [Metroid Prime 3 (Wii)-sfx, Donkey Kong Country Returns (Wii)-sfx] */
VGMSTREAM* init_vgmstream_csmp(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset, first_offset = 0x08, chunk_offset;
@ -10,21 +11,20 @@ VGMSTREAM* init_vgmstream_csmp(STREAMFILE* sf) {
/* checks */
if (!check_extensions(sf, "csmp"))
goto fail;
if (!is_id32be(0x00, sf, "CSMP"))
goto fail;
if (read_u32be(0x04, sf) != 1)
if (!check_extensions(sf, "csmp"))
goto fail;
if (read_u32be(0x04, sf) != 1) /* version? */
goto fail;
if (!find_chunk(sf, 0x44415441,first_offset,0, &chunk_offset,NULL, 1, 0)) /*"DATA"*/
/* INFO > PAD > DATA */
if (!find_chunk(sf, get_id32be("DATA"),first_offset,0, &chunk_offset,NULL, 1, 0))
goto fail;
/* contains standard DSP header, but somehow some validations (start/loop ps)
* don't seem to work, so no point to handle as standard DSP */
channels = 1;
loop_flag = read_s16be(chunk_offset+0x0c,sf);
/* contains a not quite standard DSP header */
channels = 1; /* also at INFO + 0x00? (in practice uses dual stereo in separate files) */
loop_flag = read_s16be(chunk_offset+0x0c,sf); /* also at INFO + 0x01 */
start_offset = chunk_offset + 0x60;
@ -35,10 +35,8 @@ VGMSTREAM* init_vgmstream_csmp(STREAMFILE* sf) {
vgmstream->meta_type = meta_CSMP;
vgmstream->sample_rate = read_s32be(chunk_offset+0x08,sf);
vgmstream->num_samples = read_s32be(chunk_offset+0x00,sf);
vgmstream->loop_start_sample = dsp_nibbles_to_samples(read_u32be(chunk_offset+0x10,sf));
vgmstream->loop_end_sample = dsp_nibbles_to_samples(read_u32be(chunk_offset+0x14,sf)) + 1;
if (vgmstream->loop_end_sample > vgmstream->num_samples) /* ? */
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->loop_start_sample = read_s32be(chunk_offset+0x10,sf); /* unlike regular DSP's nibbles */
vgmstream->loop_end_sample = read_s32be(chunk_offset+0x14,sf) + 1;
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_none;

View File

@ -2,6 +2,8 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
#include "../util/companion_files.h"
#include "ea_eaac_streamfile.h"
/* EAAudioCore (aka SND10) formats, EA's current audio middleware */
@ -85,7 +87,7 @@ VGMSTREAM* init_vgmstream_ea_snu(STREAMFILE* sf) {
* 0x0c(4): some sub-offset? (0x20, found when @0x01 is set) */
/* use start_offset as endianness flag */
if (guess_endianness32bit(0x08,sf)) {
if (guess_endian32(0x08,sf)) {
read_32bit = read_32bitBE;
} else {
read_32bit = read_32bitLE;
@ -125,7 +127,7 @@ VGMSTREAM* init_vgmstream_ea_abk_eaac(STREAMFILE* sf) {
goto fail;
/* use table offset to check endianness */
if (guess_endianness32bit(0x1C, sf)) {
if (guess_endian32(0x1C, sf)) {
read_32bit = read_32bitBE;
read_16bit = read_16bitBE;
} else {

View File

@ -1,6 +1,8 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
#include "../util/companion_files.h"
#include "ea_schl_streamfile.h"
/* header version */
@ -222,7 +224,7 @@ VGMSTREAM* init_vgmstream_ea_schl_video(STREAMFILE* sf) {
}
/* use block size to check endianness */
if (guess_endianness32bit(0x04, sf)) {
if (guess_endian32(0x04, sf)) {
read_32bit = read_32bitBE;
} else {
read_32bit = read_32bitLE;
@ -329,7 +331,7 @@ VGMSTREAM* init_vgmstream_ea_abk(STREAMFILE* sf) {
goto fail;
/* use table offset to check endianness */
if (guess_endianness32bit(0x1C, sf)) {
if (guess_endian32(0x1C, sf)) {
read_32bit = read_32bitBE;
read_16bit = read_16bitBE;
} else {
@ -1142,7 +1144,7 @@ static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset) {
ea.codec_config |= (header_id & 0xFFFF) << 16;
}
if (guess_endianness32bit(offset + 0x04, sf)) { /* size is always LE, except in early SS/MAC */
if (guess_endian32(offset + 0x04, sf)) { /* size is always LE, except in early SS/MAC */
header_size = read_32bitBE(offset + 0x04, sf);
ea.codec_config |= 0x02;
}

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../layout/layout.h"
#include "../util/endianness.h"
/* EA WVE (Ad10) - from early Electronic Arts movies [Wing Commander 3/4 (PS1), Madden NHL 97 (PC)-w95] */
VGMSTREAM* init_vgmstream_ea_wve_ad10(STREAMFILE* sf) {
@ -22,7 +23,7 @@ VGMSTREAM* init_vgmstream_ea_wve_ad10(STREAMFILE* sf) {
!is_id32be(0x00, sf, "Ad11")) /* last audio block, but could be first */
goto fail;
big_endian = guess_endianness32bit(0x04, sf);
big_endian = guess_endian32(0x04, sf);
if (is_id32be(0x00, sf, "AABB"))
start_offset += big_endian ? read_u32be(0x04, sf) : read_u32le(0x04, sf);

View File

@ -1,5 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/companion_files.h"
#include "../util/chunks.h"
#include "ogg_vorbis_streamfile.h"
#include "encrypted_bgm_streamfile.h"
#include "encrypted_mc161_streamfile.h"

View File

@ -488,10 +488,9 @@ VGMSTREAM* init_vgmstream_fsb5(STREAMFILE* sf) {
vgmstream->interleave_block_size = 0x8c;
break;
#if 0 //disabled until some game is found, can be created in the GUI tool
#ifdef VGM_USE_FFMPEG
case 0x11: { /* FMOD_SOUND_FORMAT_OPUS */
int skip = 312; //fsb_opus_get_encoder_delay(fsb5.stream_offset, sb); /* returns 120 but this seems correct */
case 0x11: { /* FMOD_SOUND_FORMAT_OPUS [LEGO 2K Drive (Switch)] */
int skip = 312; //fsb_opus_get_encoder_delay(fsb5.stream_offset, sb); /* returns 120 but this seems correct in test files */
//vgmstream->num_samples -= skip;
vgmstream->codec_data = init_ffmpeg_fsb_opus(sb, fsb5.stream_offset, fsb5.stream_size, vgmstream->channels, skip, vgmstream->sample_rate);
@ -500,7 +499,6 @@ VGMSTREAM* init_vgmstream_fsb5(STREAMFILE* sf) {
vgmstream->layout_type = layout_none;
break;
}
#endif
#endif
default:
vgm_logi("FSB5: unknown codec 0x%x (report)\n", fsb5.codec);

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
static int get_subsongs(STREAMFILE* sf, off_t fsb5_offset, size_t fsb5_size);
@ -16,13 +17,14 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
/* checks */
if (!is_id32be(0x00,sf, "RIFF"))
goto fail;
if (!is_id32be(0x08,sf, "FEV "))
goto fail;
if (!check_extensions(sf, "bank"))
goto fail;
if (read_u32be(0x00,sf) != 0x52494646) /* "RIFF" */
goto fail;
if (read_u32be(0x08,sf) != 0x46455620) /* "FEV " */
goto fail;
version = read_u32le(0x14,sf); /* newer FEV have some kind of sub-version at 0x18 */
/* .fev is an event format referencing various external .fsb, but FMOD can bake .fev and .fsb to

View File

@ -1,4 +1,5 @@
#include "meta.h"
#include "../util/companion_files.h"
#include "fsb_keys.h"
#include "fsb_encrypted_streamfile.h"

View File

@ -64,6 +64,7 @@ static const fsbkey_info fsbkey_list[] = {
{ MODE_FSB4_STD, FSBKEY_ADD("qjvkeoqkrdhkdckd") }, // Bubble Fighter (PC)
{ MODE_FSB5_STD, FSBKEY_ADD("p@4_ih*srN:UJk&8") }, // Fall Guys (PC) update ~2021-11
{ MODE_FSB5_STD, FSBKEY_ADD(",&.XZ8]fLu%caPF+") }, // Fall Guys (PC) update ~2022-07
{ MODE_FSB5_STD, FSBKEY_ADD("^*4[hE>K]x90Vj") }, // Fall Guys (PC) update ~2023-05
{ MODE_FSB5_STD, FSBKEY_ADD("Achilles_0_15_DpG") }, // Achilles: Legends Untold (PC)
{ MODE_FSB5_STD, FSBKEY_ADD("4FB8CC894515617939F4E1B7D50972D27213B8E6") }, // Cult of the Lamb Demo (PC)
{ MODE_FSB5_STD, FSBKEY_ADD("X3EK%Bbga-%Y9HZZ%gkc*C512*$$DhRxWTGgjUG@=rUD") }, // Signalis (PC)

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* GSP+GSB - from Tecmo's Super Swing Golf 1 & 2 (Wii), Quantum Theory (PS3/X360) */
VGMSTREAM* init_vgmstream_gsp_gsb(STREAMFILE* sf) {

View File

@ -2,6 +2,8 @@
#include "hca_keys.h"
#include "../coding/coding.h"
#include "../coding/hca_decoder_clhca.h"
#include "../util/channel_mappings.h"
#include "../util/companion_files.h"
#ifdef VGM_DEBUG_OUTPUT
//#define HCA_BRUTEFORCE

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* LucasArts iMUSE (Interactive Music Streaming Engine) formats */

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
typedef enum { PCM16, MSADPCM, DSP_HEAD, DSP_BODY, AT9, MSF_APEX, XMA2 } kwb_codec;
@ -594,7 +595,7 @@ static int parse_kwb(kwb_header* kwb, STREAMFILE* sf_h, STREAMFILE* sf_b) {
head_offset = 0x00;
body_offset = 0x00;
kwb->big_endian = guess_endianness32bit(head_offset + 0x08, sf_h);
kwb->big_endian = guess_endian32(head_offset + 0x08, sf_h);
read_u32 = kwb->big_endian ? read_u32be : read_u32le;
}

View File

@ -2,6 +2,8 @@
#define _META_H
#include "../vgmstream.h"
#include "../util/reader_sf.h"
#include "../util/reader_text.h"
typedef VGMSTREAM* (*init_vgmstream_t)(STREAMFILE* sf);

View File

@ -33,7 +33,7 @@ VGMSTREAM* init_vgmstream_mul(STREAMFILE* sf) {
read_u32be(0x1c,sf) != 0)
goto fail;
big_endian = guess_endianness32bit(0x00, sf);
big_endian = guess_endian32(0x00, sf);
read_u32 = big_endian ? read_u32be : read_u32le;
read_f32 = big_endian ? read_f32be : read_f32le;

View File

@ -1,5 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
#include "../util/chunks.h"
static void load_name(char* name, size_t name_size, STREAMFILE* sf, int big_endian, int total_subsongs, int target_subsong);
@ -19,21 +21,21 @@ VGMSTREAM* init_vgmstream_nub(STREAMFILE* sf) {
/* checks */
version = read_u32be(0x00,sf);
if (version != 0x00020000 && /* v2.0 (rare, ex. Ridge Race 6 (X360)) */
version != 0x00020100 && /* v2.1 (common) */
version != 0x01020100) /* same but LE (seen in PSP/PC games, except PS4) */
goto fail;
if (read_u32be(0x04,sf) != 0x00000000) /* null */
goto fail;
/* .nub: standard
* .nub2: rare [iDOLM@STER - Gravure For You (PS3)] */
if (!check_extensions(sf, "nub,nub2"))
goto fail;
version = read_32bitBE(0x00,sf);
if (version != 0x00020000 && /* v2.0 (rare, ex. Ridge Race 6 (X360)) */
version != 0x00020100 && /* v2.1 (common) */
version != 0x01020100) /* same but LE (seen in PSP/PC games, except PS4) */
goto fail;
if (read_32bitBE(0x04,sf) != 0x00000000) /* null */
goto fail;
/* sometimes LE [Soul Calibur: Broken Destiny (PSP), Tales of Vesperia (PS4) */
big_endian = guess_endianness32bit(0x18, sf);
big_endian = guess_endian32(0x18, sf);
if (big_endian) {
read_32bit = read_32bitBE;
} else{
@ -249,7 +251,7 @@ VGMSTREAM* init_vgmstream_nub_wav(STREAMFILE* sf) {
if (read_32bitBE(0x00,sf) != 0x77617600) /* "wav\0" "*/
goto fail;
if (guess_endianness32bit(0x1c, sf)) {
if (guess_endian32(0x1c, sf)) {
read_32bit = read_32bitBE;
read_16bit = read_16bitBE;
} else {
@ -313,7 +315,7 @@ VGMSTREAM* init_vgmstream_nub_vag(STREAMFILE* sf) {
if (read_32bitBE(0x00,sf) != 0x76616700) /* "vag\0" */
goto fail;
if (guess_endianness32bit(0x1c, sf)) {
if (guess_endian32(0x1c, sf)) {
read_32bit = read_32bitBE;
} else {
read_32bit = read_32bitLE;
@ -598,7 +600,7 @@ VGMSTREAM* init_vgmstream_nub_is14(STREAMFILE* sf) {
if (read_32bitBE(0x00,sf) != 0x69733134) /* "is14" */
goto fail;
if (guess_endianness32bit(0x1c, sf)) {
if (guess_endian32(0x1c, sf)) {
read_32bit = read_32bitBE;
} else{
read_32bit = read_32bitLE;

View File

@ -2,6 +2,7 @@
#include <string.h>
#include "meta.h"
#include "../coding/coding.h"
#include "../util/channel_mappings.h"
#include "ogg_vorbis_streamfile.h"

View File

@ -133,9 +133,10 @@ VGMSTREAM* init_vgmstream_opus_std(STREAMFILE* sf) {
if (read_u32le(0x00,sf) != 0x80000001) /* 'basic info' chunk */
goto fail;
/* .opus: standard
* .bgm: Cotton Reboot (Switch) */
if (!check_extensions(sf,"opus,lopus,bgm"))
/* .opus: standard / .lopus: for plugins
* .bgm: Cotton Reboot (Switch)
* .opu: Ys Memoire: The Oath in Felghana (Switch) */
if (!check_extensions(sf,"opus,lopus,bgm,opu"))
goto fail;
offset = 0x00;

View File

@ -3,6 +3,7 @@
#include "../coding/coding.h"
#include "../layout/layout.h"
#include "../util.h"
#include "../util/channel_mappings.h"
#include "riff_ogg_streamfile.h"
/* RIFF - Resource Interchange File Format, standard container used in many games */

View File

@ -1,5 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* .SBK - from Addiction Pinball (PC) */
VGMSTREAM *init_vgmstream_sbk(STREAMFILE *sf) {
@ -11,13 +13,12 @@ VGMSTREAM *init_vgmstream_sbk(STREAMFILE *sf) {
int target_subsong = sf->stream_index, total_subsongs, loop_flag, is_streamed;
/* checks */
if (!check_extensions(sf, "sbk"))
if (!is_id32be(0x00,sf, "RIFF"))
goto fail;
if (!is_id32be(0x08,sf, "SBNK"))
goto fail;
/* check header */
if (read_u32be(0x00, sf) != 0x52494646) /* "RIFF" */
goto fail;
if (read_u32be(0x08, sf) != 0x53424E4B) /* "SBNK" */
if (!check_extensions(sf, "sbk"))
goto fail;
if (!find_chunk_le(sf, 0x57415649, 0x0c, 0, &table_offset, &table_size)) /* "WAVI" */

View File

@ -1,5 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
/* SEG - from Stormfront games [Eragon (multi), Forgotten Realms: Demon Stone (multi) */
VGMSTREAM* init_vgmstream_seg(STREAMFILE* sf) {
@ -19,7 +21,7 @@ VGMSTREAM* init_vgmstream_seg(STREAMFILE* sf) {
codec = read_32bitBE(0x04,sf);
/* 0x08: version? (2: Eragon, Spiderwick Chronicles Wii / 3: Spiderwick Chronicles X360 / 4: Spiderwick Chronicles PC) */
if (guess_endianness32bit(0x08,sf)) {
if (guess_endian32(0x08,sf)) {
read_32bit = read_32bitBE;
} else {
read_32bit = read_32bitLE;

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* SGXD - Sony/SCEI's format (SGB+SGH / SGD / SGX) */

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
/* also see init_vgmstream_dsp_sps_n1 and init_vgmstream_opus_sps_n1 */
@ -21,7 +22,7 @@ VGMSTREAM* init_vgmstream_sps_n1(STREAMFILE* sf) {
if (!check_extensions(sf,"sps"))
goto fail;
if (guess_endianness32bit(0x00, sf)) { /* PS3 */
if (guess_endian32(0x00, sf)) { /* PS3 */
read_u32 = read_u32be;
read_u16 = read_u16be;
}

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
/* SSPR - Capcom container [Sengoku Basara 4 (PS3/PS4), Mega Man Zero ZX Legacy Collection (PS4)] */
VGMSTREAM* init_vgmstream_sspr(STREAMFILE* sf) {
@ -21,7 +22,7 @@ VGMSTREAM* init_vgmstream_sspr(STREAMFILE* sf) {
/* Simple (audio only) container used some Capcom games (common engine?).
* Some files come with a .stqr with unknown data (cues?). */
big_endian = guess_endianness32bit(0x04, sf); /* 0x01 (version?) */
big_endian = guess_endian32(0x04, sf); /* 0x01 (version?) */
read_u32 = big_endian ? read_u32be : read_u32le;
total_subsongs = read_u32(0x08,sf);

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* SXD - Sony/SCE's SNDX lib format (cousin of SGXD) [Gravity Rush, Freedom Wars, Soul Sacrifice PSV] */

View File

@ -4,6 +4,7 @@
#include "txth_streamfile.h"
#include "../util/text_reader.h"
#include "../util/endianness.h"
#include "../util/paths.h"
#define TXT_LINE_MAX 2048 /* probably ~1000 would be ok */
#define TXT_LINE_KEY_MAX 128
@ -115,6 +116,7 @@ typedef struct {
int target_subsong;
uint32_t subsong_count;
uint32_t subsong_spacing;
uint32_t subsong_sum;
uint32_t name_offset_set;
uint32_t name_offset;
@ -1299,6 +1301,23 @@ static int parse_keyval(STREAMFILE* sf_, txth_header* txth, const char* key, cha
else if (is_string(key,"subsong_spacing") || is_string(key,"subsong_offset")) {
if (!parse_num(txth->sf_head,txth,val, &txth->subsong_spacing)) goto fail;
}
else if (is_string(key,"subsong_sum")) {
/* add all values up to current subsong (for example, to add all sizes to get current offset, so get start_offset)
* doesn't include current (that is, reading size from fist subsong doesn't add anything) */
int default_subsong = txth->target_subsong;
uint32_t subsong_sum = 0;
for (int i = 0; i < default_subsong - 1; i++) {
txth->target_subsong = i + 1;
if (!parse_num(txth->sf_head,txth,val, &subsong_sum)) goto fail;
txth->subsong_sum += subsong_sum;
}
txth->target_subsong = default_subsong;
}
else if (is_string(key,"name_offset")) {
if (!parse_num(txth->sf_head,txth,val, &txth->name_offset)) goto fail;
txth->name_offset_set = 1;
@ -2000,6 +2019,7 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
else if ((n = is_string_field(val,"subsong_count"))) value = txth->subsong_count;
else if ((n = is_string_field(val,"subsong_spacing"))) value = txth->subsong_spacing;
else if ((n = is_string_field(val,"subsong_offset"))) value = txth->subsong_spacing;
else if ((n = is_string_field(val,"subsong_sum"))) value = txth->subsong_sum;
else if ((n = is_string_field(val,"subfile_offset"))) value = txth->subfile_offset;
else if ((n = is_string_field(val,"subfile_size"))) value = txth->subfile_size;
else if ((n = is_string_field(val,"base_offset"))) value = txth->base_offset;

View File

@ -1,9 +1,10 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../layout/layout.h"
#include "../mixing.h"
#include "../plugins.h"
#include "../base/mixing.h"
#include "../base/plugins.h"
#include "../util/text_reader.h"
#include "../util/paths.h"
#include <math.h>

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
#include "ubi_bao_streamfile.h"
#define BAO_MIN_VERSION 0x1B
@ -1570,7 +1571,7 @@ static void config_bao_endian(ubi_bao_header* bao, off_t offset, STREAMFILE* sf)
* This could be done once as all BAOs share endianness */
/* negate as fields looks like LE (0xN0000000) */
bao->big_endian = !guess_endianness32bit(offset+bao->cfg.bao_class, sf);
bao->big_endian = !guess_endian32(offset+bao->cfg.bao_class, sf);
}
@ -1714,7 +1715,7 @@ static int config_bao_version(ubi_bao_header* bao, STREAMFILE* sf) {
/* next BAO uses machine endianness, entry should always exist
* (maybe should use project BAO to detect?) */
if (guess_endianness32bit(header_size + 0x04, sf)) {
if (guess_endian32(header_size + 0x04, sf)) {
version |= 0xFF00; /* signal Wii=BE, but don't modify original */
}
}

View File

@ -1,6 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
#include "../util/chunks.h"
typedef enum { MSADPCM, DSP, MP3, XMA2 } ckd_codec;
@ -30,7 +31,7 @@ VGMSTREAM* init_vgmstream_ubi_ckd(STREAMFILE* sf) {
if (!is_id32be(0x0c,sf, "fmt "))
goto fail;
big_endian = guess_endianness32bit(0x04, sf);
big_endian = guess_endian32(0x04, sf);
read_u32 = big_endian ? read_u32be : read_u32le;
read_u16 = big_endian ? read_u16be : read_u16le;

View File

@ -2,6 +2,7 @@
#include "../layout/layout.h"
#include "../coding/coding.h"
#include "../util/endianness.h"
#include "../util/chunks.h"
typedef enum { PCM, UBI, PSX, DSP, XIMA, ATRAC3, XMA2, MP3, SILENCE } ubi_hx_codec;
@ -239,6 +240,14 @@ static int parse_name(ubi_hx_header* hx, STREAMFILE* sf) {
}
}
/* XIII GC has one subsong 718260C4 B7C67534 with empty index entry
* (CGCWavResData with name does exist but its CGCWaveFileIdObj doesn't point to it) */
if (!hx->is_external) {
strcpy(hx->internal_name,"?");
return 1;
}
VGM_LOG("UBI HX: name not found for CUUID %08x %08x\n", hx->cuuid1, hx->cuuid2);
fail:
vgm_logi("UBI HX: error parsing name at %x (report)\n", index_offset);
return 0;

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* VXN - from Gameloft mobile games */
@ -11,11 +12,12 @@ VGMSTREAM* init_vgmstream_vxn(STREAMFILE* sf) {
int total_subsongs, target_subsong = sf->stream_index;
/* checks */
if (!is_id32be(0x00,sf, "VoxN"))
goto fail;
if (!check_extensions(sf,"vxn"))
goto fail;
if (!is_id32be(0x00,sf, "VoxN"))
goto fail;
/* 0x04: chunk size */
/* 0x08: ASCII version? ("0.0.1") */
if (read_u32le(0x10,sf) != get_streamfile_size(sf))

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
//#include <ctype.h>
/* .WBK - seen in some Treyarch games [Spider-Man 2, Ultimate Spider-Man, Call of Duty 2: Big Red One] */

View File

@ -3,6 +3,7 @@
#include "../coding/coding.h"
#include "../util/chunks.h"
#include "../util/endianness.h"
#include "../util/channel_mappings.h"
/* Wwise uses a custom RIFF/RIFX header, non-standard enough that it's parsed it here.

View File

@ -1,64 +1,65 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
#include "../util/chunks.h"
/* XAU - XPEC Entertainment sound format (Beat Down PS2/Xbox, Spectral Force Chronicle [SLPM-65967]) */
VGMSTREAM * init_vgmstream_xau(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
/* XAU - XPEC Entertainment sound format [Beat Down (PS2/Xbox), Spectral Force Chronicle (PS2)] */
VGMSTREAM* init_vgmstream_xau(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count, type, loop_start, loop_end;
int loop_flag, channels, type, loop_start, loop_end;
/* check extension */
if (!check_extensions(streamFile, "xau"))
goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x58415500) /* "XAU\0" "*/
if (!is_id32be(0x00,sf, "XAU\0"))
goto fail;
if (read_32bitLE(0x08,streamFile) != 0x40) /* header start */
if (!check_extensions(sf, "xau"))
goto fail;
if (read_32bitLE(0x08,sf) != 0x40) /* header start */
goto fail;
/* 0x04: version? (0x100) */
type = read_32bitBE(0x0c, streamFile);
loop_start = read_32bitLE(0x10, streamFile);
loop_end = read_32bitLE(0x14, streamFile);
loop_flag = (loop_end > 0);
type = read_32bitBE(0x0c, sf);
loop_start = read_32bitLE(0x10, sf);
loop_end = read_32bitLE(0x14, sf);
loop_flag = (loop_end > 0);
channel_count = read_8bit(0x18,streamFile);
channels = read_8bit(0x18,sf);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->channels = channel_count;
vgmstream->channels = channels;
vgmstream->meta_type = meta_XAU;
/* miniheader over a common header with some tweaks, so we'll simplify parsing */
switch(type) {
case 0x50533200: /* "PS2\0" */
if (read_32bitBE(0x40,streamFile) != 0x56414770) goto fail; /* mutant "VAGp" (long header size) */
/* miniheader over a common header with some tweaks, so we'll simplify parsing */
switch(type) {
case 0x50533200: /* "PS2\0" */
if (read_32bitBE(0x40,sf) != 0x56414770) goto fail; /* mutant "VAGp" (long header size) */
start_offset = 0x800;
vgmstream->sample_rate = read_32bitBE(0x50, streamFile);
vgmstream->num_samples = ps_bytes_to_samples(read_32bitBE(0x4C,streamFile) * channel_count, channel_count);
start_offset = 0x800;
vgmstream->sample_rate = read_32bitBE(0x50, sf);
vgmstream->num_samples = ps_bytes_to_samples(read_32bitBE(0x4C,sf) * channels, channels);
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x8000;
break;
vgmstream->interleave_block_size = 0x8000;
break;
case 0x58420000: /* "XB\0\0" */
if (read_32bitBE(0x40,streamFile) != 0x52494646) goto fail; /* mutant "RIFF" (sometimes wrong RIFF size) */
case 0x58420000: /* "XB\0\0" */
if (read_32bitBE(0x40,sf) != 0x52494646) goto fail; /* mutant "RIFF" (sometimes wrong RIFF size) */
/* start offset: find "data" chunk, as sometimes there is a "smpl" chunk at the start or the end (same as loop_start/end) */
if (!find_chunk_le(streamFile, 0x64617461, 0x4c, 0, &start_offset, NULL) )
goto fail;
/* start offset: find "data" chunk, as sometimes there is a "smpl" chunk at the start or the end (same as loop_start/end) */
if (!find_chunk_le(sf, 0x64617461, 0x4c, 0, &start_offset, NULL) )
goto fail;
vgmstream->sample_rate = read_32bitLE(0x58, streamFile);
vgmstream->num_samples = xbox_ima_bytes_to_samples(read_32bitLE(start_offset-4, streamFile), channel_count);
vgmstream->sample_rate = read_32bitLE(0x58, sf);
vgmstream->num_samples = xbox_ima_bytes_to_samples(read_32bitLE(start_offset-4, sf), channels);
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
@ -66,13 +67,13 @@ VGMSTREAM * init_vgmstream_xau(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
break;
default:
goto fail;
}
default:
goto fail;
}
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
if (!vgmstream_open_stream(vgmstream,sf,start_offset))
goto fail;
return vgmstream;

View File

@ -2,17 +2,20 @@
#define _XNB_STREAMFILE_H_
//#define XNB_ENABLE_LZX 1
#include "../streamfile.h"
#include "../util/log.h"
#include "xnb_lz4mg.h"
#ifdef XNB_ENABLE_LZX
/* lib from https://github.com/sumatrapdfreader/chmlib
/* can be safely enabled but useless since LZX isn't used for audio assets
* lib from https://github.com/sumatrapdfreader/chmlib
* which is a cleaned-up version of https://github.com/jedwing/CHMLib */
#include "lzx.h"
#include "../utils/lzx.h"
#define LZX_XNB_WINDOW_BITS 16
#endif
#include "xnb_lz4mg.h"
#define XNB_TYPE_LZX 1
#define XNB_TYPE_LZ4 2

View File

@ -2,6 +2,7 @@
#include "../coding/coding.h"
#include "../layout/layout.h"
#include "xvag_streamfile.h"
#include "../util/chunks.h"
typedef struct {
@ -41,12 +42,13 @@ VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) {
/* checks */
if (!is_id32be(0x00,sf, "XVAG"))
goto fail;
/* .xvag: standard
* (extensionless): The Last of Us (PS3) speech files */
if (!check_extensions(sf,"xvag,"))
goto fail;
if (!is_id32be(0x00,sf, "XVAG"))
goto fail;
/* endian flag (XVAGs of the same game can use BE or LE, usually when reusing from other platforms) */
xvag.big_endian = read_8bit(0x08,sf) & 0x01;

View File

@ -1,6 +1,7 @@
#ifndef _XWB_XSB_H_
#define _XWB_XSB_H_
#include "meta.h"
#include "../util/companion_files.h"
#define XSB_XACT1_0_MAX 5 /* Unreal Championship (Xbox) */
#define XSB_XACT1_1_MAX 8 /* Die Hard: Vendetta (Xbox) */

View File

@ -1,6 +1,8 @@
#include "streamfile.h"
#include "util.h"
#include "vgmstream.h"
#include "util/reader_sf.h"
#include "util/paths.h"
#include <string.h>
/* for dup/fdopen in some systems */
@ -8,15 +10,6 @@
#include <unistd.h>
#endif
//TODO: move
#ifndef DIR_SEPARATOR
#if defined (_WIN32) || defined (WIN32)
#define DIR_SEPARATOR '\\'
#else
#define DIR_SEPARATOR '/'
#endif
#endif
/* For (rarely needed) +2GB file support we use fseek64/ftell64. Those are usually available
* but may depend on compiler.
* - MSVC: +VS2008 should work
@ -987,6 +980,19 @@ STREAMFILE* open_multifile_streamfile_f(STREAMFILE** sfs, size_t sfs_size) {
/* **************************************************** */
/* change pathname's extension to another (or add it if extensionless) */
static void swap_extension(char* pathname, /*size_t*/ int pathname_len, const char* swap) {
char* extension = (char*)filename_extension(pathname);
//todo safeops
if (extension[0] == '\0') {
strcat(pathname, ".");
strcat(pathname, swap);
}
else {
strcpy(extension, swap);
}
}
STREAMFILE* open_streamfile(STREAMFILE* sf, const char* pathname) {
return sf->open(sf, pathname, STREAMFILE_DEFAULT_BUFFER_SIZE);
}
@ -1071,279 +1077,6 @@ STREAMFILE* reopen_streamfile(STREAMFILE* sf, size_t buffer_size) {
return sf->open(sf, pathname, buffer_size);
}
/* **************************************************** */
size_t read_line(char* buf, int buf_size, off_t offset, STREAMFILE* sf, int* p_line_ok) {
int i;
off_t file_size = get_streamfile_size(sf);
int extra_bytes = 0; /* how many bytes over those put in the buffer were read */
if (p_line_ok) *p_line_ok = 0;
for (i = 0; i < buf_size-1 && offset+i < file_size; i++) {
char in_char = read_8bit(offset+i, sf);
/* check for end of line */
if (in_char == 0x0d && read_8bit(offset+i+1, sf) == 0x0a) { /* CRLF */
extra_bytes = 2;
if (p_line_ok) *p_line_ok = 1;
break;
}
else if (in_char == 0x0d || in_char == 0x0a) { /* CR or LF */
extra_bytes = 1;
if (p_line_ok) *p_line_ok = 1;
break;
}
buf[i] = in_char;
}
buf[i] = '\0';
/* did we fill the buffer? */
if (i == buf_size) {
char in_char = read_8bit(offset+i, sf);
/* did the bytes we missed just happen to be the end of the line? */
if (in_char == 0x0d && read_8bit(offset+i+1, sf) == 0x0a) { /* CRLF */
extra_bytes = 2;
if (p_line_ok) *p_line_ok = 1;
}
else if (in_char == 0x0d || in_char == 0x0a) { /* CR or LF */
extra_bytes = 1;
if (p_line_ok) *p_line_ok = 1;
}
}
/* did we hit the file end? */
if (offset+i == file_size) {
/* then we did in fact finish reading the last line */
if (p_line_ok) *p_line_ok = 1;
}
return i + extra_bytes;
}
size_t read_bom(STREAMFILE* sf) {
if (read_u16le(0x00, sf) == 0xFFFE ||
read_u16le(0x00, sf) == 0xFEFF) {
return 0x02;
}
if ((read_u32be(0x00, sf) & 0xFFFFFF00) == 0xEFBBBF00) {
return 0x03;
}
return 0x00;
}
size_t read_string(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf) {
size_t pos;
for (pos = 0; pos < buf_size; pos++) {
uint8_t byte = read_u8(offset + pos, sf);
char c = (char)byte;
if (buf) buf[pos] = c;
if (c == '\0')
return pos;
if (pos+1 == buf_size) { /* null at maxsize and don't validate (expected to be garbage) */
if (buf) buf[pos] = '\0';
return buf_size;
}
/* UTF-8 only goes to 0x7F, but allow a bunch of Windows-1252 codes that some games use */
if (byte < 0x20 || byte > 0xF0)
goto fail;
}
fail:
if (buf) buf[0] = '\0';
return 0;
}
size_t read_string_utf16(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf, int big_endian) {
size_t pos, offpos;
uint16_t (*read_u16)(off_t,STREAMFILE*) = big_endian ? read_u16be : read_u16le;
for (pos = 0, offpos = 0; pos < buf_size; pos++, offpos += 2) {
char c = read_u16(offset + offpos, sf) & 0xFF; /* lower byte for now */
if (buf) buf[pos] = c;
if (c == '\0')
return pos;
if (pos+1 == buf_size) { /* null at maxsize and don't validate (expected to be garbage) */
if (buf) buf[pos] = '\0';
return buf_size;
}
if (c < 0x20 || (uint8_t)c > 0xA5)
goto fail;
}
fail:
if (buf) buf[0] = '\0';
return 0;
}
size_t read_string_utf16le(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf) {
return read_string_utf16(buf, buf_size, offset, sf, 0);
}
size_t read_string_utf16be(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf) {
return read_string_utf16(buf, buf_size, offset, sf, 1);
}
/* ************************************************************************* */
size_t read_key_file(uint8_t* buf, size_t buf_size, STREAMFILE* sf) {
char keyname[PATH_LIMIT];
char filename[PATH_LIMIT];
const char *path, *ext;
STREAMFILE* sf_key = NULL;
size_t keysize;
get_streamfile_name(sf, filename, sizeof(filename));
if (strlen(filename)+4 > sizeof(keyname)) goto fail;
/* try to open a keyfile using variations */
{
ext = strrchr(filename,'.');
if (ext!=NULL) ext = ext+1;
path = strrchr(filename, DIR_SEPARATOR);
if (path!=NULL) path = path+1;
/* "(name.ext)key" */
strcpy(keyname, filename);
strcat(keyname, "key");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
/* "(name.ext)KEY" */
/*
strcpy(keyname+strlen(keyname)-3,"KEY");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
*/
/* "(.ext)key" */
if (path) {
strcpy(keyname, filename);
keyname[path-filename] = '\0';
strcat(keyname, ".");
} else {
strcpy(keyname, ".");
}
if (ext) strcat(keyname, ext);
strcat(keyname, "key");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
/* "(.ext)KEY" */
/*
strcpy(keyname+strlen(keyname)-3,"KEY");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
*/
goto fail;
}
found:
keysize = get_streamfile_size(sf_key);
if (keysize > buf_size) goto fail;
if (read_streamfile(buf, 0, keysize, sf_key) != keysize)
goto fail;
close_streamfile(sf_key);
return keysize;
fail:
close_streamfile(sf_key);
return 0;
}
STREAMFILE* read_filemap_file(STREAMFILE* sf, int file_num) {
return read_filemap_file_pos(sf, file_num, NULL);
}
STREAMFILE* read_filemap_file_pos(STREAMFILE* sf, int file_num, int* p_pos) {
char filename[PATH_LIMIT];
off_t txt_offset, file_size;
STREAMFILE* sf_map = NULL;
int file_pos = 0;
sf_map = open_streamfile_by_filename(sf, ".txtm");
if (!sf_map) goto fail;
get_streamfile_filename(sf, filename, sizeof(filename));
txt_offset = read_bom(sf_map);
file_size = get_streamfile_size(sf_map);
/* read lines and find target filename, format is (filename): value1, ... valueN */
while (txt_offset < file_size) {
char line[0x2000];
char key[PATH_LIMIT] = { 0 }, val[0x2000] = { 0 };
int ok, bytes_read, line_ok;
bytes_read = read_line(line, sizeof(line), txt_offset, sf_map, &line_ok);
if (!line_ok) goto fail;
txt_offset += bytes_read;
/* get key/val (ignores lead/trailing spaces, stops at comment/separator) */
ok = sscanf(line, " %[^\t#:] : %[^\t#\r\n] ", key, val);
if (ok != 2) { /* ignore line if no key=val (comment or garbage) */
/* better way? */
if (strcmp(line, "#@reset-pos") == 0) {
file_pos = 0;
}
continue;
}
if (strcmp(key, filename) == 0) {
int n;
char subval[PATH_LIMIT];
const char* current = val;
int i;
for (i = 0; i <= file_num; i++) {
if (current[0] == '\0')
goto fail;
ok = sscanf(current, " %[^\t#\r\n,]%n ", subval, &n);
if (ok != 1)
goto fail;
if (i == file_num) {
if (p_pos) *p_pos = file_pos;
close_streamfile(sf_map);
return open_streamfile_by_filename(sf, subval);
}
current += n;
if (current[0] == ',')
current++;
}
}
file_pos++;
}
fail:
close_streamfile(sf_map);
return NULL;
}
void fix_dir_separators(char* filename) {
char c;
int i = 0;
while ((c = filename[i]) != '\0') {
if ((c == '\\' && DIR_SEPARATOR == '/') || (c == '/' && DIR_SEPARATOR == '\\'))
filename[i] = DIR_SEPARATOR;
i++;
}
}
/* ************************************************************************* */
int check_extensions(STREAMFILE* sf, const char* cmp_exts) {
@ -1378,73 +1111,6 @@ int check_extensions(STREAMFILE* sf, const char* cmp_exts) {
/* ************************************************************************* */
/**
* Find a chunk starting from an offset, and save its offset/size (if not NULL), with offset after id/size.
* Works for chunked headers in the form of "chunk_id chunk_size (data)"xN (ex. RIFF).
* The start_offset should be the first actual chunk (not "RIFF" or "WAVE" but "fmt ").
* "full_chunk_size" signals chunk_size includes 4+4+data.
*
* returns 0 on failure
*/
static int find_chunk_internal(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size, int big_endian_type, int big_endian_size, int zero_size_end) {
int32_t (*read_32bit_type)(off_t,STREAMFILE*) = big_endian_type ? read_32bitBE : read_32bitLE;
int32_t (*read_32bit_size)(off_t,STREAMFILE*) = big_endian_size ? read_32bitBE : read_32bitLE;
off_t offset, max_offset;
size_t file_size = get_streamfile_size(sf);
if (max_size == 0)
max_size = file_size;
offset = start_offset;
max_offset = offset + max_size;
if (max_offset > file_size)
max_offset = file_size;
/* read chunks */
while (offset < max_offset) {
uint32_t chunk_type = read_32bit_type(offset + 0x00,sf);
uint32_t chunk_size = read_32bit_size(offset + 0x04,sf);
if (chunk_type == 0xFFFFFFFF || chunk_size == 0xFFFFFFFF)
return 0;
if (chunk_type == chunk_id) {
if (out_chunk_offset) *out_chunk_offset = offset + 0x08;
if (out_chunk_size) *out_chunk_size = chunk_size;
return 1;
}
/* empty chunk with 0 size, seen in some formats (XVAG uses it as end marker, Wwise doesn't) */
if (chunk_size == 0 && zero_size_end)
return 0;
offset += full_chunk_size ? chunk_size : 0x08 + chunk_size;
}
return 0;
}
int find_chunk_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk(sf, chunk_id, start_offset, full_chunk_size, out_chunk_offset, out_chunk_size, 1, 0);
}
int find_chunk_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk(sf, chunk_id, start_offset, full_chunk_size, out_chunk_offset, out_chunk_size, 0, 0);
}
int find_chunk(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size, int big_endian_size, int zero_size_end) {
return find_chunk_internal(sf, chunk_id, start_offset, 0, full_chunk_size, out_chunk_offset, out_chunk_size, 1, big_endian_size, zero_size_end);
}
int find_chunk_riff_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk_internal(sf, chunk_id, start_offset, max_size, 0, out_chunk_offset, out_chunk_size, 1, 0, 0);
}
int find_chunk_riff_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk_internal(sf, chunk_id, start_offset, max_size, 0, out_chunk_offset, out_chunk_size, 1, 1, 0);
}
int find_chunk_riff_ve(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t *out_chunk_offset, size_t *out_chunk_size, int big_endian) {
return find_chunk_internal(sf, chunk_id, start_offset, max_size, 0, out_chunk_offset, out_chunk_size, big_endian, big_endian, 0);
}
/* ************************************************************************* */
/* copies name as-is (may include full path included) */
void get_streamfile_name(STREAMFILE* sf, char* buffer, size_t size) {
sf->get_name(sf, buffer, size);

View File

@ -161,214 +161,12 @@ static inline size_t get_streamfile_size(STREAMFILE* sf) {
}
/* Sometimes you just need an int, and we're doing the buffering.
* Note, however, that if these fail to read they'll return -1,
* so that should not be a valid value or there should be some backup. */
static inline int16_t read_16bitLE(off_t offset, STREAMFILE* sf) {
uint8_t buf[2];
if (read_streamfile(buf,offset,2,sf)!=2) return -1;
return get_16bitLE(buf);
}
static inline int16_t read_16bitBE(off_t offset, STREAMFILE* sf) {
uint8_t buf[2];
if (read_streamfile(buf,offset,2,sf)!=2) return -1;
return get_16bitBE(buf);
}
static inline int32_t read_32bitLE(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf,offset,4,sf)!=4) return -1;
return get_32bitLE(buf);
}
static inline int32_t read_32bitBE(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf,offset,4,sf)!=4) return -1;
return get_32bitBE(buf);
}
static inline int64_t read_64bitLE(off_t offset, STREAMFILE* sf) {
uint8_t buf[8];
if (read_streamfile(buf,offset,8,sf)!=8) return -1;
return get_64bitLE(buf);
}
static inline int64_t read_64bitBE(off_t offset, STREAMFILE* sf) {
uint8_t buf[8];
if (read_streamfile(buf,offset,8,sf)!=8) return -1;
return get_64bitBE(buf);
}
static inline int8_t read_8bit(off_t offset, STREAMFILE* sf) {
uint8_t buf[1];
if (read_streamfile(buf,offset,1,sf)!=1) return -1;
return buf[0];
}
/* alias of the above */
static inline int8_t read_s8 (off_t offset, STREAMFILE* sf) { return read_8bit(offset, sf); }
static inline uint8_t read_u8 (off_t offset, STREAMFILE* sf) { return (uint8_t) read_8bit(offset, sf); }
static inline int16_t read_s16le(off_t offset, STREAMFILE* sf) { return read_16bitLE(offset, sf); }
static inline uint16_t read_u16le(off_t offset, STREAMFILE* sf) { return (uint16_t)read_16bitLE(offset, sf); }
static inline int16_t read_s16be(off_t offset, STREAMFILE* sf) { return read_16bitBE(offset, sf); }
static inline uint16_t read_u16be(off_t offset, STREAMFILE* sf) { return (uint16_t)read_16bitBE(offset, sf); }
static inline int32_t read_s32le(off_t offset, STREAMFILE* sf) { return read_32bitLE(offset, sf); }
static inline uint32_t read_u32le(off_t offset, STREAMFILE* sf) { return (uint32_t)read_32bitLE(offset, sf); }
static inline int32_t read_s32be(off_t offset, STREAMFILE* sf) { return read_32bitBE(offset, sf); }
static inline uint32_t read_u32be(off_t offset, STREAMFILE* sf) { return (uint32_t)read_32bitBE(offset, sf); }
static inline int64_t read_s64be(off_t offset, STREAMFILE* sf) { return read_64bitBE(offset, sf); }
static inline uint64_t read_u64be(off_t offset, STREAMFILE* sf) { return (uint64_t)read_64bitBE(offset, sf); }
static inline int64_t read_s64le(off_t offset, STREAMFILE* sf) { return read_64bitLE(offset, sf); }
static inline uint64_t read_u64le(off_t offset, STREAMFILE* sf) { return (uint64_t)read_64bitLE(offset, sf); }
static inline float read_f32be(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf, offset, sizeof(buf), sf) != sizeof(buf))
return -1;
return get_f32be(buf);
}
static inline float read_f32le(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf, offset, sizeof(buf), sf) != sizeof(buf))
return -1;
return get_f32le(buf);
}
#if 0
// on GCC, this reader will be correctly optimized out (as long as it's static/inline), would be same as declaring:
// uintXX_t (*read_uXX)(off_t,uint8_t*) = be ? get_uXXbe : get_uXXle;
// only for the functions actually used in code, and inlined if possible (like big_endian param being a constant).
// on MSVC seems all read_X in sf_reader are compiled and included in the translation unit, plus ignores constants
// so may result on bloatness?
// (from godbolt tests, test more real cases)
/* collection of callbacks for quick access */
typedef struct sf_reader {
int32_t (*read_s32)(off_t,STREAMFILE*); //maybe r.s32
float (*read_f32)(off_t,STREAMFILE*);
/* ... */
} sf_reader;
static inline void sf_reader_init(sf_reader* r, int big_endian) {
memset(r, 0, sizeof(sf_reader));
if (big_endian) {
r->read_s32 = read_s32be;
r->read_f32 = read_f32be;
}
else {
r->read_s32 = read_s32le;
r->read_f32 = read_f32le;
}
}
/* sf_reader r;
* ...
* sf_reader_init(&r, big_endian);
* val = r.read_s32; //maybe r.s32?
*/
#endif
#if 0 //todo improve + test + simplify code (maybe not inline?)
static inline int read_s4h(off_t offset, STREAMFILE* sf) {
uint8_t byte = read_u8(offset, streamfile);
return get_nibble_signed(byte, 1);
}
static inline int read_u4h(off_t offset, STREAMFILE* sf) {
uint8_t byte = read_u8(offset, streamfile);
return (byte >> 4) & 0x0f;
}
static inline int read_s4l(off_t offset, STREAMFILE* sf) {
...
}
static inline int read_u4l(off_t offset, STREAMFILE* sf) {
...
}
static inline int max_s32(int32_t a, int32_t b) { return a > b ? a : b; }
static inline int min_s32(int32_t a, int32_t b) { return a < b ? a : b; }
//align32, align16, clamp16, etc
#endif
/* fastest to compare would be read_u32x == (uint32), but should be pre-optimized (see get_id32x) */
static inline /*const*/ int is_id32be(off_t offset, STREAMFILE* sf, const char* s) {
return read_u32be(offset, sf) == get_id32be(s);
}
static inline /*const*/ int is_id32le(off_t offset, STREAMFILE* sf, const char* s) {
return read_u32le(offset, sf) == get_id32be(s);
}
static inline /*const*/ int is_id64be(off_t offset, STREAMFILE* sf, const char* s) {
return read_u64be(offset, sf) == get_id64be(s);
}
//TODO: maybe move to streamfile.c
/* guess byte endianness from a given value, return true if big endian and false if little endian */
static inline int guess_endianness16bit(off_t offset, STREAMFILE* sf) {
uint8_t buf[0x02];
if (read_streamfile(buf, offset, 0x02, sf) != 0x02) return -1; /* ? */
return get_u16le(buf) > get_u16be(buf) ? 1 : 0;
}
static inline int guess_endianness32bit(off_t offset, STREAMFILE* sf) {
uint8_t buf[0x04];
if (read_streamfile(buf, offset, 0x04, sf) != 0x04) return -1; /* ? */
return get_u32le(buf) > get_u32be(buf) ? 1 : 0;
}
static inline size_t align_size_to_block(size_t value, size_t block_align) {
size_t extra_size = value % block_align;
if (extra_size == 0) return value;
return (value + block_align - extra_size);
}
/* various STREAMFILE helpers functions */
/* Read into dst a line delimited by CRLF (Windows) / LF (Unux) / CR (Mac) / EOF, null-terminated
* and without line feeds. Returns bytes read (including CR/LF), *not* the same as string length.
* p_line_ok is set to 1 if the complete line was read; pass NULL to ignore. */
size_t read_line(char* buf, int buf_size, off_t offset, STREAMFILE* sf, int* p_line_ok);
/* skip BOM if needed */
size_t read_bom(STREAMFILE* sf);
/* reads a c-string (ANSI only), up to bufsize or NULL, returning size. buf is optional (works as get_string_size). */
size_t read_string(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf);
/* reads a UTF16 string... but actually only as ANSI (discards the upper byte) */
size_t read_string_utf16(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf, int big_endian);
size_t read_string_utf16le(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf);
size_t read_string_utf16be(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf);
/* Opens a file containing decryption keys and copies to buffer.
* Tries "(name.ext)key" (per song), "(.ext)key" (per folder) keynames.
* returns size of key if found and copied */
size_t read_key_file(uint8_t* buf, size_t buf_size, STREAMFILE* sf);
/* Opens .txtm file containing file:companion file(-s) mappings and tries to see if there's a match
* then loads the associated companion file if one is found */
STREAMFILE* read_filemap_file(STREAMFILE *sf, int file_num);
STREAMFILE* read_filemap_file_pos(STREAMFILE *sf, int file_num, int* p_pos);
/* hack to allow relative paths in various OSs */
void fix_dir_separators(char* filename);
/* Checks if the stream filename is one of the extensions (comma-separated, ex. "adx" or "adx,aix").
* Empty is ok to accept files without extension ("", "adx,,aix"). Returns 0 on failure */
int check_extensions(STREAMFILE* sf, const char* cmp_exts);
/* chunk-style file helpers */
int find_chunk_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t* p_chunk_offset, size_t* p_chunk_size);
int find_chunk_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t* p_chunk_offset, size_t* p_chunk_size);
int find_chunk(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t* p_chunk_offset, size_t* p_chunk_size, int big_endian_size, int zero_size_end);
/* find a RIFF-style chunk (with chunk_size not including id and size) */
int find_chunk_riff_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t* p_chunk_offset, size_t* p_chunk_size);
int find_chunk_riff_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t* p_chunk_offset, size_t* p_chunk_size);
/* same with chunk ids in variable endianess (so instead of "fmt " has " tmf" */
int find_chunk_riff_ve(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t* p_chunk_offset, size_t* p_chunk_size, int big_endian);
/* filename helpers */
void get_streamfile_name(STREAMFILE* sf, char* buf, size_t size);
void get_streamfile_filename(STREAMFILE* sf, char* buf, size_t size);

View File

@ -1,11 +1,12 @@
/*
* streamtypes.h - widely used type definitions
*/
#ifndef _STREAMTYPES_H
#define _STREAMTYPES_H
#include <stddef.h> //size_t
#include <stdbool.h> //bool
#ifdef _MSC_VER
/* Common versions:
* - 1500: VS2008
@ -15,25 +16,24 @@
* - 1900: VS2015
* - 1920: VS2019 */
#if (_MSC_VER >= 1600)
#if (_MSC_VER >= 1600)
#include <stdint.h>
#else
#include <pstdint.h>
#endif
#include <stdint.h>
#if (_MSC_VER < 1800) && !defined(__cplusplus)
#define inline __inline
#endif
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#if (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#else
#include <pstdint.h>
#endif
#if (_MSC_VER < 1800) && !defined(__cplusplus)
#define inline __inline
#endif
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#if (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#else
#include <stdint.h>
#endif /* _MSC_VER */

View File

@ -23,86 +23,6 @@ const char* filename_extension(const char* pathname) {
return pathname + strlen(pathname);
}
void swap_extension(char* pathname, int pathname_len, const char* swap) {
char* extension = (char*)filename_extension(pathname);
//todo safeops
if (extension[0] == '\0') {
strcat(pathname, ".");
strcat(pathname, swap);
}
else {
strcpy(extension, swap);
}
}
/* unused */
/*
void interleave_channel(sample_t * outbuffer, sample_t * inbuffer, int32_t sample_count, int channel_count, int channel_number) {
int32_t insample,outsample;
if (channel_count==1) {
memcpy(outbuffer,inbuffer,sizeof(sample)*sample_count);
return;
}
for (insample=0,outsample=channel_number;insample<sample_count;insample++,outsample+=channel_count) {
outbuffer[outsample]=inbuffer[insample];
}
}
*/
/* failed attempt at interleave in place */
/*
void interleave_stereo(sample_t * buffer, int32_t sample_count) {
int32_t tomove, belongs;
sample_t moving,temp;
tomove = sample_count;
moving = buffer[tomove];
do {
if (tomove<sample_count)
belongs = tomove*2;
else
belongs = (tomove-sample_count)*2+1;
temp = buffer[belongs];
buffer[belongs] = moving;
moving = temp;
tomove = belongs;
} while (tomove != sample_count);
}
*/
void put_8bit(uint8_t * buf, int8_t i) {
buf[0] = i;
}
void put_16bitLE(uint8_t * buf, int16_t i) {
buf[0] = (i & 0xFF);
buf[1] = i >> 8;
}
void put_32bitLE(uint8_t * buf, int32_t i) {
buf[0] = (uint8_t)(i & 0xFF);
buf[1] = (uint8_t)((i >> 8) & 0xFF);
buf[2] = (uint8_t)((i >> 16) & 0xFF);
buf[3] = (uint8_t)((i >> 24) & 0xFF);
}
void put_16bitBE(uint8_t * buf, int16_t i) {
buf[0] = i >> 8;
buf[1] = (i & 0xFF);
}
void put_32bitBE(uint8_t * buf, int32_t i) {
buf[0] = (uint8_t)((i >> 24) & 0xFF);
buf[1] = (uint8_t)((i >> 16) & 0xFF);
buf[2] = (uint8_t)((i >> 8) & 0xFF);
buf[3] = (uint8_t)(i & 0xFF);
}
int round10(int val) {
int round_val = val % 10;
@ -112,25 +32,6 @@ int round10(int val) {
return val + (10 - round_val);
}
void swap_samples_le(sample_t *buf, int count) {
/* Windows can't be BE... I think */
#if !defined(_WIN32)
#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
int i;
for (i = 0; i < count; i++) {
/* 16b sample in memory: aabb where aa=MSB, bb=LSB */
uint8_t b0 = buf[i] & 0xff;
uint8_t b1 = buf[i] >> 8;
uint8_t *p = (uint8_t*)&(buf[i]);
/* 16b sample in buffer: bbaa where bb=LSB, aa=MSB */
p[0] = b0;
p[1] = b1;
/* when endianness is LE, buffer has bbaa already so this function can be skipped */
}
#endif
#endif
}
/* length is maximum length of dst. dst will always be null-terminated if
* length > 0 */
void concatn(int length, char * dst, const char * src) {
@ -141,3 +42,12 @@ void concatn(int length, char * dst, const char * src) {
dst[i]=src[j];
dst[i]='\0';
}
size_t align_size_to_block(size_t value, size_t block_align) {
if (!block_align)
return 0;
size_t extra_size = value % block_align;
if (extra_size == 0) return value;
return (value + block_align - extra_size);
}

View File

@ -1,142 +1,19 @@
/*
* util.h - utility functions
*/
#include "streamtypes.h"
#ifndef _UTIL_H
#define _UTIL_H
/* very common functions, so static (inline) in .h as compiler can optimize to avoid some call overhead */
/* host endian independent multi-byte integer reading */
static inline int16_t get_16bitBE(const uint8_t* p) {
return ((uint16_t)p[0]<<8) | ((uint16_t)p[1]);
}
static inline int16_t get_16bitLE(const uint8_t* p) {
return ((uint16_t)p[0]) | ((uint16_t)p[1]<<8);
}
static inline int32_t get_32bitBE(const uint8_t* p) {
return ((uint32_t)p[0]<<24) | ((uint32_t)p[1]<<16) | ((uint32_t)p[2]<<8) | ((uint32_t)p[3]);
}
static inline int32_t get_32bitLE(const uint8_t* p) {
return ((uint32_t)p[0]) | ((uint32_t)p[1]<<8) | ((uint32_t)p[2]<<16) | ((uint32_t)p[3]<<24);
}
static inline int64_t get_64bitBE(const uint8_t* p) {
return (uint64_t)(((uint64_t)p[0]<<56) | ((uint64_t)p[1]<<48) | ((uint64_t)p[2]<<40) | ((uint64_t)p[3]<<32) | ((uint64_t)p[4]<<24) | ((uint64_t)p[5]<<16) | ((uint64_t)p[6]<<8) | ((uint64_t)p[7]));
}
static inline int64_t get_64bitLE(const uint8_t* p) {
return (uint64_t)(((uint64_t)p[0]) | ((uint64_t)p[1]<<8) | ((uint64_t)p[2]<<16) | ((uint64_t)p[3]<<24) | ((uint64_t)p[4]<<32) | ((uint64_t)p[5]<<40) | ((uint64_t)p[6]<<48) | ((uint64_t)p[7]<<56));
}
/* alias of the above */
static inline int8_t get_s8 (const uint8_t* p) { return ( int8_t)p[0]; }
static inline uint8_t get_u8 (const uint8_t* p) { return (uint8_t)p[0]; }
static inline int16_t get_s16le(const uint8_t* p) { return ( int16_t)get_16bitLE(p); }
static inline uint16_t get_u16le(const uint8_t* p) { return (uint16_t)get_16bitLE(p); }
static inline int16_t get_s16be(const uint8_t* p) { return ( int16_t)get_16bitBE(p); }
static inline uint16_t get_u16be(const uint8_t* p) { return (uint16_t)get_16bitBE(p); }
static inline int32_t get_s32le(const uint8_t* p) { return ( int32_t)get_32bitLE(p); }
static inline uint32_t get_u32le(const uint8_t* p) { return (uint32_t)get_32bitLE(p); }
static inline int32_t get_s32be(const uint8_t* p) { return ( int32_t)get_32bitBE(p); }
static inline uint32_t get_u32be(const uint8_t* p) { return (uint32_t)get_32bitBE(p); }
static inline int64_t get_s64le(const uint8_t* p) { return ( int64_t)get_64bitLE(p); }
static inline uint64_t get_u64le(const uint8_t* p) { return (uint64_t)get_64bitLE(p); }
static inline int64_t get_s64be(const uint8_t* p) { return ( int64_t)get_64bitBE(p); }
static inline uint64_t get_u64be(const uint8_t* p) { return (uint64_t)get_64bitBE(p); }
/* The recommended int-to-float type punning in C is through union, but pointer casting
* works too (though less portable due to aliasing rules?). For C++ memcpy seems
* recommended. Both work in GCC and VS2015+ (not sure about older, ifdef as needed). */
static inline float get_f32be(const uint8_t* p) {
union {
uint32_t u32;
float f32;
} temp;
temp.u32 = get_u32be(p);
return temp.f32;
}
static inline float get_f32le(const uint8_t* p) {
union {
uint32_t u32;
float f32;
} temp;
temp.u32 = get_u32le(p);
return temp.f32;
}
static inline double get_d64be(const uint8_t* p) {
union {
uint64_t u64;
double d64;
} temp;
temp.u64 = get_u64be(p);
return temp.d64;
}
static inline double get_d64le(const uint8_t* p) {
union {
uint64_t u64;
double d64;
} temp;
temp.u64 = get_u64le(p);
return temp.d64;
}
#if 0
static inline float get_f32be_cast(const uint8_t* p) {
uint32_t sample_int = get_u32be(p);
float* sample_float = (float*)&sample_int;
return *sample_float;
}
static inline float get_f32be_mcpy(const uint8_t* p) {
uint32_t sample_int = get_u32be(p);
float sample_float;
memcpy(&sample_float, &sample_int, sizeof(uint32_t));
return sample_float;
}
#include "streamtypes.h"
#ifdef BUILD_VGMSTREAM
#include "util/reader_get.h"
#include "util/reader_put.h"
#else
#include <libvgmstream/reader_get.h>
#include <libvgmstream/reader_put.h>
#endif
void put_8bit(uint8_t* buf, int8_t i);
void put_16bitLE(uint8_t* buf, int16_t i);
void put_32bitLE(uint8_t* buf, int32_t i);
void put_16bitBE(uint8_t* buf, int16_t i);
void put_32bitBE(uint8_t* buf, int32_t i);
/* alias of the above */ //TODO: improve
#define put_u8 put_8bit
#define put_u16le put_16bitLE
#define put_u32le put_32bitLE
#define put_u16be put_16bitBE
#define put_u32be put_32bitBE
#define put_s8 put_8bit
#define put_s16le put_16bitLE
#define put_s32le put_32bitLE
#define put_s16be put_16bitBE
#define put_s32be put_32bitBE
/* signed nibbles come up a lot */
static int nibble_to_int[16] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1};
static inline int get_nibble_signed(uint8_t n, int upper) {
/*return ((n&0x70)-(n&0x80))>>4;*/
return nibble_to_int[(n >> (upper?4:0)) & 0x0f];
}
static inline int get_high_nibble_signed(uint8_t n) {
/*return ((n&0x70)-(n&0x80))>>4;*/
return nibble_to_int[n>>4];
}
static inline int get_low_nibble_signed(uint8_t n) {
/*return (n&7)-(n&8);*/
return nibble_to_int[n&0xf];
}
/* very common functions, so static (inline) in .h as compiler can optimize to avoid some call overhead */
static inline int clamp16(int32_t val) {
if (val > 32767) return 32767;
@ -177,12 +54,8 @@ int round10(int val);
* extension in the original filename or the ending null byte if no extension */
const char* filename_extension(const char* pathname);
/* change pathname's extension to another (or add it if extensionless) */
void swap_extension(char* pathname, /*size_t*/ int pathname_len, const char* swap);
/* swap samples in machine endianness to little endian (useful to write .wav) */
void swap_samples_le(sample_t *buf, int count);
void concatn(int length, char * dst, const char * src);
size_t align_size_to_block(size_t value, size_t block_align);
#endif

View File

@ -1,8 +1,11 @@
#ifndef _VORBIS_BITREADER_H
#define _VORBIS_BITREADER_H
#ifndef _BITSTREAM_LSB_H
#define _BITSTREAM_LSB_H
/* Simple bitreader for Vorbis' bit format.
* Kept in .h since it's slightly faster (compiler can optimize statics better) */
#include "../streamtypes.h"
/* Simple bitreader for Vorbis' bit style, in 'least significant byte' (LSB) format.
* Example: 0x12345678 is read as 12,34,56,78 (continuous).
* Kept in .h since it's slightly faster (compiler can optimize statics better using default compile flags). */
typedef struct {
@ -12,7 +15,7 @@ typedef struct {
} bitstream_t;
/* convenience util */
static void init_bitstream(bitstream_t* b, uint8_t* buf, size_t bufsize) {
static inline void bl_setup(bitstream_t* b, uint8_t* buf, size_t bufsize) {
b->buf = buf;
b->bufsize = bufsize;
b->b_off = 0;
@ -29,7 +32,7 @@ static const uint32_t MASK_TABLE[33] = {
/* Read bits (max 32) from buf and update the bit offset. Vorbis packs values in LSB order and byte by byte.
* (ex. from 2 bytes 00100111 00000001 we can could read 4b=0111 and 6b=010010, 6b=remainder (second value is split into the 2nd byte) */
static int rv_bits(bitstream_t* ib, uint32_t bits, uint32_t* value) {
static inline int bl_get(bitstream_t* ib, uint32_t bits, uint32_t* value) {
uint32_t shift, mask, pos, val;
if (bits > 32 || ib->b_off + bits > ib->bufsize * 8)
@ -59,15 +62,14 @@ static int rv_bits(bitstream_t* ib, uint32_t bits, uint32_t* value) {
return 1;
fail:
VGM_LOG_ONCE("BITREADER: read fail\n");
//VGM_LOG_ONCE("BITREADER: read fail\n");
*value = 0;
return 0;
}
#ifndef BITSTREAM_READ_ONLY
/* Write bits (max 32) to buf and update the bit offset. Vorbis packs values in LSB order and byte by byte.
* (ex. writing 1101011010 from b_off 2 we get 01101011 00001101 (value split, and 11 in the first byte skipped)*/
static int wv_bits(bitstream_t* ob, uint32_t bits, uint32_t value) {
static inline int bl_put(bitstream_t* ob, uint32_t bits, uint32_t value) {
uint32_t shift, mask, pos;
if (bits > 32 || ob->b_off + bits > ob->bufsize*8)
@ -95,9 +97,8 @@ static int wv_bits(bitstream_t* ob, uint32_t bits, uint32_t value) {
ob->b_off += bits;
return 1;
fail:
VGM_LOG_ONCE("BITREADER: write fail\n");
//VGM_LOG_ONCE("BITREADER: write fail\n");
return 0;
}
#endif
#endif

View File

@ -1,10 +1,11 @@
#ifndef _BITSTREAM_MSB_H
#define _BITSTREAM_MSB_H
#include <stdint.h>
#include "../streamtypes.h"
/* Simple bitreader for MPEG/standard bit format.
* Kept in .h since it's slightly faster (compiler can optimize better) */
/* Simple bitreader for MPEG/standard bit style, in 'most significant byte' (MSB) format.
* Example: 0x12345678 is read as 78,56,34,12 then each byte's bits.
* Kept in .h since it's slightly faster (compiler can optimize statics better using default compile flags). */
typedef struct {
uint8_t* buf; /* buffer to read/write */
@ -70,6 +71,7 @@ static inline int bm_get(bitstream_t* ib, uint32_t bits, uint32_t* value) {
pos = ib->b_off / 8; /* byte offset */
shift = ib->b_off % 8; /* bit sub-offset */
#if 1 //naive approach
val = 0;
for (i = 0; i < bits; i++) {
bit_buf = (1U << (8-1-shift)) & 0xFF; /* bit check for buf */
@ -84,6 +86,35 @@ static inline int bm_get(bitstream_t* ib, uint32_t bits, uint32_t* value) {
pos++;
}
}
#else //has bugs
pos = ib->b_off / 8; /* byte offset */
shift = ib->b_off % 8; /* bit sub-offset */
uint32_t mask = MASK_TABLE[bits]; /* to remove upper in highest byte */
int left = 0;
if (bits == 0)
val = 0;
else
val = ib->buf[pos+0];
left = 8 - (bits + shift);
if (bits + shift > 8) {
val = (val << 8u) | ib->buf[pos+1];
left = 16 - (bits + shift);
if (bits + shift > 16) {
val = (val << 8u) | ib->buf[pos+2];
left = 32 - (bits + shift);
if (bits + shift > 24) {
val = (val << 8u) | ib->buf[pos+3];
left = 32 - (bits + shift);
if (bits + shift > 32) {
val = (val << 8u) | ib->buf[pos+4]; /* upper bits are lost (shifting over 32) */ TO-DO
left = 40 - (bits + shift);
}
}
}
}
val = ((val >> left) & mask);
#endif
*value = val;
ib->b_off += bits;

View File

@ -0,0 +1,49 @@
#ifndef _CHANNEL_MAPPING_H
#define _CHANNEL_MAPPING_H
/* standard WAVEFORMATEXTENSIBLE speaker positions */
typedef enum {
speaker_FL = (1 << 0), /* front left */
speaker_FR = (1 << 1), /* front right */
speaker_FC = (1 << 2), /* front center */
speaker_LFE = (1 << 3), /* low frequency effects */
speaker_BL = (1 << 4), /* back left */
speaker_BR = (1 << 5), /* back right */
speaker_FLC = (1 << 6), /* front left center */
speaker_FRC = (1 << 7), /* front right center */
speaker_BC = (1 << 8), /* back center */
speaker_SL = (1 << 9), /* side left */
speaker_SR = (1 << 10), /* side right */
speaker_TC = (1 << 11), /* top center*/
speaker_TFL = (1 << 12), /* top front left */
speaker_TFC = (1 << 13), /* top front center */
speaker_TFR = (1 << 14), /* top front right */
speaker_TBL = (1 << 15), /* top back left */
speaker_TBC = (1 << 16), /* top back center */
speaker_TBR = (1 << 17), /* top back left */
} speaker_t;
/* typical mappings that metas may use to set channel_layout (but plugin must actually use it)
* (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR)
* not too sure about names but no clear standards */
typedef enum {
mapping_MONO = speaker_FC,
mapping_STEREO = speaker_FL | speaker_FR,
mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE,
mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */
mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR,
mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC,
mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR,
mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR,
mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR,
mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR,
mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR,
mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR,
mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC,
mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC,
mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR,
} channel_mapping_t;
#endif

View File

@ -1,5 +1,5 @@
#include "chunks.h"
//#include "log.h"
#include "reader_sf.h"
int next_chunk(chunk_t* chunk, STREAMFILE* sf) {
@ -33,3 +33,71 @@ int next_chunk(chunk_t* chunk, STREAMFILE* sf) {
/* more chunks remain */
return 1;
}
/* ************************************************************************* */
/**
* Find a chunk starting from an offset, and save its offset/size (if not NULL), with offset after id/size.
* Works for chunked headers in the form of "chunk_id chunk_size (data)"xN (ex. RIFF).
* The start_offset should be the first actual chunk (not "RIFF" or "WAVE" but "fmt ").
* "full_chunk_size" signals chunk_size includes 4+4+data.
*
* returns 0 on failure
*/
static int find_chunk_internal(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size, int big_endian_type, int big_endian_size, int zero_size_end) {
int32_t (*read_32bit_type)(off_t,STREAMFILE*) = big_endian_type ? read_32bitBE : read_32bitLE;
int32_t (*read_32bit_size)(off_t,STREAMFILE*) = big_endian_size ? read_32bitBE : read_32bitLE;
off_t offset, max_offset;
size_t file_size = get_streamfile_size(sf);
if (max_size == 0)
max_size = file_size;
offset = start_offset;
max_offset = offset + max_size;
if (max_offset > file_size)
max_offset = file_size;
/* read chunks */
while (offset < max_offset) {
uint32_t chunk_type = read_32bit_type(offset + 0x00,sf);
uint32_t chunk_size = read_32bit_size(offset + 0x04,sf);
if (chunk_type == 0xFFFFFFFF || chunk_size == 0xFFFFFFFF)
return 0;
if (chunk_type == chunk_id) {
if (out_chunk_offset) *out_chunk_offset = offset + 0x08;
if (out_chunk_size) *out_chunk_size = chunk_size;
return 1;
}
/* empty chunk with 0 size, seen in some formats (XVAG uses it as end marker, Wwise doesn't) */
if (chunk_size == 0 && zero_size_end)
return 0;
offset += full_chunk_size ? chunk_size : 0x08 + chunk_size;
}
return 0;
}
int find_chunk_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk(sf, chunk_id, start_offset, full_chunk_size, out_chunk_offset, out_chunk_size, 1, 0);
}
int find_chunk_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk(sf, chunk_id, start_offset, full_chunk_size, out_chunk_offset, out_chunk_size, 0, 0);
}
int find_chunk(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size, int big_endian_size, int zero_size_end) {
return find_chunk_internal(sf, chunk_id, start_offset, 0, full_chunk_size, out_chunk_offset, out_chunk_size, 1, big_endian_size, zero_size_end);
}
int find_chunk_riff_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk_internal(sf, chunk_id, start_offset, max_size, 0, out_chunk_offset, out_chunk_size, 1, 0, 0);
}
int find_chunk_riff_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t *out_chunk_offset, size_t *out_chunk_size) {
return find_chunk_internal(sf, chunk_id, start_offset, max_size, 0, out_chunk_offset, out_chunk_size, 1, 1, 0);
}
int find_chunk_riff_ve(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t *out_chunk_offset, size_t *out_chunk_size, int big_endian) {
return find_chunk_internal(sf, chunk_id, start_offset, max_size, 0, out_chunk_offset, out_chunk_size, big_endian, big_endian, 0);
}

View File

@ -26,4 +26,16 @@ enum {
};
#endif
/* chunk-style file helpers (the above is more performant, this is mainly for quick checks) */
int find_chunk_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t* p_chunk_offset, size_t* p_chunk_size);
int find_chunk_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t* p_chunk_offset, size_t* p_chunk_size);
int find_chunk(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t* p_chunk_offset, size_t* p_chunk_size, int big_endian_size, int zero_size_end);
/* find a RIFF-style chunk (with chunk_size not including id and size) */
int find_chunk_riff_le(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t* p_chunk_offset, size_t* p_chunk_size);
int find_chunk_riff_be(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t* p_chunk_offset, size_t* p_chunk_size);
/* same with chunk ids in variable endianess (so instead of "fmt " has " tmf" */
int find_chunk_riff_ve(STREAMFILE* sf, uint32_t chunk_id, off_t start_offset, size_t max_size, off_t* p_chunk_offset, size_t* p_chunk_size, int big_endian);
#endif

View File

@ -0,0 +1,149 @@
#include "companion_files.h"
#include "paths.h"
#include "../vgmstream.h"
#include "../util/reader_text.h"
size_t read_key_file(uint8_t* buf, size_t buf_size, STREAMFILE* sf) {
char keyname[PATH_LIMIT];
char filename[PATH_LIMIT];
const char *path, *ext;
STREAMFILE* sf_key = NULL;
size_t keysize;
get_streamfile_name(sf, filename, sizeof(filename));
if (strlen(filename)+4 > sizeof(keyname)) goto fail;
/* try to open a keyfile using variations */
{
ext = strrchr(filename,'.');
if (ext!=NULL) ext = ext+1;
path = strrchr(filename, DIR_SEPARATOR);
if (path!=NULL) path = path+1;
/* "(name.ext)key" */
strcpy(keyname, filename);
strcat(keyname, "key");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
/* "(name.ext)KEY" */
/*
strcpy(keyname+strlen(keyname)-3,"KEY");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
*/
/* "(.ext)key" */
if (path) {
strcpy(keyname, filename);
keyname[path-filename] = '\0';
strcat(keyname, ".");
} else {
strcpy(keyname, ".");
}
if (ext) strcat(keyname, ext);
strcat(keyname, "key");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
/* "(.ext)KEY" */
/*
strcpy(keyname+strlen(keyname)-3,"KEY");
sf_key = sf->open(sf, keyname, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (sf_key) goto found;
*/
goto fail;
}
found:
keysize = get_streamfile_size(sf_key);
if (keysize > buf_size) goto fail;
if (read_streamfile(buf, 0, keysize, sf_key) != keysize)
goto fail;
close_streamfile(sf_key);
return keysize;
fail:
close_streamfile(sf_key);
return 0;
}
STREAMFILE* read_filemap_file(STREAMFILE* sf, int file_num) {
return read_filemap_file_pos(sf, file_num, NULL);
}
STREAMFILE* read_filemap_file_pos(STREAMFILE* sf, int file_num, int* p_pos) {
char filename[PATH_LIMIT];
off_t txt_offset, file_size;
STREAMFILE* sf_map = NULL;
int file_pos = 0;
sf_map = open_streamfile_by_filename(sf, ".txtm");
if (!sf_map) goto fail;
get_streamfile_filename(sf, filename, sizeof(filename));
txt_offset = read_bom(sf_map);
file_size = get_streamfile_size(sf_map);
/* read lines and find target filename, format is (filename): value1, ... valueN */
while (txt_offset < file_size) {
char line[0x2000];
char key[PATH_LIMIT] = { 0 }, val[0x2000] = { 0 };
int ok, bytes_read, line_ok;
bytes_read = read_line(line, sizeof(line), txt_offset, sf_map, &line_ok);
if (!line_ok) goto fail;
txt_offset += bytes_read;
/* get key/val (ignores lead/trailing spaces, stops at comment/separator) */
ok = sscanf(line, " %[^\t#:] : %[^\t#\r\n] ", key, val);
if (ok != 2) { /* ignore line if no key=val (comment or garbage) */
/* better way? */
if (strcmp(line, "#@reset-pos") == 0) {
file_pos = 0;
}
continue;
}
if (strcmp(key, filename) == 0) {
int n;
char subval[PATH_LIMIT];
const char* current = val;
int i;
for (i = 0; i <= file_num; i++) {
if (current[0] == '\0')
goto fail;
ok = sscanf(current, " %[^\t#\r\n,]%n ", subval, &n);
if (ok != 1)
goto fail;
if (i == file_num) {
if (p_pos) *p_pos = file_pos;
close_streamfile(sf_map);
return open_streamfile_by_filename(sf, subval);
}
current += n;
if (current[0] == ',')
current++;
}
}
file_pos++;
}
fail:
close_streamfile(sf_map);
return NULL;
}

View File

@ -0,0 +1,16 @@
#ifndef _COMPANION_FILES_H
#define _COMPANION_FILES_H
#include "../streamfile.h"
/* Opens a file containing decryption keys and copies to buffer.
* Tries "(name.ext)key" (per song), "(.ext)key" (per folder) keynames.
* returns size of key if found and copied */
size_t read_key_file(uint8_t* buf, size_t buf_size, STREAMFILE* sf);
/* Opens .txtm file containing file:companion file(-s) mappings and tries to see if there's a match
* then loads the associated companion file if one is found */
STREAMFILE* read_filemap_file(STREAMFILE *sf, int file_num);
STREAMFILE* read_filemap_file_pos(STREAMFILE *sf, int file_num, int* p_pos);
#endif

View File

@ -1,5 +1,6 @@
#include "cri_utf.h"
#include "log.h"
#include "reader_sf.h"
#define UTF_MAX_SCHEMA_SIZE 0x8000 /* arbitrary max */
#define COLUMN_BITMASK_FLAG 0xf0

View File

@ -2,6 +2,7 @@
#define _UTIL_ENDIAN_H
#include "../streamfile.h"
#include "reader_get.h"
typedef uint32_t (*read_u32_t)(off_t, STREAMFILE*);
typedef int32_t (*read_s32_t)(off_t, STREAMFILE*);
@ -11,8 +12,17 @@ typedef float (*read_f32_t)(off_t, STREAMFILE*);
typedef int16_t (*get_s16_t)(const uint8_t*);
//todo move here
#define guess_endian32 guess_endianness32bit
#define guess_endian16 guess_endianness16bit
/* guess byte endianness from a given value, return true if big endian and false if little endian */
static inline int guess_endian16(off_t offset, STREAMFILE* sf) {
uint8_t buf[0x02];
if (read_streamfile(buf, offset, 0x02, sf) != 0x02) return -1; /* ? */
return get_u16le(buf) > get_u16be(buf) ? 1 : 0;
}
static inline int guess_endian32(off_t offset, STREAMFILE* sf) {
uint8_t buf[0x04];
if (read_streamfile(buf, offset, 0x04, sf) != 0x04) return -1; /* ? */
return get_u32le(buf) > get_u32be(buf) ? 1 : 0;
}
#endif

View File

@ -0,0 +1,11 @@
#include "paths.h"
void fix_dir_separators(char* filename) {
char c;
int i = 0;
while ((c = filename[i]) != '\0') {
if ((c == '\\' && DIR_SEPARATOR == '/') || (c == '/' && DIR_SEPARATOR == '\\'))
filename[i] = DIR_SEPARATOR;
i++;
}
}

View File

@ -0,0 +1,17 @@
#ifndef _PATHS_H
#define _PATHS_H
#ifndef DIR_SEPARATOR
#if defined (_WIN32) || defined (WIN32)
#define DIR_SEPARATOR '\\'
#else
#define DIR_SEPARATOR '/'
#endif
#endif
/* hack to allow relative paths in various OSs */
void fix_dir_separators(char* filename);
//const char* filename_extension(const char* pathname);
#endif

View File

@ -0,0 +1,149 @@
#include "reader_put.h"
#include "reader_text.h"
#include "reader_sf.h"
#include "endianness.h"
void put_8bit(uint8_t* buf, int8_t i) {
buf[0] = i;
}
void put_16bitLE(uint8_t* buf, int16_t i) {
buf[0] = (i & 0xFF);
buf[1] = i >> 8;
}
void put_32bitLE(uint8_t* buf, int32_t i) {
buf[0] = (uint8_t)(i & 0xFF);
buf[1] = (uint8_t)((i >> 8) & 0xFF);
buf[2] = (uint8_t)((i >> 16) & 0xFF);
buf[3] = (uint8_t)((i >> 24) & 0xFF);
}
void put_16bitBE(uint8_t* buf, int16_t i) {
buf[0] = i >> 8;
buf[1] = (i & 0xFF);
}
void put_32bitBE(uint8_t* buf, int32_t i) {
buf[0] = (uint8_t)((i >> 24) & 0xFF);
buf[1] = (uint8_t)((i >> 16) & 0xFF);
buf[2] = (uint8_t)((i >> 8) & 0xFF);
buf[3] = (uint8_t)(i & 0xFF);
}
/* **************************************************** */
size_t read_line(char* buf, int buf_size, off_t offset, STREAMFILE* sf, int* p_line_ok) {
int i;
off_t file_size = get_streamfile_size(sf);
int extra_bytes = 0; /* how many bytes over those put in the buffer were read */
if (p_line_ok) *p_line_ok = 0;
for (i = 0; i < buf_size-1 && offset+i < file_size; i++) {
char in_char = read_8bit(offset+i, sf);
/* check for end of line */
if (in_char == 0x0d && read_8bit(offset+i+1, sf) == 0x0a) { /* CRLF */
extra_bytes = 2;
if (p_line_ok) *p_line_ok = 1;
break;
}
else if (in_char == 0x0d || in_char == 0x0a) { /* CR or LF */
extra_bytes = 1;
if (p_line_ok) *p_line_ok = 1;
break;
}
buf[i] = in_char;
}
buf[i] = '\0';
/* did we fill the buffer? */
if (i == buf_size) {
char in_char = read_8bit(offset+i, sf);
/* did the bytes we missed just happen to be the end of the line? */
if (in_char == 0x0d && read_8bit(offset+i+1, sf) == 0x0a) { /* CRLF */
extra_bytes = 2;
if (p_line_ok) *p_line_ok = 1;
}
else if (in_char == 0x0d || in_char == 0x0a) { /* CR or LF */
extra_bytes = 1;
if (p_line_ok) *p_line_ok = 1;
}
}
/* did we hit the file end? */
if (offset+i == file_size) {
/* then we did in fact finish reading the last line */
if (p_line_ok) *p_line_ok = 1;
}
return i + extra_bytes;
}
size_t read_bom(STREAMFILE* sf) {
if (read_u16le(0x00, sf) == 0xFFFE ||
read_u16le(0x00, sf) == 0xFEFF) {
return 0x02;
}
if ((read_u32be(0x00, sf) & 0xFFFFFF00) == 0xEFBBBF00) {
return 0x03;
}
return 0x00;
}
size_t read_string(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf) {
size_t pos;
for (pos = 0; pos < buf_size; pos++) {
uint8_t byte = read_u8(offset + pos, sf);
char c = (char)byte;
if (buf) buf[pos] = c;
if (c == '\0')
return pos;
if (pos+1 == buf_size) { /* null at maxsize and don't validate (expected to be garbage) */
if (buf) buf[pos] = '\0';
return buf_size;
}
/* UTF-8 only goes to 0x7F, but allow a bunch of Windows-1252 codes that some games use */
if (byte < 0x20 || byte > 0xF0)
goto fail;
}
fail:
if (buf) buf[0] = '\0';
return 0;
}
size_t read_string_utf16(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf, int big_endian) {
size_t pos, offpos;
read_u16_t read_u16 = big_endian ? read_u16be : read_u16le;
for (pos = 0, offpos = 0; pos < buf_size; pos++, offpos += 2) {
char c = read_u16(offset + offpos, sf) & 0xFF; /* lower byte for now */
if (buf) buf[pos] = c;
if (c == '\0')
return pos;
if (pos+1 == buf_size) { /* null at maxsize and don't validate (expected to be garbage) */
if (buf) buf[pos] = '\0';
return buf_size;
}
if (c < 0x20 || (uint8_t)c > 0xA5)
goto fail;
}
fail:
if (buf) buf[0] = '\0';
return 0;
}
size_t read_string_utf16le(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf) {
return read_string_utf16(buf, buf_size, offset, sf, 0);
}
size_t read_string_utf16be(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf) {
return read_string_utf16(buf, buf_size, offset, sf, 1);
}

View File

@ -0,0 +1,104 @@
#ifndef _READER_GET_H
#define _READER_GET_H
#ifdef BUILD_VGMSTREAM
#include "../streamtypes.h"
#else
#include <libvgmstream/streamtypes.h>
#endif
/* very common functions, so static (inline) in .h as compiler can optimize to avoid some call overhead */
/* host endian independent multi-byte integer reading */
static inline int16_t get_16bitBE(const uint8_t* p) {
return ((uint16_t)p[0]<<8) | ((uint16_t)p[1]);
}
static inline int16_t get_16bitLE(const uint8_t* p) {
return ((uint16_t)p[0]) | ((uint16_t)p[1]<<8);
}
static inline int32_t get_32bitBE(const uint8_t* p) {
return ((uint32_t)p[0]<<24) | ((uint32_t)p[1]<<16) | ((uint32_t)p[2]<<8) | ((uint32_t)p[3]);
}
static inline int32_t get_32bitLE(const uint8_t* p) {
return ((uint32_t)p[0]) | ((uint32_t)p[1]<<8) | ((uint32_t)p[2]<<16) | ((uint32_t)p[3]<<24);
}
static inline int64_t get_64bitBE(const uint8_t* p) {
return (uint64_t)(((uint64_t)p[0]<<56) | ((uint64_t)p[1]<<48) | ((uint64_t)p[2]<<40) | ((uint64_t)p[3]<<32) | ((uint64_t)p[4]<<24) | ((uint64_t)p[5]<<16) | ((uint64_t)p[6]<<8) | ((uint64_t)p[7]));
}
static inline int64_t get_64bitLE(const uint8_t* p) {
return (uint64_t)(((uint64_t)p[0]) | ((uint64_t)p[1]<<8) | ((uint64_t)p[2]<<16) | ((uint64_t)p[3]<<24) | ((uint64_t)p[4]<<32) | ((uint64_t)p[5]<<40) | ((uint64_t)p[6]<<48) | ((uint64_t)p[7]<<56));
}
/* alias of the above */
static inline int8_t get_s8 (const uint8_t* p) { return ( int8_t)p[0]; }
static inline uint8_t get_u8 (const uint8_t* p) { return (uint8_t)p[0]; }
static inline int16_t get_s16le(const uint8_t* p) { return ( int16_t)get_16bitLE(p); }
static inline uint16_t get_u16le(const uint8_t* p) { return (uint16_t)get_16bitLE(p); }
static inline int16_t get_s16be(const uint8_t* p) { return ( int16_t)get_16bitBE(p); }
static inline uint16_t get_u16be(const uint8_t* p) { return (uint16_t)get_16bitBE(p); }
static inline int32_t get_s32le(const uint8_t* p) { return ( int32_t)get_32bitLE(p); }
static inline uint32_t get_u32le(const uint8_t* p) { return (uint32_t)get_32bitLE(p); }
static inline int32_t get_s32be(const uint8_t* p) { return ( int32_t)get_32bitBE(p); }
static inline uint32_t get_u32be(const uint8_t* p) { return (uint32_t)get_32bitBE(p); }
static inline int64_t get_s64le(const uint8_t* p) { return ( int64_t)get_64bitLE(p); }
static inline uint64_t get_u64le(const uint8_t* p) { return (uint64_t)get_64bitLE(p); }
static inline int64_t get_s64be(const uint8_t* p) { return ( int64_t)get_64bitBE(p); }
static inline uint64_t get_u64be(const uint8_t* p) { return (uint64_t)get_64bitBE(p); }
/* The recommended int-to-float type punning in C is through union, but pointer casting
* works too (though less portable due to aliasing rules?). For C++ memcpy seems
* recommended. Both work in GCC and VS2015+ (not sure about older, ifdef as needed). */
static inline float get_f32be(const uint8_t* p) {
union {
uint32_t u32;
float f32;
} temp;
temp.u32 = get_u32be(p);
return temp.f32;
}
static inline float get_f32le(const uint8_t* p) {
union {
uint32_t u32;
float f32;
} temp;
temp.u32 = get_u32le(p);
return temp.f32;
}
static inline double get_d64be(const uint8_t* p) {
union {
uint64_t u64;
double d64;
} temp;
temp.u64 = get_u64be(p);
return temp.d64;
}
static inline double get_d64le(const uint8_t* p) {
union {
uint64_t u64;
double d64;
} temp;
temp.u64 = get_u64le(p);
return temp.d64;
}
#if 0
static inline float get_f32be_cast(const uint8_t* p) {
uint32_t sample_int = get_u32be(p);
float* sample_float = (float*)&sample_int;
return *sample_float;
}
static inline float get_f32be_mcpy(const uint8_t* p) {
uint32_t sample_int = get_u32be(p);
float sample_float;
memcpy(&sample_float, &sample_int, sizeof(uint32_t));
return sample_float;
}
#endif
#endif

View File

@ -0,0 +1,25 @@
#ifndef _READER_GET_NIBBLES_H
#define _READER_GET_NIBBLES_H
#include "../streamtypes.h"
/* signed nibbles come up a lot in decoders */
static int nibble_to_int[16] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1};
static inline int get_nibble_signed(uint8_t n, int upper) {
/*return ((n&0x70)-(n&0x80))>>4;*/
return nibble_to_int[(n >> (upper?4:0)) & 0x0f];
}
static inline int get_high_nibble_signed(uint8_t n) {
/*return ((n&0x70)-(n&0x80))>>4;*/
return nibble_to_int[n>>4];
}
static inline int get_low_nibble_signed(uint8_t n) {
/*return (n&7)-(n&8);*/
return nibble_to_int[n&0xf];
}
#endif

View File

@ -0,0 +1,29 @@
#ifndef _READER_PUT_H
#define _READER_PUT_H
#ifdef BUILD_VGMSTREAM
#include "../streamtypes.h"
#else
#include <libvgmstream/streamtypes.h>
#endif
void put_8bit(uint8_t* buf, int8_t i);
void put_16bitLE(uint8_t* buf, int16_t i);
void put_32bitLE(uint8_t* buf, int32_t i);
void put_16bitBE(uint8_t* buf, int16_t i);
void put_32bitBE(uint8_t* buf, int32_t i);
/* alias of the above */ //TODO: improve
#define put_u8 put_8bit
#define put_u16le put_16bitLE
#define put_u32le put_32bitLE
#define put_u16be put_16bitBE
#define put_u32be put_32bitBE
#define put_s8 put_8bit
#define put_s16le put_16bitLE
#define put_s32le put_32bitLE
#define put_s16be put_16bitBE
#define put_s32be put_32bitBE
#endif

View File

@ -0,0 +1,149 @@
#ifndef _READER_SF_H
#define _READER_SF_H
#include "../streamfile.h"
/* Sometimes you just need an int, and we're doing the buffering.
* Note, however, that if these fail to read they'll return -1,
* so that should not be a valid value or there should be some backup. */
static inline int16_t read_16bitLE(off_t offset, STREAMFILE* sf) {
uint8_t buf[2];
if (read_streamfile(buf,offset,2,sf)!=2) return -1;
return get_16bitLE(buf);
}
static inline int16_t read_16bitBE(off_t offset, STREAMFILE* sf) {
uint8_t buf[2];
if (read_streamfile(buf,offset,2,sf)!=2) return -1;
return get_16bitBE(buf);
}
static inline int32_t read_32bitLE(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf,offset,4,sf)!=4) return -1;
return get_32bitLE(buf);
}
static inline int32_t read_32bitBE(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf,offset,4,sf)!=4) return -1;
return get_32bitBE(buf);
}
static inline int64_t read_64bitLE(off_t offset, STREAMFILE* sf) {
uint8_t buf[8];
if (read_streamfile(buf,offset,8,sf)!=8) return -1;
return get_64bitLE(buf);
}
static inline int64_t read_64bitBE(off_t offset, STREAMFILE* sf) {
uint8_t buf[8];
if (read_streamfile(buf,offset,8,sf)!=8) return -1;
return get_64bitBE(buf);
}
static inline int8_t read_8bit(off_t offset, STREAMFILE* sf) {
uint8_t buf[1];
if (read_streamfile(buf,offset,1,sf)!=1) return -1;
return buf[0];
}
/* alias of the above */
static inline int8_t read_s8 (off_t offset, STREAMFILE* sf) { return read_8bit(offset, sf); }
static inline uint8_t read_u8 (off_t offset, STREAMFILE* sf) { return (uint8_t) read_8bit(offset, sf); }
static inline int16_t read_s16le(off_t offset, STREAMFILE* sf) { return read_16bitLE(offset, sf); }
static inline uint16_t read_u16le(off_t offset, STREAMFILE* sf) { return (uint16_t)read_16bitLE(offset, sf); }
static inline int16_t read_s16be(off_t offset, STREAMFILE* sf) { return read_16bitBE(offset, sf); }
static inline uint16_t read_u16be(off_t offset, STREAMFILE* sf) { return (uint16_t)read_16bitBE(offset, sf); }
static inline int32_t read_s32le(off_t offset, STREAMFILE* sf) { return read_32bitLE(offset, sf); }
static inline uint32_t read_u32le(off_t offset, STREAMFILE* sf) { return (uint32_t)read_32bitLE(offset, sf); }
static inline int32_t read_s32be(off_t offset, STREAMFILE* sf) { return read_32bitBE(offset, sf); }
static inline uint32_t read_u32be(off_t offset, STREAMFILE* sf) { return (uint32_t)read_32bitBE(offset, sf); }
static inline int64_t read_s64be(off_t offset, STREAMFILE* sf) { return read_64bitBE(offset, sf); }
static inline uint64_t read_u64be(off_t offset, STREAMFILE* sf) { return (uint64_t)read_64bitBE(offset, sf); }
static inline int64_t read_s64le(off_t offset, STREAMFILE* sf) { return read_64bitLE(offset, sf); }
static inline uint64_t read_u64le(off_t offset, STREAMFILE* sf) { return (uint64_t)read_64bitLE(offset, sf); }
static inline float read_f32be(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf, offset, sizeof(buf), sf) != sizeof(buf))
return -1;
return get_f32be(buf);
}
static inline float read_f32le(off_t offset, STREAMFILE* sf) {
uint8_t buf[4];
if (read_streamfile(buf, offset, sizeof(buf), sf) != sizeof(buf))
return -1;
return get_f32le(buf);
}
#if 0
// on GCC, this reader will be correctly optimized out (as long as it's static/inline), would be same as declaring:
// uintXX_t (*read_uXX)(off_t,uint8_t*) = be ? get_uXXbe : get_uXXle;
// only for the functions actually used in code, and inlined if possible (like big_endian param being a constant).
// on MSVC seems all read_X in sf_reader are compiled and included in the translation unit, plus ignores constants
// so may result on bloatness?
// (from godbolt tests, test more real cases)
/* collection of callbacks for quick access */
typedef struct sf_reader {
int32_t (*read_s32)(off_t,STREAMFILE*); //maybe r.s32
float (*read_f32)(off_t,STREAMFILE*);
/* ... */
} sf_reader;
static inline void sf_reader_init(sf_reader* r, int big_endian) {
memset(r, 0, sizeof(sf_reader));
if (big_endian) {
r->read_s32 = read_s32be;
r->read_f32 = read_f32be;
}
else {
r->read_s32 = read_s32le;
r->read_f32 = read_f32le;
}
}
/* sf_reader r;
* ...
* sf_reader_init(&r, big_endian);
* val = r.read_s32; //maybe r.s32?
*/
#endif
#if 0 //todo improve + test + simplify code (maybe not inline?)
static inline int read_s4h(off_t offset, STREAMFILE* sf) {
uint8_t byte = read_u8(offset, streamfile);
return get_nibble_signed(byte, 1);
}
static inline int read_u4h(off_t offset, STREAMFILE* sf) {
uint8_t byte = read_u8(offset, streamfile);
return (byte >> 4) & 0x0f;
}
static inline int read_s4l(off_t offset, STREAMFILE* sf) {
...
}
static inline int read_u4l(off_t offset, STREAMFILE* sf) {
...
}
static inline int max_s32(int32_t a, int32_t b) { return a > b ? a : b; }
static inline int min_s32(int32_t a, int32_t b) { return a < b ? a : b; }
//align32, align16, clamp16, etc
#endif
/* fastest to compare would be read_u32x == (uint32), but should be pre-optimized (see get_id32x) */
static inline /*const*/ int is_id32be(off_t offset, STREAMFILE* sf, const char* s) {
return read_u32be(offset, sf) == get_id32be(s);
}
static inline /*const*/ int is_id32le(off_t offset, STREAMFILE* sf, const char* s) {
return read_u32le(offset, sf) == get_id32be(s);
}
static inline /*const*/ int is_id64be(off_t offset, STREAMFILE* sf, const char* s) {
return read_u64be(offset, sf) == get_id64be(s);
}
#endif

View File

@ -0,0 +1,21 @@
#ifndef _READER_TEXT_H
#define _READER_TEXT_H
#include "../streamfile.h"
/* Read into dst a line delimited by CRLF (Windows) / LF (Unux) / CR (Mac) / EOF, null-terminated
* and without line feeds. Returns bytes read (including CR/LF), *not* the same as string length.
* p_line_ok is set to 1 if the complete line was read; pass NULL to ignore. */
size_t read_line(char* buf, int buf_size, off_t offset, STREAMFILE* sf, int* p_line_ok);
/* skip BOM if needed */
size_t read_bom(STREAMFILE* sf);
/* reads a c-string (ANSI only), up to bufsize or NULL, returning size. buf is optional (works as get_string_size). */
size_t read_string(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf);
/* reads a UTF16 string... but actually only as ANSI (discards the upper byte) */
size_t read_string_utf16(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf, int big_endian);
size_t read_string_utf16le(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf);
size_t read_string_utf16be(char* buf, size_t buf_size, off_t offset, STREAMFILE* sf);
#endif

View File

@ -0,0 +1,63 @@
#include "samples_ops.h"
void swap_samples_le(sample_t *buf, int count) {
/* Windows can't be BE... I think */
#if !defined(_WIN32)
#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
int i;
for (i = 0; i < count; i++) {
/* 16b sample in memory: aabb where aa=MSB, bb=LSB */
uint8_t b0 = buf[i] & 0xff;
uint8_t b1 = buf[i] >> 8;
uint8_t *p = (uint8_t*)&(buf[i]);
/* 16b sample in buffer: bbaa where bb=LSB, aa=MSB */
p[0] = b0;
p[1] = b1;
/* when endianness is LE, buffer has bbaa already so this function can be skipped */
}
#endif
#endif
}
/* unused */
/*
void interleave_channel(sample_t * outbuffer, sample_t * inbuffer, int32_t sample_count, int channel_count, int channel_number) {
int32_t insample,outsample;
if (channel_count==1) {
memcpy(outbuffer,inbuffer,sizeof(sample)*sample_count);
return;
}
for (insample=0,outsample=channel_number;insample<sample_count;insample++,outsample+=channel_count) {
outbuffer[outsample]=inbuffer[insample];
}
}
*/
/* failed attempt at interleave in place */
/*
void interleave_stereo(sample_t * buffer, int32_t sample_count) {
int32_t tomove, belongs;
sample_t moving,temp;
tomove = sample_count;
moving = buffer[tomove];
do {
if (tomove<sample_count)
belongs = tomove*2;
else
belongs = (tomove-sample_count)*2+1;
temp = buffer[belongs];
buffer[belongs] = moving;
moving = temp;
tomove = belongs;
} while (tomove != sample_count);
}
*/

View File

@ -0,0 +1,9 @@
#ifndef _SAMPLES_OPS_H
#define _SAMPLES_OPS_H
#include "../streamtypes.h"
/* swap samples in machine endianness to little endian (useful to write .wav) */
void swap_samples_le(sample_t* buf, int count);
#endif

View File

@ -9,15 +9,16 @@
#include "meta/meta.h"
#include "layout/layout.h"
#include "coding/coding.h"
#include "decode.h"
#include "render.h"
#include "mixing.h"
#include "base/decode.h"
#include "base/render.h"
#include "base/mixing.h"
static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, VGMSTREAM* (*init_vgmstream_function)(STREAMFILE*));
typedef VGMSTREAM* (*init_vgmstream_t)(STREAMFILE*);
static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, init_vgmstream_t init_vgmstream_function);
/* list of metadata parser functions that will recognize files, used on init */
VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_adx,
init_vgmstream_brstm,
init_vgmstream_brwav,
@ -563,25 +564,25 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
#endif
};
#define LOCAL_ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
static const int init_vgmstream_count = LOCAL_ARRAY_LENGTH(init_vgmstream_functions);
/*****************************************************************************/
/* INIT/META */
/*****************************************************************************/
#define LOCAL_ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
/* internal version with all parameters */
static VGMSTREAM* init_vgmstream_internal(STREAMFILE* sf) {
int i, fcns_count;
if (!sf)
return NULL;
fcns_count = LOCAL_ARRAY_LENGTH(init_vgmstream_functions);
/* try a series of formats, see which works */
for (i = 0; i < fcns_count; i++) {
for (int i = 0; i < init_vgmstream_count; i++) {
init_vgmstream_t init_vgmstream_function = init_vgmstream_functions[i];
/* call init function and see if valid VGMSTREAM was returned */
VGMSTREAM* vgmstream = (init_vgmstream_functions[i])(sf);
VGMSTREAM* vgmstream = init_vgmstream_function(sf);
if (!vgmstream)
continue;
@ -614,7 +615,7 @@ static VGMSTREAM* init_vgmstream_internal(STREAMFILE* sf) {
/* test if candidate for dual stereo */
if (vgmstream->channels == 1 && vgmstream->allow_dual_stereo == 1) {
try_dual_file_stereo(vgmstream, sf, init_vgmstream_functions[i]);
try_dual_file_stereo(vgmstream, sf, init_vgmstream_function);
}
/* clean as loops are readable metadata but loop fields may contain garbage
@ -714,9 +715,9 @@ void reset_vgmstream(VGMSTREAM* vgmstream) {
* Otherwise hit_loop will be 0 and it will be copied over anyway when we
* really hit the loop start. */
reset_codec(vgmstream);
decode_reset(vgmstream);
reset_layout(vgmstream);
render_reset(vgmstream);
/* note that this does not reset the constituent STREAMFILES
* (vgmstream->ch[N].streamfiles' internal state, like internal offset, though shouldn't matter) */
@ -737,7 +738,7 @@ VGMSTREAM* allocate_vgmstream(int channel_count, int loop_flag) {
* - ch: config+state per channel, also modified by those
* - start_vgmstream: vgmstream clone copied on init_vgmstream and restored on reset_vgmstream
* - start_ch: ch clone copied on init_vgmstream and restored on reset_vgmstream
* - loop_ch: ch clone copied on loop start and restored on loop end (vgmstream_do_loop)
* - loop_ch: ch clone copied on loop start and restored on loop end (decode_do_loop)
* - codec/layout_data: custom state for complex codecs or layouts, handled externally
*
* Here we only create the basic structs to be filled, and only after init_vgmstream it
@ -799,10 +800,10 @@ void close_vgmstream(VGMSTREAM* vgmstream) {
if (!vgmstream)
return;
free_codec(vgmstream);
decode_free(vgmstream);
vgmstream->codec_data = NULL;
free_layout(vgmstream);
render_free(vgmstream);
vgmstream->layout_data = NULL;
@ -915,7 +916,7 @@ void vgmstream_set_loop_target(VGMSTREAM* vgmstream, int loop_target) {
/* See if there is a second file which may be the second channel, given an already opened mono vgmstream.
* If a suitable file is found, open it and change opened_vgmstream to a stereo vgmstream. */
static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, VGMSTREAM*(*init_vgmstream_function)(STREAMFILE*)) {
static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, init_vgmstream_t init_vgmstream_function) {
/* filename search pairs for dual file stereo */
static const char* const dfs_pairs[][2] = {
{"L","R"}, /* most common in .dsp and .vag */

View File

@ -1,10 +1,17 @@
/*
* vgmstream.h - definitions for VGMSTREAM, encapsulating a multi-channel, looped audio stream
*/
#ifndef _VGMSTREAM_H
#define _VGMSTREAM_H
#include "streamfile.h"
#include "vgmstream_types.h"
#ifdef BUILD_VGMSTREAM
#include "util/log.h"
#else
#include <libvgmstream/log.h>
#endif
/* reasonable limits */
enum {
/* Windows generally only allows 260 chars in path, but other OSs have higher limits, and we handle
@ -19,14 +26,6 @@ enum {
VGMSTREAM_MAX_NUM_SAMPLES = 1000000000, /* no ~5h vgm hopefully */
};
#include "streamfile.h"
#ifdef BUILD_VGMSTREAM
#include "util/log.h"
#else
#include <libvgmstream/log.h>
#endif
/* Due mostly to licensing issues, Vorbis, MPEG, G.722.1, etc decoding is done by external libraries.
* Libs are disabled by default, defined on compile-time for builds that support it */
//#define VGM_USE_VORBIS
@ -57,765 +56,6 @@ enum {
#endif
/* The encoding type specifies the format the sound data itself takes */
typedef enum {
coding_SILENCE, /* generates silence */
/* PCM */
coding_PCM16LE, /* little endian 16-bit PCM */
coding_PCM16BE, /* big endian 16-bit PCM */
coding_PCM16_int, /* 16-bit PCM with sample-level interleave (for blocks) */
coding_PCM8, /* 8-bit PCM */
coding_PCM8_int, /* 8-bit PCM with sample-level interleave (for blocks) */
coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */
coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0) with sample-level interleave (for blocks) */
coding_PCM8_SB, /* 8-bit PCM, sign bit (others are 2's complement) */
coding_PCM4, /* 4-bit PCM, signed */
coding_PCM4_U, /* 4-bit PCM, unsigned */
coding_ULAW, /* 8-bit u-Law (non-linear PCM) */
coding_ULAW_int, /* 8-bit u-Law (non-linear PCM) with sample-level interleave (for blocks) */
coding_ALAW, /* 8-bit a-Law (non-linear PCM) */
coding_PCMFLOAT, /* 32-bit float PCM */
coding_PCM24LE, /* little endian 24-bit PCM */
coding_PCM24BE, /* big endian 24-bit PCM */
/* ADPCM */
coding_CRI_ADX, /* CRI ADX */
coding_CRI_ADX_fixed, /* CRI ADX, encoding type 2 with fixed coefficients */
coding_CRI_ADX_exp, /* CRI ADX, encoding type 4 with exponential scale */
coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */
coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */
coding_NGC_DSP, /* Nintendo DSP ADPCM */
coding_NGC_DSP_subint, /* Nintendo DSP ADPCM with frame subinterframe */
coding_NGC_DTK, /* Nintendo DTK ADPCM (hardware disc), also called TRK or ADP */
coding_NGC_AFC, /* Nintendo AFC ADPCM */
coding_VADPCM, /* Silicon Graphics VADPCM */
coding_G721, /* CCITT G.721 */
coding_XA, /* CD-ROM XA 4-bit */
coding_XA8, /* CD-ROM XA 8-bit */
coding_XA_EA, /* EA's Saturn XA (not to be confused with EA-XA) */
coding_PSX, /* Sony PS ADPCM (VAG) */
coding_PSX_badflags, /* Sony PS ADPCM with custom flag byte */
coding_PSX_cfg, /* Sony PS ADPCM with configurable frame size (int math) */
coding_PSX_pivotal, /* Sony PS ADPCM with configurable frame size (float math) */
coding_HEVAG, /* Sony PSVita ADPCM */
coding_EA_XA, /* Electronic Arts EA-XA ADPCM v1 (stereo) aka "EA ADPCM" */
coding_EA_XA_int, /* Electronic Arts EA-XA ADPCM v1 (mono/interleave) */
coding_EA_XA_V2, /* Electronic Arts EA-XA ADPCM v2 */
coding_MAXIS_XA, /* Maxis EA-XA ADPCM */
coding_EA_XAS_V0, /* Electronic Arts EA-XAS ADPCM v0 */
coding_EA_XAS_V1, /* Electronic Arts EA-XAS ADPCM v1 */
coding_IMA, /* IMA ADPCM (stereo or mono, low nibble first) */
coding_IMA_int, /* IMA ADPCM (mono/interleave, low nibble first) */
coding_DVI_IMA, /* DVI IMA ADPCM (stereo or mono, high nibble first) */
coding_DVI_IMA_int, /* DVI IMA ADPCM (mono/interleave, high nibble first) */
coding_NW_IMA,
coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */
coding_QD_IMA,
coding_WV6_IMA, /* Gorilla Systems WV6 4-bit IMA ADPCM */
coding_HV_IMA, /* High Voltage 4-bit IMA ADPCM */
coding_FFTA2_IMA, /* Final Fantasy Tactics A2 4-bit IMA ADPCM */
coding_BLITZ_IMA, /* Blitz Games 4-bit IMA ADPCM */
coding_MS_IMA, /* Microsoft IMA ADPCM */
coding_MS_IMA_mono, /* Microsoft IMA ADPCM (mono/interleave) */
coding_XBOX_IMA, /* XBOX IMA ADPCM */
coding_XBOX_IMA_mch, /* XBOX IMA ADPCM (multichannel) */
coding_XBOX_IMA_int, /* XBOX IMA ADPCM (mono/interleave) */
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */
coding_RAD_IMA, /* Radical IMA ADPCM */
coding_RAD_IMA_mono, /* Radical IMA ADPCM (mono/interleave) */
coding_APPLE_IMA4, /* Apple Quicktime IMA4 */
coding_FSB_IMA, /* FMOD's FSB multichannel IMA ADPCM */
coding_WWISE_IMA, /* Audiokinetic Wwise IMA ADPCM */
coding_REF_IMA, /* Reflections IMA ADPCM */
coding_AWC_IMA, /* Rockstar AWC IMA ADPCM */
coding_UBI_IMA, /* Ubisoft IMA ADPCM */
coding_UBI_SCE_IMA, /* Ubisoft SCE IMA ADPCM */
coding_H4M_IMA, /* H4M IMA ADPCM (stereo or mono, high nibble first) */
coding_MTF_IMA, /* Capcom MT Framework IMA ADPCM */
coding_CD_IMA, /* Crystal Dynamics IMA ADPCM */
coding_MSADPCM, /* Microsoft ADPCM (stereo/mono) */
coding_MSADPCM_int, /* Microsoft ADPCM (mono) */
coding_MSADPCM_ck, /* Microsoft ADPCM (Cricket Audio variation) */
coding_WS, /* Westwood Studios VBR ADPCM */
coding_AICA, /* Yamaha AICA ADPCM (stereo) */
coding_AICA_int, /* Yamaha AICA ADPCM (mono/interleave) */
coding_CP_YM, /* Capcom's Yamaha ADPCM (stereo/mono) */
coding_ASKA, /* Aska ADPCM */
coding_NXAP, /* NXAP ADPCM */
coding_TGC, /* Tiger Game.com 4-bit ADPCM */
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
coding_L5_555, /* Level-5 0x555 ADPCM */
coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/
coding_MTAF, /* Konami MTAF ADPCM */
coding_MTA2, /* Konami MTA2 ADPCM */
coding_MC3, /* Paradigm MC3 3-bit ADPCM */
coding_FADPCM, /* FMOD FADPCM 4-bit ADPCM */
coding_ASF, /* Argonaut ASF 4-bit ADPCM */
coding_DSA, /* Ocean DSA 4-bit ADPCM */
coding_XMD, /* Konami XMD 4-bit ADPCM */
coding_TANTALUS, /* Tantalus 4-bit ADPCM */
coding_PCFX, /* PC-FX 4-bit ADPCM */
coding_OKI16, /* OKI 4-bit ADPCM with 16-bit output and modified expand */
coding_OKI4S, /* OKI 4-bit ADPCM with 16-bit output and cuadruple step */
coding_PTADPCM, /* Platinum 4-bit ADPCM */
coding_IMUSE, /* LucasArts iMUSE Variable ADPCM */
coding_COMPRESSWAVE, /* CompressWave Huffman ADPCM */
/* others */
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression DPCM */
coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression with sample-level interleave */
coding_CBD2, /* CBD2 2:1 Cuberoot-Delta-Exact compression DPCM */
coding_CBD2_int, /* CBD2 2:1 Cuberoot-Delta-Exact compression, with sample-level interleave */
coding_SASSC, /* Activision EXAKT SASSC 8-bit DPCM */
coding_DERF, /* DERF 8-bit DPCM */
coding_WADY, /* WADY 8-bit DPCM */
coding_NWA, /* VisualArt's NWA DPCM */
coding_ACM, /* InterPlay ACM */
coding_CIRCUS_ADPCM, /* Circus 8-bit ADPCM */
coding_UBI_ADPCM, /* Ubisoft 4/6-bit ADPCM */
coding_EA_MT, /* Electronic Arts MicroTalk (linear-predictive speech codec) */
coding_CIRCUS_VQ, /* Circus VQ */
coding_RELIC, /* Relic Codec (DCT-based) */
coding_CRI_HCA, /* CRI High Compression Audio (MDCT-based) */
coding_TAC, /* tri-Ace Codec (MDCT-based) */
coding_ICE_RANGE, /* Inti Creates "range" codec */
coding_ICE_DCT, /* Inti Creates "DCT" codec */
#ifdef VGM_USE_VORBIS
coding_OGG_VORBIS, /* Xiph Vorbis with Ogg layer (MDCT-based) */
coding_VORBIS_custom, /* Xiph Vorbis with custom layer (MDCT-based) */
#endif
#ifdef VGM_USE_MPEG
coding_MPEG_custom, /* MPEG audio with custom features (MDCT-based) */
coding_MPEG_ealayer3, /* EALayer3, custom MPEG frames */
coding_MPEG_layer1, /* MP1 MPEG audio (MDCT-based) */
coding_MPEG_layer2, /* MP2 MPEG audio (MDCT-based) */
coding_MPEG_layer3, /* MP3 MPEG audio (MDCT-based) */
#endif
#ifdef VGM_USE_G7221
coding_G7221C, /* ITU G.722.1 annex C (Polycom Siren 14) */
#endif
#ifdef VGM_USE_G719
coding_G719, /* ITU G.719 annex B (Polycom Siren 22) */
#endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
coding_MP4_AAC, /* AAC (MDCT-based) */
#endif
#ifdef VGM_USE_ATRAC9
coding_ATRAC9, /* Sony ATRAC9 (MDCT-based) */
#endif
#ifdef VGM_USE_CELT
coding_CELT_FSB, /* Custom Xiph CELT (MDCT-based) */
#endif
#ifdef VGM_USE_SPEEX
coding_SPEEX, /* Custom Speex (CELP-based) */
#endif
#ifdef VGM_USE_FFMPEG
coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */
#endif
} coding_t;
/* The layout type specifies how the sound data is laid out in the file */
typedef enum {
/* generic */
layout_none, /* straight data */
/* interleave */
layout_interleave, /* equal interleave throughout the stream */
/* headered blocks */
layout_blocked_ast,
layout_blocked_halpst,
layout_blocked_xa,
layout_blocked_ea_schl,
layout_blocked_ea_1snh,
layout_blocked_caf,
layout_blocked_wsi,
layout_blocked_str_snds,
layout_blocked_ws_aud,
layout_blocked_matx,
layout_blocked_dec,
layout_blocked_xvas,
layout_blocked_vs,
layout_blocked_mul,
layout_blocked_gsb,
layout_blocked_thp,
layout_blocked_filp,
layout_blocked_ea_swvr,
layout_blocked_adm,
layout_blocked_bdsp,
layout_blocked_mxch,
layout_blocked_ivaud, /* GTA IV .ivaud blocks */
layout_blocked_ps2_iab,
layout_blocked_vs_str,
layout_blocked_rws,
layout_blocked_hwas,
layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
layout_blocked_awc, /* Rockstar AWC */
layout_blocked_vgs, /* Guitar Hero II (PS2) */
layout_blocked_xwav,
layout_blocked_xvag_subsong, /* XVAG subsongs [God of War III (PS4)] */
layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */
layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */
layout_blocked_sthd, /* Dream Factory STHD */
layout_blocked_h4m, /* H4M video */
layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */
layout_blocked_vs_square,
layout_blocked_vid1,
layout_blocked_ubi_sce,
layout_blocked_tt_ad,
/* otherwise odd */
layout_segmented, /* song divided in segments (song sections) */
layout_layered, /* song divided in layers (song channels) */
} layout_t;
/* The meta type specifies how we know what we know about the file.
* We may know because of a header we read, some of it may have been guessed from filenames, etc. */
typedef enum {
meta_SILENCE,
meta_DSP_STD, /* Nintendo standard GC ADPCM (DSP) header */
meta_DSP_CSTR, /* Star Fox Assault "Cstr" */
meta_DSP_RS03, /* Retro: Metroid Prime 2 "RS03" */
meta_DSP_STM, /* Paper Mario 2 STM */
meta_AGSC, /* Retro: Metroid Prime 2 title */
meta_CSMP, /* Retro: Metroid Prime 3 (Wii), Donkey Kong Country Returns (Wii) */
meta_RFRM, /* Retro: Donkey Kong Country Tropical Freeze (Wii U) */
meta_DSP_MPDSP, /* Monopoly Party single header stereo */
meta_DSP_JETTERS, /* Bomberman Jetters .dsp */
meta_DSP_MSS, /* Free Radical GC games */
meta_DSP_GCM, /* some of Traveller's Tales games */
meta_DSP_STR, /* Conan .str files */
meta_DSP_SADB, /* .sad */
meta_DSP_WSI, /* .wsi */
meta_IDSP_TT, /* Traveller's Tales games */
meta_DSP_WII_MUS, /* .mus */
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
meta_STRM, /* Nintendo STRM */
meta_RSTM, /* Nintendo RSTM (Revolution Stream, similar to STRM) */
meta_AFC, /* AFC */
meta_AST, /* AST */
meta_RWSD, /* single-stream RWSD */
meta_RWAR, /* single-stream RWAR */
meta_RWAV, /* contents of RWAR */
meta_CWAV, /* contents of CWAR */
meta_FWAV, /* contents of FWAR */
meta_THP, /* THP movie files */
meta_SWAV,
meta_NDS_RRDS, /* Ridge Racer DS */
meta_WII_BNS, /* Wii BNS Banner Sound (similar to RSTM) */
meta_WIIU_BTSND, /* Wii U Boot Sound */
meta_ADX_03, /* CRI ADX "type 03" */
meta_ADX_04, /* CRI ADX "type 04" */
meta_ADX_05, /* CRI ADX "type 05" */
meta_AIX, /* CRI AIX */
meta_AAX, /* CRI AAX */
meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */
meta_DTK,
meta_RSF,
meta_HALPST, /* HAL Labs HALPST */
meta_GCSW, /* GCSW (PCM) */
meta_CAF, /* tri-Crescendo CAF */
meta_MYSPD, /* U-Sing .myspd */
meta_HIS, /* Her Ineractive .his */
meta_BNSF, /* Bandai Namco Sound Format */
meta_XA, /* CD-ROM XA */
meta_ADS,
meta_NPS,
meta_RXWS,
meta_RAW_INT,
meta_EXST,
meta_SVAG_KCET,
meta_PS_HEADERLESS, /* headerless PS-ADPCM */
meta_MIB_MIH,
meta_PS2_MIC, /* KOEI MIC File */
meta_PS2_VAGi, /* VAGi Interleaved File */
meta_PS2_VAGp, /* VAGp Mono File */
meta_PS2_pGAV, /* VAGp with Little Endian Header */
meta_PS2_VAGp_AAAP, /* Acclaim Austin Audio VAG header */
meta_SEB,
meta_STR_WAV, /* Blitz Games STR+WAV files */
meta_ILD,
meta_PS2_PNB, /* PsychoNauts Bgm File */
meta_VPK, /* VPK Audio File */
meta_PS2_BMDX, /* Beatmania thing */
meta_PS2_IVB, /* Langrisser 3 IVB */
meta_PS2_SND, /* some Might & Magics SSND header */
meta_SVS, /* Square SVS */
meta_XSS, /* Dino Crisis 3 */
meta_SL3, /* Test Drive Unlimited */
meta_HGC1, /* Knights of the Temple 2 */
meta_AUS, /* Various Capcom games */
meta_RWS, /* RenderWare games (only when using RW Audio middleware) */
meta_FSB1, /* FMOD Sample Bank, version 1 */
meta_FSB2, /* FMOD Sample Bank, version 2 */
meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */
meta_FSB4, /* FMOD Sample Bank, version 4 */
meta_FSB5, /* FMOD Sample Bank, version 5 */
meta_RWX, /* Air Force Delta Storm (XBOX) */
meta_XWB, /* Microsoft XACT framework (Xbox, X360, Windows) */
meta_PS2_XA30, /* Driver - Parallel Lines (PS2) */
meta_MUSC, /* Krome PS2 games */
meta_MUSX,
meta_LEG, /* Legaia 2 [no header_id] */
meta_FILP, /* Resident Evil - Dead Aim */
meta_IKM,
meta_STER,
meta_BG00, /* Ibara, Mushihimesama */
meta_PS2_RSTM, /* Midnight Club 3 */
meta_PS2_KCES, /* Dance Dance Revolution */
meta_HXD,
meta_VSV,
meta_SCD_PCM, /* Lunar - Eternal Blue */
meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */
meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */
meta_PS2_VAS, /* Pro Baseball Spirits 5 */
meta_PS2_ENTH, /* Enthusia */
meta_SDT, /* Baldur's Gate - Dark Alliance */
meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */
meta_DC_STR, /* SEGA Stream Asset Builder */
meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */
meta_NGC_BH2PCM, /* Bio Hazard 2 */
meta_SAP,
meta_DC_IDVI, /* Eldorado Gate */
meta_KRAW, /* Geometry Wars - Galaxies */
meta_PS2_OMU, /* PS2 Int file with Header */
meta_PS2_XA2, /* XG3 Extreme-G Racing */
meta_NUB,
meta_IDSP_NL, /* Mario Strikers Charged (Wii) */
meta_IDSP_IE, /* Defencer (GC) */
meta_SPT_SPD, /* Various (SPT+SPT DSP) */
meta_ISH_ISD, /* Various (ISH+ISD DSP) */
meta_GSP_GSB, /* Tecmo games (Super Swing Golf 1 & 2, Quamtum Theory) */
meta_YDSP, /* WWE Day of Reckoning */
meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */
meta_UBI_JADE, /* Beyond Good & Evil, Rayman Raving Rabbids */
meta_GCA, /* Metal Slug Anthology */
meta_NGC_SSM, /* Golden Gashbell Full Power */
meta_PS2_JOE, /* Wall-E / Pixar games */
meta_NGC_YMF, /* WWE WrestleMania X8 */
meta_SADL,
meta_FAG, /* Jackie Chan - Stuntmaster */
meta_PS2_MIHB, /* Merged MIH+MIB */
meta_NGC_PDT, /* Mario Party 6 */
meta_DC_ASD, /* Miss Moonligh */
meta_SPSD,
meta_RSD,
meta_PS2_ASS, /* ASS */
meta_SEG, /* Eragon */
meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */
meta_KNON,
meta_ZWDSP, /* Zack and Wiki */
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
meta_DCS_WAV,
meta_SMP,
meta_WII_SNG, /* Excite Trucks */
meta_MUL,
meta_SAT_BAKA, /* Crypt Killer */
meta_VSF,
meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */
meta_ADS_MIDWAY,
meta_PS2_SPS, /* Ape Escape 2 */
meta_PS2_XA2_RRP, /* RC Revenge Pro */
meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */
meta_UBI_CKD, /* Ubisoft CKD RIFF header (Rayman Origins Wii) */
meta_RAW_WAVM,
meta_WVS,
meta_XBOX_MATX, /* XBOX MATX */
meta_XMU,
meta_XVAS,
meta_EA_SCHL, /* Electronic Arts SCHl with variable header */
meta_EA_SCHL_fixed, /* Electronic Arts SCHl with fixed header */
meta_EA_BNK, /* Electronic Arts BNK */
meta_EA_1SNH, /* Electronic Arts 1SNh/EACS */
meta_EA_EACS,
meta_RAW_PCM,
meta_GENH, /* generic header */
meta_AIFC, /* Audio Interchange File Format AIFF-C */
meta_AIFF, /* Audio Interchange File Format */
meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */
meta_WS_AUD, /* Westwood Studios .aud */
meta_WS_AUD_old, /* Westwood Studios .aud, old style */
meta_RIFF_WAVE, /* RIFF, for WAVs */
meta_RIFF_WAVE_POS, /* .wav + .pos for looping (Ys Complete PC) */
meta_RIFF_WAVE_labl, /* RIFF w/ loop Markers in LIST-adtl-labl */
meta_RIFF_WAVE_smpl, /* RIFF w/ loop data in smpl chunk */
meta_RIFF_WAVE_wsmp, /* RIFF w/ loop data in wsmp chunk */
meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */
meta_RIFX_WAVE, /* RIFX, for big-endian WAVs */
meta_RIFX_WAVE_smpl, /* RIFX w/ loop data in smpl chunk */
meta_XNB, /* XNA Game Studio 4.0 */
meta_PC_MXST, /* Lego Island MxSt */
meta_SAB, /* Worms 4 Mayhem SAB+SOB file */
meta_NWA, /* Visual Art's NWA */
meta_NWA_NWAINFOINI, /* Visual Art's NWA w/ NWAINFO.INI for looping */
meta_NWA_GAMEEXEINI, /* Visual Art's NWA w/ Gameexe.ini for looping */
meta_SAT_DVI, /* Konami KCE Nagoya DVI (SAT games) */
meta_DC_KCEY, /* Konami KCE Yokohama KCEYCOMP (DC games) */
meta_ACM, /* InterPlay ACM header */
meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */
meta_DEC, /* Falcom PC games (Xanadu Next, Gurumin) */
meta_VS, /* Men in Black .vs */
meta_FFXI_BGW, /* FFXI (PC) BGW */
meta_FFXI_SPW, /* FFXI (PC) SPW */
meta_STS,
meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */
meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */
meta_NGC_DSP_IADP, /* Gamecube Interleave DSP */
meta_PS2_TK5, /* Tekken 5 Stream Files */
meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */
meta_ZSD, /* Dragon Booster ZSD */
meta_REDSPARK, /* "RedSpark" RSD (MadWorld) */
meta_IVAUD, /* .ivaud GTA IV */
meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */
meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */
meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */
meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
meta_PS2_VGV, /* Rune: Viking Warlord */
meta_GCUB,
meta_MAXIS_XA, /* Sim City 3000 (PC) */
meta_NGC_SCK_DSP, /* Scorpion King (NGC) */
meta_CAFF, /* iPhone .caf */
meta_EXAKT_SC, /* Activision EXAKT .SC (PS2) */
meta_WII_WAS, /* DiRT 2 (WII) */
meta_PONA_3DO, /* Policenauts (3DO) */
meta_PONA_PSX, /* Policenauts (PSX) */
meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */
meta_AST_MV,
meta_AST_MMV,
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
meta_S14, /* raw Siren 14, 24kbit mono */
meta_SSS, /* raw Siren 14, 48kbit stereo */
meta_PS2_GCM, /* NamCollection */
meta_PS2_SMPL, /* Homura */
meta_PS2_MSA, /* Psyvariar -Complete Edition- */
meta_PS2_VOI, /* RAW Danger (Zettaizetsumei Toshi 2 - Itetsuita Kiokutachi) [PS2] */
meta_P3D, /* Prototype P3D */
meta_PS2_TK1, /* Tekken (NamCollection) */
meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */
meta_DSP_DDSP, /* Various (2 dsp files stuck together */
meta_NGC_DSP_MPDS, /* Big Air Freestyle, Terminator 3 */
meta_DSP_STR_IG, /* Micro Machines, Superman Superman: Shadow of Apokolis */
meta_EA_SWVR, /* Future Cop L.A.P.D., Freekstyle */
meta_PS2_B1S, /* 7 Wonders of the ancient world */
meta_PS2_WAD, /* The golden Compass */
meta_DSP_XIII, /* XIII, possibly more (Ubisoft header???) */
meta_DSP_CABELAS, /* Cabelas games */
meta_PS2_ADM, /* Dragon Quest V (PS2) */
meta_LPCM_SHADE,
meta_DSP_BDSP, /* Ah! My Goddess */
meta_PS2_VMS, /* Autobahn Raser - Police Madness */
meta_XAU, /* XPEC Entertainment (Beat Down (PS2 Xbox), Spectral Force Chronicle (PS2)) */
meta_GH3_BAR, /* Guitar Hero III Mobile .bar */
meta_FFW, /* Freedom Fighters [NGC] */
meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */
meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */
meta_SQEX_SCD, /* Square-Enix SCD */
meta_NGC_NST_DSP, /* Animaniacs [NGC] */
meta_BAF, /* Bizarre Creations (Blur, James Bond) */
meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_CPS,
meta_MSF,
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */
meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */
meta_SPM,
meta_VGS_PS,
meta_PS2_IAB, /* Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */
meta_VS_STR, /* The Bouncer */
meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */
meta_XWAV,
meta_RAW_SNDS,
meta_PS2_WMUS, /* The Warriors (PS2) */
meta_HYPERSCAN_KVAG, /* Hyperscan KVAG/BVG */
meta_IOS_PSND, /* Crash Bandicoot Nitro Kart 2 (iOS) */
meta_BOS_ADP,
meta_QD_ADP,
meta_EB_SFX, /* Excitebots .sfx */
meta_EB_SF0, /* Excitebots .sf0 */
meta_MTAF,
meta_PS2_VAG1, /* Metal Gear Solid 3 VAG1 */
meta_PS2_VAG2, /* Metal Gear Solid 3 VAG2 */
meta_ALP,
meta_WPD, /* Shuffle! (PC) */
meta_MN_STR, /* Mini Ninjas (PC/PS3/WII) */
meta_MSS, /* Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */
meta_PS2_HSF, /* Lowrider (PS2) */
meta_IVAG,
meta_PS2_2PFS, /* Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2) */
meta_PS2_VBK, /* Disney's Stitch - Experiment 626 */
meta_OTM, /* Otomedius (Arcade) */
meta_CSTM, /* Nintendo 3DS CSTM (Century Stream) */
meta_FSTM, /* Nintendo Wii U FSTM (caFe? Stream) */
meta_IDSP_NAMCO,
meta_KT_WIIBGM, /* Koei Tecmo WiiBGM */
meta_KTSS, /* Koei Tecmo Nintendo Stream (KNS) */
meta_MCA, /* Capcom MCA "MADP" */
meta_XB3D_ADX, /* Xenoblade Chronicles 3D ADX */
meta_HCA, /* CRI HCA */
meta_SVAG_SNK,
meta_PS2_VDS_VDM, /* Graffiti Kingdom */
meta_FFMPEG,
meta_FFMPEG_faulty,
meta_CXS,
meta_AKB,
meta_PASX,
meta_XMA_RIFF,
meta_ASTB,
meta_WWISE_RIFF, /* Audiokinetic Wwise RIFF/RIFX */
meta_UBI_RAKI, /* Ubisoft RAKI header (Rayman Legends, Just Dance 2017) */
meta_SXD, /* Sony SXD (Gravity Rush, Freedom Wars PSV) */
meta_OGL, /* Shin'en Wii/WiiU (Jett Rocket (Wii), FAST Racing NEO (WiiU)) */
meta_MC3, /* Paradigm games (T3 PS2, MX Rider PS2, MI: Operation Surma PS2) */
meta_GHS,
meta_AAC_TRIACE,
meta_MTA2,
meta_NGC_ULW, /* Burnout 1 (GC only) */
meta_XA_XA30,
meta_XA_04SW,
meta_TXTH, /* generic text header */
meta_SK_AUD, /* Silicon Knights .AUD (Eternal Darkness GC) */
meta_AHX,
meta_STM, /* Angel Studios/Rockstar San Diego Games */
meta_BINK, /* RAD Game Tools BINK audio/video */
meta_EA_SNU, /* Electronic Arts SNU (Dead Space) */
meta_AWC, /* Rockstar AWC (GTA5, RDR) */
meta_OPUS, /* Nintendo Opus [Lego City Undercover (Switch)] */
meta_RAW_AL,
meta_PC_AST, /* Dead Rising (PC) */
meta_NAAC, /* Namco AAC (3DS) */
meta_UBI_SB, /* Ubisoft banks */
meta_EZW, /* EZ2DJ (Arcade) EZWAV */
meta_VXN, /* Gameloft mobile games */
meta_EA_SNR_SNS, /* Electronic Arts SNR+SNS (Burnout Paradise) */
meta_EA_SPS, /* Electronic Arts SPS (Burnout Crash) */
meta_VID1,
meta_PC_FLX, /* Ultima IX PC */
meta_MOGG, /* Harmonix Music Systems MOGG Vorbis */
meta_OGG_VORBIS, /* Ogg Vorbis */
meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */
meta_OPUS_SLI, /* Ogg Opus file w/ companion .sli for looping */
meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */
meta_OGG_KOVS, /* Ogg Vorbis with header and encryption (Koei Tecmo Games) */
meta_OGG_encrypted, /* Ogg Vorbis with encryption */
meta_KMA9, /* Koei Tecmo [Nobunaga no Yabou - Souzou (Vita)] */
meta_XWC, /* Starbreeze games */
meta_SQEX_SAB, /* Square-Enix newest middleware (sound) */
meta_SQEX_MAB, /* Square-Enix newest middleware (music) */
meta_WAF, /* KID WAF [Ever 17 (PC)] */
meta_WAVE, /* EngineBlack games [Mighty Switch Force! (3DS)] */
meta_WAVE_segmented, /* EngineBlack games, segmented [Shantae and the Pirate's Curse (PC)] */
meta_SMV, /* Cho Aniki Zero (PSP) */
meta_NXAP, /* Nex Entertainment games [Time Crisis 4 (PS3), Time Crisis Razing Storm (PS3)] */
meta_EA_WVE_AU00, /* Electronic Arts PS movies [Future Cop - L.A.P.D. (PS), Supercross 2000 (PS)] */
meta_EA_WVE_AD10, /* Electronic Arts PS movies [Wing Commander 3/4 (PS)] */
meta_STHD, /* STHD .stx [Kakuto Chojin (Xbox)] */
meta_MP4, /* MP4/AAC */
meta_PCM_SRE, /* .PCM+SRE [Viewtiful Joe (PS2)] */
meta_DSP_MCADPCM, /* Skyrim (Switch) */
meta_UBI_LYN, /* Ubisoft LyN engine [The Adventures of Tintin (multi)] */
meta_MSB_MSH, /* sfx companion of MIH+MIB */
meta_TXTP, /* generic text playlist */
meta_SMC_SMH, /* Wangan Midnight (System 246) */
meta_PPST, /* PPST [Parappa the Rapper (PSP)] */
meta_SPS_N1,
meta_UBI_BAO, /* Ubisoft BAO */
meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */
meta_H4M, /* Hudson HVQM4 video [Resident Evil 0 (GC), Tales of Symphonia (GC)] */
meta_ASF, /* Argonaut ASF [Croc 2 (PC)] */
meta_XMD, /* Konami XMD [Silent Hill 4 (Xbox), Castlevania: Curse of Darkness (Xbox)] */
meta_CKS, /* Cricket Audio stream [Part Time UFO (Android), Mega Man 1-6 (Android)] */
meta_CKB, /* Cricket Audio bank [Fire Emblem Heroes (Android), Mega Man 1-6 (Android)] */
meta_WV6, /* Gorilla Systems PC games */
meta_WAVEBATCH, /* Firebrand Games */
meta_HD3_BD3, /* Sony PS3 bank */
meta_BNK_SONY, /* Sony Scream Tool bank */
meta_SSCF,
meta_DSP_VAG, /* Penny-Punching Princess (Switch) sfx */
meta_DSP_ITL, /* Charinko Hero (GC) */
meta_A2M, /* Scooby-Doo! Unmasked (PS2) */
meta_AHV, /* Headhunter (PS2) */
meta_MSV,
meta_SDF,
meta_SVG, /* Hunter - The Reckoning - Wayward (PS2) */
meta_VIS, /* AirForce Delta Strike (PS2) */
meta_VAI, /* Ratatouille (GC) */
meta_AIF_ASOBO, /* Ratatouille (PC) */
meta_AO, /* Cloudphobia (PC) */
meta_APC, /* MegaRace 3 (PC) */
meta_WV2, /* Slave Zero (PC) */
meta_XAU_KONAMI, /* Yu-Gi-Oh - The Dawn of Destiny (Xbox) */
meta_DERF, /* Stupid Invaders (PC) */
meta_SADF,
meta_UTK,
meta_NXA,
meta_ADPCM_CAPCOM,
meta_UE4OPUS,
meta_XWMA,
meta_VA3, /* DDR Supernova 2 AC */
meta_XOPUS,
meta_VS_SQUARE,
meta_NWAV,
meta_XPCM,
meta_MSF_TAMASOFT,
meta_XPS_DAT,
meta_ZSND,
meta_DSP_ADPY,
meta_DSP_ADPX,
meta_OGG_OPUS,
meta_IMC,
meta_GIN,
meta_DSF,
meta_208,
meta_DSP_DS2,
meta_MUS_VC,
meta_STRM_ABYLIGHT,
meta_MSF_KONAMI,
meta_XWMA_KONAMI,
meta_9TAV,
meta_BWAV,
meta_RAD,
meta_SMACKER,
meta_MZRT,
meta_XAVS,
meta_PSF,
meta_DSP_ITL_i,
meta_IMA,
meta_XWV_VALVE,
meta_UBI_HX,
meta_BMP_KONAMI,
meta_ISB,
meta_XSSB,
meta_XMA_UE3,
meta_FWSE,
meta_FDA,
meta_TGC,
meta_KWB,
meta_LRMD,
meta_WWISE_FX,
meta_DIVA,
meta_IMUSE,
meta_KTSR,
meta_KAT,
meta_PCM_SUCCESS,
meta_ADP_KONAMI,
meta_SDRH,
meta_WADY,
meta_DSP_SQEX,
meta_DSP_WIIVOICE,
meta_SBK,
meta_DSP_WIIADPCM,
meta_DSP_CWAC,
meta_COMPRESSWAVE,
meta_KTAC,
meta_MJB_MJH,
meta_BSNF,
meta_TAC,
meta_IDSP_TOSE,
meta_DSP_KWA,
meta_OGV_3RDEYE,
meta_PIFF_TPCM,
meta_WXD_WXH,
meta_BNK_RELIC,
meta_XSH_XSD_XSS,
meta_PSB,
meta_LOPU_FB,
meta_LPCM_FB,
meta_WBK,
meta_WBK_NSLB,
meta_DSP_APEX,
meta_MPEG,
meta_SSPF,
meta_S3V,
meta_ESF,
meta_ADM3,
meta_TT_AD,
meta_SNDZ,
meta_VAB,
meta_BIGRP,
} meta_t;
/* standard WAVEFORMATEXTENSIBLE speaker positions */
typedef enum {
speaker_FL = (1 << 0), /* front left */
speaker_FR = (1 << 1), /* front right */
speaker_FC = (1 << 2), /* front center */
speaker_LFE = (1 << 3), /* low frequency effects */
speaker_BL = (1 << 4), /* back left */
speaker_BR = (1 << 5), /* back right */
speaker_FLC = (1 << 6), /* front left center */
speaker_FRC = (1 << 7), /* front right center */
speaker_BC = (1 << 8), /* back center */
speaker_SL = (1 << 9), /* side left */
speaker_SR = (1 << 10), /* side right */
speaker_TC = (1 << 11), /* top center*/
speaker_TFL = (1 << 12), /* top front left */
speaker_TFC = (1 << 13), /* top front center */
speaker_TFR = (1 << 14), /* top front right */
speaker_TBL = (1 << 15), /* top back left */
speaker_TBC = (1 << 16), /* top back center */
speaker_TBR = (1 << 17), /* top back left */
} speaker_t;
/* typical mappings that metas may use to set channel_layout (but plugin must actually use it)
* (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR)
* not too sure about names but no clear standards */
typedef enum {
mapping_MONO = speaker_FC,
mapping_STEREO = speaker_FL | speaker_FR,
mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE,
mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */
mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR,
mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC,
mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR,
mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR,
mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR,
mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR,
mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR,
mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR,
mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC,
mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC,
mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR,
} mapping_t;
typedef struct {
int config_set; /* some of the mods below are set */
@ -961,7 +201,7 @@ typedef struct {
size_t stream_size; /* info to properly calculate bitrate in case of subsongs */
char stream_name[STREAM_NAME_SIZE]; /* name of the current stream (info), if the file stores it and it's filled */
/* mapping config (info for plugins) */
/* mapping config (info for plugins) see channel_mappings.h */
uint32_t channel_layout; /* order: FL FR FC LFE BL BR FLC FRC BC SL SR etc (WAVEFORMATEX flags where FL=lowest bit set) */
/* other config */
@ -1044,15 +284,6 @@ typedef struct {
} layered_layout_data;
/* libacm interface */
typedef struct {
STREAMFILE* streamfile;
void* handle;
void* io_config;
} acm_codec_data;
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
typedef struct {
STREAMFILE* streamfile;

View File

@ -0,0 +1,718 @@
#ifndef _VGMSTREAM_TYPES_H
#define _VGMSTREAM_TYPES_H
/* The encoding type specifies the format the sound data itself takes */
typedef enum {
coding_SILENCE, /* generates silence */
/* PCM */
coding_PCM16LE, /* little endian 16-bit PCM */
coding_PCM16BE, /* big endian 16-bit PCM */
coding_PCM16_int, /* 16-bit PCM with sample-level interleave (for blocks) */
coding_PCM8, /* 8-bit PCM */
coding_PCM8_int, /* 8-bit PCM with sample-level interleave (for blocks) */
coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */
coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0) with sample-level interleave (for blocks) */
coding_PCM8_SB, /* 8-bit PCM, sign bit (others are 2's complement) */
coding_PCM4, /* 4-bit PCM, signed */
coding_PCM4_U, /* 4-bit PCM, unsigned */
coding_ULAW, /* 8-bit u-Law (non-linear PCM) */
coding_ULAW_int, /* 8-bit u-Law (non-linear PCM) with sample-level interleave (for blocks) */
coding_ALAW, /* 8-bit a-Law (non-linear PCM) */
coding_PCMFLOAT, /* 32-bit float PCM */
coding_PCM24LE, /* little endian 24-bit PCM */
coding_PCM24BE, /* big endian 24-bit PCM */
/* ADPCM */
coding_CRI_ADX, /* CRI ADX */
coding_CRI_ADX_fixed, /* CRI ADX, encoding type 2 with fixed coefficients */
coding_CRI_ADX_exp, /* CRI ADX, encoding type 4 with exponential scale */
coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */
coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */
coding_NGC_DSP, /* Nintendo DSP ADPCM */
coding_NGC_DSP_subint, /* Nintendo DSP ADPCM with frame subinterframe */
coding_NGC_DTK, /* Nintendo DTK ADPCM (hardware disc), also called TRK or ADP */
coding_NGC_AFC, /* Nintendo AFC ADPCM */
coding_VADPCM, /* Silicon Graphics VADPCM */
coding_G721, /* CCITT G.721 */
coding_XA, /* CD-ROM XA 4-bit */
coding_XA8, /* CD-ROM XA 8-bit */
coding_XA_EA, /* EA's Saturn XA (not to be confused with EA-XA) */
coding_PSX, /* Sony PS ADPCM (VAG) */
coding_PSX_badflags, /* Sony PS ADPCM with custom flag byte */
coding_PSX_cfg, /* Sony PS ADPCM with configurable frame size (int math) */
coding_PSX_pivotal, /* Sony PS ADPCM with configurable frame size (float math) */
coding_HEVAG, /* Sony PSVita ADPCM */
coding_EA_XA, /* Electronic Arts EA-XA ADPCM v1 (stereo) aka "EA ADPCM" */
coding_EA_XA_int, /* Electronic Arts EA-XA ADPCM v1 (mono/interleave) */
coding_EA_XA_V2, /* Electronic Arts EA-XA ADPCM v2 */
coding_MAXIS_XA, /* Maxis EA-XA ADPCM */
coding_EA_XAS_V0, /* Electronic Arts EA-XAS ADPCM v0 */
coding_EA_XAS_V1, /* Electronic Arts EA-XAS ADPCM v1 */
coding_IMA, /* IMA ADPCM (stereo or mono, low nibble first) */
coding_IMA_int, /* IMA ADPCM (mono/interleave, low nibble first) */
coding_DVI_IMA, /* DVI IMA ADPCM (stereo or mono, high nibble first) */
coding_DVI_IMA_int, /* DVI IMA ADPCM (mono/interleave, high nibble first) */
coding_NW_IMA,
coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */
coding_QD_IMA,
coding_WV6_IMA, /* Gorilla Systems WV6 4-bit IMA ADPCM */
coding_HV_IMA, /* High Voltage 4-bit IMA ADPCM */
coding_FFTA2_IMA, /* Final Fantasy Tactics A2 4-bit IMA ADPCM */
coding_BLITZ_IMA, /* Blitz Games 4-bit IMA ADPCM */
coding_MS_IMA, /* Microsoft IMA ADPCM */
coding_MS_IMA_mono, /* Microsoft IMA ADPCM (mono/interleave) */
coding_XBOX_IMA, /* XBOX IMA ADPCM */
coding_XBOX_IMA_mch, /* XBOX IMA ADPCM (multichannel) */
coding_XBOX_IMA_int, /* XBOX IMA ADPCM (mono/interleave) */
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */
coding_RAD_IMA, /* Radical IMA ADPCM */
coding_RAD_IMA_mono, /* Radical IMA ADPCM (mono/interleave) */
coding_APPLE_IMA4, /* Apple Quicktime IMA4 */
coding_FSB_IMA, /* FMOD's FSB multichannel IMA ADPCM */
coding_WWISE_IMA, /* Audiokinetic Wwise IMA ADPCM */
coding_REF_IMA, /* Reflections IMA ADPCM */
coding_AWC_IMA, /* Rockstar AWC IMA ADPCM */
coding_UBI_IMA, /* Ubisoft IMA ADPCM */
coding_UBI_SCE_IMA, /* Ubisoft SCE IMA ADPCM */
coding_H4M_IMA, /* H4M IMA ADPCM (stereo or mono, high nibble first) */
coding_MTF_IMA, /* Capcom MT Framework IMA ADPCM */
coding_CD_IMA, /* Crystal Dynamics IMA ADPCM */
coding_MSADPCM, /* Microsoft ADPCM (stereo/mono) */
coding_MSADPCM_int, /* Microsoft ADPCM (mono) */
coding_MSADPCM_ck, /* Microsoft ADPCM (Cricket Audio variation) */
coding_WS, /* Westwood Studios VBR ADPCM */
coding_AICA, /* Yamaha AICA ADPCM (stereo) */
coding_AICA_int, /* Yamaha AICA ADPCM (mono/interleave) */
coding_CP_YM, /* Capcom's Yamaha ADPCM (stereo/mono) */
coding_ASKA, /* Aska ADPCM */
coding_NXAP, /* NXAP ADPCM */
coding_TGC, /* Tiger Game.com 4-bit ADPCM */
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
coding_L5_555, /* Level-5 0x555 ADPCM */
coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/
coding_MTAF, /* Konami MTAF ADPCM */
coding_MTA2, /* Konami MTA2 ADPCM */
coding_MC3, /* Paradigm MC3 3-bit ADPCM */
coding_FADPCM, /* FMOD FADPCM 4-bit ADPCM */
coding_ASF, /* Argonaut ASF 4-bit ADPCM */
coding_DSA, /* Ocean DSA 4-bit ADPCM */
coding_XMD, /* Konami XMD 4-bit ADPCM */
coding_TANTALUS, /* Tantalus 4-bit ADPCM */
coding_PCFX, /* PC-FX 4-bit ADPCM */
coding_OKI16, /* OKI 4-bit ADPCM with 16-bit output and modified expand */
coding_OKI4S, /* OKI 4-bit ADPCM with 16-bit output and cuadruple step */
coding_PTADPCM, /* Platinum 4-bit ADPCM */
coding_IMUSE, /* LucasArts iMUSE Variable ADPCM */
coding_COMPRESSWAVE, /* CompressWave Huffman ADPCM */
/* others */
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression DPCM */
coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression with sample-level interleave */
coding_CBD2, /* CBD2 2:1 Cuberoot-Delta-Exact compression DPCM */
coding_CBD2_int, /* CBD2 2:1 Cuberoot-Delta-Exact compression, with sample-level interleave */
coding_SASSC, /* Activision EXAKT SASSC 8-bit DPCM */
coding_DERF, /* DERF 8-bit DPCM */
coding_WADY, /* WADY 8-bit DPCM */
coding_NWA, /* VisualArt's NWA DPCM */
coding_ACM, /* InterPlay ACM */
coding_CIRCUS_ADPCM, /* Circus 8-bit ADPCM */
coding_UBI_ADPCM, /* Ubisoft 4/6-bit ADPCM */
coding_EA_MT, /* Electronic Arts MicroTalk (linear-predictive speech codec) */
coding_CIRCUS_VQ, /* Circus VQ */
coding_RELIC, /* Relic Codec (DCT-based) */
coding_CRI_HCA, /* CRI High Compression Audio (MDCT-based) */
coding_TAC, /* tri-Ace Codec (MDCT-based) */
coding_ICE_RANGE, /* Inti Creates "range" codec */
coding_ICE_DCT, /* Inti Creates "DCT" codec */
#ifdef VGM_USE_VORBIS
coding_OGG_VORBIS, /* Xiph Vorbis with Ogg layer (MDCT-based) */
coding_VORBIS_custom, /* Xiph Vorbis with custom layer (MDCT-based) */
#endif
#ifdef VGM_USE_MPEG
coding_MPEG_custom, /* MPEG audio with custom features (MDCT-based) */
coding_MPEG_ealayer3, /* EALayer3, custom MPEG frames */
coding_MPEG_layer1, /* MP1 MPEG audio (MDCT-based) */
coding_MPEG_layer2, /* MP2 MPEG audio (MDCT-based) */
coding_MPEG_layer3, /* MP3 MPEG audio (MDCT-based) */
#endif
#ifdef VGM_USE_G7221
coding_G7221C, /* ITU G.722.1 annex C (Polycom Siren 14) */
#endif
#ifdef VGM_USE_G719
coding_G719, /* ITU G.719 annex B (Polycom Siren 22) */
#endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
coding_MP4_AAC, /* AAC (MDCT-based) */
#endif
#ifdef VGM_USE_ATRAC9
coding_ATRAC9, /* Sony ATRAC9 (MDCT-based) */
#endif
#ifdef VGM_USE_CELT
coding_CELT_FSB, /* Custom Xiph CELT (MDCT-based) */
#endif
#ifdef VGM_USE_SPEEX
coding_SPEEX, /* Custom Speex (CELP-based) */
#endif
#ifdef VGM_USE_FFMPEG
coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */
#endif
} coding_t;
/* The layout type specifies how the sound data is laid out in the file */
typedef enum {
/* generic */
layout_none, /* straight data */
/* interleave */
layout_interleave, /* equal interleave throughout the stream */
/* headered blocks */
layout_blocked_ast,
layout_blocked_halpst,
layout_blocked_xa,
layout_blocked_ea_schl,
layout_blocked_ea_1snh,
layout_blocked_caf,
layout_blocked_wsi,
layout_blocked_str_snds,
layout_blocked_ws_aud,
layout_blocked_matx,
layout_blocked_dec,
layout_blocked_xvas,
layout_blocked_vs,
layout_blocked_mul,
layout_blocked_gsb,
layout_blocked_thp,
layout_blocked_filp,
layout_blocked_ea_swvr,
layout_blocked_adm,
layout_blocked_bdsp,
layout_blocked_mxch,
layout_blocked_ivaud, /* GTA IV .ivaud blocks */
layout_blocked_ps2_iab,
layout_blocked_vs_str,
layout_blocked_rws,
layout_blocked_hwas,
layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
layout_blocked_awc, /* Rockstar AWC */
layout_blocked_vgs, /* Guitar Hero II (PS2) */
layout_blocked_xwav,
layout_blocked_xvag_subsong, /* XVAG subsongs [God of War III (PS4)] */
layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */
layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */
layout_blocked_sthd, /* Dream Factory STHD */
layout_blocked_h4m, /* H4M video */
layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */
layout_blocked_vs_square,
layout_blocked_vid1,
layout_blocked_ubi_sce,
layout_blocked_tt_ad,
/* otherwise odd */
layout_segmented, /* song divided in segments (song sections) */
layout_layered, /* song divided in layers (song channels) */
} layout_t;
/* The meta type specifies how we know what we know about the file. */
typedef enum {
meta_SILENCE,
meta_DSP_STD, /* Nintendo standard GC ADPCM (DSP) header */
meta_DSP_CSTR, /* Star Fox Assault "Cstr" */
meta_DSP_RS03, /* Retro: Metroid Prime 2 "RS03" */
meta_DSP_STM, /* Paper Mario 2 STM */
meta_AGSC, /* Retro: Metroid Prime 2 title */
meta_CSMP, /* Retro: Metroid Prime 3 (Wii), Donkey Kong Country Returns (Wii) */
meta_RFRM, /* Retro: Donkey Kong Country Tropical Freeze (Wii U) */
meta_DSP_MPDSP, /* Monopoly Party single header stereo */
meta_DSP_JETTERS, /* Bomberman Jetters .dsp */
meta_DSP_MSS, /* Free Radical GC games */
meta_DSP_GCM, /* some of Traveller's Tales games */
meta_DSP_STR, /* Conan .str files */
meta_DSP_SADB, /* .sad */
meta_DSP_WSI, /* .wsi */
meta_IDSP_TT, /* Traveller's Tales games */
meta_DSP_WII_MUS, /* .mus */
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
meta_STRM, /* Nintendo STRM */
meta_RSTM, /* Nintendo RSTM (Revolution Stream, similar to STRM) */
meta_AFC, /* AFC */
meta_AST, /* AST */
meta_RWSD, /* single-stream RWSD */
meta_RWAR, /* single-stream RWAR */
meta_RWAV, /* contents of RWAR */
meta_CWAV, /* contents of CWAR */
meta_FWAV, /* contents of FWAR */
meta_THP, /* THP movie files */
meta_SWAV,
meta_NDS_RRDS, /* Ridge Racer DS */
meta_WII_BNS, /* Wii BNS Banner Sound (similar to RSTM) */
meta_WIIU_BTSND, /* Wii U Boot Sound */
meta_ADX_03, /* CRI ADX "type 03" */
meta_ADX_04, /* CRI ADX "type 04" */
meta_ADX_05, /* CRI ADX "type 05" */
meta_AIX, /* CRI AIX */
meta_AAX, /* CRI AAX */
meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */
meta_DTK,
meta_RSF,
meta_HALPST, /* HAL Labs HALPST */
meta_GCSW, /* GCSW (PCM) */
meta_CAF, /* tri-Crescendo CAF */
meta_MYSPD, /* U-Sing .myspd */
meta_HIS, /* Her Ineractive .his */
meta_BNSF, /* Bandai Namco Sound Format */
meta_XA, /* CD-ROM XA */
meta_ADS,
meta_NPS,
meta_RXWS,
meta_RAW_INT,
meta_EXST,
meta_SVAG_KCET,
meta_PS_HEADERLESS, /* headerless PS-ADPCM */
meta_MIB_MIH,
meta_PS2_MIC, /* KOEI MIC File */
meta_PS2_VAGi, /* VAGi Interleaved File */
meta_PS2_VAGp, /* VAGp Mono File */
meta_PS2_pGAV, /* VAGp with Little Endian Header */
meta_PS2_VAGp_AAAP, /* Acclaim Austin Audio VAG header */
meta_SEB,
meta_STR_WAV, /* Blitz Games STR+WAV files */
meta_ILD,
meta_PS2_PNB, /* PsychoNauts Bgm File */
meta_VPK, /* VPK Audio File */
meta_PS2_BMDX, /* Beatmania thing */
meta_PS2_IVB, /* Langrisser 3 IVB */
meta_PS2_SND, /* some Might & Magics SSND header */
meta_SVS, /* Square SVS */
meta_XSS, /* Dino Crisis 3 */
meta_SL3, /* Test Drive Unlimited */
meta_HGC1, /* Knights of the Temple 2 */
meta_AUS, /* Various Capcom games */
meta_RWS, /* RenderWare games (only when using RW Audio middleware) */
meta_FSB1, /* FMOD Sample Bank, version 1 */
meta_FSB2, /* FMOD Sample Bank, version 2 */
meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */
meta_FSB4, /* FMOD Sample Bank, version 4 */
meta_FSB5, /* FMOD Sample Bank, version 5 */
meta_RWX, /* Air Force Delta Storm (XBOX) */
meta_XWB, /* Microsoft XACT framework (Xbox, X360, Windows) */
meta_PS2_XA30, /* Driver - Parallel Lines (PS2) */
meta_MUSC, /* Krome PS2 games */
meta_MUSX,
meta_LEG, /* Legaia 2 [no header_id] */
meta_FILP, /* Resident Evil - Dead Aim */
meta_IKM,
meta_STER,
meta_BG00, /* Ibara, Mushihimesama */
meta_PS2_RSTM, /* Midnight Club 3 */
meta_PS2_KCES, /* Dance Dance Revolution */
meta_HXD,
meta_VSV,
meta_SCD_PCM, /* Lunar - Eternal Blue */
meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */
meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */
meta_PS2_VAS, /* Pro Baseball Spirits 5 */
meta_PS2_ENTH, /* Enthusia */
meta_SDT, /* Baldur's Gate - Dark Alliance */
meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */
meta_DC_STR, /* SEGA Stream Asset Builder */
meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */
meta_NGC_BH2PCM, /* Bio Hazard 2 */
meta_SAP,
meta_DC_IDVI, /* Eldorado Gate */
meta_KRAW, /* Geometry Wars - Galaxies */
meta_PS2_OMU, /* PS2 Int file with Header */
meta_PS2_XA2, /* XG3 Extreme-G Racing */
meta_NUB,
meta_IDSP_NL, /* Mario Strikers Charged (Wii) */
meta_IDSP_IE, /* Defencer (GC) */
meta_SPT_SPD, /* Various (SPT+SPT DSP) */
meta_ISH_ISD, /* Various (ISH+ISD DSP) */
meta_GSP_GSB, /* Tecmo games (Super Swing Golf 1 & 2, Quamtum Theory) */
meta_YDSP, /* WWE Day of Reckoning */
meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */
meta_UBI_JADE, /* Beyond Good & Evil, Rayman Raving Rabbids */
meta_GCA, /* Metal Slug Anthology */
meta_NGC_SSM, /* Golden Gashbell Full Power */
meta_PS2_JOE, /* Wall-E / Pixar games */
meta_NGC_YMF, /* WWE WrestleMania X8 */
meta_SADL,
meta_FAG, /* Jackie Chan - Stuntmaster */
meta_PS2_MIHB, /* Merged MIH+MIB */
meta_NGC_PDT, /* Mario Party 6 */
meta_DC_ASD, /* Miss Moonligh */
meta_SPSD,
meta_RSD,
meta_PS2_ASS, /* ASS */
meta_SEG, /* Eragon */
meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */
meta_KNON,
meta_ZWDSP, /* Zack and Wiki */
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
meta_DCS_WAV,
meta_SMP,
meta_WII_SNG, /* Excite Trucks */
meta_MUL,
meta_SAT_BAKA, /* Crypt Killer */
meta_VSF,
meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */
meta_ADS_MIDWAY,
meta_PS2_SPS, /* Ape Escape 2 */
meta_PS2_XA2_RRP, /* RC Revenge Pro */
meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */
meta_UBI_CKD, /* Ubisoft CKD RIFF header (Rayman Origins Wii) */
meta_RAW_WAVM,
meta_WVS,
meta_XBOX_MATX, /* XBOX MATX */
meta_XMU,
meta_XVAS,
meta_EA_SCHL, /* Electronic Arts SCHl with variable header */
meta_EA_SCHL_fixed, /* Electronic Arts SCHl with fixed header */
meta_EA_BNK, /* Electronic Arts BNK */
meta_EA_1SNH, /* Electronic Arts 1SNh/EACS */
meta_EA_EACS,
meta_RAW_PCM,
meta_GENH, /* generic header */
meta_AIFC, /* Audio Interchange File Format AIFF-C */
meta_AIFF, /* Audio Interchange File Format */
meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */
meta_WS_AUD, /* Westwood Studios .aud */
meta_WS_AUD_old, /* Westwood Studios .aud, old style */
meta_RIFF_WAVE, /* RIFF, for WAVs */
meta_RIFF_WAVE_POS, /* .wav + .pos for looping (Ys Complete PC) */
meta_RIFF_WAVE_labl, /* RIFF w/ loop Markers in LIST-adtl-labl */
meta_RIFF_WAVE_smpl, /* RIFF w/ loop data in smpl chunk */
meta_RIFF_WAVE_wsmp, /* RIFF w/ loop data in wsmp chunk */
meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */
meta_RIFX_WAVE, /* RIFX, for big-endian WAVs */
meta_RIFX_WAVE_smpl, /* RIFX w/ loop data in smpl chunk */
meta_XNB, /* XNA Game Studio 4.0 */
meta_PC_MXST, /* Lego Island MxSt */
meta_SAB, /* Worms 4 Mayhem SAB+SOB file */
meta_NWA, /* Visual Art's NWA */
meta_NWA_NWAINFOINI, /* Visual Art's NWA w/ NWAINFO.INI for looping */
meta_NWA_GAMEEXEINI, /* Visual Art's NWA w/ Gameexe.ini for looping */
meta_SAT_DVI, /* Konami KCE Nagoya DVI (SAT games) */
meta_DC_KCEY, /* Konami KCE Yokohama KCEYCOMP (DC games) */
meta_ACM, /* InterPlay ACM header */
meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */
meta_DEC, /* Falcom PC games (Xanadu Next, Gurumin) */
meta_VS, /* Men in Black .vs */
meta_FFXI_BGW, /* FFXI (PC) BGW */
meta_FFXI_SPW, /* FFXI (PC) SPW */
meta_STS,
meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */
meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */
meta_NGC_DSP_IADP, /* Gamecube Interleave DSP */
meta_PS2_TK5, /* Tekken 5 Stream Files */
meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */
meta_ZSD, /* Dragon Booster ZSD */
meta_REDSPARK, /* "RedSpark" RSD (MadWorld) */
meta_IVAUD, /* .ivaud GTA IV */
meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */
meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */
meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */
meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */
meta_PS2_VGV, /* Rune: Viking Warlord */
meta_GCUB,
meta_MAXIS_XA, /* Sim City 3000 (PC) */
meta_NGC_SCK_DSP, /* Scorpion King (NGC) */
meta_CAFF, /* iPhone .caf */
meta_EXAKT_SC, /* Activision EXAKT .SC (PS2) */
meta_WII_WAS, /* DiRT 2 (WII) */
meta_PONA_3DO, /* Policenauts (3DO) */
meta_PONA_PSX, /* Policenauts (PSX) */
meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */
meta_AST_MV,
meta_AST_MMV,
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
meta_S14, /* raw Siren 14, 24kbit mono */
meta_SSS, /* raw Siren 14, 48kbit stereo */
meta_PS2_GCM, /* NamCollection */
meta_PS2_SMPL, /* Homura */
meta_PS2_MSA, /* Psyvariar -Complete Edition- */
meta_PS2_VOI, /* RAW Danger (Zettaizetsumei Toshi 2 - Itetsuita Kiokutachi) [PS2] */
meta_P3D, /* Prototype P3D */
meta_PS2_TK1, /* Tekken (NamCollection) */
meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */
meta_DSP_DDSP, /* Various (2 dsp files stuck together */
meta_NGC_DSP_MPDS, /* Big Air Freestyle, Terminator 3 */
meta_DSP_STR_IG, /* Micro Machines, Superman Superman: Shadow of Apokolis */
meta_EA_SWVR, /* Future Cop L.A.P.D., Freekstyle */
meta_PS2_B1S, /* 7 Wonders of the ancient world */
meta_PS2_WAD, /* The golden Compass */
meta_DSP_XIII, /* XIII, possibly more (Ubisoft header???) */
meta_DSP_CABELAS, /* Cabelas games */
meta_PS2_ADM, /* Dragon Quest V (PS2) */
meta_LPCM_SHADE,
meta_DSP_BDSP, /* Ah! My Goddess */
meta_PS2_VMS, /* Autobahn Raser - Police Madness */
meta_XAU, /* XPEC Entertainment (Beat Down (PS2 Xbox), Spectral Force Chronicle (PS2)) */
meta_GH3_BAR, /* Guitar Hero III Mobile .bar */
meta_FFW, /* Freedom Fighters [NGC] */
meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */
meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */
meta_SQEX_SCD, /* Square-Enix SCD */
meta_NGC_NST_DSP, /* Animaniacs [NGC] */
meta_BAF, /* Bizarre Creations (Blur, James Bond) */
meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_CPS,
meta_MSF,
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */
meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */
meta_SPM,
meta_VGS_PS,
meta_PS2_IAB, /* Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */
meta_VS_STR, /* The Bouncer */
meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */
meta_XWAV,
meta_RAW_SNDS,
meta_PS2_WMUS, /* The Warriors (PS2) */
meta_HYPERSCAN_KVAG, /* Hyperscan KVAG/BVG */
meta_IOS_PSND, /* Crash Bandicoot Nitro Kart 2 (iOS) */
meta_BOS_ADP,
meta_QD_ADP,
meta_EB_SFX, /* Excitebots .sfx */
meta_EB_SF0, /* Excitebots .sf0 */
meta_MTAF,
meta_PS2_VAG1, /* Metal Gear Solid 3 VAG1 */
meta_PS2_VAG2, /* Metal Gear Solid 3 VAG2 */
meta_ALP,
meta_WPD, /* Shuffle! (PC) */
meta_MN_STR, /* Mini Ninjas (PC/PS3/WII) */
meta_MSS, /* Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */
meta_PS2_HSF, /* Lowrider (PS2) */
meta_IVAG,
meta_PS2_2PFS, /* Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2) */
meta_PS2_VBK, /* Disney's Stitch - Experiment 626 */
meta_OTM, /* Otomedius (Arcade) */
meta_CSTM, /* Nintendo 3DS CSTM (Century Stream) */
meta_FSTM, /* Nintendo Wii U FSTM (caFe? Stream) */
meta_IDSP_NAMCO,
meta_KT_WIIBGM, /* Koei Tecmo WiiBGM */
meta_KTSS, /* Koei Tecmo Nintendo Stream (KNS) */
meta_MCA, /* Capcom MCA "MADP" */
meta_XB3D_ADX, /* Xenoblade Chronicles 3D ADX */
meta_HCA, /* CRI HCA */
meta_SVAG_SNK,
meta_PS2_VDS_VDM, /* Graffiti Kingdom */
meta_FFMPEG,
meta_FFMPEG_faulty,
meta_CXS,
meta_AKB,
meta_PASX,
meta_XMA_RIFF,
meta_ASTB,
meta_WWISE_RIFF, /* Audiokinetic Wwise RIFF/RIFX */
meta_UBI_RAKI, /* Ubisoft RAKI header (Rayman Legends, Just Dance 2017) */
meta_SXD, /* Sony SXD (Gravity Rush, Freedom Wars PSV) */
meta_OGL, /* Shin'en Wii/WiiU (Jett Rocket (Wii), FAST Racing NEO (WiiU)) */
meta_MC3, /* Paradigm games (T3 PS2, MX Rider PS2, MI: Operation Surma PS2) */
meta_GHS,
meta_AAC_TRIACE,
meta_MTA2,
meta_NGC_ULW, /* Burnout 1 (GC only) */
meta_XA_XA30,
meta_XA_04SW,
meta_TXTH, /* generic text header */
meta_SK_AUD, /* Silicon Knights .AUD (Eternal Darkness GC) */
meta_AHX,
meta_STM, /* Angel Studios/Rockstar San Diego Games */
meta_BINK, /* RAD Game Tools BINK audio/video */
meta_EA_SNU, /* Electronic Arts SNU (Dead Space) */
meta_AWC, /* Rockstar AWC (GTA5, RDR) */
meta_OPUS, /* Nintendo Opus [Lego City Undercover (Switch)] */
meta_RAW_AL,
meta_PC_AST, /* Dead Rising (PC) */
meta_NAAC, /* Namco AAC (3DS) */
meta_UBI_SB, /* Ubisoft banks */
meta_EZW, /* EZ2DJ (Arcade) EZWAV */
meta_VXN, /* Gameloft mobile games */
meta_EA_SNR_SNS, /* Electronic Arts SNR+SNS (Burnout Paradise) */
meta_EA_SPS, /* Electronic Arts SPS (Burnout Crash) */
meta_VID1,
meta_PC_FLX, /* Ultima IX PC */
meta_MOGG, /* Harmonix Music Systems MOGG Vorbis */
meta_OGG_VORBIS, /* Ogg Vorbis */
meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */
meta_OPUS_SLI, /* Ogg Opus file w/ companion .sli for looping */
meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */
meta_OGG_KOVS, /* Ogg Vorbis with header and encryption (Koei Tecmo Games) */
meta_OGG_encrypted, /* Ogg Vorbis with encryption */
meta_KMA9, /* Koei Tecmo [Nobunaga no Yabou - Souzou (Vita)] */
meta_XWC, /* Starbreeze games */
meta_SQEX_SAB, /* Square-Enix newest middleware (sound) */
meta_SQEX_MAB, /* Square-Enix newest middleware (music) */
meta_WAF, /* KID WAF [Ever 17 (PC)] */
meta_WAVE, /* EngineBlack games [Mighty Switch Force! (3DS)] */
meta_WAVE_segmented, /* EngineBlack games, segmented [Shantae and the Pirate's Curse (PC)] */
meta_SMV, /* Cho Aniki Zero (PSP) */
meta_NXAP, /* Nex Entertainment games [Time Crisis 4 (PS3), Time Crisis Razing Storm (PS3)] */
meta_EA_WVE_AU00, /* Electronic Arts PS movies [Future Cop - L.A.P.D. (PS), Supercross 2000 (PS)] */
meta_EA_WVE_AD10, /* Electronic Arts PS movies [Wing Commander 3/4 (PS)] */
meta_STHD, /* STHD .stx [Kakuto Chojin (Xbox)] */
meta_MP4, /* MP4/AAC */
meta_PCM_SRE, /* .PCM+SRE [Viewtiful Joe (PS2)] */
meta_DSP_MCADPCM, /* Skyrim (Switch) */
meta_UBI_LYN, /* Ubisoft LyN engine [The Adventures of Tintin (multi)] */
meta_MSB_MSH, /* sfx companion of MIH+MIB */
meta_TXTP, /* generic text playlist */
meta_SMC_SMH, /* Wangan Midnight (System 246) */
meta_PPST, /* PPST [Parappa the Rapper (PSP)] */
meta_SPS_N1,
meta_UBI_BAO, /* Ubisoft BAO */
meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */
meta_H4M, /* Hudson HVQM4 video [Resident Evil 0 (GC), Tales of Symphonia (GC)] */
meta_ASF, /* Argonaut ASF [Croc 2 (PC)] */
meta_XMD, /* Konami XMD [Silent Hill 4 (Xbox), Castlevania: Curse of Darkness (Xbox)] */
meta_CKS, /* Cricket Audio stream [Part Time UFO (Android), Mega Man 1-6 (Android)] */
meta_CKB, /* Cricket Audio bank [Fire Emblem Heroes (Android), Mega Man 1-6 (Android)] */
meta_WV6, /* Gorilla Systems PC games */
meta_WAVEBATCH, /* Firebrand Games */
meta_HD3_BD3, /* Sony PS3 bank */
meta_BNK_SONY, /* Sony Scream Tool bank */
meta_SSCF,
meta_DSP_VAG, /* Penny-Punching Princess (Switch) sfx */
meta_DSP_ITL, /* Charinko Hero (GC) */
meta_A2M, /* Scooby-Doo! Unmasked (PS2) */
meta_AHV, /* Headhunter (PS2) */
meta_MSV,
meta_SDF,
meta_SVG, /* Hunter - The Reckoning - Wayward (PS2) */
meta_VIS, /* AirForce Delta Strike (PS2) */
meta_VAI, /* Ratatouille (GC) */
meta_AIF_ASOBO, /* Ratatouille (PC) */
meta_AO, /* Cloudphobia (PC) */
meta_APC, /* MegaRace 3 (PC) */
meta_WV2, /* Slave Zero (PC) */
meta_XAU_KONAMI, /* Yu-Gi-Oh - The Dawn of Destiny (Xbox) */
meta_DERF, /* Stupid Invaders (PC) */
meta_SADF,
meta_UTK,
meta_NXA,
meta_ADPCM_CAPCOM,
meta_UE4OPUS,
meta_XWMA,
meta_VA3, /* DDR Supernova 2 AC */
meta_XOPUS,
meta_VS_SQUARE,
meta_NWAV,
meta_XPCM,
meta_MSF_TAMASOFT,
meta_XPS_DAT,
meta_ZSND,
meta_DSP_ADPY,
meta_DSP_ADPX,
meta_OGG_OPUS,
meta_IMC,
meta_GIN,
meta_DSF,
meta_208,
meta_DSP_DS2,
meta_MUS_VC,
meta_STRM_ABYLIGHT,
meta_MSF_KONAMI,
meta_XWMA_KONAMI,
meta_9TAV,
meta_BWAV,
meta_RAD,
meta_SMACKER,
meta_MZRT,
meta_XAVS,
meta_PSF,
meta_DSP_ITL_i,
meta_IMA,
meta_XWV_VALVE,
meta_UBI_HX,
meta_BMP_KONAMI,
meta_ISB,
meta_XSSB,
meta_XMA_UE3,
meta_FWSE,
meta_FDA,
meta_TGC,
meta_KWB,
meta_LRMD,
meta_WWISE_FX,
meta_DIVA,
meta_IMUSE,
meta_KTSR,
meta_KAT,
meta_PCM_SUCCESS,
meta_ADP_KONAMI,
meta_SDRH,
meta_WADY,
meta_DSP_SQEX,
meta_DSP_WIIVOICE,
meta_SBK,
meta_DSP_WIIADPCM,
meta_DSP_CWAC,
meta_COMPRESSWAVE,
meta_KTAC,
meta_MJB_MJH,
meta_BSNF,
meta_TAC,
meta_IDSP_TOSE,
meta_DSP_KWA,
meta_OGV_3RDEYE,
meta_PIFF_TPCM,
meta_WXD_WXH,
meta_BNK_RELIC,
meta_XSH_XSD_XSS,
meta_PSB,
meta_LOPU_FB,
meta_LPCM_FB,
meta_WBK,
meta_WBK_NSLB,
meta_DSP_APEX,
meta_MPEG,
meta_SSPF,
meta_S3V,
meta_ESF,
meta_ADM3,
meta_TT_AD,
meta_SNDZ,
meta_VAB,
meta_BIGRP,
} meta_t;
#endif

Some files were not shown because too many files have changed in this diff Show More