From 543ff1d95362628a6bd6a2efc05cc30bd00556ff Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 24 Jun 2023 16:36:54 +0200 Subject: [PATCH] cleanup: rename s14_sss.c to raw_s14_sss.c --- src/formats.c | 2 +- src/meta/meta.h | 2 +- src/meta/myspd.c | 33 ++++++++++++++------------- src/meta/{s14_sss.c => raw_s14_sss.c} | 4 ++-- src/vgmstream.c | 2 +- 5 files changed, 22 insertions(+), 21 deletions(-) rename src/meta/{s14_sss.c => raw_s14_sss.c} (97%) diff --git a/src/formats.c b/src/formats.c index 429985e3..0ad4ddb9 100644 --- a/src/formats.c +++ b/src/formats.c @@ -1164,7 +1164,7 @@ static const meta_info meta_info_list[] = { {meta_WII_BNS, "Nintendo BNS header"}, {meta_WII_WAS, "Sumo Digital iSWS header"}, {meta_XBOX_HLWAV, "Half-Life 2 .WAV header"}, - {meta_MYSPD, "U-Sing .MYSPD header"}, + {meta_MYSPD, "Punchers Impact .MYSPD header"}, {meta_HIS, "Her Interactive HIS header"}, {meta_AST_MV, "MicroVision AST header"}, {meta_AST_MMV, "Marvelous AST header"}, diff --git a/src/meta/meta.h b/src/meta/meta.h index 1a601e61..ab0a58a4 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -444,7 +444,7 @@ VGMSTREAM * init_vgmstream_bnsf(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile); -VGMSTREAM * init_vgmstream_s14_sss(STREAMFILE* streamFile); +VGMSTREAM* init_vgmstream_raw_s14_sss(STREAMFILE* sf); VGMSTREAM * init_vgmstream_ps2_gcm(STREAMFILE* streamFile); diff --git a/src/meta/myspd.c b/src/meta/myspd.c index 373f2303..ac7cdb34 100644 --- a/src/meta/myspd.c +++ b/src/meta/myspd.c @@ -1,38 +1,39 @@ #include "meta.h" #include "../coding/coding.h" -/* .MYSPF - from U-Sing (Wii) */ -VGMSTREAM * init_vgmstream_myspd(STREAMFILE *streamFile) { - VGMSTREAM * vgmstream = NULL; - int loop_flag = 0, channel_count; - off_t start_offset; - size_t channel_size; - /* check extension, case insensitive */ - if (!check_extensions(streamFile,"myspd")) - goto fail; +/* .MYSPD - from U-Sing (Wii) */ +VGMSTREAM* init_vgmstream_myspd(STREAMFILE* sf) { + VGMSTREAM* vgmstream = NULL; + int loop_flag = 0, channels; + uint32_t start_offset, channel_size; - channel_count = 2; + /* checks */ + /* .myspd: actual extension */ + if (!check_extensions(sf,"myspd")) + return NULL; + + channels = 2; start_offset = 0x20; - channel_size = read_32bitBE(0x00,streamFile); + channel_size = read_s32be(0x00,sf); /* check size */ - if ((channel_size * channel_count + start_offset) != get_streamfile_size(streamFile)) + if (channel_size * channels + start_offset != get_streamfile_size(sf)) goto fail; /* build the VGMSTREAM */ - vgmstream = allocate_vgmstream(channel_count,loop_flag); + vgmstream = allocate_vgmstream(channels,loop_flag); if (!vgmstream) goto fail; - vgmstream->num_samples = ima_bytes_to_samples(channel_size*channel_count, channel_count); - vgmstream->sample_rate = read_32bitBE(0x04,streamFile); + vgmstream->num_samples = ima_bytes_to_samples(channel_size*channels, channels); + vgmstream->sample_rate = read_s32be(0x04,sf); vgmstream->meta_type = meta_MYSPD; vgmstream->coding_type = coding_IMA_int; vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = channel_size; - if (!vgmstream_open_stream(vgmstream,streamFile,start_offset)) + if (!vgmstream_open_stream(vgmstream,sf,start_offset)) goto fail; return vgmstream; diff --git a/src/meta/s14_sss.c b/src/meta/raw_s14_sss.c similarity index 97% rename from src/meta/s14_sss.c rename to src/meta/raw_s14_sss.c index 921e4e0d..a52c98b6 100644 --- a/src/meta/s14_sss.c +++ b/src/meta/raw_s14_sss.c @@ -6,7 +6,7 @@ static int test_interleave(STREAMFILE* sf, int channels, int interleave); /* .s14/.sss - headerless siren14 stream [The Idolm@ster (DS), Korogashi Puzzle Katamari Damacy (DS), Taiko no Tatsujin DS 1/2 (DS)] */ -VGMSTREAM* init_vgmstream_s14_sss(STREAMFILE* sf) { +VGMSTREAM* init_vgmstream_raw_s14_sss(STREAMFILE* sf) { VGMSTREAM* vgmstream = NULL; off_t start_offset = 0; int channels, loop_flag = 0, interleave; @@ -18,7 +18,7 @@ VGMSTREAM* init_vgmstream_s14_sss(STREAMFILE* sf) { } else if (check_extensions(sf,"s14")) { channels = 1; /* may have dual _0ch.s14 + _1ch.s14, needs .txtp */ } else { - goto fail; + return NULL; } /* raw siren comes in 3 frame sizes, try to guess the correct one */ diff --git a/src/vgmstream.c b/src/vgmstream.c index 1f6e5076..5303b1d9 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -552,7 +552,7 @@ init_vgmstream_t init_vgmstream_functions[] = { init_vgmstream_raw_snds, /* .snds raw SNDS IMA */ init_vgmstream_raw_wavm, /* .wavm raw xbox */ init_vgmstream_raw_pcm, /* .raw raw PCM */ - init_vgmstream_s14_sss, /* .s14/sss raw siren14 */ + init_vgmstream_raw_s14_sss, /* .s14/sss raw siren14 */ init_vgmstream_exakt_sc, /* .sc raw PCM */ init_vgmstream_zwdsp, /* fake format */ init_vgmstream_ps2_adm, /* weird non-constant PSX blocks */