mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-25 15:20:21 +01:00
Add .smc+smh [Wangan Midnight (System 246)]
This commit is contained in:
parent
6a12dba228
commit
12cba40baf
@ -300,6 +300,7 @@ static const char* extension_list[] = {
|
||||
"sl3",
|
||||
"slb", //txth/reserved [THE Nekomura no Hitobito (PS2)]
|
||||
"sli",
|
||||
"smc",
|
||||
"smp",
|
||||
"smpl", //fake extension (to be removed)
|
||||
"smv",
|
||||
@ -997,6 +998,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_OGG_RPGMV, "Ogg Vorbis (RPGMV header)"},
|
||||
{meta_OGG_ENO, "Ogg Vorbis (ENO header)"},
|
||||
{meta_TXTP, "TXTP generic header"},
|
||||
{meta_SMC_SMH, "Genki SMC+SMH header"},
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
{meta_FFmpeg, "FFmpeg supported file format"},
|
||||
|
@ -1218,6 +1218,10 @@
|
||||
RelativePath=".\meta\sli.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\smc_smh.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\smv.c"
|
||||
>
|
||||
|
@ -389,6 +389,7 @@
|
||||
<ClCompile Include="meta\sdt.c" />
|
||||
<ClCompile Include="meta\sfl.c" />
|
||||
<ClCompile Include="meta\sli.c" />
|
||||
<ClCompile Include="meta\smc_smh.c" />
|
||||
<ClCompile Include="meta\smv.c" />
|
||||
<ClCompile Include="meta\sps_n1.c" />
|
||||
<ClCompile Include="meta\spt_spd.c" />
|
||||
|
@ -742,6 +742,9 @@
|
||||
<ClCompile Include="meta\sli.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\smc_smh.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\smv.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -736,4 +736,6 @@ VGMSTREAM * init_vgmstream_msb_msh(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_txtp(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_smc_smh(STREAMFILE * streamFile);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
66
src/meta/smc_smh.c
Normal file
66
src/meta/smc_smh.c
Normal file
@ -0,0 +1,66 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* SMC+SMH - from Wangan Midnight 1/R (System246) */
|
||||
VGMSTREAM * init_vgmstream_smc_smh(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamHeader = NULL;
|
||||
off_t start_offset, header_offset = 0;
|
||||
size_t stream_size;
|
||||
int loop_flag = 0, channel_count, sample_rate;
|
||||
int total_subsongs, target_subsong = streamFile->stream_index;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "smc"))
|
||||
goto fail;
|
||||
|
||||
streamHeader = open_streamfile_by_ext(streamFile, "smh");
|
||||
if (!streamHeader) goto fail;
|
||||
|
||||
|
||||
total_subsongs = read_32bitLE(0x00,streamHeader);
|
||||
if (target_subsong == 0) target_subsong = 1;
|
||||
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
|
||||
|
||||
if (total_subsongs*0x10 + 0x10 != get_streamfile_size(streamHeader))
|
||||
goto fail;
|
||||
|
||||
header_offset = 0x10 + (target_subsong-1)*0x10;
|
||||
|
||||
start_offset = read_32bitLE(header_offset+0x00, streamHeader);
|
||||
stream_size = read_32bitLE(header_offset+0x04, streamHeader);
|
||||
sample_rate = read_32bitLE(header_offset+0x08, streamHeader);
|
||||
/* 0x0c(2): always 0x10, frame size? */
|
||||
channel_count = read_16bitLE(header_offset+0x0e, streamHeader);
|
||||
|
||||
loop_flag = 0;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = ps_bytes_to_samples(stream_size,channel_count);
|
||||
|
||||
vgmstream->num_streams = total_subsongs;
|
||||
vgmstream->stream_size = stream_size;
|
||||
vgmstream->meta_type = meta_SMC_SMH;
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x04, streamHeader);
|
||||
|
||||
|
||||
close_streamfile(streamHeader);
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(streamHeader);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -398,6 +398,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ubi_lyn_container,
|
||||
init_vgmstream_msb_msh,
|
||||
init_vgmstream_txtp,
|
||||
init_vgmstream_smc_smh,
|
||||
|
||||
init_vgmstream_txth, /* should go at the end (lower priority) */
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
|
@ -669,6 +669,7 @@ typedef enum {
|
||||
meta_OGG_RPGMV, /* Ogg Vorbis with encryption [RPG Maker MV games (PC)] */
|
||||
meta_OGG_ENO, /* Ogg Vorbis with encryption [Metronomicon (PC)] */
|
||||
meta_TXTP, /* generic text playlist */
|
||||
meta_SMC_SMH, /* Wangan Midnight (System 246) */
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
meta_FFmpeg,
|
||||
|
Loading…
Reference in New Issue
Block a user