Updated VGMStream to r1626-15-g49dfc218
This commit is contained in:
parent
f3f5d67b2f
commit
dea022a323
30 changed files with 702 additions and 346 deletions
|
@ -97,8 +97,6 @@
|
||||||
831BA6211EAC61A500CF89B0 /* x360_pasx.c in Sources */ = {isa = PBXBuildFile; fileRef = 831BA6171EAC61A500CF89B0 /* x360_pasx.c */; };
|
831BA6211EAC61A500CF89B0 /* x360_pasx.c in Sources */ = {isa = PBXBuildFile; fileRef = 831BA6171EAC61A500CF89B0 /* x360_pasx.c */; };
|
||||||
831BA6281EAC61CB00CF89B0 /* coding_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 831BA6221EAC61CB00CF89B0 /* coding_utils.c */; };
|
831BA6281EAC61CB00CF89B0 /* coding_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 831BA6221EAC61CB00CF89B0 /* coding_utils.c */; };
|
||||||
8322ECE7240268BB009E9429 /* raw_al.c in Sources */ = {isa = PBXBuildFile; fileRef = 8322ECE6240268BA009E9429 /* raw_al.c */; };
|
8322ECE7240268BB009E9429 /* raw_al.c in Sources */ = {isa = PBXBuildFile; fileRef = 8322ECE6240268BA009E9429 /* raw_al.c */; };
|
||||||
8323894A1D22419B00482226 /* clHCA.c in Sources */ = {isa = PBXBuildFile; fileRef = 832389481D22419B00482226 /* clHCA.c */; };
|
|
||||||
8323894B1D22419B00482226 /* clHCA.h in Headers */ = {isa = PBXBuildFile; fileRef = 832389491D22419B00482226 /* clHCA.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
832389501D2246C300482226 /* hca.c in Sources */ = {isa = PBXBuildFile; fileRef = 8323894F1D2246C300482226 /* hca.c */; };
|
832389501D2246C300482226 /* hca.c in Sources */ = {isa = PBXBuildFile; fileRef = 8323894F1D2246C300482226 /* hca.c */; };
|
||||||
832389521D224C0800482226 /* hca_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 832389511D224C0800482226 /* hca_decoder.c */; };
|
832389521D224C0800482226 /* hca_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 832389511D224C0800482226 /* hca_decoder.c */; };
|
||||||
83269DD22399F5DE00F49FE3 /* nus3bank_streamfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 83269DD02399F5DD00F49FE3 /* nus3bank_streamfile.h */; };
|
83269DD22399F5DE00F49FE3 /* nus3bank_streamfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 83269DD02399F5DD00F49FE3 /* nus3bank_streamfile.h */; };
|
||||||
|
@ -655,6 +653,9 @@
|
||||||
83FC176E23AC58D100E1025F /* csb.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FC176B23AC58D100E1025F /* csb.c */; };
|
83FC176E23AC58D100E1025F /* csb.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FC176B23AC58D100E1025F /* csb.c */; };
|
||||||
83FC176F23AC58D100E1025F /* cri_utf.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FC176C23AC58D100E1025F /* cri_utf.h */; };
|
83FC176F23AC58D100E1025F /* cri_utf.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FC176C23AC58D100E1025F /* cri_utf.h */; };
|
||||||
83FC177123AC59A800E1025F /* cri_utf.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FC177023AC59A800E1025F /* cri_utf.c */; };
|
83FC177123AC59A800E1025F /* cri_utf.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FC177023AC59A800E1025F /* cri_utf.c */; };
|
||||||
|
83FC417026D32FF5009A2022 /* hca_decoder_clhca.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FC416E26D32FF5009A2022 /* hca_decoder_clhca.h */; };
|
||||||
|
83FC417126D32FF5009A2022 /* hca_decoder_clhca.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FC416F26D32FF5009A2022 /* hca_decoder_clhca.c */; };
|
||||||
|
83FC417326D3304D009A2022 /* xsh_xsd_xss.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FC417226D3304D009A2022 /* xsh_xsd_xss.c */; };
|
||||||
83FF0EBC1E93282100C58054 /* wwise.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FF0EBB1E93282100C58054 /* wwise.c */; };
|
83FF0EBC1E93282100C58054 /* wwise.c in Sources */ = {isa = PBXBuildFile; fileRef = 83FF0EBB1E93282100C58054 /* wwise.c */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
@ -898,8 +899,6 @@
|
||||||
831BA6221EAC61CB00CF89B0 /* coding_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = coding_utils.c; sourceTree = "<group>"; };
|
831BA6221EAC61CB00CF89B0 /* coding_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = coding_utils.c; sourceTree = "<group>"; };
|
||||||
831BD11F1EEE1CF200198540 /* ngc_ulw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ngc_ulw.c; sourceTree = "<group>"; };
|
831BD11F1EEE1CF200198540 /* ngc_ulw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ngc_ulw.c; sourceTree = "<group>"; };
|
||||||
8322ECE6240268BA009E9429 /* raw_al.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raw_al.c; sourceTree = "<group>"; };
|
8322ECE6240268BA009E9429 /* raw_al.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raw_al.c; sourceTree = "<group>"; };
|
||||||
832389481D22419B00482226 /* clHCA.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = clHCA.c; sourceTree = "<group>"; };
|
|
||||||
832389491D22419B00482226 /* clHCA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clHCA.h; sourceTree = "<group>"; };
|
|
||||||
8323894F1D2246C300482226 /* hca.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hca.c; sourceTree = "<group>"; };
|
8323894F1D2246C300482226 /* hca.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hca.c; sourceTree = "<group>"; };
|
||||||
832389511D224C0800482226 /* hca_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hca_decoder.c; sourceTree = "<group>"; };
|
832389511D224C0800482226 /* hca_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hca_decoder.c; sourceTree = "<group>"; };
|
||||||
83269DD02399F5DD00F49FE3 /* nus3bank_streamfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nus3bank_streamfile.h; sourceTree = "<group>"; };
|
83269DD02399F5DD00F49FE3 /* nus3bank_streamfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nus3bank_streamfile.h; sourceTree = "<group>"; };
|
||||||
|
@ -1452,6 +1451,9 @@
|
||||||
83FC176B23AC58D100E1025F /* csb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = csb.c; sourceTree = "<group>"; };
|
83FC176B23AC58D100E1025F /* csb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = csb.c; sourceTree = "<group>"; };
|
||||||
83FC176C23AC58D100E1025F /* cri_utf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cri_utf.h; sourceTree = "<group>"; };
|
83FC176C23AC58D100E1025F /* cri_utf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cri_utf.h; sourceTree = "<group>"; };
|
||||||
83FC177023AC59A800E1025F /* cri_utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cri_utf.c; sourceTree = "<group>"; };
|
83FC177023AC59A800E1025F /* cri_utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cri_utf.c; sourceTree = "<group>"; };
|
||||||
|
83FC416E26D32FF5009A2022 /* hca_decoder_clhca.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hca_decoder_clhca.h; sourceTree = "<group>"; };
|
||||||
|
83FC416F26D32FF5009A2022 /* hca_decoder_clhca.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hca_decoder_clhca.c; sourceTree = "<group>"; };
|
||||||
|
83FC417226D3304D009A2022 /* xsh_xsd_xss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xsh_xsd_xss.c; sourceTree = "<group>"; };
|
||||||
83FF0EBB1E93282100C58054 /* wwise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wwise.c; sourceTree = "<group>"; };
|
83FF0EBB1E93282100C58054 /* wwise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wwise.c; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
@ -1494,15 +1496,6 @@
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
832389471D22419B00482226 /* ext_libs */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
832389481D22419B00482226 /* clHCA.c */,
|
|
||||||
832389491D22419B00482226 /* clHCA.h */,
|
|
||||||
);
|
|
||||||
path = ext_libs;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
835FC6C223F62AEE006960FA /* Products */ = {
|
835FC6C223F62AEE006960FA /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -1567,7 +1560,6 @@
|
||||||
836F6B4218BDB8880095E648 /* vgmstream */ = {
|
836F6B4218BDB8880095E648 /* vgmstream */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
832389471D22419B00482226 /* ext_libs */,
|
|
||||||
836F6DDE18BDC2180095E648 /* src */,
|
836F6DDE18BDC2180095E648 /* src */,
|
||||||
836F6B4318BDB8880095E648 /* Supporting Files */,
|
836F6B4318BDB8880095E648 /* Supporting Files */,
|
||||||
);
|
);
|
||||||
|
@ -1654,6 +1646,8 @@
|
||||||
8373341323F60C7B00DE14DC /* g7221_decoder_lib.c */,
|
8373341323F60C7B00DE14DC /* g7221_decoder_lib.c */,
|
||||||
8373341523F60C7B00DE14DC /* g7221_decoder_lib.h */,
|
8373341523F60C7B00DE14DC /* g7221_decoder_lib.h */,
|
||||||
836F6DE818BDC2180095E648 /* g7221_decoder.c */,
|
836F6DE818BDC2180095E648 /* g7221_decoder.c */,
|
||||||
|
83FC416F26D32FF5009A2022 /* hca_decoder_clhca.c */,
|
||||||
|
83FC416E26D32FF5009A2022 /* hca_decoder_clhca.h */,
|
||||||
832389511D224C0800482226 /* hca_decoder.c */,
|
832389511D224C0800482226 /* hca_decoder.c */,
|
||||||
836F6DEA18BDC2180095E648 /* ima_decoder.c */,
|
836F6DEA18BDC2180095E648 /* ima_decoder.c */,
|
||||||
83F1EE28245D4FB10076E182 /* imuse_decoder.c */,
|
83F1EE28245D4FB10076E182 /* imuse_decoder.c */,
|
||||||
|
@ -2211,6 +2205,7 @@
|
||||||
832BF80A21E05148006F50F1 /* xpcm.c */,
|
832BF80A21E05148006F50F1 /* xpcm.c */,
|
||||||
832BF80C21E05148006F50F1 /* xps.c */,
|
832BF80C21E05148006F50F1 /* xps.c */,
|
||||||
83A8BAE225667AA7000F5F3F /* xse.c */,
|
83A8BAE225667AA7000F5F3F /* xse.c */,
|
||||||
|
83FC417226D3304D009A2022 /* xsh_xsd_xss.c */,
|
||||||
836F6F1218BDC2190095E648 /* xss.c */,
|
836F6F1218BDC2190095E648 /* xss.c */,
|
||||||
83AFABB923795201002F3947 /* xssb.c */,
|
83AFABB923795201002F3947 /* xssb.c */,
|
||||||
834FE0C6215C79E7000A5D3D /* xvag_streamfile.h */,
|
834FE0C6215C79E7000A5D3D /* xvag_streamfile.h */,
|
||||||
|
@ -2312,7 +2307,6 @@
|
||||||
836F705418BDC2190095E648 /* streamfile.h in Headers */,
|
836F705418BDC2190095E648 /* streamfile.h in Headers */,
|
||||||
83A3F0761E3AD8B900D6A794 /* stack_alloc.h in Headers */,
|
83A3F0761E3AD8B900D6A794 /* stack_alloc.h in Headers */,
|
||||||
8373342723F60CDC00DE14DC /* lrmd_streamfile.h in Headers */,
|
8373342723F60CDC00DE14DC /* lrmd_streamfile.h in Headers */,
|
||||||
8323894B1D22419B00482226 /* clHCA.h in Headers */,
|
|
||||||
83C7281122BC893D00678B4A /* 9tav_streamfile.h in Headers */,
|
83C7281122BC893D00678B4A /* 9tav_streamfile.h in Headers */,
|
||||||
83C7280F22BC893D00678B4A /* xwb_xsb.h in Headers */,
|
83C7280F22BC893D00678B4A /* xwb_xsb.h in Headers */,
|
||||||
83AA7F732519BFEA004C5298 /* mpeg_bitreader.h in Headers */,
|
83AA7F732519BFEA004C5298 /* mpeg_bitreader.h in Headers */,
|
||||||
|
@ -2346,6 +2340,7 @@
|
||||||
83031EDD243C510500C3F3E0 /* xnb_streamfile.h in Headers */,
|
83031EDD243C510500C3F3E0 /* xnb_streamfile.h in Headers */,
|
||||||
83D2007B248DDB770048BD24 /* mups_streamfile.h in Headers */,
|
83D2007B248DDB770048BD24 /* mups_streamfile.h in Headers */,
|
||||||
83AA7F8B2519C076004C5298 /* render.h in Headers */,
|
83AA7F8B2519C076004C5298 /* render.h in Headers */,
|
||||||
|
83FC417026D32FF5009A2022 /* hca_decoder_clhca.h in Headers */,
|
||||||
8373341623F60C7B00DE14DC /* g7221_decoder_aes.h in Headers */,
|
8373341623F60C7B00DE14DC /* g7221_decoder_aes.h in Headers */,
|
||||||
8373341923F60C7B00DE14DC /* g7221_decoder_lib_data.h in Headers */,
|
8373341923F60C7B00DE14DC /* g7221_decoder_lib_data.h in Headers */,
|
||||||
83AFABBD23795202002F3947 /* ea_eaac_opus_streamfile.h in Headers */,
|
83AFABBD23795202002F3947 /* ea_eaac_opus_streamfile.h in Headers */,
|
||||||
|
@ -2615,6 +2610,7 @@
|
||||||
83299FD01E7660C7003A3242 /* bik.c in Sources */,
|
83299FD01E7660C7003A3242 /* bik.c in Sources */,
|
||||||
8346D97C25BF838C00D1A8B0 /* mjb_mjh.c in Sources */,
|
8346D97C25BF838C00D1A8B0 /* mjb_mjh.c in Sources */,
|
||||||
8373341823F60C7B00DE14DC /* tgcadpcm_decoder.c in Sources */,
|
8373341823F60C7B00DE14DC /* tgcadpcm_decoder.c in Sources */,
|
||||||
|
83FC417326D3304D009A2022 /* xsh_xsd_xss.c in Sources */,
|
||||||
836F6F3318BDC2190095E648 /* ngc_dtk_decoder.c in Sources */,
|
836F6F3318BDC2190095E648 /* ngc_dtk_decoder.c in Sources */,
|
||||||
83E7FD6525EF2B2400683FD2 /* tac.c in Sources */,
|
83E7FD6525EF2B2400683FD2 /* tac.c in Sources */,
|
||||||
83C7281322BC893D00678B4A /* mta2.c in Sources */,
|
83C7281322BC893D00678B4A /* mta2.c in Sources */,
|
||||||
|
@ -2674,6 +2670,7 @@
|
||||||
834FE107215C79ED000A5D3D /* mib_mih.c in Sources */,
|
834FE107215C79ED000A5D3D /* mib_mih.c in Sources */,
|
||||||
836F703618BDC2190095E648 /* thp.c in Sources */,
|
836F703618BDC2190095E648 /* thp.c in Sources */,
|
||||||
836F6F7818BDC2190095E648 /* Cstr.c in Sources */,
|
836F6F7818BDC2190095E648 /* Cstr.c in Sources */,
|
||||||
|
83FC417126D32FF5009A2022 /* hca_decoder_clhca.c in Sources */,
|
||||||
83F1EE30245D4FC10076E182 /* imuse.c in Sources */,
|
83F1EE30245D4FC10076E182 /* imuse.c in Sources */,
|
||||||
8346D98625BF83B300D1A8B0 /* compresswave_decoder.c in Sources */,
|
8346D98625BF83B300D1A8B0 /* compresswave_decoder.c in Sources */,
|
||||||
836F6F1E18BDC2190095E648 /* acm_decoder.c in Sources */,
|
836F6F1E18BDC2190095E648 /* acm_decoder.c in Sources */,
|
||||||
|
@ -2998,7 +2995,6 @@
|
||||||
836F702618BDC2190095E648 /* s14_sss.c in Sources */,
|
836F702618BDC2190095E648 /* s14_sss.c in Sources */,
|
||||||
834FE102215C79ED000A5D3D /* rfrm.c in Sources */,
|
834FE102215C79ED000A5D3D /* rfrm.c in Sources */,
|
||||||
83AA5D1D1F6E2F800020821C /* blocked_vgs.c in Sources */,
|
83AA5D1D1F6E2F800020821C /* blocked_vgs.c in Sources */,
|
||||||
8323894A1D22419B00482226 /* clHCA.c in Sources */,
|
|
||||||
836F702E18BDC2190095E648 /* sli.c in Sources */,
|
836F702E18BDC2190095E648 /* sli.c in Sources */,
|
||||||
83AA7F822519C042004C5298 /* ktsc.c in Sources */,
|
83AA7F822519C042004C5298 /* ktsc.c in Sources */,
|
||||||
836F6FDE18BDC2190095E648 /* ps2_ild.c in Sources */,
|
836F6FDE18BDC2190095E648 /* ps2_ild.c in Sources */,
|
||||||
|
|
|
@ -131,7 +131,7 @@ static void transform(int32_t* invbuf, int32_t* tmpbuf) {
|
||||||
for (lpc1 = 0; lpc1 < 12 - 2; lpc1++) {
|
for (lpc1 = 0; lpc1 < 12 - 2; lpc1++) {
|
||||||
int sub1, sub2;
|
int sub1, sub2;
|
||||||
int i1, i2, i3, i4;
|
int i1, i2, i3, i4;
|
||||||
int64_t cos1, sin1, cos2, sin2; /* needs i64 to force 64b ops (avoid overflows) */
|
int64_t cos1, sin1, cos2, sin2; /* needs i64 to force 64b ops (avoid overflows) then converted to i32 */
|
||||||
|
|
||||||
cos1 = (int64_t)sincos_table[sc1 + 1024];
|
cos1 = (int64_t)sincos_table[sc1 + 1024];
|
||||||
sin1 = (int64_t)sincos_table[sc1 + 0];
|
sin1 = (int64_t)sincos_table[sc1 + 0];
|
||||||
|
@ -153,8 +153,8 @@ static void transform(int32_t* invbuf, int32_t* tmpbuf) {
|
||||||
sub2 = tmpbuf[i1 + 1] - tmpbuf[i2 + 1];
|
sub2 = tmpbuf[i1 + 1] - tmpbuf[i2 + 1];
|
||||||
invbuf[i1 + 1] += invbuf[i2 + 1];
|
invbuf[i1 + 1] += invbuf[i2 + 1];
|
||||||
tmpbuf[i1 + 1] += tmpbuf[i2 + 1];
|
tmpbuf[i1 + 1] += tmpbuf[i2 + 1];
|
||||||
invbuf[i2 + 1] = ((sub1 * cos1) >> 12) + ((sub2 * sin1) >> 12);
|
invbuf[i2 + 1] = (int32_t)( ((sub1 * cos1) >> 12) + ((sub2 * sin1) >> 12) );
|
||||||
tmpbuf[i2 + 1] = ((sub2 * cos1) >> 12) - ((sub1 * sin1) >> 12);
|
tmpbuf[i2 + 1] = (int32_t)( ((sub2 * cos1) >> 12) - ((sub1 * sin1) >> 12) );
|
||||||
|
|
||||||
sub1 = invbuf[i3 + 0] - invbuf[i4 + 0];
|
sub1 = invbuf[i3 + 0] - invbuf[i4 + 0];
|
||||||
sub2 = tmpbuf[i3 + 0] - tmpbuf[i4 + 0];
|
sub2 = tmpbuf[i3 + 0] - tmpbuf[i4 + 0];
|
||||||
|
@ -167,8 +167,8 @@ static void transform(int32_t* invbuf, int32_t* tmpbuf) {
|
||||||
sub2 = tmpbuf[i3 + 1] - tmpbuf[i4 + 1];
|
sub2 = tmpbuf[i3 + 1] - tmpbuf[i4 + 1];
|
||||||
invbuf[i3 + 1] += invbuf[i4 + 1];
|
invbuf[i3 + 1] += invbuf[i4 + 1];
|
||||||
tmpbuf[i3 + 1] += tmpbuf[i4 + 1];
|
tmpbuf[i3 + 1] += tmpbuf[i4 + 1];
|
||||||
invbuf[i4 + 1] = ((sub2 * cos1) >> 12) - ((sub1 * sin1) >> 12);
|
invbuf[i4 + 1] = (int32_t)( ((sub2 * cos1) >> 12) - ((sub1 * sin1) >> 12) );
|
||||||
tmpbuf[i4 + 1] = -(((sub1 * cos1) >> 12) + ((sub2 * sin1) >> 12));
|
tmpbuf[i4 + 1] = (int32_t)( -(((sub1 * cos1) >> 12) + ((sub2 * sin1) >> 12)) );
|
||||||
|
|
||||||
i1 += step1;
|
i1 += step1;
|
||||||
i2 += step1;
|
i2 += step1;
|
||||||
|
@ -194,15 +194,15 @@ static void transform(int32_t* invbuf, int32_t* tmpbuf) {
|
||||||
sub2 = tmpbuf[i1] - tmpbuf[i2];
|
sub2 = tmpbuf[i1] - tmpbuf[i2];
|
||||||
invbuf[i1] += invbuf[i2];
|
invbuf[i1] += invbuf[i2];
|
||||||
tmpbuf[i1] += tmpbuf[i2];
|
tmpbuf[i1] += tmpbuf[i2];
|
||||||
invbuf[i2] = ((sub1 * cos2) >> 12) + ((sub2 * sin2) >> 12);
|
invbuf[i2] = (int32_t)( ((sub1 * cos2) >> 12) + ((sub2 * sin2) >> 12) );
|
||||||
tmpbuf[i2] = ((sub2 * cos2) >> 12) - ((sub1 * sin2) >> 12);
|
tmpbuf[i2] = (int32_t)( ((sub2 * cos2) >> 12) - ((sub1 * sin2) >> 12) );
|
||||||
|
|
||||||
sub1 = invbuf[i3] - invbuf[i4];
|
sub1 = invbuf[i3] - invbuf[i4];
|
||||||
sub2 = tmpbuf[i3] - tmpbuf[i4];
|
sub2 = tmpbuf[i3] - tmpbuf[i4];
|
||||||
invbuf[i3] += invbuf[i4];
|
invbuf[i3] += invbuf[i4];
|
||||||
tmpbuf[i3] += tmpbuf[i4];
|
tmpbuf[i3] += tmpbuf[i4];
|
||||||
invbuf[i4] = ((sub2 * cos2) >> 12) - ((sub1 * sin2) >> 12);
|
invbuf[i4] = (int32_t)( ((sub2 * cos2) >> 12) - ((sub1 * sin2) >> 12) );
|
||||||
tmpbuf[i4] = -(((sub1 * cos2) >> 12) + ((sub2 * sin2) >> 12));
|
tmpbuf[i4] = (int32_t)( -(((sub1 * cos2) >> 12) + ((sub2 * sin2) >> 12)) );
|
||||||
|
|
||||||
i1 += step1;
|
i1 += step1;
|
||||||
i2 += step1;
|
i2 += step1;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define _CODING_H
|
#define _CODING_H
|
||||||
|
|
||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
|
//todo remove
|
||||||
|
#include "hca_decoder_clhca.h"
|
||||||
|
|
||||||
/* adx_decoder */
|
/* adx_decoder */
|
||||||
void decode_adx(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes, coding_t coding_type);
|
void decode_adx(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes, coding_t coding_type);
|
||||||
|
@ -442,8 +444,10 @@ typedef struct {
|
||||||
int channels; /* max channels */
|
int channels; /* max channels */
|
||||||
int fsb_padding; /* fsb padding mode */
|
int fsb_padding; /* fsb padding mode */
|
||||||
int chunk_size; /* size of a data portion */
|
int chunk_size; /* size of a data portion */
|
||||||
|
int max_chunks;
|
||||||
int data_size; /* playable size */
|
int data_size; /* playable size */
|
||||||
int interleave; /* size of stream interleave */
|
int interleave; /* size of stream interleave */
|
||||||
|
int interleave_last;
|
||||||
int encryption; /* encryption mode */
|
int encryption; /* encryption mode */
|
||||||
int big_endian;
|
int big_endian;
|
||||||
int skip_samples;
|
int skip_samples;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "coding.h"
|
#include "coding.h"
|
||||||
#include "clHCA.h"
|
#include "hca_decoder_clhca.h"
|
||||||
|
|
||||||
|
|
||||||
struct hca_codec_data {
|
struct hca_codec_data {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Includes
|
// Includes
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
#include "clHCA.h"
|
#include "hca_decoder_clhca.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
|
@ -51,6 +51,7 @@ int mpeg_custom_setup_init_default(STREAMFILE* sf, off_t start_offset, mpeg_code
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//todo simplify/unify XVAG/P3D/SCD/LYN and just feed arbitrary chunks to the decoder
|
||||||
case MPEG_P3D:
|
case MPEG_P3D:
|
||||||
case MPEG_SCD:
|
case MPEG_SCD:
|
||||||
if (data->config.interleave <= 0)
|
if (data->config.interleave <= 0)
|
||||||
|
@ -61,7 +62,8 @@ int mpeg_custom_setup_init_default(STREAMFILE* sf, off_t start_offset, mpeg_code
|
||||||
if (data->config.interleave <= 0)
|
if (data->config.interleave <= 0)
|
||||||
goto fail; /* needs external fixed size */
|
goto fail; /* needs external fixed size */
|
||||||
data->default_buffer_size = data->config.interleave;
|
data->default_buffer_size = data->config.interleave;
|
||||||
//todo simplify/unify XVAG/P3D/SCD/LYN and just feed arbitrary chunks to the decoder
|
if (data->default_buffer_size < data->config.interleave_last)
|
||||||
|
data->default_buffer_size = data->config.interleave_last;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_STANDARD:
|
case MPEG_STANDARD:
|
||||||
|
@ -179,7 +181,6 @@ int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* d
|
||||||
|
|
||||||
case MPEG_P3D: /* fixed interleave, not frame-aligned (ie. blocks may end/start in part of a frame) */
|
case MPEG_P3D: /* fixed interleave, not frame-aligned (ie. blocks may end/start in part of a frame) */
|
||||||
case MPEG_SCD:
|
case MPEG_SCD:
|
||||||
case MPEG_LYN:
|
|
||||||
current_interleave = data->config.interleave;
|
current_interleave = data->config.interleave;
|
||||||
|
|
||||||
/* check if current interleave block is short */
|
/* check if current interleave block is short */
|
||||||
|
@ -197,6 +198,23 @@ int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* d
|
||||||
current_data_size = current_interleave;
|
current_data_size = current_interleave;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MPEG_LYN:
|
||||||
|
/* after N interleaves last block is bigger */
|
||||||
|
if (ms->current_size_count < data->config.max_chunks)
|
||||||
|
current_interleave = data->config.interleave;
|
||||||
|
else if (ms->current_size_count == data->config.max_chunks)
|
||||||
|
current_interleave = data->config.interleave_last;
|
||||||
|
else
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
current_interleave_pre = current_interleave*num_stream;
|
||||||
|
current_interleave_post = current_interleave*(data->streams_size-1) - current_interleave_pre;
|
||||||
|
//VGM_LOG("o=%lx, %i: %x, %x, %x, %x\n", stream->offset, num_stream, ms->current_size_count, current_interleave, current_interleave_pre, current_interleave_post );
|
||||||
|
|
||||||
|
current_data_size = current_interleave;
|
||||||
|
ms->current_size_count++;
|
||||||
|
break;
|
||||||
|
|
||||||
default: /* standard frames (CBR or VBR) */
|
default: /* standard frames (CBR or VBR) */
|
||||||
if ( !mpeg_get_frame_info(stream->streamfile, stream->offset, &info) )
|
if ( !mpeg_get_frame_info(stream->streamfile, stream->offset, &info) )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -232,7 +250,9 @@ int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* d
|
||||||
fail:
|
fail:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//TODO: move to a better place
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
/* FRAME HELPERS */
|
/* FRAME HELPERS */
|
||||||
|
@ -475,5 +495,3 @@ fail:
|
||||||
VGM_LOG("MPEG: sample reader failed at %lx\n", offset);
|
VGM_LOG("MPEG: sample reader failed at %lx\n", offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -144,7 +144,11 @@ mpeg_codec_data* init_mpeg_custom(STREAMFILE* sf, off_t start_offset, coding_t*
|
||||||
if (channels <= 0 || channels > 16) goto fail; /* arbitrary max */
|
if (channels <= 0 || channels > 16) goto fail; /* arbitrary max */
|
||||||
if (channels < data->channels_per_frame) goto fail;
|
if (channels < data->channels_per_frame) goto fail;
|
||||||
//todo simplify/unify XVAG/P3D/SCD/LYN and just feed arbitrary chunks to the decoder
|
//todo simplify/unify XVAG/P3D/SCD/LYN and just feed arbitrary chunks to the decoder
|
||||||
if (data->default_buffer_size > 0x10000) goto fail; /* max for some Ubi Lyn */
|
/* max for some Ubi Lyn */
|
||||||
|
if (data->default_buffer_size > 0x20000) {
|
||||||
|
VGM_LOG("MPEG: buffer size too big %x\n", data->default_buffer_size);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* init streams */
|
/* init streams */
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
#ifndef _MPEG_DECODER_H_
|
#ifndef _MPEG_DECODER_H_
|
||||||
#define _MPEG_DECODER_H_
|
#define _MPEG_DECODER_H_
|
||||||
#include <mpg123/mpg123.h>
|
|
||||||
|
|
||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
|
||||||
/* used by mpeg_decoder.c, but scattered in other .c files */
|
/* used by mpeg_decoder.c, but scattered in other .c files */
|
||||||
#ifdef VGM_USE_MPEG
|
#ifdef VGM_USE_MPEG
|
||||||
typedef struct {
|
#include <mpg123/mpg123.h>
|
||||||
int version;
|
|
||||||
int layer;
|
|
||||||
int bit_rate;
|
|
||||||
int sample_rate;
|
|
||||||
int frame_samples;
|
|
||||||
int frame_size; /* bytes */
|
|
||||||
int channels;
|
|
||||||
} mpeg_frame_info;
|
|
||||||
|
|
||||||
/* represents a single MPEG stream */
|
/* represents a single MPEG stream */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -70,19 +62,29 @@ struct mpeg_codec_data {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int mpeg_get_frame_info(STREAMFILE *streamfile, off_t offset, mpeg_frame_info * info);
|
int mpeg_custom_setup_init_default(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
|
||||||
|
int mpeg_custom_setup_init_ealayer3(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
|
||||||
int mpeg_custom_setup_init_default(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
|
int mpeg_custom_setup_init_awc(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
|
||||||
int mpeg_custom_setup_init_ealayer3(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
|
int mpeg_custom_setup_init_eamp3(STREAMFILE* sf, off_t start_offset, mpeg_codec_data* data, coding_t* coding_type);
|
||||||
int mpeg_custom_setup_init_awc(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
|
|
||||||
int mpeg_custom_setup_init_eamp3(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type);
|
|
||||||
|
|
||||||
int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream);
|
|
||||||
int mpeg_custom_parse_frame_ahx(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream);
|
|
||||||
int mpeg_custom_parse_frame_ealayer3(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream);
|
|
||||||
int mpeg_custom_parse_frame_awc(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream);
|
|
||||||
int mpeg_custom_parse_frame_eamp3(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream);
|
|
||||||
|
|
||||||
|
int mpeg_custom_parse_frame_default(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);
|
||||||
|
int mpeg_custom_parse_frame_ahx(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);
|
||||||
|
int mpeg_custom_parse_frame_ealayer3(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);
|
||||||
|
int mpeg_custom_parse_frame_awc(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);
|
||||||
|
int mpeg_custom_parse_frame_eamp3(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, int num_stream);
|
||||||
#endif/* VGM_USE_MPEG */
|
#endif/* VGM_USE_MPEG */
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int version;
|
||||||
|
int layer;
|
||||||
|
int bit_rate;
|
||||||
|
int sample_rate;
|
||||||
|
int frame_samples;
|
||||||
|
int frame_size; /* bytes */
|
||||||
|
int channels;
|
||||||
|
} mpeg_frame_info;
|
||||||
|
|
||||||
|
int mpeg_get_frame_info(STREAMFILE* sf, off_t offset, mpeg_frame_info* info);
|
||||||
|
|
||||||
#endif/*_MPEG_DECODER_H_ */
|
#endif/*_MPEG_DECODER_H_ */
|
||||||
|
|
|
@ -238,9 +238,9 @@ static void init_dequantization(float* scales) {
|
||||||
|
|
||||||
static int unpack_frame(uint8_t* buf, int buf_size, float* freq1, float* freq2, const float* scales, uint8_t* exponents, int freq_size) {
|
static int unpack_frame(uint8_t* buf, int buf_size, float* freq1, float* freq2, const float* scales, uint8_t* exponents, int freq_size) {
|
||||||
uint8_t flags, cb_bits, ev_bits, ei_bits, qv_bits;
|
uint8_t flags, cb_bits, ev_bits, ei_bits, qv_bits;
|
||||||
int qv;
|
int qv, pos;
|
||||||
uint8_t ev;
|
uint8_t ev;
|
||||||
uint8_t move, pos;
|
uint8_t move;
|
||||||
uint32_t bit_offset, max_offset;
|
uint32_t bit_offset, max_offset;
|
||||||
int i, j;
|
int i, j;
|
||||||
int freq_half = freq_size >> 1;
|
int freq_half = freq_size >> 1;
|
||||||
|
|
|
@ -100,7 +100,7 @@ fail:
|
||||||
|
|
||||||
/* for simple style speex (seen in EA-Speex and libspeex's sampledec.c) */
|
/* for simple style speex (seen in EA-Speex and libspeex's sampledec.c) */
|
||||||
static int read_frame(speex_codec_data* data, VGMSTREAMCHANNEL* stream) {
|
static int read_frame(speex_codec_data* data, VGMSTREAMCHANNEL* stream) {
|
||||||
uint8_t bytes;
|
size_t bytes;
|
||||||
|
|
||||||
data->frame_size = read_u8(stream->offset, stream->streamfile);
|
data->frame_size = read_u8(stream->offset, stream->streamfile);
|
||||||
stream->offset += 0x01;
|
stream->offset += 0x01;
|
||||||
|
|
|
@ -155,7 +155,7 @@ static const char* extension_list[] = {
|
||||||
"de2",
|
"de2",
|
||||||
"dec",
|
"dec",
|
||||||
"diva",
|
"diva",
|
||||||
"dmsg",
|
"dmsg", //fake extension/header id for .sgt (to be removed)
|
||||||
"ds2", //txth/reserved [Star Wars Bounty Hunter (GC)]
|
"ds2", //txth/reserved [Star Wars Bounty Hunter (GC)]
|
||||||
"dsb",
|
"dsb",
|
||||||
"dsf",
|
"dsf",
|
||||||
|
@ -402,7 +402,7 @@ static const char* extension_list[] = {
|
||||||
"rad",
|
"rad",
|
||||||
"rak",
|
"rak",
|
||||||
"ras",
|
"ras",
|
||||||
"raw",
|
"raw", //txth/reserved [Madden NHL 97 (PC)-pcm8u]
|
||||||
"rda", //FFmpeg/reserved [Rhythm Destruction (PC)]
|
"rda", //FFmpeg/reserved [Rhythm Destruction (PC)]
|
||||||
"rkv",
|
"rkv",
|
||||||
"rnd",
|
"rnd",
|
||||||
|
@ -464,6 +464,7 @@ static const char* extension_list[] = {
|
||||||
"sfx",
|
"sfx",
|
||||||
"sgb",
|
"sgb",
|
||||||
"sgd",
|
"sgd",
|
||||||
|
"sgt",
|
||||||
"sgx",
|
"sgx",
|
||||||
"sl3",
|
"sl3",
|
||||||
"slb", //txth/reserved [THE Nekomura no Hitobito (PS2)]
|
"slb", //txth/reserved [THE Nekomura no Hitobito (PS2)]
|
||||||
|
@ -518,6 +519,7 @@ static const char* extension_list[] = {
|
||||||
"tad",
|
"tad",
|
||||||
"tec",
|
"tec",
|
||||||
"tgq",
|
"tgq",
|
||||||
|
"tgv",
|
||||||
"thp",
|
"thp",
|
||||||
"tk5",
|
"tk5",
|
||||||
"tmx",
|
"tmx",
|
||||||
|
@ -610,6 +612,7 @@ static const char* extension_list[] = {
|
||||||
"xma2",
|
"xma2",
|
||||||
"xmu",
|
"xmu",
|
||||||
"xnb",
|
"xnb",
|
||||||
|
"xsh",
|
||||||
"xsf",
|
"xsf",
|
||||||
"xse",
|
"xse",
|
||||||
"xsew",
|
"xsew",
|
||||||
|
@ -1113,7 +1116,7 @@ static const meta_info meta_info_list[] = {
|
||||||
{meta_HIS, "Her Interactive HIS header"},
|
{meta_HIS, "Her Interactive HIS header"},
|
||||||
{meta_PS2_AST, "KOEI AST header"},
|
{meta_PS2_AST, "KOEI AST header"},
|
||||||
{meta_CAPDSP, "Capcom DSP header"},
|
{meta_CAPDSP, "Capcom DSP header"},
|
||||||
{meta_DMSG, "RIFF/DMSGsegh header"},
|
{meta_DMSG, "Microsoft RIFF DMSG header"},
|
||||||
{meta_PONA_3DO, "Policenauts BGM header"},
|
{meta_PONA_3DO, "Policenauts BGM header"},
|
||||||
{meta_PONA_PSX, "Policenauts BGM header"},
|
{meta_PONA_PSX, "Policenauts BGM header"},
|
||||||
{meta_NGC_DSP_AAAP, "Acclaim Austin AAAp DSP header"},
|
{meta_NGC_DSP_AAAP, "Acclaim Austin AAAp DSP header"},
|
||||||
|
@ -1356,6 +1359,7 @@ static const meta_info meta_info_list[] = {
|
||||||
{meta_PIFF_TPCM, "Tantalus PIFF TPCM header"},
|
{meta_PIFF_TPCM, "Tantalus PIFF TPCM header"},
|
||||||
{meta_WXD_WXH, "Relic WXD+WXH header"},
|
{meta_WXD_WXH, "Relic WXD+WXH header"},
|
||||||
{meta_BNK_RELIC, "Relic BNK header"},
|
{meta_BNK_RELIC, "Relic BNK header"},
|
||||||
|
{meta_XSH_XSD_XSS, "Treyarch XSH+XSD/XSS header"},
|
||||||
};
|
};
|
||||||
|
|
||||||
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {
|
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
#include "../decode.h"
|
#include "../decode.h"
|
||||||
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
|
||||||
/* Decodes samples for blocked streams.
|
/* Decodes samples for blocked streams.
|
||||||
|
@ -90,7 +91,7 @@ void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM*
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper functions to parse new block */
|
/* helper functions to parse new block */
|
||||||
void block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
void block_update(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||||
switch (vgmstream->layout_type) {
|
switch (vgmstream->layout_type) {
|
||||||
case layout_blocked_ast:
|
case layout_blocked_ast:
|
||||||
block_update_ast(block_offset,vgmstream);
|
block_update_ast(block_offset,vgmstream);
|
||||||
|
@ -216,3 +217,38 @@ void block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void blocked_count_samples(VGMSTREAM* vgmstream, STREAMFILE* sf, off_t offset) {
|
||||||
|
int block_samples;
|
||||||
|
off_t max_offset = get_streamfile_size(sf);
|
||||||
|
|
||||||
|
vgmstream->next_block_offset = offset;
|
||||||
|
do {
|
||||||
|
block_update(vgmstream->next_block_offset, vgmstream);
|
||||||
|
|
||||||
|
if (vgmstream->current_block_samples < 0 || vgmstream->current_block_size == 0xFFFFFFFF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (vgmstream->current_block_samples) {
|
||||||
|
block_samples = vgmstream->current_block_samples;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch(vgmstream->coding_type) {
|
||||||
|
case coding_PCM16_int: block_samples = pcm16_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
|
case coding_PCM8_int:
|
||||||
|
case coding_PCM8_U_int: block_samples = pcm8_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
|
case coding_XBOX_IMA: block_samples = xbox_ima_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
|
case coding_NGC_DSP: block_samples = dsp_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
|
case coding_PSX: block_samples = ps_bytes_to_samples(vgmstream->current_block_size,1); break;
|
||||||
|
default:
|
||||||
|
VGM_LOG("BLOCKED: missing codec\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vgmstream->num_samples += block_samples;
|
||||||
|
}
|
||||||
|
while (vgmstream->next_block_offset < max_offset);
|
||||||
|
|
||||||
|
block_update(offset, vgmstream); /* reset */
|
||||||
|
}
|
||||||
|
|
|
@ -6,17 +6,20 @@
|
||||||
void block_update_ea_wve_ad10(off_t block_offset, VGMSTREAM* vgmstream) {
|
void block_update_ea_wve_ad10(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||||
STREAMFILE* sf = vgmstream->ch[0].streamfile;
|
STREAMFILE* sf = vgmstream->ch[0].streamfile;
|
||||||
int i;
|
int i;
|
||||||
size_t block_size, channel_size = 0, interleave = 0;
|
size_t channel_size = 0, interleave = 0;
|
||||||
uint32_t block_id;
|
uint32_t block_id, block_size;
|
||||||
|
|
||||||
block_id = read_32bitBE(block_offset+0x00, sf);
|
int flag_be = (vgmstream->codec_config & 0x01);
|
||||||
block_size = read_32bitBE(block_offset+0x04, sf);
|
uint32_t (*read_u32)(off_t,STREAMFILE*) = flag_be ? read_u32be : read_u32le;
|
||||||
|
|
||||||
|
block_id = read_u32be(block_offset+0x00, sf);
|
||||||
|
block_size = read_u32 (block_offset+0x04, sf);
|
||||||
|
|
||||||
/* accept "Ad10/Ad11" audio block/footer */
|
/* accept "Ad10/Ad11" audio block/footer */
|
||||||
if (block_id == 0x41643130 || block_id == 0x41643131) {
|
if (block_id == 0x41643130 || block_id == 0x41643131) {
|
||||||
channel_size = block_size - 0x08; /* one block per channel */
|
channel_size = block_size - 0x08; /* one block per channel */
|
||||||
interleave = block_size;
|
interleave = block_size;
|
||||||
block_size = block_size*vgmstream->channels;
|
block_size = block_size * vgmstream->channels;
|
||||||
}
|
}
|
||||||
/* rest could be "MDEC" video blocks with 0 size/samples */
|
/* rest could be "MDEC" video blocks with 0 size/samples */
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
/* blocked layouts */
|
/* blocked layouts */
|
||||||
void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM* vgmstream);
|
void render_vgmstream_blocked(sample_t* buffer, int32_t sample_count, VGMSTREAM* vgmstream);
|
||||||
void block_update(off_t block_offset, VGMSTREAM* vgmstream);
|
void block_update(off_t block_offset, VGMSTREAM* vgmstream);
|
||||||
|
void blocked_count_samples(VGMSTREAM* vgmstream, STREAMFILE* sf, off_t offset);
|
||||||
|
|
||||||
void block_update_ast(off_t block_ofset, VGMSTREAM* vgmstream);
|
void block_update_ast(off_t block_ofset, VGMSTREAM* vgmstream);
|
||||||
void block_update_mxch(off_t block_ofset, VGMSTREAM* vgmstream);
|
void block_update_mxch(off_t block_ofset, VGMSTREAM* vgmstream);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "cri_utf.h"
|
#include "cri_utf.h"
|
||||||
|
|
||||||
|
|
||||||
typedef enum { HCA, CWAV, } cpk_type_t;
|
typedef enum { HCA, CWAV, ADX } cpk_type_t;
|
||||||
|
|
||||||
static void load_cpk_name(STREAMFILE* sf, STREAMFILE* sf_acb, VGMSTREAM* vgmstream, int waveid);
|
static void load_cpk_name(STREAMFILE* sf, STREAMFILE* sf_acb, VGMSTREAM* vgmstream, int waveid);
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ VGMSTREAM* init_vgmstream_cpk_memory(STREAMFILE* sf, STREAMFILE* sf_acb) {
|
||||||
/* checks */
|
/* checks */
|
||||||
if (!check_extensions(sf, "awb"))
|
if (!check_extensions(sf, "awb"))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (read_u32be(0x00,sf) != 0x43504B20) /* "CPK " */
|
if (!is_id32be(0x00,sf, "CPK "))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (read_u32be(0x10,sf) != 0x40555446) /* "@UTF" */
|
if (!is_id32be(0x10,sf, "@UTF"))
|
||||||
goto fail;
|
goto fail;
|
||||||
/* 04: 0xFF? */
|
/* 04: 0xFF? */
|
||||||
/* 08: 0x02A0? */
|
/* 08: 0x02A0? */
|
||||||
|
@ -176,14 +176,18 @@ VGMSTREAM* init_vgmstream_cpk_memory(STREAMFILE* sf, STREAMFILE* sf_acb) {
|
||||||
//;VGM_LOG("CPK: subfile offset=%lx + %x, id=%i\n", subfile_offset, subfile_size, subfile_id);
|
//;VGM_LOG("CPK: subfile offset=%lx + %x, id=%i\n", subfile_offset, subfile_size, subfile_id);
|
||||||
|
|
||||||
|
|
||||||
if ((read_u32be(subfile_offset,sf) & 0x7f7f7f7f) == 0x48434100) { /* "HCA\0" */
|
if ((read_u32be(subfile_offset,sf) & 0x7f7f7f7f) == get_id32be("HCA\0")) {
|
||||||
type = HCA;
|
type = HCA;
|
||||||
extension = "hca";
|
extension = "hca";
|
||||||
}
|
}
|
||||||
else if (read_u32be(subfile_offset,sf) == 0x43574156) { /* "CWAV" */
|
else if (is_id32be(subfile_offset,sf, "CWAV")) {
|
||||||
type = CWAV;
|
type = CWAV;
|
||||||
extension = "bcwav";
|
extension = "bcwav";
|
||||||
}
|
}
|
||||||
|
else if (read_u16be(subfile_offset, sf) == 0x8000) {
|
||||||
|
type = ADX;
|
||||||
|
extension = "adx";
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -200,6 +204,10 @@ VGMSTREAM* init_vgmstream_cpk_memory(STREAMFILE* sf, STREAMFILE* sf_acb) {
|
||||||
vgmstream = init_vgmstream_rwsd(temp_sf);
|
vgmstream = init_vgmstream_rwsd(temp_sf);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
break;
|
break;
|
||||||
|
case ADX: /* Sonic Generations (3DS) */
|
||||||
|
vgmstream = init_vgmstream_adx(temp_sf);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +246,7 @@ static void load_cpk_name(STREAMFILE* sf, STREAMFILE* sf_acb, VGMSTREAM* vgmstre
|
||||||
if (!sf_acb)
|
if (!sf_acb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* companion .acb probably loaded */
|
/* companion .acb probably loaded */
|
||||||
load_acb_wave_name(sf_acb, vgmstream, waveid, port, is_memory);
|
load_acb_wave_name(sf_acb, vgmstream, waveid, port, is_memory);
|
||||||
|
|
||||||
close_streamfile(sf_acb);
|
close_streamfile(sf_acb);
|
||||||
|
|
|
@ -1,110 +1,159 @@
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* DMSG
|
typedef struct {
|
||||||
found in: Nightcaster II - Equinox
|
uint32_t type;
|
||||||
2010-01-05 (manakoAT): Seems it's a corrupted "SGT" file, but I'm not sure...
|
uint32_t size;
|
||||||
*/
|
uint32_t offset;
|
||||||
VGMSTREAM * init_vgmstream_dmsg(STREAMFILE *streamFile) {
|
off_t current;
|
||||||
VGMSTREAM * vgmstream = NULL;
|
off_t max;
|
||||||
char filename[PATH_LIMIT];
|
int le_type;
|
||||||
int loop_flag = 0;
|
int be_size;
|
||||||
int frequency;
|
int full_size;
|
||||||
int channel_count;
|
} chunk_t;
|
||||||
int dataBuffer = 0;
|
|
||||||
int Founddata = 0;
|
|
||||||
size_t file_size;
|
|
||||||
off_t current_chunk;
|
|
||||||
off_t start_offset;
|
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("dmsg",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
static int next_chunk(chunk_t* chunk, STREAMFILE* sf) {
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x52494646) /* "RIFF" */
|
uint32_t (*read_u32type)(off_t,STREAMFILE*) = !chunk->le_type ? read_u32be : read_u32le;
|
||||||
goto fail;
|
uint32_t (*read_u32size)(off_t,STREAMFILE*) = chunk->be_size ? read_u32be : read_u32le;
|
||||||
if (read_32bitBE(0x08,streamFile) != 0x444D5347) /* "DMSG" */
|
|
||||||
goto fail;
|
|
||||||
if (read_32bitBE(0x0C,streamFile) != 0x73656768) /* "segh" */
|
|
||||||
goto fail;
|
|
||||||
if (read_32bitBE(0x10,streamFile) != 0x38000000) /* "0x38" */
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* scan file until we find a "data" string */
|
if (chunk->max == 0)
|
||||||
file_size = get_streamfile_size(streamFile);
|
chunk->max = get_streamfile_size(sf);
|
||||||
|
|
||||||
|
if (chunk->current >= chunk->max)
|
||||||
|
return 0;
|
||||||
|
/* can be used to signal "stop" */
|
||||||
|
if (chunk->current < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
chunk->type = read_u32type(chunk->current + 0x00,sf);
|
||||||
|
chunk->size = read_u32size(chunk->current + 0x04,sf);
|
||||||
|
|
||||||
|
chunk->offset = chunk->current + 0x04 + 0x04;
|
||||||
|
chunk->current += chunk->full_size ? chunk->size : 0x08 + chunk->size;
|
||||||
|
//;VGM_LOG("CHUNK: %x, %x, %x\n", dc.offset, chunk->type, chunk->size);
|
||||||
|
|
||||||
|
/* read past data */
|
||||||
|
if (chunk->type == 0xFFFFFFFF || chunk->size == 0xFFFFFFFF)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* empty chunk with 0 size, seen in some formats (XVAG uses it as end marker, Wwise doesn't) */
|
||||||
|
if (chunk->type == 0 || chunk->size == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* more chunks remain */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CHUNK_RIFF = 0x52494646, /* "RIFF" */
|
||||||
|
CHUNK_LIST = 0x4C495354, /* "LIST" */
|
||||||
|
CHUNK_segh = 0x73656768, /* "segh" */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* DMSG - DirectMusic Segment with streams [Nightcaster II: Equinox (Xbox), Wildfire (PC)] */
|
||||||
|
VGMSTREAM* init_vgmstream_dmsg(STREAMFILE* sf) {
|
||||||
|
VGMSTREAM* vgmstream = NULL;
|
||||||
|
//int loop_flag, channels, sample_rate;
|
||||||
|
//int found_data = 0;
|
||||||
|
//int32_t num_samples, loop_start, loop_end;
|
||||||
|
//off_t start_offset;
|
||||||
|
off_t offset = 0, name_offset = 0, name_size = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
/* .sgt: common
|
||||||
|
* .dmsg: header id */
|
||||||
|
if (!check_extensions(sf, "sgt,dmsg"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (!is_id32be(0x00,sf, "RIFF"))
|
||||||
|
goto fail;
|
||||||
|
if (!is_id32be(0x08,sf, "DMSG"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* A DirectMusic segment usually has lots of chunks then data pointing to .dls soundbank.
|
||||||
|
* This accepts .sgt with a RIFF WAVE inside (less common). */
|
||||||
{
|
{
|
||||||
current_chunk = 0;
|
chunk_t rc = {0};
|
||||||
/* Start at 0 and loop until we reached the
|
chunk_t dc = {0};
|
||||||
file size, or until we found a "data string */
|
|
||||||
while (!Founddata && current_chunk < file_size) {
|
rc.current = 0x0c;
|
||||||
dataBuffer = (read_32bitBE(current_chunk,streamFile));
|
while (next_chunk(&rc, sf)) {
|
||||||
if (dataBuffer == 0x64617461) { /* "data" */
|
switch(rc.type) {
|
||||||
/* if "data" string found, retrieve the needed infos */
|
/* "segh" has loopnum/samplesloop */
|
||||||
Founddata = 1;
|
case CHUNK_segh:
|
||||||
/* We will cancel the search here if we have a match */
|
//todo: missing TMusicTime format
|
||||||
break;
|
/* 0x00: dwRepeats (>0 or -1=inf)
|
||||||
|
* 0x04: mtLength
|
||||||
|
* 0x08: mtPlayStart
|
||||||
|
* 0x0c: mtLoopStart
|
||||||
|
* 0x10: mtLoopEnd
|
||||||
|
* 0x14: dwResolution
|
||||||
|
* 0x18: rtLength (optional)
|
||||||
|
* .. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CHUNK_LIST:
|
||||||
|
if (is_id32be(rc.offset + 0x00, sf, "UNFO") && is_id32be(rc.offset + 0x04, sf, "UNAM")) {
|
||||||
|
name_offset = rc.offset + 0x0c;
|
||||||
|
name_size = read_u32le(rc.offset + 0x08, sf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CHUNK_RIFF:
|
||||||
|
if (!is_id32be(rc.offset, sf, "DMCN"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
dc.current = rc.offset + 0x04;
|
||||||
|
while (next_chunk(&dc, sf)) {
|
||||||
|
switch(dc.type) {
|
||||||
|
case CHUNK_LIST:
|
||||||
|
/* abridged, there are some sublists */
|
||||||
|
if (is_id32be(dc.offset + 0x00, sf, "cosl") && is_id32be(dc.offset + 0x30, sf, "WAVE")) {
|
||||||
|
offset = dc.offset + 0x34;
|
||||||
|
dc.current = -1;
|
||||||
|
rc.current = -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/* else we will increase the search offset by 1 */
|
|
||||||
current_chunk = current_chunk + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Founddata == 0) {
|
if (!offset)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if (Founddata == 1) {
|
|
||||||
channel_count = (uint16_t)read_16bitLE(current_chunk-0x10,streamFile);
|
|
||||||
frequency = read_32bitLE(current_chunk-0xE,streamFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
loop_flag = 1;
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* subfile has a few extra chunks (guid, wavh) but otherwise standard (seen PCM and MS-ADPCM, with fact chunks) */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
||||||
if (!vgmstream) goto fail;
|
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
|
||||||
if (Founddata == 0) {
|
|
||||||
goto fail;
|
|
||||||
} else if (Founddata == 1) {
|
|
||||||
start_offset = current_chunk+0x8;
|
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->sample_rate = frequency;
|
|
||||||
vgmstream->coding_type = coding_PCM16LE;
|
|
||||||
vgmstream->num_samples = (read_32bitLE(current_chunk+0x4,streamFile)/2/channel_count);
|
|
||||||
if (loop_flag) {
|
|
||||||
vgmstream->loop_start_sample = 0;
|
|
||||||
vgmstream->loop_end_sample = (read_32bitLE(current_chunk+0x4,streamFile)/2/channel_count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channel_count == 1) {
|
|
||||||
vgmstream->layout_type = layout_none;
|
|
||||||
} else if (channel_count > 1) {
|
|
||||||
vgmstream->layout_type = layout_interleave;
|
|
||||||
vgmstream->interleave_block_size = 0x2;
|
|
||||||
}
|
|
||||||
|
|
||||||
vgmstream->meta_type = meta_DMSG;
|
|
||||||
|
|
||||||
/* open the file for reading */
|
|
||||||
{
|
{
|
||||||
int i;
|
STREAMFILE* temp_sf = NULL;
|
||||||
STREAMFILE * file;
|
off_t subfile_offset = offset;
|
||||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
size_t subfile_size = read_u32le(offset + 0x04, sf) + 0x08;
|
||||||
if (!file) goto fail;
|
|
||||||
for (i=0;i<channel_count;i++) {
|
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, "wav");
|
||||||
vgmstream->ch[i].streamfile = file;
|
if (!temp_sf) goto fail;
|
||||||
vgmstream->ch[i].channel_start_offset=
|
|
||||||
vgmstream->ch[i].offset=start_offset+
|
vgmstream = init_vgmstream_riff(temp_sf);
|
||||||
vgmstream->interleave_block_size*i;
|
close_streamfile(temp_sf);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
if (name_offset) {
|
||||||
|
if (name_size >= STREAM_NAME_SIZE)
|
||||||
|
name_size = STREAM_NAME_SIZE;
|
||||||
|
read_string_utf16le(vgmstream->stream_name,name_size, name_offset, sf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vgmstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
return vgmstream;
|
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@
|
||||||
/* CODEC1 values were used early, then they migrated to CODEC2 values */
|
/* CODEC1 values were used early, then they migrated to CODEC2 values */
|
||||||
#define EA_CODEC1_NONE -1
|
#define EA_CODEC1_NONE -1
|
||||||
#define EA_CODEC1_PCM 0x00
|
#define EA_CODEC1_PCM 0x00
|
||||||
#define EA_CODEC1_VAG 0x01 /* unsure */
|
//#define EA_CODEC1_IMA 0x02 /* not used (sx.exe internal defs) */
|
||||||
|
#define EA_CODEC1_N64 0x05
|
||||||
|
#define EA_CODEC1_VAG 0x06
|
||||||
#define EA_CODEC1_EAXA 0x07
|
#define EA_CODEC1_EAXA 0x07
|
||||||
#define EA_CODEC1_MT10 0x09
|
#define EA_CODEC1_MT10 0x09
|
||||||
#define EA_CODEC1_N64 0x64 /* unknown but probably before MT10 */
|
|
||||||
|
|
||||||
|
|
||||||
#define EA_CODEC2_NONE -1
|
#define EA_CODEC2_NONE -1
|
||||||
#define EA_CODEC2_S16LE_INT 0x00
|
#define EA_CODEC2_S16LE_INT 0x00
|
||||||
|
@ -1809,6 +1809,7 @@ static int parse_variable_header(STREAMFILE* sf, ea_header* ea, off_t begin_offs
|
||||||
else
|
else
|
||||||
ea->codec2 = ea->bps==8 ? EA_CODEC2_S8 : (ea->big_endian ? EA_CODEC2_S16BE : EA_CODEC2_S16LE);
|
ea->codec2 = ea->bps==8 ? EA_CODEC2_S8 : (ea->big_endian ? EA_CODEC2_S16BE : EA_CODEC2_S16LE);
|
||||||
break;
|
break;
|
||||||
|
case EA_CODEC1_N64: ea->codec2 = EA_CODEC2_N64; break;
|
||||||
case EA_CODEC1_VAG: ea->codec2 = EA_CODEC2_VAG; break;
|
case EA_CODEC1_VAG: ea->codec2 = EA_CODEC2_VAG; break;
|
||||||
case EA_CODEC1_EAXA:
|
case EA_CODEC1_EAXA:
|
||||||
if (ea->platform == EA_PLATFORM_PC || ea->platform == EA_PLATFORM_MAC)
|
if (ea->platform == EA_PLATFORM_PC || ea->platform == EA_PLATFORM_MAC)
|
||||||
|
@ -1817,7 +1818,6 @@ static int parse_variable_header(STREAMFILE* sf, ea_header* ea, off_t begin_offs
|
||||||
ea->codec2 = EA_CODEC2_EAXA;
|
ea->codec2 = EA_CODEC2_EAXA;
|
||||||
break;
|
break;
|
||||||
case EA_CODEC1_MT10: ea->codec2 = EA_CODEC2_MT10; break;
|
case EA_CODEC1_MT10: ea->codec2 = EA_CODEC2_MT10; break;
|
||||||
case EA_CODEC1_N64: ea->codec2 = EA_CODEC2_N64; break;
|
|
||||||
default:
|
default:
|
||||||
VGM_LOG("EA SCHl: unknown codec1 0x%02x\n", ea->codec1);
|
VGM_LOG("EA SCHl: unknown codec1 0x%02x\n", ea->codec1);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1830,6 +1830,7 @@ static int parse_variable_header(STREAMFILE* sf, ea_header* ea, off_t begin_offs
|
||||||
case EA_PLATFORM_GENERIC: ea->codec2 = EA_CODEC2_EAXA; break;
|
case EA_PLATFORM_GENERIC: ea->codec2 = EA_CODEC2_EAXA; break;
|
||||||
case EA_PLATFORM_PC: ea->codec2 = EA_CODEC2_EAXA; break;
|
case EA_PLATFORM_PC: ea->codec2 = EA_CODEC2_EAXA; break;
|
||||||
case EA_PLATFORM_PSX: ea->codec2 = EA_CODEC2_VAG; break;
|
case EA_PLATFORM_PSX: ea->codec2 = EA_CODEC2_VAG; break;
|
||||||
|
case EA_PLATFORM_N64: ea->codec2 = EA_CODEC2_N64; break;
|
||||||
case EA_PLATFORM_MAC: ea->codec2 = EA_CODEC2_EAXA; break;
|
case EA_PLATFORM_MAC: ea->codec2 = EA_CODEC2_EAXA; break;
|
||||||
case EA_PLATFORM_PS2: ea->codec2 = EA_CODEC2_VAG; break;
|
case EA_PLATFORM_PS2: ea->codec2 = EA_CODEC2_VAG; break;
|
||||||
case EA_PLATFORM_GC: ea->codec2 = EA_CODEC2_S16BE; break;
|
case EA_PLATFORM_GC: ea->codec2 = EA_CODEC2_S16BE; break;
|
||||||
|
@ -1837,7 +1838,7 @@ static int parse_variable_header(STREAMFILE* sf, ea_header* ea, off_t begin_offs
|
||||||
case EA_PLATFORM_X360: ea->codec2 = EA_CODEC2_EAXA; break;
|
case EA_PLATFORM_X360: ea->codec2 = EA_CODEC2_EAXA; break;
|
||||||
case EA_PLATFORM_PSP: ea->codec2 = EA_CODEC2_EAXA; break;
|
case EA_PLATFORM_PSP: ea->codec2 = EA_CODEC2_EAXA; break;
|
||||||
case EA_PLATFORM_PS3: ea->codec2 = EA_CODEC2_EAXA; break;
|
case EA_PLATFORM_PS3: ea->codec2 = EA_CODEC2_EAXA; break;
|
||||||
//case EA_PLATFORM_WII: ea->codec2 = EA_CODEC2_EAXA; break; /* not set? */
|
case EA_PLATFORM_WII: ea->codec2 = EA_CODEC2_GCADPCM; break;
|
||||||
case EA_PLATFORM_3DS: ea->codec2 = EA_CODEC2_GCADPCM; break;
|
case EA_PLATFORM_3DS: ea->codec2 = EA_CODEC2_GCADPCM; break;
|
||||||
default:
|
default:
|
||||||
VGM_LOG("EA SCHl: unknown default codec2 for platform 0x%02x\n", ea->platform);
|
VGM_LOG("EA SCHl: unknown default codec2 for platform 0x%02x\n", ea->platform);
|
||||||
|
|
|
@ -1,54 +1,68 @@
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
#include "../layout/layout.h"
|
#include "../layout/layout.h"
|
||||||
|
|
||||||
/* EA WVE (Ad10) - from Electronic Arts PS movies [Wing Commander 3/4 (PS)] */
|
/* 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 *streamFile) {
|
VGMSTREAM* init_vgmstream_ea_wve_ad10(STREAMFILE* sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag, channel_count;
|
int loop_flag, channels;
|
||||||
|
int big_endian, is_ps1;
|
||||||
|
|
||||||
/* checks */
|
|
||||||
if (!check_extensions(streamFile, "wve"))
|
/* checks */
|
||||||
goto fail;
|
/* .wve: common
|
||||||
|
* .mov: Madden NHL 97 (also uses .wve) */
|
||||||
start_offset = 0x00;
|
if (!check_extensions(sf, "wve,mov"))
|
||||||
if (read_32bitBE(start_offset, streamFile) != 0x41643130 && /* "Ad10" */
|
goto fail;
|
||||||
read_32bitBE(start_offset, streamFile) != 0x41643131) /* "Ad11" (last block, but could be first) */
|
|
||||||
goto fail;
|
start_offset = 0x00;
|
||||||
loop_flag = 0;
|
if (!is_id32be(0x00, sf, "AABB") && /* video block */
|
||||||
/* no header = no channels, but seems if the first PS-ADPCM header is 00 then it's mono, somehow
|
!is_id32be(0x00, sf, "Ad10") && /* audio block */
|
||||||
* (ex. Wing Commander 3 intro / Wing Commander 4 = stereo, rest of Wing Commander 3 = mono) */
|
!is_id32be(0x00, sf, "Ad11")) /* last audio block, but could be first */
|
||||||
channel_count = read_8bit(start_offset+0x08,streamFile) != 0 ? 2 : 1;
|
goto fail;
|
||||||
|
|
||||||
|
big_endian = guess_endianness32bit(0x04, sf);
|
||||||
/* build the VGMSTREAM */
|
|
||||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
if (is_id32be(0x00, sf, "AABB"))
|
||||||
if (!vgmstream) goto fail;
|
start_offset += big_endian ? read_u32be(0x04, sf) : read_u32le(0x04, sf);
|
||||||
|
|
||||||
vgmstream->sample_rate = 22050;
|
loop_flag = 0;
|
||||||
vgmstream->meta_type = meta_EA_WVE_AD10;
|
|
||||||
vgmstream->coding_type = coding_PSX;
|
if (ps_check_format(sf, start_offset + 0x08, 0x40)) {
|
||||||
vgmstream->layout_type = layout_blocked_ea_wve_ad10;
|
/* no header = no channels, but seems if the first PS-ADPCM header is 00 then it's mono, somehow
|
||||||
|
* (ex. Wing Commander 3 intro / Wing Commander 4 = stereo, rest of Wing Commander 3 = mono) */
|
||||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
channels = read_u8(start_offset + 0x08,sf) != 0 ? 2 : 1;
|
||||||
goto fail;
|
is_ps1 = 1;
|
||||||
|
VGM_LOG("ps1");
|
||||||
/* calc num_samples manually */
|
}
|
||||||
{
|
else {
|
||||||
vgmstream->next_block_offset = start_offset;
|
channels = 1;
|
||||||
do {
|
is_ps1 = 0;
|
||||||
block_update(vgmstream->next_block_offset,vgmstream);
|
}
|
||||||
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
|
|
||||||
}
|
|
||||||
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
|
/* build the VGMSTREAM */
|
||||||
block_update(start_offset, vgmstream);
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
}
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
return vgmstream;
|
vgmstream->sample_rate = 22050;
|
||||||
|
vgmstream->meta_type = meta_EA_WVE_AD10;
|
||||||
fail:
|
vgmstream->layout_type = layout_blocked_ea_wve_ad10;
|
||||||
close_vgmstream(vgmstream);
|
vgmstream->codec_config = big_endian;
|
||||||
return NULL;
|
if (is_ps1)
|
||||||
}
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
else
|
||||||
|
vgmstream->coding_type = coding_PCM8_U_int;
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
blocked_count_samples(vgmstream, sf, start_offset);
|
||||||
|
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -80,7 +80,6 @@ VGMSTREAM* init_vgmstream_ffmpeg(STREAMFILE* sf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VGM_USE_MPEG
|
|
||||||
/* hack for MP3 files (will return 0 samples if not an actual file)
|
/* hack for MP3 files (will return 0 samples if not an actual file)
|
||||||
* .mus: Marc Ecko's Getting Up (PC) */
|
* .mus: Marc Ecko's Getting Up (PC) */
|
||||||
if (!num_samples && check_extensions(sf, "mp3,lmp3,mus")) {
|
if (!num_samples && check_extensions(sf, "mp3,lmp3,mus")) {
|
||||||
|
@ -89,7 +88,6 @@ VGMSTREAM* init_vgmstream_ffmpeg(STREAMFILE* sf) {
|
||||||
/* this seems correct thankfully */
|
/* this seems correct thankfully */
|
||||||
//ffmpeg_set_skip_samples(data, encoder_delay);
|
//ffmpeg_set_skip_samples(data, encoder_delay);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* hack for MPC */
|
/* hack for MPC */
|
||||||
if (is_id32be(0x00, sf, "MP+\x07") || /* Musepack V7 */
|
if (is_id32be(0x00, sf, "MP+\x07") || /* Musepack V7 */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "hca_keys.h"
|
#include "hca_keys.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
#include "clHCA.h"
|
#include "../coding/hca_decoder_clhca.h"
|
||||||
|
|
||||||
//#define HCA_BRUTEFORCE
|
//#define HCA_BRUTEFORCE
|
||||||
#ifdef HCA_BRUTEFORCE
|
#ifdef HCA_BRUTEFORCE
|
||||||
|
|
|
@ -718,7 +718,10 @@ static const hcakey_info hcakey_list[] = {
|
||||||
{0xfea0d6adff136868}, //music_9050001
|
{0xfea0d6adff136868}, //music_9050001
|
||||||
|
|
||||||
// Mini 4WD Hyper Dash Grand Prix (Android)
|
// Mini 4WD Hyper Dash Grand Prix (Android)
|
||||||
{7957824642808300098}, // 6E6FDF59AB704242
|
{7957824642808300098}, // 6E6FDF59AB704242
|
||||||
|
|
||||||
|
// m HOLD'EM (Android)
|
||||||
|
{369211553984367}, // 00014FCBC385AF6F
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif/*_HCA_KEYS_H_*/
|
#endif/*_HCA_KEYS_H_*/
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
|
|
||||||
VGMSTREAM* init_vgmstream_silence(int channels, int sample_rate, int32_t num_samples);
|
VGMSTREAM* init_vgmstream_silence(int channels, int sample_rate, int32_t num_samples);
|
||||||
|
VGMSTREAM* init_vgmstream_silence_container(int total_subsongs);
|
||||||
|
|
||||||
|
|
||||||
VGMSTREAM* init_vgmstream_adx(STREAMFILE* sf);
|
VGMSTREAM* init_vgmstream_adx(STREAMFILE* sf);
|
||||||
|
@ -959,4 +960,6 @@ VGMSTREAM* init_vgmstream_wxd_wxh(STREAMFILE* sf);
|
||||||
|
|
||||||
VGMSTREAM* init_vgmstream_bnk_relic(STREAMFILE* sf);
|
VGMSTREAM* init_vgmstream_bnk_relic(STREAMFILE* sf);
|
||||||
|
|
||||||
|
VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf);
|
||||||
|
|
||||||
#endif /*_META_H*/
|
#endif /*_META_H*/
|
||||||
|
|
|
@ -27,8 +27,8 @@ static void parse_adtl(off_t adtl_offset, off_t adtl_length, STREAMFILE* sf, lon
|
||||||
off_t current_chunk = adtl_offset+0x04;
|
off_t current_chunk = adtl_offset+0x04;
|
||||||
|
|
||||||
while (current_chunk < adtl_offset + adtl_length) {
|
while (current_chunk < adtl_offset + adtl_length) {
|
||||||
uint32_t chunk_type = read_32bitBE(current_chunk+0x00,sf);
|
uint32_t chunk_type = read_u32be(current_chunk+0x00,sf);
|
||||||
off_t chunk_size = read_32bitLE(current_chunk+0x04,sf);
|
uint32_t chunk_size = read_u32le(current_chunk+0x04,sf);
|
||||||
|
|
||||||
if (current_chunk+0x08+chunk_size > adtl_offset+adtl_length)
|
if (current_chunk+0x08+chunk_size > adtl_offset+adtl_length)
|
||||||
return;
|
return;
|
||||||
|
@ -81,7 +81,7 @@ typedef struct {
|
||||||
off_t size;
|
off_t size;
|
||||||
uint32_t codec;
|
uint32_t codec;
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
int channel_count;
|
int channels;
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
int bps;
|
int bps;
|
||||||
off_t extra_size;
|
off_t extra_size;
|
||||||
|
@ -95,38 +95,38 @@ typedef struct {
|
||||||
int is_at9;
|
int is_at9;
|
||||||
} riff_fmt_chunk;
|
} riff_fmt_chunk;
|
||||||
|
|
||||||
static int read_fmt(int big_endian, STREAMFILE* sf, off_t current_chunk, riff_fmt_chunk* fmt, int mwv) {
|
static int read_fmt(int big_endian, STREAMFILE* sf, off_t offset, riff_fmt_chunk* fmt, int mwv) {
|
||||||
int32_t (*read_32bit)(off_t,STREAMFILE*) = big_endian ? read_32bitBE : read_32bitLE;
|
uint32_t (*read_u32)(off_t,STREAMFILE*) = big_endian ? read_u32be : read_u32le;
|
||||||
int16_t (*read_16bit)(off_t,STREAMFILE*) = big_endian ? read_16bitBE : read_16bitLE;
|
uint16_t (*read_u16)(off_t,STREAMFILE*) = big_endian ? read_u16be : read_u16le;
|
||||||
|
|
||||||
fmt->offset = current_chunk;
|
fmt->offset = offset;
|
||||||
fmt->size = read_32bit(current_chunk+0x04,sf);
|
fmt->size = read_u32(offset+0x04,sf);
|
||||||
|
|
||||||
/* WAVEFORMAT */
|
/* WAVEFORMAT */
|
||||||
fmt->codec = (uint16_t)read_16bit(current_chunk+0x08,sf);
|
fmt->codec = read_u16(offset+0x08,sf);
|
||||||
fmt->channel_count = read_16bit(current_chunk+0x0a,sf);
|
fmt->channels = read_u16(offset+0x0a,sf);
|
||||||
fmt->sample_rate = read_32bit(current_chunk+0x0c,sf);
|
fmt->sample_rate = read_u32(offset+0x0c,sf);
|
||||||
//fmt->avg_bps = read_32bit(current_chunk+0x10,sf);
|
//fmt->avg_bps = read_u32(offset+0x10,sf);
|
||||||
fmt->block_size = read_16bit(current_chunk+0x14,sf);
|
fmt->block_size = read_u16(offset+0x14,sf);
|
||||||
fmt->bps = read_16bit(current_chunk+0x16,sf);
|
fmt->bps = read_u16(offset+0x16,sf);
|
||||||
/* WAVEFORMATEX */
|
/* WAVEFORMATEX */
|
||||||
if (fmt->size >= 0x10) {
|
if (fmt->size >= 0x10) {
|
||||||
fmt->extra_size = read_16bit(current_chunk+0x18,sf);
|
fmt->extra_size = read_u16(offset+0x18,sf);
|
||||||
/* 0x1a+ depends on codec (ex. coef table for MSADPCM, samples_per_frame in MS-IMA, etc) */
|
/* 0x1a+ depends on codec (ex. coef table for MSADPCM, samples_per_frame in MS-IMA, etc) */
|
||||||
}
|
}
|
||||||
/* WAVEFORMATEXTENSIBLE */
|
/* WAVEFORMATEXTENSIBLE */
|
||||||
if (fmt->codec == 0xFFFE && fmt->extra_size >= 0x16) {
|
if (fmt->codec == 0xFFFE && fmt->extra_size >= 0x16) {
|
||||||
//fmt->extra_samples = read_16bit(current_chunk+0x1a,sf); /* valid_bits_per_sample or samples_per_block */
|
//fmt->extra_samples = read_u16(offset+0x1a,sf); /* valid_bits_per_sample or samples_per_block */
|
||||||
fmt->channel_layout = read_32bit(current_chunk+0x1c,sf);
|
fmt->channel_layout = read_u32(offset+0x1c,sf);
|
||||||
/* 0x10 guid at 0x20 */
|
/* 0x10 guid at 0x20 */
|
||||||
|
|
||||||
/* happens in various .at3/at9, may be a bug in their encoder b/c MS's defs set mono as FC */
|
/* happens in various .at3/at9, may be a bug in their encoder b/c MS's defs set mono as FC */
|
||||||
if (fmt->channel_count == 1 && fmt->channel_layout == speaker_FL) { /* other channels are fine */
|
if (fmt->channels == 1 && fmt->channel_layout == speaker_FL) { /* other channels are fine */
|
||||||
fmt->channel_layout = speaker_FC;
|
fmt->channel_layout = speaker_FC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* happens in few at3p, may be a bug in older tools as other games have ok flags [Ridge Racer 7 (PS3)] */
|
/* happens in few at3p, may be a bug in older tools as other games have ok flags [Ridge Racer 7 (PS3)] */
|
||||||
if (fmt->channel_count == 6 && fmt->channel_layout == 0x013f) {
|
if (fmt->channels == 6 && fmt->channel_layout == 0x013f) {
|
||||||
fmt->channel_layout = 0x3f;
|
fmt->channel_layout = 0x3f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,8 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t current_chunk, riff_fm
|
||||||
switch (fmt->codec) {
|
switch (fmt->codec) {
|
||||||
case 0x00: /* Yamaha AICA ADPCM [Headhunter (DC), Bomber hehhe (DC), Rayman 2 (DC)] (unofficial) */
|
case 0x00: /* Yamaha AICA ADPCM [Headhunter (DC), Bomber hehhe (DC), Rayman 2 (DC)] (unofficial) */
|
||||||
if (fmt->bps != 4) goto fail;
|
if (fmt->bps != 4) goto fail;
|
||||||
if (fmt->block_size != 0x02*fmt->channel_count &&
|
if (fmt->block_size != 0x02*fmt->channels &&
|
||||||
fmt->block_size != 0x01*fmt->channel_count) goto fail;
|
fmt->block_size != 0x01*fmt->channels) goto fail;
|
||||||
fmt->coding_type = coding_AICA_int;
|
fmt->coding_type = coding_AICA_int;
|
||||||
fmt->interleave = 0x01;
|
fmt->interleave = 0x01;
|
||||||
break;
|
break;
|
||||||
|
@ -161,7 +161,7 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t current_chunk, riff_fm
|
||||||
if (!msadpcm_check_coefs(sf, fmt->offset + 0x08 + 0x14))
|
if (!msadpcm_check_coefs(sf, fmt->offset + 0x08 + 0x14))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
else if (fmt->bps == 16 && fmt->block_size == 0x02 * fmt->channel_count && fmt->size == 0x14) {
|
else if (fmt->bps == 16 && fmt->block_size == 0x02 * fmt->channels && fmt->size == 0x14) {
|
||||||
fmt->coding_type = coding_IMA; /* MX vs ATV Unleashed (PC) codec hijack */
|
fmt->coding_type = coding_IMA; /* MX vs ATV Unleashed (PC) codec hijack */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -201,9 +201,9 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t current_chunk, riff_fm
|
||||||
|
|
||||||
case 0x0300: /* IMA ADPCM [Chrono Ma:gia (Android)] (unofficial) */
|
case 0x0300: /* IMA ADPCM [Chrono Ma:gia (Android)] (unofficial) */
|
||||||
if (fmt->bps != 4) goto fail;
|
if (fmt->bps != 4) goto fail;
|
||||||
if (fmt->block_size != 0x0400*fmt->channel_count) goto fail;
|
if (fmt->block_size != 0x0400*fmt->channels) goto fail;
|
||||||
if (fmt->size != 0x14) goto fail;
|
if (fmt->size != 0x14) goto fail;
|
||||||
if (fmt->channel_count != 1) goto fail; /* not seen */
|
if (fmt->channels != 1) goto fail; /* not seen */
|
||||||
fmt->coding_type = coding_DVI_IMA;
|
fmt->coding_type = coding_DVI_IMA;
|
||||||
/* real 0x300 is "Fujitsu FM Towns SND" with block align 0x01 */
|
/* real 0x300 is "Fujitsu FM Towns SND" with block align 0x01 */
|
||||||
break;
|
break;
|
||||||
|
@ -218,25 +218,21 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t current_chunk, riff_fm
|
||||||
case 0x6771: /* Ogg Vorbis (mode 3+) */
|
case 0x6771: /* Ogg Vorbis (mode 3+) */
|
||||||
fmt->coding_type = coding_OGG_VORBIS;
|
fmt->coding_type = coding_OGG_VORBIS;
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
goto fail;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 0x0270: /* ATRAC3 */
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
|
case 0x0270: /* ATRAC3 */
|
||||||
fmt->coding_type = coding_FFmpeg;
|
fmt->coding_type = coding_FFmpeg;
|
||||||
fmt->is_at3 = 1;
|
fmt->is_at3 = 1;
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
goto fail;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 0xFFFE: { /* WAVEFORMATEXTENSIBLE (see ksmedia.h for known GUIDs) */
|
case 0xFFFE: { /* WAVEFORMATEXTENSIBLE (see ksmedia.h for known GUIDs) */
|
||||||
uint32_t guid1 = (uint32_t)read_32bit (current_chunk+0x20,sf);
|
uint32_t guid1 = read_u32 (offset+0x20,sf);
|
||||||
uint32_t guid2 = ((uint16_t)read_16bit (current_chunk+0x24,sf) << 16u) |
|
uint32_t guid2 = (read_u16 (offset+0x24,sf) << 16u) |
|
||||||
((uint16_t)read_16bit (current_chunk+0x26,sf));
|
(read_u16 (offset+0x26,sf));
|
||||||
uint32_t guid3 = (uint32_t)read_32bitBE(current_chunk+0x28,sf);
|
uint32_t guid3 = read_u32be(offset+0x28,sf);
|
||||||
uint32_t guid4 = (uint32_t)read_32bitBE(current_chunk+0x2c,sf);
|
uint32_t guid4 = read_u32be(offset+0x2c,sf);
|
||||||
//;VGM_LOG("RIFF: guid %08x %08x %08x %08x\n", guid1, guid2, guid3, guid4);
|
//;VGM_LOG("RIFF: guid %08x %08x %08x %08x\n", guid1, guid2, guid3, guid4);
|
||||||
|
|
||||||
/* PCM GUID (0x00000001,0000,0010,80,00,00,AA,00,38,9B,71) */
|
/* PCM GUID (0x00000001,0000,0010,80,00,00,AA,00,38,9B,71) */
|
||||||
|
@ -254,32 +250,30 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t current_chunk, riff_fm
|
||||||
|
|
||||||
/* ATRAC3plus GUID (0xE923AABF,CB58,4471,A1,19,FF,FA,01,E4,CE,62) */
|
/* ATRAC3plus GUID (0xE923AABF,CB58,4471,A1,19,FF,FA,01,E4,CE,62) */
|
||||||
if (guid1 == 0xE923AABF && guid2 == 0xCB584471 && guid3 == 0xA119FFFA && guid4 == 0x01E4CE62) {
|
if (guid1 == 0xE923AABF && guid2 == 0xCB584471 && guid3 == 0xA119FFFA && guid4 == 0x01E4CE62) {
|
||||||
#ifdef VGM_USE_MAIATRAC3PLUS
|
#ifdef VGM_USE_FFMPEG
|
||||||
uint16_t bztmp = read_16bit(current_chunk+0x32,sf);
|
fmt->coding_type = coding_FFmpeg;
|
||||||
|
fmt->is_at3p = 1;
|
||||||
|
break;
|
||||||
|
#elif defined(VGM_USE_MAIATRAC3PLUS)
|
||||||
|
uint16_t bztmp = read_u16(offset+0x32,sf);
|
||||||
bztmp = (bztmp >> 8) | (bztmp << 8);
|
bztmp = (bztmp >> 8) | (bztmp << 8);
|
||||||
fmt->coding_type = coding_AT3plus;
|
fmt->coding_type = coding_AT3plus;
|
||||||
fmt->block_size = (bztmp & 0x3FF) * 8 + 8; /* should match fmt->block_size */
|
fmt->block_size = (bztmp & 0x3FF) * 8 + 8; /* should match fmt->block_size */
|
||||||
fmt->is_at3p = 1;
|
fmt->is_at3p = 1;
|
||||||
break;
|
break;
|
||||||
#elif defined(VGM_USE_FFMPEG)
|
|
||||||
fmt->coding_type = coding_FFmpeg;
|
|
||||||
fmt->is_at3p = 1;
|
|
||||||
break;
|
|
||||||
#else
|
#else
|
||||||
goto fail;
|
goto fail;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
/* ATRAC9 GUID (0x47E142D2,36BA,4D8D,88,FC,61,65,4F,8C,83,6C) */
|
/* ATRAC9 GUID (0x47E142D2,36BA,4D8D,88,FC,61,65,4F,8C,83,6C) */
|
||||||
if (guid1 == 0x47E142D2 && guid2 == 0x36BA4D8D && guid3 == 0x88FC6165 && guid4 == 0x4F8C836C) {
|
if (guid1 == 0x47E142D2 && guid2 == 0x36BA4D8D && guid3 == 0x88FC6165 && guid4 == 0x4F8C836C) {
|
||||||
#ifdef VGM_USE_ATRAC9
|
|
||||||
fmt->coding_type = coding_ATRAC9;
|
fmt->coding_type = coding_ATRAC9;
|
||||||
fmt->is_at9 = 1;
|
fmt->is_at9 = 1;
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
goto fail;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
goto fail; /* unknown GUID */
|
goto fail; /* unknown GUID */
|
||||||
}
|
}
|
||||||
|
@ -370,7 +364,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
|
|
||||||
/* some games have wonky sizes, selectively fix to catch bad rips and new mutations */
|
/* some games have wonky sizes, selectively fix to catch bad rips and new mutations */
|
||||||
if (file_size != riff_size + 0x08) {
|
if (file_size != riff_size + 0x08) {
|
||||||
uint16_t codec = read_16bitLE(0x14,sf);
|
uint16_t codec = read_u16le(0x14,sf);
|
||||||
|
|
||||||
if (codec == 0x6771 && riff_size + 0x08 + 0x01 == file_size)
|
if (codec == 0x6771 && riff_size + 0x08 + 0x01 == file_size)
|
||||||
riff_size += 0x01; /* [Shikkoku no Sharnoth (PC)] (Sony Sound Forge?) */
|
riff_size += 0x01; /* [Shikkoku no Sharnoth (PC)] (Sony Sound Forge?) */
|
||||||
|
@ -397,11 +391,10 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
riff_size += 0x18; /* [F1 2011 (Vita)] (adds a "pada" chunk but RIFF size wasn't updated) */
|
riff_size += 0x18; /* [F1 2011 (Vita)] (adds a "pada" chunk but RIFF size wasn't updated) */
|
||||||
|
|
||||||
else if (mwv) {
|
else if (mwv) {
|
||||||
int channels = read_16bitLE(0x16, sf); /* [Dragon Quest VIII (PS2), Rogue Galaxy (PS2)] */
|
int channels = read_u16le(0x16, sf); /* [Dragon Quest VIII (PS2), Rogue Galaxy (PS2)] */
|
||||||
size_t file_size_fixed = riff_size + 0x08 + 0x04 * (channels - 1);
|
size_t file_size_fixed = riff_size + 0x08 + 0x04 * (channels - 1);
|
||||||
|
|
||||||
if (file_size_fixed <= file_size && file_size - file_size_fixed < 0x10)
|
if (file_size_fixed <= file_size && file_size - file_size_fixed < 0x10) {
|
||||||
{
|
|
||||||
/* files inside HD6/DAT are also padded to 0x10 so need to fix file_size */
|
/* files inside HD6/DAT are also padded to 0x10 so need to fix file_size */
|
||||||
file_size = file_size_fixed;
|
file_size = file_size_fixed;
|
||||||
riff_size = file_size - 0x08;
|
riff_size = file_size - 0x08;
|
||||||
|
@ -617,7 +610,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(fmt.channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(fmt.channels,loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->sample_rate = fmt.sample_rate;
|
vgmstream->sample_rate = fmt.sample_rate;
|
||||||
|
@ -661,7 +654,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
/* samples, codec init (after setting coding to ensure proper close on failure) */
|
/* samples, codec init (after setting coding to ensure proper close on failure) */
|
||||||
switch (fmt.coding_type) {
|
switch (fmt.coding_type) {
|
||||||
case coding_PCM16LE:
|
case coding_PCM16LE:
|
||||||
vgmstream->num_samples = pcm_bytes_to_samples(data_size, fmt.channel_count, 16);
|
vgmstream->num_samples = pcm_bytes_to_samples(data_size, fmt.channels, 16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case coding_PCM8_U:
|
case coding_PCM8_U:
|
||||||
|
@ -670,7 +663,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
|
|
||||||
case coding_L5_555:
|
case coding_L5_555:
|
||||||
if (!mwv) goto fail;
|
if (!mwv) goto fail;
|
||||||
vgmstream->num_samples = data_size / 0x12 / fmt.channel_count * 32;
|
vgmstream->num_samples = data_size / 0x12 / fmt.channels * 32;
|
||||||
|
|
||||||
/* coefs */
|
/* coefs */
|
||||||
{
|
{
|
||||||
|
@ -684,7 +677,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
read_32bitLE(mwv_pflt_offset+0x04, sf) < 8 + filter_count * 4 * filter_order)
|
read_32bitLE(mwv_pflt_offset+0x04, sf) < 8 + filter_count * 4 * filter_order)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
for (ch = 0; ch < fmt.channel_count; ch++) {
|
for (ch = 0; ch < fmt.channels; ch++) {
|
||||||
for (i = 0; i < filter_count * filter_order; i++) {
|
for (i = 0; i < filter_count * filter_order; i++) {
|
||||||
int coef = read_32bitLE(mwv_pflt_offset+0x10+i*0x04, sf);
|
int coef = read_32bitLE(mwv_pflt_offset+0x10+i*0x04, sf);
|
||||||
vgmstream->ch[ch].adpcm_coef_3by32[i] = coef;
|
vgmstream->ch[ch].adpcm_coef_3by32[i] = coef;
|
||||||
|
@ -695,31 +688,31 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case coding_MSADPCM:
|
case coding_MSADPCM:
|
||||||
vgmstream->num_samples = msadpcm_bytes_to_samples(data_size, fmt.block_size, fmt.channel_count);
|
vgmstream->num_samples = msadpcm_bytes_to_samples(data_size, fmt.block_size, fmt.channels);
|
||||||
if (fact_sample_count && fact_sample_count < vgmstream->num_samples)
|
if (fact_sample_count && fact_sample_count < vgmstream->num_samples)
|
||||||
vgmstream->num_samples = fact_sample_count;
|
vgmstream->num_samples = fact_sample_count;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case coding_MS_IMA:
|
case coding_MS_IMA:
|
||||||
vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, fmt.block_size, fmt.channel_count);
|
vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, fmt.block_size, fmt.channels);
|
||||||
if (fact_sample_count && fact_sample_count < vgmstream->num_samples)
|
if (fact_sample_count && fact_sample_count < vgmstream->num_samples)
|
||||||
vgmstream->num_samples = fact_sample_count;
|
vgmstream->num_samples = fact_sample_count;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case coding_AICA:
|
case coding_AICA:
|
||||||
case coding_AICA_int:
|
case coding_AICA_int:
|
||||||
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, fmt.channel_count);
|
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, fmt.channels);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case coding_XBOX_IMA:
|
case coding_XBOX_IMA:
|
||||||
vgmstream->num_samples = xbox_ima_bytes_to_samples(data_size, fmt.channel_count);
|
vgmstream->num_samples = xbox_ima_bytes_to_samples(data_size, fmt.channels);
|
||||||
if (fact_sample_count && fact_sample_count < vgmstream->num_samples)
|
if (fact_sample_count && fact_sample_count < vgmstream->num_samples)
|
||||||
vgmstream->num_samples = fact_sample_count; /* some (converted?) Xbox games have bigger fact_samples */
|
vgmstream->num_samples = fact_sample_count; /* some (converted?) Xbox games have bigger fact_samples */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case coding_IMA:
|
case coding_IMA:
|
||||||
case coding_DVI_IMA:
|
case coding_DVI_IMA:
|
||||||
vgmstream->num_samples = ima_bytes_to_samples(data_size, fmt.channel_count);
|
vgmstream->num_samples = ima_bytes_to_samples(data_size, fmt.channels);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
|
@ -873,7 +866,7 @@ fail:
|
||||||
static int is_ue4_msadpcm(STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_count, off_t start) {
|
static int is_ue4_msadpcm(STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_count, off_t start) {
|
||||||
|
|
||||||
/* multichannel ok */
|
/* multichannel ok */
|
||||||
if (fmt->channel_count < 2)
|
if (fmt->channels < 2)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* UE4 class is "ADPCM", assume it's the extension too */
|
/* UE4 class is "ADPCM", assume it's the extension too */
|
||||||
|
@ -902,7 +895,7 @@ static int is_ue4_msadpcm(STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_c
|
||||||
/* their encoder doesn't calculate optimal coefs and uses fixed values every frame
|
/* their encoder doesn't calculate optimal coefs and uses fixed values every frame
|
||||||
* (could do it for fmt size 0x36 too but maybe they'll fix it in the future) */
|
* (could do it for fmt size 0x36 too but maybe they'll fix it in the future) */
|
||||||
while (offset <= max_offset) {
|
while (offset <= max_offset) {
|
||||||
if (read_8bit(offset+0x00, sf) != 0 || read_16bitLE(offset+0x01, sf) != 0x00E6)
|
if (read_u8(offset+0x00, sf) != 0 || read_u16le(offset+0x01, sf) != 0x00E6)
|
||||||
goto fail;
|
goto fail;
|
||||||
offset += fmt->block_size;
|
offset += fmt->block_size;
|
||||||
}
|
}
|
||||||
|
@ -916,7 +909,7 @@ fail:
|
||||||
/* for maximum annoyance later UE4 versions (~v4.2x?) interleave single frames instead of
|
/* for maximum annoyance later UE4 versions (~v4.2x?) interleave single frames instead of
|
||||||
* half interleave, but don't have flags to detect so we need some heuristics */
|
* half interleave, but don't have flags to detect so we need some heuristics */
|
||||||
static size_t get_ue4_msadpcm_interleave(STREAMFILE* sf, riff_fmt_chunk* fmt, off_t start, size_t size) {
|
static size_t get_ue4_msadpcm_interleave(STREAMFILE* sf, riff_fmt_chunk* fmt, off_t start, size_t size) {
|
||||||
size_t v1_interleave = size / fmt->channel_count;
|
size_t v1_interleave = size / fmt->channels;
|
||||||
size_t v2_interleave = fmt->block_size;
|
size_t v2_interleave = fmt->block_size;
|
||||||
uint8_t nibbles1[0x08] = {0};
|
uint8_t nibbles1[0x08] = {0};
|
||||||
uint8_t nibbles2[0x08] = {0};
|
uint8_t nibbles2[0x08] = {0};
|
||||||
|
@ -927,7 +920,7 @@ static size_t get_ue4_msadpcm_interleave(STREAMFILE* sf, riff_fmt_chunk* fmt, of
|
||||||
return v1_interleave;
|
return v1_interleave;
|
||||||
|
|
||||||
/* 6ch only observed in later versions [Fortnite (PC)], not padded */
|
/* 6ch only observed in later versions [Fortnite (PC)], not padded */
|
||||||
if (fmt->channel_count > 2)
|
if (fmt->channels > 2)
|
||||||
return v2_interleave;
|
return v2_interleave;
|
||||||
|
|
||||||
read_streamfile(nibbles1, start + size - 0x08, sizeof(nibbles2), sf);
|
read_streamfile(nibbles1, start + size - 0x08, sizeof(nibbles2), sf);
|
||||||
|
@ -1053,7 +1046,7 @@ VGMSTREAM* init_vgmstream_rifx(STREAMFILE* sf) {
|
||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(fmt.channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(fmt.channels,loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->sample_rate = fmt.sample_rate;
|
vgmstream->sample_rate = fmt.sample_rate;
|
||||||
|
|
|
@ -27,3 +27,19 @@ fail:
|
||||||
close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* silent stream - for containers that have dummy streams but it's a hassle to detect/filter out */
|
||||||
|
VGMSTREAM* init_vgmstream_silence_container(int total_subsongs) {
|
||||||
|
VGMSTREAM* vgmstream = NULL;
|
||||||
|
|
||||||
|
vgmstream = init_vgmstream_silence(0, 0, 0);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->num_streams = total_subsongs;
|
||||||
|
snprintf(vgmstream->stream_name, STREAM_NAME_SIZE, "%s", "dummy");
|
||||||
|
|
||||||
|
return vgmstream;
|
||||||
|
fail:
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ typedef struct {
|
||||||
int audio_fix_psx_samples;
|
int audio_fix_psx_samples;
|
||||||
int audio_external_and;
|
int audio_external_and;
|
||||||
int audio_loop_and;
|
int audio_loop_and;
|
||||||
|
int audio_ignore_resource_size;
|
||||||
|
|
||||||
off_t sequence_sequence_loop;
|
off_t sequence_sequence_loop;
|
||||||
off_t sequence_sequence_single;
|
off_t sequence_sequence_single;
|
||||||
|
@ -1116,9 +1117,12 @@ static int parse_offsets(ubi_bao_header* bao, STREAMFILE* sf) {
|
||||||
read_string(bao->resource_name,255, resources_offset + 0x04+0x04 + name_offset, sf);
|
read_string(bao->resource_name,255, resources_offset + 0x04+0x04 + name_offset, sf);
|
||||||
|
|
||||||
if (bao->stream_size != resource_size - bao->stream_skip + bao->prefetch_size) {
|
if (bao->stream_size != resource_size - bao->stream_skip + bao->prefetch_size) {
|
||||||
VGM_ASSERT(bao->stream_size != resource_size - bao->stream_skip + bao->prefetch_size,
|
VGM_LOG("UBI BAO: stream vs resource size mismatch at %lx (%x vs %x, %x, %x)\n", offset+0x10*i, bao->stream_size, resource_size, bao->stream_skip, bao->prefetch_size);
|
||||||
"UBI BAO: stream vs resource size mismatch at %lx\n", offset+0x10*i);
|
|
||||||
goto fail;
|
/* rarely resource has more data than stream (sometimes a few bytes, others +0x100000)
|
||||||
|
* sometimes short song versions, but not accessed? no samples/sizes/cues/etc in header seem to refer to that [Just Dance (Wii)] */
|
||||||
|
if (!bao->cfg.audio_ignore_resource_size || bao->prefetch_size)
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1755,6 +1759,9 @@ static int config_bao_version(ubi_bao_header* bao, STREAMFILE* sf) {
|
||||||
bao->cfg.codec_map[0x09] = RAW_DSP;
|
bao->cfg.codec_map[0x09] = RAW_DSP;
|
||||||
|
|
||||||
bao->cfg.file_type = UBI_FORGE_b;
|
bao->cfg.file_type = UBI_FORGE_b;
|
||||||
|
|
||||||
|
if (version == 0x0022000D) /* Just Dance (Wii) oddity */
|
||||||
|
bao->cfg.audio_ignore_resource_size = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case 0x00220015: /* James Cameron's Avatar: The Game (PSP)-package */
|
case 0x00220015: /* James Cameron's Avatar: The Game (PSP)-package */
|
||||||
|
|
|
@ -5,38 +5,40 @@
|
||||||
|
|
||||||
|
|
||||||
/* LyN RIFF - from Ubisoft LyN engine games [Red Steel 2 (Wii), Adventures of Tintin (Multi), From Dust (Multi), Just Dance 3/4 (multi)] */
|
/* LyN RIFF - from Ubisoft LyN engine games [Red Steel 2 (Wii), Adventures of Tintin (Multi), From Dust (Multi), Just Dance 3/4 (multi)] */
|
||||||
VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
VGMSTREAM* init_vgmstream_ubi_lyn(STREAMFILE* sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
off_t start_offset, first_offset = 0xc;
|
off_t start_offset, first_offset = 0xc;
|
||||||
off_t fmt_offset, data_offset, fact_offset;
|
off_t fmt_offset, data_offset, fact_offset;
|
||||||
size_t fmt_size, data_size, fact_size;
|
size_t fmt_size, data_size, fact_size;
|
||||||
int loop_flag, channel_count, sample_rate, codec;
|
int loop_flag, channels, sample_rate, codec;
|
||||||
int num_samples;
|
int num_samples;
|
||||||
|
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
/* .sns: Red Steel 2, .wav: Tintin, .son: From Dust */
|
/* .sns: Red Steel 2
|
||||||
if (!check_extensions(streamFile,"sns,wav,lwav,son"))
|
* .wav: Tintin, Just Dance
|
||||||
|
* .son: From Dust */
|
||||||
|
if (!check_extensions(sf,"sns,wav,lwav,son"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* a slightly eccentric RIFF with custom codecs */
|
/* a slightly eccentric RIFF with custom codecs */
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x52494646 || /* "RIFF" */
|
if (!is_id32be(0x00,sf, "RIFF") ||
|
||||||
read_32bitBE(0x08,streamFile) != 0x57415645) /* "WAVE" */
|
!is_id32be(0x08,sf, "WAVE"))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (read_32bitLE(0x04,streamFile)+0x04+0x04 != get_streamfile_size(streamFile))
|
if (read_32bitLE(0x04,sf) + 0x04 + 0x04 != get_streamfile_size(sf))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!find_chunk(streamFile, 0x666d7420,first_offset,0, &fmt_offset,&fmt_size, 0, 0)) /* "fmt " */
|
if (!find_chunk(sf, 0x666d7420,first_offset,0, &fmt_offset,&fmt_size, 0, 0)) /* "fmt " */
|
||||||
goto fail;
|
goto fail;
|
||||||
if (!find_chunk(streamFile, 0x64617461,first_offset,0, &data_offset,&data_size, 0, 0)) /* "data" */
|
if (!find_chunk(sf, 0x64617461,first_offset,0, &data_offset,&data_size, 0, 0)) /* "data" */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* always found, even with PCM (LyN subchunk seems to contain the engine version, ex. 0x0d/10) */
|
/* always found, even with PCM (LyN subchunk seems to contain the engine version, ex. 0x0d/10) */
|
||||||
if (!find_chunk(streamFile, 0x66616374,first_offset,0, &fact_offset,&fact_size, 0, 0)) /* "fact" */
|
if (!find_chunk(sf, 0x66616374,first_offset,0, &fact_offset,&fact_size, 0, 0)) /* "fact" */
|
||||||
goto fail;
|
goto fail;
|
||||||
if (fact_size != 0x10 || read_32bitBE(fact_offset+0x04, streamFile) != 0x4C794E20) /* "LyN " */
|
if (fact_size != 0x10 || read_32bitBE(fact_offset+0x04, sf) != 0x4C794E20) /* "LyN " */
|
||||||
goto fail;
|
goto fail;
|
||||||
num_samples = read_32bitLE(fact_offset+0x00, streamFile);
|
num_samples = read_32bitLE(fact_offset+0x00, sf);
|
||||||
/* sometimes there is a LySE chunk */
|
/* sometimes there is a LySE chunk */
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,9 +46,9 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
{
|
{
|
||||||
if (fmt_size < 0x12)
|
if (fmt_size < 0x12)
|
||||||
goto fail;
|
goto fail;
|
||||||
codec = (uint16_t)read_16bitLE(fmt_offset+0x00,streamFile);
|
codec = read_u16le(fmt_offset+0x00,sf);
|
||||||
channel_count = read_16bitLE(fmt_offset+0x02,streamFile);
|
channels = read_u16le(fmt_offset+0x02,sf);
|
||||||
sample_rate = read_32bitLE(fmt_offset+0x04,streamFile);
|
sample_rate = read_s32le(fmt_offset+0x04,sf);
|
||||||
/* 0x08: average bytes, 0x0c: block align, 0x0e: bps, etc */
|
/* 0x08: average bytes, 0x0c: block align, 0x0e: bps, etc */
|
||||||
|
|
||||||
/* fake WAVEFORMATEX, used with > 2ch */
|
/* fake WAVEFORMATEX, used with > 2ch */
|
||||||
|
@ -54,10 +56,10 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
if (fmt_size < 0x28)
|
if (fmt_size < 0x28)
|
||||||
goto fail;
|
goto fail;
|
||||||
/* fake GUID with first value doubling as codec */
|
/* fake GUID with first value doubling as codec */
|
||||||
codec = read_32bitLE(fmt_offset+0x18,streamFile);
|
codec = read_32bitLE(fmt_offset+0x18,sf);
|
||||||
if (read_32bitBE(fmt_offset+0x1c,streamFile) != 0x00001000 &&
|
if (read_32bitBE(fmt_offset+0x1c,sf) != 0x00001000 &&
|
||||||
read_32bitBE(fmt_offset+0x20,streamFile) != 0x800000AA &&
|
read_32bitBE(fmt_offset+0x20,sf) != 0x800000AA &&
|
||||||
read_32bitBE(fmt_offset+0x24,streamFile) != 0x00389B71) {
|
read_32bitBE(fmt_offset+0x24,sf) != 0x00389B71) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +72,7 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->sample_rate = sample_rate;
|
vgmstream->sample_rate = sample_rate;
|
||||||
|
@ -99,7 +101,7 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
};
|
};
|
||||||
int i, ch;
|
int i, ch;
|
||||||
|
|
||||||
for (ch = 0; ch < channel_count; ch++) {
|
for (ch = 0; ch < channels; ch++) {
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
vgmstream->ch[ch].adpcm_coef[i] = coef[i];
|
vgmstream->ch[ch].adpcm_coef[i] = coef[i];
|
||||||
}
|
}
|
||||||
|
@ -114,27 +116,27 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
layered_layout_data* data = NULL;
|
layered_layout_data* data = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (read_32bitLE(start_offset+0x00,streamFile) != 1) /* id? */
|
if (read_32bitLE(start_offset+0x00,sf) != 1) /* id? */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
interleave_size = read_32bitLE(start_offset+0x04,streamFile);
|
interleave_size = read_32bitLE(start_offset+0x04,sf);
|
||||||
/* interleave is adjusted so there is no smaller last block, it seems */
|
/* interleave is adjusted so there is no smaller last block, it seems */
|
||||||
|
|
||||||
vgmstream->coding_type = coding_OGG_VORBIS;
|
vgmstream->coding_type = coding_OGG_VORBIS;
|
||||||
vgmstream->layout_type = layout_layered;
|
vgmstream->layout_type = layout_layered;
|
||||||
|
|
||||||
/* init layout */
|
/* init layout */
|
||||||
data = init_layout_layered(channel_count);
|
data = init_layout_layered(channels);
|
||||||
if (!data) goto fail;
|
if (!data) goto fail;
|
||||||
vgmstream->layout_data = data;
|
vgmstream->layout_data = data;
|
||||||
|
|
||||||
/* open each layer subfile */
|
/* open each layer subfile */
|
||||||
for (i = 0; i < channel_count; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
STREAMFILE* temp_sf = NULL;
|
STREAMFILE* temp_sf = NULL;
|
||||||
size_t logical_size = read_32bitLE(start_offset+0x08 + 0x04*i,streamFile);
|
size_t logical_size = read_32bitLE(start_offset+0x08 + 0x04*i,sf);
|
||||||
off_t layer_offset = start_offset + 0x08 + 0x04*channel_count; //+ interleave_size*i;
|
off_t layer_offset = start_offset + 0x08 + 0x04*channels; //+ interleave_size*i;
|
||||||
|
|
||||||
temp_sf = setup_ubi_lyn_streamfile(streamFile, layer_offset, interleave_size, i, channel_count, logical_size);
|
temp_sf = setup_ubi_lyn_streamfile(sf, layer_offset, interleave_size, i, channels, logical_size);
|
||||||
if (!temp_sf) goto fail;
|
if (!temp_sf) goto fail;
|
||||||
|
|
||||||
data->layers[i] = init_vgmstream_ogg_vorbis(temp_sf);
|
data->layers[i] = init_vgmstream_ogg_vorbis(temp_sf);
|
||||||
|
@ -155,17 +157,23 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
#ifdef VGM_USE_MPEG
|
#ifdef VGM_USE_MPEG
|
||||||
case 0x5051: { /* MPEG (PS3/PC), interleaved 1ch */
|
case 0x5051: { /* MPEG (PS3/PC), interleaved 1ch */
|
||||||
mpeg_custom_config cfg = {0};
|
mpeg_custom_config cfg = {0};
|
||||||
int i;
|
int i, frame_samples;
|
||||||
|
|
||||||
cfg.interleave = read_32bitLE(start_offset+0x04,streamFile);
|
/* 0x00: config? (related to chunk size? 2=Tintin, some JD4?, 3=Michael Jackson, JD4) */
|
||||||
cfg.chunk_size = read_32bitLE(start_offset+0x08,streamFile); /* frame size (not counting MPEG padding?) */
|
cfg.interleave = read_u32le(start_offset+0x04,sf);
|
||||||
/* 0x00: id? (2=Tintin, 3=Michael Jackson), 0x0c: frame per interleave, 0x10: samples per frame */
|
/* 0x08: CBR frame size (not counting MPEG padding) */
|
||||||
|
/* 0x0c: bps (32) */
|
||||||
|
frame_samples = read_s32le(start_offset+0x10,sf);
|
||||||
|
|
||||||
/* skip seek tables and find actual start */
|
/* skip seek tables and find actual start */
|
||||||
|
/* table: entries per channel (1 per chunk, but not chunk-aligned?) */
|
||||||
|
/* - 0x00: offset but same for both channels? */
|
||||||
|
/* - 0x04: flag? (-1~-N) */
|
||||||
|
/* - 0x06: flag? (-1~-N) */
|
||||||
start_offset += 0x14;
|
start_offset += 0x14;
|
||||||
data_size -= 0x14;
|
data_size -= 0x14;
|
||||||
for (i = 0; i < channel_count; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
int entries = read_32bitLE(start_offset,streamFile);
|
int entries = read_s32le(start_offset,sf);
|
||||||
|
|
||||||
start_offset += 0x04 + entries*0x08;
|
start_offset += 0x04 + entries*0x08;
|
||||||
data_size -= 0x04 + entries*0x08;
|
data_size -= 0x04 + entries*0x08;
|
||||||
|
@ -173,8 +181,25 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
|
|
||||||
cfg.data_size = data_size;
|
cfg.data_size = data_size;
|
||||||
|
|
||||||
//todo data parsing looks correct but some files decode a bit wrong at the end (ex. Tintin: Music~Boss~Allan~Victory~02)
|
/* last interleave is half remaining data */
|
||||||
vgmstream->codec_data = init_mpeg_custom(streamFile, start_offset, &vgmstream->coding_type, vgmstream->channels, MPEG_LYN, &cfg);
|
cfg.max_chunks = (cfg.data_size / (cfg.interleave * channels));
|
||||||
|
/* somehow certain interleaves don't work:
|
||||||
|
* - 0xB400: 0x2D00 ko, 0xE100 ok (max-1)
|
||||||
|
* - 0x8000: 0x3ec7 ko, 0xbec7 ok (max-1)
|
||||||
|
* - 0x8000: 0x5306 ok, 0xd306 ko (max-1) !!!
|
||||||
|
* (doesn't seem related to anything like data size/frame samples/sample rate/etc) */
|
||||||
|
cfg.max_chunks--;
|
||||||
|
cfg.interleave_last = (cfg.data_size - cfg.max_chunks * cfg.interleave * channels) / channels;
|
||||||
|
if (cfg.interleave <= 0x8000 && cfg.interleave_last > 0xD000) {
|
||||||
|
cfg.max_chunks++;
|
||||||
|
cfg.interleave_last = (cfg.data_size - cfg.max_chunks * cfg.interleave * channels) / channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for some reason num_samples may be +1 or +2 of max possible samples (no apparent meaning) */
|
||||||
|
vgmstream->num_samples = vgmstream->num_samples / frame_samples * frame_samples;
|
||||||
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
|
|
||||||
|
vgmstream->codec_data = init_mpeg_custom(sf, start_offset, &vgmstream->coding_type, vgmstream->channels, MPEG_LYN, &cfg);
|
||||||
if (!vgmstream->codec_data) goto fail;
|
if (!vgmstream->codec_data) goto fail;
|
||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
|
@ -192,13 +217,13 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
/* skip standard XMA header + seek table */
|
/* skip standard XMA header + seek table */
|
||||||
/* 0x00: version? no apparent differences (0x1=Just Dance 4, 0x3=others) */
|
/* 0x00: version? no apparent differences (0x1=Just Dance 4, 0x3=others) */
|
||||||
chunk_offset = start_offset + 0x04 + 0x04;
|
chunk_offset = start_offset + 0x04 + 0x04;
|
||||||
chunk_size = read_32bitLE(start_offset + 0x04, streamFile);
|
chunk_size = read_32bitLE(start_offset + 0x04, sf);
|
||||||
seek_size = read_32bitLE(chunk_offset+chunk_size, streamFile);
|
seek_size = read_32bitLE(chunk_offset+chunk_size, sf);
|
||||||
start_offset += (0x04 + 0x04 + chunk_size + 0x04 + seek_size);
|
start_offset += (0x04 + 0x04 + chunk_size + 0x04 + seek_size);
|
||||||
data_size -= (0x04 + 0x04 + chunk_size + 0x04 + seek_size);
|
data_size -= (0x04 + 0x04 + chunk_size + 0x04 + seek_size);
|
||||||
|
|
||||||
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,0x100, chunk_offset,chunk_size, data_size, streamFile, 1);
|
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,0x100, chunk_offset,chunk_size, data_size, sf, 1);
|
||||||
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
vgmstream->codec_data = init_ffmpeg_header_offset(sf, buf,bytes, start_offset,data_size);
|
||||||
if ( !vgmstream->codec_data ) goto fail;
|
if ( !vgmstream->codec_data ) goto fail;
|
||||||
vgmstream->coding_type = coding_FFmpeg;
|
vgmstream->coding_type = coding_FFmpeg;
|
||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
|
@ -212,7 +237,7 @@ VGMSTREAM * init_vgmstream_ubi_lyn(STREAMFILE *streamFile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( !vgmstream_open_stream(vgmstream,streamFile,start_offset) )
|
if ( !vgmstream_open_stream(vgmstream,sf,start_offset) )
|
||||||
goto fail;
|
goto fail;
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
|
@ -223,7 +248,7 @@ fail:
|
||||||
|
|
||||||
|
|
||||||
/* LyN RIFF in containers */
|
/* LyN RIFF in containers */
|
||||||
VGMSTREAM * init_vgmstream_ubi_lyn_container(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ubi_lyn_container(STREAMFILE *sf) {
|
||||||
VGMSTREAM *vgmstream = NULL;
|
VGMSTREAM *vgmstream = NULL;
|
||||||
STREAMFILE *temp_sf = NULL;
|
STREAMFILE *temp_sf = NULL;
|
||||||
off_t subfile_offset;
|
off_t subfile_offset;
|
||||||
|
@ -233,29 +258,29 @@ VGMSTREAM * init_vgmstream_ubi_lyn_container(STREAMFILE *streamFile) {
|
||||||
* data before the RIFF. Might as well support them in case the RIFF wasn't extracted. */
|
* data before the RIFF. Might as well support them in case the RIFF wasn't extracted. */
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
if (!check_extensions(streamFile,"sns,wav,lwav,son"))
|
if (!check_extensions(sf,"sns,wav,lwav,son"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* find "RIFF" position */
|
/* find "RIFF" position */
|
||||||
if (read_32bitBE(0x00,streamFile) == 0x4C795345 && /* "LySE" */
|
if (read_32bitBE(0x00,sf) == 0x4C795345 && /* "LySE" */
|
||||||
read_32bitBE(0x14,streamFile) == 0x52494646) { /* "RIFF" */
|
read_32bitBE(0x14,sf) == 0x52494646) { /* "RIFF" */
|
||||||
subfile_offset = 0x14; /* Adventures of Tintin */
|
subfile_offset = 0x14; /* Adventures of Tintin */
|
||||||
}
|
}
|
||||||
else if (read_32bitBE(0x20,streamFile) == 0x4C795345 && /* "LySE" */
|
else if (read_32bitBE(0x20,sf) == 0x4C795345 && /* "LySE" */
|
||||||
read_32bitBE(0x34,streamFile) == 0x52494646) { /* "RIFF" */
|
read_32bitBE(0x34,sf) == 0x52494646) { /* "RIFF" */
|
||||||
subfile_offset = 0x34; /* Michael Jackson The Experience (Wii) */
|
subfile_offset = 0x34; /* Michael Jackson The Experience (Wii) */
|
||||||
}
|
}
|
||||||
else if (read_32bitLE(0x00,streamFile)+0x20 == get_streamfile_size(streamFile) &&
|
else if (read_32bitLE(0x00,sf)+0x20 == get_streamfile_size(sf) &&
|
||||||
read_32bitBE(0x20,streamFile) == 0x52494646) { /* "RIFF" */
|
read_32bitBE(0x20,sf) == 0x52494646) { /* "RIFF" */
|
||||||
subfile_offset = 0x20; /* Red Steel 2, From Dust */
|
subfile_offset = 0x20; /* Red Steel 2, From Dust */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
subfile_size = read_32bitLE(subfile_offset+0x04,streamFile) + 0x04+0x04;
|
subfile_size = read_32bitLE(subfile_offset+0x04,sf) + 0x04+0x04;
|
||||||
|
|
||||||
temp_sf = setup_subfile_streamfile(streamFile, subfile_offset, subfile_size, NULL);
|
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, NULL);
|
||||||
if (!temp_sf) goto fail;
|
if (!temp_sf) goto fail;
|
||||||
|
|
||||||
vgmstream = init_vgmstream_ubi_lyn(temp_sf);
|
vgmstream = init_vgmstream_ubi_lyn(temp_sf);
|
||||||
|
|
170
Frameworks/vgmstream/vgmstream/src/meta/xsh_xsd_xss.c
Normal file
170
Frameworks/vgmstream/vgmstream/src/meta/xsh_xsd_xss.c
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
#include "meta.h"
|
||||||
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* XSH+XSD/XSS - from Treyarch games [Spider-Man 2002 (Xbox), Kelly Slater's Pro Surfer (Xbox)] */
|
||||||
|
VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf) {
|
||||||
|
VGMSTREAM* vgmstream = NULL;
|
||||||
|
STREAMFILE* sf_body = NULL;
|
||||||
|
uint32_t offset;
|
||||||
|
uint32_t stream_type, stream_offset, stream_size;
|
||||||
|
uint32_t name_offset, name_size;
|
||||||
|
uint32_t flags;
|
||||||
|
int32_t num_samples;
|
||||||
|
int version = 0;
|
||||||
|
int loop_flag, channels, codec, sample_rate;
|
||||||
|
int total_subsongs, target_subsong = sf->stream_index;
|
||||||
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
if (!check_extensions(sf, "xsh"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
version = read_u32le(0x00, sf);
|
||||||
|
|
||||||
|
if (read_u32le(0x04, sf) != 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
total_subsongs = read_u32le(0x08, sf);
|
||||||
|
if (target_subsong == 0) target_subsong = 1;
|
||||||
|
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
|
||||||
|
|
||||||
|
switch(version) {
|
||||||
|
case 0x009D:
|
||||||
|
offset = 0x0c + (target_subsong-1) * 0x60;
|
||||||
|
|
||||||
|
name_offset = offset + 0x00;
|
||||||
|
name_size = 0x20;
|
||||||
|
stream_type = read_u32le(offset + 0x20,sf);
|
||||||
|
stream_offset = read_u32le(offset + 0x24,sf);
|
||||||
|
stream_size = read_u32le(offset + 0x28,sf);
|
||||||
|
flags = read_u32le(offset + 0x34,sf);
|
||||||
|
/* 0x38: flags? */
|
||||||
|
num_samples = 0;
|
||||||
|
|
||||||
|
offset = offset + 0x3c;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x0100:
|
||||||
|
offset = 0x0c + (target_subsong-1) * 0x64;
|
||||||
|
|
||||||
|
name_offset = offset + 0x00;
|
||||||
|
name_size = 0x20;
|
||||||
|
stream_type = read_u32le(offset + 0x20,sf);
|
||||||
|
stream_offset = read_u32le(offset + 0x24,sf);
|
||||||
|
stream_size = read_u32le(offset + 0x28,sf);
|
||||||
|
flags = read_u32le(offset + 0x34,sf);
|
||||||
|
num_samples = read_u32le(offset + 0x38,sf);
|
||||||
|
/* 0x3c: flags? */
|
||||||
|
|
||||||
|
offset = offset + 0x40;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
loop_flag = 0;
|
||||||
|
|
||||||
|
if (stream_type < 0 || stream_type > 2)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* 0x00: floats x4 (volume/pan/etc? usually 1.0, 1.0, 10.0, 10.0) */
|
||||||
|
codec = read_u16le(offset + 0x10,sf);
|
||||||
|
channels = read_u16le(offset + 0x12,sf);
|
||||||
|
sample_rate = read_u32le(offset + 0x14,sf);
|
||||||
|
/* 0x18: avg bitrate */
|
||||||
|
/* 0x1c: block size */
|
||||||
|
/* 0x1e: bps */
|
||||||
|
/* 0x20: 2? */
|
||||||
|
|
||||||
|
if (stream_type == 0) {
|
||||||
|
vgmstream = init_vgmstream_silence_container(total_subsongs);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
close_streamfile(sf_body);
|
||||||
|
return vgmstream;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & 0x04) {
|
||||||
|
char filename[255];
|
||||||
|
switch (version) {
|
||||||
|
case 0x009D:
|
||||||
|
/* stream is a named .xss, with stream_offset/size = 0 (Spider-Man) */
|
||||||
|
read_string(filename, name_size, name_offset,sf);
|
||||||
|
strcat(filename, ".xss");
|
||||||
|
|
||||||
|
sf_body = open_streamfile_by_filename(sf,filename);
|
||||||
|
if (!sf_body) {
|
||||||
|
VGM_LOG("XSH: can't find %s\n", filename);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* xss is playable externally, so this is mostly for show */
|
||||||
|
vgmstream = init_vgmstream_riff(sf_body);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->num_streams = total_subsongs;
|
||||||
|
read_string(vgmstream->stream_name, name_size, name_offset,sf);
|
||||||
|
|
||||||
|
close_streamfile(sf_body);
|
||||||
|
return vgmstream;
|
||||||
|
//break;
|
||||||
|
|
||||||
|
case 0x0100:
|
||||||
|
/* bigfile with all streams (Kelly Slater) */
|
||||||
|
snprintf(filename, sizeof(filename), "%s", "STREAMS.XSS");
|
||||||
|
sf_body = open_streamfile_by_filename(sf,filename);
|
||||||
|
if (!sf_body) {
|
||||||
|
VGM_LOG("XSH: can't find %s\n", filename);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sf_body = open_streamfile_by_ext(sf,"xsd");
|
||||||
|
if (!sf_body) {
|
||||||
|
VGM_LOG("XSH: can't find XSD");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->meta_type = meta_XSH_XSD_XSS;
|
||||||
|
vgmstream->sample_rate = sample_rate;
|
||||||
|
vgmstream->num_streams = total_subsongs;
|
||||||
|
vgmstream->stream_size = stream_size;
|
||||||
|
|
||||||
|
switch(codec) {
|
||||||
|
case 0x0069:
|
||||||
|
vgmstream->coding_type = coding_XBOX_IMA;
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
|
if (!num_samples)
|
||||||
|
num_samples = xbox_ima_bytes_to_samples(stream_size, channels);
|
||||||
|
|
||||||
|
vgmstream->num_samples = num_samples;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_string(vgmstream->stream_name, name_size, name_offset,sf);
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream, sf_body, stream_offset))
|
||||||
|
goto fail;
|
||||||
|
close_streamfile(sf_body);
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close_streamfile(sf_body);
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -528,6 +528,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
||||||
init_vgmstream_piff_tpcm,
|
init_vgmstream_piff_tpcm,
|
||||||
init_vgmstream_wxd_wxh,
|
init_vgmstream_wxd_wxh,
|
||||||
init_vgmstream_bnk_relic,
|
init_vgmstream_bnk_relic,
|
||||||
|
init_vgmstream_xsh_xsd_xss,
|
||||||
|
|
||||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||||
|
@ -819,7 +820,7 @@ void close_vgmstream(VGMSTREAM* vgmstream) {
|
||||||
void vgmstream_force_loop(VGMSTREAM* vgmstream, int loop_flag, int loop_start_sample, int loop_end_sample) {
|
void vgmstream_force_loop(VGMSTREAM* vgmstream, int loop_flag, int loop_start_sample, int loop_end_sample) {
|
||||||
if (!vgmstream) return;
|
if (!vgmstream) return;
|
||||||
|
|
||||||
/* ignore bad values (may happen with layers + TXTP loop install) */
|
/* ignore bad values (may happen with layers + TXTP loop install) */
|
||||||
if (loop_flag && (loop_start_sample < 0 ||
|
if (loop_flag && (loop_start_sample < 0 ||
|
||||||
loop_start_sample > loop_end_sample ||
|
loop_start_sample > loop_end_sample ||
|
||||||
loop_end_sample > vgmstream->num_samples))
|
loop_end_sample > vgmstream->num_samples))
|
||||||
|
|
|
@ -42,8 +42,6 @@ enum {
|
||||||
#include <aacdecoder_lib.h>
|
#include <aacdecoder_lib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "clHCA.h"
|
|
||||||
|
|
||||||
#ifdef BUILD_VGMSTREAM
|
#ifdef BUILD_VGMSTREAM
|
||||||
#include "coding/g72x_state.h"
|
#include "coding/g72x_state.h"
|
||||||
#else
|
#else
|
||||||
|
@ -749,6 +747,8 @@ typedef enum {
|
||||||
meta_PIFF_TPCM,
|
meta_PIFF_TPCM,
|
||||||
meta_WXD_WXH,
|
meta_WXD_WXH,
|
||||||
meta_BNK_RELIC,
|
meta_BNK_RELIC,
|
||||||
|
meta_XSH_XSD_XSS,
|
||||||
|
|
||||||
} meta_t;
|
} meta_t;
|
||||||
|
|
||||||
/* standard WAVEFORMATEXTENSIBLE speaker positions */
|
/* standard WAVEFORMATEXTENSIBLE speaker positions */
|
||||||
|
|
Loading…
Reference in a new issue