This commit is contained in:
bnnm 2022-05-01 20:34:58 +02:00
parent 61e82459b2
commit f4fe1482c9
8 changed files with 49 additions and 46 deletions

View File

@ -110,7 +110,6 @@
<ClInclude Include="meta\bar_streamfile.h" /> <ClInclude Include="meta\bar_streamfile.h" />
<ClInclude Include="meta\bgw_streamfile.h" /> <ClInclude Include="meta\bgw_streamfile.h" />
<ClInclude Include="meta\bnsf_keys.h" /> <ClInclude Include="meta\bnsf_keys.h" />
<ClInclude Include="meta\cri_utf.h" />
<ClInclude Include="meta\deblock_streamfile.h" /> <ClInclude Include="meta\deblock_streamfile.h" />
<ClInclude Include="meta\ea_eaac_streamfile.h" /> <ClInclude Include="meta\ea_eaac_streamfile.h" />
<ClInclude Include="meta\ea_eaac_opus_streamfile.h" /> <ClInclude Include="meta\ea_eaac_opus_streamfile.h" />
@ -172,6 +171,7 @@
<ClInclude Include="coding\tac_decoder_lib_ops.h" /> <ClInclude Include="coding\tac_decoder_lib_ops.h" />
<ClInclude Include="layout\layout.h" /> <ClInclude Include="layout\layout.h" />
<ClInclude Include="util\chunks.h" /> <ClInclude Include="util\chunks.h" />
<ClInclude Include="util\cri_utf.h" />
<ClInclude Include="util\endianness.h" /> <ClInclude Include="util\endianness.h" />
<ClInclude Include="util\log.h" /> <ClInclude Include="util\log.h" />
<ClInclude Include="util\m2_psb.h" /> <ClInclude Include="util\m2_psb.h" />
@ -340,7 +340,6 @@
<ClCompile Include="meta\ck.c" /> <ClCompile Include="meta\ck.c" />
<ClCompile Include="meta\compresswave.c" /> <ClCompile Include="meta\compresswave.c" />
<ClCompile Include="meta\cpk.c" /> <ClCompile Include="meta\cpk.c" />
<ClCompile Include="meta\cri_utf.c" />
<ClCompile Include="meta\csb.c" /> <ClCompile Include="meta\csb.c" />
<ClCompile Include="meta\csmp.c" /> <ClCompile Include="meta\csmp.c" />
<ClCompile Include="meta\cstr.c" /> <ClCompile Include="meta\cstr.c" />
@ -731,6 +730,7 @@
<ClCompile Include="layout\blocked_xa_aiff.c" /> <ClCompile Include="layout\blocked_xa_aiff.c" />
<ClCompile Include="layout\blocked_xvas.c" /> <ClCompile Include="layout\blocked_xvas.c" />
<ClCompile Include="util\chunks.c" /> <ClCompile Include="util\chunks.c" />
<ClCompile Include="util\cri_utf.c" />
<ClCompile Include="util\log.c" /> <ClCompile Include="util\log.c" />
<ClCompile Include="util\m2_psb.c" /> <ClCompile Include="util\m2_psb.c" />
<ClCompile Include="util\text_reader.c" /> <ClCompile Include="util\text_reader.c" />

View File

@ -95,9 +95,6 @@
<ClInclude Include="meta\bnsf_keys.h"> <ClInclude Include="meta\bnsf_keys.h">
<Filter>meta\Header Files</Filter> <Filter>meta\Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="meta\cri_utf.h">
<Filter>meta\Header Files</Filter>
</ClInclude>
<ClInclude Include="meta\deblock_streamfile.h"> <ClInclude Include="meta\deblock_streamfile.h">
<Filter>meta\Header Files</Filter> <Filter>meta\Header Files</Filter>
</ClInclude> </ClInclude>
@ -314,6 +311,9 @@
<ClInclude Include="util\chunks.h"> <ClInclude Include="util\chunks.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="util\cri_utf.h">
<Filter>meta\Header Files</Filter>
</ClInclude>
<ClInclude Include="util\endianness.h"> <ClInclude Include="util\endianness.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -490,9 +490,6 @@
<ClCompile Include="meta\cpk.c"> <ClCompile Include="meta\cpk.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\cri_utf.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\csb.c"> <ClCompile Include="meta\csb.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
@ -1975,6 +1972,9 @@
<ClCompile Include="util\chunks.c"> <ClCompile Include="util\chunks.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="util\cri_utf.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="util\log.c"> <ClCompile Include="util\log.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -1,31 +1,32 @@
#include "meta.h" #include "meta.h"
#include "../layout/layout.h" #include "../layout/layout.h"
#include "../coding/coding.h" #include "../coding/coding.h"
#include "cri_utf.h" #include "../util/cri_utf.h"
#define MAX_SEGMENTS 2 /* usually segment0=intro, segment1=loop/main */ #define MAX_SEGMENTS 2 /* usually segment0=intro, segment1=loop/main */
/* AAX - segmented ADX [Bayonetta (PS3), Pandora's Tower (Wii), Catherine (X360), Binary Domain (PS3)] */ /* AAX - segmented ADX [Bayonetta (PS3), Pandora's Tower (Wii), Catherine (X360), Binary Domain (PS3)] */
VGMSTREAM * init_vgmstream_aax(STREAMFILE *streamFile) { VGMSTREAM* init_vgmstream_aax(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
int loop_flag = 0, channel_count = 0; int loop_flag = 0, channels = 0;
int32_t sample_count, loop_start_sample = 0, loop_end_sample = 0; int32_t sample_count, loop_start_sample = 0, loop_end_sample = 0;
segmented_layout_data *data = NULL; segmented_layout_data* data = NULL;
int segment_count, loop_segment = 0, is_hca; int segment_count, loop_segment = 0, is_hca;
off_t segment_offset[MAX_SEGMENTS]; off_t segment_offset[MAX_SEGMENTS];
size_t segment_size[MAX_SEGMENTS]; size_t segment_size[MAX_SEGMENTS];
int i; int i;
utf_context *utf = NULL; utf_context* utf = NULL;
/* checks */ /* checks */
if (!is_id32be(0x00,sf, "@UTF"))
goto fail;
/* .aax: often with extension (with either HCA or AAX tables) /* .aax: often with extension (with either HCA or AAX tables)
* (extensionless): sometimes without [PES 2013 (PC)] */ * (extensionless): sometimes without [PES 2013 (PC)] */
if (!check_extensions(streamFile, "aax,")) if (!check_extensions(sf, "aax,"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x40555446) /* "@UTF" */
goto fail; goto fail;
/* .aax contains a simple UTF table, each row being a segment pointing to a CRI audio format */ /* .aax contains a simple UTF table, each row being a segment pointing to a CRI audio format */
@ -35,7 +36,7 @@ VGMSTREAM * init_vgmstream_aax(STREAMFILE *streamFile) {
uint32_t table_offset = 0x00; uint32_t table_offset = 0x00;
utf = utf_open(streamFile, table_offset, &rows, &name); utf = utf_open(sf, table_offset, &rows, &name);
if (!utf) goto fail; if (!utf) goto fail;
if (strcmp(name, "AAX") == 0) if (strcmp(name, "AAX") == 0)
@ -74,7 +75,7 @@ VGMSTREAM * init_vgmstream_aax(STREAMFILE *streamFile) {
/* open each segment subfile */ /* open each segment subfile */
for (i = 0; i < segment_count; i++) { for (i = 0; i < segment_count; i++) {
STREAMFILE* temp_sf = setup_subfile_streamfile(streamFile, segment_offset[i],segment_size[i], (is_hca ? "hca" : "adx")); STREAMFILE* temp_sf = setup_subfile_streamfile(sf, segment_offset[i],segment_size[i], (is_hca ? "hca" : "adx"));
if (!temp_sf) goto fail; if (!temp_sf) goto fail;
data->segments[i] = is_hca ? data->segments[i] = is_hca ?
@ -105,11 +106,11 @@ VGMSTREAM * init_vgmstream_aax(STREAMFILE *streamFile) {
} }
} }
channel_count = data->output_channels; channels = data->output_channels;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channels,loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
vgmstream->sample_rate = data->segments[0]->sample_rate; vgmstream->sample_rate = data->segments[0]->sample_rate;
@ -135,21 +136,22 @@ fail:
/* CRI's UTF wrapper around DSP [Sonic Colors sfx (Wii), NiGHTS: Journey of Dreams sfx (Wii)] */ /* CRI's UTF wrapper around DSP [Sonic Colors sfx (Wii), NiGHTS: Journey of Dreams sfx (Wii)] */
VGMSTREAM * init_vgmstream_utf_dsp(STREAMFILE *streamFile) { VGMSTREAM* init_vgmstream_utf_dsp(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
off_t start_offset; off_t start_offset;
uint8_t loop_flag = 0, channel_count; uint8_t loop_flag = 0, channels;
uint32_t sample_rate, num_samples, loop_start, loop_end, interleave; uint32_t sample_rate, num_samples, loop_start, loop_end, interleave;
uint32_t data_offset, data_size, header_offset, header_size; uint32_t data_offset, data_size, header_offset, header_size;
utf_context *utf = NULL; utf_context* utf = NULL;
/* checks */ /* checks */
if (!is_id32be(0x00,sf, "@UTF"))
goto fail;
/* .aax: assumed /* .aax: assumed
* (extensionless): extracted names inside csb/cpk often don't have extensions */ * (extensionless): extracted names inside csb/cpk often don't have extensions */
if (!check_extensions(streamFile, "aax,")) if (!check_extensions(sf, "aax,"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x40555446) /* "@UTF" */
goto fail; goto fail;
/* .aax contains a simple UTF table with one row and various columns being header info */ /* .aax contains a simple UTF table with one row and various columns being header info */
@ -159,7 +161,7 @@ VGMSTREAM * init_vgmstream_utf_dsp(STREAMFILE *streamFile) {
uint32_t table_offset = 0x00; uint32_t table_offset = 0x00;
utf = utf_open(streamFile, table_offset, &rows, &name); utf = utf_open(sf, table_offset, &rows, &name);
if (!utf) goto fail; if (!utf) goto fail;
if (strcmp(name, "ADPCM_WII") != 0) if (strcmp(name, "ADPCM_WII") != 0)
@ -172,7 +174,7 @@ VGMSTREAM * init_vgmstream_utf_dsp(STREAMFILE *streamFile) {
goto fail; goto fail;
if (!utf_query_u32(utf, 0, "nsmpl", &num_samples)) if (!utf_query_u32(utf, 0, "nsmpl", &num_samples))
goto fail; goto fail;
if (!utf_query_u8(utf, 0, "nch", &channel_count)) if (!utf_query_u8(utf, 0, "nch", &channels))
goto fail; goto fail;
if (!utf_query_u8(utf, 0, "lpflg", &loop_flag)) /* full loops */ if (!utf_query_u8(utf, 0, "lpflg", &loop_flag)) /* full loops */
goto fail; goto fail;
@ -182,21 +184,21 @@ VGMSTREAM * init_vgmstream_utf_dsp(STREAMFILE *streamFile) {
if (!utf_query_data(utf, 0, "header", &header_offset, &header_size)) if (!utf_query_data(utf, 0, "header", &header_offset, &header_size))
goto fail; goto fail;
if (channel_count < 1 || channel_count > 2) if (channels < 1 || channels > 2)
goto fail; goto fail;
if (header_size != channel_count * 0x60) if (header_size != channels * 0x60)
goto fail; goto fail;
start_offset = data_offset; start_offset = data_offset;
interleave = (data_size+7) / 8 * 8 / channel_count; interleave = (data_size+7) / 8 * 8 / channels;
loop_start = read_32bitBE(header_offset + 0x10, streamFile); loop_start = read_32bitBE(header_offset + 0x10, sf);
loop_end = read_32bitBE(header_offset + 0x14, streamFile); loop_end = read_32bitBE(header_offset + 0x14, sf);
} }
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag); vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
vgmstream->sample_rate = sample_rate; vgmstream->sample_rate = sample_rate;
@ -209,9 +211,9 @@ VGMSTREAM * init_vgmstream_utf_dsp(STREAMFILE *streamFile) {
vgmstream->interleave_block_size = interleave; vgmstream->interleave_block_size = interleave;
vgmstream->meta_type = meta_UTF_DSP; vgmstream->meta_type = meta_UTF_DSP;
dsp_read_coefs_be(vgmstream, streamFile, header_offset+0x1c, 0x60); dsp_read_coefs_be(vgmstream, sf, header_offset+0x1c, 0x60);
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset)) if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail; goto fail;
return vgmstream; return vgmstream;

View File

@ -1,6 +1,6 @@
#include "meta.h" #include "meta.h"
#include "../coding/coding.h" #include "../coding/coding.h"
#include "cri_utf.h" #include "../util/cri_utf.h"
/* ACB (Atom Cue sheet Binary) - CRI container of memory audio, often together with a .awb wave bank */ /* ACB (Atom Cue sheet Binary) - CRI container of memory audio, often together with a .awb wave bank */

View File

@ -1,6 +1,6 @@
#include "meta.h" #include "meta.h"
#include "../coding/coding.h" #include "../coding/coding.h"
#include "cri_utf.h" #include "../util/cri_utf.h"
typedef enum { HCA, CWAV, ADX } cpk_type_t; typedef enum { HCA, CWAV, ADX } cpk_type_t;
@ -26,10 +26,11 @@ VGMSTREAM* init_vgmstream_cpk_memory(STREAMFILE* sf, STREAMFILE* sf_acb) {
/* checks */ /* checks */
if (!check_extensions(sf, "awb"))
goto fail;
if (!is_id32be(0x00,sf, "CPK ")) if (!is_id32be(0x00,sf, "CPK "))
goto fail; goto fail;
if (!check_extensions(sf, "awb"))
goto fail;
if (!is_id32be(0x10,sf, "@UTF")) if (!is_id32be(0x10,sf, "@UTF"))
goto fail; goto fail;
/* 04: 0xFF? */ /* 04: 0xFF? */

View File

@ -1,6 +1,6 @@
#include "meta.h" #include "meta.h"
#include "../coding/coding.h" #include "../coding/coding.h"
#include "cri_utf.h" #include "../util/cri_utf.h"
/* CSB (Cue Sheet Binary?) - CRI container of memory audio, often together with a .cpk wave bank */ /* CSB (Cue Sheet Binary?) - CRI container of memory audio, often together with a .cpk wave bank */
@ -9,8 +9,8 @@ VGMSTREAM* init_vgmstream_csb(STREAMFILE* sf) {
STREAMFILE* temp_sf = NULL; STREAMFILE* temp_sf = NULL;
off_t subfile_offset; off_t subfile_offset;
size_t subfile_size; size_t subfile_size;
utf_context *utf = NULL; utf_context* utf = NULL;
utf_context *utf_sdl = NULL; utf_context* utf_sdl = NULL;
int total_subsongs, target_subsong = sf->stream_index; int total_subsongs, target_subsong = sf->stream_index;
uint8_t fmt = 0; uint8_t fmt = 0;
const char* stream_name = NULL; const char* stream_name = NULL;

View File

@ -1,5 +1,5 @@
#include "cri_utf.h" #include "cri_utf.h"
#include "../util/log.h" #include "log.h"
#define UTF_MAX_SCHEMA_SIZE 0x8000 /* arbitrary max */ #define UTF_MAX_SCHEMA_SIZE 0x8000 /* arbitrary max */
#define COLUMN_BITMASK_FLAG 0xf0 #define COLUMN_BITMASK_FLAG 0xf0