mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-20 12:31:00 +01:00
commit
243c1770ec
@ -858,7 +858,7 @@ static const layout_info layout_info_list[] = {
|
||||
{layout_blocked_ea_sns, "blocked (EA SNS)"},
|
||||
{layout_blocked_awc, "blocked (AWC)"},
|
||||
{layout_blocked_vgs, "blocked (VGS)"},
|
||||
{layout_blocked_vawx, "blocked (VAWX)"},
|
||||
{layout_blocked_xwav, "blocked (XWAV)"},
|
||||
{layout_blocked_xvag_subsong, "blocked (XVAG subsong)"},
|
||||
{layout_blocked_ea_wve_au00, "blocked (EA WVE au00)"},
|
||||
{layout_blocked_ea_wve_ad10, "blocked (EA WVE Ad10)"},
|
||||
@ -1228,7 +1228,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_TXTP, "TXTP generic header"},
|
||||
{meta_SMC_SMH, "Genki SMC+SMH header"},
|
||||
{meta_PPST, "Parappa PPST header"},
|
||||
{meta_OPUS_PPP, "AT9 OPUS header"},
|
||||
{meta_SPS_N1, "Nippon Ichi .SPS header"},
|
||||
{meta_UBI_BAO, "Ubisoft BAO header"},
|
||||
{meta_DSP_SWITCH_AUDIO, "UE4 Switch Audio header"},
|
||||
{meta_TA_AAC_VITA, "tri-Ace AAC (Vita) header"},
|
||||
|
@ -182,8 +182,8 @@ void block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
case layout_blocked_vgs:
|
||||
block_update_vgs(block_offset,vgmstream);
|
||||
break;
|
||||
case layout_blocked_vawx:
|
||||
block_update_vawx(block_offset,vgmstream);
|
||||
case layout_blocked_xwav:
|
||||
block_update_xwav(block_offset,vgmstream);
|
||||
break;
|
||||
case layout_blocked_xvag_subsong:
|
||||
block_update_xvag_subsong(block_offset,vgmstream);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* pseudo-blocks that must skip last 0x20 every 0x8000 */
|
||||
void block_update_vawx(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
void block_update_xwav(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
size_t block_size;
|
||||
|
@ -38,7 +38,7 @@ void block_update_hwas(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_ea_sns(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_awc(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_vgs(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_vawx(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_xwav(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_xvag_subsong(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_ea_wve_au00(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
void block_update_ea_wve_ad10(off_t block_offset, VGMSTREAM* vgmstream);
|
||||
|
@ -1125,10 +1125,6 @@
|
||||
<File
|
||||
RelativePath=".\meta\omu.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\opus_ppp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\otm.c"
|
||||
@ -1527,7 +1523,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\vawx.c"
|
||||
RelativePath=".\meta\xwav.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -2371,7 +2367,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\layout\blocked_vawx.c"
|
||||
RelativePath=".\layout\blocked_xwav.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -235,7 +235,7 @@
|
||||
<ClCompile Include="meta\sgxd.c" />
|
||||
<ClCompile Include="meta\silence.c" />
|
||||
<ClCompile Include="meta\sk_aud.c" />
|
||||
<ClCompile Include="meta\vawx.c" />
|
||||
<ClCompile Include="meta\xwav.c" />
|
||||
<ClCompile Include="meta\seg.c" />
|
||||
<ClCompile Include="meta\sfh.c" />
|
||||
<ClCompile Include="meta\sqex_scd.c" />
|
||||
@ -408,7 +408,6 @@
|
||||
<ClCompile Include="meta\ogg_vorbis.c" />
|
||||
<ClCompile Include="meta\ogl.c" />
|
||||
<ClCompile Include="meta\omu.c" />
|
||||
<ClCompile Include="meta\opus_ppp.c" />
|
||||
<ClCompile Include="meta\otm.c" />
|
||||
<ClCompile Include="meta\p3d.c" />
|
||||
<ClCompile Include="meta\raw_al.c" />
|
||||
@ -645,7 +644,7 @@
|
||||
<ClCompile Include="layout\blocked_vgs.c" />
|
||||
<ClCompile Include="layout\blocked_vid1.c" />
|
||||
<ClCompile Include="layout\blocked_vs_square.c" />
|
||||
<ClCompile Include="layout\blocked_vawx.c" />
|
||||
<ClCompile Include="layout\blocked_xwav.c" />
|
||||
<ClCompile Include="layout\blocked_xvag.c" />
|
||||
<ClCompile Include="layout\blocked_caf.c" />
|
||||
<ClCompile Include="layout\blocked_dec.c" />
|
||||
|
@ -730,9 +730,6 @@
|
||||
<ClCompile Include="meta\omu.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\opus_ppp.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\otm.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -1423,7 +1420,7 @@
|
||||
<ClCompile Include="layout\blocked_vs_square.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="layout\blocked_vawx.c">
|
||||
<ClCompile Include="layout\blocked_xwav.c">
|
||||
<Filter>layout\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="layout\blocked_xvag.c">
|
||||
@ -1564,7 +1561,7 @@
|
||||
<ClCompile Include="meta\lsf.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\vawx.c">
|
||||
<ClCompile Include="meta\xwav.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\raw_snds.c">
|
||||
|
@ -153,7 +153,7 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
/* BKHD mini format, probably from a FX generator plugin [Borderlands 2 (X360)] */
|
||||
/* BKHD mini format, probably from FX generator plugins [Borderlands 2 (X360), Warhammer 40000 (PC)] */
|
||||
VGMSTREAM* init_vgmstream_bkhd_fx(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
off_t start_offset, data_size;
|
||||
@ -172,19 +172,20 @@ VGMSTREAM* init_vgmstream_bkhd_fx(STREAMFILE* sf) {
|
||||
if (read_u32(0x04, sf) != 0x0800) /* codec? */
|
||||
goto fail;
|
||||
sample_rate = read_u32(0x08, sf);
|
||||
channels = read_u32(0x0c, sf);
|
||||
/* 0x10: some id or small size? */
|
||||
channels = read_u32(0x0c, sf) & 0xFF; /* 0x31 at 0x0d in PC, field is 32b vs X360 */
|
||||
/* 0x10: some id or small size? (related to entries?) */
|
||||
/* 0x14/18: some float? */
|
||||
entries = read_u32(0x1c, sf);
|
||||
/* 0x20 data size / 0x10 */
|
||||
/* 0x24 usually 4, sometimes higher values? */
|
||||
/* 0x30: unknown table of 16b that goes up and down */
|
||||
/* 0x30: unknown table of 16b that goes up and down, or is fixed */
|
||||
|
||||
start_offset = 0x30 + align_size_to_block(entries * 0x02, 0x10);
|
||||
data_size = get_streamfile_size(sf) - start_offset;
|
||||
loop_flag = 0;
|
||||
|
||||
/* output sounds a bit funny, maybe not an actual stream but parts using the table */
|
||||
/* output sounds a bit funny, maybe not an actual stream but sections or models for reverb/etc,
|
||||
* data seems divided in chunks of 0x2000 */
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
|
@ -8,6 +8,8 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
|
||||
off_t subfile_offset, chunk_offset, bank_offset, offset;
|
||||
size_t subfile_size, bank_size;
|
||||
uint32_t version = 0;
|
||||
int fsb5_pos, fsb5_subsong;
|
||||
int total_subsongs, target_subsong = sf->stream_index;
|
||||
|
||||
|
||||
/* checks */
|
||||
@ -31,7 +33,7 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
|
||||
goto fail; /* event .fev has "OBCT" instead of "BNKI" (which can also be empty) */
|
||||
|
||||
|
||||
/* inside BNKI is a bunch of LIST each with event subchunks and somewhere the FSB5 offset */
|
||||
/* inside BNKI is a bunch of LISTs each with event subchunks and somewhere the FSB5 offsets */
|
||||
bank_offset = 0;
|
||||
offset = chunk_offset + 0x04;
|
||||
while (bank_offset == 0 && offset < get_streamfile_size(sf)) {
|
||||
@ -65,39 +67,48 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
|
||||
if (bank_offset == 0)
|
||||
goto fail;
|
||||
|
||||
/* 0x00: unknown (chunk version? ex LE: 0x00080003, 0x00080005) */
|
||||
{
|
||||
/* versions:
|
||||
* 0x28: Transistor (iOS) [+2015]
|
||||
* 0x50: Runic Rampage (PC), Forza 7 (PC), Shantae: Half Genie Hero (Switch) [+2017]
|
||||
* 0x58: Mana Spark (PC), Shantae and the Seven Sirens (PC) [+2018]
|
||||
* 0x63: Banner Saga 3 (PC) [+2018]
|
||||
* 0x64: Guacamelee! Super Turbo Championship Edition (Switch) [+2018]
|
||||
* 0x65: Carrion (Switch) [+2020]
|
||||
* 0x7D: Fall Guys (PC) [+2020] */
|
||||
/* known bank versions:
|
||||
* 0x28: Transistor (iOS) [~2015]
|
||||
* 0x50: Runic Rampage (PC), Forza 7 (PC), Shantae: Half Genie Hero (Switch) [~2017]
|
||||
* 0x58: Mana Spark (PC), Shantae and the Seven Sirens (PC) [~2018]
|
||||
* 0x63: Banner Saga 3 (PC) [~2018]
|
||||
* 0x64: Guacamelee! Super Turbo Championship Edition (Switch) [~2018]
|
||||
* 0x65: Carrion (Switch) [~2020]
|
||||
* 0x7D: Fall Guys (PC) [~2020]
|
||||
* 0x84: SCP Unity (PC) [~2020]
|
||||
* 0x86: Hades (Switch) [~2020] */
|
||||
size_t entry_size = version <= 0x28 ? 0x04 : 0x08;
|
||||
int banks;
|
||||
int i, banks;
|
||||
|
||||
/* multiple banks is possible but rare (only seen an extra "Silence" FSB5 in Guacamelee 2 (Switch),
|
||||
* which on PC is a regular subsong in the only FSB5) */
|
||||
/* 0x00: unknown (chunk version? ex LE: 0x00080003, 0x00080005) */
|
||||
banks = (bank_size - 0x04) / entry_size;
|
||||
VGM_ASSERT(banks > 1, "FSB5FEV: multiple banks found\n");
|
||||
|
||||
/* multiple banks is possible but rare [Hades (Switch), Guacamelee 2 (Switch)],
|
||||
* must map bank (global) subsong to FSB (internal) subsong */
|
||||
|
||||
/* Could try to set stream index based on FSB subsong ranges, also fixing num_streams and stream_index
|
||||
* kinda involved and hard to test so for now just ignore it and use first offset */
|
||||
if (target_subsong == 0) target_subsong = 1;
|
||||
|
||||
if (banks > 2)
|
||||
goto fail;
|
||||
if (banks == 2) {
|
||||
off_t temp_offset = read_u32le(bank_offset + 0x04 + entry_size*1 + 0x00,sf);
|
||||
//size_t temp_size = read_u32le(bank_offset + 0x04 + entry_size*1 + 0x04,sf);
|
||||
fsb5_pos = 0;
|
||||
fsb5_subsong = -1;
|
||||
total_subsongs = 0;
|
||||
for (i = 0; i < banks; i++) {
|
||||
off_t fsb5_offset = read_u32le(bank_offset + 0x04 + entry_size*i + 0x00,sf);
|
||||
int fsb5_subsongs = read_s32le(fsb5_offset + 0x08,sf);
|
||||
|
||||
int bank_subsongs = read_s32le(temp_offset + 0x08,sf);
|
||||
if (bank_subsongs != 1) goto fail;
|
||||
/* target in range */
|
||||
if (target_subsong >= total_subsongs + 1 && target_subsong < total_subsongs + 1 + fsb5_subsongs) {
|
||||
fsb5_pos = i;
|
||||
fsb5_subsong = target_subsong - total_subsongs;
|
||||
}
|
||||
|
||||
total_subsongs += fsb5_subsongs;
|
||||
}
|
||||
if (fsb5_subsong < 0)
|
||||
goto fail;
|
||||
|
||||
if (version <= 0x28) {
|
||||
subfile_offset = read_u32le(bank_offset+0x04,sf);
|
||||
subfile_offset = read_u32le(bank_offset+0x04 + entry_size*fsb5_pos,sf);
|
||||
subfile_size = /* meh */
|
||||
read_u32le(subfile_offset + 0x0C,sf) +
|
||||
read_u32le(subfile_offset + 0x10,sf) +
|
||||
@ -105,22 +116,24 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
|
||||
0x3C;
|
||||
}
|
||||
else {
|
||||
subfile_offset = read_u32le(bank_offset+0x04,sf);
|
||||
subfile_size = read_u32le(bank_offset+0x08,sf);
|
||||
subfile_offset = read_u32le(bank_offset+0x04 + entry_size*fsb5_pos,sf);
|
||||
subfile_size = read_u32le(bank_offset+0x08 + entry_size*fsb5_pos,sf);
|
||||
}
|
||||
}
|
||||
|
||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset,subfile_size, "fsb");
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
temp_sf->stream_index = fsb5_subsong; /* relative subsong, in case of multiple FSBs */
|
||||
|
||||
if (read_u32be(0x00, temp_sf) == 0x46534235) {
|
||||
vgmstream = init_vgmstream_fsb5(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
}
|
||||
else { //other flag?
|
||||
vgmstream = init_vgmstream_fsb_encrypted(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
}
|
||||
vgmstream = (read_u32be(0x00, temp_sf) == 0x46534235) ? /* "FSB5" (better flag?)*/
|
||||
init_vgmstream_fsb5(temp_sf) :
|
||||
init_vgmstream_fsb_encrypted(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->stream_index = sf->stream_index; //target_subsong; /* 0-index matters */
|
||||
vgmstream->num_streams = total_subsongs;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
|
@ -691,6 +691,7 @@ VGMSTREAM * init_vgmstream_xwc(STREAMFILE *streamFile);
|
||||
VGMSTREAM * init_vgmstream_atsl(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_sps_n1(STREAMFILE *streamFile);
|
||||
VGMSTREAM * init_vgmstream_sps_n1_segmented(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_atx(STREAMFILE *streamFile);
|
||||
|
||||
@ -727,8 +728,6 @@ VGMSTREAM * init_vgmstream_smc_smh(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ppst(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_opus_sps_n1_segmented(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ubi_bao_pk(STREAMFILE *streamFile);
|
||||
VGMSTREAM * init_vgmstream_ubi_bao_atomic(STREAMFILE *streamFile);
|
||||
|
||||
|
@ -1,93 +0,0 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../layout/layout.h"
|
||||
|
||||
/* Nippon Ichi SPS wrapper (segmented) [Penny-Punching Princess (Switch)] */
|
||||
VGMSTREAM * init_vgmstream_opus_sps_n1_segmented(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t segment_offset;
|
||||
int loop_flag, channel_count;
|
||||
int i;
|
||||
|
||||
segmented_layout_data *data = NULL;
|
||||
int segment_count, loop_start_segment = 0, loop_end_segment = 0;
|
||||
int num_samples = 0, loop_start_sample = 0, loop_end_sample = 0;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "at9"))
|
||||
goto fail;
|
||||
if (read_32bitBE(0x00,streamFile) != 0x09000000) /* file type (see other N1 SPS) */
|
||||
goto fail;
|
||||
if (read_32bitLE(0x04,streamFile) + 0x1c != get_streamfile_size(streamFile))
|
||||
goto fail;
|
||||
/* 0x08(2): sample rate, 0x0a(2): flag?, 0x0c: num_samples (slightly smaller than added samples) */
|
||||
|
||||
segment_count = 3; /* intro/loop/end */
|
||||
loop_start_segment = 1;
|
||||
loop_end_segment = 1;
|
||||
loop_flag = (segment_count > 0);
|
||||
|
||||
/* init layout */
|
||||
data = init_layout_segmented(segment_count);
|
||||
if (!data) goto fail;
|
||||
|
||||
/* open each segment subfile */
|
||||
segment_offset = 0x1c;
|
||||
for (i = 0; i < segment_count; i++) {
|
||||
STREAMFILE* temp_streamFile;
|
||||
size_t segment_size = read_32bitLE(0x10+0x04*i,streamFile);
|
||||
|
||||
if (!segment_size)
|
||||
goto fail;
|
||||
|
||||
temp_streamFile = setup_subfile_streamfile(streamFile, segment_offset,segment_size, "opus");
|
||||
if (!temp_streamFile) goto fail;
|
||||
|
||||
data->segments[i] = init_vgmstream_opus_std(temp_streamFile);
|
||||
close_streamfile(temp_streamFile);
|
||||
if (!data->segments[i]) goto fail;
|
||||
|
||||
segment_offset += segment_size;
|
||||
|
||||
//todo there are some trailing samples that must be removed for smooth loops, start skip seems ok
|
||||
data->segments[i]->num_samples -= 374; //not correct for all files, no idea how to calculate
|
||||
|
||||
/* get looping and samples */
|
||||
if (loop_flag && loop_start_segment == i)
|
||||
loop_start_sample = num_samples;
|
||||
|
||||
num_samples += data->segments[i]->num_samples;
|
||||
|
||||
if (loop_flag && loop_end_segment == i)
|
||||
loop_end_sample = num_samples;
|
||||
}
|
||||
|
||||
/* setup segmented VGMSTREAMs */
|
||||
if (!setup_layout_segmented(data))
|
||||
goto fail;
|
||||
|
||||
|
||||
channel_count = data->segments[0]->channels;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = (uint16_t)read_16bitLE(0x08,streamFile);
|
||||
vgmstream->num_samples = num_samples;
|
||||
vgmstream->loop_start_sample = loop_start_sample;
|
||||
vgmstream->loop_end_sample = loop_end_sample;
|
||||
|
||||
vgmstream->meta_type = meta_OPUS_PPP;
|
||||
vgmstream->coding_type = data->segments[0]->coding_type;
|
||||
vgmstream->layout_type = layout_segmented;
|
||||
vgmstream->layout_data = data;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
free_layout_segmented(data);
|
||||
return NULL;
|
||||
}
|
@ -1,54 +1,177 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* .SPS - Nippon Ichi wrapper [ClaDun (PSP)] */
|
||||
VGMSTREAM * init_vgmstream_sps_n1(STREAMFILE *streamFile) {
|
||||
VGMSTREAM *vgmstream = NULL;
|
||||
STREAMFILE *temp_streamFile = NULL;
|
||||
int type, sample_rate;
|
||||
off_t subfile_offset;
|
||||
size_t subfile_size;
|
||||
|
||||
/* check extensions */
|
||||
if ( !check_extensions(streamFile,"sps"))
|
||||
goto fail;
|
||||
|
||||
/* mini header */
|
||||
type = read_32bitLE(0x00,streamFile);
|
||||
subfile_size = read_32bitLE(0x04,streamFile);
|
||||
sample_rate = (uint16_t)read_16bitLE(0x08,streamFile);
|
||||
/* 0x0a: flag? */
|
||||
//num_samples = read_32bitLE(0x0c,streamFile);
|
||||
subfile_offset = 0x10;
|
||||
|
||||
/* init the VGMSTREAM */
|
||||
switch(type) {
|
||||
case 1: /* .vag */
|
||||
temp_streamFile = setup_subfile_streamfile(streamFile, subfile_offset, subfile_size, "vag");
|
||||
if (!temp_streamFile) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_vag(temp_streamFile);
|
||||
if (!vgmstream) goto fail;
|
||||
break;
|
||||
|
||||
case 2: /* .at3 */
|
||||
temp_streamFile = setup_subfile_streamfile(streamFile, subfile_offset, subfile_size, "at3");
|
||||
if (!temp_streamFile) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_riff(temp_streamFile);
|
||||
if (!vgmstream) goto fail;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vgmstream->sample_rate = sample_rate; /* .vag header doesn't match */
|
||||
|
||||
close_streamfile(temp_streamFile);
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_streamFile);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* also see init_vgmstream_dsp_sps_n1 and init_vgmstream_opus_sps_n1 */
|
||||
|
||||
/* Nippon Ichi SPS wrapper [ClaDun (PSP)] */
|
||||
VGMSTREAM* init_vgmstream_sps_n1(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* temp_sf = NULL;
|
||||
int type, sample_rate;
|
||||
off_t subfile_offset;
|
||||
size_t subfile_size;
|
||||
|
||||
VGMSTREAM* (*init_vgmstream_subfile)(STREAMFILE*) = NULL;
|
||||
const char* extension;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(sf,"sps"))
|
||||
goto fail;
|
||||
|
||||
type = read_u32le(0x00,sf);
|
||||
subfile_size = read_u32le(0x04,sf);
|
||||
sample_rate = read_u16le(0x08,sf);
|
||||
/* 0x0a: flag? (stereo?) */
|
||||
/* 0x0b: flag? */
|
||||
/* 0x0c: num_samples */
|
||||
|
||||
switch(type) {
|
||||
case 1:
|
||||
init_vgmstream_subfile = init_vgmstream_vag;
|
||||
extension = "vag";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
init_vgmstream_subfile = init_vgmstream_riff;
|
||||
extension = "at3";
|
||||
break;
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
subfile_offset = 0x10;
|
||||
if (subfile_size + subfile_offset != get_streamfile_size(sf))
|
||||
goto fail;
|
||||
|
||||
/* init the VGMSTREAM */
|
||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, extension);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_subfile(temp_sf);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = sample_rate; /* .vag header doesn't match */
|
||||
|
||||
close_streamfile(temp_sf);
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_sf);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Nippon Ichi SPS wrapper (segmented) [Penny-Punching Princess (Switch), Disgaea 4 Complete (PC)] */
|
||||
VGMSTREAM* init_vgmstream_sps_n1_segmented(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
off_t segment_offset;
|
||||
size_t data_size, max_size;
|
||||
int loop_flag, type, sample_rate;
|
||||
int i, segment;
|
||||
|
||||
VGMSTREAM* (*init_vgmstream_subfile)(STREAMFILE*) = NULL;
|
||||
const char* extension;
|
||||
segmented_layout_data* data = NULL;
|
||||
int segment_count, loop_start_segment, loop_end_segment;
|
||||
|
||||
|
||||
/* checks */
|
||||
/* .at9: Penny-Punching Princess (Switch)
|
||||
* .nlsd: Disgaea 4 Complete (PC) */
|
||||
if (!check_extensions(sf, "at9,nlsd"))
|
||||
goto fail;
|
||||
|
||||
type = read_u32le(0x00,sf);
|
||||
data_size = read_u32le(0x04,sf);
|
||||
sample_rate = read_u16le(0x08,sf);
|
||||
/* 0x0a: flag? (stereo?) */
|
||||
/* 0x0b: flag? */
|
||||
/* 0x0c: num_samples (slightly smaller than added samples?) */
|
||||
|
||||
switch(type) {
|
||||
case 7:
|
||||
init_vgmstream_subfile = init_vgmstream_ogg_vorbis;
|
||||
extension = "ogg";
|
||||
break;
|
||||
|
||||
case 9:
|
||||
init_vgmstream_subfile = init_vgmstream_opus_std;
|
||||
extension = "opus";
|
||||
break;
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
segment_offset = 0x1c;
|
||||
if (data_size + segment_offset != get_streamfile_size(sf))
|
||||
goto fail;
|
||||
|
||||
/* segmented using 3 files (intro/loop/outro). non-segmented wrapper is the same
|
||||
* but with loop samples instead of sub-sizes */
|
||||
max_size = 0;
|
||||
segment_count = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
size_t segment_size = read_u32le(0x10 + 0x04*i,sf);
|
||||
max_size += segment_size;
|
||||
/* may only set 1 segment (Disgaea4's bgm_185) */
|
||||
if (segment_size)
|
||||
segment_count++;
|
||||
}
|
||||
if (data_size != max_size)
|
||||
goto fail;
|
||||
|
||||
loop_flag = segment_count > 1; /* intro+loop section must exit */
|
||||
loop_start_segment = 1;
|
||||
loop_end_segment = 1;
|
||||
|
||||
/* init layout */
|
||||
data = init_layout_segmented(segment_count);
|
||||
if (!data) goto fail;
|
||||
|
||||
/* open each segment subfile */
|
||||
segment = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
STREAMFILE* temp_sf;
|
||||
size_t segment_size = read_u32le(0x10 + 0x04*i,sf);
|
||||
|
||||
if (!segment_size)
|
||||
continue;
|
||||
|
||||
temp_sf = setup_subfile_streamfile(sf, segment_offset,segment_size, extension);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
data->segments[segment] = init_vgmstream_subfile(temp_sf);
|
||||
close_streamfile(temp_sf);
|
||||
if (!data->segments[segment]) goto fail;
|
||||
|
||||
segment_offset += segment_size;
|
||||
segment++;
|
||||
|
||||
if (type == 9) {
|
||||
//todo there are some trailing samples that must be removed for smooth loops, start skip seems ok
|
||||
//not correct for all files, no idea how to calculate
|
||||
data->segments[segment]->num_samples -= 374;
|
||||
}
|
||||
}
|
||||
|
||||
/* setup segmented VGMSTREAMs */
|
||||
if (!setup_layout_segmented(data))
|
||||
goto fail;
|
||||
|
||||
vgmstream = allocate_segmented_vgmstream(data, loop_flag, loop_start_segment, loop_end_segment);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->meta_type = meta_SPS_N1;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
free_layout_segmented(data);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ VGMSTREAM* init_vgmstream_xwav_new(STREAMFILE* sf) {
|
||||
switch(codec) {
|
||||
case 2: /* No Nore Heroes (PS3) */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = channels == 6 ? layout_blocked_vawx : layout_interleave;
|
||||
vgmstream->layout_type = channels == 6 ? layout_blocked_xwav : layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
|
||||
vgmstream->loop_start_sample = loop_start;
|
@ -294,7 +294,7 @@ static int render_layout(sample_t* buf, int32_t sample_count, VGMSTREAM* vgmstre
|
||||
case layout_blocked_ea_sns:
|
||||
case layout_blocked_awc:
|
||||
case layout_blocked_vgs:
|
||||
case layout_blocked_vawx:
|
||||
case layout_blocked_xwav:
|
||||
case layout_blocked_xvag_subsong:
|
||||
case layout_blocked_ea_wve_au00:
|
||||
case layout_blocked_ea_wve_ad10:
|
||||
|
@ -393,7 +393,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
||||
init_vgmstream_txtp,
|
||||
init_vgmstream_smc_smh,
|
||||
init_vgmstream_ppst,
|
||||
init_vgmstream_opus_sps_n1_segmented,
|
||||
init_vgmstream_sps_n1_segmented,
|
||||
init_vgmstream_ubi_bao_pk,
|
||||
init_vgmstream_ubi_bao_atomic,
|
||||
init_vgmstream_dsp_switch_audio,
|
||||
|
@ -271,7 +271,7 @@ typedef enum {
|
||||
layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
|
||||
layout_blocked_awc, /* Rockstar AWC */
|
||||
layout_blocked_vgs, /* Guitar Hero II (PS2) */
|
||||
layout_blocked_vawx, /* No More Heroes 6ch (PS3) */
|
||||
layout_blocked_xwav,
|
||||
layout_blocked_xvag_subsong, /* XVAG subsongs [God of War III (PS4)] */
|
||||
layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */
|
||||
layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */
|
||||
@ -656,7 +656,7 @@ typedef enum {
|
||||
meta_TXTP, /* generic text playlist */
|
||||
meta_SMC_SMH, /* Wangan Midnight (System 246) */
|
||||
meta_PPST, /* PPST [Parappa the Rapper (PSP)] */
|
||||
meta_OPUS_PPP, /* .at9 Opus [Penny-Punching Princess (Switch)] */
|
||||
meta_SPS_N1,
|
||||
meta_UBI_BAO, /* Ubisoft BAO */
|
||||
meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */
|
||||
meta_TA_AAC_VITA, /* tri-Ace AAC (Judas Code) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user