diff --git a/cli/tools/txtp_maker.py b/cli/tools/txtp_maker.py index 4f0345bc..1ac558cf 100644 --- a/cli/tools/txtp_maker.py +++ b/cli/tools/txtp_maker.py @@ -552,7 +552,7 @@ class App(object): if not maker.has_more_subsongs(target_subsong): break - if target_subsong >= subsong_end: + if subsong_end and target_subsong >= subsong_end: break target_subsong += 1 diff --git a/msvc-build.ps1 b/msvc-build.ps1 index cfe5914c..40fff8c9 100644 --- a/msvc-build.ps1 +++ b/msvc-build.ps1 @@ -176,6 +176,8 @@ function Clean Remove-Item -Path "Release" -Recurse -ErrorAction Ignore Remove-Item -Path "bin" -Recurse -ErrorAction Ignore Remove-Item -Path "tmp" -Recurse -ErrorAction Ignore + + Remove-Item "msvc-build.log" -ErrorAction Ignore } $fb2kFiles = @( @@ -207,7 +209,7 @@ $cliPdbFiles = @( "$configuration/xmp-vgmstream.pdb" ) -function Package +function MakePackage { Build @@ -229,9 +231,9 @@ function Package # for github actions/artifact uploads, that use a dir with files -function PackageTmp +function MakePackageTmp { - Package + MakePackage md -Force tmp/cli md -Force tmp/fb2k @@ -251,6 +253,6 @@ switch ($Task) "Build" { Build } "Rebuild" { Rebuild } "Clean" { Clean } - "Package" { Package } - "PackageTmp" { PackageTmp } + "Package" { MakePackage } + "PackageTmp" { MakePackageTmp } } diff --git a/src/coding/coding.h b/src/coding/coding.h index d586264a..3d05f987 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -680,7 +680,7 @@ size_t atrac3plus_bytes_to_samples(size_t bytes, int full_block_align); size_t ac3_bytes_to_samples(size_t bytes, int full_block_align, int channels); size_t aac_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes); size_t mpeg_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes); -int32_t mpeg_get_samples_clean(STREAMFILE* sf, off_t start, size_t size, size_t* p_loop_start, size_t* p_loop_end, int is_vbr); +int32_t mpeg_get_samples_clean(STREAMFILE* sf, off_t start, size_t size, uint32_t* p_loop_start, uint32_t* p_loop_end, int is_vbr); int mpc_get_samples(STREAMFILE* sf, off_t offset, int32_t* p_samples, int32_t* p_delay); diff --git a/src/coding/mpeg_custom_utils.c b/src/coding/mpeg_custom_utils.c index 82abed46..f3cb4508 100644 --- a/src/coding/mpeg_custom_utils.c +++ b/src/coding/mpeg_custom_utils.c @@ -451,7 +451,7 @@ size_t mpeg_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes) { /* variation of the above, for clean streams = no ID3/VBR headers * (maybe should be fused in a single thing with config, API is kinda messy too) */ -int32_t mpeg_get_samples_clean(STREAMFILE *sf, off_t start, size_t size, size_t* p_loop_start, size_t* p_loop_end, int is_vbr) { +int32_t mpeg_get_samples_clean(STREAMFILE* sf, off_t start, size_t size, uint32_t* p_loop_start, uint32_t* p_loop_end, int is_vbr) { mpeg_frame_info info; off_t offset = start; int32_t num_samples = 0, loop_start = 0, loop_end = 0; diff --git a/src/meta/fsb5.c b/src/meta/fsb5.c index 24c9b801..e9195013 100644 --- a/src/meta/fsb5.c +++ b/src/meta/fsb5.c @@ -18,10 +18,10 @@ typedef struct { int32_t loop_end; int loop_flag; - size_t sample_header_size; - size_t name_table_size; - size_t sample_data_size; - size_t base_header_size; + uint32_t sample_header_size; + uint32_t name_table_size; + uint32_t sample_data_size; + uint32_t base_header_size; uint32_t extradata_offset; uint32_t extradata_size; @@ -46,15 +46,15 @@ VGMSTREAM* init_vgmstream_fsb5(STREAMFILE* sf) { /* checks */ + if (!is_id32be(0x00,sf, "FSB5")) + goto fail; + /* .fsb: standard * .snd: Alchemy engine (also Unity) */ if (!check_extensions(sf,"fsb,snd")) goto fail; - if (!is_id32be(0x00,sf, "FSB5")) - goto fail; - - /* v0 is rare (seen in Tales from Space Vita) */ + /* v0 is rare, seen in Tales from Space (Vita) */ fsb5.version = read_u32le(0x04,sf); if (fsb5.version != 0x00 && fsb5.version != 0x01) goto fail; @@ -80,7 +80,7 @@ VGMSTREAM* init_vgmstream_fsb5(STREAMFILE* sf) { } if ((fsb5.sample_header_size + fsb5.name_table_size + fsb5.sample_data_size + fsb5.base_header_size) != get_streamfile_size(sf)) { - vgm_logi("FSB5: wrong size, expected %x + %x + %x + %x vs %x (re-rip)\n", fsb5.sample_header_size, fsb5.name_table_size, fsb5.sample_data_size, fsb5.base_header_size, get_streamfile_size(sf)); + vgm_logi("FSB5: wrong size, expected %x + %x + %x + %x vs %x (re-rip)\n", fsb5.sample_header_size, fsb5.name_table_size, fsb5.sample_data_size, fsb5.base_header_size, (uint32_t)get_streamfile_size(sf)); goto fail; } diff --git a/src/meta/wwise.c b/src/meta/wwise.c index efa6f8c4..d74523a6 100644 --- a/src/meta/wwise.c +++ b/src/meta/wwise.c @@ -56,15 +56,19 @@ typedef struct { static int parse_wwise(STREAMFILE* sf, wwise_header* ww); static int is_dsp_full_interleave(STREAMFILE* sf, wwise_header* ww, off_t coef_offset); +typedef uint32_t (*read_u32_t)(off_t, STREAMFILE*); +typedef int32_t (*read_s32_t)(off_t, STREAMFILE*); +typedef uint16_t (*read_u16_t)(off_t, STREAMFILE*); + /* Wwise - Audiokinetic Wwise (WaveWorks Interactive Sound Engine) middleware */ VGMSTREAM* init_vgmstream_wwise(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; wwise_header ww = {0}; off_t start_offset; - uint32_t (*read_u32)(off_t,STREAMFILE*) = NULL; - int32_t (*read_s32)(off_t,STREAMFILE*) = NULL; - uint16_t (*read_u16)(off_t,STREAMFILE*) = NULL; + read_u32_t read_u32 = NULL; + read_s32_t read_s32 = NULL; + read_u16_t read_u16 = NULL; /* checks */ @@ -99,6 +103,7 @@ VGMSTREAM* init_vgmstream_wwise(STREAMFILE* sf) { vgmstream->loop_start_sample = ww.loop_start_sample; vgmstream->loop_end_sample = ww.loop_end_sample; vgmstream->channel_layout = ww.channel_layout; + vgmstream->stream_size = ww.data_size; switch(ww.codec) { case PCM: /* common */ @@ -696,11 +701,12 @@ static int is_dsp_full_interleave(STREAMFILE* sf, wwise_header* ww, off_t coef_o static int parse_wwise(STREAMFILE* sf, wwise_header* ww) { - uint32_t (*read_u32)(off_t,STREAMFILE*) = NULL; - uint16_t (*read_u16)(off_t,STREAMFILE*) = NULL; + read_u32_t read_u32; + read_u16_t read_u16; - ww->big_endian = is_id32be(0x00,sf, "RIFX"); - if (ww->big_endian) { /* Wwise honors machine's endianness (PC=RIFF, X360=RIFX --unlike XMA) */ + /* Wwise honors machine's endianness (PC=RIFF, X360=RIFX --unlike XMA) */ + ww->big_endian = is_id32be(0x00,sf, "RIFX"); /* RIFF size not useful to detect, see below */ + if (ww->big_endian) { read_u32 = read_u32be; read_u16 = read_u16be; } else {