mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Add KTSC [Atelier Ryza (PC)]
This commit is contained in:
parent
c9dc860c4e
commit
477666a4f7
@ -832,6 +832,10 @@
|
||||
RelativePath=".\meta\kraw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ktsc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ktsr.c"
|
||||
>
|
||||
|
@ -193,6 +193,7 @@
|
||||
<ClCompile Include="meta\imuse.c" />
|
||||
<ClCompile Include="meta\ios_psnd.c" />
|
||||
<ClCompile Include="meta\kat.c" />
|
||||
<ClCompile Include="meta\ktsc.c" />
|
||||
<ClCompile Include="meta\ktsr.c" />
|
||||
<ClCompile Include="meta\ktss.c" />
|
||||
<ClCompile Include="meta\kwb.c" />
|
||||
|
@ -1747,6 +1747,9 @@
|
||||
<ClCompile Include="meta\mogg.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ktsc.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ktsr.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
60
src/meta/ktsc.c
Normal file
60
src/meta/ktsc.c
Normal file
@ -0,0 +1,60 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../layout/layout.h"
|
||||
|
||||
|
||||
/* KTSC - Koei Tecmo KTSR container */
|
||||
VGMSTREAM* init_vgmstream_ktsc(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE *temp_sf = NULL;
|
||||
int target_subsong = sf->stream_index, total_subsongs;
|
||||
off_t offset, subfile_offset;
|
||||
size_t subfile_size;
|
||||
|
||||
|
||||
/* checks */
|
||||
/* .ktsl2asbin: common [Atelier Ryza (PC)] */
|
||||
if (!check_extensions(sf, "ktsl2asbin"))
|
||||
goto fail;
|
||||
|
||||
/* KTSC is a container of KTSRs, but can't be extracted easily as they use absolute pointers to the
|
||||
* same stream companion file. KTSRs may have subsongs, but only seem to have 1, so use KTSC's subsongs. */
|
||||
if (read_u32be(0x00, sf) != 0x4B545343) /* "KTSC" */
|
||||
goto fail;
|
||||
if (read_u32be(0x04, sf) != 0x01000001) /* version? */
|
||||
goto fail;
|
||||
|
||||
if (target_subsong == 0) target_subsong = 1;
|
||||
total_subsongs = read_u32le(0x08, sf);
|
||||
if (target_subsong > total_subsongs)
|
||||
goto fail;
|
||||
|
||||
/* 0x0c: CRC(?) table start */
|
||||
offset = read_u32le(0x10, sf);
|
||||
/* 0x14: file size */
|
||||
/* 0x18: header end */
|
||||
/* 0x1c: null */
|
||||
/* 0x20+: CRC(?) table, 1 entry per file */
|
||||
|
||||
subfile_offset = read_u32le(offset + 0x04 * (target_subsong - 1), sf);
|
||||
subfile_size = read_u32le(subfile_offset + 0x1c, sf); /* from header, meh */
|
||||
|
||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, NULL);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
temp_sf->stream_index = 1;
|
||||
vgmstream = init_vgmstream_ktsr(temp_sf);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
if (vgmstream->num_streams > 1)
|
||||
goto fail;
|
||||
vgmstream->num_streams = total_subsongs;
|
||||
|
||||
close_streamfile(temp_sf);
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_sf);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -312,6 +312,7 @@ static int parse_ktsr_subfile(ktsr_header* ktsr, STREAMFILE* sf, off_t offset) {
|
||||
switch(type) { /* hash-id? */
|
||||
|
||||
case 0x38D0437D: /* external [Nioh (PC), Atelier Ryza (PC)] */
|
||||
case 0xDF92529F: /* external [Atelier Ryza (PC)] */
|
||||
/* 08 subtype? (ex. 0x522B86B9)
|
||||
* 0c channels
|
||||
* 10 ? (always 0x002706B8)
|
||||
|
@ -907,4 +907,6 @@ VGMSTREAM* init_vgmstream_kat(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_pcm_success(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_ktsc(STREAMFILE* sf);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
@ -501,6 +501,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_mups,
|
||||
init_vgmstream_kat,
|
||||
init_vgmstream_pcm_success,
|
||||
init_vgmstream_ktsc,
|
||||
|
||||
/* 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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user