mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Add MJB+MJH [Star Wars: Bounty Hunter (PS2)]
This commit is contained in:
parent
c246311359
commit
f47b79b0b0
@ -305,6 +305,7 @@ static const char* extension_list[] = {
|
||||
"mds",
|
||||
"mdsp",
|
||||
"med",
|
||||
"mjb",
|
||||
"mi4",
|
||||
"mib",
|
||||
"mic",
|
||||
@ -1334,6 +1335,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_DSP_CWAC, "CRI CWAC header"},
|
||||
{meta_COMPRESSWAVE, "CompressWave .cwav header"},
|
||||
{meta_KTAC, "Koei Tecmo KTAC header"},
|
||||
{meta_MJB_MJH, "Sony MultiStream MJH+MJB header"},
|
||||
};
|
||||
|
||||
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {
|
||||
|
@ -931,6 +931,10 @@
|
||||
<File
|
||||
RelativePath=".\meta\mib_mih.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\mjb_mjh.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\mn_str.c"
|
||||
|
@ -211,6 +211,7 @@
|
||||
<ClCompile Include="meta\lsf.c" />
|
||||
<ClCompile Include="meta\mattel_hyperscan.c" />
|
||||
<ClCompile Include="meta\mib_mih.c" />
|
||||
<ClCompile Include="meta\mjb_mjh.c" />
|
||||
<ClCompile Include="meta\mn_str.c" />
|
||||
<ClCompile Include="meta\mogg.c" />
|
||||
<ClCompile Include="meta\mp4.c" />
|
||||
|
@ -1675,6 +1675,9 @@
|
||||
<ClCompile Include="meta\mib_mih.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\mjb_mjh.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\mn_str.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -940,4 +940,6 @@ VGMSTREAM* init_vgmstream_compresswave(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_ktac(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_mjb_mjh(STREAMFILE* sf);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
83
src/meta/mjb_mjh.c
Normal file
83
src/meta/mjb_mjh.c
Normal file
@ -0,0 +1,83 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* MJB+MJH - SCEE MultiStream? bank of MIB+MIH [Star Wars: Bounty Hunter (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_mjb_mjh(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sh = NULL;
|
||||
off_t start_offset = 0, header_offset = 0;
|
||||
size_t data_size, frame_size, frame_count;
|
||||
int channels, loop_flag, sample_rate;
|
||||
int total_subsongs, target_subsong = sf->stream_index;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(sf, "mjb"))
|
||||
goto fail;
|
||||
|
||||
sh = open_streamfile_by_ext(sf, "mjh");
|
||||
if (!sh) goto fail;
|
||||
|
||||
/* parse entries */
|
||||
{
|
||||
int i;
|
||||
off_t subsong_offset = 0;
|
||||
|
||||
total_subsongs = read_s32le(0x00,sh);
|
||||
if (target_subsong == 0) target_subsong = 1;
|
||||
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
|
||||
|
||||
for (i = 0; i < total_subsongs; i++) {
|
||||
off_t offset = 0x40 + 0x40 * i;
|
||||
size_t subsong_size = read_u32le(offset + 0x08,sh) * read_u32le(offset + 0x10,sh) * read_u32le(offset + 0x14,sh);
|
||||
|
||||
if (i + 1== target_subsong) {
|
||||
header_offset = offset;
|
||||
start_offset = subsong_offset;
|
||||
}
|
||||
subsong_offset += subsong_size;
|
||||
}
|
||||
|
||||
if (!header_offset)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
VGM_LOG("3: %lx\n", start_offset);
|
||||
|
||||
/* also see MIB+MIH (same thing but this excludes padding stuff) */
|
||||
if (read_u32le(header_offset + 0x00,sh) != 0x40)
|
||||
goto fail;
|
||||
channels = read_u32le(header_offset + 0x08,sh);
|
||||
sample_rate = read_u32le(header_offset + 0x0c,sh);
|
||||
frame_size = read_u32le(header_offset + 0x10,sh);
|
||||
frame_count = read_u32le(header_offset + 0x14,sh);
|
||||
|
||||
data_size = frame_count * frame_size * channels;
|
||||
loop_flag = 0;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_MJB_MJH;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = ps_bytes_to_samples(data_size, channels);
|
||||
|
||||
vgmstream->num_streams = total_subsongs;
|
||||
vgmstream->stream_size = data_size;
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = frame_size;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
close_streamfile(sh);
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(sh);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -519,6 +519,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
||||
init_vgmstream_acx,
|
||||
init_vgmstream_compresswave,
|
||||
init_vgmstream_ktac,
|
||||
init_vgmstream_mjb_mjh,
|
||||
|
||||
/* 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 */
|
||||
|
@ -752,6 +752,7 @@ typedef enum {
|
||||
meta_DSP_CWAC,
|
||||
meta_COMPRESSWAVE,
|
||||
meta_KTAC,
|
||||
meta_MJB_MJH,
|
||||
} meta_t;
|
||||
|
||||
/* standard WAVEFORMATEXTENSIBLE speaker positions */
|
||||
|
Loading…
x
Reference in New Issue
Block a user