diff --git a/ext_includes/clHCA.h b/ext_includes/clHCA.h index df2b71a8..dc72d39a 100644 --- a/ext_includes/clHCA.h +++ b/ext_includes/clHCA.h @@ -14,12 +14,12 @@ int clHCA_isOurFile(const void *data, unsigned int size); typedef struct clHCA clHCA; /* In case you wish to allocate and reset the structure on your own. */ -int clHCA_sizeof(); +int clHCA_sizeof(void); void clHCA_clear(clHCA *); void clHCA_done(clHCA *); /* Or you could let the library allocate it. */ -clHCA * clHCA_new(); +clHCA * clHCA_new(void); void clHCA_delete(clHCA *); /* Parses the HCA header. Must be called before any decoding may be performed, diff --git a/ext_libs/clHCA.c b/ext_libs/clHCA.c index 7d48cd2f..79ca3178 100644 --- a/ext_libs/clHCA.c +++ b/ext_libs/clHCA.c @@ -364,7 +364,7 @@ static void clHCA_destructor(clHCA* hca) { hca->is_valid = 0; } -int clHCA_sizeof() { +int clHCA_sizeof(void) { return sizeof(clHCA); } @@ -376,7 +376,7 @@ void clHCA_done(clHCA* hca) { clHCA_destructor(hca); } -clHCA* clHCA_new() { +clHCA* clHCA_new(void) { clHCA* hca = malloc(clHCA_sizeof()); if (hca) { clHCA_constructor(hca); @@ -1941,7 +1941,6 @@ static void imdct_transform(stChannel* ch, int subframe) { /* update output/imdct with overlapped window (lib fuses this with the above) */ { - unsigned int i; const float* dct = ch->spectra; //ch->dct; const float* prev = ch->imdct_previous; diff --git a/src/coding/coding.h b/src/coding/coding.h index c67f1975..41dd086f 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -35,12 +35,12 @@ void decode_rad_ima(VGMSTREAM* vgmstream, VGMSTREAMCHANNEL* stream, sample_t* ou void decode_rad_ima_mono(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_apple_ima4(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_fsb_ima(VGMSTREAM* vgmstream, VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); -void decode_wwise_ima(VGMSTREAM* vgmstream, VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); +void decode_wwise_ima(VGMSTREAM* vgmstream, VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_awc_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ubi_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_ubi_sce_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_h4m_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, uint16_t frame_format); -void decode_cd_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); +void decode_cd_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); size_t ima_bytes_to_samples(size_t bytes, int channels); size_t ms_ima_bytes_to_samples(size_t bytes, int block_align, int channels); size_t xbox_ima_bytes_to_samples(size_t bytes, int channels); @@ -118,13 +118,13 @@ size_t xa_bytes_to_samples(size_t bytes, int channels, int is_blocked, int is_fo /* ea_xa_decoder */ void decode_ea_xa(VGMSTREAMCHANNEL* stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int is_stereo); -void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); +void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_maxis_xa(VGMSTREAMCHANNEL* stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); int32_t ea_xa_bytes_to_samples(size_t bytes, int channels); /* ea_xas_decoder */ -void decode_ea_xas_v0(VGMSTREAMCHANNEL* stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); +void decode_ea_xas_v0(VGMSTREAMCHANNEL* stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ea_xas_v1(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); diff --git a/src/coding/compresswave_decoder_lib.c b/src/coding/compresswave_decoder_lib.c index 57aee8ff..770efc39 100644 --- a/src/coding/compresswave_decoder_lib.c +++ b/src/coding/compresswave_decoder_lib.c @@ -557,7 +557,7 @@ struct TCompressWaveData { //----------------------------------------------------------- //create -TCompressWaveData* TCompressWaveData_Create() { +TCompressWaveData* TCompressWaveData_Create(void) { TCompressWaveData* this = malloc(sizeof(TCompressWaveData)); if (!this) return NULL; #if 0 @@ -604,7 +604,7 @@ void TCompressWaveData_Free(TCompressWaveData* this) { //----------------------------------------------------------- //outpus 44100/16bit/stereo waveform to designed buffer -void TCompressWaveData_Rendering_ReadPress(TCompressWaveData* this, int32_t* RFlg, int32_t* LFlg) { +static void TCompressWaveData_Rendering_ReadPress(TCompressWaveData* this, int32_t* RFlg, int32_t* LFlg) { if (this->Hed.Channel == 2) { *RFlg = THuff_Read(this->RH); //STEREO *LFlg = THuff_Read(this->RH); @@ -615,7 +615,7 @@ void TCompressWaveData_Rendering_ReadPress(TCompressWaveData* this, int32_t* RFl } } -void TCompressWaveData_Rendering_WriteWave(TCompressWaveData* this, int16_t** buf1, int32_t RVol, int32_t LVol) { +static void TCompressWaveData_Rendering_WriteWave(TCompressWaveData* this, int16_t** buf1, int32_t RVol, int32_t LVol) { TLRWRITEBUFFER bbb = {0}; if (this->Hed.Sample == 44100) { //44100 STEREO/MONO diff --git a/src/coding/compresswave_decoder_lib.h b/src/coding/compresswave_decoder_lib.h index c2e438c7..ae53e2cc 100644 --- a/src/coding/compresswave_decoder_lib.h +++ b/src/coding/compresswave_decoder_lib.h @@ -7,7 +7,7 @@ typedef struct TCompressWaveData TCompressWaveData; void TCompressWaveData_GetLoopState(TCompressWaveData* this); void TCompressWaveData_SetLoopState(TCompressWaveData* this); -TCompressWaveData* TCompressWaveData_Create(); +TCompressWaveData* TCompressWaveData_Create(void); void TCompressWaveData_Free(TCompressWaveData* this); int TCompressWaveData_Rendering(TCompressWaveData* this, int16_t* buf, uint32_t Len); int TCompressWaveData_LoadFromStream(TCompressWaveData* this, STREAMFILE* ss); diff --git a/src/coding/ea_xa_decoder.c b/src/coding/ea_xa_decoder.c index f09cdc14..523f3731 100644 --- a/src/coding/ea_xa_decoder.c +++ b/src/coding/ea_xa_decoder.c @@ -30,7 +30,7 @@ static const int EA_XA_TABLE[20] = { }; /* EA XA v2 (always mono); like v1 but with "PCM samples" flag and doesn't add 128 on expand or clamp (pre-adjusted by the encoder?) */ -void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) { +void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { uint8_t frame_info; int32_t coef1, coef2; int i, sample_count, shift; @@ -60,7 +60,7 @@ void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspac coef2 = EA_XA_TABLE[(frame_info >> 4) + 4]; shift = (frame_info & 0x0F) + 8; - for (i=first_sample,sample_count=0; ioffset + 0x01 + i/2); @@ -84,7 +84,7 @@ void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspac } #if 0 -/* later PC games use float math, though in the end sounds basically the same (decompiled from various exes) */ +/* later PC games and EAAC use float math, though in the end sounds basically the same (decompiled from various exes) */ static const double XA_K0[16] = { 0.0, 0.9375, 1.796875, 1.53125 }; static const double XA_K1[16] = { 0.0, 0.0, -0.8125, -0.859375 }; /* code uses look-up table but it's equivalent to: @@ -125,7 +125,7 @@ static const uint32_t FLOAT_TABLE_INT[256] = { }; static const float* FLOAT_TABLE = (const float *)FLOAT_TABLE_INT; -void decode_ea_xa_v2(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) { +void decode_ea_xa_v2_f32(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { uint8_t frame_info; int i, sample_count, shift; diff --git a/src/coding/ea_xas_decoder.c b/src/coding/ea_xas_decoder.c index 37979dd1..6aa57f97 100644 --- a/src/coding/ea_xas_decoder.c +++ b/src/coding/ea_xas_decoder.c @@ -113,7 +113,7 @@ void decode_ea_xas_v1(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspa /* EA-XAS v0 (xas0), without complex layouts and closer to EA-XA. Somewhat based on daemon1's decoder. */ -void decode_ea_xas_v0(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) { +void decode_ea_xas_v0(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { uint8_t frame[0x13] = {0}; off_t frame_offset; int i, frames_in, samples_done = 0, sample_count = 0; diff --git a/src/coding/ffmpeg_decoder_custom_opus.c b/src/coding/ffmpeg_decoder_custom_opus.c index 463f3300..d5d97a3d 100644 --- a/src/coding/ffmpeg_decoder_custom_opus.c +++ b/src/coding/ffmpeg_decoder_custom_opus.c @@ -784,7 +784,7 @@ static ffmpeg_codec_data* init_ffmpeg_custom_opus(STREAMFILE* sf, off_t start_of return init_ffmpeg_custom_opus_config(sf, start_offset, data_size, &cfg, type); } -ffmpeg_codec_data* init_ffmpeg_custom_table_opus(STREAMFILE* sf, off_t table_offset, int table_count, off_t data_offset, size_t data_size, int channels, int skip, int sample_rate, opus_type_t type) { +static ffmpeg_codec_data* init_ffmpeg_custom_table_opus(STREAMFILE* sf, off_t table_offset, int table_count, off_t data_offset, size_t data_size, int channels, int skip, int sample_rate, opus_type_t type) { opus_config cfg = {0}; cfg.channels = channels; cfg.skip = skip; diff --git a/src/coding/g7221_decoder_aes.c b/src/coding/g7221_decoder_aes.c index dfdfd4f0..7d3560c1 100644 --- a/src/coding/g7221_decoder_aes.c +++ b/src/coding/g7221_decoder_aes.c @@ -302,7 +302,7 @@ static void aes_decrypt_block(s14aes_handle* ctx, uint8_t* buf) { /* **************************** */ -s14aes_handle* s14aes_init() { +s14aes_handle* s14aes_init(void) { s14aes_handle* ctx = malloc(sizeof(s14aes_handle)); if (!ctx) goto fail; diff --git a/src/coding/g7221_decoder_aes.h b/src/coding/g7221_decoder_aes.h index 7f8d6dbe..4176ae25 100644 --- a/src/coding/g7221_decoder_aes.h +++ b/src/coding/g7221_decoder_aes.h @@ -6,7 +6,7 @@ typedef struct s14aes_handle s14aes_handle; /* init/close handle (AES-192 in ECB mode) */ -s14aes_handle* s14aes_init(); +s14aes_handle* s14aes_init(void); void s14aes_close(s14aes_handle* ctx); diff --git a/src/coding/ima_decoder.c b/src/coding/ima_decoder.c index a0b4599f..14f14a1d 100644 --- a/src/coding/ima_decoder.c +++ b/src/coding/ima_decoder.c @@ -983,7 +983,7 @@ void decode_fsb_ima(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample_t * } /* mono XBOX-IMA with header endianness and alt nibble expand (verified vs AK test demos) */ -void decode_wwise_ima(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) { +void decode_wwise_ima(VGMSTREAM* vgmstream, VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { int i, sample_count = 0, num_frame; int32_t hist1 = stream->adpcm_history1_32; int step_index = stream->adpcm_step_index; @@ -1242,7 +1242,7 @@ static inline int _clamp_s32(int value, int min, int max) { /* Crystal Dynamics IMA. Original code uses mind-bending intrinsics, so this may not be fully accurate. * Has another table with delta_table MMX combos, and uses header sample (first nibble is always 0). */ -void decode_cd_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) { +void decode_cd_ima(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { uint8_t frame[0x24] = {0}; int i, frames_in, sample_pos = 0, block_samples, frame_size; int32_t hist1 = stream->adpcm_history1_32; diff --git a/src/coding/mpeg_decoder.c b/src/coding/mpeg_decoder.c index 57d37579..d158f823 100644 --- a/src/coding/mpeg_decoder.c +++ b/src/coding/mpeg_decoder.c @@ -8,7 +8,7 @@ #define MPEG_DATA_BUFFER_SIZE 0x1000 /* at least one MPEG frame (max ~0x5A1 plus some more in case of free bitrate) */ -static mpg123_handle* init_mpg123_handle(); +static mpg123_handle* init_mpg123_handle(void); static void decode_mpeg_standard(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data, sample_t* outbuf, int32_t samples_to_do, int channels); static void decode_mpeg_custom(VGMSTREAM* vgmstream, mpeg_codec_data* data, sample_t* outbuf, int32_t samples_to_do, int channels); static void decode_mpeg_custom_stream(VGMSTREAMCHANNEL *stream, mpeg_codec_data* data, int num_stream); @@ -184,7 +184,7 @@ fail: } -static mpg123_handle* init_mpg123_handle() { +static mpg123_handle* init_mpg123_handle(void) { mpg123_handle* m = NULL; int rc; diff --git a/src/coding/ubi_adpcm_decoder.c b/src/coding/ubi_adpcm_decoder.c index ab44efd1..0d7be9ef 100644 --- a/src/coding/ubi_adpcm_decoder.c +++ b/src/coding/ubi_adpcm_decoder.c @@ -455,7 +455,7 @@ static void decode_subframe_stereo(ubi_adpcm_channel_data* ch0_state, ubi_adpcm_ * 0xA82557DB LE = 1010 100000 100101 010101 111101 1011 ... (where last 00 | first 1010 = 001010), etc * Codes aren't signed but rather have a particular meaning (see decoding). */ -void unpack_codes(uint8_t* data, uint8_t* codes, int code_count, int bps) { +static void unpack_codes(uint8_t* data, uint8_t* codes, int code_count, int bps) { int i; size_t pos = 0; uint64_t bits = 0, input = 0; diff --git a/src/coding/ws_decoder.c b/src/coding/ws_decoder.c index b72193dc..3dc530a2 100644 --- a/src/coding/ws_decoder.c +++ b/src/coding/ws_decoder.c @@ -135,6 +135,8 @@ void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channels samples_left_in_frame--) { /* done with reading a sample */ outbuf[sample_count]=(hist-0x80)*0x100; } + default: + break; } } } diff --git a/src/decode.c b/src/decode.c index 08b1bb70..9038086d 100644 --- a/src/decode.c +++ b/src/decode.c @@ -1012,7 +1012,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_ case coding_EA_XA_V2: for (ch = 0; ch < vgmstream->channels; ch++) { decode_ea_xa_v2(&vgmstream->ch[ch], buffer+ch, - vgmstream->channels, vgmstream->samples_into_block, samples_to_do, ch); + vgmstream->channels, vgmstream->samples_into_block, samples_to_do); } break; case coding_MAXIS_XA: @@ -1024,7 +1024,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_ case coding_EA_XAS_V0: for (ch = 0; ch < vgmstream->channels; ch++) { decode_ea_xas_v0(&vgmstream->ch[ch], buffer+ch, - vgmstream->channels, vgmstream->samples_into_block, samples_to_do, ch); + vgmstream->channels, vgmstream->samples_into_block, samples_to_do); } break; case coding_EA_XAS_V1: @@ -1188,7 +1188,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_ case coding_WWISE_IMA: for (ch = 0; ch < vgmstream->channels; ch++) { decode_wwise_ima(vgmstream,&vgmstream->ch[ch], buffer+ch, - vgmstream->channels, vgmstream->samples_into_block, samples_to_do, ch); + vgmstream->channels, vgmstream->samples_into_block, samples_to_do); } break; case coding_REF_IMA: @@ -1227,7 +1227,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_ case coding_CD_IMA: for (ch = 0; ch < vgmstream->channels; ch++) { decode_cd_ima(&vgmstream->ch[ch], buffer+ch, - vgmstream->channels, vgmstream->samples_into_block, samples_to_do, ch); + vgmstream->channels, vgmstream->samples_into_block, samples_to_do); } break; diff --git a/src/layout/blocked_awc.c b/src/layout/blocked_awc.c index 3504e1d7..a2dda815 100644 --- a/src/layout/blocked_awc.c +++ b/src/layout/blocked_awc.c @@ -4,7 +4,7 @@ #include "../vgmstream.h" -static size_t get_channel_header_size(STREAMFILE* sf, off_t offset, int channels, int big_endian); +static size_t get_channel_header_size(STREAMFILE* sf, off_t offset, int big_endian); static size_t get_block_header_size(STREAMFILE* sf, off_t offset, size_t channel_header_size, int channels, int big_endian); /* AWC music chunks */ @@ -38,7 +38,7 @@ void block_update_awc(off_t block_offset, VGMSTREAM * vgmstream) { * 32b * entries = global samples per frame in each block (for MPEG probably per full frame) */ - channel_header_size = get_channel_header_size(sf, block_offset, vgmstream->channels, vgmstream->codec_endian); + channel_header_size = get_channel_header_size(sf, block_offset, vgmstream->codec_endian); header_size = get_block_header_size(sf, block_offset, channel_header_size, vgmstream->channels, vgmstream->codec_endian); for (i = 0; i < vgmstream->channels; i++) { vgmstream->ch[i].offset = block_offset + header_size + 0x800*entries*i; @@ -47,7 +47,7 @@ void block_update_awc(off_t block_offset, VGMSTREAM * vgmstream) { } -static size_t get_channel_header_size(STREAMFILE* sf, off_t offset, int channels, int big_endian) { +static size_t get_channel_header_size(STREAMFILE* sf, off_t offset, int big_endian) { int32_t (*read_32bit)(off_t,STREAMFILE*) = big_endian ? read_32bitBE : read_32bitLE; /* later games have an smaller channel header, try to detect using diff --git a/src/meta/acb.c b/src/meta/acb.c index 0acad0a8..69737494 100644 --- a/src/meta/acb.c +++ b/src/meta/acb.c @@ -91,7 +91,7 @@ fail: #define ACB_MAX_NAME 1024 /* even more is possible in rare cases [Senran Kagura Burst Re:Newal (PC)] */ -STREAMFILE* setup_acb_streamfile(STREAMFILE* sf, size_t buffer_size) { +static STREAMFILE* setup_acb_streamfile(STREAMFILE* sf, size_t buffer_size) { STREAMFILE* new_sf = NULL; /* buffer seems better than reopening when opening multiple subsongs at the same time with STDIO, diff --git a/src/meta/adx.c b/src/meta/adx.c index 111e10d0..3d127145 100644 --- a/src/meta/adx.c +++ b/src/meta/adx.c @@ -274,7 +274,7 @@ static int find_adx_key(STREAMFILE* sf, uint8_t type, uint16_t *xor_start, uint1 key_size = read_key_file(keybuf, sizeof(keybuf), sf); if (key_size > 0) { - int i, is_ascii = 0; + int is_ascii = 0; /* keystrings should be ASCII, also needed to tell apart 0x06 strings from derived keys */ if (type == 8) { diff --git a/src/meta/ea_eaac.c b/src/meta/ea_eaac.c index 90296a55..814a4473 100644 --- a/src/meta/ea_eaac.c +++ b/src/meta/ea_eaac.c @@ -508,7 +508,7 @@ fail: } /* open map/mpf+mus pairs that aren't exact pairs, since EA's games can load any combo */ -static STREAMFILE *open_mapfile_pair(STREAMFILE* sf, int track, int num_tracks) { +static STREAMFILE *open_mapfile_pair(STREAMFILE* sf, int track /*, int num_tracks*/) { static const char *const mapfile_pairs[][2] = { /* standard cases, replace map part with mus part (from the end to preserve prefixes) */ {"game.mpf", "Game_Stream.mus"}, /* Skate 1/2/3 */ @@ -685,7 +685,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) { } /* open MUS file that matches this track */ - musFile = open_mapfile_pair(sf, i, num_tracks); + musFile = open_mapfile_pair(sf, i);//, num_tracks if (!musFile) goto fail; @@ -1136,6 +1136,8 @@ static VGMSTREAM* init_vgmstream_eaaudiocore_header(STREAMFILE* sf_head, STREAMF eaac.loop_offset = read_32bitBE(header_offset + 0x10, sf_head); } break; + default: + goto fail; } /* get data offsets */ @@ -1151,6 +1153,8 @@ static VGMSTREAM* init_vgmstream_eaaudiocore_header(STREAMFILE* sf_head, STREAMF eaac.prefetch_offset = header_offset + header_size; eaac.stream_offset = start_offset; break; + default: + goto fail; } } else { eaac.stream_offset = header_offset - 0x04 + header_block_size; @@ -1340,7 +1344,7 @@ static VGMSTREAM* init_vgmstream_eaaudiocore_header(STREAMFILE* sf_head, STREAMF #ifdef VGM_USE_MPEG - case EAAC_CODEC_EAMP3: { /* "EM30": EA-MP3 [Need for Speed 2015 (PS4)] */ + case EAAC_CODEC_EAMP3: { /* "EM30": EA-MP3 [Need for Speed 2015 (PS4), FIFA 2021 (PC)] */ mpeg_custom_config cfg = {0}; temp_sf = setup_eaac_audio_streamfile(sf, eaac.version, eaac.codec, eaac.streamed,0,0, 0x00); @@ -1551,6 +1555,8 @@ static STREAMFILE *setup_eaac_streamfile(eaac_header *ea, STREAMFILE* sf_head, S sf_segments[0] = NULL; sf_segments[1] = NULL; break; + default: + goto fail; } } else { data_size = calculate_eaac_size(sf_head, ea, ea->num_samples, ea->stream_offset, 0); @@ -1603,29 +1609,29 @@ static segmented_layout_data* build_segmented_eaaudiocore_looping(STREAMFILE *sf switch(eaac->codec) { #ifdef VGM_USE_FFMPEG - case EAAC_CODEC_EAXMA: { - eaac_header temp_eaac = *eaac; /* equivalent to memcpy... I think */ - temp_eaac.loop_flag = 0; - temp_eaac.num_samples = num_samples[i]; + case EAAC_CODEC_EAXMA: { + eaac_header temp_eaac = *eaac; /* equivalent to memcpy... I think */ + temp_eaac.loop_flag = 0; + temp_eaac.num_samples = num_samples[i]; - start_offset = 0x00; /* must point to the custom streamfile's beginning */ + start_offset = 0x00; /* must point to the custom streamfile's beginning */ - /* layers inside segments, how trippy */ - data->segments[i]->layout_data = build_layered_eaaudiocore(sf_data, &temp_eaac, offsets[i]); - if (!data->segments[i]->layout_data) goto fail; - data->segments[i]->coding_type = coding_FFmpeg; - data->segments[i]->layout_type = layout_layered; - break; - } + /* layers inside segments, how trippy */ + data->segments[i]->layout_data = build_layered_eaaudiocore(sf_data, &temp_eaac, offsets[i]); + if (!data->segments[i]->layout_data) goto fail; + data->segments[i]->coding_type = coding_FFmpeg; + data->segments[i]->layout_type = layout_layered; + break; + } #endif - case EAAC_CODEC_XAS1: { - start_offset = offsets[i]; + case EAAC_CODEC_XAS1: { + start_offset = offsets[i]; - data->segments[i]->coding_type = coding_EA_XAS_V1; - data->segments[i]->layout_type = layout_blocked_ea_sns; - break; - } + data->segments[i]->coding_type = coding_EA_XAS_V1; + data->segments[i]->layout_type = layout_blocked_ea_sns; + break; + } #ifdef VGM_USE_MPEG case EAAC_CODEC_EALAYER3_V1: @@ -1689,8 +1695,8 @@ static layered_layout_data* build_layered_eaaudiocore(STREAMFILE *sf_data, eaac_ data->layers[i]->loop_start_sample = eaac->loop_start; data->layers[i]->loop_end_sample = eaac->loop_end; -#ifdef VGM_USE_FFMPEG switch(eaac->codec) { +#ifdef VGM_USE_FFMPEG /* EA-XMA uses completely separate 1/2ch streams, unlike standard XMA that interleaves 1/2ch * streams with a skip counter to reinterleave (so EA-XMA streams don't have skips set) */ case EAAC_CODEC_EAXMA: { @@ -1743,11 +1749,10 @@ static layered_layout_data* build_layered_eaaudiocore(STREAMFILE *sf_data, eaac_ data->layers[i]->layout_type = layout_none; break; } - - } -#else - goto fail; #endif + default: + goto fail; + } if (!vgmstream_open_stream(data->layers[i], temp_sf, 0x00)) { goto fail; diff --git a/src/meta/ea_schl.c b/src/meta/ea_schl.c index 34fb731a..292f78a4 100644 --- a/src/meta/ea_schl.c +++ b/src/meta/ea_schl.c @@ -637,7 +637,7 @@ fail: /* open map/mpf+mus pairs that aren't exact pairs, since EA's games can load any combo */ -static STREAMFILE* open_mapfile_pair(STREAMFILE* sf, int track, int num_tracks) { +static STREAMFILE* open_mapfile_pair(STREAMFILE* sf, int track /*, int num_tracks*/) { static const char *const mapfile_pairs[][2] = { /* standard cases, replace map part with mus part (from the end to preserve prefixes) */ {"MUS_CTRL.MPF", "MUS_STR.MUS"}, /* GoldenEye - Rogue Agent (PS2) */ @@ -760,7 +760,7 @@ VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) { version = read_8bit(0x04, sf); if (version > 1) goto fail; - sf_mus = open_mapfile_pair(sf, 0, 1); + sf_mus = open_mapfile_pair(sf, 0); //, 1 if (!sf_mus) goto fail; /* @@ -994,7 +994,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) { goto fail; /* open MUS file that matches this track */ - sf_mus = open_mapfile_pair(sf, i, num_tracks); + sf_mus = open_mapfile_pair(sf, i); //, num_tracks if (!sf_mus) goto fail; diff --git a/src/meta/ubi_sb.c b/src/meta/ubi_sb.c index 819e512b..d63a0845 100644 --- a/src/meta/ubi_sb.c +++ b/src/meta/ubi_sb.c @@ -207,7 +207,7 @@ static int parse_dat_header(ubi_sb_header *sb, STREAMFILE *sf); static int parse_header(ubi_sb_header* sb, STREAMFILE* sf, off_t offset, int index); static int parse_sb(ubi_sb_header* sb, STREAMFILE* sf, int target_subsong); static VGMSTREAM* init_vgmstream_ubi_sb_header(ubi_sb_header* sb, STREAMFILE* sf_index, STREAMFILE* sf); -static VGMSTREAM *init_vgmstream_ubi_sb_silence(ubi_sb_header *sb, STREAMFILE *sf_index, STREAMFILE *sf); +static VGMSTREAM *init_vgmstream_ubi_sb_silence(ubi_sb_header *sb); static int config_sb_platform(ubi_sb_header* sb, STREAMFILE* sf); static int config_sb_version(ubi_sb_header* sb, STREAMFILE* sf); @@ -542,7 +542,7 @@ static int parse_ubi_bank_header(ubi_sb_header *sb, ubi_sb_header *sb_other, STR return 0; } -static void get_ubi_bank_name(ubi_sb_header *sb, STREAMFILE *sf, int bank_number, char *bank_name) { +static void get_ubi_bank_name(ubi_sb_header *sb, int bank_number, char *bank_name) { if (sb->is_bnm) { sprintf(bank_name, "Bnk_%d.bnm", bank_number); } else if (sb->is_dat) { @@ -559,7 +559,7 @@ static int is_other_bank(ubi_sb_header *sb, STREAMFILE *sf, int bank_number) { char bank_name[255]; get_streamfile_filename(sf, current_name, PATH_LIMIT); - get_ubi_bank_name(sb, sf, bank_number, bank_name); + get_ubi_bank_name(sb, bank_number, bank_name); return strcmp(current_name, bank_name) != 0; } @@ -647,7 +647,7 @@ static VGMSTREAM *init_vgmstream_ubi_dat_main(ubi_sb_header *sb, STREAMFILE *sf_ VGM_LOG("UBI DAT: external stream '%s' not found\n", sb->resource_name); strncat(sb->readable_name, " (missing)", sizeof(sb->readable_name)); sb->duration = (float)pcm_bytes_to_samples(sb->stream_size, sb->channels, 16) / (float)sb->sample_rate; - return init_vgmstream_ubi_sb_silence(sb, sf_index, sf); + return init_vgmstream_ubi_sb_silence(sb); } } @@ -1438,7 +1438,7 @@ static VGMSTREAM* init_vgmstream_ubi_sb_sequence(ubi_sb_header* sb, STREAMFILE* if (sf_bank != sf_index) close_streamfile(sf_bank); - get_ubi_bank_name(sb, sf, sb->sequence_banks[i], bank_name); + get_ubi_bank_name(sb, sb->sequence_banks[i], bank_name); sf_bank = open_streamfile_by_filename(sf, bank_name); /* may be worth trying in localized folder? */ @@ -1529,7 +1529,7 @@ fail: } -static VGMSTREAM* init_vgmstream_ubi_sb_silence(ubi_sb_header* sb, STREAMFILE* sf_index, STREAMFILE* sf) { +static VGMSTREAM* init_vgmstream_ubi_sb_silence(ubi_sb_header* sb) { VGMSTREAM* vgmstream = NULL; int channels, sample_rate; int32_t num_samples; @@ -1585,7 +1585,7 @@ static VGMSTREAM* init_vgmstream_ubi_sb_header(ubi_sb_header* sb, STREAMFILE* sf break; case UBI_SILENCE: - vgmstream = init_vgmstream_ubi_sb_silence(sb, sf_index, sf); + vgmstream = init_vgmstream_ubi_sb_silence(sb); break; case UBI_NONE: