From aa58da7ca1ea9729f8269b892765f087e5400de0 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 1 Aug 2020 16:04:41 +0200 Subject: [PATCH] Add .dsb [Taiko no Tatsujin DS: Dororon! Yokai Daikessen!! (DS)] --- src/formats.c | 1 + src/libvgmstream.vcproj | 4 +++ src/libvgmstream.vcxproj | 1 + src/libvgmstream.vcxproj.filters | 3 ++ src/meta/dsb.c | 54 ++++++++++++++++++++++++++++++++ src/meta/meta.h | 2 ++ src/vgmstream.c | 1 + 7 files changed, 66 insertions(+) create mode 100644 src/meta/dsb.c diff --git a/src/formats.c b/src/formats.c index f8788d99..394f30ca 100644 --- a/src/formats.c +++ b/src/formats.c @@ -150,6 +150,7 @@ static const char* extension_list[] = { "diva", "dmsg", "ds2", //txth/reserved [Star Wars Bounty Hunter (GC)] + "dsb", "dsf", "dsp", "dspw", diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 4bf18b90..fdefc4f4 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -660,6 +660,10 @@ RelativePath=".\meta\dmsg_segh.c" > + + diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index db0de389..3ceec39c 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -316,6 +316,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index fbd0fa57..1cd1c5c3 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -457,6 +457,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/dsb.c b/src/meta/dsb.c new file mode 100644 index 00000000..24f0cc27 --- /dev/null +++ b/src/meta/dsb.c @@ -0,0 +1,54 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* .dsb - from Namco games [Taiko no Tatsujin DS: Dororon! Yokai Daikessen!! (DS)] */ +VGMSTREAM* init_vgmstream_dsb(STREAMFILE* sf) { + VGMSTREAM* vgmstream = NULL; + STREAMFILE* temp_sf = NULL; + off_t subfile_offset; + size_t subfile_size; + + + /* checks */ + if (!check_extensions(sf,"dsb")) + goto fail; + if (read_u32be(0x00,sf) != 0x44535342) /* "DSSB" */ + goto fail; + if (read_u32be(0x40,sf) != 0x44535354) /* "DSST" */ + goto fail; + + /* - DDSB: + * 0x04: chunk size + * 0x08: file name + * 0x14: sample rate + * 0x18: v01? + * 0x1c: file size + * 0x20: DSST offset + * + * - DDST: + * 0x44: chunk size + * 0x48: file name + * 0x58: small signed number? + * 0x5c: data size (with padding) + * 0x60: small signed number? + * 0x64: ? + * rest: null + */ + + subfile_offset = 0x80; + subfile_size = read_u32be(0x80 + 0x04, sf) + 0x08; /* files are padded so use BNSF */ + + temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, "bnsf"); + if (!temp_sf) goto fail; + + vgmstream = init_vgmstream_bnsf(temp_sf); + if (!vgmstream) goto fail; + + close_streamfile(temp_sf); + return vgmstream; + +fail: + close_streamfile(temp_sf); + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/meta/meta.h b/src/meta/meta.h index 72106a6a..6da0a01f 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -913,4 +913,6 @@ VGMSTREAM* init_vgmstream_adp_konami(STREAMFILE* sf); VGMSTREAM* init_vgmstream_zwv(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_dsb(STREAMFILE* sf); + #endif /*_META_H*/ diff --git a/src/vgmstream.c b/src/vgmstream.c index a6d625c6..4b3c88e5 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -506,6 +506,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_ktsc, init_vgmstream_adp_konami, init_vgmstream_zwv, + init_vgmstream_dsb, /* 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 */