mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 09:40:51 +01:00
Merge pull request #1129 from NicknineTheEagle/esf
Added Eurocom ESF format [Mortal Kombat 4 (PC)]
This commit is contained in:
commit
24e9906abf
@ -223,7 +223,7 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal
|
||||
if (total_samples > 0)
|
||||
p_info.info_set_int("stream_total_samples", total_samples);
|
||||
if (loop_start >= 0 && loop_end > loop_start) {
|
||||
if (loop_flag <= 0) p_info.info_set("looping", "disabled");
|
||||
if (!loop_flag) p_info.info_set("looping", "disabled");
|
||||
p_info.info_set_int("loop_start", loop_start);
|
||||
p_info.info_set_int("loop_end", loop_end);
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ static const char* extension_list[] = {
|
||||
"enm",
|
||||
"eno",
|
||||
"ens",
|
||||
"esf",
|
||||
"exa",
|
||||
"ezw",
|
||||
|
||||
@ -1390,6 +1391,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_MPEG, "MPEG header"},
|
||||
{meta_SSPF, "Konami SSPF header"},
|
||||
{meta_S3V, "Konami S3V header"},
|
||||
{meta_ESF, "Eurocom ESF header"},
|
||||
};
|
||||
|
||||
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {
|
||||
|
@ -205,6 +205,7 @@
|
||||
<ClCompile Include="meta\bfstm.c" />
|
||||
<ClCompile Include="meta\bfwav.c" />
|
||||
<ClCompile Include="meta\bwav.c" />
|
||||
<ClCompile Include="meta\esf.c" />
|
||||
<ClCompile Include="meta\excitebots.c" />
|
||||
<ClCompile Include="meta\ezw.c" />
|
||||
<ClCompile Include="meta\ffmpeg.c" />
|
||||
|
@ -1984,5 +1984,8 @@
|
||||
<ClCompile Include="meta\s3v.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\esf.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
46
src/meta/esf.c
Normal file
46
src/meta/esf.c
Normal file
@ -0,0 +1,46 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* .ESF - from Mortal Kombat 4 (PC) */
|
||||
VGMSTREAM* init_vgmstream_esf(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t pcm_size;
|
||||
off_t start_offset;
|
||||
int loop_flag, bps_flag, hq_flag, channels, bps;
|
||||
|
||||
/* checks */
|
||||
if (!is_id32be(0x00, sf, "ESF\x06"))
|
||||
goto fail;
|
||||
|
||||
if (!check_extensions(sf, "esf"))
|
||||
goto fail;
|
||||
|
||||
pcm_size = read_u32le(0x04, sf);
|
||||
bps_flag = pcm_size & 0x20000000;
|
||||
hq_flag = pcm_size & 0x40000000;
|
||||
loop_flag = pcm_size & 0x80000000;
|
||||
pcm_size &= 0x1FFFFFFF;
|
||||
|
||||
channels = 1; /* mono only */
|
||||
start_offset = 0x08;
|
||||
bps = bps_flag ? 16 : 8; /* 16 is supposed to mean PCM16 but is actually IMA */
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_ESF;
|
||||
vgmstream->sample_rate = hq_flag ? 22050 : 11025;
|
||||
vgmstream->coding_type = (bps == 8) ? coding_PCM8_U : coding_DVI_IMA;
|
||||
vgmstream->num_samples = pcm_bytes_to_samples(pcm_size, 1, bps);
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -982,4 +982,6 @@ VGMSTREAM* init_vgmstream_sspf(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_s3v(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_esf(STREAMFILE* sf);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
@ -522,6 +522,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
||||
init_vgmstream_sspf,
|
||||
init_vgmstream_opus_rsnd,
|
||||
init_vgmstream_s3v,
|
||||
init_vgmstream_esf,
|
||||
|
||||
/* lower priority metas (no clean header identity, somewhat ambiguous, or need extension/companion file to identify) */
|
||||
init_vgmstream_mpeg,
|
||||
|
@ -756,6 +756,7 @@ typedef enum {
|
||||
meta_MPEG,
|
||||
meta_SSPF,
|
||||
meta_S3V,
|
||||
meta_ESF,
|
||||
|
||||
} meta_t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user