mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Add PCM16LE .xpcm [Eternal Fantasy (PC)]
This commit is contained in:
parent
b56f9e9acd
commit
9b7161a207
@ -1109,6 +1109,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_XOPUS, "Exient XOPUS header"},
|
||||
{meta_VS_FFX, "Square VS header"},
|
||||
{meta_NWAV, "Chunsoft NWAV header"},
|
||||
{meta_XPCM, "Circus XPCM header"},
|
||||
|
||||
};
|
||||
|
||||
|
@ -1617,6 +1617,10 @@
|
||||
<File
|
||||
RelativePath=".\meta\xopus.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\xpcm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\xss.c"
|
||||
|
@ -478,6 +478,7 @@
|
||||
<ClCompile Include="meta\xma.c" />
|
||||
<ClCompile Include="meta\xnb.c" />
|
||||
<ClCompile Include="meta\xopus.c" />
|
||||
<ClCompile Include="meta\xpcm.c" />
|
||||
<ClCompile Include="meta\xss.c" />
|
||||
<ClCompile Include="meta\xvag.c" />
|
||||
<ClCompile Include="meta\xmd.c" />
|
||||
|
@ -1456,6 +1456,9 @@
|
||||
<ClCompile Include="meta\xopus.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\xpcm.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\x360_cxs.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -806,4 +806,6 @@ VGMSTREAM * init_vgmstream_msf_banpresto_2msf(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_nwav(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_xpcm(STREAMFILE * streamFile);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
65
src/meta/xpcm.c
Normal file
65
src/meta/xpcm.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* XPCM - from Circus games [Eternal Fantasy (PC), D.C. White Season (PC)] */
|
||||
VGMSTREAM * init_vgmstream_xpcm(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
size_t decompressed_size;
|
||||
int loop_flag, channel_count, codec, subcodec, sample_rate;
|
||||
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "pcm"))
|
||||
goto fail;
|
||||
|
||||
if (read_32bitBE(0x00,streamFile) != 0x5850434D) /* "XPCM" "*/
|
||||
goto fail;
|
||||
|
||||
decompressed_size = read_32bitLE(0x04,streamFile); /* (data_size for PCM) */
|
||||
codec = read_8bit(0x08, streamFile);
|
||||
subcodec = read_8bit(0x09, streamFile);
|
||||
/* 0x0a: always null */
|
||||
/* 0x0c: always 0x01 (PCM codec) */
|
||||
channel_count = read_16bitLE(0x0e,streamFile);
|
||||
sample_rate = read_32bitLE(0x10,streamFile);
|
||||
/* 0x14: average bitrate */
|
||||
/* 0x18: block size */
|
||||
/* 0x1a: output bits (16) */
|
||||
start_offset = 0x1c;
|
||||
|
||||
loop_flag = 0;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_XPCM;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = decompressed_size / sizeof(int16_t) / channel_count;
|
||||
|
||||
switch(codec) {
|
||||
case 0x00:
|
||||
if (subcodec != 0) goto fail;
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x02;
|
||||
break;
|
||||
case 0x01: /* LZSS + VQ */
|
||||
case 0x02: /* ADPCM */
|
||||
case 0x03: /* unknown */
|
||||
default:
|
||||
/* 0x1c contains compressed size for those */
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -448,6 +448,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_msf_banpresto_wmsf,
|
||||
init_vgmstream_msf_banpresto_2msf,
|
||||
init_vgmstream_nwav,
|
||||
init_vgmstream_xpcm,
|
||||
|
||||
/* 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 */
|
||||
|
@ -703,6 +703,7 @@ typedef enum {
|
||||
meta_XOPUS,
|
||||
meta_VS_FFX,
|
||||
meta_NWAV,
|
||||
meta_XPCM,
|
||||
|
||||
} meta_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user