From 8e39b511eb9a4f4ae45659ef1fcdf1b66158cb72 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 21 Jan 2023 20:36:19 +0100 Subject: [PATCH] cleanup: renames, etc --- src/coding/ffmpeg_decoder.c | 6 ++- src/formats.c | 6 +-- src/libvgmstream.vcxproj | 10 ++-- src/libvgmstream.vcxproj.filters | 30 +++++------ src/meta/{ta_aac.c => aac_triace.c} | 4 +- src/meta/cps.c | 50 ++++++++++++++++++ src/meta/cxs.c | 3 +- src/meta/meta.h | 10 ++-- src/meta/ps3_cps.c | 74 --------------------------- src/meta/{xse.c => sdrh.c} | 10 ++-- src/meta/xwav.c | 4 +- src/meta/{xmv_valve.c => xwv_valve.c} | 4 +- src/vgmstream.c | 10 ++-- src/vgmstream.h | 6 +-- 14 files changed, 98 insertions(+), 129 deletions(-) rename src/meta/{ta_aac.c => aac_triace.c} (99%) create mode 100644 src/meta/cps.c delete mode 100644 src/meta/ps3_cps.c rename src/meta/{xse.c => sdrh.c} (97%) rename src/meta/{xmv_valve.c => xwv_valve.c} (98%) diff --git a/src/coding/ffmpeg_decoder.c b/src/coding/ffmpeg_decoder.c index 9b0e50c6..35d013de 100644 --- a/src/coding/ffmpeg_decoder.c +++ b/src/coding/ffmpeg_decoder.c @@ -389,7 +389,8 @@ ffmpeg_codec_data* init_ffmpeg_header_offset_subsong(STREAMFILE* sf, uint8_t* he if (data->skip_samples < 0) data->skip_samples = 0; -#if 0 //LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 64, 100) +#if 0 + //LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 64, 100) /* exposed before but not too reliable either */ else if (stream->start_skip_samples) /* samples to skip in the first packet */ data->skip_samples = stream->start_skip_samples; @@ -404,7 +405,8 @@ ffmpeg_codec_data* init_ffmpeg_header_offset_subsong(STREAMFILE* sf, uint8_t* he VGM_ASSERT(stream->codecpar->trailing_padding > 0, "FFMPEG: trailing_padding %i\n", (int)stream->codecpar->trailing_padding); VGM_ASSERT(stream->codecpar->seek_preroll > 0, "FFMPEG: seek_preroll %i\n", (int)stream->codecpar->seek_preroll);//seek delay: OPUS VGM_ASSERT(stream->start_time > 0, "FFMPEG: start_time %i\n", (int)stream->start_time); //delay -#if 0 //LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 64, 100) +#if 0 + //LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 64, 100) VGM_ASSERT(stream->first_discard_sample > 0, "FFMPEG: first_discard_sample %i\n", (int)stream->first_discard_sample); //padding: MP3 VGM_ASSERT(stream->last_discard_sample > 0, "FFMPEG: last_discard_sample %i\n", (int)stream->last_discard_sample); //padding: MP3 VGM_ASSERT(stream->skip_samples > 0, "FFMPEG: skip_samples %i\n", (int)stream->skip_samples); //delay: MP4 diff --git a/src/formats.c b/src/formats.c index 2843ce84..527c4b66 100644 --- a/src/formats.c +++ b/src/formats.c @@ -1190,7 +1190,7 @@ static const meta_info meta_info_list[] = { {meta_DSP_DSPW, "Capcom DSPW header"}, {meta_PS2_JSTM, "JSTM Header"}, {meta_XVAG, "Sony XVAG header"}, - {meta_PS3_CPS, "tri-Crescendo CPS Header"}, + {meta_CPS, "tri-Crescendo CPS Header"}, {meta_SQEX_SCD, "Square-Enix SCD header"}, {meta_NGC_NST_DSP, "Animaniacs NST header"}, {meta_BAF, "Bizarre Creations .baf header"}, @@ -1249,7 +1249,7 @@ static const meta_info meta_info_list[] = { {meta_OGL, "Shin'en OGL header"}, {meta_MC3, "Paradigm MC3 header"}, {meta_GTD, "Hexadrive GHS/S_P_STH header"}, - {meta_TA_AAC, "tri-Ace AAC header"}, + {meta_AAC_TRIACE, "tri-Ace AAC header"}, {meta_MTA2, "Konami MTA2 header"}, {meta_NGC_ULW, "Criterion ULW raw header"}, {meta_XA_XA30, "Reflections XA30 header"}, @@ -1363,7 +1363,7 @@ static const meta_info meta_info_list[] = { {meta_PSF, "Pivotal PSF header"}, {meta_DSP_ITL_i, "Infernal .ITL DSP header"}, {meta_IMA, "Blitz Games .IMA header"}, - {meta_XMV_VALVE, "Valve XMV header"}, + {meta_XWV_VALVE, "Valve XWV header"}, {meta_UBI_HX, "Ubisoft HXx header"}, {meta_BMP_KONAMI, "Konami BMP header"}, {meta_ISB, "Creative ISACT header"}, diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 3c2ecd5d..c2e8e17b 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -289,7 +289,6 @@ - @@ -312,6 +311,7 @@ + @@ -368,6 +368,7 @@ + @@ -571,7 +572,6 @@ - @@ -605,6 +605,7 @@ + @@ -642,7 +643,6 @@ - @@ -691,7 +691,6 @@ - @@ -703,12 +702,10 @@ - - @@ -719,6 +716,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index bfeec779..5a6e6cd3 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -688,9 +688,6 @@ layout\Source Files - - layout\Source Files - layout\Source Files @@ -757,6 +754,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files @@ -925,6 +925,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files @@ -1534,9 +1537,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1636,6 +1636,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files @@ -1747,9 +1750,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1894,9 +1894,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1930,9 +1927,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1945,9 +1939,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1978,6 +1969,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/ta_aac.c b/src/meta/aac_triace.c similarity index 99% rename from src/meta/ta_aac.c rename to src/meta/aac_triace.c index 8560b404..95986a44 100644 --- a/src/meta/ta_aac.c +++ b/src/meta/aac_triace.c @@ -26,7 +26,7 @@ static int parse_aac(STREAMFILE* sf, aac_header* aac); /* AAC - tri-Ace (ASKA engine) Audio Container */ -VGMSTREAM* init_vgmstream_ta_aac(STREAMFILE* sf) { +VGMSTREAM* init_vgmstream_aac_triace(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; aac_header aac = {0}; @@ -46,7 +46,7 @@ VGMSTREAM* init_vgmstream_ta_aac(STREAMFILE* sf) { vgmstream = allocate_vgmstream(aac.channels, aac.loop_flag); if (!vgmstream) goto fail; - vgmstream->meta_type = meta_TA_AAC; + vgmstream->meta_type = meta_AAC_TRIACE; vgmstream->sample_rate = aac.sample_rate; vgmstream->num_streams = aac.total_subsongs; vgmstream->stream_size = aac.stream_size; diff --git a/src/meta/cps.c b/src/meta/cps.c new file mode 100644 index 00000000..071c5be0 --- /dev/null +++ b/src/meta/cps.c @@ -0,0 +1,50 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* CPS - tri-Crescendo games [Eternal Sonata (PS3)] */ +VGMSTREAM* init_vgmstream_cps(STREAMFILE* sf) { + VGMSTREAM* vgmstream = NULL; + off_t start_offset; + int loop_flag, channels; + + + /* checks */ + if (!is_id32be(0x00,sf, "CPS ")) + goto fail; + if (!check_extensions(sf,"cps")) + goto fail; + + start_offset = read_32bitBE(0x04,sf); + channels = read_32bitBE(0x08,sf); + loop_flag = read_32bitBE(0x18,sf); + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channels,loop_flag); + if (!vgmstream) goto fail; + + vgmstream->meta_type = meta_CPS; + vgmstream->channels = channels; + vgmstream->sample_rate = read_32bitBE(0x10,sf); + if (read_32bitBE(0x20,sf) == 0) { + vgmstream->coding_type = coding_PCM16BE; + vgmstream->layout_type = layout_interleave; + vgmstream->num_samples = pcm16_bytes_to_samples(read_32bitBE(0x0c,sf), channels); + vgmstream->interleave_block_size = 2; + } + else { + vgmstream->coding_type = coding_PSX; + vgmstream->layout_type = layout_interleave; + vgmstream->num_samples = ps_bytes_to_samples(read_32bitBE(0x0c,sf), channels); + vgmstream->interleave_block_size = 0x10; + vgmstream->loop_start_sample = ps_bytes_to_samples(read_32bitBE(0x14,sf), channels); + vgmstream->loop_end_sample = ps_bytes_to_samples(read_32bitBE(0x18,sf), channels); + } + + if (!vgmstream_open_stream(vgmstream, sf, start_offset)) + goto fail; + return vgmstream; + +fail: + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/meta/cxs.c b/src/meta/cxs.c index 7dfdc501..3cf02d58 100644 --- a/src/meta/cxs.c +++ b/src/meta/cxs.c @@ -1,7 +1,7 @@ #include "meta.h" #include "../coding/coding.h" -/* CXS - found in Eternal Sonata (X360) */ +/* CXS - tri-Crescendo games [Eternal Sonata (X360)] */ VGMSTREAM* init_vgmstream_cxs(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; off_t start_offset; @@ -50,7 +50,6 @@ VGMSTREAM* init_vgmstream_cxs(STREAMFILE* sf) { if (!vgmstream_open_stream(vgmstream, sf, start_offset)) goto fail; return vgmstream; - fail: close_vgmstream(vgmstream); return NULL; diff --git a/src/meta/meta.h b/src/meta/meta.h index b5d6d0c3..534a7793 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -485,7 +485,7 @@ VGMSTREAM * init_vgmstream_jstm(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_xvag(STREAMFILE* streamFile); -VGMSTREAM * init_vgmstream_ps3_cps(STREAMFILE* streamFile); +VGMSTREAM* init_vgmstream_cps(STREAMFILE* sf); VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE* streamFile); @@ -598,7 +598,7 @@ VGMSTREAM * init_vgmstream_mc3(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_gtd(STREAMFILE *streamFile); -VGMSTREAM* init_vgmstream_ta_aac(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_aac_triace(STREAMFILE* sf); VGMSTREAM * init_vgmstream_va3(STREAMFILE *streamFile); @@ -867,7 +867,7 @@ VGMSTREAM * init_vgmstream_nub_dsp(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_nub_idsp(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_nub_is14(STREAMFILE * streamFile); -VGMSTREAM * init_vgmstream_xmv_valve(STREAMFILE * streamFile); +VGMSTREAM* init_vgmstream_xwv_valve(STREAMFILE* sf); VGMSTREAM * init_vgmstream_ubi_hx(STREAMFILE * streamFile); @@ -919,8 +919,8 @@ VGMSTREAM* init_vgmstream_dsb(STREAMFILE* sf); VGMSTREAM* init_vgmstream_bsf(STREAMFILE* sf); -VGMSTREAM* init_vgmstream_xse_new(STREAMFILE* sf); -VGMSTREAM* init_vgmstream_xse_old(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf); VGMSTREAM* init_vgmstream_wady(STREAMFILE* sf); diff --git a/src/meta/ps3_cps.c b/src/meta/ps3_cps.c deleted file mode 100644 index 78e2a803..00000000 --- a/src/meta/ps3_cps.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "meta.h" -#include "../util.h" - -/* CPS (from Eternal Sonata) */ -VGMSTREAM * init_vgmstream_ps3_cps(STREAMFILE *streamFile) { - VGMSTREAM * vgmstream = NULL; - char filename[PATH_LIMIT]; - off_t start_offset; - - int loop_flag; - int channel_count; - - /* check extension, case insensitive */ - streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("cps",filename_extension(filename))) goto fail; - - /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x43505320) /* "CPS" */ - goto fail; - - loop_flag = read_32bitBE(0x18,streamFile); - - channel_count = read_32bitBE(0x8,streamFile); - - /* build the VGMSTREAM */ - vgmstream = allocate_vgmstream(channel_count,loop_flag); - if (!vgmstream) goto fail; - - /* fill in the vital statistics */ - start_offset = read_32bitBE(0x4,streamFile); - vgmstream->channels = channel_count; - vgmstream->sample_rate = read_32bitBE(0x10,streamFile); - if (read_32bitBE(0x20,streamFile)==0x00000000){ - vgmstream->coding_type = coding_PCM16BE; - vgmstream->num_samples = read_32bitBE(0xc,streamFile)/4; - vgmstream->interleave_block_size = 2; - } - else { - vgmstream->coding_type = coding_PSX; - vgmstream->num_samples = read_32bitBE(0xc,streamFile)*28/32; - vgmstream->interleave_block_size = 0x10; - } - - if (loop_flag) { - vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile)*28/32; - vgmstream->loop_end_sample = read_32bitBE(0x18,streamFile)*28/32; - } - - vgmstream->layout_type = layout_interleave; - vgmstream->meta_type = meta_PS3_CPS; - - /* open the file for reading */ - { - int i; - STREAMFILE * file; - file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); - if (!file) goto fail; - for (i=0;ich[i].streamfile = file; - - vgmstream->ch[i].channel_start_offset= - vgmstream->ch[i].offset=start_offset+ - vgmstream->interleave_block_size*i; - - } - } - - return vgmstream; - - /* clean up anything we may have opened */ -fail: - if (vgmstream) close_vgmstream(vgmstream); - return NULL; -} diff --git a/src/meta/xse.c b/src/meta/sdrh.c similarity index 97% rename from src/meta/xse.c rename to src/meta/sdrh.c index ebc26bb1..f353edaf 100644 --- a/src/meta/xse.c +++ b/src/meta/sdrh.c @@ -4,7 +4,7 @@ /* SDRH - banks for newer feelplus-related games [Mindjack (PS3/X360)] */ -VGMSTREAM* init_vgmstream_xse_new(STREAMFILE* sf) { +VGMSTREAM* init_vgmstream_sdrh_new(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; off_t start_offset, data_size, stream_size; int loop_flag = 0, channels, codec, sample_rate, seek_count; @@ -14,7 +14,7 @@ VGMSTREAM* init_vgmstream_xse_new(STREAMFILE* sf) { /* checks */ - if (!is_id32be(0x00,sf, "HRDS")) + if (!is_id32le(0x00,sf, "SDRH")) /* LE */ goto fail; if (!check_extensions(sf, "xse")) goto fail; @@ -150,8 +150,8 @@ fail: } -/* SDRH - banks for older feelplus-related games [Lost Odyssey (X360)] */ -VGMSTREAM* init_vgmstream_xse_old(STREAMFILE* sf) { +/* SDRH - banks for older feelplus-related games [Lost Odyssey (X360), Lost Odyssey Demo (X360)] */ +VGMSTREAM* init_vgmstream_sdrh_old(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; off_t start_offset, data_size, stream_size; int loop_flag = 0, channels, codec, sample_rate, seek_count; @@ -164,7 +164,7 @@ VGMSTREAM* init_vgmstream_xse_old(STREAMFILE* sf) { if (!is_id32be(0x00,sf, "SDRH")) goto fail; - /* .xse: assumed */ + /* .xse: actual extension (LO demo) */ if (!check_extensions(sf, "xse")) goto fail; diff --git a/src/meta/xwav.c b/src/meta/xwav.c index e25ccbc9..f0b7ed61 100644 --- a/src/meta/xwav.c +++ b/src/meta/xwav.c @@ -12,7 +12,7 @@ VGMSTREAM* init_vgmstream_xwav_new(STREAMFILE* sf) { /* checks */ - if (!is_id32be(0x00,sf, "VAWX")) + if (!is_id32le(0x00,sf, "XWAV")) goto fail; /* .xwv: actual extension [Moon Diver (PS3/X360)] @@ -137,7 +137,7 @@ VGMSTREAM* init_vgmstream_xwav_old(STREAMFILE* sf) { if (!is_id32be(0x00,sf, "XWAV")) goto fail; - /* .xwv: actual extension [Bullet Witch (X360)] */ + /* .xwv: actual extension [Bullet Witch (X360), Lost Odyssey Demo (X360)] */ if (!check_extensions(sf, "xwv")) goto fail; diff --git a/src/meta/xmv_valve.c b/src/meta/xwv_valve.c similarity index 98% rename from src/meta/xmv_valve.c rename to src/meta/xwv_valve.c index 65f605bb..eca6dc23 100644 --- a/src/meta/xmv_valve.c +++ b/src/meta/xwv_valve.c @@ -77,7 +77,7 @@ fail: /* XWV - from Valve games running on Source Engine, evolution of Xbox .WAV format seen above * [The Orange Box (X360), Portal 2 (PS3/X360), Counter-Strike: Global Offensive (PS3/X360)] */ -VGMSTREAM* init_vgmstream_xmv_valve(STREAMFILE* sf) { +VGMSTREAM* init_vgmstream_xwv_valve(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; int32_t loop_start; uint32_t start_offset, data_size, sample_rate, num_samples; @@ -126,7 +126,7 @@ VGMSTREAM* init_vgmstream_xmv_valve(STREAMFILE* sf) { vgmstream = allocate_vgmstream(channels, loop_flag); if (!vgmstream) goto fail; - vgmstream->meta_type = meta_XMV_VALVE; + vgmstream->meta_type = meta_XWV_VALVE; vgmstream->sample_rate = sample_rate; vgmstream->num_samples = num_samples; vgmstream->loop_start_sample = loop_start; diff --git a/src/vgmstream.c b/src/vgmstream.c index 61ce3f77..e589f63e 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -230,7 +230,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_dsp_dspw, init_vgmstream_jstm, init_vgmstream_xvag, - init_vgmstream_ps3_cps, + init_vgmstream_cps, init_vgmstream_sqex_scd, init_vgmstream_ngc_nst_dsp, init_vgmstream_baf, @@ -295,7 +295,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_ogl, init_vgmstream_mc3, init_vgmstream_gtd, - init_vgmstream_ta_aac, + init_vgmstream_aac_triace, init_vgmstream_va3, init_vgmstream_mta2, init_vgmstream_mta2_container, @@ -453,7 +453,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_nub_xma, init_vgmstream_nub_idsp, init_vgmstream_nub_is14, - init_vgmstream_xmv_valve, + init_vgmstream_xwv_valve, init_vgmstream_ubi_hx, init_vgmstream_bmp_konami, init_vgmstream_opus_opusnx, @@ -479,8 +479,8 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_zwv, init_vgmstream_dsb, init_vgmstream_bsf, - init_vgmstream_xse_new, - init_vgmstream_xse_old, + init_vgmstream_sdrh_new, + init_vgmstream_sdrh_old, init_vgmstream_wady, init_vgmstream_dsp_sqex, init_vgmstream_dsp_wiivoice, diff --git a/src/vgmstream.h b/src/vgmstream.h index af039365..1cb088fb 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -540,7 +540,7 @@ typedef enum { meta_NGC_NST_DSP, /* Animaniacs [NGC] */ meta_BAF, /* Bizarre Creations (Blur, James Bond) */ meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */ - meta_PS3_CPS, /* Eternal Sonata (PS3) */ + meta_CPS, meta_MSF, meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */ meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */ @@ -594,7 +594,7 @@ typedef enum { meta_OGL, /* Shin'en Wii/WiiU (Jett Rocket (Wii), FAST Racing NEO (WiiU)) */ meta_MC3, /* Paradigm games (T3 PS2, MX Rider PS2, MI: Operation Surma PS2) */ meta_GTD, - meta_TA_AAC, + meta_AAC_TRIACE, meta_MTA2, meta_NGC_ULW, /* Burnout 1 (GC only) */ meta_XA_XA30, @@ -707,7 +707,7 @@ typedef enum { meta_PSF, meta_DSP_ITL_i, meta_IMA, - meta_XMV_VALVE, + meta_XWV_VALVE, meta_UBI_HX, meta_BMP_KONAMI, meta_ISB,